From ab0328b2f40abef4c5bf791316ce7bbcada25dff Mon Sep 17 00:00:00 2001 From: ikemo Date: Sat, 28 May 2005 14:06:25 +0000 Subject: [PATCH] change search interface. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1734 56b19765-1e22-0410-a548-a0f45d66c51a --- kita/src/board/threadlistview.cpp | 25 ++++++++++++++++++------- kita/src/board/threadlistview.h | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/kita/src/board/threadlistview.cpp b/kita/src/board/threadlistview.cpp index b985403..d56453d 100644 --- a/kita/src/board/threadlistview.cpp +++ b/kita/src/board/threadlistview.cpp @@ -69,6 +69,8 @@ ThreadListView::ThreadListView( QWidget* parent, const char* name ) SLOT( slotSearchButton() ) ); connect( SearchCombo, SIGNAL( activated( int ) ), SLOT( slotSearchButton() ) ); + connect( SearchCombo, SIGNAL( textChanged( const QString& ) ), + SLOT( slotSearchButton() ) ); connect( HideButton, SIGNAL( toggled( bool ) ), SLOT( slotHideButton( bool ) ) ); connect( subjectList, SIGNAL( mouseButtonClicked( int, QListViewItem*, const QPoint&, int ) ), @@ -90,12 +92,12 @@ void ThreadListView::slotSearchButton() { insertSearchCombo(); QStringList list = parseSearchQuery( SearchCombo->currentText() ); - - if ( list.isEmpty() ) return; - - if ( list != m_prevquery ) { + + if ( list.isEmpty() ) { + clearSearch(); + } else if ( list != m_prevquery ) { searchNew( list ); - slotHideButton( HideButton->isOn() ); + slotHideButton( true ); } else { searchNext( list ); } @@ -160,10 +162,19 @@ void ThreadListView::searchNew( const QStringList &query ) } } -void ThreadListView::slotHideButton( bool on ) +void ThreadListView::clearSearch() { - if ( m_hitList.empty() ) return ; + QListViewItemIterator listIt( subjectList ); + while ( listIt.current() != 0 ) { + KListViewItem * item = static_cast( listIt.current() ); + item->setPixmap( Col_Icon, 0 ); + item->setVisible( true ); + ++listIt; + } +} +void ThreadListView::slotHideButton( bool on ) +{ QListViewItemIterator listIt( subjectList ); while ( listIt.current() != 0 ) { KListViewItem * item = static_cast( listIt.current() ); diff --git a/kita/src/board/threadlistview.h b/kita/src/board/threadlistview.h index 9e27cc2..d78c462 100644 --- a/kita/src/board/threadlistview.h +++ b/kita/src/board/threadlistview.h @@ -48,6 +48,7 @@ namespace Kita QStringList parseSearchQuery( const QString& input ); void searchNext( const QStringList& input ); void searchNew( const QStringList& query ); + void clearSearch(); void hideColumn( int col ); void showColumn( int col ); -- 2.11.0