author | tille <tille> | 2003-05-13 13:46:19 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-13 13:46:19 (UTC) |
commit | ba4bb8e673fba43ae7a232942dea14d166991530 (patch) (unidiff) | |
tree | e775ad637d5256eb1412e576c1bd5e77ed50406d | |
parent | 1461a41433a732e3a615508e5de23f8acd91de6a (diff) | |
download | opie-ba4bb8e673fba43ae7a232942dea14d166991530.zip opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.gz opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.bz2 |
icons ;)
-rw-r--r-- | core/pim/osearch/adresssearch.cpp | 10 | ||||
-rw-r--r-- | core/pim/osearch/applnkitem.cpp | 1 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.cpp | 7 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 5 | ||||
-rw-r--r-- | core/pim/osearch/doclnkitem.cpp | 1 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 6 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 22 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 10 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.cpp | 31 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.h | 9 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 7 |
11 files changed, 86 insertions, 23 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index 69ad9ef..252fb40 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.cpp | |||
@@ -1,50 +1,58 @@ | |||
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 | 14 | ||
15 | #include <opie/ocontactaccess.h> | 15 | #include <opie/ocontactaccess.h> |
16 | #include <qstring.h> | 16 | #include <qstring.h> |
17 | #include <qiconset.h> | ||
18 | #include <qpe/resource.h> | ||
17 | 19 | ||
18 | #include "contactitem.h" | 20 | #include "contactitem.h" |
19 | //#include <qdir.h> | ||
20 | 21 | ||
21 | AdressSearch::AdressSearch(QListView* parent, QString name): | 22 | AdressSearch::AdressSearch(QListView* parent, QString name): |
22 | SearchGroup(parent, name) | 23 | SearchGroup(parent, name) |
23 | { | 24 | { |
24 | _contacts = 0; | 25 | _contacts = 0; |
26 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); | ||
27 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | ||
28 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); | ||
29 | QImage img = pix.convertToImage(); | ||
30 | img.smoothScale( 14, 14 ); | ||
31 | pix.convertFromImage( img ); | ||
32 | setPixmap( 0, pix );*/ | ||
25 | } | 33 | } |
26 | 34 | ||
27 | 35 | ||
28 | AdressSearch::~AdressSearch() | 36 | AdressSearch::~AdressSearch() |
29 | { | 37 | { |
30 | delete _contacts; | 38 | delete _contacts; |
31 | } | 39 | } |
32 | 40 | ||
33 | void AdressSearch::load() | 41 | void AdressSearch::load() |
34 | { | 42 | { |
35 | _contacts = new OContactAccess("osearch"); | 43 | _contacts = new OContactAccess("osearch"); |
36 | } | 44 | } |
37 | 45 | ||
38 | int AdressSearch::search() | 46 | int AdressSearch::search() |
39 | { | 47 | { |
40 | ORecordList<OContact> results = _contacts->matchRegexp(_search); | 48 | ORecordList<OContact> results = _contacts->matchRegexp(_search); |
41 | for (uint i = 0; i < results.count(); i++) { | 49 | for (uint i = 0; i < results.count(); i++) { |
42 | new ContactItem( this, new OContact( results[i] )); | 50 | new ContactItem( this, new OContact( results[i] )); |
43 | } | 51 | } |
44 | return results.count(); | 52 | return results.count(); |
45 | } | 53 | } |
46 | 54 | ||
47 | void AdressSearch::insertItem( void* ) | 55 | void AdressSearch::insertItem( void* ) |
48 | { | 56 | { |
49 | 57 | ||
50 | } | 58 | } |
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp index 0d04be6..2c4a4cb 100644 --- a/core/pim/osearch/applnkitem.cpp +++ b/core/pim/osearch/applnkitem.cpp | |||
@@ -1,59 +1,60 @@ | |||
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> | 16 | #include <qfileinfo.h> |
17 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
18 | 18 | ||
19 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) | 19 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) |
20 | : ResultItem(parent) | 20 | : ResultItem(parent) |
21 | { | 21 | { |
22 | _app = app; | 22 | _app = app; |
23 | setText(0, _app->name() ); | 23 | setText(0, _app->name() ); |
24 | setPixmap(0, _app->pixmap() ); | ||
24 | } | 25 | } |
25 | 26 | ||
26 | 27 | ||
27 | AppLnkItem::~AppLnkItem() | 28 | AppLnkItem::~AppLnkItem() |
28 | { | 29 | { |
29 | } | 30 | } |
30 | 31 | ||
31 | 32 | ||
32 | QString AppLnkItem::toRichText() | 33 | QString AppLnkItem::toRichText() |
33 | { | 34 | { |
34 | QString text; | 35 | QString text; |
35 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; | 36 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; |
36 | text += _app->comment() + "<br>"; | 37 | text += _app->comment() + "<br>"; |
37 | text += "<br>`" + _app->exec() + "`<br>"; | 38 | text += "<br>`" + _app->exec() + "`<br>"; |
38 | text += "<br>`" + _app->file() + "`<br>"; | 39 | text += "<br>`" + _app->file() + "`<br>"; |
39 | text += "<br>`" + _app->linkFile() + "`<br>"; | 40 | text += "<br>`" + _app->linkFile() + "`<br>"; |
40 | return text; | 41 | return text; |
41 | } | 42 | } |
42 | 43 | ||
43 | void AppLnkItem::action( int act ) | 44 | void AppLnkItem::action( int act ) |
44 | { | 45 | { |
45 | if (!_app->isValid()) qDebug("INVALID"); | 46 | if (!_app->isValid()) qDebug("INVALID"); |
46 | if (act == 0) _app->execute(); | 47 | if (act == 0) _app->execute(); |
47 | else if (act == 1){ | 48 | else if (act == 1){ |
48 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); | 49 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); |
49 | e << _app->linkFile(); | 50 | e << _app->linkFile(); |
50 | } | 51 | } |
51 | } | 52 | } |
52 | 53 | ||
53 | QIntDict<QString> AppLnkItem::actions() | 54 | QIntDict<QString> AppLnkItem::actions() |
54 | { | 55 | { |
55 | QIntDict<QString> result; | 56 | QIntDict<QString> result; |
56 | result.insert( 0, new QString( QObject::tr("execute") ) ); | 57 | result.insert( 0, new QString( QObject::tr("execute") ) ); |
57 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); | 58 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); |
58 | return result; | 59 | return result; |
59 | } | 60 | } |
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp index acf650a..d5b181b 100644 --- a/core/pim/osearch/applnksearch.cpp +++ b/core/pim/osearch/applnksearch.cpp | |||
@@ -1,63 +1,68 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "applnksearch.h" | 13 | #include "applnksearch.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <qiconset.h> | ||
18 | #include <qpe/resource.h> | ||
17 | 19 | ||
18 | #include "applnkitem.h" | 20 | #include "applnkitem.h" |
19 | 21 | ||
20 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) | 22 | AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) |
21 | { | 23 | { |
22 | _apps = 0; | 24 | _apps = 0; |
25 | QIconSet is = Resource::loadIconSet( "osearch/applications" ); | ||
26 | //QIconSet is = Resource::loadIconSet( "AppsIcon" ); | ||
27 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | ||
23 | } | 28 | } |
24 | 29 | ||
25 | 30 | ||
26 | AppLnkSearch::~AppLnkSearch() | 31 | AppLnkSearch::~AppLnkSearch() |
27 | { | 32 | { |
28 | delete _apps; | 33 | delete _apps; |
29 | } | 34 | } |
30 | 35 | ||
31 | 36 | ||
32 | void AppLnkSearch::load() | 37 | void AppLnkSearch::load() |
33 | { | 38 | { |
34 | _apps = new AppLnkSet(QPEApplication::qpeDir()); | 39 | _apps = new AppLnkSet(QPEApplication::qpeDir()); |
35 | } | 40 | } |
36 | 41 | ||
37 | int AppLnkSearch::search() | 42 | int AppLnkSearch::search() |
38 | { | 43 | { |
39 | int count = 0; | 44 | int count = 0; |
40 | QList<AppLnk> appList = _apps->children(); | 45 | QList<AppLnk> appList = _apps->children(); |
41 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ | 46 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ |
42 | if ( (_search.match( app->name() ) != -1) | 47 | if ( (_search.match( app->name() ) != -1) |
43 | || (_search.match(app->comment()) != -1) | 48 | || (_search.match(app->comment()) != -1) |
44 | || (_search.match(app->exec()) != -1) ) { | 49 | || (_search.match(app->exec()) != -1) ) { |
45 | count++; | 50 | count++; |
46 | insertItem( app ); | 51 | insertItem( app ); |
47 | } | 52 | } |
53 | qApp->processEvents( 100 ); | ||
48 | } | 54 | } |
49 | return count; | 55 | return count; |
50 | } | 56 | } |
51 | 57 | ||
52 | void AppLnkSearch::insertItem( void *rec ) | 58 | void AppLnkSearch::insertItem( void *rec ) |
53 | { | 59 | { |
54 | new AppLnkItem( this, (AppLnk*)rec ); | 60 | new AppLnkItem( this, (AppLnk*)rec ); |
55 | } | 61 | } |
56 | 62 | ||
57 | void AppLnkSearch::setSearch(QRegExp re) | 63 | void AppLnkSearch::setSearch(QRegExp re) |
58 | { | 64 | { |
59 | expanded = false; | ||
60 | setOpen( false ); | 65 | setOpen( false ); |
61 | SearchGroup::setSearch( re ); | 66 | SearchGroup::setSearch( re ); |
62 | } | 67 | } |
63 | 68 | ||
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 68699fa..7aabcea 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -1,50 +1,55 @@ | |||
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 | 14 | ||
15 | #include "eventitem.h" | 15 | #include "eventitem.h" |
16 | 16 | ||
17 | #include <opie/oevent.h> | 17 | #include <opie/oevent.h> |
18 | #include <opie/odatebookaccess.h> | 18 | #include <opie/odatebookaccess.h> |
19 | #include <qiconset.h> | ||
20 | #include <qpe/resource.h> | ||
19 | 21 | ||
20 | DatebookSearch::DatebookSearch(QListView* parent, QString name) | 22 | DatebookSearch::DatebookSearch(QListView* parent, QString name) |
21 | : SearchGroup(parent, name) | 23 | : SearchGroup(parent, name) |
22 | { | 24 | { |
23 | _dates = 0; | 25 | _dates = 0; |
26 | QIconSet is = Resource::loadIconSet( "datebook/DateBook" ); | ||
27 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | ||
28 | |||
24 | } | 29 | } |
25 | 30 | ||
26 | 31 | ||
27 | DatebookSearch::~DatebookSearch() | 32 | DatebookSearch::~DatebookSearch() |
28 | { | 33 | { |
29 | delete _dates; | 34 | delete _dates; |
30 | } | 35 | } |
31 | 36 | ||
32 | 37 | ||
33 | void DatebookSearch::load() | 38 | void DatebookSearch::load() |
34 | { | 39 | { |
35 | _dates = new ODateBookAccess(); | 40 | _dates = new ODateBookAccess(); |
36 | _dates->load(); | 41 | _dates->load(); |
37 | } | 42 | } |
38 | 43 | ||
39 | int DatebookSearch::search() | 44 | int DatebookSearch::search() |
40 | { | 45 | { |
41 | ORecordList<OEvent> results = _dates->matchRegexp(_search); | 46 | ORecordList<OEvent> results = _dates->matchRegexp(_search); |
42 | for (uint i = 0; i < results.count(); i++) | 47 | for (uint i = 0; i < results.count(); i++) |
43 | new EventItem( this, new OEvent( results[i] )); | 48 | new EventItem( this, new OEvent( results[i] )); |
44 | return results.count(); | 49 | return results.count(); |
45 | } | 50 | } |
46 | 51 | ||
47 | void DatebookSearch::insertItem( void* ) | 52 | void DatebookSearch::insertItem( void* ) |
48 | { | 53 | { |
49 | 54 | ||
50 | } | 55 | } |
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp index 95402b9..a1d0384 100644 --- a/core/pim/osearch/doclnkitem.cpp +++ b/core/pim/osearch/doclnkitem.cpp | |||
@@ -1,73 +1,74 @@ | |||
1 | // | 1 | // |
2 | // | 2 | // |
3 | // C++ Implementation: $MODULE$ | 3 | // C++ Implementation: $MODULE$ |
4 | // | 4 | // |
5 | // Description: | 5 | // Description: |
6 | // | 6 | // |
7 | // | 7 | // |
8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 | 8 | // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 |
9 | // | 9 | // |
10 | // Copyright: See COPYING file that comes with this distribution | 10 | // Copyright: See COPYING file that comes with this distribution |
11 | // | 11 | // |
12 | // | 12 | // |
13 | #include "doclnkitem.h" | 13 | #include "doclnkitem.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qfile.h> | 16 | #include <qfile.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #include <qfileinfo.h> | 18 | #include <qfileinfo.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | 20 | ||
21 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) | 21 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) |
22 | : ResultItem(parent) | 22 | : ResultItem(parent) |
23 | { | 23 | { |
24 | _doc = app; | 24 | _doc = app; |
25 | setText(0, _doc->name() ); | 25 | setText(0, _doc->name() ); |
26 | setPixmap(0, _doc->pixmap() ); | ||
26 | } | 27 | } |
27 | 28 | ||
28 | DocLnkItem::~DocLnkItem() | 29 | DocLnkItem::~DocLnkItem() |
29 | { | 30 | { |
30 | } | 31 | } |
31 | 32 | ||
32 | QString DocLnkItem::toRichText() | 33 | QString DocLnkItem::toRichText() |
33 | { | 34 | { |
34 | QString text; | 35 | QString text; |
35 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; | 36 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; |
36 | text += _doc->comment() + "<br>"; | 37 | text += _doc->comment() + "<br>"; |
37 | text += "File: " + _doc->file() + "<br>"; | 38 | text += "File: " + _doc->file() + "<br>"; |
38 | text += "Link: " + _doc->linkFile() + "<br>"; | 39 | text += "Link: " + _doc->linkFile() + "<br>"; |
39 | text += "Mimetype: " + _doc->type() + "<br>"; | 40 | text += "Mimetype: " + _doc->type() + "<br>"; |
40 | if ( _doc->type().contains( "text" ) ){ | 41 | if ( _doc->type().contains( "text" ) ){ |
41 | text += "<br><br><hr><br>"; | 42 | text += "<br><br><hr><br>"; |
42 | QFile f(_doc->file()); | 43 | QFile f(_doc->file()); |
43 | if ( f.open(IO_ReadOnly) ) { | 44 | if ( f.open(IO_ReadOnly) ) { |
44 | QTextStream t( &f ); | 45 | QTextStream t( &f ); |
45 | while ( !t.eof() ) | 46 | while ( !t.eof() ) |
46 | text += t.readLine() + "<br>"; | 47 | text += t.readLine() + "<br>"; |
47 | } | 48 | } |
48 | f.close(); | 49 | f.close(); |
49 | } | 50 | } |
50 | /* text += "<br><br>`"; | 51 | /* text += "<br><br>`"; |
51 | text += _doc->exec(); | 52 | text += _doc->exec(); |
52 | text += "`";*/ | 53 | text += "`";*/ |
53 | QStringList list = _doc->mimeTypes(); | 54 | QStringList list = _doc->mimeTypes(); |
54 | int i = 0; | 55 | int i = 0; |
55 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 56 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
56 | text += QString::number( i++) + " - " + *it ; | 57 | text += QString::number( i++) + " - " + *it ; |
57 | } | 58 | } |
58 | return text; | 59 | return text; |
59 | } | 60 | } |
60 | 61 | ||
61 | void DocLnkItem::action( int act ) | 62 | void DocLnkItem::action( int act ) |
62 | { | 63 | { |
63 | qDebug("action %i",act); | 64 | qDebug("action %i",act); |
64 | if (!_doc->isValid()) qDebug("INVALID"); | 65 | if (!_doc->isValid()) qDebug("INVALID"); |
65 | if (act == 0) _doc->execute(); | 66 | if (act == 0) _doc->execute(); |
66 | else if (act == 1){ | 67 | else if (act == 1){ |
67 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); | 68 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); |
68 | e << _doc->file(); | 69 | e << _doc->file(); |
69 | } | 70 | } |
70 | } | 71 | } |
71 | 72 | ||
72 | QIntDict<QString> DocLnkItem::actions() | 73 | QIntDict<QString> DocLnkItem::actions() |
73 | { | 74 | { |
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index f2a60e9..123eaa0 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp | |||
@@ -1,38 +1,42 @@ | |||
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 "doclnksearch.h" | 13 | #include "doclnksearch.h" |
14 | 14 | ||
15 | #include <qpe/applnk.h> | 15 | #include <qpe/applnk.h> |
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <qiconset.h> | ||
18 | #include <qpe/resource.h> | ||
17 | 19 | ||
18 | #include "doclnkitem.h" | 20 | #include "doclnkitem.h" |
19 | 21 | ||
20 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) | 22 | DocLnkSearch::DocLnkSearch(QListView* parent, QString name) |
21 | : AppLnkSearch(parent, name) | 23 | : AppLnkSearch(parent, name) |
22 | { | 24 | { |
25 | QIconSet is = Resource::loadIconSet( "osearch/documents" ); | ||
26 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | ||
23 | } | 27 | } |
24 | 28 | ||
25 | 29 | ||
26 | DocLnkSearch::~DocLnkSearch() | 30 | DocLnkSearch::~DocLnkSearch() |
27 | { | 31 | { |
28 | } | 32 | } |
29 | 33 | ||
30 | void DocLnkSearch::load() | 34 | void DocLnkSearch::load() |
31 | { | 35 | { |
32 | _apps = new DocLnkSet(QPEApplication::documentDir()); | 36 | _apps = new DocLnkSet(QPEApplication::documentDir()); |
33 | } | 37 | } |
34 | 38 | ||
35 | void DocLnkSearch::insertItem( void *rec ) | 39 | void DocLnkSearch::insertItem( void *rec ) |
36 | { | 40 | { |
37 | new DocLnkItem( this, (DocLnk*)rec ); | 41 | new DocLnkItem( this, (DocLnk*)rec ); |
38 | } | 42 | } |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index e15cc7e..33a24bc 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -42,167 +42,179 @@ | |||
42 | #include "applnksearch.h" | 42 | #include "applnksearch.h" |
43 | #include "doclnksearch.h" | 43 | #include "doclnksearch.h" |
44 | 44 | ||
45 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 45 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
46 | QMainWindow( parent, name, f ), _currentItem(0) | 46 | QMainWindow( parent, name, f ), _currentItem(0) |
47 | { | 47 | { |
48 | setCaption( tr("OSearch") ); | 48 | setCaption( tr("OSearch") ); |
49 | 49 | ||
50 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); | 50 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); |
51 | 51 | ||
52 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 52 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
53 | 53 | ||
54 | mainLayout = new QVBoxLayout( mainFrame ); | 54 | mainLayout = new QVBoxLayout( mainFrame ); |
55 | mainLayout->setSpacing( 0 ); | 55 | mainLayout->setSpacing( 0 ); |
56 | mainLayout->setMargin( 0 ); | 56 | mainLayout->setMargin( 0 ); |
57 | 57 | ||
58 | resultsList = new OListView( mainFrame ); | 58 | resultsList = new OListView( mainFrame ); |
59 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); | 59 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); |
60 | mainLayout->addWidget( resultsList, 1 ); | 60 | mainLayout->addWidget( resultsList, 1 ); |
61 | 61 | ||
62 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 62 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
63 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 63 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
64 | richEdit = new QTextView( detailsFrame ); | 64 | richEdit = new QTextView( detailsFrame ); |
65 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); | 65 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); |
66 | //richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum )); | 66 | //richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum )); |
67 | detailsLayout->addWidget( richEdit, 1 ); | 67 | detailsLayout->addWidget( richEdit, 1 ); |
68 | 68 | ||
69 | buttonGroupActions = new QHButtonGroup( this ); | 69 | buttonGroupActions = new QHButtonGroup( this ); |
70 | buttonGroupActions->hide(); | 70 | buttonGroupActions->hide(); |
71 | _buttonCount = 0; | 71 | _buttonCount = 0; |
72 | // buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 72 | // buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
73 | 73 | ||
74 | buttonLayout = new QHBoxLayout( detailsFrame ); | 74 | buttonLayout = new QHBoxLayout( detailsFrame ); |
75 | detailsLayout->addLayout( buttonLayout ); | 75 | detailsLayout->addLayout( buttonLayout ); |
76 | 76 | ||
77 | mainLayout->addWidget( detailsFrame ); | 77 | mainLayout->addWidget( detailsFrame ); |
78 | detailsFrame->hide(); | 78 | detailsFrame->hide(); |
79 | 79 | ||
80 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); | 80 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); |
81 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); | 81 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); |
82 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); | 82 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); |
83 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); | 83 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); |
84 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); | 84 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); |
85 | 85 | ||
86 | makeMenu(); | 86 | makeMenu(); |
87 | setCentralWidget( mainFrame ); | 87 | setCentralWidget( mainFrame ); |
88 | 88 | ||
89 | popupTimer = new QTimer(); | 89 | popupTimer = new QTimer(); |
90 | searchTimer = new QTimer(); | ||
90 | 91 | ||
91 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 92 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
93 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); | ||
92 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 94 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
93 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 95 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
94 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); | 96 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); |
95 | 97 | ||
96 | } | 98 | } |
97 | 99 | ||
98 | void MainWindow::makeMenu() | 100 | void MainWindow::makeMenu() |
99 | { | 101 | { |
100 | QPEToolBar *toolBar = new QPEToolBar( this ); | 102 | QPEToolBar *toolBar = new QPEToolBar( this ); |
101 | QPEToolBar *searchBar = new QPEToolBar(this); | 103 | QPEToolBar *searchBar = new QPEToolBar(this); |
102 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 104 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
103 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 105 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
104 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 106 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
105 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 107 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
106 | // | 108 | // |
107 | setToolBarsMovable( false ); | 109 | setToolBarsMovable( false ); |
108 | toolBar->setHorizontalStretchable( true ); | 110 | toolBar->setHorizontalStretchable( true ); |
109 | menuBar->insertItem( tr( "Search" ), searchMenu ); | 111 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
110 | // menuBar->insertItem( tr( "View" ), viewMenu ); | 112 | // menuBar->insertItem( tr( "View" ), viewMenu ); |
111 | // menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 113 | // menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
112 | 114 | ||
113 | //SEARCH | 115 | //SEARCH |
114 | QAction *action = new QAction( tr("Search all"),QString::null, 0, this, 0 ); | 116 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); |
115 | connect( action, SIGNAL(activated()), this, SLOT(searchAll()) ); | 117 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); |
116 | action->addTo( searchMenu ); | 118 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); |
119 | SearchAllAction->addTo( searchMenu ); | ||
117 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); | 120 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
118 | actionCaseSensitiv->addTo( searchMenu ); | 121 | actionCaseSensitiv->addTo( searchMenu ); |
119 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | 122 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); |
120 | actionWildcards->addTo( searchMenu ); | 123 | actionWildcards->addTo( searchMenu ); |
121 | 124 | ||
122 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 125 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
123 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 126 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
124 | searchBar->setHorizontalStretchable( TRUE ); | 127 | searchBar->setHorizontalStretchable( TRUE ); |
125 | searchBar->setStretchableWidget( searchEdit ); | 128 | searchBar->setStretchableWidget( searchEdit ); |
129 | SearchAllAction->addTo( searchBar ); | ||
126 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 130 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
127 | this, SLOT( setSearch( const QString & ) ) ); | 131 | this, SLOT( setSearch( const QString & ) ) ); |
128 | 132 | ||
129 | } | 133 | } |
130 | 134 | ||
131 | MainWindow::~MainWindow() | 135 | MainWindow::~MainWindow() |
132 | { | 136 | { |
133 | } | 137 | } |
134 | 138 | ||
135 | void MainWindow::setCurrent(QListViewItem *item) | 139 | void MainWindow::setCurrent(QListViewItem *item) |
136 | { | 140 | { |
137 | if (!item) return; | 141 | if (!item) return; |
138 | _currentItem = (OListViewItem*)item; | 142 | _currentItem = (OListViewItem*)item; |
139 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 143 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
140 | if (_currentItem->rtti() == OListViewItem::Result){ | 144 | if (_currentItem->rtti() == OListViewItem::Result){ |
141 | ResultItem *res = (ResultItem*)item; | 145 | ResultItem *res = (ResultItem*)item; |
142 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 146 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
143 | richEdit->setText( res->toRichText() ); | 147 | richEdit->setText( res->toRichText() ); |
144 | QIntDict<QString> acts = res->actions(); | 148 | QIntDict<QString> acts = res->actions(); |
145 | QButton *button; | 149 | QButton *button; |
146 | for (uint i = 0; i < acts.count(); i++){ | 150 | for (uint i = 0; i < acts.count(); i++){ |
147 | button = buttonGroupActions->find( i ); | 151 | button = buttonGroupActions->find( i ); |
148 | qDebug("action %i >%s<",i,acts[i]->latin1()); | 152 | qDebug("action %i >%s<",i,acts[i]->latin1()); |
149 | if (!button) { | 153 | if (!button) { |
150 | qDebug("BUTTON"); | 154 | qDebug("BUTTON"); |
151 | button = new QPushButton( detailsFrame ); | 155 | button = new QPushButton( detailsFrame ); |
152 | buttonLayout->addWidget( button, 0 ); | 156 | buttonLayout->addWidget( button, 0 ); |
153 | buttonGroupActions->insert( button, i); | 157 | buttonGroupActions->insert( button, i); |
154 | } | 158 | } |
155 | button->setText( *acts[i] ); | 159 | button->setText( *acts[i] ); |
156 | button->show(); | 160 | button->show(); |
157 | } | 161 | } |
158 | for (uint i = acts.count(); i < _buttonCount; i++){ | 162 | for (uint i = acts.count(); i < _buttonCount; i++){ |
159 | qDebug("remove button %i of %i",i, _buttonCount); | 163 | qDebug("remove button %i of %i",i, _buttonCount); |
160 | button = buttonGroupActions->find( i ); | 164 | button = buttonGroupActions->find( i ); |
161 | if (button) button->hide(); | 165 | if (button) button->hide(); |
162 | } | 166 | } |
163 | _buttonCount = acts.count(); | 167 | _buttonCount = acts.count(); |
164 | // buttonShow = new QPushButton( detailsFrame, "Show" ) ; | 168 | // buttonShow = new QPushButton( detailsFrame, "Show" ) ; |
165 | // buttonShow->setText( "test" ); | 169 | // buttonShow->setText( "test" ); |
166 | // buttonLayout->addWidget( buttonShow, 0 ); | 170 | // buttonLayout->addWidget( buttonShow, 0 ); |
167 | // buttonGroupActions->insert(buttonShow); | 171 | // buttonGroupActions->insert(buttonShow); |
168 | detailsFrame->show(); | 172 | detailsFrame->show(); |
169 | }else detailsFrame->hide(); | 173 | }else detailsFrame->hide(); |
170 | //_currentItem = (OListViewItem*)item; | 174 | //_currentItem = (OListViewItem*)item; |
171 | popupTimer->start( 300 ); | 175 | popupTimer->start( 300 ); |
172 | } | 176 | } |
173 | 177 | ||
174 | void MainWindow::stopTimer(QListViewItem*) | 178 | void MainWindow::stopTimer(QListViewItem*) |
175 | { | 179 | { |
176 | popupTimer->stop(); | 180 | popupTimer->stop(); |
177 | } | 181 | } |
178 | 182 | ||
179 | void MainWindow::showPopup() | 183 | void MainWindow::showPopup() |
180 | { | 184 | { |
181 | qDebug("showPopup"); | 185 | qDebug("showPopup"); |
182 | if (!_currentItem) return; | 186 | if (!_currentItem) return; |
183 | } | 187 | } |
184 | 188 | ||
185 | void MainWindow::setSearch( const QString &key ) | 189 | void MainWindow::setSearch( const QString &key ) |
186 | { | 190 | { |
187 | QRegExp re( key, actionCaseSensitiv->isOn(), actionWildcards->isOn() ); | 191 | searchTimer->stop(); |
192 | _searchString = key; | ||
193 | searchTimer->start( 300 ); | ||
194 | } | ||
195 | |||
196 | void MainWindow::searchStringChanged() | ||
197 | { | ||
198 | searchTimer->stop(); | ||
199 | QRegExp re( _searchString, actionCaseSensitiv->isOn(), actionWildcards->isOn() ); | ||
188 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) | 200 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
189 | s->setSearch( re ); | 201 | s->setSearch( re ); |
190 | } | 202 | } |
191 | 203 | ||
192 | void MainWindow::searchAll() | 204 | void MainWindow::searchAll() |
193 | { | 205 | { |
194 | bool openState; | ||
195 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 206 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
196 | s->doSearch(); | 207 | s->doSearch(); |
208 | //resultsList->repaint(); | ||
197 | } | 209 | } |
198 | } | 210 | } |
199 | 211 | ||
200 | void MainWindow::slotAction( int act) | 212 | void MainWindow::slotAction( int act) |
201 | { | 213 | { |
202 | if (_currentItem->rtti() == OListViewItem::Result){ | 214 | if (_currentItem->rtti() == OListViewItem::Result){ |
203 | ResultItem *res = (ResultItem*)_currentItem; | 215 | ResultItem *res = (ResultItem*)_currentItem; |
204 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 216 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
205 | res->action(act); | 217 | res->action(act); |
206 | } | 218 | } |
207 | } | 219 | } |
208 | 220 | ||
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index 2773205..939762e 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -1,72 +1,76 @@ | |||
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 | #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 | #include <qtimer.h> | 19 | #include <qtimer.h> |
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | 21 | ||
22 | class QPEToolBar; | 22 | class QPEToolBar; |
23 | class QVBoxLayout; | 23 | class QVBoxLayout; |
24 | class QHBoxLayout; | 24 | class QHBoxLayout; |
25 | class QTextView; | 25 | class QTextView; |
26 | class QFrame; | 26 | class QFrame; |
27 | class QListViewItem; | 27 | class QListViewItem; |
28 | class OListView; | 28 | class OListView; |
29 | class OListViewItem; | 29 | class OListViewItem; |
30 | class QHButtonGroup; | 30 | class QHButtonGroup; |
31 | 31 | ||
32 | class SearchGroup; | 32 | class SearchGroup; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | 38 | ||
39 | public: | 39 | public: |
40 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 40 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
41 | ~MainWindow(); | 41 | ~MainWindow(); |
42 | 42 | ||
43 | 43 | ||
44 | public slots: | 44 | public slots: |
45 | void setCurrent(QListViewItem*); | 45 | void setCurrent(QListViewItem*); |
46 | void showPopup(); | ||
47 | void stopTimer( QListViewItem* ); | ||
48 | void setSearch( const QString& ); | 46 | void setSearch( const QString& ); |
49 | void searchAll(); | 47 | void searchAll(); |
50 | 48 | ||
51 | protected slots: | 49 | protected slots: |
52 | void slotAction(int); | 50 | void slotAction(int); |
53 | 51 | void showPopup(); | |
52 | void stopTimer( QListViewItem* ); | ||
53 | void searchStringChanged(); | ||
54 | |||
54 | private: | 55 | private: |
55 | OListView *resultsList; | 56 | OListView *resultsList; |
56 | QTextView *richEdit; | 57 | QTextView *richEdit; |
57 | OListViewItem *_currentItem; | 58 | OListViewItem *_currentItem; |
58 | QVBoxLayout *mainLayout; | 59 | QVBoxLayout *mainLayout; |
59 | QHBoxLayout *buttonLayout; | 60 | QHBoxLayout *buttonLayout; |
60 | QFrame *detailsFrame; | 61 | QFrame *detailsFrame; |
61 | QTimer *popupTimer; | 62 | QTimer *popupTimer; |
63 | QTimer *searchTimer; | ||
62 | 64 | ||
65 | QString _searchString; | ||
63 | QList<SearchGroup> searches; | 66 | QList<SearchGroup> searches; |
64 | QHButtonGroup *buttonGroupActions; | 67 | QHButtonGroup *buttonGroupActions; |
68 | QAction *SearchAllAction; | ||
65 | QAction *actionCaseSensitiv; | 69 | QAction *actionCaseSensitiv; |
66 | QAction *actionWildcards; | 70 | QAction *actionWildcards; |
67 | uint _buttonCount; | 71 | uint _buttonCount; |
68 | void makeMenu(); | 72 | void makeMenu(); |
69 | }; | 73 | }; |
70 | 74 | ||
71 | #endif | 75 | #endif |
72 | 76 | ||
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp index 3159984..490deea 100644 --- a/core/pim/osearch/searchgroup.cpp +++ b/core/pim/osearch/searchgroup.cpp | |||
@@ -1,74 +1,87 @@ | |||
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 "searchgroup.h" | 13 | #include "searchgroup.h" |
14 | 14 | ||
15 | #include <qregexp.h> | 15 | #include <qregexp.h> |
16 | // #include <qapplication.h> | ||
17 | // #include <opie/owait.h> | ||
16 | 18 | ||
17 | #include "olistviewitem.h" | 19 | #include "olistviewitem.h" |
18 | 20 | ||
19 | SearchGroup::SearchGroup(QListView* parent, QString name) | 21 | SearchGroup::SearchGroup(QListView* parent, QString name) |
20 | : OListViewItem(parent, name) | 22 | : OListViewItem(parent, name) |
21 | { | 23 | { |
22 | _name = name; | 24 | _name = name; |
23 | loaded = false; | 25 | loaded = false; |
24 | expanded = false; | ||
25 | } | 26 | } |
26 | 27 | ||
27 | 28 | ||
28 | SearchGroup::~SearchGroup() | 29 | SearchGroup::~SearchGroup() |
29 | { | 30 | { |
30 | } | 31 | } |
31 | 32 | ||
32 | 33 | ||
33 | void SearchGroup::expand() | 34 | void SearchGroup::expand() |
34 | { | 35 | { |
36 | //expanded = true; | ||
35 | clearList(); | 37 | clearList(); |
36 | if (_search.isEmpty()) return; | 38 | if (_search.isEmpty()) return; |
37 | OListViewItem *dummy = new OListViewItem( this, "searching..."); | 39 | OListViewItem *dummy = new OListViewItem( this, "searching..."); |
38 | setOpen( expanded ); | 40 | setOpen( true ); |
39 | if (!loaded) load(); | 41 | repaint(); |
40 | int res_count = search(); | 42 | int res_count = realSearch(); |
41 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | 43 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); |
42 | delete dummy; | 44 | delete dummy; |
45 | repaint(); | ||
43 | } | 46 | } |
44 | 47 | ||
45 | void SearchGroup::doSearch() | 48 | void SearchGroup::doSearch() |
46 | { | 49 | { |
47 | clearList(); | 50 | clearList(); |
48 | if (_search.isEmpty()) return; | 51 | if (_search.isEmpty()) return; |
49 | if (!loaded) load(); | 52 | int res_count = realSearch(); |
50 | int res_count = search(); | ||
51 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | 53 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); |
54 | //repaint(); | ||
52 | } | 55 | } |
53 | 56 | ||
54 | void SearchGroup::clearList() | 57 | void SearchGroup::clearList() |
55 | { | 58 | { |
56 | QListViewItem *item = firstChild(); | 59 | QListViewItem *item = firstChild(); |
57 | QListViewItem *toDel; | 60 | QListViewItem *toDel; |
58 | |||
59 | while ( item != 0 ) { | 61 | while ( item != 0 ) { |
60 | toDel = item; | 62 | toDel = item; |
61 | item = item->nextSibling(); | 63 | item = item->nextSibling(); |
62 | delete toDel; | 64 | delete toDel; |
63 | } | 65 | } |
64 | expanded = true; | ||
65 | } | 66 | } |
66 | 67 | ||
67 | void SearchGroup::setSearch(QRegExp re) | 68 | void SearchGroup::setSearch(QRegExp re) |
68 | { | 69 | { |
69 | setText(0, _name+" - "+re.pattern() ); | 70 | setText(0, _name+" - "+re.pattern() ); |
70 | _search = re; | 71 | _search = re; |
71 | if (expanded) expand(); | 72 | if (isOpen()) expand(); |
72 | else new OListViewItem( this, "searching..."); | 73 | else new OListViewItem( this, "searching..."); |
73 | } | 74 | } |
74 | 75 | ||
76 | int SearchGroup::realSearch() | ||
77 | { | ||
78 | //emit isSearching( tr(" Searching for %s in %s" ).arg( _search.pattern().latin1()).arg( _name ) ); | ||
79 | /*OWait *wait = new OWait( qApp->mainWidget(), "test" ); | ||
80 | wait->show();*/ | ||
81 | if (!loaded) load(); | ||
82 | int count = search(); | ||
83 | /*wait->hide(); | ||
84 | delete wait;*/ | ||
85 | return count; | ||
86 | } | ||
87 | |||
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h index bf5dc67..32f32e0 100644 --- a/core/pim/osearch/searchgroup.h +++ b/core/pim/osearch/searchgroup.h | |||
@@ -1,46 +1,51 @@ | |||
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 SEARCHGROUP_H | 13 | #ifndef SEARCHGROUP_H |
14 | #define SEARCHGROUP_H | 14 | #define SEARCHGROUP_H |
15 | 15 | ||
16 | #include "olistviewitem.h" | 16 | #include "olistviewitem.h" |
17 | 17 | ||
18 | class QRegExp; | 18 | class QRegExp; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | @author Patrick S. Vogt | 21 | @author Patrick S. Vogt |
22 | */ | 22 | */ |
23 | class SearchGroup : public OListViewItem | 23 | class SearchGroup : public OListViewItem //, QObject |
24 | { | 24 | { |
25 | //Q_OBJECT | ||
25 | public: | 26 | public: |
26 | SearchGroup(QListView* parent, QString name); | 27 | SearchGroup(QListView* parent, QString name); |
27 | 28 | ||
28 | ~SearchGroup(); | 29 | ~SearchGroup(); |
29 | 30 | ||
30 | virtual void expand(); | 31 | virtual void expand(); |
31 | virtual void doSearch(); | 32 | virtual void doSearch(); |
32 | virtual void setSearch(QRegExp); | 33 | virtual void setSearch(QRegExp); |
33 | virtual int rtti() { return Searchgroup;} | 34 | virtual int rtti() { return Searchgroup;} |
34 | 35 | ||
36 | // signals: | ||
37 | // isSearching(QString); | ||
38 | |||
35 | protected: | 39 | protected: |
36 | QRegExp _search; | 40 | QRegExp _search; |
37 | virtual void load() = 0; | 41 | virtual void load() = 0; |
38 | virtual int search() = 0; | 42 | virtual int search() = 0; |
39 | virtual void insertItem( void* ) = 0; | 43 | virtual void insertItem( void* ) = 0; |
40 | void clearList(); | 44 | void clearList(); |
41 | QString _name; | 45 | QString _name; |
42 | bool expanded; | ||
43 | bool loaded; | 46 | bool loaded; |
47 | private: | ||
48 | int realSearch(); | ||
44 | }; | 49 | }; |
45 | 50 | ||
46 | #endif | 51 | #endif |
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 6a73530..c9fa61a 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -1,50 +1,55 @@ | |||
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 | 14 | ||
15 | #include <opie/otodoaccess.h> | 15 | #include <opie/otodoaccess.h> |
16 | #include <opie/otodo.h> | 16 | #include <opie/otodo.h> |
17 | 17 | #include <qiconset.h> | |
18 | #include <qpe/resource.h> | ||
18 | #include "todoitem.h" | 19 | #include "todoitem.h" |
19 | 20 | ||
20 | TodoSearch::TodoSearch(QListView* parent, QString name) | 21 | TodoSearch::TodoSearch(QListView* parent, QString name) |
21 | : SearchGroup(parent, name) | 22 | : SearchGroup(parent, name) |
22 | { | 23 | { |
23 | _todos = 0; | 24 | _todos = 0; |
25 | //AppLnkSet als(QPEApplication::qpeDir()); | ||
26 | //setPixmap( 0, als.findExec("todolist")->pixmap() ); | ||
27 | QIconSet is = Resource::loadIconSet( "todo/TodoList" ); | ||
28 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | ||
24 | } | 29 | } |
25 | 30 | ||
26 | 31 | ||
27 | TodoSearch::~TodoSearch() | 32 | TodoSearch::~TodoSearch() |
28 | { | 33 | { |
29 | delete _todos; | 34 | delete _todos; |
30 | } | 35 | } |
31 | 36 | ||
32 | 37 | ||
33 | void TodoSearch::load() | 38 | void TodoSearch::load() |
34 | { | 39 | { |
35 | _todos = new OTodoAccess(); | 40 | _todos = new OTodoAccess(); |
36 | _todos->load(); | 41 | _todos->load(); |
37 | } | 42 | } |
38 | 43 | ||
39 | int TodoSearch::search() | 44 | int TodoSearch::search() |
40 | { | 45 | { |
41 | ORecordList<OTodo> results = _todos->matchRegexp(_search); | 46 | ORecordList<OTodo> results = _todos->matchRegexp(_search); |
42 | for (uint i = 0; i < results.count(); i++) | 47 | for (uint i = 0; i < results.count(); i++) |
43 | new TodoItem( this, new OTodo( results[i] )); | 48 | new TodoItem( this, new OTodo( results[i] )); |
44 | return results.count(); | 49 | return results.count(); |
45 | } | 50 | } |
46 | 51 | ||
47 | void TodoSearch::insertItem( void* ) | 52 | void TodoSearch::insertItem( void* ) |
48 | { | 53 | { |
49 | 54 | ||
50 | } | 55 | } |