author | tille <tille> | 2003-05-17 10:38:52 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-17 10:38:52 (UTC) |
commit | cdf3ec6993eebb80c96258c1bb217594ea442544 (patch) (unidiff) | |
tree | e0323d8011928c11aecc747535fcf8ae521d70c3 /core/pim | |
parent | f6c30fa4d0e97b0256a7b40554f70b5c08895d80 (diff) | |
download | opie-cdf3ec6993eebb80c96258c1bb217594ea442544.zip opie-cdf3ec6993eebb80c96258c1bb217594ea442544.tar.gz opie-cdf3ec6993eebb80c96258c1bb217594ea442544.tar.bz2 |
(layout) fixes from zecke (for 0.99)
and some minor things...
-rw-r--r-- | core/pim/osearch/adresssearch.cpp | 5 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/eventitem.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 39 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 20 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.h | 2 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 2 |
9 files changed, 45 insertions, 31 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index 2cd545f..f117fe6 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.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 "adresssearch.h" | 13 | #include "adresssearch.h" |
14 | 14 | ||
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qiconset.h> | 16 | #include <qiconset.h> |
17 | #include <qwhatsthis.h> | 17 | //#include <qwhatsthis.h> |
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | #include <opie/ocontactaccess.h> | 19 | #include <opie/ocontactaccess.h> |
20 | 20 | ||
21 | #include "contactitem.h" | 21 | #include "contactitem.h" |
22 | 22 | ||
23 | AdressSearch::AdressSearch(QListView* parent, QString name): | 23 | AdressSearch::AdressSearch(QListView* parent, QString name): |
24 | SearchGroup(parent, name) | 24 | SearchGroup(parent, name) |
25 | { | 25 | { |
26 | _contacts = 0; | 26 | _contacts = 0; |
27 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); | 27 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); |
28 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | 28 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); |
29 | //QWhatsThis::add( this, QObject::tr("Search the addressbook") ); | ||
29 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); | 30 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); |
30 | QImage img = pix.convertToImage(); | 31 | QImage img = pix.convertToImage(); |
31 | img.smoothScale( 14, 14 ); | 32 | img.smoothScale( 14, 14 ); |
32 | pix.convertFromImage( img ); | 33 | pix.convertFromImage( img ); |
33 | setPixmap( 0, pix );*/ | 34 | setPixmap( 0, pix );*/ |
34 | } | 35 | } |
35 | 36 | ||
36 | 37 | ||
37 | AdressSearch::~AdressSearch() | 38 | AdressSearch::~AdressSearch() |
38 | { | 39 | { |
39 | delete _contacts; | 40 | delete _contacts; |
40 | } | 41 | } |
41 | 42 | ||
42 | void AdressSearch::load() | 43 | void AdressSearch::load() |
43 | { | 44 | { |
44 | _contacts = new OContactAccess("osearch"); | 45 | _contacts = new OContactAccess("osearch"); |
45 | } | 46 | } |
46 | 47 | ||
47 | int AdressSearch::search() | 48 | int AdressSearch::search() |
48 | { | 49 | { |
49 | ORecordList<OContact> results = _contacts->matchRegexp(_search); | 50 | ORecordList<OContact> results = _contacts->matchRegexp(_search); |
50 | for (uint i = 0; i < results.count(); i++) { | 51 | for (uint i = 0; i < results.count(); i++) { |
51 | new ContactItem( this, new OContact( results[i] )); | 52 | (void)new ContactItem( this, new OContact( results[i] )); |
52 | } | 53 | } |
53 | return results.count(); | 54 | return results.count(); |
54 | } | 55 | } |
55 | 56 | ||
56 | void AdressSearch::insertItem( void* ) | 57 | void AdressSearch::insertItem( void* ) |
57 | { | 58 | { |
58 | 59 | ||
59 | } | 60 | } |
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp index 403c719..b15275a 100644 --- a/core/pim/osearch/applnksearch.cpp +++ b/core/pim/osearch/applnksearch.cpp | |||
@@ -36,34 +36,34 @@ AppLnkSearch::~AppLnkSearch() | |||
36 | 36 | ||
37 | void AppLnkSearch::load() | 37 | void AppLnkSearch::load() |
38 | { | 38 | { |
39 | _apps = new AppLnkSet(QPEApplication::qpeDir()); | 39 | _apps = new AppLnkSet(QPEApplication::qpeDir()); |
40 | } | 40 | } |
41 | 41 | ||
42 | int AppLnkSearch::search() | 42 | int AppLnkSearch::search() |
43 | { | 43 | { |
44 | QList<AppLnk> appList = _apps->children(); | 44 | QList<AppLnk> appList = _apps->children(); |
45 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ | 45 | for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ |
46 | if ( (_search.match( app->name() ) != -1) | 46 | if ( (_search.match( app->name() ) != -1) |
47 | || (_search.match(app->comment()) != -1) | 47 | || (_search.match(app->comment()) != -1) |
48 | || (_search.match(app->exec()) != -1) ) { | 48 | || (_search.match(app->exec()) != -1) ) { |
49 | insertItem( app ); | 49 | insertItem( app ); |
50 | }else | 50 | }else |
51 | if (searchFile( app )) | 51 | if (searchFile( app )) |
52 | insertItem( app ); | 52 | insertItem( app ); |
53 | qApp->processEvents( 100 ); | 53 | qApp->processEvents( 100 ); |
54 | } | 54 | } |
55 | return _resultCount; | 55 | return _resultCount; |
56 | } | 56 | } |
57 | 57 | ||
58 | void AppLnkSearch::insertItem( void *rec ) | 58 | void AppLnkSearch::insertItem( void *rec ) |
59 | { | 59 | { |
60 | new AppLnkItem( this, (AppLnk*)rec ); | 60 | (void)new AppLnkItem( this, (AppLnk*)rec ); |
61 | _resultCount++; | 61 | _resultCount++; |
62 | } | 62 | } |
63 | 63 | ||
64 | void AppLnkSearch::setSearch(QRegExp re) | 64 | void AppLnkSearch::setSearch(QRegExp re) |
65 | { | 65 | { |
66 | setOpen( false ); | 66 | setOpen( false ); |
67 | SearchGroup::setSearch( re ); | 67 | SearchGroup::setSearch( re ); |
68 | } | 68 | } |
69 | 69 | ||
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 5da7ae9..be2bf25 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -55,38 +55,38 @@ void DatebookSearch::load() | |||
55 | { | 55 | { |
56 | _dates = new ODateBookAccess(); | 56 | _dates = new ODateBookAccess(); |
57 | _dates->load(); | 57 | _dates->load(); |
58 | } | 58 | } |
59 | 59 | ||
60 | int DatebookSearch::search() | 60 | int DatebookSearch::search() |
61 | { | 61 | { |
62 | ORecordList<OEvent> results = _dates->matchRegexp(_search); | 62 | ORecordList<OEvent> results = _dates->matchRegexp(_search); |
63 | for (uint i = 0; i < results.count(); i++) | 63 | for (uint i = 0; i < results.count(); i++) |
64 | insertItem( new OEvent( results[i] ) ); | 64 | insertItem( new OEvent( results[i] ) ); |
65 | return _resultCount; | 65 | return _resultCount; |
66 | } | 66 | } |
67 | 67 | ||
68 | void DatebookSearch::insertItem( void *rec ) | 68 | void DatebookSearch::insertItem( void *rec ) |
69 | { | 69 | { |
70 | OEvent *ev = (OEvent*)rec; | 70 | OEvent *ev = (OEvent*)rec; |
71 | if ( !actionShowPastEvents->isOn() && | 71 | if ( !actionShowPastEvents->isOn() && |
72 | ev->endDateTime() < QDateTime::currentDateTime() && | 72 | ev->endDateTime() < QDateTime::currentDateTime() && |
73 | !ev->recurrence().doesRecur() | 73 | !ev->recurrence().doesRecur() |
74 | ) return; | 74 | ) return; |
75 | if ( !actionSearchInDates->isOn() && ( | 75 | if ( !actionSearchInDates->isOn() && ( |
76 | ev->lastHitField() == Qtopia::StartDateTime || | 76 | ev->lastHitField() == Qtopia::StartDateTime || |
77 | ev->lastHitField() == Qtopia::EndDateTime ) | 77 | ev->lastHitField() == Qtopia::EndDateTime ) |
78 | ) return; | 78 | ) return; |
79 | new EventItem( this, ev ); | 79 | (void)new EventItem( this, ev ); |
80 | _resultCount++; | 80 | _resultCount++; |
81 | } | 81 | } |
82 | 82 | ||
83 | QPopupMenu* DatebookSearch::popupMenu() | 83 | QPopupMenu* DatebookSearch::popupMenu() |
84 | { | 84 | { |
85 | if (!_popupMenu){ | 85 | if (!_popupMenu){ |
86 | _popupMenu = new QPopupMenu( 0 ); | 86 | _popupMenu = new QPopupMenu( 0 ); |
87 | actionShowPastEvents->addTo( _popupMenu ); | 87 | actionShowPastEvents->addTo( _popupMenu ); |
88 | actionSearchInDates->addTo( _popupMenu ); | 88 | actionSearchInDates->addTo( _popupMenu ); |
89 | } | 89 | } |
90 | return _popupMenu; | 90 | return _popupMenu; |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index 321d011..3428798 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp | |||
@@ -55,37 +55,37 @@ bool DocLnkSearch::searchFile( AppLnk *app ) | |||
55 | if (!actionSearchInFiles->isOn()) return false; | 55 | if (!actionSearchInFiles->isOn()) return false; |
56 | DocLnk *doc = (DocLnk*)app; | 56 | DocLnk *doc = (DocLnk*)app; |
57 | bool found = false; | 57 | bool found = false; |
58 | if ( doc->type().contains( "text" ) ){ | 58 | if ( doc->type().contains( "text" ) ){ |
59 | #ifdef NEW_OWAIT | 59 | #ifdef NEW_OWAIT |
60 | QString ouput = QObject::tr("searching %1").arg(doc->file()); | 60 | QString ouput = QObject::tr("searching %1").arg(doc->file()); |
61 | OWait( output ); | 61 | OWait( output ); |
62 | #endif | 62 | #endif |
63 | QFile f(doc->file()); | 63 | QFile f(doc->file()); |
64 | if ( f.open(IO_ReadOnly) ) { | 64 | if ( f.open(IO_ReadOnly) ) { |
65 | QTextStream t( &f ); | 65 | QTextStream t( &f ); |
66 | while ( !t.eof() ) | 66 | while ( !t.eof() ) |
67 | if (_search.match( t.readLine()) != -1) { | 67 | if (_search.match( t.readLine()) != -1) { |
68 | found = true; | 68 | found = true; |
69 | break; | 69 | break; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | f.close(); | 72 | f.close(); |
73 | } | 73 | } |
74 | return found; | 74 | return found; |
75 | } | 75 | } |
76 | 76 | ||
77 | void DocLnkSearch::insertItem( void *rec ) | 77 | void DocLnkSearch::insertItem( void *rec ) |
78 | { | 78 | { |
79 | new DocLnkItem( this, (DocLnk*)rec ); | 79 | (void)new DocLnkItem( this, (DocLnk*)rec ); |
80 | _resultCount++; | 80 | _resultCount++; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | QPopupMenu* DocLnkSearch::popupMenu() | 84 | QPopupMenu* DocLnkSearch::popupMenu() |
85 | { | 85 | { |
86 | if (!_popupMenu){ | 86 | if (!_popupMenu){ |
87 | _popupMenu = new QPopupMenu( 0 ); | 87 | _popupMenu = new QPopupMenu( 0 ); |
88 | actionSearchInFiles->addTo( _popupMenu ); | 88 | actionSearchInFiles->addTo( _popupMenu ); |
89 | } | 89 | } |
90 | return _popupMenu; | 90 | return _popupMenu; |
91 | } | 91 | } |
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp index 24ce8e8..3228093 100644 --- a/core/pim/osearch/eventitem.cpp +++ b/core/pim/osearch/eventitem.cpp | |||
@@ -1,84 +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 | #include <qdatetime.h> |
16 | #include <qpixmap.h> | 16 | #include <qpixmap.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | //#include <qwhatsthis.h> | ||
19 | #include <opie/oevent.h> | 20 | #include <opie/oevent.h> |
20 | 21 | ||
21 | EventItem::EventItem(OListViewItem* parent, OEvent *event) | 22 | EventItem::EventItem(OListViewItem* parent, OEvent *event) |
22 | : ResultItem(parent) | 23 | : ResultItem(parent) |
23 | { | 24 | { |
24 | _event = event; | 25 | _event = event; |
25 | setText(0, _event->toShortText() ); | 26 | setText(0, _event->toShortText() ); |
26 | setIcon(); | 27 | setIcon(); |
27 | } | 28 | } |
28 | 29 | ||
29 | 30 | ||
30 | EventItem::~EventItem() | 31 | EventItem::~EventItem() |
31 | { | 32 | { |
32 | } | 33 | } |
33 | 34 | ||
34 | 35 | ||
35 | QString EventItem::toRichText() | 36 | QString EventItem::toRichText() |
36 | { | 37 | { |
37 | return _event->toRichText(); | 38 | return _event->toRichText(); |
38 | } | 39 | } |
39 | 40 | ||
40 | void EventItem::action( int act ) | 41 | void EventItem::action( int act ) |
41 | { | 42 | { |
42 | if (act == 0){ | 43 | if (act == 0){ |
43 | QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); | 44 | QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); |
44 | e << _event->startDateTime().date(); | 45 | e << _event->startDateTime().date(); |
45 | }else if(act == 1){ | 46 | }else if(act == 1){ |
46 | QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); | 47 | QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); |
47 | e << _event->uid(); | 48 | e << _event->uid(); |
48 | } | 49 | } |
49 | } | 50 | } |
50 | 51 | ||
51 | QIntDict<QString> EventItem::actions() | 52 | QIntDict<QString> EventItem::actions() |
52 | { | 53 | { |
53 | QIntDict<QString> result; | 54 | QIntDict<QString> result; |
54 | result.insert( 0, new QString( QObject::tr("show") ) ); | 55 | result.insert( 0, new QString( QObject::tr("show") ) ); |
55 | result.insert( 1, new QString( QObject::tr("edit") ) ); | 56 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
56 | return result; | 57 | return result; |
57 | } | 58 | } |
58 | 59 | ||
59 | void EventItem::setIcon() | 60 | void EventItem::setIcon() |
60 | { | 61 | { |
61 | QPixmap icon; | 62 | QPixmap icon; |
62 | switch ( _event->lastHitField() ) { | 63 | switch ( _event->lastHitField() ) { |
63 | case -1: | 64 | case -1: |
64 | icon = Resource::loadPixmap( "reset" ); | 65 | icon = Resource::loadPixmap( "reset" ); |
66 | // QWhatsThis::add( icon, QObject::tr("Enter your search terms here") ); | ||
65 | break; | 67 | break; |
66 | case Qtopia::DatebookDescription: | 68 | case Qtopia::DatebookDescription: |
67 | icon = Resource::loadPixmap( "osearch/summary" ); | 69 | icon = Resource::loadPixmap( "osearch/summary" ); |
68 | break; | 70 | break; |
69 | case Qtopia::Notes: | 71 | case Qtopia::Notes: |
70 | icon = Resource::loadPixmap( "txt" ); | 72 | icon = Resource::loadPixmap( "txt" ); |
71 | break; | 73 | break; |
72 | case Qtopia::Location: | 74 | case Qtopia::Location: |
73 | icon = Resource::loadPixmap( "home" ); | 75 | icon = Resource::loadPixmap( "home" ); |
74 | break; | 76 | break; |
75 | case Qtopia::StartDateTime: | 77 | case Qtopia::StartDateTime: |
76 | case Qtopia::EndDateTime: | 78 | case Qtopia::EndDateTime: |
77 | icon = Resource::loadPixmap( "osearch/clock" ); | 79 | icon = Resource::loadPixmap( "osearch/clock" ); |
78 | break; | 80 | break; |
79 | default: | 81 | default: |
80 | icon = Resource::loadPixmap( "DocsIcon" ); | 82 | icon = Resource::loadPixmap( "DocsIcon" ); |
81 | break; | 83 | break; |
82 | } | 84 | } |
83 | setPixmap( 0, icon ); | 85 | setPixmap( 0, icon ); |
84 | } | 86 | } |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index c6934db..aa52061 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -1,123 +1,127 @@ | |||
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 | 13 | ||
14 | #include <qaction.h> | 14 | #include <qaction.h> |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
17 | #include <qtoolbutton.h> | 17 | #include <qtoolbutton.h> |
18 | #include <qstring.h> | 18 | #include <qstring.h> |
19 | #include <qlabel.h> | 19 | #include <qlabel.h> |
20 | #include <qfile.h> | 20 | #include <qfile.h> |
21 | #include <qhbuttongroup.h> | 21 | #include <qhbuttongroup.h> |
22 | #include <qhbox.h> | ||
22 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
23 | #include <qintdict.h> | 24 | #include <qintdict.h> |
24 | #include <qlayout.h> | 25 | #include <qlayout.h> |
25 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qsignalmapper.h> | ||
26 | #include <qtextbrowser.h> | 28 | #include <qtextbrowser.h> |
27 | #include <qregexp.h> | 29 | #include <qregexp.h> |
28 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
29 | #include <qpe/qpemenubar.h> | 31 | #include <qpe/qpemenubar.h> |
30 | #include <qpe/qpemessagebox.h> | 32 | #include <qpe/qpemessagebox.h> |
31 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
32 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
33 | #include <qpe/qpetoolbar.h> | 35 | #include <qpe/qpetoolbar.h> |
34 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
36 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
37 | #include <opie/owait.h> | 39 | #include <opie/owait.h> |
38 | 40 | ||
39 | #include "olistview.h" | 41 | #include "olistview.h" |
40 | #include "olistviewitem.h" | 42 | #include "olistviewitem.h" |
41 | #include "resultitem.h" | 43 | #include "resultitem.h" |
42 | #include "adresssearch.h" | 44 | #include "adresssearch.h" |
43 | #include "todosearch.h" | 45 | #include "todosearch.h" |
44 | #include "datebooksearch.h" | 46 | #include "datebooksearch.h" |
45 | #include "applnksearch.h" | 47 | #include "applnksearch.h" |
46 | #include "doclnksearch.h" | 48 | #include "doclnksearch.h" |
47 | #include "mainwindow.h" | 49 | #include "mainwindow.h" |
48 | 50 | ||
49 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 51 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
50 | QMainWindow( parent, name, f ), _currentItem(0) | 52 | QMainWindow( parent, name, f ), _currentItem(0) |
51 | { | 53 | { |
52 | setCaption( tr("OSearch") ); | 54 | setCaption( tr("OSearch") ); |
53 | 55 | ||
54 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 56 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
55 | 57 | ||
56 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 58 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
57 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 59 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
58 | 60 | ||
59 | mainLayout = new QVBoxLayout( mainFrame ); | 61 | mainLayout = new QVBoxLayout( mainFrame ); |
60 | mainLayout->setSpacing( 0 ); | 62 | mainLayout->setSpacing( 0 ); |
61 | mainLayout->setMargin( 0 ); | 63 | mainLayout->setMargin( 0 ); |
62 | 64 | ||
63 | resultsList = new OListView( mainFrame ); | 65 | resultsList = new OListView( mainFrame ); |
64 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 66 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
65 | mainLayout->addWidget( resultsList ); | 67 | mainLayout->addWidget( resultsList ); |
66 | 68 | ||
67 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 69 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
68 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 70 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
69 | richEdit = new QTextView( detailsFrame ); | 71 | richEdit = new QTextView( detailsFrame ); |
70 | QWhatsThis::add( richEdit, tr("The details of the current result") ); | 72 | QWhatsThis::add( richEdit, tr("The details of the current result") ); |
71 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 73 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
72 | detailsLayout->addWidget( richEdit ); | 74 | detailsLayout->addWidget( richEdit ); |
73 | 75 | ||
74 | buttonGroupActions = new QHButtonGroup( this ); | 76 | buttonBox = new QHBox( mainFrame, "Button Box" ); |
75 | buttonGroupActions->hide(); | ||
76 | _buttonCount = 0; | ||
77 | 77 | ||
78 | buttonLayout = new QHBoxLayout( detailsFrame ); | 78 | _buttonCount = 0; |
79 | detailsLayout->addLayout( buttonLayout ); | ||
80 | 79 | ||
81 | mainLayout->addWidget( detailsFrame ); | 80 | mainLayout->addWidget( detailsFrame ); |
81 | mainLayout->addWidget( buttonBox ); | ||
82 | detailsFrame->hide(); | 82 | detailsFrame->hide(); |
83 | buttonBox->hide(); | ||
83 | 84 | ||
84 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); | 85 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); |
85 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); | 86 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); |
86 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); | 87 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); |
87 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); | 88 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); |
88 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); | 89 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); |
89 | 90 | ||
90 | setCentralWidget( mainFrame ); | 91 | setCentralWidget( mainFrame ); |
91 | 92 | ||
92 | popupTimer = new QTimer(); | 93 | popupTimer = new QTimer(); |
93 | searchTimer = new QTimer(); | 94 | searchTimer = new QTimer(); |
94 | 95 | ||
95 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 96 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
96 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); | 97 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); |
97 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 98 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
98 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 99 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
99 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); | 100 | |
101 | signalMapper = new QSignalMapper( this ); | ||
102 | |||
103 | connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); | ||
100 | 104 | ||
101 | makeMenu(); | 105 | makeMenu(); |
102 | 106 | ||
103 | Config cfg( "osearch", Config::User ); | 107 | Config cfg( "osearch", Config::User ); |
104 | cfg.setGroup( "search_settings" ); | 108 | cfg.setGroup( "search_settings" ); |
105 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); | 109 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); |
106 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); | 110 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); |
107 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); | 111 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); |
108 | } | 112 | } |
109 | 113 | ||
110 | void MainWindow::makeMenu() | 114 | void MainWindow::makeMenu() |
111 | { | 115 | { |
112 | QPEToolBar *toolBar = new QPEToolBar( this ); | 116 | QPEToolBar *toolBar = new QPEToolBar( this ); |
113 | QPEToolBar *searchBar = new QPEToolBar(this); | 117 | QPEToolBar *searchBar = new QPEToolBar(this); |
114 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 118 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
115 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 119 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
116 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 120 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
117 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 121 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
118 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); | 122 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); |
119 | 123 | ||
120 | setToolBarsMovable( false ); | 124 | setToolBarsMovable( false ); |
121 | toolBar->setHorizontalStretchable( true ); | 125 | toolBar->setHorizontalStretchable( true ); |
122 | menuBar->insertItem( tr( "Search" ), searchMenu ); | 126 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
123 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 127 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
@@ -162,64 +166,71 @@ void MainWindow::makeMenu() | |||
162 | 166 | ||
163 | } | 167 | } |
164 | 168 | ||
165 | MainWindow::~MainWindow() | 169 | MainWindow::~MainWindow() |
166 | { | 170 | { |
167 | Config cfg( "osearch", Config::User ); | 171 | Config cfg( "osearch", Config::User ); |
168 | cfg.setGroup( "search_settings" ); | 172 | cfg.setGroup( "search_settings" ); |
169 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); | 173 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); |
170 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); | 174 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); |
171 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); | 175 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); |
172 | } | 176 | } |
173 | 177 | ||
174 | void MainWindow::setCurrent(QListViewItem *item) | 178 | void MainWindow::setCurrent(QListViewItem *item) |
175 | { | 179 | { |
176 | if (!item) return; | 180 | if (!item) return; |
177 | _currentItem = (OListViewItem*)item; | 181 | _currentItem = (OListViewItem*)item; |
178 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 182 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
179 | if (_currentItem->rtti() == OListViewItem::Result){ | 183 | if (_currentItem->rtti() == OListViewItem::Result){ |
180 | ResultItem *res = (ResultItem*)item; | 184 | ResultItem *res = (ResultItem*)item; |
181 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 185 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
182 | richEdit->setText( res->toRichText() ); | 186 | richEdit->setText( res->toRichText() ); |
183 | QIntDict<QString> acts = res->actions(); | 187 | QIntDict<QString> acts = res->actions(); |
184 | QButton *button; | 188 | QButton *button; |
185 | for (uint i = 0; i < acts.count(); i++){ | 189 | for (uint i = 0; i < acts.count(); i++){ |
186 | button = buttonGroupActions->find( i ); | 190 | button = buttonMap[i]; |
187 | if (!button) { | 191 | if (!button) { |
188 | button = new QPushButton( detailsFrame ); | 192 | qWarning(" no button for %s", (*acts[i]).latin1() ); |
189 | buttonLayout->addWidget( button, 0 ); | 193 | button = new QPushButton( buttonBox ); |
190 | buttonGroupActions->insert( button, i); | 194 | buttonMap.insert( i, button ); |
195 | signalMapper->setMapping(button, i ); | ||
196 | connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); | ||
191 | } | 197 | } |
192 | button->setText( *acts[i] ); | 198 | button->setText( *acts[i] ); |
193 | button->show(); | 199 | button->show(); |
194 | } | 200 | } |
195 | for (uint i = acts.count(); i < _buttonCount; i++){ | 201 | for (uint i = acts.count(); i < _buttonCount; i++){ |
196 | button = buttonGroupActions->find( i ); | 202 | button = buttonMap[i]; |
197 | if (button) button->hide(); | 203 | if (button) button->hide(); |
198 | } | 204 | } |
199 | _buttonCount = acts.count(); | 205 | _buttonCount = acts.count(); |
200 | detailsFrame->show(); | 206 | detailsFrame->show(); |
201 | }else detailsFrame->hide(); | 207 | buttonBox->show(); |
208 | |||
209 | }else { | ||
210 | detailsFrame->hide(); | ||
211 | buttonBox->hide(); | ||
212 | } | ||
202 | popupTimer->start( 300, true ); | 213 | popupTimer->start( 300, true ); |
203 | } | 214 | } |
204 | 215 | ||
205 | void MainWindow::stopTimer(QListViewItem*) | 216 | void MainWindow::stopTimer(QListViewItem*) |
206 | { | 217 | { |
207 | popupTimer->stop(); | 218 | popupTimer->stop(); |
208 | } | 219 | } |
209 | 220 | ||
210 | void MainWindow::showPopup() | 221 | void MainWindow::showPopup() |
211 | { | 222 | { |
212 | popupTimer->stop(); | 223 | popupTimer->stop(); |
213 | if (!_currentItem) return; | 224 | if (!_currentItem) return; |
214 | QPopupMenu *pop = _currentItem->popupMenu(); | 225 | QPopupMenu *pop = _currentItem->popupMenu(); |
215 | if (pop) pop->popup( QCursor::pos() ); | 226 | if (pop) pop->popup( QCursor::pos() ); |
216 | } | 227 | } |
217 | 228 | ||
218 | void MainWindow::setSearch( const QString &key ) | 229 | void MainWindow::setSearch( const QString &key ) |
219 | { | 230 | { |
220 | searchTimer->stop(); | 231 | searchTimer->stop(); |
221 | _searchString = key; | 232 | _searchString = key; |
222 | searchTimer->start( 300 ); | 233 | searchTimer->start( 300 ); |
223 | } | 234 | } |
224 | 235 | ||
225 | void MainWindow::searchStringChanged() | 236 | void MainWindow::searchStringChanged() |
@@ -232,35 +243,35 @@ void MainWindow::searchStringChanged() | |||
232 | //ss = Global::stringQuote( _searchString ); | 243 | //ss = Global::stringQuote( _searchString ); |
233 | //if (actionWholeWordsOnly->isOn()) | 244 | //if (actionWholeWordsOnly->isOn()) |
234 | // ss = "\\s"+_searchString+"\\s"; | 245 | // ss = "\\s"+_searchString+"\\s"; |
235 | //qDebug(" set searchString >%s<",ss.latin1()); | 246 | //qDebug(" set searchString >%s<",ss.latin1()); |
236 | QRegExp re( ss ); | 247 | QRegExp re( ss ); |
237 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); | 248 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); |
238 | re.setWildcard( actionWildcards->isOn() ); | 249 | re.setWildcard( actionWildcards->isOn() ); |
239 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) | 250 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
240 | s->setSearch( re ); | 251 | s->setSearch( re ); |
241 | } | 252 | } |
242 | 253 | ||
243 | void MainWindow::searchAll() | 254 | void MainWindow::searchAll() |
244 | { | 255 | { |
245 | #ifdef NEW_OWAIT | 256 | #ifdef NEW_OWAIT |
246 | OWait("searching..."); | 257 | OWait("searching..."); |
247 | #endif | 258 | #endif |
248 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 259 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
249 | s->doSearch(); | 260 | s->doSearch(); |
250 | //resultsList->repaint(); | 261 | //resultsList->repaint(); |
251 | } | 262 | } |
252 | } | 263 | } |
253 | 264 | ||
254 | void MainWindow::slotAction( int act ) | 265 | void MainWindow::slotAction( int act ) |
255 | { | 266 | { |
256 | if (_currentItem->rtti() == OListViewItem::Result){ | 267 | if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ |
257 | ResultItem *res = (ResultItem*)_currentItem; | 268 | ResultItem *res = (ResultItem*)_currentItem; |
258 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 269 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
259 | res->action(act); | 270 | res->action(act); |
260 | } | 271 | } |
261 | } | 272 | } |
262 | 273 | ||
263 | void MainWindow::optionChanged(int i) | 274 | void MainWindow::optionChanged(int ) |
264 | { | 275 | { |
265 | searchStringChanged(); | 276 | searchStringChanged(); |
266 | } | 277 | } |
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index cba11c5..1f5c4bb 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -1,78 +1,78 @@ | |||
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> | ||
17 | #include <qaction.h> | ||
18 | #include <qlist.h> | 16 | #include <qlist.h> |
19 | #include <qtimer.h> | 17 | #include <qmap.h> |
20 | #include <qpopupmenu.h> | ||
21 | 18 | ||
19 | class QAction; | ||
22 | class QPEToolBar; | 20 | class QPEToolBar; |
21 | class QHBox; | ||
23 | class QVBoxLayout; | 22 | class QVBoxLayout; |
24 | class QHBoxLayout; | ||
25 | class QTextView; | 23 | class QTextView; |
26 | class QFrame; | 24 | class QFrame; |
27 | class QListViewItem; | ||
28 | class OListView; | 25 | class OListView; |
29 | class OListViewItem; | 26 | class OListViewItem; |
30 | class QHButtonGroup; | 27 | class QListViewItem; |
31 | 28 | class QPopupMenu; | |
29 | class QSignalMapper; | ||
30 | class QTimer; | ||
32 | class SearchGroup; | 31 | class SearchGroup; |
33 | 32 | ||
34 | class MainWindow : public QMainWindow | 33 | class MainWindow : public QMainWindow |
35 | { | 34 | { |
36 | Q_OBJECT | 35 | Q_OBJECT |
37 | 36 | ||
38 | 37 | ||
39 | public: | 38 | public: |
40 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 39 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
41 | ~MainWindow(); | 40 | ~MainWindow(); |
42 | 41 | ||
43 | 42 | ||
44 | public slots: | 43 | public slots: |
45 | void setCurrent(QListViewItem*); | 44 | void setCurrent(QListViewItem*); |
46 | void setSearch( const QString& ); | 45 | void setSearch( const QString& ); |
47 | void searchAll(); | 46 | void searchAll(); |
48 | 47 | ||
49 | protected slots: | 48 | protected slots: |
50 | void slotAction(int); | 49 | void slotAction(int); |
51 | void showPopup(); | 50 | void showPopup(); |
52 | void stopTimer( QListViewItem* ); | 51 | void stopTimer( QListViewItem* ); |
53 | void searchStringChanged(); | 52 | void searchStringChanged(); |
54 | void optionChanged(int); | 53 | void optionChanged(int); |
55 | 54 | ||
56 | private: | 55 | private: |
56 | QHBox *buttonBox; | ||
57 | QMap<int, QButton*> buttonMap; | ||
58 | QSignalMapper* signalMapper; | ||
57 | OListView *resultsList; | 59 | OListView *resultsList; |
58 | QTextView *richEdit; | 60 | QTextView *richEdit; |
59 | OListViewItem *_currentItem; | 61 | OListViewItem *_currentItem; |
60 | QVBoxLayout *mainLayout; | 62 | QVBoxLayout *mainLayout; |
61 | QHBoxLayout *buttonLayout; | ||
62 | QFrame *detailsFrame; | 63 | QFrame *detailsFrame; |
63 | QTimer *popupTimer; | 64 | QTimer *popupTimer; |
64 | QTimer *searchTimer; | 65 | QTimer *searchTimer; |
65 | 66 | ||
66 | QString _searchString; | 67 | QString _searchString; |
67 | QList<SearchGroup> searches; | 68 | QList<SearchGroup> searches; |
68 | QHButtonGroup *buttonGroupActions; | ||
69 | QAction *SearchAllAction; | 69 | QAction *SearchAllAction; |
70 | QAction *actionCaseSensitiv; | 70 | QAction *actionCaseSensitiv; |
71 | QAction *actionWildcards; | 71 | QAction *actionWildcards; |
72 | //QAction *actionWholeWordsOnly; | 72 | //QAction *actionWholeWordsOnly; |
73 | uint _buttonCount; | 73 | uint _buttonCount; |
74 | void makeMenu(); | 74 | void makeMenu(); |
75 | }; | 75 | }; |
76 | 76 | ||
77 | #endif | 77 | #endif |
78 | 78 | ||
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h index ad37d4e..de74efb 100644 --- a/core/pim/osearch/searchgroup.h +++ b/core/pim/osearch/searchgroup.h | |||
@@ -19,31 +19,31 @@ class QRegExp; | |||
19 | class QPopupMenu; | 19 | class QPopupMenu; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | @author Patrick S. Vogt | 22 | @author Patrick S. Vogt |
23 | */ | 23 | */ |
24 | class SearchGroup : public OListViewItem | 24 | class SearchGroup : public OListViewItem |
25 | { | 25 | { |
26 | public: | 26 | public: |
27 | SearchGroup(QListView* parent, QString name); | 27 | SearchGroup(QListView* parent, QString name); |
28 | 28 | ||
29 | ~SearchGroup(); | 29 | ~SearchGroup(); |
30 | 30 | ||
31 | virtual void expand(); | 31 | virtual void expand(); |
32 | virtual void doSearch(); | 32 | virtual void doSearch(); |
33 | virtual void setSearch(QRegExp); | 33 | virtual void setSearch(QRegExp); |
34 | virtual int rtti() { return Searchgroup;} | 34 | virtual int rtti() { return Searchgroup;} |
35 | 35 | ||
36 | protected: | 36 | protected: |
37 | virtual void load() = 0; | 37 | virtual void load() = 0; |
38 | virtual int search() = 0; | 38 | virtual int search() = 0; |
39 | virtual void insertItem( void* ) = 0; | 39 | virtual void insertItem( void* ) = 0; |
40 | QRegExp _search; | 40 | QRegExp _search; |
41 | QRegExp _lastSearch; | 41 | QRegExp _lastSearch; |
42 | QString _name; | 42 | QString _name; |
43 | bool loaded; | 43 | bool loaded : 1; |
44 | int _resultCount; | 44 | int _resultCount; |
45 | private: | 45 | private: |
46 | int realSearch(); | 46 | int realSearch(); |
47 | }; | 47 | }; |
48 | 48 | ||
49 | #endif | 49 | #endif |
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 08bbe93..5c1d7a5 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -45,36 +45,36 @@ TodoSearch::~TodoSearch() | |||
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 OTodoAccess(); |
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 | ORecordList<OTodo> 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 OTodo( 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 | OTodo *todo = (OTodo*)rec; |
67 | if (!actionShowCompleted->isOn() && | 67 | if (!actionShowCompleted->isOn() && |
68 | todo->isCompleted() ) return; | 68 | todo->isCompleted() ) return; |
69 | 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 | } |