author | harlekin <harlekin> | 2004-03-01 16:38:12 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-03-01 16:38:12 (UTC) |
commit | 49615014f281a58bd9bde5543692ffddab052755 (patch) (unidiff) | |
tree | fea29073a62a2217ce25976e492772f0636dce80 | |
parent | 032f2d909293fb29e6c7e3cf9cce1a12484c80f7 (diff) | |
download | opie-49615014f281a58bd9bde5543692ffddab052755.zip opie-49615014f281a58bd9bde5543692ffddab052755.tar.gz opie-49615014f281a58bd9bde5543692ffddab052755.tar.bz2 |
osearch libopie1->libopie2
-rw-r--r-- | core/pim/osearch/adresssearch.cpp | 19 | ||||
-rw-r--r-- | core/pim/osearch/adresssearch.h | 8 | ||||
-rw-r--r-- | core/pim/osearch/applnkitem.cpp | 3 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.cpp | 13 | ||||
-rw-r--r-- | core/pim/osearch/contactitem.cpp | 7 | ||||
-rw-r--r-- | core/pim/osearch/contactitem.h | 9 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 19 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.h | 4 | ||||
-rw-r--r-- | core/pim/osearch/doclnkitem.cpp | 3 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 18 | ||||
-rw-r--r-- | core/pim/osearch/eventitem.cpp | 10 | ||||
-rw-r--r-- | core/pim/osearch/eventitem.h | 8 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 50 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 1 | ||||
-rw-r--r-- | core/pim/osearch/olistview.cpp | 9 | ||||
-rw-r--r-- | core/pim/osearch/osearch.pro | 2 | ||||
-rw-r--r-- | core/pim/osearch/resultitem.cpp | 4 | ||||
-rw-r--r-- | core/pim/osearch/resultitem.h | 4 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.cpp | 8 | ||||
-rw-r--r-- | core/pim/osearch/todoitem.cpp | 16 | ||||
-rw-r--r-- | core/pim/osearch/todoitem.h | 9 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 14 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.h | 8 |
23 files changed, 137 insertions, 109 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index 7681ea2..dbd6df6 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.cpp | |||
@@ -1,62 +1,61 @@ | |||
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 "adresssearch.h" | 13 | #include "adresssearch.h" |
14 | #include "contactitem.h" | ||
15 | |||
16 | #include <qpe/resource.h> | ||
14 | 17 | ||
15 | #include <qstring.h> | 18 | #include <qstring.h> |
16 | #include <qiconset.h> | 19 | #include <qiconset.h> |
17 | //#include <qwhatsthis.h> | 20 | //#include <qwhatsthis.h> |
18 | #include <qpe/resource.h> | ||
19 | #include <opie/ocontactaccess.h> | ||
20 | |||
21 | #include "contactitem.h" | ||
22 | 21 | ||
23 | AdressSearch::AdressSearch(QListView* parent, QString name): | 22 | AdressSearch::AdressSearch(QListView* parent, QString name): |
24 | SearchGroup(parent, name) | 23 | SearchGroup(parent, name) |
25 | { | 24 | { |
26 | _contacts = 0; | 25 | _contacts = 0; |
27 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBookSmall" ); | 26 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBookSmall" ); |
28 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); | 27 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); |
29 | 28 | ||
30 | 29 | ||
31 | //QWhatsThis::add( this, QObject::tr("Search the addressbook") ); | 30 | //QWhatsThis::add( this, QObject::tr("Search the addressbook") ); |
32 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); | 31 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); |
33 | QImage img = pix.convertToImage(); | 32 | QImage img = pix.convertToImage(); |
34 | img.smoothScale( 14, 14 ); | 33 | img.smoothScale( 14, 14 ); |
35 | pix.convertFromImage( img ); | 34 | pix.convertFromImage( img ); |
36 | setPixmap( 0, pix );*/ | 35 | setPixmap( 0, pix );*/ |
37 | } | 36 | } |
38 | 37 | ||
39 | 38 | ||
40 | AdressSearch::~AdressSearch() | 39 | AdressSearch::~AdressSearch() |
41 | { | 40 | { |
42 | delete _contacts; | 41 | delete _contacts; |
43 | } | 42 | } |
44 | 43 | ||
45 | void AdressSearch::load() | 44 | void AdressSearch::load() |
46 | { | 45 | { |
47 | _contacts = new OContactAccess("osearch"); | 46 | _contacts = new OPimContactAccess("osearch"); |
48 | } | 47 | } |
49 | 48 | ||
50 | int AdressSearch::search() | 49 | int AdressSearch::search() |
51 | { | 50 | { |
52 | ORecordList<OContact> results = _contacts->matchRegexp(_search); | 51 | OPimRecordList<OPimContact> results = _contacts->matchRegexp(_search); |
53 | for (uint i = 0; i < results.count(); i++) { | 52 | for (uint i = 0; i < results.count(); i++) { |
54 | (void)new ContactItem( this, new OContact( results[i] )); | 53 | (void)new ContactItem( this, new OPimContact( results[i] )); |
55 | } | 54 | } |
56 | return results.count(); | 55 | return results.count(); |
57 | } | 56 | } |
58 | 57 | ||
59 | void AdressSearch::insertItem( void* ) | 58 | void AdressSearch::insertItem( void* ) |
60 | { | 59 | { |
61 | 60 | ||
62 | } | 61 | } |
diff --git a/core/pim/osearch/adresssearch.h b/core/pim/osearch/adresssearch.h index d5c7622..028521a 100644 --- a/core/pim/osearch/adresssearch.h +++ b/core/pim/osearch/adresssearch.h | |||
@@ -1,38 +1,38 @@ | |||
1 | // | ||
2 | // | ||
3 | // C++ Interface: $MODULE$ | 1 | // C++ Interface: $MODULE$ |
4 | // | 2 | // |
5 | // Description: | 3 | // Description: |
6 | // | 4 | // |
7 | // | 5 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 6 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 7 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 8 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 9 | // |
12 | // | 10 | // |
13 | #ifndef ADRESSSEARCH_H | 11 | #ifndef ADRESSSEARCH_H |
14 | #define ADRESSSEARCH_H | 12 | #define ADRESSSEARCH_H |
15 | 13 | ||
16 | #include "searchgroup.h" | 14 | #include "searchgroup.h" |
15 | #include <opie2/ocontactaccess.h> | ||
16 | |||
17 | using namespace Opie; | ||
17 | 18 | ||
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 | protected: | 29 | protected: |
30 | virtual void load(); | 30 | virtual void load(); |
31 | virtual int search(); | 31 | virtual int search(); |
32 | virtual void insertItem( void* ); | 32 | virtual void insertItem( void* ); |
33 | 33 | ||
34 | private: | 34 | private: |
35 | OContactAccess *_contacts; | 35 | OPimContactAccess *_contacts; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp index 2c4a4cb..06c2b1e 100644 --- a/core/pim/osearch/applnkitem.cpp +++ b/core/pim/osearch/applnkitem.cpp | |||
@@ -1,60 +1,61 @@ | |||
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 | #include <qfileinfo.h> | ||
17 | #include <qpe/qcopenvelope_qws.h> | 16 | #include <qpe/qcopenvelope_qws.h> |
18 | 17 | ||
18 | #include <qfileinfo.h> | ||
19 | |||
19 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) | 20 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) |
20 | : ResultItem(parent) | 21 | : ResultItem(parent) |
21 | { | 22 | { |
22 | _app = app; | 23 | _app = app; |
23 | setText(0, _app->name() ); | 24 | setText(0, _app->name() ); |
24 | setPixmap(0, _app->pixmap() ); | 25 | setPixmap(0, _app->pixmap() ); |
25 | } | 26 | } |
26 | 27 | ||
27 | 28 | ||
28 | AppLnkItem::~AppLnkItem() | 29 | AppLnkItem::~AppLnkItem() |
29 | { | 30 | { |
30 | } | 31 | } |
31 | 32 | ||
32 | 33 | ||
33 | QString AppLnkItem::toRichText() | 34 | QString AppLnkItem::toRichText() |
34 | { | 35 | { |
35 | QString text; | 36 | QString text; |
36 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; | 37 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; |
37 | text += _app->comment() + "<br>"; | 38 | text += _app->comment() + "<br>"; |
38 | text += "<br>`" + _app->exec() + "`<br>"; | 39 | text += "<br>`" + _app->exec() + "`<br>"; |
39 | text += "<br>`" + _app->file() + "`<br>"; | 40 | text += "<br>`" + _app->file() + "`<br>"; |
40 | text += "<br>`" + _app->linkFile() + "`<br>"; | 41 | text += "<br>`" + _app->linkFile() + "`<br>"; |
41 | return text; | 42 | return text; |
42 | } | 43 | } |
43 | 44 | ||
44 | void AppLnkItem::action( int act ) | 45 | void AppLnkItem::action( int act ) |
45 | { | 46 | { |
46 | if (!_app->isValid()) qDebug("INVALID"); | 47 | if (!_app->isValid()) qDebug("INVALID"); |
47 | if (act == 0) _app->execute(); | 48 | if (act == 0) _app->execute(); |
48 | else if (act == 1){ | 49 | else if (act == 1){ |
49 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); | 50 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); |
50 | e << _app->linkFile(); | 51 | e << _app->linkFile(); |
51 | } | 52 | } |
52 | } | 53 | } |
53 | 54 | ||
54 | QIntDict<QString> AppLnkItem::actions() | 55 | QIntDict<QString> AppLnkItem::actions() |
55 | { | 56 | { |
56 | QIntDict<QString> result; | 57 | QIntDict<QString> result; |
57 | result.insert( 0, new QString( QObject::tr("execute") ) ); | 58 | result.insert( 0, new QString( QObject::tr("execute") ) ); |
58 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); | 59 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); |
59 | return result; | 60 | return result; |
60 | } | 61 | } |
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp index e8170c5..1c84d66 100644 --- a/core/pim/osearch/applnksearch.cpp +++ b/core/pim/osearch/applnksearch.cpp | |||
@@ -1,71 +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 "applnksearch.h" | 13 | #include "applnksearch.h" |
14 | #include "applnkitem.h" | ||
14 | 15 | ||
15 | #include <qpe/applnk.h> | 16 | #include <qpe/applnk.h> |
16 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
17 | #include <qiconset.h> | ||
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | 19 | ||
20 | #include "applnkitem.h" | 20 | #include <qiconset.h> |
21 | |||
22 | 21 | ||
23 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) | 22 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) |
24 | { | 23 | { |
25 | _apps = 0; | 24 | _apps = 0; |
26 | QIconSet is = Resource::loadIconSet( "osearch/applicationsSmall" ); | 25 | QIconSet is = Resource::loadIconSet( "osearch/applicationsSmall" ); |
27 | //QIconSet is = Resource::loadIconSet( "AppsIcon" ); | 26 | //QIconSet is = Resource::loadIconSet( "AppsIcon" ); |
28 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); | 27 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); |
29 | } | 28 | } |
30 | 29 | ||
31 | 30 | ||
32 | AppLnkSearch::~AppLnkSearch() | 31 | AppLnkSearch::~AppLnkSearch() |
33 | { | 32 | { |
34 | delete _apps; | 33 | delete _apps; |
35 | } | 34 | } |
36 | 35 | ||
37 | 36 | ||
38 | void AppLnkSearch::load() | 37 | void AppLnkSearch::load() |
39 | { | 38 | { |
40 | _apps = new AppLnkSet(QPEApplication::qpeDir()); | 39 | _apps = new AppLnkSet(QPEApplication::qpeDir()); |
41 | } | 40 | } |
42 | 41 | ||
43 | int AppLnkSearch::search() | 42 | int AppLnkSearch::search() |
44 | { | 43 | { |
45 | QList<AppLnk> appList = _apps->children(); | 44 | QList<AppLnk> appList = _apps->children(); |
46 | 45 | ||
47 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ | 46 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ |
48 | if ( (_search.match( app->name() ) != -1) | 47 | if ( (_search.match( app->name() ) != -1) |
49 | || (_search.match(app->comment()) != -1) | 48 | || (_search.match(app->comment()) != -1) |
50 | || (_search.match(app->exec()) != -1) ) { | 49 | || (_search.match(app->exec()) != -1) ) { |
51 | insertItem( app ); | 50 | insertItem( app ); |
52 | }else | 51 | }else |
53 | if (searchFile( app )) | 52 | if (searchFile( app )) |
54 | insertItem( app ); | 53 | insertItem( app ); |
55 | qApp->processEvents( 100 ); | 54 | qApp->processEvents( 100 ); |
56 | } | 55 | } |
57 | return _resultCount; | 56 | return _resultCount; |
58 | } | 57 | } |
59 | 58 | ||
60 | void AppLnkSearch::insertItem( void *rec ) | 59 | void AppLnkSearch::insertItem( void *rec ) |
61 | { | 60 | { |
62 | (void)new AppLnkItem( this, (AppLnk*)rec ); | 61 | (void)new AppLnkItem( this, (AppLnk*)rec ); |
63 | _resultCount++; | 62 | _resultCount++; |
64 | } | 63 | } |
65 | 64 | ||
66 | void AppLnkSearch::setSearch(QRegExp re) | 65 | void AppLnkSearch::setSearch(QRegExp re) |
67 | { | 66 | { |
68 | setOpen( false ); | 67 | setOpen( false ); |
69 | SearchGroup::setSearch( re ); | 68 | SearchGroup::setSearch( re ); |
70 | } | 69 | } |
71 | 70 | ||
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp index c4738ae..eedc374 100644 --- a/core/pim/osearch/contactitem.cpp +++ b/core/pim/osearch/contactitem.cpp | |||
@@ -1,141 +1,142 @@ | |||
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 <qpixmap.h> | ||
16 | #include <opie/ocontact.h> | ||
17 | #include <qpe/resource.h> | 15 | #include <qpe/resource.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 16 | #include <qpe/qcopenvelope_qws.h> |
19 | 17 | ||
20 | ContactItem::ContactItem(OListViewItem* parent, OContact *contact) | 18 | #include <qpixmap.h> |
19 | |||
20 | |||
21 | ContactItem::ContactItem(OListViewItem* parent, OPimContact *contact) | ||
21 | : ResultItem(parent) | 22 | : ResultItem(parent) |
22 | { | 23 | { |
23 | _contact = contact; | 24 | _contact = contact; |
24 | setText(0, _contact->toShortText()); | 25 | setText(0, _contact->toShortText()); |
25 | setIcon(); | 26 | setIcon(); |
26 | } | 27 | } |
27 | 28 | ||
28 | void ContactItem::setIcon() | 29 | void ContactItem::setIcon() |
29 | { | 30 | { |
30 | QPixmap icon; | 31 | QPixmap icon; |
31 | switch ( _contact->lastHitField() ) { | 32 | switch ( _contact->lastHitField() ) { |
32 | case -1: | 33 | case -1: |
33 | icon = Resource::loadPixmap( "reset" ); | 34 | icon = Resource::loadPixmap( "reset" ); |
34 | break; | 35 | break; |
35 | case Qtopia::BusinessPhone: | 36 | case Qtopia::BusinessPhone: |
36 | icon = Resource::loadPixmap( "addressbook/phonework" ); | 37 | icon = Resource::loadPixmap( "addressbook/phonework" ); |
37 | break; | 38 | break; |
38 | case Qtopia::BusinessFax: | 39 | case Qtopia::BusinessFax: |
39 | icon = Resource::loadPixmap( "addressbook/faxwork" ); | 40 | icon = Resource::loadPixmap( "addressbook/faxwork" ); |
40 | break; | 41 | break; |
41 | case Qtopia::BusinessMobile: | 42 | case Qtopia::BusinessMobile: |
42 | icon = Resource::loadPixmap( "addressbook/mobilework" ); | 43 | icon = Resource::loadPixmap( "addressbook/mobilework" ); |
43 | break; | 44 | break; |
44 | case Qtopia::DefaultEmail: | 45 | case Qtopia::DefaultEmail: |
45 | case Qtopia::Emails: | 46 | case Qtopia::Emails: |
46 | icon = Resource::loadPixmap( "addressbook/email" ); | 47 | icon = Resource::loadPixmap( "addressbook/email" ); |
47 | break; | 48 | break; |
48 | case Qtopia::HomePhone: | 49 | case Qtopia::HomePhone: |
49 | icon = Resource::loadPixmap( "addressbook/phonehome" ); | 50 | icon = Resource::loadPixmap( "addressbook/phonehome" ); |
50 | break; | 51 | break; |
51 | case Qtopia::HomeFax: | 52 | case Qtopia::HomeFax: |
52 | icon = Resource::loadPixmap( "addressbook/faxhome" ); | 53 | icon = Resource::loadPixmap( "addressbook/faxhome" ); |
53 | break; | 54 | break; |
54 | case Qtopia::HomeMobile: | 55 | case Qtopia::HomeMobile: |
55 | icon = Resource::loadPixmap( "addressbook/mobilehome" ); | 56 | icon = Resource::loadPixmap( "addressbook/mobilehome" ); |
56 | break; | 57 | break; |
57 | case Qtopia::HomeWebPage: | 58 | case Qtopia::HomeWebPage: |
58 | icon = Resource::loadPixmap( "addressbook/webpagehome" ); | 59 | icon = Resource::loadPixmap( "addressbook/webpagehome" ); |
59 | break; | 60 | break; |
60 | case Qtopia::BusinessWebPage: | 61 | case Qtopia::BusinessWebPage: |
61 | icon = Resource::loadPixmap( "addressbook/webpagework" ); | 62 | icon = Resource::loadPixmap( "addressbook/webpagework" ); |
62 | break; | 63 | break; |
63 | case Qtopia::Title: | 64 | case Qtopia::Title: |
64 | case Qtopia::JobTitle: | 65 | case Qtopia::JobTitle: |
65 | case Qtopia::FirstName: | 66 | case Qtopia::FirstName: |
66 | case Qtopia::MiddleName: | 67 | case Qtopia::MiddleName: |
67 | case Qtopia::LastName: | 68 | case Qtopia::LastName: |
68 | case Qtopia::Suffix: | 69 | case Qtopia::Suffix: |
69 | case Qtopia::Nickname: | 70 | case Qtopia::Nickname: |
70 | case Qtopia::FileAs: | 71 | case Qtopia::FileAs: |
71 | icon = Resource::loadPixmap( "addressbook/identity" ); | 72 | icon = Resource::loadPixmap( "addressbook/identity" ); |
72 | break; | 73 | break; |
73 | case Qtopia::HomeStreet: | 74 | case Qtopia::HomeStreet: |
74 | case Qtopia::HomeCity: | 75 | case Qtopia::HomeCity: |
75 | case Qtopia::HomeState: | 76 | case Qtopia::HomeState: |
76 | case Qtopia::HomeZip: | 77 | case Qtopia::HomeZip: |
77 | case Qtopia::HomeCountry: | 78 | case Qtopia::HomeCountry: |
78 | icon = Resource::loadPixmap( "osearch/addresshome" ); | 79 | icon = Resource::loadPixmap( "osearch/addresshome" ); |
79 | break; | 80 | break; |
80 | case Qtopia::Company: | 81 | case Qtopia::Company: |
81 | case Qtopia::BusinessCity: | 82 | case Qtopia::BusinessCity: |
82 | case Qtopia::BusinessStreet: | 83 | case Qtopia::BusinessStreet: |
83 | case Qtopia::BusinessZip: | 84 | case Qtopia::BusinessZip: |
84 | case Qtopia::BusinessCountry: | 85 | case Qtopia::BusinessCountry: |
85 | case Qtopia::Department: | 86 | case Qtopia::Department: |
86 | case Qtopia::Office: | 87 | case Qtopia::Office: |
87 | case Qtopia::Manager: | 88 | case Qtopia::Manager: |
88 | case Qtopia::BusinessPager: | 89 | case Qtopia::BusinessPager: |
89 | case Qtopia::Profession: | 90 | case Qtopia::Profession: |
90 | icon = Resource::loadPixmap( "osearch/addresshome" ); | 91 | icon = Resource::loadPixmap( "osearch/addresshome" ); |
91 | break; | 92 | break; |
92 | case Qtopia::Assistant: | 93 | case Qtopia::Assistant: |
93 | case Qtopia::Spouse: | 94 | case Qtopia::Spouse: |
94 | case Qtopia::Children: | 95 | case Qtopia::Children: |
95 | icon = Resource::loadPixmap( "osearch/personal" ); | 96 | icon = Resource::loadPixmap( "osearch/personal" ); |
96 | break; | 97 | break; |
97 | case Qtopia::Birthday: | 98 | case Qtopia::Birthday: |
98 | case Qtopia::Anniversary: | 99 | case Qtopia::Anniversary: |
99 | icon = Resource::loadPixmap( "osearch/clock" ); | 100 | icon = Resource::loadPixmap( "osearch/clock" ); |
100 | break; | 101 | break; |
101 | case Qtopia::Notes: | 102 | case Qtopia::Notes: |
102 | icon = Resource::loadPixmap( "txt" ); | 103 | icon = Resource::loadPixmap( "txt" ); |
103 | break; | 104 | break; |
104 | default: | 105 | default: |
105 | icon = Resource::loadPixmap( "DocsIcon" ); | 106 | icon = Resource::loadPixmap( "DocsIcon" ); |
106 | break; | 107 | break; |
107 | } | 108 | } |
108 | setPixmap( 0, icon ); | 109 | setPixmap( 0, icon ); |
109 | } | 110 | } |
110 | 111 | ||
111 | ContactItem::~ContactItem() | 112 | ContactItem::~ContactItem() |
112 | { | 113 | { |
113 | delete _contact; | 114 | delete _contact; |
114 | } | 115 | } |
115 | 116 | ||
116 | 117 | ||
117 | QString ContactItem::toRichText() | 118 | QString ContactItem::toRichText() |
118 | { | 119 | { |
119 | return _contact->toRichText(); | 120 | return _contact->toRichText(); |
120 | } | 121 | } |
121 | 122 | ||
122 | void ContactItem::action( int act ) | 123 | void ContactItem::action( int act ) |
123 | { | 124 | { |
124 | if (act == 0){ | 125 | if (act == 0){ |
125 | QCopEnvelope e("QPE/Application/addressbook", "show(int)"); | 126 | QCopEnvelope e("QPE/Application/addressbook", "show(int)"); |
126 | e << _contact->uid(); | 127 | e << _contact->uid(); |
127 | }else if(act == 1){ | 128 | }else if(act == 1){ |
128 | QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | 129 | QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); |
129 | e << _contact->uid(); | 130 | e << _contact->uid(); |
130 | } | 131 | } |
131 | 132 | ||
132 | } | 133 | } |
133 | 134 | ||
134 | QIntDict<QString> ContactItem::actions() | 135 | QIntDict<QString> ContactItem::actions() |
135 | { | 136 | { |
136 | QIntDict<QString> result; | 137 | QIntDict<QString> result; |
137 | result.insert( 0, new QString( QObject::tr("show") ) ); | 138 | result.insert( 0, new QString( QObject::tr("show") ) ); |
138 | result.insert( 1, new QString( QObject::tr("edit") ) ); | 139 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
139 | return result; | 140 | return result; |
140 | 141 | ||
141 | } | 142 | } |
diff --git a/core/pim/osearch/contactitem.h b/core/pim/osearch/contactitem.h index d6303e2..3c553fc 100644 --- a/core/pim/osearch/contactitem.h +++ b/core/pim/osearch/contactitem.h | |||
@@ -1,41 +1,44 @@ | |||
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 CONTACTITEM_H | 13 | #ifndef CONTACTITEM_H |
14 | #define CONTACTITEM_H | 14 | #define CONTACTITEM_H |
15 | 15 | ||
16 | #include <opie2/opimrecord.h> | ||
17 | #include <opie2/opimcontact.h> | ||
18 | |||
16 | #include "resultitem.h" | 19 | #include "resultitem.h" |
17 | 20 | ||
18 | class OContact; | 21 | using namespace Opie; |
19 | 22 | ||
20 | /** | 23 | /** |
21 | @author Patrick S. Vogt | 24 | @author Patrick S. Vogt |
22 | */ | 25 | */ |
23 | class ContactItem : public ResultItem | 26 | class ContactItem : public ResultItem |
24 | { | 27 | { |
25 | public: | 28 | public: |
26 | ContactItem(OListViewItem* parent, OContact *contact); | 29 | ContactItem(OListViewItem* parent, OPimContact *contact); |
27 | 30 | ||
28 | ~ContactItem(); | 31 | ~ContactItem(); |
29 | 32 | ||
30 | virtual QString toRichText(); | 33 | virtual QString toRichText(); |
31 | virtual void action( int ); | 34 | virtual void action( int ); |
32 | virtual QIntDict<QString> actions(); | 35 | virtual QIntDict<QString> actions(); |
33 | 36 | ||
34 | 37 | ||
35 | private: | 38 | private: |
36 | void setIcon(); | 39 | void setIcon(); |
37 | OContact *_contact; | 40 | OPimContact *_contact; |
38 | 41 | ||
39 | }; | 42 | }; |
40 | 43 | ||
41 | #endif | 44 | #endif |
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 50c76e0..2b4660a 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -1,92 +1,95 @@ | |||
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 "datebooksearch.h" | 13 | #include "datebooksearch.h" |
14 | |||
15 | #include "eventitem.h" | 14 | #include "eventitem.h" |
16 | 15 | ||
16 | #include <opie2/opimevent.h> | ||
17 | #include <opie2/opimrecurrence.h> | ||
18 | |||
19 | |||
17 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
19 | #include <opie/oevent.h> | 22 | |
20 | #include <opie/orecur.h> | ||
21 | #include <opie/odatebookaccess.h> | ||
22 | #include <qiconset.h> | 23 | #include <qiconset.h> |
23 | #include <qaction.h> | 24 | #include <qaction.h> |
24 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
25 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
26 | 27 | ||
28 | |||
29 | |||
27 | DatebookSearch::DatebookSearch(QListView* parent, QString name) | 30 | DatebookSearch::DatebookSearch(QListView* parent, QString name) |
28 | : SearchGroup(parent, name), _dates(0), _popupMenu(0) | 31 | : SearchGroup(parent, name), _dates(0), _popupMenu(0) |
29 | { | 32 | { |
30 | QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); | 33 | QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); |
31 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); | 34 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); |
32 | actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); | 35 | actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); |
33 | actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); | 36 | actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); |
34 | Config cfg( "osearch", Config::User ); | 37 | Config cfg( "osearch", Config::User ); |
35 | cfg.setGroup( "datebook_settings" ); | 38 | cfg.setGroup( "datebook_settings" ); |
36 | actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); | 39 | actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); |
37 | actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); | 40 | actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); |
38 | } | 41 | } |
39 | 42 | ||
40 | DatebookSearch::~DatebookSearch() | 43 | DatebookSearch::~DatebookSearch() |
41 | { | 44 | { |
42 | qDebug("SAVE DATEBOOK SEARCH CONFIG"); | 45 | qDebug("SAVE DATEBOOK SEARCH CONFIG"); |
43 | Config cfg( "osearch", Config::User ); | 46 | Config cfg( "osearch", Config::User ); |
44 | cfg.setGroup( "datebook_settings" ); | 47 | cfg.setGroup( "datebook_settings" ); |
45 | cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); | 48 | cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); |
46 | cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); | 49 | cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); |
47 | delete _dates; | 50 | delete _dates; |
48 | delete _popupMenu; | 51 | delete _popupMenu; |
49 | delete actionShowPastEvents; | 52 | delete actionShowPastEvents; |
50 | delete actionSearchInDates; | 53 | delete actionSearchInDates; |
51 | } | 54 | } |
52 | 55 | ||
53 | 56 | ||
54 | void DatebookSearch::load() | 57 | void DatebookSearch::load() |
55 | { | 58 | { |
56 | _dates = new ODateBookAccess(); | 59 | _dates = new ODateBookAccess(); |
57 | _dates->load(); | 60 | _dates->load(); |
58 | } | 61 | } |
59 | 62 | ||
60 | int DatebookSearch::search() | 63 | int DatebookSearch::search() |
61 | { | 64 | { |
62 | ORecordList<OEvent> results = _dates->matchRegexp(_search); | 65 | OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search); |
63 | for (uint i = 0; i < results.count(); i++) | 66 | for (uint i = 0; i < results.count(); i++) |
64 | insertItem( new OEvent( results[i] ) ); | 67 | insertItem( new OPimEvent( results[i] ) ); |
65 | return _resultCount; | 68 | return _resultCount; |
66 | } | 69 | } |
67 | 70 | ||
68 | void DatebookSearch::insertItem( void *rec ) | 71 | void DatebookSearch::insertItem( void *rec ) |
69 | { | 72 | { |
70 | OEvent *ev = (OEvent*)rec; | 73 | OPimEvent *ev = (OPimEvent*)rec; |
71 | if ( !actionShowPastEvents->isOn() && | 74 | if ( !actionShowPastEvents->isOn() && |
72 | ev->endDateTime() < QDateTime::currentDateTime() && | 75 | ev->endDateTime() < QDateTime::currentDateTime() && |
73 | !ev->recurrence().doesRecur() | 76 | !ev->recurrence().doesRecur() |
74 | ) return; | 77 | ) return; |
75 | if ( !actionSearchInDates->isOn() && ( | 78 | if ( !actionSearchInDates->isOn() && ( |
76 | ev->lastHitField() == Qtopia::StartDateTime || | 79 | ev->lastHitField() == Qtopia::StartDateTime || |
77 | ev->lastHitField() == Qtopia::EndDateTime ) | 80 | ev->lastHitField() == Qtopia::EndDateTime ) |
78 | ) return; | 81 | ) return; |
79 | new EventItem( this, ev ); | 82 | new EventItem( this, ev ); |
80 | _resultCount++; | 83 | _resultCount++; |
81 | } | 84 | } |
82 | 85 | ||
83 | QPopupMenu* DatebookSearch::popupMenu() | 86 | QPopupMenu* DatebookSearch::popupMenu() |
84 | { | 87 | { |
85 | if (!_popupMenu){ | 88 | if (!_popupMenu){ |
86 | _popupMenu = new QPopupMenu( 0 ); | 89 | _popupMenu = new QPopupMenu( 0 ); |
87 | actionShowPastEvents->addTo( _popupMenu ); | 90 | actionShowPastEvents->addTo( _popupMenu ); |
88 | actionSearchInDates->addTo( _popupMenu ); | 91 | actionSearchInDates->addTo( _popupMenu ); |
89 | } | 92 | } |
90 | return _popupMenu; | 93 | return _popupMenu; |
91 | } | 94 | } |
92 | 95 | ||
diff --git a/core/pim/osearch/datebooksearch.h b/core/pim/osearch/datebooksearch.h index a6d115e..2af727d 100644 --- a/core/pim/osearch/datebooksearch.h +++ b/core/pim/osearch/datebooksearch.h | |||
@@ -1,44 +1,46 @@ | |||
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 DATEBOOKSEARCH_H | 13 | #ifndef DATEBOOKSEARCH_H |
14 | #define DATEBOOKSEARCH_H | 14 | #define DATEBOOKSEARCH_H |
15 | 15 | ||
16 | #include "searchgroup.h" | 16 | #include "searchgroup.h" |
17 | #include <opie2/odatebookaccess.h> | ||
18 | |||
19 | using namespace Opie; | ||
17 | 20 | ||
18 | class ODateBookAccess; | ||
19 | class QAction; | 21 | class QAction; |
20 | 22 | ||
21 | /** | 23 | /** |
22 | @author Patrick S. Vogt | 24 | @author Patrick S. Vogt |
23 | */ | 25 | */ |
24 | class DatebookSearch : public SearchGroup | 26 | class DatebookSearch : public SearchGroup |
25 | { | 27 | { |
26 | public: | 28 | public: |
27 | DatebookSearch(QListView* parent, QString name); | 29 | DatebookSearch(QListView* parent, QString name); |
28 | ~DatebookSearch(); | 30 | ~DatebookSearch(); |
29 | 31 | ||
30 | virtual QPopupMenu* popupMenu(); | 32 | virtual QPopupMenu* popupMenu(); |
31 | 33 | ||
32 | protected: | 34 | protected: |
33 | virtual void load(); | 35 | virtual void load(); |
34 | virtual int search(); | 36 | virtual int search(); |
35 | virtual void insertItem( void* ); | 37 | virtual void insertItem( void* ); |
36 | 38 | ||
37 | private: | 39 | private: |
38 | ODateBookAccess *_dates; | 40 | ODateBookAccess *_dates; |
39 | QAction *actionShowPastEvents; | 41 | QAction *actionShowPastEvents; |
40 | QAction *actionSearchInDates; | 42 | QAction *actionSearchInDates; |
41 | QPopupMenu *_popupMenu; | 43 | QPopupMenu *_popupMenu; |
42 | }; | 44 | }; |
43 | 45 | ||
44 | #endif | 46 | #endif |
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp index 56eb26a..1516b8e 100644 --- a/core/pim/osearch/doclnkitem.cpp +++ b/core/pim/osearch/doclnkitem.cpp | |||
@@ -1,79 +1,80 @@ | |||
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 <qpe/qcopenvelope_qws.h> | ||
17 | |||
16 | #include <qfile.h> | 18 | #include <qfile.h> |
17 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
18 | #include <qfileinfo.h> | 20 | #include <qfileinfo.h> |
19 | #include <qpe/qcopenvelope_qws.h> | ||
20 | 21 | ||
21 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) | 22 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) |
22 | : ResultItem(parent) | 23 | : ResultItem(parent) |
23 | { | 24 | { |
24 | _doc = app; | 25 | _doc = app; |
25 | setText(0, _doc->name() ); | 26 | setText(0, _doc->name() ); |
26 | setPixmap(0, _doc->pixmap() ); | 27 | setPixmap(0, _doc->pixmap() ); |
27 | } | 28 | } |
28 | 29 | ||
29 | DocLnkItem::~DocLnkItem() | 30 | DocLnkItem::~DocLnkItem() |
30 | { | 31 | { |
31 | } | 32 | } |
32 | 33 | ||
33 | QString DocLnkItem::toRichText() | 34 | QString DocLnkItem::toRichText() |
34 | { | 35 | { |
35 | QString text; | 36 | QString text; |
36 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; | 37 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; |
37 | text += _doc->comment() + "<br>"; | 38 | text += _doc->comment() + "<br>"; |
38 | text += QObject::tr("File: ") + _doc->file() + "<br>"; | 39 | text += QObject::tr("File: ") + _doc->file() + "<br>"; |
39 | text += QObject::tr("Link: ") + _doc->linkFile() + "<br>"; | 40 | text += QObject::tr("Link: ") + _doc->linkFile() + "<br>"; |
40 | text += QObject::tr("Mimetype: ") + _doc->type() + "<br>"; | 41 | text += QObject::tr("Mimetype: ") + _doc->type() + "<br>"; |
41 | if ( _doc->type().contains( "text" ) ){ | 42 | if ( _doc->type().contains( "text" ) ){ |
42 | text += "<br><br><hr><br>"; | 43 | text += "<br><br><hr><br>"; |
43 | QFile f(_doc->file()); | 44 | QFile f(_doc->file()); |
44 | if ( f.open(IO_ReadOnly) ) { | 45 | if ( f.open(IO_ReadOnly) ) { |
45 | QTextStream t( &f ); | 46 | QTextStream t( &f ); |
46 | while ( !t.eof() ) | 47 | while ( !t.eof() ) |
47 | text += t.readLine() + "<br>"; | 48 | text += t.readLine() + "<br>"; |
48 | } | 49 | } |
49 | f.close(); | 50 | f.close(); |
50 | } | 51 | } |
51 | /* text += "<br><br>`"; | 52 | /* text += "<br><br>`"; |
52 | text += _doc->exec(); | 53 | text += _doc->exec(); |
53 | text += "`";*/ | 54 | text += "`";*/ |
54 | QStringList list = _doc->mimeTypes(); | 55 | QStringList list = _doc->mimeTypes(); |
55 | int i = 0; | 56 | int i = 0; |
56 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 57 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
57 | text += QString::number( i++) + " - " + *it ; | 58 | text += QString::number( i++) + " - " + *it ; |
58 | } | 59 | } |
59 | return text; | 60 | return text; |
60 | } | 61 | } |
61 | 62 | ||
62 | void DocLnkItem::action( int act ) | 63 | void DocLnkItem::action( int act ) |
63 | { | 64 | { |
64 | qDebug("action %i",act); | 65 | qDebug("action %i",act); |
65 | if (!_doc->isValid()) qDebug("INVALID"); | 66 | if (!_doc->isValid()) qDebug("INVALID"); |
66 | if (act == 0) _doc->execute(); | 67 | if (act == 0) _doc->execute(); |
67 | else if (act == 1){ | 68 | else if (act == 1){ |
68 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); | 69 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); |
69 | e << _doc->file(); | 70 | e << _doc->file(); |
70 | } | 71 | } |
71 | } | 72 | } |
72 | 73 | ||
73 | QIntDict<QString> DocLnkItem::actions() | 74 | QIntDict<QString> DocLnkItem::actions() |
74 | { | 75 | { |
75 | QIntDict<QString> result; | 76 | QIntDict<QString> result; |
76 | result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); | 77 | result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); |
77 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); | 78 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); |
78 | return result; | 79 | return result; |
79 | } | 80 | } |
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index b03dbd8..c73dcbf 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp | |||
@@ -1,95 +1,99 @@ | |||
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 | 13 | ||
14 | |||
15 | #include "doclnkitem.h" | ||
16 | #include "doclnksearch.h" | ||
17 | |||
18 | #include <opie2/owait.h> | ||
19 | |||
20 | #include <qpe/applnk.h> | ||
21 | #include <qpe/config.h> | ||
22 | #include <qpe/resource.h> | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
14 | #include <qaction.h> | 25 | #include <qaction.h> |
15 | #include <qfile.h> | 26 | #include <qfile.h> |
16 | #include <qiconset.h> | 27 | #include <qiconset.h> |
17 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
18 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
19 | #include <qpe/applnk.h> | ||
20 | #include <qpe/config.h> | ||
21 | #include <qpe/resource.h> | ||
22 | #include <qpe/qpeapplication.h> | ||
23 | #include <opie/owait.h> | ||
24 | 30 | ||
25 | #include "doclnkitem.h" | ||
26 | #include "doclnksearch.h" | ||
27 | 31 | ||
28 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) | 32 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) |
29 | : AppLnkSearch(parent, name), _popupMenu(0) | 33 | : AppLnkSearch(parent, name), _popupMenu(0) |
30 | { | 34 | { |
31 | QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" ); | 35 | QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" ); |
32 | setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) ); | 36 | setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) ); |
33 | 37 | ||
34 | actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); | 38 | actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); |
35 | Config cfg( "osearch", Config::User ); | 39 | Config cfg( "osearch", Config::User ); |
36 | cfg.setGroup( "doclnk_settings" ); | 40 | cfg.setGroup( "doclnk_settings" ); |
37 | actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); | 41 | actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); |
38 | } | 42 | } |
39 | 43 | ||
40 | 44 | ||
41 | DocLnkSearch::~DocLnkSearch() | 45 | DocLnkSearch::~DocLnkSearch() |
42 | { | 46 | { |
43 | Config cfg( "osearch", Config::User ); | 47 | Config cfg( "osearch", Config::User ); |
44 | cfg.setGroup( "doclnk_settings" ); | 48 | cfg.setGroup( "doclnk_settings" ); |
45 | cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); | 49 | cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); |
46 | } | 50 | } |
47 | 51 | ||
48 | void DocLnkSearch::load() | 52 | void DocLnkSearch::load() |
49 | { | 53 | { |
50 | _apps = new DocLnkSet(QPEApplication::documentDir()); | 54 | _apps = new DocLnkSet(QPEApplication::documentDir()); |
51 | } | 55 | } |
52 | 56 | ||
53 | bool DocLnkSearch::searchFile( AppLnk *app ) | 57 | bool DocLnkSearch::searchFile( AppLnk *app ) |
54 | { | 58 | { |
55 | if (!actionSearchInFiles->isOn()) return false; | 59 | if (!actionSearchInFiles->isOn()) return false; |
56 | DocLnk *doc = (DocLnk*)app; | 60 | DocLnk *doc = (DocLnk*)app; |
57 | bool found = false; | 61 | bool found = false; |
58 | if ( doc->type().contains( "text" ) ){ | 62 | if ( doc->type().contains( "text" ) ){ |
59 | #ifdef NEW_OWAIT | 63 | #ifdef NEW_OWAIT |
60 | QString ouput = QObject::tr("searching %1").arg(doc->file()); | 64 | QString ouput = QObject::tr("searching %1").arg(doc->file()); |
61 | OWait( output ); | 65 | OWait( output ); |
62 | #endif | 66 | #endif |
63 | QFile f(doc->file()); | 67 | QFile f(doc->file()); |
64 | if ( f.open(IO_ReadOnly) ) { | 68 | if ( f.open(IO_ReadOnly) ) { |
65 | QTextStream t( &f ); | 69 | QTextStream t( &f ); |
66 | while ( !t.eof() ) | 70 | while ( !t.eof() ) |
67 | if (_search.match( t.readLine()) != -1) { | 71 | if (_search.match( t.readLine()) != -1) { |
68 | found = true; | 72 | found = true; |
69 | break; | 73 | break; |
70 | } | 74 | } |
71 | } | 75 | } |
72 | f.close(); | 76 | f.close(); |
73 | } | 77 | } |
74 | return found; | 78 | return found; |
75 | } | 79 | } |
76 | 80 | ||
77 | void DocLnkSearch::insertItem( void *rec ) | 81 | void DocLnkSearch::insertItem( void *rec ) |
78 | { | 82 | { |
79 | (void)new DocLnkItem( this, (DocLnk*)rec ); | 83 | (void)new DocLnkItem( this, (DocLnk*)rec ); |
80 | _resultCount++; | 84 | _resultCount++; |
81 | } | 85 | } |
82 | 86 | ||
83 | 87 | ||
84 | QPopupMenu* DocLnkSearch::popupMenu() | 88 | QPopupMenu* DocLnkSearch::popupMenu() |
85 | { | 89 | { |
86 | if (!_popupMenu){ | 90 | if (!_popupMenu){ |
87 | _popupMenu = new QPopupMenu( 0 ); | 91 | _popupMenu = new QPopupMenu( 0 ); |
88 | actionSearchInFiles->addTo( _popupMenu ); | 92 | actionSearchInFiles->addTo( _popupMenu ); |
89 | } | 93 | } |
90 | return _popupMenu; | 94 | return _popupMenu; |
91 | //(void) new DocLnkItem( this, (DocLnk*)rec ); | 95 | //(void) new DocLnkItem( this, (DocLnk*)rec ); |
92 | // rec is undeclared here | 96 | // rec is undeclared here |
93 | #warning FIXME | 97 | #warning FIXME |
94 | _resultCount++; | 98 | _resultCount++; |
95 | } | 99 | } |
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp index 3228093..f6e34fe 100644 --- a/core/pim/osearch/eventitem.cpp +++ b/core/pim/osearch/eventitem.cpp | |||
@@ -1,86 +1,86 @@ | |||
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 "eventitem.h" | 13 | #include "eventitem.h" |
14 | 14 | ||
15 | #include <qdatetime.h> | 15 | |
16 | #include <qpixmap.h> | ||
17 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
19 | //#include <qwhatsthis.h> | ||
20 | #include <opie/oevent.h> | ||
21 | 18 | ||
22 | EventItem::EventItem(OListViewItem* parent, OEvent *event) | 19 | #include <qdatetime.h> |
20 | #include <qpixmap.h> | ||
21 | |||
22 | EventItem::EventItem(OListViewItem* parent, OPimEvent *event) | ||
23 | : ResultItem(parent) | 23 | : ResultItem(parent) |
24 | { | 24 | { |
25 | _event = event; | 25 | _event = event; |
26 | setText(0, _event->toShortText() ); | 26 | setText(0, _event->toShortText() ); |
27 | setIcon(); | 27 | setIcon(); |
28 | } | 28 | } |
29 | 29 | ||
30 | 30 | ||
31 | EventItem::~EventItem() | 31 | EventItem::~EventItem() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
36 | QString EventItem::toRichText() | 36 | QString EventItem::toRichText() |
37 | { | 37 | { |
38 | return _event->toRichText(); | 38 | return _event->toRichText(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void EventItem::action( int act ) | 41 | void EventItem::action( int act ) |
42 | { | 42 | { |
43 | if (act == 0){ | 43 | if (act == 0){ |
44 | QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); | 44 | QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); |
45 | e << _event->startDateTime().date(); | 45 | e << _event->startDateTime().date(); |
46 | }else if(act == 1){ | 46 | }else if(act == 1){ |
47 | QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); | 47 | QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); |
48 | e << _event->uid(); | 48 | e << _event->uid(); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | QIntDict<QString> EventItem::actions() | 52 | QIntDict<QString> EventItem::actions() |
53 | { | 53 | { |
54 | QIntDict<QString> result; | 54 | QIntDict<QString> result; |
55 | result.insert( 0, new QString( QObject::tr("show") ) ); | 55 | result.insert( 0, new QString( QObject::tr("show") ) ); |
56 | result.insert( 1, new QString( QObject::tr("edit") ) ); | 56 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
57 | return result; | 57 | return result; |
58 | } | 58 | } |
59 | 59 | ||
60 | void EventItem::setIcon() | 60 | void EventItem::setIcon() |
61 | { | 61 | { |
62 | QPixmap icon; | 62 | QPixmap icon; |
63 | switch ( _event->lastHitField() ) { | 63 | switch ( _event->lastHitField() ) { |
64 | case -1: | 64 | case -1: |
65 | icon = Resource::loadPixmap( "reset" ); | 65 | icon = Resource::loadPixmap( "reset" ); |
66 | // QWhatsThis::add( icon, QObject::tr("Enter your search terms here") ); | 66 | // QWhatsThis::add( icon, QObject::tr("Enter your search terms here") ); |
67 | break; | 67 | break; |
68 | case Qtopia::DatebookDescription: | 68 | case Qtopia::DatebookDescription: |
69 | icon = Resource::loadPixmap( "osearch/summary" ); | 69 | icon = Resource::loadPixmap( "osearch/summary" ); |
70 | break; | 70 | break; |
71 | case Qtopia::Notes: | 71 | case Qtopia::Notes: |
72 | icon = Resource::loadPixmap( "txt" ); | 72 | icon = Resource::loadPixmap( "txt" ); |
73 | break; | 73 | break; |
74 | case Qtopia::Location: | 74 | case Qtopia::Location: |
75 | icon = Resource::loadPixmap( "home" ); | 75 | icon = Resource::loadPixmap( "home" ); |
76 | break; | 76 | break; |
77 | case Qtopia::StartDateTime: | 77 | case Qtopia::StartDateTime: |
78 | case Qtopia::EndDateTime: | 78 | case Qtopia::EndDateTime: |
79 | icon = Resource::loadPixmap( "osearch/clock" ); | 79 | icon = Resource::loadPixmap( "osearch/clock" ); |
80 | break; | 80 | break; |
81 | default: | 81 | default: |
82 | icon = Resource::loadPixmap( "DocsIcon" ); | 82 | icon = Resource::loadPixmap( "DocsIcon" ); |
83 | break; | 83 | break; |
84 | } | 84 | } |
85 | setPixmap( 0, icon ); | 85 | setPixmap( 0, icon ); |
86 | } | 86 | } |
diff --git a/core/pim/osearch/eventitem.h b/core/pim/osearch/eventitem.h index 5f9c9fc..68923f1 100644 --- a/core/pim/osearch/eventitem.h +++ b/core/pim/osearch/eventitem.h | |||
@@ -1,40 +1,42 @@ | |||
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 EVENTITEM_H | 13 | #ifndef EVENTITEM_H |
14 | #define EVENTITEM_H | 14 | #define EVENTITEM_H |
15 | 15 | ||
16 | #include "resultitem.h" | 16 | #include "resultitem.h" |
17 | 17 | ||
18 | class OEvent; | 18 | #include <opie2/opimevent.h> |
19 | |||
20 | using namespace Opie; | ||
19 | 21 | ||
20 | /** | 22 | /** |
21 | @author Patrick S. Vogt | 23 | @author Patrick S. Vogt |
22 | */ | 24 | */ |
23 | class EventItem : public ResultItem | 25 | class EventItem : public ResultItem |
24 | { | 26 | { |
25 | public: | 27 | public: |
26 | EventItem(OListViewItem* parent, OEvent *event); | 28 | EventItem(OListViewItem* parent, OPimEvent *event); |
27 | 29 | ||
28 | ~EventItem(); | 30 | ~EventItem(); |
29 | 31 | ||
30 | virtual QString toRichText(); | 32 | virtual QString toRichText(); |
31 | virtual void action( int ); | 33 | virtual void action( int ); |
32 | virtual QIntDict<QString> actions(); | 34 | virtual QIntDict<QString> actions(); |
33 | 35 | ||
34 | private: | 36 | private: |
35 | void setIcon(); | 37 | void setIcon(); |
36 | OEvent *_event; | 38 | OPimEvent *_event; |
37 | 39 | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | #endif | 42 | #endif |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 55302cb..95f5967 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -1,313 +1,317 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
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 | 12 | ||
13 | #include "olistview.h" | ||
14 | #include "olistviewitem.h" | ||
15 | #include "resultitem.h" | ||
16 | #include "adresssearch.h" | ||
17 | #include "todosearch.h" | ||
18 | #include "datebooksearch.h" | ||
19 | #include "applnksearch.h" | ||
20 | #include "doclnksearch.h" | ||
21 | #include "mainwindow.h" | ||
13 | 22 | ||
23 | #include <opie2/owait.h> | ||
24 | |||
25 | #include <qpe/qpemessagebox.h> | ||
26 | #include <qpe/resource.h> | ||
27 | #include <qpe/config.h> | ||
28 | |||
29 | #include <qpe/qpeapplication.h> | ||
30 | #include <qpe/config.h> | ||
31 | #include <qpe/global.h> | ||
32 | |||
33 | #include <qtoolbar.h> | ||
14 | #include <qaction.h> | 34 | #include <qaction.h> |
15 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
16 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
17 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
18 | #include <qstring.h> | 38 | #include <qstring.h> |
19 | #include <qlabel.h> | 39 | #include <qlabel.h> |
20 | #include <qfile.h> | 40 | #include <qfile.h> |
21 | #include <qhbuttongroup.h> | 41 | #include <qhbuttongroup.h> |
22 | #include <qhbox.h> | 42 | #include <qhbox.h> |
23 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
24 | #include <qintdict.h> | 44 | #include <qintdict.h> |
25 | #include <qlayout.h> | 45 | #include <qlayout.h> |
26 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
27 | #include <qsignalmapper.h> | 47 | #include <qsignalmapper.h> |
28 | #include <qtextbrowser.h> | 48 | #include <qtextbrowser.h> |
29 | #include <qregexp.h> | 49 | #include <qregexp.h> |
30 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
31 | #include <qmenubar.h> | 51 | #include <qmenubar.h> |
32 | #include <qpe/qpemessagebox.h> | ||
33 | #include <qpe/resource.h> | ||
34 | #include <qpe/config.h> | ||
35 | #include <qtoolbar.h> | ||
36 | #include <qpe/qpeapplication.h> | ||
37 | #include <qpe/config.h> | ||
38 | #include <qpe/global.h> | ||
39 | #include <opie/owait.h> | ||
40 | 52 | ||
41 | #include "olistview.h" | ||
42 | #include "olistviewitem.h" | ||
43 | #include "resultitem.h" | ||
44 | #include "adresssearch.h" | ||
45 | #include "todosearch.h" | ||
46 | #include "datebooksearch.h" | ||
47 | #include "applnksearch.h" | ||
48 | #include "doclnksearch.h" | ||
49 | #include "mainwindow.h" | ||
50 | 53 | ||
51 | static const char* const image1_data[] = { | 54 | |
55 | static const char* const image1_data[] = { | ||
52 | "14 14 3 1", | 56 | "14 14 3 1", |
53 | ". c None", | 57 | ". c None", |
54 | "# c #000000", | 58 | "# c #000000", |
55 | "a c #ff0000", | 59 | "a c #ff0000", |
56 | "..............", | 60 | "..............", |
57 | "..##.......###", | 61 | "..##.......###", |
58 | ".#aa#....##aa#", | 62 | ".#aa#....##aa#", |
59 | "#aaaa#.##aaaa#", | 63 | "#aaaa#.##aaaa#", |
60 | ".##aaa#aaaaa##", | 64 | ".##aaa#aaaaa##", |
61 | "...#aaaaaaa#..", | 65 | "...#aaaaaaa#..", |
62 | "....#aaaaa#...", | 66 | "....#aaaaa#...", |
63 | "...#aaaaa#....", | 67 | "...#aaaaa#....", |
64 | "..#aaaaaaa#...", | 68 | "..#aaaaaaa#...", |
65 | ".#aaaaaaaaa#..", | 69 | ".#aaaaaaaaa#..", |
66 | "#aaaa###aaaa#.", | 70 | "#aaaa###aaaa#.", |
67 | "#aaa#..##aaa#.", | 71 | "#aaa#..##aaa#.", |
68 | "#aaa#...#aa#..", | 72 | "#aaa#...#aa#..", |
69 | ".###.....##..."}; | 73 | ".###.....##..."}; |
70 | 74 | ||
71 | 75 | ||
72 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 76 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
73 | QMainWindow( parent, name, f ), _currentItem(0) | 77 | QMainWindow( parent, name, f ), _currentItem(0) |
74 | { | 78 | { |
75 | setCaption( tr("OSearch") ); | 79 | setCaption( tr("OSearch") ); |
76 | 80 | ||
77 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 81 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
78 | 82 | ||
79 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 83 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
80 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 84 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
81 | 85 | ||
82 | mainLayout = new QVBoxLayout( mainFrame ); | 86 | mainLayout = new QVBoxLayout( mainFrame ); |
83 | mainLayout->setSpacing( 0 ); | 87 | mainLayout->setSpacing( 0 ); |
84 | mainLayout->setMargin( 3 ); | 88 | mainLayout->setMargin( 3 ); |
85 | 89 | ||
86 | resultsList = new OListView( mainFrame ); | 90 | resultsList = new OListView( mainFrame ); |
87 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 91 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
88 | mainLayout->addWidget( resultsList ); | 92 | mainLayout->addWidget( resultsList ); |
89 | 93 | ||
90 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 94 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
91 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 95 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
92 | richEdit = new QTextView( detailsFrame ); | 96 | richEdit = new QTextView( detailsFrame ); |
93 | QWhatsThis::add( richEdit, tr("The details of the current result") ); | 97 | QWhatsThis::add( richEdit, tr("The details of the current result") ); |
94 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 98 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
95 | detailsLayout->addWidget( richEdit ); | 99 | detailsLayout->addWidget( richEdit ); |
96 | 100 | ||
97 | buttonBox = new QHBox( mainFrame, "Button Box" ); | 101 | buttonBox = new QHBox( mainFrame, "Button Box" ); |
98 | 102 | ||
99 | _buttonCount = 0; | 103 | _buttonCount = 0; |
100 | 104 | ||
101 | mainLayout->addWidget( detailsFrame ); | 105 | mainLayout->addWidget( detailsFrame ); |
102 | mainLayout->addWidget( buttonBox ); | 106 | mainLayout->addWidget( buttonBox ); |
103 | detailsFrame->hide(); | 107 | detailsFrame->hide(); |
104 | buttonBox->hide(); | 108 | buttonBox->hide(); |
105 | 109 | ||
106 | searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); | 110 | searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); |
107 | searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); | 111 | searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); |
108 | searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); | 112 | searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); |
109 | searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); | 113 | searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); |
110 | searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); | 114 | searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); |
111 | 115 | ||
112 | setCentralWidget( mainFrame ); | 116 | setCentralWidget( mainFrame ); |
113 | 117 | ||
114 | popupTimer = new QTimer(); | 118 | popupTimer = new QTimer(); |
115 | searchTimer = new QTimer(); | 119 | searchTimer = new QTimer(); |
116 | 120 | ||
117 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 121 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
118 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); | 122 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); |
119 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 123 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
120 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 124 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
121 | 125 | ||
122 | signalMapper = new QSignalMapper( this ); | 126 | signalMapper = new QSignalMapper( this ); |
123 | 127 | ||
124 | connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); | 128 | connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); |
125 | 129 | ||
126 | makeMenu(); | 130 | makeMenu(); |
127 | 131 | ||
128 | Config cfg( "osearch", Config::User ); | 132 | Config cfg( "osearch", Config::User ); |
129 | cfg.setGroup( "search_settings" ); | 133 | cfg.setGroup( "search_settings" ); |
130 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); | 134 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); |
131 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); | 135 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); |
132 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); | 136 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); |
133 | } | 137 | } |
134 | 138 | ||
135 | void MainWindow::makeMenu() | 139 | void MainWindow::makeMenu() |
136 | { | 140 | { |
137 | QToolBar *toolBar = new QToolBar( this ); | 141 | QToolBar *toolBar = new QToolBar( this ); |
138 | QToolBar *searchBar = new QToolBar(this); | 142 | QToolBar *searchBar = new QToolBar(this); |
139 | QMenuBar *menuBar = new QMenuBar( toolBar ); | 143 | QMenuBar *menuBar = new QMenuBar( toolBar ); |
140 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 144 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
141 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 145 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
142 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 146 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
143 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); | 147 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); |
144 | 148 | ||
145 | setToolBarsMovable( false ); | 149 | setToolBarsMovable( false ); |
146 | toolBar->setHorizontalStretchable( true ); | 150 | toolBar->setHorizontalStretchable( true ); |
147 | menuBar->insertItem( tr( "Search" ), searchMenu ); | 151 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
148 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 152 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
149 | 153 | ||
150 | //SETTINGS MENU | 154 | //SETTINGS MENU |
151 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); | 155 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); |
152 | QPopupMenu *pop; | 156 | QPopupMenu *pop; |
153 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 157 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
154 | pop = s->popupMenu(); | 158 | pop = s->popupMenu(); |
155 | if (pop){ | 159 | if (pop){ |
156 | cfgMenu->insertItem( s->text(0), pop ); | 160 | cfgMenu->insertItem( s->text(0), pop ); |
157 | } | 161 | } |
158 | } | 162 | } |
159 | 163 | ||
160 | 164 | ||
161 | //SEARCH | 165 | //SEARCH |
162 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); | 166 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); |
163 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); | 167 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); |
164 | // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); | 168 | // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); |
165 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); | 169 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); |
166 | SearchAllAction->addTo( searchMenu ); | 170 | SearchAllAction->addTo( searchMenu ); |
167 | searchMenu->insertItem( tr( "Options" ), searchOptions ); | 171 | searchMenu->insertItem( tr( "Options" ), searchOptions ); |
168 | 172 | ||
169 | //SEARCH OPTIONS | 173 | //SEARCH OPTIONS |
170 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); | 174 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); |
171 | //actionWholeWordsOnly->addTo( searchOptions ); | 175 | //actionWholeWordsOnly->addTo( searchOptions ); |
172 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); | 176 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
173 | actionCaseSensitiv->addTo( searchOptions ); | 177 | actionCaseSensitiv->addTo( searchOptions ); |
174 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | 178 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); |
175 | actionWildcards->addTo( searchOptions ); | 179 | actionWildcards->addTo( searchOptions ); |
176 | 180 | ||
177 | //SEARCH BAR | 181 | //SEARCH BAR |
178 | LabelEnterText = new QLabel( searchBar, "Label" ); | 182 | LabelEnterText = new QLabel( searchBar, "Label" ); |
179 | LabelEnterText->setAutoMask( FALSE ); | 183 | LabelEnterText->setAutoMask( FALSE ); |
180 | LabelEnterText->setText( tr( "Search for: " ) ); | 184 | LabelEnterText->setText( tr( "Search for: " ) ); |
181 | 185 | ||
182 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 186 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
183 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 187 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
184 | QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); | 188 | QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); |
185 | searchEdit->setFocus(); | 189 | searchEdit->setFocus(); |
186 | searchBar->setHorizontalStretchable( TRUE ); | 190 | searchBar->setHorizontalStretchable( TRUE ); |
187 | searchBar->setStretchableWidget( searchEdit ); | 191 | searchBar->setStretchableWidget( searchEdit ); |
188 | 192 | ||
189 | //Search button | 193 | //Search button |
190 | SearchAllAction->addTo( searchBar ); | 194 | SearchAllAction->addTo( searchBar ); |
191 | 195 | ||
192 | //image ripped of off opie-login/loginwindow.cpp | 196 | //image ripped of off opie-login/loginwindow.cpp |
193 | QPixmap image1( ( const char** ) image1_data ); | 197 | QPixmap image1( ( const char** ) image1_data ); |
194 | 198 | ||
195 | //Clear text | 199 | //Clear text |
196 | ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); | 200 | ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); |
197 | ClearSearchText->setText( tr( "" ) ); | 201 | ClearSearchText->setText( tr( "" ) ); |
198 | ClearSearchText->setPixmap( image1 ); | 202 | ClearSearchText->setPixmap( image1 ); |
199 | 203 | ||
200 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) ); | 204 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) ); |
201 | connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); | 205 | connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); |
202 | 206 | ||
203 | } | 207 | } |
204 | 208 | ||
205 | MainWindow::~MainWindow() | 209 | MainWindow::~MainWindow() |
206 | { | 210 | { |
207 | Config cfg( "osearch", Config::User ); | 211 | Config cfg( "osearch", Config::User ); |
208 | cfg.setGroup( "search_settings" ); | 212 | cfg.setGroup( "search_settings" ); |
209 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); | 213 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); |
210 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); | 214 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); |
211 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); | 215 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); |
212 | } | 216 | } |
213 | 217 | ||
214 | void MainWindow::setCurrent(QListViewItem *item) | 218 | void MainWindow::setCurrent(QListViewItem *item) |
215 | { | 219 | { |
216 | if (!item) return; | 220 | if (!item) return; |
217 | _currentItem = (OListViewItem*)item; | 221 | _currentItem = (OListViewItem*)item; |
218 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 222 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
219 | if (_currentItem->rtti() == OListViewItem::Result){ | 223 | if (_currentItem->rtti() == OListViewItem::Result){ |
220 | ResultItem *res = (ResultItem*)item; | 224 | ResultItem *res = (ResultItem*)item; |
221 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 225 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
222 | richEdit->setText( res->toRichText() ); | 226 | richEdit->setText( res->toRichText() ); |
223 | QIntDict<QString> acts = res->actions(); | 227 | QIntDict<QString> acts = res->actions(); |
224 | QButton *button; | 228 | QButton *button; |
225 | for (uint i = 0; i < acts.count(); i++){ | 229 | for (uint i = 0; i < acts.count(); i++){ |
226 | button = buttonMap[i]; | 230 | button = buttonMap[i]; |
227 | if (!button) { | 231 | if (!button) { |
228 | qWarning(" no button for %s", (*acts[i]).latin1() ); | 232 | qWarning(" no button for %s", (*acts[i]).latin1() ); |
229 | button = new QPushButton( buttonBox ); | 233 | button = new QPushButton( buttonBox ); |
230 | buttonMap.insert( i, button ); | 234 | buttonMap.insert( i, button ); |
231 | signalMapper->setMapping(button, i ); | 235 | signalMapper->setMapping(button, i ); |
232 | connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); | 236 | connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); |
233 | } | 237 | } |
234 | button->setText( *acts[i] ); | 238 | button->setText( *acts[i] ); |
235 | button->show(); | 239 | button->show(); |
236 | } | 240 | } |
237 | for (uint i = acts.count(); i < _buttonCount; i++){ | 241 | for (uint i = acts.count(); i < _buttonCount; i++){ |
238 | button = buttonMap[i]; | 242 | button = buttonMap[i]; |
239 | if (button) button->hide(); | 243 | if (button) button->hide(); |
240 | } | 244 | } |
241 | _buttonCount = acts.count(); | 245 | _buttonCount = acts.count(); |
242 | detailsFrame->show(); | 246 | detailsFrame->show(); |
243 | buttonBox->show(); | 247 | buttonBox->show(); |
244 | 248 | ||
245 | }else { | 249 | }else { |
246 | detailsFrame->hide(); | 250 | detailsFrame->hide(); |
247 | buttonBox->hide(); | 251 | buttonBox->hide(); |
248 | } | 252 | } |
249 | popupTimer->start( 300, true ); | 253 | popupTimer->start( 300, true ); |
250 | } | 254 | } |
251 | 255 | ||
252 | void MainWindow::stopTimer(QListViewItem*) | 256 | void MainWindow::stopTimer(QListViewItem*) |
253 | { | 257 | { |
254 | popupTimer->stop(); | 258 | popupTimer->stop(); |
255 | } | 259 | } |
256 | 260 | ||
257 | void MainWindow::showPopup() | 261 | void MainWindow::showPopup() |
258 | { | 262 | { |
259 | popupTimer->stop(); | 263 | popupTimer->stop(); |
260 | if (!_currentItem) return; | 264 | if (!_currentItem) return; |
261 | QPopupMenu *pop = _currentItem->popupMenu(); | 265 | QPopupMenu *pop = _currentItem->popupMenu(); |
262 | if (pop) pop->popup( QCursor::pos() ); | 266 | if (pop) pop->popup( QCursor::pos() ); |
263 | } | 267 | } |
264 | 268 | ||
265 | void MainWindow::setSearch( const QString &key ) | 269 | void MainWindow::setSearch( const QString &key ) |
266 | { | 270 | { |
267 | searchTimer->stop(); | 271 | searchTimer->stop(); |
268 | _searchString = key; | 272 | _searchString = key; |
269 | searchTimer->start( 300 ); | 273 | searchTimer->start( 300 ); |
270 | } | 274 | } |
271 | 275 | ||
272 | void MainWindow::searchStringChanged() | 276 | void MainWindow::searchStringChanged() |
273 | { | 277 | { |
274 | #ifdef NEW_OWAIT | 278 | #ifdef NEW_OWAIT |
275 | OWait("setting search string"); | 279 | OWait("setting search string"); |
276 | #endif | 280 | #endif |
277 | searchTimer->stop(); | 281 | searchTimer->stop(); |
278 | QString ss = _searchString; | 282 | QString ss = _searchString; |
279 | //ss = Global::stringQuote( _searchString ); | 283 | //ss = Global::stringQuote( _searchString ); |
280 | //if (actionWholeWordsOnly->isOn()) | 284 | //if (actionWholeWordsOnly->isOn()) |
281 | // ss = "\\s"+_searchString+"\\s"; | 285 | // ss = "\\s"+_searchString+"\\s"; |
282 | //qDebug(" set searchString >%s<",ss.latin1()); | 286 | //qDebug(" set searchString >%s<",ss.latin1()); |
283 | QRegExp re( ss ); | 287 | QRegExp re( ss ); |
284 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); | 288 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); |
285 | re.setWildcard( actionWildcards->isOn() ); | 289 | re.setWildcard( actionWildcards->isOn() ); |
286 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) | 290 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
287 | s->setSearch( re ); | 291 | s->setSearch( re ); |
288 | } | 292 | } |
289 | 293 | ||
290 | void MainWindow::searchAll() | 294 | void MainWindow::searchAll() |
291 | { | 295 | { |
292 | #ifdef NEW_OWAIT | 296 | #ifdef NEW_OWAIT |
293 | OWait("searching..."); | 297 | OWait("searching..."); |
294 | #endif | 298 | #endif |
295 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 299 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
296 | s->doSearch(); | 300 | s->doSearch(); |
297 | //resultsList->repaint(); | 301 | //resultsList->repaint(); |
298 | } | 302 | } |
299 | } | 303 | } |
300 | 304 | ||
301 | void MainWindow::slotAction( int act ) | 305 | void MainWindow::slotAction( int act ) |
302 | { | 306 | { |
303 | if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ | 307 | if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ |
304 | ResultItem *res = (ResultItem*)_currentItem; | 308 | ResultItem *res = (ResultItem*)_currentItem; |
305 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 309 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
306 | res->action(act); | 310 | res->action(act); |
307 | } | 311 | } |
308 | } | 312 | } |
309 | 313 | ||
310 | void MainWindow::optionChanged(int ) | 314 | void MainWindow::optionChanged(int ) |
311 | { | 315 | { |
312 | searchStringChanged(); | 316 | searchStringChanged(); |
313 | } | 317 | } |
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index 9886053..bf3081f 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -1,89 +1,88 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | // (c) 2002-2003 Patrick S. Vogt <tille@handhelds.org> | 10 | // (c) 2002-2003 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 <qlist.h> |
19 | |||
20 | #include <qmap.h> | 19 | #include <qmap.h> |
21 | #include <qtimer.h> | 20 | #include <qtimer.h> |
22 | #include <qpopupmenu.h> | 21 | #include <qpopupmenu.h> |
23 | 22 | ||
24 | class QAction; | 23 | class QAction; |
25 | class QToolBar; | 24 | class QToolBar; |
26 | class QHBox; | 25 | class QHBox; |
27 | class QVBoxLayout; | 26 | class QVBoxLayout; |
28 | class QTextView; | 27 | class QTextView; |
29 | class QFrame; | 28 | class QFrame; |
30 | class OListView; | 29 | class OListView; |
31 | class OListViewItem; | 30 | class OListViewItem; |
32 | class QListViewItem; | 31 | class QListViewItem; |
33 | class QPopupMenu; | 32 | class QPopupMenu; |
34 | class QTimer; | 33 | class QTimer; |
35 | class QLabel; | 34 | class QLabel; |
36 | 35 | ||
37 | class QSignalMapper; | 36 | class QSignalMapper; |
38 | class QButton; | 37 | class QButton; |
39 | 38 | ||
40 | class SearchGroup; | 39 | class SearchGroup; |
41 | 40 | ||
42 | class MainWindow : public QMainWindow | 41 | class MainWindow : public QMainWindow |
43 | { | 42 | { |
44 | Q_OBJECT | 43 | Q_OBJECT |
45 | 44 | ||
46 | 45 | ||
47 | public: | 46 | public: |
48 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 47 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
49 | ~MainWindow(); | 48 | ~MainWindow(); |
50 | static QString appName() { return QString::fromLatin1("osearch"); } | 49 | static QString appName() { return QString::fromLatin1("osearch"); } |
51 | 50 | ||
52 | public slots: | 51 | public slots: |
53 | void setCurrent(QListViewItem*); | 52 | void setCurrent(QListViewItem*); |
54 | void setSearch( const QString& ); | 53 | void setSearch( const QString& ); |
55 | void searchAll(); | 54 | void searchAll(); |
56 | 55 | ||
57 | protected slots: | 56 | protected slots: |
58 | void slotAction(int); | 57 | void slotAction(int); |
59 | void showPopup(); | 58 | void showPopup(); |
60 | void stopTimer( QListViewItem* ); | 59 | void stopTimer( QListViewItem* ); |
61 | void searchStringChanged(); | 60 | void searchStringChanged(); |
62 | void optionChanged(int); | 61 | void optionChanged(int); |
63 | 62 | ||
64 | private: | 63 | private: |
65 | QHBox *buttonBox; | 64 | QHBox *buttonBox; |
66 | QMap<int, QButton*> buttonMap; | 65 | QMap<int, QButton*> buttonMap; |
67 | QSignalMapper* signalMapper; | 66 | QSignalMapper* signalMapper; |
68 | OListView *resultsList; | 67 | OListView *resultsList; |
69 | QTextView *richEdit; | 68 | QTextView *richEdit; |
70 | OListViewItem *_currentItem; | 69 | OListViewItem *_currentItem; |
71 | QVBoxLayout *mainLayout; | 70 | QVBoxLayout *mainLayout; |
72 | QFrame *detailsFrame; | 71 | QFrame *detailsFrame; |
73 | QTimer *popupTimer; | 72 | QTimer *popupTimer; |
74 | QTimer *searchTimer; | 73 | QTimer *searchTimer; |
75 | QToolButton* ClearSearchText; | 74 | QToolButton* ClearSearchText; |
76 | QLabel* LabelEnterText; | 75 | QLabel* LabelEnterText; |
77 | 76 | ||
78 | QString _searchString; | 77 | QString _searchString; |
79 | QList<SearchGroup> searches; | 78 | QList<SearchGroup> searches; |
80 | QAction *SearchAllAction; | 79 | QAction *SearchAllAction; |
81 | QAction *actionCaseSensitiv; | 80 | QAction *actionCaseSensitiv; |
82 | QAction *actionWildcards; | 81 | QAction *actionWildcards; |
83 | //QAction *actionWholeWordsOnly; | 82 | //QAction *actionWholeWordsOnly; |
84 | uint _buttonCount; | 83 | uint _buttonCount; |
85 | void makeMenu(); | 84 | void makeMenu(); |
86 | }; | 85 | }; |
87 | 86 | ||
88 | #endif | 87 | #endif |
89 | 88 | ||
diff --git a/core/pim/osearch/olistview.cpp b/core/pim/osearch/olistview.cpp index e678d63..7a7cb26 100644 --- a/core/pim/osearch/olistview.cpp +++ b/core/pim/osearch/olistview.cpp | |||
@@ -1,37 +1,40 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> | 9 | // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> |
10 | 10 | ||
11 | #include "olistview.h" | 11 | #include "olistview.h" |
12 | #include "olistviewitem.h" | 12 | #include "olistviewitem.h" |
13 | #include <qmessagebox.h> | 13 | |
14 | #include <qpe/qpeapplication.h> | 14 | #include <qpe/qpeapplication.h> |
15 | 15 | ||
16 | #include <qmessagebox.h> | ||
17 | |||
18 | |||
16 | OListView::OListView(QWidget *parent, const char *name ) | 19 | OListView::OListView(QWidget *parent, const char *name ) |
17 | : QListView(parent,name) | 20 | : QListView(parent,name) |
18 | { | 21 | { |
19 | 22 | ||
20 | setRootIsDecorated( true ); | 23 | setRootIsDecorated( true ); |
21 | addColumn(tr("Results"),qApp->desktop()->width() - 9 ); | 24 | addColumn(tr("Results"),qApp->desktop()->width() - 9 ); |
22 | //setColumnWidthMode(0, Manual); | 25 | //setColumnWidthMode(0, Manual); |
23 | 26 | ||
24 | setSorting( -1 ); | 27 | setSorting( -1 ); |
25 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); | 28 | connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); |
26 | } | 29 | } |
27 | 30 | ||
28 | 31 | ||
29 | OListView::~OListView() | 32 | OListView::~OListView() |
30 | { | 33 | { |
31 | } | 34 | } |
32 | 35 | ||
33 | void OListView::expand(QListViewItem *item) | 36 | void OListView::expand(QListViewItem *item) |
34 | { | 37 | { |
35 | ((OListViewItem*)item)->expand(); | 38 | ((OListViewItem*)item)->expand(); |
36 | } | 39 | } |
37 | 40 | ||
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro index c988f48..7412de9 100644 --- a/core/pim/osearch/osearch.pro +++ b/core/pim/osearch/osearch.pro | |||
@@ -1,39 +1,39 @@ | |||
1 | CONFIG += qt release warn_on quick-app | 1 | CONFIG += qt release warn_on quick-app |
2 | SOURCES += main.cpp \ | 2 | SOURCES += main.cpp \ |
3 | mainwindow.cpp \ | 3 | mainwindow.cpp \ |
4 | olistview.cpp \ | 4 | olistview.cpp \ |
5 | olistviewitem.cpp \ | 5 | olistviewitem.cpp \ |
6 | adresssearch.cpp \ | 6 | adresssearch.cpp \ |
7 | todosearch.cpp \ | 7 | todosearch.cpp \ |
8 | datebooksearch.cpp \ | 8 | datebooksearch.cpp \ |
9 | searchgroup.cpp \ | 9 | searchgroup.cpp \ |
10 | resultitem.cpp \ | 10 | resultitem.cpp \ |
11 | todoitem.cpp \ | 11 | todoitem.cpp \ |
12 | contactitem.cpp \ | 12 | contactitem.cpp \ |
13 | eventitem.cpp \ | 13 | eventitem.cpp \ |
14 | applnksearch.cpp \ | 14 | applnksearch.cpp \ |
15 | applnkitem.cpp \ | 15 | applnkitem.cpp \ |
16 | doclnkitem.cpp \ | 16 | doclnkitem.cpp \ |
17 | doclnksearch.cpp | 17 | doclnksearch.cpp |
18 | HEADERS += mainwindow.h \ | 18 | HEADERS += mainwindow.h \ |
19 | olistview.h \ | 19 | olistview.h \ |
20 | olistviewitem.h \ | 20 | olistviewitem.h \ |
21 | adresssearch.h \ | 21 | adresssearch.h \ |
22 | todosearch.h \ | 22 | todosearch.h \ |
23 | datebooksearch.h \ | 23 | datebooksearch.h \ |
24 | searchgroup.h \ | 24 | searchgroup.h \ |
25 | resultitem.h \ | 25 | resultitem.h \ |
26 | todoitem.h \ | 26 | todoitem.h \ |
27 | contactitem.h \ | 27 | contactitem.h \ |
28 | eventitem.h \ | 28 | eventitem.h \ |
29 | applnksearch.h \ | 29 | applnksearch.h \ |
30 | applnkitem.h \ | 30 | applnkitem.h \ |
31 | doclnkitem.h \ | 31 | doclnkitem.h \ |
32 | doclnksearch.h | 32 | doclnksearch.h |
33 | 33 | ||
34 | TARGET= osearch | 34 | TARGET= osearch |
35 | 35 | ||
36 | INCLUDEPATH = $(OPIEDIR)/include | 36 | INCLUDEPATH = $(OPIEDIR)/include |
37 | DEPENDPATH += $(OPIEDIR)/include | 37 | DEPENDPATH += $(OPIEDIR)/include |
38 | LIBS += -lqpe -lopie | 38 | LIBS += -lqpe -lopiecore2 -lopiepim2 -lopieui2 |
39 | include ( $(OPIEDIR)/include.pro ) | 39 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/osearch/resultitem.cpp b/core/pim/osearch/resultitem.cpp index 2c1e95a..f051b12 100644 --- a/core/pim/osearch/resultitem.cpp +++ b/core/pim/osearch/resultitem.cpp | |||
@@ -1,29 +1,27 @@ | |||
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 "resultitem.h" | 13 | #include "resultitem.h" |
14 | 14 | ||
15 | #include <qmessagebox.h> | ||
16 | |||
17 | #include <opie/otodo.h> | ||
18 | 15 | ||
16 | #include <qmessagebox.h> | ||
19 | 17 | ||
20 | ResultItem::ResultItem(OListViewItem* parent) | 18 | ResultItem::ResultItem(OListViewItem* parent) |
21 | : OListViewItem(parent) | 19 | : OListViewItem(parent) |
22 | { | 20 | { |
23 | 21 | ||
24 | } | 22 | } |
25 | 23 | ||
26 | 24 | ||
27 | ResultItem::~ResultItem() | 25 | ResultItem::~ResultItem() |
28 | { | 26 | { |
29 | } | 27 | } |
diff --git a/core/pim/osearch/resultitem.h b/core/pim/osearch/resultitem.h index 9e87f99..1c14e8f 100644 --- a/core/pim/osearch/resultitem.h +++ b/core/pim/osearch/resultitem.h | |||
@@ -1,35 +1,35 @@ | |||
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 RESULTITEM_H | 13 | #ifndef RESULTITEM_H |
14 | #define RESULTITEM_H | 14 | #define RESULTITEM_H |
15 | 15 | ||
16 | #include <qintdict.h> | ||
17 | |||
18 | #include "olistviewitem.h" | 16 | #include "olistviewitem.h" |
19 | 17 | ||
18 | #include <qintdict.h> | ||
19 | |||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class ResultItem : public OListViewItem | 23 | class ResultItem : public OListViewItem |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | ResultItem(OListViewItem* parent); | 26 | ResultItem(OListViewItem* parent); |
27 | ~ResultItem(); | 27 | ~ResultItem(); |
28 | 28 | ||
29 | virtual QString toRichText() {return "no text";}; | 29 | virtual QString toRichText() {return "no text";}; |
30 | virtual int rtti() { return Result;} | 30 | virtual int rtti() { return Result;} |
31 | virtual void action( int ) = 0; | 31 | virtual void action( int ) = 0; |
32 | virtual QIntDict<QString> actions() = 0; | 32 | virtual QIntDict<QString> actions() = 0; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | #endif | 35 | #endif |
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp index 0b58176..5377b9f 100644 --- a/core/pim/osearch/searchgroup.cpp +++ b/core/pim/osearch/searchgroup.cpp | |||
@@ -1,92 +1,92 @@ | |||
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 "olistviewitem.h" | ||
14 | #include "searchgroup.h" | ||
15 | |||
16 | #include <opie2/owait.h> | ||
13 | 17 | ||
14 | #include <qobject.h> | 18 | #include <qobject.h> |
15 | #include <qregexp.h> | 19 | #include <qregexp.h> |
16 | #include <qapplication.h> | 20 | #include <qapplication.h> |
17 | #include <opie/owait.h> | ||
18 | |||
19 | #include "olistviewitem.h" | ||
20 | #include "searchgroup.h" | ||
21 | 21 | ||
22 | #ifndef NEW_OWAIT | 22 | #ifndef NEW_OWAIT |
23 | static OWait *wait = 0; | 23 | static OWait *wait = 0; |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | SearchGroup::SearchGroup(QListView* parent, QString name) | 26 | SearchGroup::SearchGroup(QListView* parent, QString name) |
27 | : OListViewItem(parent, name) | 27 | : OListViewItem(parent, name) |
28 | { | 28 | { |
29 | _name = name; | 29 | _name = name; |
30 | loaded = false; | 30 | loaded = false; |
31 | } | 31 | } |
32 | 32 | ||
33 | 33 | ||
34 | SearchGroup::~SearchGroup() | 34 | SearchGroup::~SearchGroup() |
35 | { | 35 | { |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | void SearchGroup::expand() | 39 | void SearchGroup::expand() |
40 | { | 40 | { |
41 | //expanded = true; | 41 | //expanded = true; |
42 | if (_lastSearch != _search) clearList(); | 42 | if (_lastSearch != _search) clearList(); |
43 | if (_search.isEmpty()) return; | 43 | if (_search.isEmpty()) return; |
44 | OListViewItem *dummy = new OListViewItem( this, "searching..."); | 44 | OListViewItem *dummy = new OListViewItem( this, "searching..."); |
45 | setOpen( true ); | 45 | setOpen( true ); |
46 | repaint(); | 46 | repaint(); |
47 | int res_count = realSearch(); | 47 | int res_count = realSearch(); |
48 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | 48 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); |
49 | delete dummy; | 49 | delete dummy; |
50 | repaint(); | 50 | repaint(); |
51 | } | 51 | } |
52 | 52 | ||
53 | void SearchGroup::doSearch() | 53 | void SearchGroup::doSearch() |
54 | { | 54 | { |
55 | clearList(); | 55 | clearList(); |
56 | if (_search.isEmpty()) return; | 56 | if (_search.isEmpty()) return; |
57 | _resultCount = realSearch(); | 57 | _resultCount = realSearch(); |
58 | //repaint(); | 58 | //repaint(); |
59 | } | 59 | } |
60 | 60 | ||
61 | void SearchGroup::setSearch(QRegExp re) | 61 | void SearchGroup::setSearch(QRegExp re) |
62 | { | 62 | { |
63 | if (re == _search) return; | 63 | if (re == _search) return; |
64 | setText(0, _name+" - "+re.pattern() ); | 64 | setText(0, _name+" - "+re.pattern() ); |
65 | _search = re; | 65 | _search = re; |
66 | if (isOpen()) expand(); | 66 | if (isOpen()) expand(); |
67 | else new OListViewItem( this, "searching..."); | 67 | else new OListViewItem( this, "searching..."); |
68 | } | 68 | } |
69 | 69 | ||
70 | int SearchGroup::realSearch() | 70 | int SearchGroup::realSearch() |
71 | { | 71 | { |
72 | if (_lastSearch == _search) return _resultCount; | 72 | if (_lastSearch == _search) return _resultCount; |
73 | #ifndef NEW_OWAIT | 73 | #ifndef NEW_OWAIT |
74 | if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" ); | 74 | if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" ); |
75 | wait->show(); | 75 | wait->show(); |
76 | qApp->processEvents(); | 76 | qApp->processEvents(); |
77 | #else | 77 | #else |
78 | qDebug("********** NEW_OWAIT *************"); | 78 | qDebug("********** NEW_OWAIT *************"); |
79 | OWait( "searching" ); | 79 | OWait( "searching" ); |
80 | #endif | 80 | #endif |
81 | if (!loaded) load(); | 81 | if (!loaded) load(); |
82 | _resultCount = 0; | 82 | _resultCount = 0; |
83 | _resultCount = search(); | 83 | _resultCount = search(); |
84 | _lastSearch = _search; | 84 | _lastSearch = _search; |
85 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")"); | 85 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")"); |
86 | 86 | ||
87 | #ifndef NEW_OWAIT | 87 | #ifndef NEW_OWAIT |
88 | wait->hide(); | 88 | wait->hide(); |
89 | #endif | 89 | #endif |
90 | return _resultCount; | 90 | return _resultCount; |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp index 9808a04..c20f1fd 100644 --- a/core/pim/osearch/todoitem.cpp +++ b/core/pim/osearch/todoitem.cpp | |||
@@ -1,81 +1,83 @@ | |||
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 | |
16 | #include <qpixmap.h> | ||
17 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
19 | 18 | ||
20 | TodoItem::TodoItem(OListViewItem* parent, OTodo *todo) | 19 | #include <qpixmap.h> |
20 | |||
21 | |||
22 | TodoItem::TodoItem(OListViewItem* parent, OPimTodo *todo) | ||
21 | : ResultItem(parent) | 23 | : ResultItem(parent) |
22 | { | 24 | { |
23 | _todo = todo; | 25 | _todo = todo; |
24 | setText( 0, todo->toShortText() ); | 26 | setText( 0, todo->toShortText() ); |
25 | setIcon(); | 27 | setIcon(); |
26 | } | 28 | } |
27 | 29 | ||
28 | TodoItem::~TodoItem() | 30 | TodoItem::~TodoItem() |
29 | { | 31 | { |
30 | delete _todo; | 32 | delete _todo; |
31 | } | 33 | } |
32 | 34 | ||
33 | QString TodoItem::toRichText() | 35 | QString TodoItem::toRichText() |
34 | { | 36 | { |
35 | return _todo->toRichText(); | 37 | return _todo->toRichText(); |
36 | } | 38 | } |
37 | 39 | ||
38 | void TodoItem::action( int act ) | 40 | void TodoItem::action( int act ) |
39 | { | 41 | { |
40 | if (act == 0){ | 42 | if (act == 0){ |
41 | QCopEnvelope e("QPE/Application/todolist", "show(int)"); | 43 | QCopEnvelope e("QPE/Application/todolist", "show(int)"); |
42 | e << _todo->uid(); | 44 | e << _todo->uid(); |
43 | }else if (act == 1){ | 45 | }else if (act == 1){ |
44 | QCopEnvelope e("QPE/Application/todolist", "edit(int)"); | 46 | QCopEnvelope e("QPE/Application/todolist", "edit(int)"); |
45 | e << _todo->uid(); | 47 | e << _todo->uid(); |
46 | } | 48 | } |
47 | } | 49 | } |
48 | 50 | ||
49 | QIntDict<QString> TodoItem::actions() | 51 | QIntDict<QString> TodoItem::actions() |
50 | { | 52 | { |
51 | QIntDict<QString> result; | 53 | QIntDict<QString> result; |
52 | result.insert( 0, new QString( QObject::tr("show") ) ); | 54 | result.insert( 0, new QString( QObject::tr("show") ) ); |
53 | result.insert( 1, new QString( QObject::tr("edit") ) ); | 55 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
54 | return result; | 56 | return result; |
55 | } | 57 | } |
56 | 58 | ||
57 | void TodoItem::setIcon() | 59 | void TodoItem::setIcon() |
58 | { | 60 | { |
59 | QPixmap icon; | 61 | QPixmap icon; |
60 | switch ( _todo->lastHitField() ) { | 62 | switch ( _todo->lastHitField() ) { |
61 | case -1: | 63 | case -1: |
62 | icon = Resource::loadPixmap( "reset" ); | 64 | icon = Resource::loadPixmap( "reset" ); |
63 | break; | 65 | break; |
64 | case OTodo::Description: | 66 | case OPimTodo::Description: |
65 | icon = Resource::loadPixmap( "txt" ); | 67 | icon = Resource::loadPixmap( "txt" ); |
66 | break; | 68 | break; |
67 | case OTodo::Summary: | 69 | case OPimTodo::Summary: |
68 | icon = Resource::loadPixmap( "osearch/summary" ); | 70 | icon = Resource::loadPixmap( "osearch/summary" ); |
69 | break; | 71 | break; |
70 | case OTodo::Priority: | 72 | case OPimTodo::Priority: |
71 | icon = Resource::loadPixmap( "todo/priority1" ); | 73 | icon = Resource::loadPixmap( "todo/priority1" ); |
72 | break; | 74 | break; |
73 | case OTodo::HasDate: | 75 | case OPimTodo::HasDate: |
74 | icon = Resource::loadPixmap( "osearch/clock" ); | 76 | icon = Resource::loadPixmap( "osearch/clock" ); |
75 | break; | 77 | break; |
76 | default: | 78 | default: |
77 | icon = Resource::loadPixmap( "DocsIcon" ); | 79 | icon = Resource::loadPixmap( "DocsIcon" ); |
78 | break; | 80 | break; |
79 | } | 81 | } |
80 | setPixmap( 0, icon ); | 82 | setPixmap( 0, icon ); |
81 | } | 83 | } |
diff --git a/core/pim/osearch/todoitem.h b/core/pim/osearch/todoitem.h index cc78e57..7c8537b 100644 --- a/core/pim/osearch/todoitem.h +++ b/core/pim/osearch/todoitem.h | |||
@@ -1,38 +1,41 @@ | |||
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 | |||
17 | #include <opie2/opimtodo.h> | ||
16 | #include "resultitem.h" | 18 | #include "resultitem.h" |
17 | class OTodo; | 19 | |
20 | using namespace Opie; | ||
18 | 21 | ||
19 | /** | 22 | /** |
20 | @author Patrick S. Vogt | 23 | @author Patrick S. Vogt |
21 | */ | 24 | */ |
22 | class TodoItem : public ResultItem | 25 | class TodoItem : public ResultItem |
23 | { | 26 | { |
24 | public: | 27 | public: |
25 | TodoItem(OListViewItem* parent, OTodo *todo); | 28 | TodoItem(OListViewItem* parent, OPimTodo *todo); |
26 | ~TodoItem(); | 29 | ~TodoItem(); |
27 | 30 | ||
28 | virtual QString toRichText(); | 31 | virtual QString toRichText(); |
29 | virtual void action( int ); | 32 | virtual void action( int ); |
30 | virtual QIntDict<QString> actions(); | 33 | virtual QIntDict<QString> actions(); |
31 | 34 | ||
32 | private: | 35 | private: |
33 | void setIcon(); | 36 | void setIcon(); |
34 | OTodo *_todo; | 37 | OPimTodo *_todo; |
35 | 38 | ||
36 | }; | 39 | }; |
37 | 40 | ||
38 | #endif | 41 | #endif |
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 8de875e..5042803 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -1,80 +1,80 @@ | |||
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 "todosearch.h" | 13 | #include "todosearch.h" |
14 | #include "todoitem.h" | ||
14 | 15 | ||
15 | #include <opie/otodoaccess.h> | ||
16 | #include <opie/otodo.h> | ||
17 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | |||
19 | #include <qiconset.h> | 19 | #include <qiconset.h> |
20 | #include <qaction.h> | 20 | #include <qaction.h> |
21 | #include <qpopupmenu.h> | 21 | #include <qpopupmenu.h> |
22 | #include "todoitem.h" | 22 | |
23 | 23 | ||
24 | TodoSearch::TodoSearch(QListView* parent, QString name) | 24 | TodoSearch::TodoSearch(QListView* parent, QString name) |
25 | : SearchGroup(parent, name), _todos(0), _popupMenu(0) | 25 | : SearchGroup(parent, name), _todos(0), _popupMenu(0) |
26 | { | 26 | { |
27 | //AppLnkSet als(QPEApplication::qpeDir()); | 27 | //AppLnkSet als(QPEApplication::qpeDir()); |
28 | //setPixmap( 0, als.findExec("todolist")->pixmap() ); | 28 | //setPixmap( 0, als.findExec("todolist")->pixmap() ); |
29 | QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" ); | 29 | QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" ); |
30 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); | 30 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); |
31 | actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true ); | 31 | actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true ); |
32 | Config cfg( "osearch", Config::User ); | 32 | Config cfg( "osearch", Config::User ); |
33 | cfg.setGroup( "todo_settings" ); | 33 | cfg.setGroup( "todo_settings" ); |
34 | actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); | 34 | actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); |
35 | 35 | ||
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | TodoSearch::~TodoSearch() | 39 | TodoSearch::~TodoSearch() |
40 | { | 40 | { |
41 | Config cfg( "osearch", Config::User ); | 41 | Config cfg( "osearch", Config::User ); |
42 | cfg.setGroup( "todo_settings" ); | 42 | cfg.setGroup( "todo_settings" ); |
43 | cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() ); | 43 | cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() ); |
44 | delete _popupMenu; | 44 | delete _popupMenu; |
45 | delete actionShowCompleted; | 45 | delete actionShowCompleted; |
46 | delete _todos; | 46 | delete _todos; |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | void TodoSearch::load() | 50 | void TodoSearch::load() |
51 | { | 51 | { |
52 | _todos = new OTodoAccess(); | 52 | _todos = new OPimTodoAccess(); |
53 | _todos->load(); | 53 | _todos->load(); |
54 | } | 54 | } |
55 | 55 | ||
56 | int TodoSearch::search() | 56 | int TodoSearch::search() |
57 | { | 57 | { |
58 | ORecordList<OTodo> results = _todos->matchRegexp(_search); | 58 | OPimRecordList<OPimTodo> results = _todos->matchRegexp(_search); |
59 | for (uint i = 0; i < results.count(); i++) | 59 | for (uint i = 0; i < results.count(); i++) |
60 | insertItem( new OTodo( results[i] )); | 60 | insertItem( new OPimTodo( results[i] )); |
61 | return _resultCount; | 61 | return _resultCount; |
62 | } | 62 | } |
63 | 63 | ||
64 | void TodoSearch::insertItem( void *rec ) | 64 | void TodoSearch::insertItem( void *rec ) |
65 | { | 65 | { |
66 | OTodo *todo = (OTodo*)rec; | 66 | OPimTodo *todo = (OPimTodo*)rec; |
67 | if (!actionShowCompleted->isOn() && | 67 | if (!actionShowCompleted->isOn() && |
68 | todo->isCompleted() ) return; | 68 | todo->isCompleted() ) return; |
69 | (void)new TodoItem( this, todo ); | 69 | (void)new TodoItem( this, todo ); |
70 | _resultCount++; | 70 | _resultCount++; |
71 | } | 71 | } |
72 | 72 | ||
73 | QPopupMenu* TodoSearch::popupMenu() | 73 | QPopupMenu* TodoSearch::popupMenu() |
74 | { | 74 | { |
75 | if (!_popupMenu){ | 75 | if (!_popupMenu){ |
76 | _popupMenu = new QPopupMenu( 0 ); | 76 | _popupMenu = new QPopupMenu( 0 ); |
77 | actionShowCompleted->addTo( _popupMenu ); | 77 | actionShowCompleted->addTo( _popupMenu ); |
78 | } | 78 | } |
79 | return _popupMenu; | 79 | return _popupMenu; |
80 | } | 80 | } |
diff --git a/core/pim/osearch/todosearch.h b/core/pim/osearch/todosearch.h index ee175da..740e483 100644 --- a/core/pim/osearch/todosearch.h +++ b/core/pim/osearch/todosearch.h | |||
@@ -1,43 +1,47 @@ | |||
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 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 | #include <opie2/otodoaccess.h> |
19 | #include <opie2/opimtodo.h> | ||
20 | |||
19 | class QAction; | 21 | class QAction; |
20 | 22 | ||
23 | using namespace Opie; | ||
24 | |||
21 | /** | 25 | /** |
22 | @author Patrick S. Vogt | 26 | @author Patrick S. Vogt |
23 | */ | 27 | */ |
24 | class TodoSearch : public SearchGroup | 28 | class TodoSearch : public SearchGroup |
25 | { | 29 | { |
26 | public: | 30 | public: |
27 | TodoSearch(QListView* parent, QString name); | 31 | TodoSearch(QListView* parent, QString name); |
28 | ~TodoSearch(); | 32 | ~TodoSearch(); |
29 | 33 | ||
30 | virtual QPopupMenu* popupMenu(); | 34 | virtual QPopupMenu* popupMenu(); |
31 | 35 | ||
32 | protected: | 36 | protected: |
33 | virtual void load(); | 37 | virtual void load(); |
34 | virtual int search(); | 38 | virtual int search(); |
35 | virtual void insertItem( void* ); | 39 | virtual void insertItem( void* ); |
36 | 40 | ||
37 | private: | 41 | private: |
38 | OTodoAccess *_todos; | 42 | OPimTodoAccess *_todos; |
39 | QAction *actionShowCompleted; | 43 | QAction *actionShowCompleted; |
40 | QPopupMenu *_popupMenu; | 44 | QPopupMenu *_popupMenu; |
41 | }; | 45 | }; |
42 | 46 | ||
43 | #endif | 47 | #endif |