#include <ksimpleconfig.h>
#include <kdeversion.h>
#include <kmessagebox.h>
+#include <kiconloader.h>
#include <qfile.h>
#include <qtextcodec.h>
#include <qheader.h>
#include <qclipboard.h>
#include <qmessagebox.h>
+#include <qtoolbutton.h>
+#include <qcombobox.h>
#include "bbsview.h"
const KURL&, const KParts::URLArgs&, QString, int, const KURL& ) ),
signalCollection, SIGNAL( openURLRequestExt(
const KURL& , const KParts::URLArgs&, QString, int, const KURL& ) ) );
+
+ connect( SearchCombo, SIGNAL( textChanged( const QString& ) ),
+ SLOT( filter( const QString& ) ) );
}
KitaBBSView::~KitaBBSView()
config.writeEntry( "Opened", openedList );
}
+
+/**
+ * search and show matched item.
+ *
+ * @param str string to search.
+ */
+void KitaBBSView::filter( const QString& str )
+{
+ QListViewItem* categoryItem;
+ QListViewItem* boardItem;
+
+ for ( categoryItem = m_boardList->firstChild(); categoryItem; categoryItem = categoryItem->nextSibling() ) {
+ bool matched = false;
+
+ for ( boardItem = categoryItem->firstChild(); boardItem; boardItem = boardItem->nextSibling() ) {
+ QString boardName = boardItem->text( 0 );
+ if ( boardName.contains( str ) ) {
+ boardItem->setVisible( true );
+ matched = true;
+ } else {
+ boardItem->setVisible( false );
+ }
+ }
+
+ categoryItem->setVisible( matched );
+ }
+}
void slotContextMenuRequested( QListViewItem*, const QPoint&, int );
void slotMouseButtonClicked( int, QListViewItem* );
void refreshFavoriteBoards();
+ void filter( const QString& str );
public:
KitaBBSView( QWidget *parent, const char *name = 0 );
<property name="caption">
<string>Form1</string>
</property>
- <grid>
+ <vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
- <widget class="KListView" row="0" column="0">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>m_boardList</cstring>
+ <cstring>layout8</cstring>
</property>
- <property name="lineWidth">
- <number>2</number>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>SearchCombo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="sizeLimit">
+ <number>10</number>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>SearchButton</cstring>
+ </property>
+ <property name="text">
+ <string>Search</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>search word</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>398</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>m_boardList</cstring>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
<bool>true</bool>
</property>
</widget>
- </grid>
+ </vbox>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<includehints>