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

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/dialogs
From:       Jason Kivlighn <confederacy2 () excite ! com>
Date:       2004-04-29 3:08:27
Message-ID: 20040429030827.F183C9A30 () office ! kde ! org
[Download RAW message or body]

CVS commit by jkivlighn: 

Use a KreListView instead of providing our own listview for filtering


  M +5 -19     usdadatadialog.cpp   1.6
  M +0 -1      usdadatadialog.h   1.2


--- kdenonbeta/krecipes/src/dialogs/usdadatadialog.h  #1.1:1.2
@@ -44,5 +44,4 @@ private:
 
 private slots:
-        void filter(const QString &);
         void importSelected();
 };

--- kdenonbeta/krecipes/src/dialogs/usdadatadialog.cpp  #1.5:1.6
@@ -27,4 +27,5 @@
 #include "DBBackend/recipedb.h"
 #include "DBBackend/usda_property_data.h"
+#include "widgets/krelistview.h"
 
 USDADataDialog::USDADataDialog( const Element &ing, RecipeDB *db, QWidget *parent ) \
: KDialog(parent,0,true), @@ -37,10 +38,7 @@ USDADataDialog::USDADataDialog( const El
 
         QVBox *left_box = new QVBox(this);
+        KreListView *krelistview = new KreListView(left_box, QString::null, true, \
0);  
-        QHBox *search_hbox = new QHBox(left_box);
-        QLabel *search_label = new QLabel( i18n("Search: "), search_hbox );
-        search_edit = new KLineEdit(search_hbox);
-
-        listView = new KListView(left_box);
+        listView = krelistview->listView();
         listView->addColumn(i18n("USDA Ingredient"));
         listView->addColumn(i18n("Id"));
@@ -61,5 +59,4 @@ USDADataDialog::USDADataDialog( const El
         loadDataFromFile();
 
-        connect( search_edit, SIGNAL(textChanged(const QString &)), \
SLOT(filter(const QString &)) );  connect( cancel_button, SIGNAL(clicked()), \
SLOT(reject()) );  connect( ok_button, SIGNAL(clicked()), SLOT(importSelected()) );
@@ -105,15 +102,4 @@ void USDADataDialog::loadDataFromFile()
 }
 
-void USDADataDialog::filter(const QString & substr)
-{
-        for ( QListViewItem *it = listView->firstChild(); it; it = it->nextSibling() \
                )
-        {
-                if ( substr.isEmpty() ) // Don't filter if the filter text is empty
-                        it->setVisible(true);
-                else
-                        it->setVisible( it->text(0).contains(substr,false) );
-        }
-}
-
 void USDADataDialog::importSelected()
 {


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

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