[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Fri May 30 00:45:46 CEST 2008


SVN commit 814315 by asimha:

Improvisations to the find dialog:

+ Adding a flag that keeps track of whether the List view was updated
after changing the text filter.

+ Ensure that the List view has been updated before calling accept()
or checking for existance of the selected object.

CCMAIL: kstars-devel at kde.org



 M  +9 -0      finddialog.cpp  
 M  +1 -0      finddialog.h  


--- trunk/KDE/kdeedu/kstars/kstars/finddialog.cpp #814314:814315
@@ -74,6 +74,8 @@
 
     // first create and paint dialog and then load list
     QTimer::singleShot(0, this, SLOT( init() ));
+
+    listFiltered = false;
 }
 
 FindDialog::~FindDialog() {
@@ -189,6 +191,8 @@
             button( Ok )->setEnabled( true );
         }
     }
+
+    listFiltered = true;
 }
 
 void FindDialog::filterByType( int /*f*/ ) {
@@ -219,6 +223,8 @@
             button( Ok )->setEnabled( true );
         }
     }
+
+    listFiltered = true;
 }
 
 SkyObject* FindDialog::selectedObject() const {
@@ -234,6 +240,7 @@
 }
 
 void FindDialog::enqueueSearch() {
+    listFiltered = false;
     if ( timer ) {
         timer->stop();
     } else {
@@ -246,6 +253,8 @@
 
 void FindDialog::slotOk() {
     //If no valid object selected, show a sorry-box.  Otherwise, emit accept()
+    if(!listFiltered)
+        filterByName();
     if ( selectedObject() == 0 ) {
         QString message = i18n( "No object named %1 found.", ui->SearchBox->text() );
         KMessageBox::sorry( 0, message, i18n( "Bad object name" ) );
--- trunk/KDE/kdeedu/kstars/kstars/finddialog.h #814314:814315
@@ -112,6 +112,7 @@
     QStringListModel *fModel;
     QSortFilterProxyModel* sortModel;
     QTimer* timer;
+    bool listFiltered;
 };
 
 #endif


More information about the Kstars-devel mailing list