KDE3Support
k3listviewsearchline.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (c) 2003 Scott Wheeler <wheeler@kde.org> 00003 Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KLISTVIEWSEARCHLINE_H 00021 #define KLISTVIEWSEARCHLINE_H 00022 00023 #include <kde3support_export.h> 00024 #include <klineedit.h> 00025 #include <khbox.h> 00026 00027 class K3ListView; 00028 class Q3ListViewItem; 00029 00038 class KDE3SUPPORT_EXPORT K3ListViewSearchLine : public KLineEdit 00039 { 00040 Q_OBJECT 00041 00042 public: 00043 00051 K3ListViewSearchLine(QWidget *parent = 0, K3ListView *listView = 0); 00052 00060 K3ListViewSearchLine(QWidget *parent, 00061 const QList<K3ListView *> &listViews); 00062 00063 00067 virtual ~K3ListViewSearchLine(); 00068 00074 bool caseSensitive() const; 00075 00082 QList<int> searchColumns() const; 00083 00090 bool keepParentsVisible() const; 00091 00098 K3ListView *listView() const; 00099 00106 const QList<K3ListView *> &listViews() const; 00107 00108 public Q_SLOTS: 00115 void addListView(K3ListView *lv); 00116 00124 void removeListView(K3ListView *lv); 00125 00130 virtual void updateSearch(const QString &s = QString()); 00131 00137 void setCaseSensitive(bool cs); 00138 00149 void setKeepParentsVisible(bool v); 00150 00160 void setSearchColumns(const QList<int> &columns); 00161 00169 void setListView(K3ListView *lv); 00170 00178 void setListViews(const QList<K3ListView *> &lv); 00179 00180 00181 protected: 00182 00188 virtual bool itemMatches(const Q3ListViewItem *item, const QString &s) const; 00189 00193 virtual void contextMenuEvent( QContextMenuEvent*e ); 00194 00199 virtual void updateSearch(K3ListView *listView); 00200 00205 virtual void connectListView(K3ListView *); 00209 virtual void disconnectListView(K3ListView *); 00210 00225 virtual bool canChooseColumnsCheck(); 00226 00227 protected Q_SLOTS: 00241 void queueSearch(const QString &search); 00242 00251 void activateSearch(); 00252 00253 private: 00254 00261 void checkColumns(); 00262 00267 void checkItemParentsNotVisible(K3ListView *listView); 00268 00274 bool checkItemParentsVisible(Q3ListViewItem *item, Q3ListViewItem *highestHiddenParent = 0); 00275 00276 private Q_SLOTS: 00277 void itemAdded(Q3ListViewItem *item) const; 00278 void listViewDeleted( QObject *listView ); 00279 void searchColumnsMenuActivated(QAction*); 00280 00281 private: 00282 class K3ListViewSearchLinePrivate; 00283 K3ListViewSearchLinePrivate *d; 00284 }; 00285 00290 class KDE3SUPPORT_EXPORT K3ListViewSearchLineWidget : public KHBox 00291 { 00292 Q_OBJECT 00293 00294 public: 00299 K3ListViewSearchLineWidget(K3ListView *listView = 0, QWidget *parent = 0); 00300 00304 ~K3ListViewSearchLineWidget(); 00305 00310 virtual K3ListViewSearchLine *createSearchLine(K3ListView *listView); 00311 00315 K3ListViewSearchLine *searchLine() const; 00316 00317 protected Q_SLOTS: 00324 virtual void createWidgets(); 00325 00326 private: 00327 class K3ListViewSearchLineWidgetPrivate; 00328 K3ListViewSearchLineWidgetPrivate *d; 00329 }; 00330 00331 #endif