[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kdeprint/kdeprintfax
From:       Michael Goffioul <kdeprint () swing ! be>
Date:       2004-03-30 8:33:04
Message-ID: 20040330083304.96BCF99D9 () office ! kde ! org
[Download RAW message or body]

CVS commit by goffioul: 

Allow arbitrary fax modem to be used (bug #78685)


  M +38 -5     confsystem.cpp   1.12
  M +2 -1      confsystem.h   1.4


--- kdebase/kdeprint/kdeprintfax/confsystem.cpp  #1.11:1.12
@@ -66,4 +66,8 @@ ConfSystem::ConfSystem(QWidget *parent, 
         for (int i=0; i<10; i++)
                 m_device->insertItem(i18n("Serial Port #%1").arg(i));
+        m_device->insertItem( i18n( "Other" ) );
+        connect( m_device, SIGNAL( activated( int ) ), SLOT( slotDeviceChanged( int \
) ) ); +        m_device_edit = new QLineEdit( m_dummy2 );
+        slotDeviceChanged( 0 );
 
         KSeparator      *sep = new KSeparator(this);
@@ -85,7 +89,9 @@ ConfSystem::ConfSystem(QWidget *parent, 
         l4->addWidget(srvlabel, 0);
         l4->addWidget(m_server, 1);
-        QHBoxLayout     *l5 = new QHBoxLayout(m_dummy2, 0, 10);
-        l5->addWidget(devlabel, 0);
-        l5->addWidget(m_device, 1);
+        QGridLayout     *l5 = new QGridLayout( m_dummy2, 2, 2, 0, 10 );
+        l5->setColStretch( 1, 1 );
+        l5->addWidget(devlabel, 0, 0);
+        l5->addWidget(m_device, 0, 1);
+        l5->addWidget( m_device_edit, 1, 1 );
 } 
  
@@ -108,6 +114,12 @@ void ConfSystem::load() 
         if (v.startsWith("ttyS"))
                 m_device->setCurrentItem(v.right(v.length()-4).toInt()+1);
-        else
+        else if ( v == "modem" )
                 m_device->setCurrentItem(0);
+        else
+        {
+                m_device->setCurrentItem( m_device->count()-1 );
+                m_device_edit->setText( "/dev/" + v );
+                slotDeviceChanged( m_device->count()-1 );
+        }
 
         m_system->setCurrentItem(m_current);
@@ -146,5 +158,14 @@ void ConfSystem::save()
         }
         conf->setGroup("Fax");
+        if ( m_device->currentItem() != ( m_device->count()-1 ) )
         conf->writeEntry("Device", m_device->currentItem() == 0 ? QString("modem") : \
QString("ttyS%1").arg(m_device->currentItem()-1)); +        else
+        {
+                QString dev = m_device_edit->text();
+                // strip leading "/dev/"
+                if ( dev.startsWith( "/dev/" ) )
+                        dev = dev.mid( 5 );
+                conf->writeEntry( "Device", dev );
+        }
         if (m_server->text().isEmpty())
                 conf->deleteEntry("Server");
@@ -168,3 +189,15 @@ void ConfSystem::slotSystemChanged(int I
 }
 
+void ConfSystem::slotDeviceChanged( int ID )
+{
+//      if ( ID == 0 )
+//              m_device_edit->setText( "/dev/modem" );
+//      else if ( ID != ( m_device->count()-1 ) )
+//              m_device_edit->setText( QString( "/dev/ttyS%1" ).arg( ID-1 ) );
+        if ( ID != ( m_device->count()-1 ) )
+                m_device_edit->hide();
+        else
+                m_device_edit->show();
+}
+
 #include "confsystem.moc"

--- kdebase/kdeprint/kdeprintfax/confsystem.h  #1.3:1.4
@@ -39,8 +39,9 @@ public:
 protected slots:
         void slotSystemChanged(int);
+        void slotDeviceChanged(int);
 
 private:
         QComboBox       *m_system, *m_device;
-        QLineEdit       *m_command, *m_server;
+        QLineEdit       *m_command, *m_server, *m_device_edit;
         QStringList     m_commands;
         int             m_current;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic