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

List:       kde-commits
Subject:    playground/network/ksniffer
From:       Giovanni Venturi <gventuri73 () tiscali ! it>
Date:       2008-10-11 20:47:59
Message-ID: 1223758079.571452.27087.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 870133 by gianni:

a better solution to remember the last choice of "New Capture" dialog


 M  +10 -6     capturedialog.cpp  
 M  +2 -2      capturedialog.h  
 M  +2 -5      ksniffer.cpp  
 M  +1 -1      ksniffer.h  


--- trunk/playground/network/ksniffer/capturedialog.cpp #870132:870133
@@ -148,18 +148,22 @@
 }
 
 
-int CaptureDialog::currentInterfaceIndex() const
+QString CaptureDialog::currentInterfaceText() const
 {
-  return m_interface->currentItem();
+  return m_interface->currentText();
 }
 
 
-void CaptureDialog::setCurrentInterfaceIndex( const int& iddev )
+void CaptureDialog::setCurrentInterfaceText( const QString& iddev )
 {
-  // I can assign the iddev index just if it's in the combobox range
-  if (m_interface->count() - 1 >= iddev)
+  int i = 0;
+
+  // I can assign the iddev text just if it's in the combobox items
+  while ((m_interface->text(i) != iddev) && (i < m_interface->count() - 1))
+    i++;
+  if (m_interface->text(i) == iddev)
   {
-    m_interface->setCurrentItem(iddev);
+    m_interface->setCurrentItem(i);
     setData( m_interface->currentText() );
   }
 }
--- trunk/playground/network/ksniffer/capturedialog.h #870132:870133
@@ -51,8 +51,8 @@
    */
   QString selectedInterface() const { return m_strUsedInterface; };
 
-  int currentInterfaceIndex() const;
-  void setCurrentInterfaceIndex( const int& iddev );
+  QString currentInterfaceText() const;
+  void setCurrentInterfaceText( const QString& iddev );
 
 protected slots:
   /**
--- trunk/playground/network/ksniffer/ksniffer.cpp #870132:870133
@@ -204,9 +204,6 @@
   // delete the splash if it's been used
   if (splash)
     delete splash;
-
-  // assign the first element into the interface combobox
-  m_currentInterfaceIndex = 0;
 }
 
 
@@ -520,11 +517,11 @@
   changeStatusbar( i18n("New Capture: select the network interface to start sniffing \
packets.") );  
   CaptureDialog *cod = new CaptureDialog( this );
-  cod->setCurrentInterfaceIndex(m_currentInterfaceIndex);
+  cod->setCurrentInterfaceText(m_currentInterfaceText);
 
   if (cod->exec())
   {
-    m_currentInterfaceIndex = cod->currentInterfaceIndex();
+    m_currentInterfaceText = cod->currentInterfaceText();
     // something can be chand, so read again options
     //  - set into m_options the sniffer options (ShowAfter, TrayBar, TmpDirectory, \
Warn, PassivePopUp, ShowSplash)  m_ksnifferConfig->getOptions( m_options );
--- trunk/playground/network/ksniffer/ksniffer.h #870132:870133
@@ -222,7 +222,7 @@
   /**
    * is the current selected interface assigned by the combobox
    */
-  int m_currentInterfaceIndex;
+  QString m_currentInterfaceText;
 };
 
 #endif // KSNIFFER_H


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

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