-rw-r--r-- | core/pim/osearch/doclnkitem.cpp | 54 | ||||
-rw-r--r-- | core/pim/osearch/doclnkitem.h | 37 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 46 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.h | 35 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 3 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 2 | ||||
-rw-r--r-- | core/pim/osearch/osearch.pro | 8 |
7 files changed, 183 insertions, 2 deletions
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp new file mode 100644 index 0000000..fd19727 --- a/dev/null +++ b/core/pim/osearch/doclnkitem.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 "doclnkitem.h" | ||
14 | |||
15 | #include <qpe/applnk.h> | ||
16 | |||
17 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) | ||
18 | : ResultItem(parent) | ||
19 | { | ||
20 | _doc = app; | ||
21 | setText(0, _doc->name() ); | ||
22 | } | ||
23 | |||
24 | |||
25 | DocLnkItem::~DocLnkItem() | ||
26 | { | ||
27 | } | ||
28 | |||
29 | |||
30 | QString DocLnkItem::toRichText() | ||
31 | { | ||
32 | QString text; | ||
33 | text += "<b><h3>"; | ||
34 | text += _doc->name(); | ||
35 | text += "</b></h3><br>"; | ||
36 | text += _doc->comment(); | ||
37 | text += "<br><br>`"; | ||
38 | text += _doc->exec(); | ||
39 | text += "`"; | ||
40 | return text; | ||
41 | } | ||
42 | |||
43 | void DocLnkItem::editItem() | ||
44 | { | ||
45 | _doc->execute(); | ||
46 | } | ||
47 | |||
48 | void DocLnkItem::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/doclnkitem.h b/core/pim/osearch/doclnkitem.h new file mode 100644 index 0000000..2718733 --- a/dev/null +++ b/core/pim/osearch/doclnkitem.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 DOCLNKITEM_H | ||
14 | #define DOCLNKITEM_H | ||
15 | |||
16 | #include "resultitem.h" | ||
17 | |||
18 | class DocLnk; | ||
19 | |||
20 | /** | ||
21 | @author Patrick S. Vogt | ||
22 | */ | ||
23 | class DocLnkItem : public ResultItem | ||
24 | { | ||
25 | public: | ||
26 | DocLnkItem(OListViewItem* parent, DocLnk *app); | ||
27 | ~DocLnkItem(); | ||
28 | |||
29 | virtual QString toRichText(); | ||
30 | virtual void editItem(); | ||
31 | virtual void showItem(); | ||
32 | |||
33 | private: | ||
34 | DocLnk *_doc; | ||
35 | }; | ||
36 | |||
37 | #endif | ||
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp new file mode 100644 index 0000000..e99a385 --- a/dev/null +++ b/core/pim/osearch/doclnksearch.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 "doclnksearch.h" | ||
14 | |||
15 | #include <qpe/applnk.h> | ||
16 | #include <qpe/qpeapplication.h> | ||
17 | |||
18 | #include "doclnkitem.h" | ||
19 | |||
20 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) | ||
21 | { | ||
22 | _docs = 0; | ||
23 | } | ||
24 | |||
25 | |||
26 | DocLnkSearch::~DocLnkSearch() | ||
27 | { | ||
28 | delete _docs; | ||
29 | } | ||
30 | |||
31 | |||
32 | void DocLnkSearch::expand() | ||
33 | { | ||
34 | SearchGroup::expand(); | ||
35 | if (_search.isEmpty()) return; | ||
36 | if (!_docs) _docs = new DocLnkSet(QPEApplication::documentDir()); | ||
37 | QList<DocLnk> appList = _docs->children(); | ||
38 | for ( DocLnk *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 DocLnkItem( this, app ); | ||
44 | } | ||
45 | } | ||
46 | |||
diff --git a/core/pim/osearch/doclnksearch.h b/core/pim/osearch/doclnksearch.h new file mode 100644 index 0000000..ec740de --- a/dev/null +++ b/core/pim/osearch/doclnksearch.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 DOCLNKSEARCH_H | ||
14 | #define DOCLNKSEARCH_H | ||
15 | |||
16 | #include "searchgroup.h" | ||
17 | |||
18 | class DocLnkSet; | ||
19 | |||
20 | /** | ||
21 | @author Patrick S. Vogt | ||
22 | */ | ||
23 | class DocLnkSearch : public SearchGroup | ||
24 | { | ||
25 | public: | ||
26 | DocLnkSearch(QListView* parent, QString name); | ||
27 | |||
28 | ~DocLnkSearch(); | ||
29 | |||
30 | virtual void expand(); | ||
31 | private: | ||
32 | DocLnkSet *_docs; | ||
33 | }; | ||
34 | |||
35 | #endif | ||
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 41ce5b6..140d7bb 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "todosearch.h" | 37 | #include "todosearch.h" |
38 | #include "datebooksearch.h" | 38 | #include "datebooksearch.h" |
39 | #include "applnksearch.h" | 39 | #include "applnksearch.h" |
40 | #include "doclnksearch.h" | ||
40 | 41 | ||
41 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 42 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
42 | QMainWindow( parent, name, f ), _currentItem(0) | 43 | QMainWindow( parent, name, f ), _currentItem(0) |
@@ -78,6 +79,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
78 | todoSearch = new TodoSearch( resultsList, tr("todo") ); | 79 | todoSearch = new TodoSearch( resultsList, tr("todo") ); |
79 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); | 80 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); |
80 | applnkSearch = new AppLnkSearch( resultsList, tr("applications") ); | 81 | applnkSearch = new AppLnkSearch( resultsList, tr("applications") ); |
82 | doclnkSearch = new DocLnkSearch( resultsList, tr("documents") ); | ||
81 | 83 | ||
82 | makeMenu(); | 84 | makeMenu(); |
83 | setCentralWidget( mainFrame ); | 85 | setCentralWidget( mainFrame ); |
@@ -157,6 +159,7 @@ void MainWindow::setSearch( const QString &key ) | |||
157 | todoSearch->setSearch(key); | 159 | todoSearch->setSearch(key); |
158 | datebookSearch->setSearch(key); | 160 | datebookSearch->setSearch(key); |
159 | applnkSearch->setSearch(key); | 161 | applnkSearch->setSearch(key); |
162 | doclnkSearch->setSearch(key); | ||
160 | } | 163 | } |
161 | 164 | ||
162 | 165 | ||
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index f79504c..424b4ba 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -29,6 +29,7 @@ class AdressSearch; | |||
29 | class TodoSearch; | 29 | class TodoSearch; |
30 | class DatebookSearch; | 30 | class DatebookSearch; |
31 | class AppLnkSearch; | 31 | class AppLnkSearch; |
32 | class DocLnkSearch; | ||
32 | 33 | ||
33 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
34 | { | 35 | { |
@@ -63,6 +64,7 @@ private: | |||
63 | TodoSearch *todoSearch; | 64 | TodoSearch *todoSearch; |
64 | DatebookSearch *datebookSearch; | 65 | DatebookSearch *datebookSearch; |
65 | AppLnkSearch *applnkSearch; | 66 | AppLnkSearch *applnkSearch; |
67 | DocLnkSearch *doclnkSearch; | ||
66 | 68 | ||
67 | void makeMenu(); | 69 | void makeMenu(); |
68 | }; | 70 | }; |
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro index 75e90f2..f28b01e 100644 --- a/core/pim/osearch/osearch.pro +++ b/core/pim/osearch/osearch.pro | |||
@@ -20,7 +20,9 @@ SOURCES += main.cpp \ | |||
20 | contactitem.cpp \ | 20 | contactitem.cpp \ |
21 | eventitem.cpp \ | 21 | eventitem.cpp \ |
22 | applnksearch.cpp \ | 22 | applnksearch.cpp \ |
23 | applnkitem.cpp | 23 | applnkitem.cpp \ |
24 | doclnkitem.cpp \ | ||
25 | doclnksearch.cpp | ||
24 | HEADERS += mainwindow.h \ | 26 | HEADERS += mainwindow.h \ |
25 | olistview.h \ | 27 | olistview.h \ |
26 | olistviewitem.h \ | 28 | olistviewitem.h \ |
@@ -33,4 +35,6 @@ HEADERS += mainwindow.h \ | |||
33 | contactitem.h \ | 35 | contactitem.h \ |
34 | eventitem.h \ | 36 | eventitem.h \ |
35 | applnksearch.h \ | 37 | applnksearch.h \ |
36 | applnkitem.h | 38 | applnkitem.h \ |
39 | doclnkitem.h \ | ||
40 | doclnksearch.h | ||