summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp5
-rw-r--r--core/pim/osearch/applnksearch.cpp7
-rw-r--r--core/pim/osearch/contactitem.cpp37
-rw-r--r--core/pim/osearch/datebooksearch.cpp6
-rw-r--r--core/pim/osearch/doclnksearch.cpp5
-rw-r--r--core/pim/osearch/eventitem.cpp14
-rw-r--r--core/pim/osearch/mainwindow.cpp5
-rw-r--r--core/pim/osearch/todoitem.cpp16
-rw-r--r--core/pim/osearch/todosearch.cpp7
9 files changed, 49 insertions, 53 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index e1f575d..d260670 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -1,60 +1,59 @@
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" 14#include "contactitem.h"
15 15
16#include <qpe/resource.h> 16#include <opie2/oresource.h>
17 17
18//#include <qwhatsthis.h> 18//#include <qwhatsthis.h>
19 19
20using namespace Opie; 20using namespace Opie;
21AdressSearch::AdressSearch(QListView* parent, QString name): 21AdressSearch::AdressSearch(QListView* parent, QString name):
22 SearchGroup(parent, name) 22 SearchGroup(parent, name)
23{ 23{
24 _contacts = 0; 24 _contacts = 0;
25 QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); 25 setPixmap( 0, Opie::Core::OResource::loadPixmap( "addressbook/AddressBook", Opie::Core::OResource::SmallIcon ) );
26 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
27 26
28 27
29 //QWhatsThis::add( this, QObject::tr("Search the addressbook") ); 28 //QWhatsThis::add( this, QObject::tr("Search the addressbook") );
30 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); 29 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" );
31 QImage img = pix.convertToImage(); 30 QImage img = pix.convertToImage();
32 img.smoothScale( 14, 14 ); 31 img.smoothScale( 14, 14 );
33 pix.convertFromImage( img ); 32 pix.convertFromImage( img );
34 setPixmap( 0, pix );*/ 33 setPixmap( 0, pix );*/
35} 34}
36 35
37 36
38AdressSearch::~AdressSearch() 37AdressSearch::~AdressSearch()
39{ 38{
40 delete _contacts; 39 delete _contacts;
41} 40}
42 41
43void AdressSearch::load() 42void AdressSearch::load()
44{ 43{
45 _contacts = new OPimContactAccess("osearch"); 44 _contacts = new OPimContactAccess("osearch");
46} 45}
47 46
48int AdressSearch::search() 47int AdressSearch::search()
49{ 48{
50 OPimRecordList<OPimContact> results = _contacts->matchRegexp(_search); 49 OPimRecordList<OPimContact> results = _contacts->matchRegexp(_search);
51 for (uint i = 0; i < results.count(); i++) { 50 for (uint i = 0; i < results.count(); i++) {
52 (void)new ContactItem( this, new OPimContact( results[i] )); 51 (void)new ContactItem( this, new OPimContact( results[i] ));
53 } 52 }
54 return results.count(); 53 return results.count();
55} 54}
56 55
57void AdressSearch::insertItem( void* ) 56void AdressSearch::insertItem( void* )
58{ 57{
59 58
60} 59}
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index 474dbb2..69170c9 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -1,69 +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#include "applnkitem.h" 14#include "applnkitem.h"
15 15
16#include <opie2/oresource.h>
17
16#include <qpe/applnk.h> 18#include <qpe/applnk.h>
17#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
18#include <qpe/resource.h>
19 20
20 21
21AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) 22AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
22{ 23{
23 _apps = 0; 24 _apps = 0;
24 QIconSet is = Resource::loadIconSet( "osearch/applications" ); 25 setPixmap( 0, Opie::Core::OResource::loadPixmap( "osearch/applications", Opie::Core::OResource::SmallIcon ) );
25 //QIconSet is = Resource::loadIconSet( "AppsIcon" );
26 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
27} 26}
28 27
29 28
30AppLnkSearch::~AppLnkSearch() 29AppLnkSearch::~AppLnkSearch()
31{ 30{
32 delete _apps; 31 delete _apps;
33} 32}
34 33
35 34
36void AppLnkSearch::load() 35void AppLnkSearch::load()
37{ 36{
38 _apps = new AppLnkSet(QPEApplication::qpeDir()); 37 _apps = new AppLnkSet(QPEApplication::qpeDir());
39} 38}
40 39
41int AppLnkSearch::search() 40int AppLnkSearch::search()
42{ 41{
43 QList<AppLnk> appList = _apps->children(); 42 QList<AppLnk> appList = _apps->children();
44 43
45 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ 44 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
46 if ( (_search.match( app->name() ) != -1) 45 if ( (_search.match( app->name() ) != -1)
47 || (_search.match(app->comment()) != -1) 46 || (_search.match(app->comment()) != -1)
48 || (_search.match(app->exec()) != -1) ) { 47 || (_search.match(app->exec()) != -1) ) {
49 insertItem( app ); 48 insertItem( app );
50 }else 49 }else
51 if (searchFile( app )) 50 if (searchFile( app ))
52 insertItem( app ); 51 insertItem( app );
53 qApp->processEvents( 100 ); 52 qApp->processEvents( 100 );
54 } 53 }
55 return _resultCount; 54 return _resultCount;
56} 55}
57 56
58void AppLnkSearch::insertItem( void *rec ) 57void AppLnkSearch::insertItem( void *rec )
59{ 58{
60 (void)new AppLnkItem( this, (AppLnk*)rec ); 59 (void)new AppLnkItem( this, (AppLnk*)rec );
61 _resultCount++; 60 _resultCount++;
62} 61}
63 62
64void AppLnkSearch::setSearch(QRegExp re) 63void AppLnkSearch::setSearch(QRegExp re)
65{ 64{
66 setOpen( false ); 65 setOpen( false );
67 SearchGroup::setSearch( re ); 66 SearchGroup::setSearch( re );
68} 67}
69 68
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
index c89c6e2..81b6359 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 <qpe/resource.h> 15#include <opie2/oresource.h>
16
16#include <qpe/qcopenvelope_qws.h> 17#include <qpe/qcopenvelope_qws.h>
17 18
18 19
19using namespace Opie; 20using namespace Opie;
20ContactItem::ContactItem(OListViewItem* parent, OPimContact *contact) 21ContactItem::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
28void ContactItem::setIcon() 29void 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 = Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon );
34 break; 35 break;
35 case Qtopia::BusinessPhone: 36 case Qtopia::BusinessPhone:
36 icon = Resource::loadPixmap( "addressbook/phonework" ); 37 icon = Opie::Core::OResource::loadPixmap( "addressbook/phonework", Opie::Core::OResource::SmallIcon );
37 break; 38 break;
38 case Qtopia::BusinessFax: 39 case Qtopia::BusinessFax:
39 icon = Resource::loadPixmap( "addressbook/faxwork" ); 40 icon = Opie::Core::OResource::loadPixmap( "addressbook/faxwork", Opie::Core::OResource::SmallIcon );
40 break; 41 break;
41 case Qtopia::BusinessMobile: 42 case Qtopia::BusinessMobile:
42 icon = Resource::loadPixmap( "addressbook/mobilework" ); 43 icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilework", Opie::Core::OResource::SmallIcon );
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 = Opie::Core::OResource::loadPixmap( "addressbook/email", Opie::Core::OResource::SmallIcon );
47 break; 48 break;
48 case Qtopia::HomePhone: 49 case Qtopia::HomePhone:
49 icon = Resource::loadPixmap( "addressbook/phonehome" ); 50 icon = Opie::Core::OResource::loadPixmap( "addressbook/phonehome", Opie::Core::OResource::SmallIcon );
50 break; 51 break;
51 case Qtopia::HomeFax: 52 case Qtopia::HomeFax:
52 icon = Resource::loadPixmap( "addressbook/faxhome" ); 53 icon = Opie::Core::OResource::loadPixmap( "addressbook/faxhome", Opie::Core::OResource::SmallIcon );
53 break; 54 break;
54 case Qtopia::HomeMobile: 55 case Qtopia::HomeMobile:
55 icon = Resource::loadPixmap( "addressbook/mobilehome" ); 56 icon = Opie::Core::OResource::loadPixmap( "addressbook/mobilehome", Opie::Core::OResource::SmallIcon );
56 break; 57 break;
57 case Qtopia::HomeWebPage: 58 case Qtopia::HomeWebPage:
58 icon = Resource::loadPixmap( "addressbook/webpagehome" ); 59 icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagehome", Opie::Core::OResource::SmallIcon );
59 break; 60 break;
60 case Qtopia::BusinessWebPage: 61 case Qtopia::BusinessWebPage:
61 icon = Resource::loadPixmap( "addressbook/webpagework" ); 62 icon = Opie::Core::OResource::loadPixmap( "addressbook/webpagework", Opie::Core::OResource::SmallIcon );
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 = Opie::Core::OResource::loadPixmap( "addressbook/identity", Opie::Core::OResource::SmallIcon );
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 = Opie::Core::OResource::loadPixmap( "osearch/addresshome", Opie::Core::OResource::SmallIcon );
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 = Opie::Core::OResource::loadPixmap( "osearch/addresshome", Opie::Core::OResource::SmallIcon );
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 = Opie::Core::OResource::loadPixmap( "osearch/personal", Opie::Core::OResource::SmallIcon );
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 = Opie::Core::OResource::loadPixmap( "osearch/clock", Opie::Core::OResource::SmallIcon );
100 break; 101 break;
101 case Qtopia::Notes: 102 case Qtopia::Notes:
102 icon = Resource::loadPixmap( "txt" ); 103 icon = Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon );
103 break; 104 break;
104 default: 105 default:
105 icon = Resource::loadPixmap( "DocsIcon" ); 106 icon = Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon );
106 break; 107 break;
107 } 108 }
108 setPixmap( 0, icon ); 109 setPixmap( 0, icon );
109} 110}
110 111
111ContactItem::~ContactItem() 112ContactItem::~ContactItem()
112{ 113{
113 delete _contact; 114 delete _contact;
114} 115}
115 116
116 117
117QString ContactItem::toRichText() 118QString ContactItem::toRichText()
118{ 119{
119 return _contact->toRichText(); 120 return _contact->toRichText();
120} 121}
121 122
122void ContactItem::action( int act ) 123void ContactItem::action( int act )
123{ 124{
124if (act == 0){ 125if (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
134QIntDict<QString> ContactItem::actions() 135QIntDict<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/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index ef3b006..13df6bf 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,93 +1,93 @@
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#include "eventitem.h" 14#include "eventitem.h"
15 15
16#include <opie2/odebug.h> 16#include <opie2/odebug.h>
17#include <opie2/opimevent.h> 17#include <opie2/opimevent.h>
18#include <opie2/opimrecurrence.h> 18#include <opie2/opimrecurrence.h>
19#include <opie2/oresource.h>
19 20
20#include <qpe/resource.h>
21#include <qpe/config.h> 21#include <qpe/config.h>
22 22
23#include <qaction.h> 23#include <qaction.h>
24#include <qpopupmenu.h> 24#include <qpopupmenu.h>
25 25
26 26
27 27
28DatebookSearch::DatebookSearch(QListView* parent, QString name) 28DatebookSearch::DatebookSearch(QListView* parent, QString name)
29: SearchGroup(parent, name), _dates(0), _popupMenu(0) 29: SearchGroup(parent, name), _dates(0), _popupMenu(0)
30{ 30{
31 QIconSet is = Resource::loadIconSet( "datebook/DateBook" ); 31 setPixmap( 0, Opie::Core::OResource::loadPixmap( "datebook/DateBook", Opie::Core::OResource::SmallIcon ) );
32 setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); 32
33 actionShowPastEvents = new QAction( QObject::tr("Show past events"),QString::null, 0, 0, 0, true ); 33 actionShowPastEvents = new QAction( QObject::tr("Show past events"),QString::null, 0, 0, 0, true );
34 actionSearchInDates = new QAction( QObject::tr("Search in dates"),QString::null, 0, 0, 0, true ); 34 actionSearchInDates = new QAction( QObject::tr("Search in dates"),QString::null, 0, 0, 0, true );
35 Config cfg( "osearch", Config::User ); 35 Config cfg( "osearch", Config::User );
36 cfg.setGroup( "datebook_settings" ); 36 cfg.setGroup( "datebook_settings" );
37 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); 37 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
38 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); 38 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
39} 39}
40 40
41DatebookSearch::~DatebookSearch() 41DatebookSearch::~DatebookSearch()
42{ 42{
43 odebug << "SAVE DATEBOOK SEARCH CONFIG" << oendl; 43 odebug << "SAVE DATEBOOK SEARCH CONFIG" << oendl;
44 Config cfg( "osearch", Config::User ); 44 Config cfg( "osearch", Config::User );
45 cfg.setGroup( "datebook_settings" ); 45 cfg.setGroup( "datebook_settings" );
46 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); 46 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() );
47 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); 47 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() );
48 delete _dates; 48 delete _dates;
49 delete _popupMenu; 49 delete _popupMenu;
50 delete actionShowPastEvents; 50 delete actionShowPastEvents;
51 delete actionSearchInDates; 51 delete actionSearchInDates;
52} 52}
53 53
54 54
55void DatebookSearch::load() 55void DatebookSearch::load()
56{ 56{
57 _dates = new ODateBookAccess(); 57 _dates = new ODateBookAccess();
58 _dates->load(); 58 _dates->load();
59} 59}
60 60
61int DatebookSearch::search() 61int DatebookSearch::search()
62{ 62{
63 OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search); 63 OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search);
64 for (uint i = 0; i < results.count(); i++) 64 for (uint i = 0; i < results.count(); i++)
65 insertItem( new OPimEvent( results[i] ) ); 65 insertItem( new OPimEvent( results[i] ) );
66 return _resultCount; 66 return _resultCount;
67} 67}
68 68
69void DatebookSearch::insertItem( void *rec ) 69void DatebookSearch::insertItem( void *rec )
70{ 70{
71 OPimEvent *ev = (OPimEvent*)rec; 71 OPimEvent *ev = (OPimEvent*)rec;
72 if ( !actionShowPastEvents->isOn() && 72 if ( !actionShowPastEvents->isOn() &&
73 ev->endDateTime() < QDateTime::currentDateTime() && 73 ev->endDateTime() < QDateTime::currentDateTime() &&
74 !ev->recurrence().doesRecur() 74 !ev->recurrence().doesRecur()
75 ) return; 75 ) return;
76 if ( !actionSearchInDates->isOn() && ( 76 if ( !actionSearchInDates->isOn() && (
77 ev->lastHitField() == Qtopia::StartDateTime || 77 ev->lastHitField() == Qtopia::StartDateTime ||
78 ev->lastHitField() == Qtopia::EndDateTime ) 78 ev->lastHitField() == Qtopia::EndDateTime )
79 ) return; 79 ) return;
80 new EventItem( this, ev ); 80 new EventItem( this, ev );
81 _resultCount++; 81 _resultCount++;
82} 82}
83 83
84QPopupMenu* DatebookSearch::popupMenu() 84QPopupMenu* DatebookSearch::popupMenu()
85{ 85{
86 if (!_popupMenu){ 86 if (!_popupMenu){
87 _popupMenu = new QPopupMenu( 0 ); 87 _popupMenu = new QPopupMenu( 0 );
88 actionShowPastEvents->addTo( _popupMenu ); 88 actionShowPastEvents->addTo( _popupMenu );
89 actionSearchInDates->addTo( _popupMenu ); 89 actionSearchInDates->addTo( _popupMenu );
90 } 90 }
91 return _popupMenu; 91 return _popupMenu;
92} 92}
93 93
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
index 3d91c1f..9d165be 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,98 +1,97 @@
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 14
15#include "doclnkitem.h" 15#include "doclnkitem.h"
16#include "doclnksearch.h" 16#include "doclnksearch.h"
17 17
18#include <opie2/oresource.h>
18#include <opie2/owait.h> 19#include <opie2/owait.h>
19 20
20#include <qpe/applnk.h> 21#include <qpe/applnk.h>
21#include <qpe/config.h> 22#include <qpe/config.h>
22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qaction.h> 25#include <qaction.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qtextstream.h> 28#include <qtextstream.h>
29 29
30 30
31DocLnkSearch::DocLnkSearch(QListView* parent, QString name) 31DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
32: AppLnkSearch(parent, name), _popupMenu(0) 32: AppLnkSearch(parent, name), _popupMenu(0)
33{ 33{
34 QIconSet is = Resource::loadIconSet( "osearch/documents" ); 34 setPixmap( 0, Opie::Core::OResource::loadPixmap( "osearch/documents", Opie::Core::OResource::SmallIcon ) );
35 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
36 35
37 actionSearchInFiles = new QAction( QObject::tr("Search content"),QString::null, 0, 0, 0, true ); 36 actionSearchInFiles = new QAction( QObject::tr("Search content"),QString::null, 0, 0, 0, true );
38 Config cfg( "osearch", Config::User ); 37 Config cfg( "osearch", Config::User );
39 cfg.setGroup( "doclnk_settings" ); 38 cfg.setGroup( "doclnk_settings" );
40 actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); 39 actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) );
41} 40}
42 41
43 42
44DocLnkSearch::~DocLnkSearch() 43DocLnkSearch::~DocLnkSearch()
45{ 44{
46 Config cfg( "osearch", Config::User ); 45 Config cfg( "osearch", Config::User );
47 cfg.setGroup( "doclnk_settings" ); 46 cfg.setGroup( "doclnk_settings" );
48 cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); 47 cfg.writeEntry( "search_content", actionSearchInFiles->isOn() );
49} 48}
50 49
51void DocLnkSearch::load() 50void DocLnkSearch::load()
52{ 51{
53 _apps = new DocLnkSet(QPEApplication::documentDir()); 52 _apps = new DocLnkSet(QPEApplication::documentDir());
54} 53}
55 54
56bool DocLnkSearch::searchFile( AppLnk *app ) 55bool DocLnkSearch::searchFile( AppLnk *app )
57{ 56{
58 if (!actionSearchInFiles->isOn()) return false; 57 if (!actionSearchInFiles->isOn()) return false;
59 DocLnk *doc = (DocLnk*)app; 58 DocLnk *doc = (DocLnk*)app;
60 bool found = false; 59 bool found = false;
61 if ( doc->type().contains( "text" ) ){ 60 if ( doc->type().contains( "text" ) ){
62#ifdef NEW_OWAIT 61#ifdef NEW_OWAIT
63 QString ouput = QObject::tr("searching %1").arg(doc->file()); 62 QString ouput = QObject::tr("searching %1").arg(doc->file());
64 OWait( output ); 63 OWait( output );
65#endif 64#endif
66 QFile f(doc->file()); 65 QFile f(doc->file());
67 if ( f.open(IO_ReadOnly) ) { 66 if ( f.open(IO_ReadOnly) ) {
68 QTextStream t( &f ); 67 QTextStream t( &f );
69 while ( !t.eof() ) 68 while ( !t.eof() )
70 if (_search.match( t.readLine()) != -1) { 69 if (_search.match( t.readLine()) != -1) {
71 found = true; 70 found = true;
72 break; 71 break;
73 } 72 }
74 } 73 }
75 f.close(); 74 f.close();
76 } 75 }
77 return found; 76 return found;
78} 77}
79 78
80void DocLnkSearch::insertItem( void *rec ) 79void DocLnkSearch::insertItem( void *rec )
81{ 80{
82 (void)new DocLnkItem( this, (DocLnk*)rec ); 81 (void)new DocLnkItem( this, (DocLnk*)rec );
83 _resultCount++; 82 _resultCount++;
84} 83}
85 84
86 85
87QPopupMenu* DocLnkSearch::popupMenu() 86QPopupMenu* DocLnkSearch::popupMenu()
88{ 87{
89 if (!_popupMenu){ 88 if (!_popupMenu){
90 _popupMenu = new QPopupMenu( 0 ); 89 _popupMenu = new QPopupMenu( 0 );
91 actionSearchInFiles->addTo( _popupMenu ); 90 actionSearchInFiles->addTo( _popupMenu );
92 } 91 }
93 return _popupMenu; 92 return _popupMenu;
94 //(void) new DocLnkItem( this, (DocLnk*)rec ); 93 //(void) new DocLnkItem( this, (DocLnk*)rec );
95 // rec is undeclared here 94 // rec is undeclared here
96#warning FIXME 95#warning FIXME
97 _resultCount++; 96 _resultCount++;
98} 97}
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp
index 7bcf340..36adc63 100644
--- a/core/pim/osearch/eventitem.cpp
+++ b/core/pim/osearch/eventitem.cpp
@@ -1,85 +1,85 @@
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 <opie2/oresource.h>
15 16
16#include <qpe/resource.h>
17#include <qpe/qcopenvelope_qws.h> 17#include <qpe/qcopenvelope_qws.h>
18 18
19 19
20using namespace Opie; 20using namespace Opie;
21EventItem::EventItem(OListViewItem* parent, OPimEvent *event) 21EventItem::EventItem(OListViewItem* parent, OPimEvent *event)
22 : ResultItem(parent) 22 : ResultItem(parent)
23{ 23{
24 _event = event; 24 _event = event;
25 setText(0, _event->toShortText() ); 25 setText(0, _event->toShortText() );
26 setIcon(); 26 setIcon();
27} 27}
28 28
29 29
30EventItem::~EventItem() 30EventItem::~EventItem()
31{ 31{
32} 32}
33 33
34 34
35QString EventItem::toRichText() 35QString EventItem::toRichText()
36{ 36{
37 return _event->toRichText(); 37 return _event->toRichText();
38} 38}
39 39
40void EventItem::action( int act ) 40void EventItem::action( int act )
41{ 41{
42 if (act == 0){ 42 if (act == 0){
43 QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)"); 43 QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)");
44 e << _event->startDateTime().date(); 44 e << _event->startDateTime().date();
45 }else if(act == 1){ 45 }else if(act == 1){
46 QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); 46 QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
47 e << _event->uid(); 47 e << _event->uid();
48 } 48 }
49} 49}
50 50
51QIntDict<QString> EventItem::actions() 51QIntDict<QString> EventItem::actions()
52{ 52{
53 QIntDict<QString> result; 53 QIntDict<QString> result;
54 result.insert( 0, new QString( QObject::tr("show") ) ); 54 result.insert( 0, new QString( QObject::tr("show") ) );
55 result.insert( 1, new QString( QObject::tr("edit") ) ); 55 result.insert( 1, new QString( QObject::tr("edit") ) );
56 return result; 56 return result;
57} 57}
58 58
59void EventItem::setIcon() 59void EventItem::setIcon()
60{ 60{
61 QPixmap icon; 61 QPixmap icon;
62 switch ( _event->lastHitField() ) { 62 switch ( _event->lastHitField() ) {
63 case -1: 63 case -1:
64 icon = Resource::loadPixmap( "reset" ); 64 icon = Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon );
65 // QWhatsThis::add( icon, QObject::tr("Enter your search terms here") ); 65 // QWhatsThis::add( icon, QObject::tr("Enter your search terms here") );
66 break; 66 break;
67 case Qtopia::DatebookDescription: 67 case Qtopia::DatebookDescription:
68 icon = Resource::loadPixmap( "osearch/summary" ); 68 icon = Opie::Core::OResource::loadPixmap( "osearch/summary", Opie::Core::OResource::SmallIcon );
69 break; 69 break;
70 case Qtopia::Notes: 70 case Qtopia::Notes:
71 icon = Resource::loadPixmap( "txt" ); 71 icon = Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon );
72 break; 72 break;
73 case Qtopia::Location: 73 case Qtopia::Location:
74 icon = Resource::loadPixmap( "home" ); 74 icon = Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon );
75 break; 75 break;
76 case Qtopia::StartDateTime: 76 case Qtopia::StartDateTime:
77 case Qtopia::EndDateTime: 77 case Qtopia::EndDateTime:
78 icon = Resource::loadPixmap( "osearch/clock" ); 78 icon = Opie::Core::OResource::loadPixmap( "osearch/clock", Opie::Core::OResource::SmallIcon );
79 break; 79 break;
80 default: 80 default:
81 icon = Resource::loadPixmap( "DocsIcon" ); 81 icon = Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon );
82 break; 82 break;
83 } 83 }
84 setPixmap( 0, icon ); 84 setPixmap( 0, icon );
85} 85}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 1d0331c..d71b167 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,320 +1,319 @@
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" 13#include "olistview.h"
14#include "olistviewitem.h" 14#include "olistviewitem.h"
15#include "resultitem.h" 15#include "resultitem.h"
16#include "adresssearch.h" 16#include "adresssearch.h"
17#include "todosearch.h" 17#include "todosearch.h"
18#include "datebooksearch.h" 18#include "datebooksearch.h"
19#include "applnksearch.h" 19#include "applnksearch.h"
20#include "doclnksearch.h" 20#include "doclnksearch.h"
21#include "mainwindow.h" 21#include "mainwindow.h"
22 22
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24#include <opie2/oresource.h>
24#include <opie2/owait.h> 25#include <opie2/owait.h>
25 26
26#include <qpe/qpemessagebox.h> 27#include <qpe/qpemessagebox.h>
27#include <qpe/resource.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30
31#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
32#include <qpe/global.h> 31#include <qpe/global.h>
33 32
34#include <qtoolbar.h> 33#include <qtoolbar.h>
35#include <qaction.h> 34#include <qaction.h>
36#include <qmessagebox.h> 35#include <qmessagebox.h>
37#include <qpopupmenu.h> 36#include <qpopupmenu.h>
38#include <qtoolbutton.h> 37#include <qtoolbutton.h>
39#include <qstring.h> 38#include <qstring.h>
40#include <qlabel.h> 39#include <qlabel.h>
41#include <qfile.h> 40#include <qfile.h>
42#include <qhbuttongroup.h> 41#include <qhbuttongroup.h>
43#include <qhbox.h> 42#include <qhbox.h>
44#include <qpushbutton.h> 43#include <qpushbutton.h>
45#include <qintdict.h> 44#include <qintdict.h>
46#include <qlayout.h> 45#include <qlayout.h>
47#include <qlineedit.h> 46#include <qlineedit.h>
48#include <qsignalmapper.h> 47#include <qsignalmapper.h>
49#include <qtextbrowser.h> 48#include <qtextbrowser.h>
50#include <qregexp.h> 49#include <qregexp.h>
51#include <qwhatsthis.h> 50#include <qwhatsthis.h>
52#include <qmenubar.h> 51#include <qmenubar.h>
53 52
54 53
55 54
56static const char* const image1_data[] = { 55static const char* const image1_data[] = {
57"14 14 3 1", 56"14 14 3 1",
58". c None", 57". c None",
59"# c #000000", 58"# c #000000",
60"a c #ff0000", 59"a c #ff0000",
61"..............", 60"..............",
62"..##.......###", 61"..##.......###",
63".#aa#....##aa#", 62".#aa#....##aa#",
64"#aaaa#.##aaaa#", 63"#aaaa#.##aaaa#",
65".##aaa#aaaaa##", 64".##aaa#aaaaa##",
66"...#aaaaaaa#..", 65"...#aaaaaaa#..",
67"....#aaaaa#...", 66"....#aaaaa#...",
68"...#aaaaa#....", 67"...#aaaaa#....",
69"..#aaaaaaa#...", 68"..#aaaaaaa#...",
70".#aaaaaaaaa#..", 69".#aaaaaaaaa#..",
71"#aaaa###aaaa#.", 70"#aaaa###aaaa#.",
72"#aaa#..##aaa#.", 71"#aaa#..##aaa#.",
73"#aaa#...#aa#..", 72"#aaa#...#aa#..",
74".###.....##..."}; 73".###.....##..."};
75 74
76 75
77MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 76MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
78 QMainWindow( parent, name, f ), _currentItem(0) 77 QMainWindow( parent, name, f ), _currentItem(0)
79{ 78{
80 setCaption( tr("OSearch") ); 79 setCaption( tr("OSearch") );
81 80
82 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 81 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
83 82
84 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 83 QFrame *mainFrame = new QFrame( this, "mainFrame" );
85 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 84 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
86 85
87 mainLayout = new QVBoxLayout( mainFrame ); 86 mainLayout = new QVBoxLayout( mainFrame );
88 mainLayout->setSpacing( 0 ); 87 mainLayout->setSpacing( 0 );
89 mainLayout->setMargin( 3 ); 88 mainLayout->setMargin( 3 );
90 89
91 resultsList = new OListView( mainFrame ); 90 resultsList = new OListView( mainFrame );
92 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 91 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
93 mainLayout->addWidget( resultsList ); 92 mainLayout->addWidget( resultsList );
94 93
95 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 94 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
96 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 95 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
97 richEdit = new QTextView( detailsFrame ); 96 richEdit = new QTextView( detailsFrame );
98 QWhatsThis::add( richEdit, tr("The details of the current result") ); 97 QWhatsThis::add( richEdit, tr("The details of the current result") );
99 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 98 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
100 detailsLayout->addWidget( richEdit ); 99 detailsLayout->addWidget( richEdit );
101 100
102 buttonBox = new QHBox( mainFrame, "Button Box" ); 101 buttonBox = new QHBox( mainFrame, "Button Box" );
103 102
104 _buttonCount = 0; 103 _buttonCount = 0;
105 104
106 mainLayout->addWidget( detailsFrame ); 105 mainLayout->addWidget( detailsFrame );
107 mainLayout->addWidget( buttonBox ); 106 mainLayout->addWidget( buttonBox );
108 detailsFrame->hide(); 107 detailsFrame->hide();
109 buttonBox->hide(); 108 buttonBox->hide();
110 109
111 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); 110 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
112 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); 111 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
113 searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); 112 searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
114 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); 113 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
115 searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); 114 searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
116 115
117 setCentralWidget( mainFrame ); 116 setCentralWidget( mainFrame );
118 117
119 popupTimer = new QTimer(); 118 popupTimer = new QTimer();
120 searchTimer = new QTimer(); 119 searchTimer = new QTimer();
121 120
122 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 121 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
123 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 122 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
124 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 123 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
125 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 124 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
126 125
127 signalMapper = new QSignalMapper( this ); 126 signalMapper = new QSignalMapper( this );
128 127
129 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); 128 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
130 129
131 makeMenu(); 130 makeMenu();
132 131
133 Config cfg( "osearch", Config::User ); 132 Config cfg( "osearch", Config::User );
134 cfg.setGroup( "search_settings" ); 133 cfg.setGroup( "search_settings" );
135 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 134 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
136 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 135 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
137// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 136// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
138} 137}
139 138
140void MainWindow::makeMenu() 139void MainWindow::makeMenu()
141{ 140{
142 QToolBar *toolBar = new QToolBar( this ); 141 QToolBar *toolBar = new QToolBar( this );
143 QToolBar *searchBar = new QToolBar(this); 142 QToolBar *searchBar = new QToolBar(this);
144 QMenuBar *menuBar = new QMenuBar( toolBar ); 143 QMenuBar *menuBar = new QMenuBar( toolBar );
145 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 144 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
146// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 145// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
147 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 146 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
148 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 147 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
149 148
150 setToolBarsMovable( false ); 149 setToolBarsMovable( false );
151 toolBar->setHorizontalStretchable( true ); 150 toolBar->setHorizontalStretchable( true );
152 menuBar->insertItem( tr( "Search" ), searchMenu ); 151 menuBar->insertItem( tr( "Search" ), searchMenu );
153 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 152 menuBar->insertItem( tr( "Settings" ), cfgMenu );
154 153
155 //SETTINGS MENU 154 //SETTINGS MENU
156 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 155 cfgMenu->insertItem( tr( "Search" ), searchOptions );
157 QPopupMenu *pop; 156 QPopupMenu *pop;
158 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 157 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
159 pop = s->popupMenu(); 158 pop = s->popupMenu();
160 if (pop){ 159 if (pop){
161 cfgMenu->insertItem( s->text(0), pop ); 160 cfgMenu->insertItem( s->text(0), pop );
162 } 161 }
163 } 162 }
164 163
165 164
166 //SEARCH 165 //SEARCH
167 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 166 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
168 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 167 SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
169 // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); 168 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
170 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 169 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
171 SearchAllAction->addTo( searchMenu ); 170 SearchAllAction->addTo( searchMenu );
172 searchMenu->insertItem( tr( "Options" ), searchOptions ); 171 searchMenu->insertItem( tr( "Options" ), searchOptions );
173 172
174 //SEARCH OPTIONS 173 //SEARCH OPTIONS
175 //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 );
176 //actionWholeWordsOnly->addTo( searchOptions ); 175 //actionWholeWordsOnly->addTo( searchOptions );
177 actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true ); 176 actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true );
178 actionCaseSensitiv->addTo( searchOptions ); 177 actionCaseSensitiv->addTo( searchOptions );
179 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 );
180 actionWildcards->addTo( searchOptions ); 179 actionWildcards->addTo( searchOptions );
181 180
182 //SEARCH BAR 181 //SEARCH BAR
183 LabelEnterText = new QLabel( searchBar, "Label" ); 182 LabelEnterText = new QLabel( searchBar, "Label" );
184 LabelEnterText->setAutoMask( FALSE ); 183 LabelEnterText->setAutoMask( FALSE );
185 LabelEnterText->setText( tr( "Search for: " ) ); 184 LabelEnterText->setText( tr( "Search for: " ) );
186 LabelEnterText->setFrameStyle( QFrame::NoFrame ); 185 LabelEnterText->setFrameStyle( QFrame::NoFrame );
187 LabelEnterText->setBackgroundMode( PaletteButton ); 186 LabelEnterText->setBackgroundMode( PaletteButton );
188 187
189 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 188 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
190 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 189 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
191 QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); 190 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
192 searchEdit->setFocus(); 191 searchEdit->setFocus();
193 searchBar->setHorizontalStretchable( TRUE ); 192 searchBar->setHorizontalStretchable( TRUE );
194 searchBar->setStretchableWidget( searchEdit ); 193 searchBar->setStretchableWidget( searchEdit );
195 194
196 //Search button 195 //Search button
197 SearchAllAction->addTo( searchBar ); 196 SearchAllAction->addTo( searchBar );
198 197
199 //image ripped of off opie-login/loginwindow.cpp 198 //image ripped of off opie-login/loginwindow.cpp
200 QPixmap image1( ( const char** ) image1_data ); 199 QPixmap image1( ( const char** ) image1_data );
201 200
202 //Clear text 201 //Clear text
203 ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); 202 ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
204 ClearSearchText->setText( "" ); 203 ClearSearchText->setText( "" );
205 ClearSearchText->setPixmap( image1 ); 204 ClearSearchText->setPixmap( image1 );
206 205
207 connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); 206 connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
208 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); 207 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
209 208
210} 209}
211 210
212MainWindow::~MainWindow() 211MainWindow::~MainWindow()
213{ 212{
214 Config cfg( "osearch", Config::User ); 213 Config cfg( "osearch", Config::User );
215 cfg.setGroup( "search_settings" ); 214 cfg.setGroup( "search_settings" );
216 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 215 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
217 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 216 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
218 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 217 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
219} 218}
220 219
221void MainWindow::setCurrent(QListViewItem *item) 220void MainWindow::setCurrent(QListViewItem *item)
222{ 221{
223 if (!item) return; 222 if (!item) return;
224 _currentItem = (OListViewItem*)item; 223 _currentItem = (OListViewItem*)item;
225 //_currentItem = dynamic_cast<OListViewItem*>(item); 224 //_currentItem = dynamic_cast<OListViewItem*>(item);
226 if (_currentItem->rtti() == OListViewItem::Result){ 225 if (_currentItem->rtti() == OListViewItem::Result){
227 ResultItem *res = (ResultItem*)item; 226 ResultItem *res = (ResultItem*)item;
228 // ResultItem *res = dynamic_cast<ResultItem*>(item); 227 // ResultItem *res = dynamic_cast<ResultItem*>(item);
229 richEdit->setText( res->toRichText() ); 228 richEdit->setText( res->toRichText() );
230 QIntDict<QString> acts = res->actions(); 229 QIntDict<QString> acts = res->actions();
231 QButton *button; 230 QButton *button;
232 for (uint i = 0; i < acts.count(); i++){ 231 for (uint i = 0; i < acts.count(); i++){
233 button = buttonMap[i]; 232 button = buttonMap[i];
234 if (!button) { 233 if (!button) {
235 owarn << " no button for " << *acts[i] << oendl; 234 owarn << " no button for " << *acts[i] << oendl;
236 button = new QPushButton( buttonBox ); 235 button = new QPushButton( buttonBox );
237 buttonMap.insert( i, button ); 236 buttonMap.insert( i, button );
238 signalMapper->setMapping(button, i ); 237 signalMapper->setMapping(button, i );
239 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); 238 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
240 } 239 }
241 button->setText( *acts[i] ); 240 button->setText( *acts[i] );
242 button->show(); 241 button->show();
243 } 242 }
244 for (uint i = acts.count(); i < _buttonCount; i++){ 243 for (uint i = acts.count(); i < _buttonCount; i++){
245 button = buttonMap[i]; 244 button = buttonMap[i];
246 if (button) button->hide(); 245 if (button) button->hide();
247 } 246 }
248 _buttonCount = acts.count(); 247 _buttonCount = acts.count();
249 detailsFrame->show(); 248 detailsFrame->show();
250 buttonBox->show(); 249 buttonBox->show();
251 250
252 }else { 251 }else {
253 detailsFrame->hide(); 252 detailsFrame->hide();
254 buttonBox->hide(); 253 buttonBox->hide();
255 } 254 }
256 popupTimer->start( 300, true ); 255 popupTimer->start( 300, true );
257} 256}
258 257
259void MainWindow::stopTimer(QListViewItem*) 258void MainWindow::stopTimer(QListViewItem*)
260{ 259{
261 popupTimer->stop(); 260 popupTimer->stop();
262} 261}
263 262
264void MainWindow::showPopup() 263void MainWindow::showPopup()
265{ 264{
266 popupTimer->stop(); 265 popupTimer->stop();
267 if (!_currentItem) return; 266 if (!_currentItem) return;
268 QPopupMenu *pop = _currentItem->popupMenu(); 267 QPopupMenu *pop = _currentItem->popupMenu();
269 if (pop) pop->popup( QCursor::pos() ); 268 if (pop) pop->popup( QCursor::pos() );
270} 269}
271 270
272void MainWindow::setSearch( const QString &key ) 271void MainWindow::setSearch( const QString &key )
273{ 272{
274 searchTimer->stop(); 273 searchTimer->stop();
275 _searchString = key; 274 _searchString = key;
276 searchTimer->start( 300 ); 275 searchTimer->start( 300 );
277} 276}
278 277
279void MainWindow::searchStringChanged() 278void MainWindow::searchStringChanged()
280{ 279{
281#ifdef NEW_OWAIT 280#ifdef NEW_OWAIT
282 OWait("setting search string"); 281 OWait("setting search string");
283#endif 282#endif
284 searchTimer->stop(); 283 searchTimer->stop();
285 QString ss = _searchString; 284 QString ss = _searchString;
286 //ss = Global::stringQuote( _searchString ); 285 //ss = Global::stringQuote( _searchString );
287 //if (actionWholeWordsOnly->isOn()) 286 //if (actionWholeWordsOnly->isOn())
288 // ss = "\\s"+_searchString+"\\s"; 287 // ss = "\\s"+_searchString+"\\s";
289 //Opie:Core::odebug << " set searchString >" << ss << "<" << oendl; 288 //Opie:Core::odebug << " set searchString >" << ss << "<" << oendl;
290 QRegExp re( ss ); 289 QRegExp re( ss );
291 re.setCaseSensitive( actionCaseSensitiv->isOn() ); 290 re.setCaseSensitive( actionCaseSensitiv->isOn() );
292 re.setWildcard( actionWildcards->isOn() ); 291 re.setWildcard( actionWildcards->isOn() );
293 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) 292 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
294 s->setSearch( re ); 293 s->setSearch( re );
295} 294}
296 295
297void MainWindow::searchAll() 296void MainWindow::searchAll()
298{ 297{
299#ifdef NEW_OWAIT 298#ifdef NEW_OWAIT
300 OWait("searching..."); 299 OWait("searching...");
301#endif 300#endif
302 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 301 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
303 s->doSearch(); 302 s->doSearch();
304 //resultsList->repaint(); 303 //resultsList->repaint();
305 } 304 }
306} 305}
307 306
308void MainWindow::slotAction( int act ) 307void MainWindow::slotAction( int act )
309{ 308{
310 if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ 309 if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){
311 ResultItem *res = (ResultItem*)_currentItem; 310 ResultItem *res = (ResultItem*)_currentItem;
312 // ResultItem *res = dynamic_cast<ResultItem*>(item); 311 // ResultItem *res = dynamic_cast<ResultItem*>(item);
313 res->action(act); 312 res->action(act);
314 } 313 }
315} 314}
316 315
317void MainWindow::optionChanged(int ) 316void MainWindow::optionChanged(int )
318{ 317{
319 searchStringChanged(); 318 searchStringChanged();
320} 319}
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp
index 34e790a..9172344 100644
--- a/core/pim/osearch/todoitem.cpp
+++ b/core/pim/osearch/todoitem.cpp
@@ -1,83 +1,81 @@
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 <opie2/oresource.h>
15 16
16#include <qpe/resource.h>
17#include <qpe/qcopenvelope_qws.h> 17#include <qpe/qcopenvelope_qws.h>
18 18
19
20
21using namespace Opie; 19using namespace Opie;
22TodoItem::TodoItem(OListViewItem* parent, OPimTodo *todo) 20TodoItem::TodoItem(OListViewItem* parent, OPimTodo *todo)
23: ResultItem(parent) 21: ResultItem(parent)
24{ 22{
25 _todo = todo; 23 _todo = todo;
26 setText( 0, todo->toShortText() ); 24 setText( 0, todo->toShortText() );
27 setIcon(); 25 setIcon();
28} 26}
29 27
30TodoItem::~TodoItem() 28TodoItem::~TodoItem()
31{ 29{
32 delete _todo; 30 delete _todo;
33} 31}
34 32
35QString TodoItem::toRichText() 33QString TodoItem::toRichText()
36{ 34{
37 return _todo->toRichText(); 35 return _todo->toRichText();
38} 36}
39 37
40void TodoItem::action( int act ) 38void TodoItem::action( int act )
41{ 39{
42 if (act == 0){ 40 if (act == 0){
43 QCopEnvelope e("QPE/Application/todolist", "show(int)"); 41 QCopEnvelope e("QPE/Application/todolist", "show(int)");
44 e << _todo->uid(); 42 e << _todo->uid();
45 }else if (act == 1){ 43 }else if (act == 1){
46 QCopEnvelope e("QPE/Application/todolist", "edit(int)"); 44 QCopEnvelope e("QPE/Application/todolist", "edit(int)");
47 e << _todo->uid(); 45 e << _todo->uid();
48 } 46 }
49} 47}
50 48
51QIntDict<QString> TodoItem::actions() 49QIntDict<QString> TodoItem::actions()
52{ 50{
53 QIntDict<QString> result; 51 QIntDict<QString> result;
54 result.insert( 0, new QString( QObject::tr("show") ) ); 52 result.insert( 0, new QString( QObject::tr("show") ) );
55 result.insert( 1, new QString( QObject::tr("edit") ) ); 53 result.insert( 1, new QString( QObject::tr("edit") ) );
56 return result; 54 return result;
57} 55}
58 56
59void TodoItem::setIcon() 57void TodoItem::setIcon()
60{ 58{
61 QPixmap icon; 59 QPixmap icon;
62 switch ( _todo->lastHitField() ) { 60 switch ( _todo->lastHitField() ) {
63 case -1: 61 case -1:
64 icon = Resource::loadPixmap( "reset" ); 62 icon = Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon );
65 break; 63 break;
66 case OPimTodo::Description: 64 case OPimTodo::Description:
67 icon = Resource::loadPixmap( "txt" ); 65 icon = Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon );
68 break; 66 break;
69 case OPimTodo::Summary: 67 case OPimTodo::Summary:
70 icon = Resource::loadPixmap( "osearch/summary" ); 68 icon = Opie::Core::OResource::loadPixmap( "osearch/summary", Opie::Core::OResource::SmallIcon );
71 break; 69 break;
72 case OPimTodo::Priority: 70 case OPimTodo::Priority:
73 icon = Resource::loadPixmap( "todo/priority1" ); 71 icon = Opie::Core::OResource::loadPixmap( "todo/priority1", Opie::Core::OResource::SmallIcon );
74 break; 72 break;
75 case OPimTodo::HasDate: 73 case OPimTodo::HasDate:
76 icon = Resource::loadPixmap( "osearch/clock" ); 74 icon = Opie::Core::OResource::loadPixmap( "osearch/clock", Opie::Core::OResource::SmallIcon );
77 break; 75 break;
78 default: 76 default:
79 icon = Resource::loadPixmap( "DocsIcon" ); 77 icon = Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon );
80 break; 78 break;
81 } 79 }
82 setPixmap( 0, icon ); 80 setPixmap( 0, icon );
83} 81}
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index 1ed7370..8a9ae39 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.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 "todosearch.h" 13#include "todosearch.h"
14#include "todoitem.h" 14#include "todoitem.h"
15 15
16#include <qpe/resource.h> 16#include <opie2/oresource.h>
17
17#include <qpe/config.h> 18#include <qpe/config.h>
18 19
19#include <qaction.h> 20#include <qaction.h>
20#include <qpopupmenu.h> 21#include <qpopupmenu.h>
21 22
22using namespace Opie; 23using namespace Opie;
23TodoSearch::TodoSearch(QListView* parent, QString name) 24TodoSearch::TodoSearch(QListView* parent, QString name)
24: SearchGroup(parent, name), _todos(0), _popupMenu(0) 25: SearchGroup(parent, name), _todos(0), _popupMenu(0)
25{ 26{
26 //AppLnkSet als(QPEApplication::qpeDir()); 27 //AppLnkSet als(QPEApplication::qpeDir());
27 //setPixmap( 0, als.findExec("todolist")->pixmap() ); 28 //setPixmap( 0, als.findExec("todolist")->pixmap() );
28 QIconSet is = Resource::loadIconSet( "todo/TodoList" ); 29 setPixmap( 0, Opie::Core::OResource::loadPixmap( "todo/TodoList", Opie::Core::OResource::SmallIcon ) );
29 setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); 30
30 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 );
31 Config cfg( "osearch", Config::User ); 32 Config cfg( "osearch", Config::User );
32 cfg.setGroup( "todo_settings" ); 33 cfg.setGroup( "todo_settings" );
33 actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); 34 actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) );
34 35
35} 36}
36 37
37 38
38TodoSearch::~TodoSearch() 39TodoSearch::~TodoSearch()
39{ 40{
40 Config cfg( "osearch", Config::User ); 41 Config cfg( "osearch", Config::User );
41 cfg.setGroup( "todo_settings" ); 42 cfg.setGroup( "todo_settings" );
42 cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() ); 43 cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() );
43 delete _popupMenu; 44 delete _popupMenu;
44 delete actionShowCompleted; 45 delete actionShowCompleted;
45 delete _todos; 46 delete _todos;
46} 47}
47 48
48 49
49void TodoSearch::load() 50void TodoSearch::load()
50{ 51{
51 _todos = new OPimTodoAccess(); 52 _todos = new OPimTodoAccess();
52 _todos->load(); 53 _todos->load();
53} 54}
54 55
55int TodoSearch::search() 56int TodoSearch::search()
56{ 57{
57 OPimRecordList<OPimTodo> results = _todos->matchRegexp(_search); 58 OPimRecordList<OPimTodo> results = _todos->matchRegexp(_search);
58 for (uint i = 0; i < results.count(); i++) 59 for (uint i = 0; i < results.count(); i++)
59 insertItem( new OPimTodo( results[i] )); 60 insertItem( new OPimTodo( results[i] ));
60 return _resultCount; 61 return _resultCount;
61} 62}
62 63
63void TodoSearch::insertItem( void *rec ) 64void TodoSearch::insertItem( void *rec )
64{ 65{
65 OPimTodo *todo = (OPimTodo*)rec; 66 OPimTodo *todo = (OPimTodo*)rec;
66 if (!actionShowCompleted->isOn() && 67 if (!actionShowCompleted->isOn() &&
67 todo->isCompleted() ) return; 68 todo->isCompleted() ) return;
68 (void)new TodoItem( this, todo ); 69 (void)new TodoItem( this, todo );
69 _resultCount++; 70 _resultCount++;
70} 71}
71 72
72QPopupMenu* TodoSearch::popupMenu() 73QPopupMenu* TodoSearch::popupMenu()
73{ 74{
74 if (!_popupMenu){ 75 if (!_popupMenu){
75 _popupMenu = new QPopupMenu( 0 ); 76 _popupMenu = new QPopupMenu( 0 );
76 actionShowCompleted->addTo( _popupMenu ); 77 actionShowCompleted->addTo( _popupMenu );
77 } 78 }
78 return _popupMenu; 79 return _popupMenu;
79} 80}