diff options
| author | 2010-01-01 22:23:40 +0000 | |
|---|---|---|
| committer | 2010-01-01 22:23:40 +0000 | |
| commit | 7777d445e8cd7164a6d8d0a4ac9889749c874cba (patch) | |
| tree | 048b8105fa79b0668f41126cf4f9a8c37c12e1d9 /src/modules | |
| parent | added texticons entry (aka ctrl+I) for new emoticons (diff) | |
| download | KVIrc-7777d445e8cd7164a6d8d0a4ac9889749c874cba.tar.gz KVIrc-7777d445e8cd7164a6d8d0a4ac9889749c874cba.tar.bz2 KVIrc-7777d445e8cd7164a6d8d0a4ac9889749c874cba.zip | |
implemented #60
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3786 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/list/listwindow.cpp | 35 | ||||
| -rw-r--r-- | src/modules/list/listwindow.h | 3 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/modules/list/listwindow.cpp b/src/modules/list/listwindow.cpp index c607c32cb..5a90f3e5f 100644 --- a/src/modules/list/listwindow.cpp +++ b/src/modules/list/listwindow.cpp @@ -198,6 +198,7 @@ KviListWindow::KviListWindow(KviFrame * lpFrm, KviConsole * lpConsole) "Commonly, masked channel names (*kvirc*) are accepted as parameters, as well as strings " \ "like <b>c<n</b> or <b>c>n</b> where <b>n</b> is the minimum or maximum of users on the channel.</center>")); + connect(m_pParamsEdit,SIGNAL(textEdited(const QString &)),this,SLOT(liveSearch(const QString &))); m_pInfoLabel = new KviThemedLabel(m_pTopSplitter,"info_label"); @@ -440,6 +441,22 @@ void KviListWindow::startOfList() m_pRequestButton->setEnabled(false); } +void KviListWindow::liveSearch(const QString & szText) +{ + QRegExp res(szText,Qt::CaseInsensitive,QRegExp::Wildcard); + + for(int i=0; i<m_pTreeWidget->topLevelItemCount(); i++) + { + if(res.exactMatch(m_pTreeWidget->topLevelItem(i)->text(0)) || + res.exactMatch(m_pTreeWidget->topLevelItem(i)->text(2))) + { + m_pTreeWidget->topLevelItem(i)->setHidden(false); + } else { + m_pTreeWidget->topLevelItem(i)->setHidden(true); + } + } +} + void KviListWindow::processData(KviIrcMessage * pMsg) { if(!m_pFlushTimer) @@ -459,18 +476,20 @@ void KviListWindow::processData(KviIrcMessage * pMsg) pMsg->connection()->decodeText(pMsg->safeTrailing())) ); } else { + //rfc2812 permits wildcards here (section 3.2.6) + QRegExp res(m_pParamsEdit->text(),Qt::CaseInsensitive,QRegExp::Wildcard); if( - pMsg->connection()->decodeText(pMsg->safeParam(1)).contains(m_pParamsEdit->text()) || - pMsg->connection()->decodeText(pMsg->safeTrailing()).contains(m_pParamsEdit->text()) + res.exactMatch(pMsg->connection()->decodeText(pMsg->safeParam(1))) || + res.exactMatch(pMsg->connection()->decodeText(pMsg->safeTrailing())) ) { m_pItemList->append( - new KviChannelTreeWidgetItemData( - pMsg->connection()->decodeText(pMsg->safeParam(1)), - pMsg->connection()->decodeText(pMsg->safeParam(2)), - pMsg->connection()->decodeText(pMsg->safeTrailing()) - ) - ); + new KviChannelTreeWidgetItemData( + pMsg->connection()->decodeText(pMsg->safeParam(1)), + pMsg->connection()->decodeText(pMsg->safeParam(2)), + pMsg->connection()->decodeText(pMsg->safeTrailing()) + ) + ); } } diff --git a/src/modules/list/listwindow.h b/src/modules/list/listwindow.h index 89566a3a1..a7dcaedb5 100644 --- a/src/modules/list/listwindow.h +++ b/src/modules/list/listwindow.h @@ -82,7 +82,7 @@ public: protected: QSplitter * m_pVertSplitter; QSplitter * m_pTopSplitter; - QTreeWidget * m_pTreeWidget; + QTreeWidget * m_pTreeWidget; QLineEdit * m_pParamsEdit; QToolButton * m_pRequestButton; QToolButton * m_pStopListDownloadButton; @@ -110,6 +110,7 @@ protected slots: void connectionStateChange(); void exportList(); void importList(); + void liveSearch(const QString & szText); private: void reset(); void endOfList(); |
