Test change - can I push OK?
[kdeedu-porting.git] / kalzium / src / search.h
blob82c997df7bfb41996038b2d1fe8568ff22c3bd8f
1 /***************************************************************************
2 * Copyright (C) 2006 by Pino Toscano, toscano.pino@tiscali.it *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef KALZIUMSEARCH_H
21 #define KALZIUMSEARCH_H
23 #include <QList>
24 #include <QObject>
26 #include "element.h"
27 //class Element;
29 /**
30 * Represent a search.
32 * @author Pino Toscano
34 class Search : public QObject
36 Q_OBJECT
38 public:
39 /**
40 * The kind of search we can perform
42 enum SearchKind
44 SearchByName = 0x01,
45 SearchBySymbol = 0x02,
46 SearchAll = 0xFF
49 /**
50 * Construct a new empty search.
52 Search();
54 /**
55 * @return the search text
57 QString searchText() const;
59 /**
60 * @return the kind of search
62 SearchKind searchKind() const;
64 /**
65 * is the current Search active?
66 * @return whether this search is active
68 bool isActive() const;
70 /**
71 * @return the found elements
73 const QList<Element*>& foundElements() const;
75 /**
76 * @return whether the element @p el matches the search
78 bool matches( Element* el ) const;
80 public slots:
81 /**
82 * Search the @p text by looking at the element using the
83 * specified @p kind
85 void doSearch( const QString& text, SearchKind kind );
86 /**
87 * Reset the current search (and put it not active).
89 void resetSearch();
91 signals:
92 /**
93 * The current search has changed (ie the found elements have
94 * changed)
96 void searchChanged();
97 /**
98 * The current search has been reset.
100 void searchReset();
102 private:
103 bool m_isActive;
105 QString m_searchText;
106 SearchKind m_searchKind;
108 QList<Element*> m_foundElements;
111 #endif // KALZIUMSEARCH_H