Author: kmachalkova Date: Fri Jun 19 13:38:01 2009 New Revision: 57656 URL: http://svn.opensuse.org/viewcvs/yast?rev=57656&view=rev Log: Very simplistic filtering (by name) Empty groups are not filtered out yet Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp?rev=57656&r1=57655&r2=57656&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp Fri Jun 19 13:38:01 2009 @@ -36,6 +36,7 @@ , d(new Private()) { + setFilterCaseSensitivity( Qt::CaseInsensitive ); } KCategorizedSortFilterProxyModel::~KCategorizedSortFilterProxyModel() Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp?rev=57656&r1=57655&r2=57656&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp Fri Jun 19 13:38:01 2009 @@ -57,6 +57,8 @@ // category proxy model KCategorizedSortFilterProxyModel * kcsfpm; + QLineEdit *searchField; + QQueue <QString> recentlyUsed; }; @@ -106,8 +108,8 @@ QLabel *searchLabel = new QLabel(); searchLabel->setText( _("Search") ); searchLayout->addWidget(searchLabel); - QLineEdit *searchField = new QLineEdit(); - searchLayout->addWidget(searchField); + d->searchField = new QLineEdit(); + searchLayout->addWidget(d->searchField); leftPanelLayout->addLayout( searchLayout ); @@ -138,6 +140,14 @@ connect( d->modview, SIGNAL( doubleClicked( const QModelIndex & ) ), SLOT( slotLaunchModule( const QModelIndex & ) ) ); + connect( d->searchField, SIGNAL( textChanged( const QString &)), + SLOT( slotFilterChanged() )); + +} + +void MainWindow::initActions() +{ + addToF = new QAction( "Add to Favourites", this ); } void MainWindow::slotGroupPressed( const QModelIndex &index ) @@ -165,11 +175,6 @@ qDebug() << "-> " << srcidx.row() << " : " << d->modmodel->propertyValue(srcidx, "GenericName").toString(); } -void MainWindow::initActions() -{ - addToF = new QAction( "Add to Favourites", this ); -} - void MainWindow::slotLaunchModule( const QModelIndex &index) { QModelIndex i1 = d->modmodel->index( d->kcsfpm->mapToSource( index ).row(), YQDesktopFilesModel::Call ); @@ -208,6 +213,13 @@ system( cmd.toAscii() ); } +void MainWindow::slotFilterChanged() +{ + QString stext = d->searchField->text(); + d->kcsfpm->setFilterFixedString( stext ); + +} + void MainWindow::readSettings() { QSettings settings(ORG_NAME, APP_NAME); Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h?rev=57656&r1=57655&r2=57656&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h Fri Jun 19 13:38:01 2009 @@ -38,6 +38,7 @@ void slotGroupPressed( const QModelIndex &index ); void slotModulePressed( const QModelIndex &index ); void slotLaunchModule( const QModelIndex &index ); + void slotFilterChanged(); protected: void initActions(); void closeEvent( QCloseEvent *event); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org