author | tille <tille> | 2003-05-10 16:51:45 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-10 16:51:45 (UTC) |
commit | bb282009a5d37c77c9239d0e78950290f026d7a8 (patch) (unidiff) | |
tree | f77f8299f6cb4393d98e005963b116bab6a27989 | |
parent | 2a37284ab7ea4a29b6e55a84445ad5b2e3d6739b (diff) | |
download | opie-bb282009a5d37c77c9239d0e78950290f026d7a8.zip opie-bb282009a5d37c77c9239d0e78950290f026d7a8.tar.gz opie-bb282009a5d37c77c9239d0e78950290f026d7a8.tar.bz2 |
applnk search
-rw-r--r-- | core/pim/osearch/applnkitem.cpp | 54 | ||||
-rw-r--r-- | core/pim/osearch/applnkitem.h | 37 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.cpp | 46 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.h | 35 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 4 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 2 | ||||
-rw-r--r-- | core/pim/osearch/osearch.pro | 8 |
7 files changed, 183 insertions, 3 deletions
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp new file mode 100644 index 0000000..f45ed68 --- a/dev/null +++ b/core/pim/osearch/applnkitem.cpp | |||
@@ -0,0 +1,54 @@ | |||
1 | // | ||
2 | // | ||
3 | // C++ Implementation: $MODULE$ | ||
4 | // | ||
5 | // Description: | ||
6 | // | ||
7 | // | ||
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | ||
9 | // | ||
10 | // Copyright: See COPYING file that comes with this distribution | ||
11 | // | ||
12 | // | ||
13 | #include "applnkitem.h" | ||
14 | |||
15 | #include <qpe/applnk.h> | ||
16 | |||
17 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) | ||
18 | : ResultItem(parent) | ||
19 | { | ||
20 | _app = app; | ||
21 | setText(0, _app->name() ); | ||
22 | } | ||
23 | |||
24 | |||
25 | AppLnkItem::~AppLnkItem() | ||
26 | { | ||
27 | } | ||
28 | |||
29 | |||
30 | QString AppLnkItem::toRichText() | ||
31 | { | ||
32 | QString text; | ||
33 | text += "<b><h3>"; | ||
34 | text += _app->name(); | ||
35 | text += "</b></h3><br>"; | ||
36 | text += _app->comment(); | ||
37 | text += "<br><br>`"; | ||
38 | text += _app->exec(); | ||
39 | text += "`"; | ||
40 | return text; | ||
41 | } | ||
42 | |||
43 | void AppLnkItem::editItem() | ||
44 | { | ||
45 | _app->execute(); | ||
46 | } | ||
47 | |||
48 | void AppLnkItem::showItem() | ||
49 | { | ||
50 | /* QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | ||
51 | e << _contact->uid();*/ | ||
52 | ResultItem::showItem(); | ||
53 | } | ||
54 | |||
diff --git a/core/pim/osearch/applnkitem.h b/core/pim/osearch/applnkitem.h new file mode 100644 index 0000000..b28631a --- a/dev/null +++ b/core/pim/osearch/applnkitem.h | |||
@@ -0,0 +1,37 @@ | |||
1 | // | ||
2 | // | ||
3 | // C++ Interface: $MODULE$ | ||
4 | // | ||
5 | // Description: | ||
6 | // | ||
7 | // | ||
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | ||
9 | // | ||
10 | // Copyright: See COPYING file that comes with this distribution | ||
11 | // | ||
12 | // | ||
13 | #ifndef APPLNKITEM_H | ||
14 | #define APPLNKITEM_H | ||
15 | |||
16 | #include "resultitem.h" | ||
17 | |||
18 | class AppLnk; | ||
19 | |||
20 | /** | ||
21 | @author Patrick S. Vogt | ||
22 | */ | ||
23 | class AppLnkItem : public ResultItem | ||
24 | { | ||
25 | public: | ||
26 | AppLnkItem(OListViewItem* parent, AppLnk *app); | ||
27 | ~AppLnkItem(); | ||
28 | |||
29 | virtual QString toRichText(); | ||
30 | virtual void editItem(); | ||
31 | virtual void showItem(); | ||
32 | |||
33 | private: | ||
34 | AppLnk *_app; | ||
35 | }; | ||
36 | |||
37 | #endif | ||
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp new file mode 100644 index 0000000..7872ae3 --- a/dev/null +++ b/core/pim/osearch/applnksearch.cpp | |||
@@ -0,0 +1,46 @@ | |||
1 | // | ||
2 | // | ||
3 | // C++ Implementation: $MODULE$ | ||
4 | // | ||
5 | // Description: | ||
6 | // | ||
7 | // | ||
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | ||
9 | // | ||
10 | // Copyright: See COPYING file that comes with this distribution | ||
11 | // | ||
12 | // | ||
13 | #include "applnksearch.h" | ||
14 | |||
15 | #include <qpe/applnk.h> | ||
16 | #include <qpe/qpeapplication.h> | ||
17 | |||
18 | #include "applnkitem.h" | ||
19 | |||
20 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) | ||
21 | { | ||
22 | _apps = 0; | ||
23 | } | ||
24 | |||
25 | |||
26 | AppLnkSearch::~AppLnkSearch() | ||
27 | { | ||
28 | delete _apps; | ||
29 | } | ||
30 | |||
31 | |||
32 | void AppLnkSearch::expand() | ||
33 | { | ||
34 | SearchGroup::expand(); | ||
35 | if (_search.isEmpty()) return; | ||
36 | if (!_apps) _apps = new AppLnkSet(QPEApplication::qpeDir()); | ||
37 | QList<AppLnk> appList = _apps->children(); | ||
38 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ | ||
39 | // if (app->name().contains(_search) || app->comment().contains(_search)) | ||
40 | if ( (_search.match( app->name() ) != -1) | ||
41 | || (_search.match(app->comment()) != -1) | ||
42 | || (_search.match(app->exec()) != -1) ) | ||
43 | new AppLnkItem( this, app ); | ||
44 | } | ||
45 | } | ||
46 | |||
diff --git a/core/pim/osearch/applnksearch.h b/core/pim/osearch/applnksearch.h new file mode 100644 index 0000000..e283cd3 --- a/dev/null +++ b/core/pim/osearch/applnksearch.h | |||
@@ -0,0 +1,35 @@ | |||
1 | // | ||
2 | // | ||
3 | // C++ Interface: $MODULE$ | ||
4 | // | ||
5 | // Description: | ||
6 | // | ||
7 | // | ||
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | ||
9 | // | ||
10 | // Copyright: See COPYING file that comes with this distribution | ||
11 | // | ||
12 | // | ||
13 | #ifndef APPLNKSEARCH_H | ||
14 | #define APPLNKSEARCH_H | ||
15 | |||
16 | #include "searchgroup.h" | ||
17 | |||
18 | class AppLnkSet; | ||
19 | |||
20 | /** | ||
21 | @author Patrick S. Vogt | ||
22 | */ | ||
23 | class AppLnkSearch : public SearchGroup | ||
24 | { | ||
25 | public: | ||
26 | AppLnkSearch(QListView* parent, QString name); | ||
27 | |||
28 | ~AppLnkSearch(); | ||
29 | |||
30 | virtual void expand(); | ||
31 | private: | ||
32 | AppLnkSet *_apps; | ||
33 | }; | ||
34 | |||
35 | #endif | ||
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 3dba3a9..41ce5b6 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -38,3 +38,3 @@ | |||
38 | #include "datebooksearch.h" | 38 | #include "datebooksearch.h" |
39 | 39 | #include "applnksearch.h" | |
40 | 40 | ||
@@ -79,2 +79,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
79 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); | 79 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); |
80 | applnkSearch = new AppLnkSearch( resultsList, tr("applications") ); | ||
80 | 81 | ||
@@ -157,2 +158,3 @@ void MainWindow::setSearch( const QString &key ) | |||
157 | datebookSearch->setSearch(key); | 158 | datebookSearch->setSearch(key); |
159 | applnkSearch->setSearch(key); | ||
158 | } | 160 | } |
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index f7e8f8e..f79504c 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -30,2 +30,3 @@ class TodoSearch; | |||
30 | class DatebookSearch; | 30 | class DatebookSearch; |
31 | class AppLnkSearch; | ||
31 | 32 | ||
@@ -63,2 +64,3 @@ private: | |||
63 | DatebookSearch *datebookSearch; | 64 | DatebookSearch *datebookSearch; |
65 | AppLnkSearch *applnkSearch; | ||
64 | 66 | ||
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro index 397bc83..75e90f2 100644 --- a/core/pim/osearch/osearch.pro +++ b/core/pim/osearch/osearch.pro | |||
@@ -20,3 +20,5 @@ SOURCES += main.cpp \ | |||
20 | contactitem.cpp \ | 20 | contactitem.cpp \ |
21 | eventitem.cpp | 21 | eventitem.cpp \ |
22 | applnksearch.cpp \ | ||
23 | applnkitem.cpp | ||
22 | HEADERS += mainwindow.h \ | 24 | HEADERS += mainwindow.h \ |
@@ -31,2 +33,4 @@ HEADERS += mainwindow.h \ | |||
31 | contactitem.h \ | 33 | contactitem.h \ |
32 | eventitem.h | 34 | eventitem.h \ |
35 | applnksearch.h \ | ||
36 | applnkitem.h | ||