26 files changed, 279 insertions, 210 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index 0ee8eba..69ad9ef 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.cpp | |||
@@ -21,25 +21,30 @@ | |||
21 | AdressSearch::AdressSearch(QListView* parent, QString name): | 21 | AdressSearch::AdressSearch(QListView* parent, QString name): |
22 | SearchGroup(parent, name) | 22 | SearchGroup(parent, name) |
23 | { | 23 | { |
24 | _contacts = 0; | 24 | _contacts = 0; |
25 | } | 25 | } |
26 | 26 | ||
27 | 27 | ||
28 | AdressSearch::~AdressSearch() | 28 | AdressSearch::~AdressSearch() |
29 | { | 29 | { |
30 | delete _contacts; | 30 | delete _contacts; |
31 | } | 31 | } |
32 | 32 | ||
33 | void AdressSearch::load() | ||
34 | { | ||
35 | _contacts = new OContactAccess("osearch"); | ||
36 | } | ||
33 | 37 | ||
34 | void AdressSearch::expand() | 38 | int AdressSearch::search() |
35 | { | 39 | { |
36 | SearchGroup::expand(); | ||
37 | if (_search.isEmpty()) return; | ||
38 | if (!_contacts) _contacts = new OContactAccess("osearch"); | ||
39 | ORecordList<OContact> results = _contacts->matchRegexp(_search); | 40 | ORecordList<OContact> results = _contacts->matchRegexp(_search); |
40 | setText(0, text(0) + " (" + QString::number( results.count() ) + ")" ); | ||
41 | for (uint i = 0; i < results.count(); i++) { | 41 | for (uint i = 0; i < results.count(); i++) { |
42 | new ContactItem( this, new OContact( results[i] )); | 42 | new ContactItem( this, new OContact( results[i] )); |
43 | } | 43 | } |
44 | return results.count(); | ||
44 | } | 45 | } |
45 | 46 | ||
47 | void AdressSearch::insertItem( void* ) | ||
48 | { | ||
49 | |||
50 | } | ||
diff --git a/core/pim/osearch/adresssearch.h b/core/pim/osearch/adresssearch.h index ab560d0..d5c7622 100644 --- a/core/pim/osearch/adresssearch.h +++ b/core/pim/osearch/adresssearch.h | |||
@@ -17,22 +17,22 @@ | |||
17 | 17 | ||
18 | class OContactAccess; | 18 | class OContactAccess; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class AdressSearch : public SearchGroup | 23 | class AdressSearch : public SearchGroup |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | AdressSearch(QListView* parent, QString name); | 26 | AdressSearch(QListView* parent, QString name); |
27 | ~AdressSearch(); | 27 | ~AdressSearch(); |
28 | 28 | ||
29 | virtual void expand(); | ||
30 | |||
31 | protected: | 29 | protected: |
32 | 30 | virtual void load(); | |
31 | virtual int search(); | ||
32 | virtual void insertItem( void* ); | ||
33 | 33 | ||
34 | private: | 34 | private: |
35 | OContactAccess *_contacts; | 35 | OContactAccess *_contacts; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp index f45ed68..2152da4 100644 --- a/core/pim/osearch/applnkitem.cpp +++ b/core/pim/osearch/applnkitem.cpp | |||
@@ -1,17 +1,17 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "applnkitem.h" | 13 | #include "applnkitem.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | 16 | ||
17 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) | 17 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) |
@@ -21,34 +21,30 @@ AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) | |||
21 | setText(0, _app->name() ); | 21 | setText(0, _app->name() ); |
22 | } | 22 | } |
23 | 23 | ||
24 | 24 | ||
25 | AppLnkItem::~AppLnkItem() | 25 | AppLnkItem::~AppLnkItem() |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | QString AppLnkItem::toRichText() | 30 | QString AppLnkItem::toRichText() |
31 | { | 31 | { |
32 | QString text; | 32 | QString text; |
33 | text += "<b><h3>"; | 33 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; |
34 | text += _app->name(); | 34 | text += _app->comment() + "<br>"; |
35 | text += "</b></h3><br>"; | 35 | text += "<br>`" + _app->exec() + "`<br>"; |
36 | text += _app->comment(); | ||
37 | text += "<br><br>`"; | ||
38 | text += _app->exec(); | ||
39 | text += "`"; | ||
40 | return text; | 36 | return text; |
41 | } | 37 | } |
42 | 38 | ||
43 | void AppLnkItem::editItem() | 39 | void AppLnkItem::action( int act ) |
44 | { | 40 | { |
45 | _app->execute(); | 41 | if (!_app->isValid()) qDebug("INVALID"); |
42 | if (act == 0) _app->execute(); | ||
46 | } | 43 | } |
47 | 44 | ||
48 | void AppLnkItem::showItem() | 45 | QIntDict<QString> AppLnkItem::actions() |
49 | { | 46 | { |
50 | /* QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | 47 | QIntDict<QString> result; |
51 | e << _contact->uid();*/ | 48 | result.insert( 0, new QString( QObject::tr("execute") ) ); |
52 | ResultItem::showItem(); | 49 | return result; |
53 | } | 50 | } |
54 | |||
diff --git a/core/pim/osearch/applnkitem.h b/core/pim/osearch/applnkitem.h index b28631a..4aa1274 100644 --- a/core/pim/osearch/applnkitem.h +++ b/core/pim/osearch/applnkitem.h | |||
@@ -18,20 +18,20 @@ | |||
18 | class AppLnk; | 18 | class AppLnk; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class AppLnkItem : public ResultItem | 23 | class AppLnkItem : public ResultItem |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | AppLnkItem(OListViewItem* parent, AppLnk *app); | 26 | AppLnkItem(OListViewItem* parent, AppLnk *app); |
27 | ~AppLnkItem(); | 27 | ~AppLnkItem(); |
28 | 28 | ||
29 | virtual QString toRichText(); | 29 | virtual QString toRichText(); |
30 | virtual void editItem(); | 30 | virtual void action( int ); |
31 | virtual void showItem(); | 31 | virtual QIntDict<QString> actions(); |
32 | 32 | ||
33 | private: | 33 | private: |
34 | AppLnk *_app; | 34 | AppLnk *_app; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #endif | 37 | #endif |
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp index 7872ae3..d5b2930 100644 --- a/core/pim/osearch/applnksearch.cpp +++ b/core/pim/osearch/applnksearch.cpp | |||
@@ -1,17 +1,17 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "applnksearch.h" | 13 | #include "applnksearch.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | 17 | ||
@@ -20,27 +20,36 @@ | |||
20 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) | 20 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) |
21 | { | 21 | { |
22 | _apps = 0; | 22 | _apps = 0; |
23 | } | 23 | } |
24 | 24 | ||
25 | 25 | ||
26 | AppLnkSearch::~AppLnkSearch() | 26 | AppLnkSearch::~AppLnkSearch() |
27 | { | 27 | { |
28 | delete _apps; | 28 | delete _apps; |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | void AppLnkSearch::expand() | 32 | void AppLnkSearch::load() |
33 | { | 33 | { |
34 | SearchGroup::expand(); | 34 | _apps = new AppLnkSet(QPEApplication::qpeDir()); |
35 | if (_search.isEmpty()) return; | 35 | } |
36 | if (!_apps) _apps = new AppLnkSet(QPEApplication::qpeDir()); | 36 | |
37 | int AppLnkSearch::search() | ||
38 | { | ||
39 | int count = 0; | ||
37 | QList<AppLnk> appList = _apps->children(); | 40 | QList<AppLnk> appList = _apps->children(); |
38 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ | 41 | 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) | 42 | if ( (_search.match( app->name() ) != -1) |
41 | || (_search.match(app->comment()) != -1) | 43 | || (_search.match(app->comment()) != -1) |
42 | || (_search.match(app->exec()) != -1) ) | 44 | || (_search.match(app->exec()) != -1) ) { |
43 | new AppLnkItem( this, app ); | 45 | count++; |
46 | insertItem( app ); | ||
47 | } | ||
44 | } | 48 | } |
49 | return count; | ||
45 | } | 50 | } |
46 | 51 | ||
52 | void AppLnkSearch::insertItem( void *rec ) | ||
53 | { | ||
54 | new AppLnkItem( this, (AppLnk*)rec ); | ||
55 | } | ||
diff --git a/core/pim/osearch/applnksearch.h b/core/pim/osearch/applnksearch.h index e283cd3..d88a8ce 100644 --- a/core/pim/osearch/applnksearch.h +++ b/core/pim/osearch/applnksearch.h | |||
@@ -1,35 +1,38 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Interface: $MODULE$ | 3 | // C++ Interface: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #ifndef APPLNKSEARCH_H | 13 | #ifndef APPLNKSEARCH_H |
14 | #define APPLNKSEARCH_H | 14 | #define APPLNKSEARCH_H |
15 | 15 | ||
16 | #include "searchgroup.h" | 16 | #include "searchgroup.h" |
17 | 17 | ||
18 | class AppLnkSet; | 18 | class AppLnkSet; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class AppLnkSearch : public SearchGroup | 23 | class AppLnkSearch : public SearchGroup |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | AppLnkSearch(QListView* parent, QString name); | 26 | AppLnkSearch(QListView* parent, QString name); |
27 | 27 | ||
28 | ~AppLnkSearch(); | 28 | ~AppLnkSearch(); |
29 | 29 | ||
30 | virtual void expand(); | 30 | protected: |
31 | private: | 31 | virtual void load(); |
32 | AppLnkSet *_apps; | 32 | virtual int search(); |
33 | virtual void insertItem( void* ); | ||
34 | |||
35 | AppLnkSet *_apps; | ||
33 | }; | 36 | }; |
34 | 37 | ||
35 | #endif | 38 | #endif |
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp index 788a415..7d8ecf1 100644 --- a/core/pim/osearch/contactitem.cpp +++ b/core/pim/osearch/contactitem.cpp | |||
@@ -1,17 +1,17 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "contactitem.h" | 13 | #include "contactitem.h" |
14 | 14 | ||
15 | #include <opie/ocontact.h> | 15 | #include <opie/ocontact.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 16 | #include <qpe/qcopenvelope_qws.h> |
17 | 17 | ||
@@ -25,27 +25,32 @@ ContactItem::ContactItem(OListViewItem* parent, OContact *contact) | |||
25 | 25 | ||
26 | ContactItem::~ContactItem() | 26 | ContactItem::~ContactItem() |
27 | { | 27 | { |
28 | delete _contact; | 28 | delete _contact; |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | QString ContactItem::toRichText() | 32 | QString ContactItem::toRichText() |
33 | { | 33 | { |
34 | return _contact->toRichText(); | 34 | return _contact->toRichText(); |
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | void ContactItem::action( int act ) | |
38 | void ContactItem::editItem() | ||
39 | { | 38 | { |
40 | QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | 39 | if (act == 0){ |
41 | //QCopEnvelope e("QPE/Addressbook", "edit(int)"); | 40 | QCopEnvelope e("QPE/Application/addressbook", "show(int)"); |
42 | e << _contact->uid(); | 41 | e << _contact->uid(); |
42 | }else if(act == 1){ | ||
43 | QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | ||
44 | e << _contact->uid(); | ||
43 | } | 45 | } |
44 | 46 | ||
45 | void ContactItem::showItem() | ||
46 | { | ||
47 | QCopEnvelope e("QPE/Application/addressbook", "show(int)"); | ||
48 | //QCopEnvelope e("QPE/Addressbook", "show(int)"); | ||
49 | e << _contact->uid(); | ||
50 | } | 47 | } |
51 | 48 | ||
49 | QIntDict<QString> ContactItem::actions() | ||
50 | { | ||
51 | QIntDict<QString> result; | ||
52 | result.insert( 0, new QString( QObject::tr("show") ) ); | ||
53 | result.insert( 1, new QString( QObject::tr("edit") ) ); | ||
54 | return result; | ||
55 | |||
56 | } | ||
diff --git a/core/pim/osearch/contactitem.h b/core/pim/osearch/contactitem.h index 431adef..5e0017d 100644 --- a/core/pim/osearch/contactitem.h +++ b/core/pim/osearch/contactitem.h | |||
@@ -19,21 +19,22 @@ class OContact; | |||
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class ContactItem : public ResultItem | 23 | class ContactItem : public ResultItem |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | ContactItem(OListViewItem* parent, OContact *contact); | 26 | ContactItem(OListViewItem* parent, OContact *contact); |
27 | 27 | ||
28 | ~ContactItem(); | 28 | ~ContactItem(); |
29 | 29 | ||
30 | virtual QString toRichText(); | 30 | virtual QString toRichText(); |
31 | virtual void showItem(); | 31 | virtual void action( int ); |
32 | virtual void editItem(); | 32 | virtual QIntDict<QString> actions(); |
33 | |||
33 | 34 | ||
34 | private: | 35 | private: |
35 | OContact *_contact; | 36 | OContact *_contact; |
36 | 37 | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | #endif | 40 | #endif |
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 83b99f5..68699fa 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -21,26 +21,30 @@ DatebookSearch::DatebookSearch(QListView* parent, QString name) | |||
21 | : SearchGroup(parent, name) | 21 | : SearchGroup(parent, name) |
22 | { | 22 | { |
23 | _dates = 0; | 23 | _dates = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | DatebookSearch::~DatebookSearch() | 27 | DatebookSearch::~DatebookSearch() |
28 | { | 28 | { |
29 | delete _dates; | 29 | delete _dates; |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | void DatebookSearch::expand() | 33 | void DatebookSearch::load() |
34 | { | 34 | { |
35 | SearchGroup::expand(); | ||
36 | if (!_dates){ | ||
37 | _dates = new ODateBookAccess(); | 35 | _dates = new ODateBookAccess(); |
38 | _dates->load(); | 36 | _dates->load(); |
39 | } | 37 | } |
38 | |||
39 | int DatebookSearch::search() | ||
40 | { | ||
40 | ORecordList<OEvent> results = _dates->matchRegexp(_search); | 41 | ORecordList<OEvent> results = _dates->matchRegexp(_search); |
41 | setText(0, text(0) + " (" + QString::number( results.count() ) + ")" ); | 42 | for (uint i = 0; i < results.count(); i++) |
42 | for (uint i = 0; i < results.count(); i++) { | ||
43 | new EventItem( this, new OEvent( results[i] )); | 43 | new EventItem( this, new OEvent( results[i] )); |
44 | } | 44 | return results.count(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void DatebookSearch::insertItem( void* ) | ||
48 | { | ||
49 | |||
50 | } | ||
diff --git a/core/pim/osearch/datebooksearch.h b/core/pim/osearch/datebooksearch.h index 35bbe5a..bb31462 100644 --- a/core/pim/osearch/datebooksearch.h +++ b/core/pim/osearch/datebooksearch.h | |||
@@ -18,19 +18,23 @@ | |||
18 | class ODateBookAccess; | 18 | class ODateBookAccess; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class DatebookSearch : public SearchGroup | 23 | class DatebookSearch : public SearchGroup |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | DatebookSearch(QListView* parent, QString name); | 26 | DatebookSearch(QListView* parent, QString name); |
27 | 27 | ||
28 | ~DatebookSearch(); | 28 | ~DatebookSearch(); |
29 | 29 | ||
30 | virtual void expand(); | 30 | protected: |
31 | virtual void load(); | ||
32 | virtual int search(); | ||
33 | virtual void insertItem( void* ); | ||
34 | |||
31 | private: | 35 | private: |
32 | ODateBookAccess *_dates; | 36 | ODateBookAccess *_dates; |
33 | 37 | ||
34 | }; | 38 | }; |
35 | 39 | ||
36 | #endif | 40 | #endif |
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp index fd19727..75dee58 100644 --- a/core/pim/osearch/doclnkitem.cpp +++ b/core/pim/osearch/doclnkitem.cpp | |||
@@ -1,54 +1,70 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "doclnkitem.h" | 13 | #include "doclnkitem.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qfile.h> | ||
17 | #include <qtextstream.h> | ||
16 | 18 | ||
17 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) | 19 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) |
18 | : ResultItem(parent) | 20 | : ResultItem(parent) |
19 | { | 21 | { |
20 | _doc = app; | 22 | _doc = app; |
21 | setText(0, _doc->name() ); | 23 | setText(0, _doc->name() ); |
22 | } | 24 | } |
23 | 25 | ||
24 | |||
25 | DocLnkItem::~DocLnkItem() | 26 | DocLnkItem::~DocLnkItem() |
26 | { | 27 | { |
27 | } | 28 | } |
28 | 29 | ||
29 | |||
30 | QString DocLnkItem::toRichText() | 30 | QString DocLnkItem::toRichText() |
31 | { | 31 | { |
32 | QString text; | 32 | QString text; |
33 | text += "<b><h3>"; | 33 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; |
34 | text += _doc->name(); | 34 | text += _doc->comment() + "<br>"; |
35 | text += "</b></h3><br>"; | 35 | text += "File: " + _doc->file() + "<br>"; |
36 | text += _doc->comment(); | 36 | text += "Mimetype: " + _doc->type() + "<br>"; |
37 | text += "<br><br>`"; | 37 | if ( _doc->type().contains( "text" ) ){ |
38 | text += "<br><br><hr><br>"; | ||
39 | QFile f(_doc->file()); | ||
40 | if ( f.open(IO_ReadOnly) ) { | ||
41 | QTextStream t( &f ); | ||
42 | while ( !t.eof() ) | ||
43 | text += t.readLine() + "<br>"; | ||
44 | } | ||
45 | f.close(); | ||
46 | } | ||
47 | /* text += "<br><br>`"; | ||
38 | text += _doc->exec(); | 48 | text += _doc->exec(); |
39 | text += "`"; | 49 | text += "`";*/ |
50 | QStringList list = _doc->mimeTypes(); | ||
51 | int i = 0; | ||
52 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | ||
53 | text += QString::number( i++) + " - " + *it ; | ||
54 | } | ||
40 | return text; | 55 | return text; |
41 | } | 56 | } |
42 | 57 | ||
43 | void DocLnkItem::editItem() | 58 | void DocLnkItem::action( int act ) |
44 | { | 59 | { |
45 | _doc->execute(); | 60 | qDebug("action %i",act); |
61 | if (!_doc->isValid()) qDebug("INVALID"); | ||
62 | if (act == 0) _doc->execute(); | ||
46 | } | 63 | } |
47 | 64 | ||
48 | void DocLnkItem::showItem() | 65 | QIntDict<QString> DocLnkItem::actions() |
49 | { | 66 | { |
50 | /* QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | 67 | QIntDict<QString> result; |
51 | e << _contact->uid();*/ | 68 | result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); |
52 | ResultItem::showItem(); | 69 | return result; |
53 | } | 70 | } |
54 | |||
diff --git a/core/pim/osearch/doclnkitem.h b/core/pim/osearch/doclnkitem.h index 2718733..4fd6dd7 100644 --- a/core/pim/osearch/doclnkitem.h +++ b/core/pim/osearch/doclnkitem.h | |||
@@ -18,20 +18,20 @@ | |||
18 | class DocLnk; | 18 | class DocLnk; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class DocLnkItem : public ResultItem | 23 | class DocLnkItem : public ResultItem |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | DocLnkItem(OListViewItem* parent, DocLnk *app); | 26 | DocLnkItem(OListViewItem* parent, DocLnk *app); |
27 | ~DocLnkItem(); | 27 | ~DocLnkItem(); |
28 | 28 | ||
29 | virtual QString toRichText(); | 29 | virtual QString toRichText(); |
30 | virtual void editItem(); | 30 | virtual void action( int ); |
31 | virtual void showItem(); | 31 | virtual QIntDict<QString> actions(); |
32 | 32 | ||
33 | private: | 33 | private: |
34 | DocLnk *_doc; | 34 | DocLnk *_doc; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #endif | 37 | #endif |
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index e99a385..f2a60e9 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp | |||
@@ -8,39 +8,31 @@ | |||
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "doclnksearch.h" | 13 | #include "doclnksearch.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | 17 | ||
18 | #include "doclnkitem.h" | 18 | #include "doclnkitem.h" |
19 | 19 | ||
20 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) | 20 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) |
21 | : AppLnkSearch(parent, name) | ||
21 | { | 22 | { |
22 | _docs = 0; | ||
23 | } | 23 | } |
24 | 24 | ||
25 | 25 | ||
26 | DocLnkSearch::~DocLnkSearch() | 26 | DocLnkSearch::~DocLnkSearch() |
27 | { | 27 | { |
28 | delete _docs; | ||
29 | } | 28 | } |
30 | 29 | ||
31 | 30 | void DocLnkSearch::load() | |
32 | void DocLnkSearch::expand() | ||
33 | { | 31 | { |
34 | SearchGroup::expand(); | 32 | _apps = new DocLnkSet(QPEApplication::documentDir()); |
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 | } | 33 | } |
46 | 34 | ||
35 | void DocLnkSearch::insertItem( void *rec ) | ||
36 | { | ||
37 | new DocLnkItem( this, (DocLnk*)rec ); | ||
38 | } | ||
diff --git a/core/pim/osearch/doclnksearch.h b/core/pim/osearch/doclnksearch.h index ec740de..e2ac40b 100644 --- a/core/pim/osearch/doclnksearch.h +++ b/core/pim/osearch/doclnksearch.h | |||
@@ -4,32 +4,30 @@ | |||
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #ifndef DOCLNKSEARCH_H | 13 | #ifndef DOCLNKSEARCH_H |
14 | #define DOCLNKSEARCH_H | 14 | #define DOCLNKSEARCH_H |
15 | 15 | ||
16 | #include "searchgroup.h" | 16 | #include "applnksearch.h" |
17 | |||
18 | class DocLnkSet; | ||
19 | 17 | ||
20 | /** | 18 | /** |
21 | @author Patrick S. Vogt | 19 | @author Patrick S. Vogt |
22 | */ | 20 | */ |
23 | class DocLnkSearch : public SearchGroup | 21 | class DocLnkSearch : public AppLnkSearch |
24 | { | 22 | { |
25 | public: | 23 | public: |
26 | DocLnkSearch(QListView* parent, QString name); | 24 | DocLnkSearch(QListView* parent, QString name); |
27 | |||
28 | ~DocLnkSearch(); | 25 | ~DocLnkSearch(); |
29 | 26 | ||
30 | virtual void expand(); | 27 | protected: |
31 | private: | 28 | virtual void load(); |
32 | DocLnkSet *_docs; | 29 | virtual void insertItem( void* ); |
30 | |||
33 | }; | 31 | }; |
34 | 32 | ||
35 | #endif | 33 | #endif |
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp index 758ad85..3b84b42 100644 --- a/core/pim/osearch/eventitem.cpp +++ b/core/pim/osearch/eventitem.cpp | |||
@@ -25,26 +25,30 @@ EventItem::EventItem(OListViewItem* parent, OEvent *event) | |||
25 | 25 | ||
26 | 26 | ||
27 | EventItem::~EventItem() | 27 | EventItem::~EventItem() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | QString EventItem::toRichText() | 32 | QString EventItem::toRichText() |
33 | { | 33 | { |
34 | return _event->toRichText(); | 34 | return _event->toRichText(); |
35 | } | 35 | } |
36 | 36 | ||
37 | void EventItem::editItem() | 37 | void EventItem::action( int act ) |
38 | { | 38 | { |
39 | QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); | 39 | if (act == 0){ |
40 | e << _event->uid(); | 40 | QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); |
41 | e << _event->startDateTime().date(); | ||
42 | }else if(act == 1){ | ||
43 | QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); | ||
44 | e << _event->uid(); | ||
45 | } | ||
41 | } | 46 | } |
42 | 47 | ||
43 | void EventItem::showItem() | 48 | QIntDict<QString> EventItem::actions() |
44 | { | 49 | { |
45 | QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); | 50 | QIntDict<QString> result; |
46 | QDate day = _event->startDateTime().date(); | 51 | result.insert( 0, new QString( QObject::tr("show") ) ); |
47 | qDebug("sending view day %s",day.toString().latin1()); | 52 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
48 | e << day; | 53 | return result; |
49 | } | 54 | } |
50 | |||
diff --git a/core/pim/osearch/eventitem.h b/core/pim/osearch/eventitem.h index 999f0ac..d0d45a8 100644 --- a/core/pim/osearch/eventitem.h +++ b/core/pim/osearch/eventitem.h | |||
@@ -19,21 +19,21 @@ class OEvent; | |||
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class EventItem : public ResultItem | 23 | class EventItem : public ResultItem |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | EventItem(OListViewItem* parent, OEvent *event); | 26 | EventItem(OListViewItem* parent, OEvent *event); |
27 | 27 | ||
28 | ~EventItem(); | 28 | ~EventItem(); |
29 | 29 | ||
30 | virtual QString toRichText(); | 30 | virtual QString toRichText(); |
31 | virtual void editItem(); | 31 | virtual void action( int ); |
32 | virtual void showItem(); | 32 | virtual QIntDict<QString> actions(); |
33 | 33 | ||
34 | private: | 34 | private: |
35 | OEvent *_event; | 35 | OEvent *_event; |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | #endif | 39 | #endif |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 140d7bb..a0b7b23 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -16,91 +16,100 @@ | |||
16 | #include <qpe/qpemessagebox.h> | 16 | #include <qpe/qpemessagebox.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qaction.h> | 21 | #include <qaction.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qhbuttongroup.h> | ||
28 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qintdict.h> | ||
29 | #include <qlayout.h> | 31 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
31 | #include <qtextbrowser.h> | 33 | #include <qtextbrowser.h> |
32 | 34 | ||
33 | #include "olistview.h" | 35 | #include "olistview.h" |
34 | #include "olistviewitem.h" | 36 | #include "olistviewitem.h" |
35 | #include "resultitem.h" | 37 | #include "resultitem.h" |
36 | #include "adresssearch.h" | 38 | #include "adresssearch.h" |
37 | #include "todosearch.h" | 39 | #include "todosearch.h" |
38 | #include "datebooksearch.h" | 40 | #include "datebooksearch.h" |
39 | #include "applnksearch.h" | 41 | #include "applnksearch.h" |
40 | #include "doclnksearch.h" | 42 | #include "doclnksearch.h" |
41 | 43 | ||
42 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 44 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
43 | QMainWindow( parent, name, f ), _currentItem(0) | 45 | QMainWindow( parent, name, f ), _currentItem(0) |
44 | { | 46 | { |
45 | setCaption( tr("OSearch") ); | 47 | setCaption( tr("OSearch") ); |
46 | 48 | ||
47 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 49 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); |
48 | 50 | ||
49 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 51 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
50 | 52 | ||
51 | mainLayout = new QVBoxLayout( mainFrame ); | 53 | mainLayout = new QVBoxLayout( mainFrame ); |
52 | mainLayout->setSpacing( 0 ); | 54 | mainLayout->setSpacing( 0 ); |
53 | mainLayout->setMargin( 0 ); | 55 | mainLayout->setMargin( 0 ); |
54 | 56 | ||
55 | resultsList = new OListView( mainFrame ); | 57 | resultsList = new OListView( mainFrame ); |
56 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 58 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); |
57 | mainLayout->addWidget( resultsList ); | 59 | mainLayout->addWidget( resultsList, 1 ); |
58 | 60 | ||
59 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 61 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
60 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 62 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
61 | richEdit = new QTextView( detailsFrame ); | 63 | richEdit = new QTextView( detailsFrame ); |
62 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 64 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); |
63 | detailsLayout->addWidget( richEdit, 0 ); | 65 | //richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum )); |
64 | QHBoxLayout *buttonLayout = new QHBoxLayout( detailsFrame ); | 66 | detailsLayout->addWidget( richEdit, 1 ); |
65 | detailsLayout->addLayout( buttonLayout, 0 ); | 67 | |
68 | buttonGroupActions = new QHButtonGroup( this ); | ||
69 | _buttonCount = 0; | ||
70 | // buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | ||
71 | |||
72 | buttonLayout = new QHBoxLayout( detailsFrame ); | ||
73 | buttonGroupActions->hide(); | ||
74 | //buttonLayout->addWidget( buttonGroupActions, 0 ); | ||
75 | |||
76 | detailsLayout->addLayout( buttonLayout ); | ||
77 | /* | ||
66 | QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" ); | 78 | QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" ); |
67 | buttonShow->setText( tr("show") ); | 79 | buttonShow->setText( tr("show") ); |
68 | // buttonShow->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | ||
69 | QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" ); | 80 | QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" ); |
70 | buttonEdit->setText( tr("edit") ); | 81 | buttonEdit->setText( tr("edit") ); |
71 | // buttonEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | ||
72 | buttonLayout->addWidget( buttonShow, 0 ); | 82 | buttonLayout->addWidget( buttonShow, 0 ); |
73 | buttonLayout->addWidget( buttonEdit, 0 ); | 83 | buttonLayout->addWidget( buttonEdit, 0 ); |
74 | 84 | */ | |
75 | mainLayout->addWidget( detailsFrame, 0 ); | 85 | mainLayout->addWidget( detailsFrame ); |
76 | detailsFrame->hide(); | 86 | detailsFrame->hide(); |
77 | 87 | ||
78 | adrSearch = new AdressSearch( resultsList, tr("adressbook") ); | 88 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); |
79 | todoSearch = new TodoSearch( resultsList, tr("todo") ); | 89 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); |
80 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); | 90 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); |
81 | applnkSearch = new AppLnkSearch( resultsList, tr("applications") ); | 91 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); |
82 | doclnkSearch = new DocLnkSearch( resultsList, tr("documents") ); | 92 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); |
83 | 93 | ||
84 | makeMenu(); | 94 | makeMenu(); |
85 | setCentralWidget( mainFrame ); | 95 | setCentralWidget( mainFrame ); |
86 | 96 | ||
87 | popupTimer = new QTimer(); | 97 | popupTimer = new QTimer(); |
88 | 98 | ||
89 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 99 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
90 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 100 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
91 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 101 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
92 | connect(buttonShow, SIGNAL(clicked()), SLOT( showItem() ) ); | 102 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); |
93 | connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) ); | 103 | // connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) ); |
94 | |||
95 | 104 | ||
96 | } | 105 | } |
97 | 106 | ||
98 | void MainWindow::makeMenu() | 107 | void MainWindow::makeMenu() |
99 | { | 108 | { |
100 | // QPEToolBar *toolBar = new QPEToolBar( this ); | 109 | // QPEToolBar *toolBar = new QPEToolBar( this ); |
101 | // QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 110 | // QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
102 | // QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 111 | // QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
103 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 112 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
104 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 113 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
105 | // | 114 | // |
106 | setToolBarsMovable( false ); | 115 | setToolBarsMovable( false ); |
@@ -127,56 +136,69 @@ MainWindow::~MainWindow() | |||
127 | { | 136 | { |
128 | } | 137 | } |
129 | 138 | ||
130 | void MainWindow::setCurrent(QListViewItem *item) | 139 | void MainWindow::setCurrent(QListViewItem *item) |
131 | { | 140 | { |
132 | if (!item) return; | 141 | if (!item) return; |
133 | _currentItem = (OListViewItem*)item; | 142 | _currentItem = (OListViewItem*)item; |
134 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 143 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
135 | if (_currentItem->rtti() == OListViewItem::Result){ | 144 | if (_currentItem->rtti() == OListViewItem::Result){ |
136 | ResultItem *res = (ResultItem*)item; | 145 | ResultItem *res = (ResultItem*)item; |
137 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 146 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
138 | richEdit->setText( res->toRichText() ); | 147 | richEdit->setText( res->toRichText() ); |
148 | QIntDict<QString> acts = res->actions(); | ||
149 | QButton *button; | ||
150 | for (uint i = 0; i < acts.count(); i++){ | ||
151 | button = buttonGroupActions->find( i ); | ||
152 | qDebug("action %i >%s<",i,acts[i]->latin1()); | ||
153 | if (!button) { | ||
154 | qDebug("BUTTON"); | ||
155 | button = new QPushButton( detailsFrame ); | ||
156 | buttonLayout->addWidget( button, 0 ); | ||
157 | buttonGroupActions->insert( button, i); | ||
158 | } | ||
159 | button->setText( *acts[i] ); | ||
160 | button->show(); | ||
161 | } | ||
162 | for (uint i = acts.count(); i < _buttonCount; i++){ | ||
163 | qDebug("remove button %i of %i",i, _buttonCount); | ||
164 | button = buttonGroupActions->find( i ); | ||
165 | if (button) button->hide(); | ||
166 | } | ||
167 | _buttonCount = acts.count(); | ||
168 | // buttonShow = new QPushButton( detailsFrame, "Show" ) ; | ||
169 | // buttonShow->setText( "test" ); | ||
170 | // buttonLayout->addWidget( buttonShow, 0 ); | ||
171 | // buttonGroupActions->insert(buttonShow); | ||
139 | detailsFrame->show(); | 172 | detailsFrame->show(); |
140 | }else detailsFrame->hide(); | 173 | }else detailsFrame->hide(); |
141 | //_currentItem = (OListViewItem*)item; | 174 | //_currentItem = (OListViewItem*)item; |
142 | popupTimer->start( 300 ); | 175 | popupTimer->start( 300 ); |
143 | } | 176 | } |
144 | 177 | ||
145 | void MainWindow::stopTimer(QListViewItem*) | 178 | void MainWindow::stopTimer(QListViewItem*) |
146 | { | 179 | { |
147 | popupTimer->stop(); | 180 | popupTimer->stop(); |
148 | } | 181 | } |
149 | 182 | ||
150 | void MainWindow::showPopup() | 183 | void MainWindow::showPopup() |
151 | { | 184 | { |
152 | qDebug("showPopup"); | 185 | qDebug("showPopup"); |
153 | if (!_item) return; | 186 | if (!_currentItem) return; |
154 | } | 187 | } |
155 | 188 | ||
156 | void MainWindow::setSearch( const QString &key ) | 189 | void MainWindow::setSearch( const QString &key ) |
157 | { | 190 | { |
158 | adrSearch->setSearch(key); | 191 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
159 | todoSearch->setSearch(key); | 192 | s->setSearch( key ); |
160 | datebookSearch->setSearch(key); | ||
161 | applnkSearch->setSearch(key); | ||
162 | doclnkSearch->setSearch(key); | ||
163 | } | 193 | } |
164 | 194 | ||
165 | 195 | ||
166 | void MainWindow::showItem() | 196 | void MainWindow::slotAction( int act) |
167 | { | 197 | { |
168 | if (_currentItem->rtti() == OListViewItem::Result){ | 198 | if (_currentItem->rtti() == OListViewItem::Result){ |
169 | ResultItem *res = (ResultItem*)_currentItem; | 199 | ResultItem *res = (ResultItem*)_currentItem; |
170 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 200 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
171 | res->showItem(); | 201 | res->action(act); |
172 | } | 202 | } |
173 | } | 203 | } |
174 | 204 | ||
175 | void MainWindow::editItem() | ||
176 | { | ||
177 | if (_currentItem->rtti() == OListViewItem::Result){ | ||
178 | ResultItem *res = (ResultItem*)_currentItem; | ||
179 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | ||
180 | res->editItem(); | ||
181 | } | ||
182 | } | ||
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index 424b4ba..f6ae0a4 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -6,68 +6,65 @@ | |||
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
11 | 11 | ||
12 | #ifndef MAINWINDOW_H | 12 | #ifndef MAINWINDOW_H |
13 | #define MAINWINDOW_H | 13 | #define MAINWINDOW_H |
14 | 14 | ||
15 | #include <qmainwindow.h> | 15 | #include <qmainwindow.h> |
16 | #include <qdialog.h> | 16 | #include <qdialog.h> |
17 | #include <qaction.h> | 17 | #include <qaction.h> |
18 | #include <qlist.h> | ||
18 | #include <qtimer.h> | 19 | #include <qtimer.h> |
19 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
20 | 21 | ||
21 | class QPEToolBar; | 22 | class QPEToolBar; |
22 | class QVBoxLayout; | 23 | class QVBoxLayout; |
24 | class QHBoxLayout; | ||
23 | class QTextView; | 25 | class QTextView; |
24 | class QFrame; | 26 | class QFrame; |
25 | class QListViewItem; | 27 | class QListViewItem; |
26 | class OListView; | 28 | class OListView; |
27 | class OListViewItem; | 29 | class OListViewItem; |
28 | class AdressSearch; | 30 | class QHButtonGroup; |
29 | class TodoSearch; | 31 | |
30 | class DatebookSearch; | 32 | class SearchGroup; |
31 | class AppLnkSearch; | ||
32 | class DocLnkSearch; | ||
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | 38 | ||
39 | public: | 39 | public: |
40 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 40 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
41 | ~MainWindow(); | 41 | ~MainWindow(); |
42 | 42 | ||
43 | 43 | ||
44 | public slots: | 44 | public slots: |
45 | void setCurrent(QListViewItem*); | 45 | void setCurrent(QListViewItem*); |
46 | void showPopup(); | 46 | void showPopup(); |
47 | void stopTimer( QListViewItem* ); | 47 | void stopTimer( QListViewItem* ); |
48 | void setSearch( const QString& ); | 48 | void setSearch( const QString& ); |
49 | 49 | ||
50 | protected slots: | 50 | protected slots: |
51 | void showItem(); | 51 | void slotAction(int); |
52 | void editItem(); | ||
53 | 52 | ||
54 | private: | 53 | private: |
55 | OListView *resultsList; | 54 | OListView *resultsList; |
56 | QTextView *richEdit; | 55 | QTextView *richEdit; |
57 | OListViewItem *_currentItem; | 56 | OListViewItem *_currentItem; |
58 | QVBoxLayout *mainLayout; | 57 | QVBoxLayout *mainLayout; |
58 | QHBoxLayout *buttonLayout; | ||
59 | QFrame *detailsFrame; | 59 | QFrame *detailsFrame; |
60 | OListViewItem *_item; | 60 | // OListViewItem *_item; |
61 | QTimer *popupTimer; | 61 | QTimer *popupTimer; |
62 | 62 | ||
63 | AdressSearch *adrSearch; | 63 | QList<SearchGroup> searches; |
64 | TodoSearch *todoSearch; | 64 | QHButtonGroup *buttonGroupActions; |
65 | DatebookSearch *datebookSearch; | 65 | uint _buttonCount; |
66 | AppLnkSearch *applnkSearch; | ||
67 | DocLnkSearch *doclnkSearch; | ||
68 | |||
69 | void makeMenu(); | 66 | void makeMenu(); |
70 | }; | 67 | }; |
71 | 68 | ||
72 | #endif | 69 | #endif |
73 | 70 | ||
diff --git a/core/pim/osearch/resultitem.cpp b/core/pim/osearch/resultitem.cpp index 31114d2..2c1e95a 100644 --- a/core/pim/osearch/resultitem.cpp +++ b/core/pim/osearch/resultitem.cpp | |||
@@ -18,24 +18,12 @@ | |||
18 | 18 | ||
19 | 19 | ||
20 | ResultItem::ResultItem(OListViewItem* parent) | 20 | ResultItem::ResultItem(OListViewItem* parent) |
21 | : OListViewItem(parent) | 21 | : OListViewItem(parent) |
22 | { | 22 | { |
23 | 23 | ||
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | ResultItem::~ResultItem() | 27 | ResultItem::~ResultItem() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | |||
31 | void ResultItem::showItem() | ||
32 | { | ||
33 | QMessageBox::warning(0,"Not implemented","show is not yet implemented for this"); | ||
34 | } | ||
35 | |||
36 | |||
37 | void ResultItem::editItem() | ||
38 | { | ||
39 | QMessageBox::warning(0,"Not implemented","edit is not yet implemented for this"); | ||
40 | } | ||
41 | |||
diff --git a/core/pim/osearch/resultitem.h b/core/pim/osearch/resultitem.h index 2cfb7f8..9e87f99 100644 --- a/core/pim/osearch/resultitem.h +++ b/core/pim/osearch/resultitem.h | |||
@@ -4,30 +4,32 @@ | |||
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #ifndef RESULTITEM_H | 13 | #ifndef RESULTITEM_H |
14 | #define RESULTITEM_H | 14 | #define RESULTITEM_H |
15 | 15 | ||
16 | #include <qintdict.h> | ||
17 | |||
16 | #include "olistviewitem.h" | 18 | #include "olistviewitem.h" |
17 | 19 | ||
18 | /** | 20 | /** |
19 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
20 | */ | 22 | */ |
21 | class ResultItem : public OListViewItem | 23 | class ResultItem : public OListViewItem |
22 | { | 24 | { |
23 | public: | 25 | public: |
24 | ResultItem(OListViewItem* parent); | 26 | ResultItem(OListViewItem* parent); |
25 | ~ResultItem(); | 27 | ~ResultItem(); |
26 | 28 | ||
27 | virtual QString toRichText() {return "no text";}; | 29 | virtual QString toRichText() {return "no text";}; |
28 | virtual int rtti() { return Result;} | 30 | virtual int rtti() { return Result;} |
29 | virtual void showItem(); | 31 | virtual void action( int ) = 0; |
30 | virtual void editItem(); | 32 | virtual QIntDict<QString> actions() = 0; |
31 | }; | 33 | }; |
32 | 34 | ||
33 | #endif | 35 | #endif |
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp index dce3b14..d062207 100644 --- a/core/pim/osearch/searchgroup.cpp +++ b/core/pim/osearch/searchgroup.cpp | |||
@@ -2,49 +2,65 @@ | |||
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "searchgroup.h" | 13 | #include "searchgroup.h" |
14 | |||
15 | #include <qregexp.h> | ||
16 | |||
14 | #include "olistviewitem.h" | 17 | #include "olistviewitem.h" |
15 | 18 | ||
16 | SearchGroup::SearchGroup(QListView* parent, QString name) | 19 | SearchGroup::SearchGroup(QListView* parent, QString name) |
17 | : OListViewItem(parent, name) | 20 | : OListViewItem(parent, name) |
18 | { | 21 | { |
19 | _name = name; | 22 | _name = name; |
23 | loaded = false; | ||
20 | expanded = false; | 24 | expanded = false; |
21 | } | 25 | } |
22 | 26 | ||
23 | 27 | ||
24 | SearchGroup::~SearchGroup() | 28 | SearchGroup::~SearchGroup() |
25 | { | 29 | { |
26 | } | 30 | } |
27 | 31 | ||
28 | 32 | ||
29 | void SearchGroup::expand() | 33 | void SearchGroup::expand() |
30 | { | 34 | { |
35 | clearList(); | ||
36 | if (_search.isEmpty()) return; | ||
37 | OListViewItem *dummy = new OListViewItem( this, "searching..."); | ||
38 | setOpen( expanded ); | ||
39 | if (!loaded) load(); | ||
40 | int res_count = search(); | ||
41 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | ||
42 | delete dummy; | ||
43 | } | ||
44 | |||
45 | |||
46 | void SearchGroup::clearList() | ||
47 | { | ||
31 | QListViewItem *item = firstChild(); | 48 | QListViewItem *item = firstChild(); |
32 | QListViewItem *toDel; | 49 | QListViewItem *toDel; |
33 | 50 | ||
34 | while ( item != 0 ) { | 51 | while ( item != 0 ) { |
35 | toDel = item; | 52 | toDel = item; |
36 | item = item->nextSibling(); | 53 | item = item->nextSibling(); |
37 | //takeItem(toDel); | 54 | delete toDel; |
38 | delete toDel; | ||
39 | } | 55 | } |
40 | expanded = true; | 56 | expanded = true; |
41 | } | 57 | } |
42 | 58 | ||
43 | void SearchGroup::setSearch(QString s) | 59 | void SearchGroup::setSearch(QString s) |
44 | { | 60 | { |
45 | setSearch( QRegExp( s ) ); | 61 | setSearch( QRegExp( s ) ); |
46 | _search.setCaseSensitive(false); | 62 | _search.setCaseSensitive(false); |
47 | } | 63 | } |
48 | 64 | ||
49 | 65 | ||
50 | void SearchGroup::setSearch(QRegExp re) | 66 | void SearchGroup::setSearch(QRegExp re) |
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h index d26ff17..ebe1193 100644 --- a/core/pim/osearch/searchgroup.h +++ b/core/pim/osearch/searchgroup.h | |||
@@ -6,37 +6,44 @@ | |||
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #ifndef SEARCHGROUP_H | 13 | #ifndef SEARCHGROUP_H |
14 | #define SEARCHGROUP_H | 14 | #define SEARCHGROUP_H |
15 | 15 | ||
16 | #include "olistviewitem.h" | 16 | #include "olistviewitem.h" |
17 | 17 | ||
18 | #include <qregexp.h> | 18 | class QRegExp; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class SearchGroup : public OListViewItem | 23 | class SearchGroup : public OListViewItem |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | SearchGroup(QListView* parent, QString name); | 26 | SearchGroup(QListView* parent, QString name); |
27 | 27 | ||
28 | ~SearchGroup(); | 28 | ~SearchGroup(); |
29 | 29 | ||
30 | virtual void expand(); | 30 | virtual void expand(); |
31 | virtual void setSearch(QString); | 31 | virtual void setSearch(QString); |
32 | virtual void setSearch(QRegExp); | 32 | virtual void setSearch(QRegExp); |
33 | virtual int rtti() { return Searchgroup;} | 33 | virtual int rtti() { return Searchgroup;} |
34 | 34 | ||
35 | |||
36 | |||
35 | protected: | 37 | protected: |
36 | QRegExp _search; | 38 | QRegExp _search; |
39 | virtual void load() = 0; | ||
40 | virtual int search() = 0; | ||
41 | virtual void insertItem( void* ) = 0; | ||
37 | private: | 42 | private: |
43 | void clearList(); | ||
38 | QString _name; | 44 | QString _name; |
39 | bool expanded; | 45 | bool expanded; |
46 | bool loaded; | ||
40 | }; | 47 | }; |
41 | 48 | ||
42 | #endif | 49 | #endif |
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp index 145b423..8b354f1 100644 --- a/core/pim/osearch/todoitem.cpp +++ b/core/pim/osearch/todoitem.cpp | |||
@@ -1,54 +1,52 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "todoitem.h" | 13 | #include "todoitem.h" |
14 | 14 | ||
15 | #include <opie/otodo.h> | 15 | #include <opie/otodo.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 16 | #include <qpe/qcopenvelope_qws.h> |
17 | 17 | ||
18 | TodoItem::TodoItem(OListViewItem* parent, OTodo *todo) | 18 | TodoItem::TodoItem(OListViewItem* parent, OTodo *todo) |
19 | : ResultItem(parent) | 19 | : ResultItem(parent) |
20 | { | 20 | { |
21 | _todo = todo; | 21 | _todo = todo; |
22 | setText( 0, todo->toShortText() ); | 22 | setText( 0, todo->toShortText() ); |
23 | } | 23 | } |
24 | 24 | ||
25 | |||
26 | TodoItem::~TodoItem() | 25 | TodoItem::~TodoItem() |
27 | { | 26 | { |
28 | delete _todo; | 27 | delete _todo; |
29 | } | 28 | } |
30 | 29 | ||
31 | |||
32 | void TodoItem::expand() | ||
33 | { | ||
34 | ResultItem::expand(); | ||
35 | } | ||
36 | |||
37 | QString TodoItem::toRichText() | 30 | QString TodoItem::toRichText() |
38 | { | 31 | { |
39 | return _todo->toRichText(); | 32 | return _todo->toRichText(); |
40 | } | 33 | } |
41 | 34 | ||
42 | void TodoItem::showItem() | 35 | void TodoItem::action( int act ) |
43 | { | 36 | { |
44 | //QCopEnvelope e("QPE/Todolist", "show(int)"); | 37 | if (act == 0){ |
45 | QCopEnvelope e("QPE/Application/todolist", "show(int)"); | 38 | QCopEnvelope e("QPE/Application/todolist", "show(int)"); |
46 | e << _todo->uid(); | 39 | e << _todo->uid(); |
40 | }else if (act == 1){ | ||
41 | QCopEnvelope e("QPE/Application/todolist", "edit(int)"); | ||
42 | e << _todo->uid(); | ||
43 | } | ||
47 | } | 44 | } |
48 | 45 | ||
49 | void TodoItem::editItem() | 46 | QIntDict<QString> TodoItem::actions() |
50 | { | 47 | { |
51 | //QCopEnvelope e("QPE/Todolist", "edit(int)"); | 48 | QIntDict<QString> result; |
52 | QCopEnvelope e("QPE/Application/todolist", "edit(int)"); | 49 | result.insert( 0, new QString( QObject::tr("show") ) ); |
53 | e << _todo->uid(); | 50 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
51 | return result; | ||
54 | } | 52 | } |
diff --git a/core/pim/osearch/todoitem.h b/core/pim/osearch/todoitem.h index 6f34915..9dfd4ff 100644 --- a/core/pim/osearch/todoitem.h +++ b/core/pim/osearch/todoitem.h | |||
@@ -1,38 +1,37 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Interface: $MODULE$ | 3 | // C++ Interface: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #ifndef TODOITEM_H | 13 | #ifndef TODOITEM_H |
14 | #define TODOITEM_H | 14 | #define TODOITEM_H |
15 | 15 | ||
16 | #include "resultitem.h" | 16 | #include "resultitem.h" |
17 | class OTodo; | 17 | class OTodo; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | @author Patrick S. Vogt | 20 | @author Patrick S. Vogt |
21 | */ | 21 | */ |
22 | class TodoItem : public ResultItem | 22 | class TodoItem : public ResultItem |
23 | { | 23 | { |
24 | public: | 24 | public: |
25 | TodoItem(OListViewItem* parent, OTodo *todo); | 25 | TodoItem(OListViewItem* parent, OTodo *todo); |
26 | ~TodoItem(); | 26 | ~TodoItem(); |
27 | 27 | ||
28 | virtual void expand(); | ||
29 | virtual QString toRichText(); | 28 | virtual QString toRichText(); |
30 | virtual void showItem(); | 29 | virtual void action( int ); |
31 | virtual void editItem(); | 30 | virtual QIntDict<QString> actions(); |
32 | 31 | ||
33 | private: | 32 | private: |
34 | OTodo *_todo; | 33 | OTodo *_todo; |
35 | 34 | ||
36 | }; | 35 | }; |
37 | 36 | ||
38 | #endif | 37 | #endif |
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index cbe356b..6a73530 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -21,31 +21,30 @@ TodoSearch::TodoSearch(QListView* parent, QString name) | |||
21 | : SearchGroup(parent, name) | 21 | : SearchGroup(parent, name) |
22 | { | 22 | { |
23 | _todos = 0; | 23 | _todos = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | TodoSearch::~TodoSearch() | 27 | TodoSearch::~TodoSearch() |
28 | { | 28 | { |
29 | delete _todos; | 29 | delete _todos; |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | void TodoSearch::expand() | 33 | void TodoSearch::load() |
34 | { | 34 | { |
35 | SearchGroup::expand(); | ||
36 | if (_search.isEmpty()) return; | ||
37 | |||
38 | if (!_todos){ | ||
39 | _todos = new OTodoAccess(); | 35 | _todos = new OTodoAccess(); |
40 | _todos->load(); | 36 | _todos->load(); |
41 | } | 37 | } |
42 | 38 | ||
39 | int TodoSearch::search() | ||
40 | { | ||
43 | ORecordList<OTodo> results = _todos->matchRegexp(_search); | 41 | ORecordList<OTodo> results = _todos->matchRegexp(_search); |
44 | setText(0, text(0) + " (" + QString::number( results.count() ) + ")"); | 42 | for (uint i = 0; i < results.count(); i++) |
45 | for (uint i = 0; i < results.count(); i++) { | ||
46 | new TodoItem( this, new OTodo( results[i] )); | 43 | new TodoItem( this, new OTodo( results[i] )); |
47 | } | 44 | return results.count(); |
48 | |||
49 | } | 45 | } |
50 | 46 | ||
47 | void TodoSearch::insertItem( void* ) | ||
48 | { | ||
51 | 49 | ||
50 | } | ||
diff --git a/core/pim/osearch/todosearch.h b/core/pim/osearch/todosearch.h index 856be1f..1d025d6 100644 --- a/core/pim/osearch/todosearch.h +++ b/core/pim/osearch/todosearch.h | |||
@@ -11,25 +11,29 @@ | |||
11 | // | 11 | // |
12 | // | 12 | // |
13 | #ifndef TODOSEARCH_H | 13 | #ifndef TODOSEARCH_H |
14 | #define TODOSEARCH_H | 14 | #define TODOSEARCH_H |
15 | 15 | ||
16 | #include "searchgroup.h" | 16 | #include "searchgroup.h" |
17 | 17 | ||
18 | class OTodoAccess; | 18 | class OTodoAccess; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class TodoSearch : public SearchGroup | 23 | class TodoSearch : public SearchGroup |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | TodoSearch(QListView* parent, QString name); | 26 | TodoSearch(QListView* parent, QString name); |
27 | 27 | ||
28 | ~TodoSearch(); | 28 | ~TodoSearch(); |
29 | 29 | ||
30 | virtual void expand(); | 30 | protected: |
31 | virtual void load(); | ||
32 | virtual int search(); | ||
33 | virtual void insertItem( void* ); | ||
34 | |||
31 | private: | 35 | private: |
32 | OTodoAccess *_todos; | 36 | OTodoAccess *_todos; |
33 | }; | 37 | }; |
34 | 38 | ||
35 | #endif | 39 | #endif |