summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp6
-rw-r--r--core/pim/osearch/applnksearch.cpp12
-rw-r--r--core/pim/osearch/datebooksearch.cpp4
-rw-r--r--core/pim/osearch/doclnksearch.cpp4
-rw-r--r--core/pim/osearch/mainwindow.cpp42
-rw-r--r--core/pim/osearch/mainwindow.h3
-rw-r--r--core/pim/osearch/olistview.cpp8
-rw-r--r--core/pim/osearch/todosearch.cpp4
8 files changed, 64 insertions, 19 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index f117fe6..7681ea2 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -1,60 +1,62 @@
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
23AdressSearch::AdressSearch(QListView* parent, QString name): 23AdressSearch::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/AddressBookSmall" );
28 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 28 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
29
30
29 //QWhatsThis::add( this, QObject::tr("Search the addressbook") ); 31 //QWhatsThis::add( this, QObject::tr("Search the addressbook") );
30 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); 32 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" );
31 QImage img = pix.convertToImage(); 33 QImage img = pix.convertToImage();
32 img.smoothScale( 14, 14 ); 34 img.smoothScale( 14, 14 );
33 pix.convertFromImage( img ); 35 pix.convertFromImage( img );
34 setPixmap( 0, pix );*/ 36 setPixmap( 0, pix );*/
35} 37}
36 38
37 39
38AdressSearch::~AdressSearch() 40AdressSearch::~AdressSearch()
39{ 41{
40 delete _contacts; 42 delete _contacts;
41} 43}
42 44
43void AdressSearch::load() 45void AdressSearch::load()
44{ 46{
45 _contacts = new OContactAccess("osearch"); 47 _contacts = new OContactAccess("osearch");
46} 48}
47 49
48int AdressSearch::search() 50int AdressSearch::search()
49{ 51{
50 ORecordList<OContact> results = _contacts->matchRegexp(_search); 52 ORecordList<OContact> results = _contacts->matchRegexp(_search);
51 for (uint i = 0; i < results.count(); i++) { 53 for (uint i = 0; i < results.count(); i++) {
52 (void)new ContactItem( this, new OContact( results[i] )); 54 (void)new ContactItem( this, new OContact( results[i] ));
53 } 55 }
54 return results.count(); 56 return results.count();
55} 57}
56 58
57void AdressSearch::insertItem( void* ) 59void AdressSearch::insertItem( void* )
58{ 60{
59 61
60} 62}
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index b15275a..e8170c5 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -1,69 +1,71 @@
1// 1//
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "applnksearch.h" 13#include "applnksearch.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <qiconset.h> 17#include <qiconset.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19 19
20#include "applnkitem.h" 20#include "applnkitem.h"
21 21
22
22AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) 23AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
23{ 24{
24 _apps = 0; 25 _apps = 0;
25 QIconSet is = Resource::loadIconSet( "osearch/applications" ); 26 QIconSet is = Resource::loadIconSet( "osearch/applicationsSmall" );
26 //QIconSet is = Resource::loadIconSet( "AppsIcon" ); 27 //QIconSet is = Resource::loadIconSet( "AppsIcon" );
27 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 28 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
28} 29}
29 30
30 31
31AppLnkSearch::~AppLnkSearch() 32AppLnkSearch::~AppLnkSearch()
32{ 33{
33 delete _apps; 34 delete _apps;
34} 35}
35 36
36 37
37void AppLnkSearch::load() 38void AppLnkSearch::load()
38{ 39{
39 _apps = new AppLnkSet(QPEApplication::qpeDir()); 40 _apps = new AppLnkSet(QPEApplication::qpeDir());
40} 41}
41 42
42int AppLnkSearch::search() 43int AppLnkSearch::search()
43{ 44{
44 QList<AppLnk> appList = _apps->children(); 45 QList<AppLnk> appList = _apps->children();
46
45 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ 47 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
46 if ( (_search.match( app->name() ) != -1) 48 if ( (_search.match( app->name() ) != -1)
47 || (_search.match(app->comment()) != -1) 49 || (_search.match(app->comment()) != -1)
48 || (_search.match(app->exec()) != -1) ) { 50 || (_search.match(app->exec()) != -1) ) {
49 insertItem( app ); 51 insertItem( app );
50 }else 52 }else
51 if (searchFile( app )) 53 if (searchFile( app ))
52 insertItem( app ); 54 insertItem( app );
53 qApp->processEvents( 100 ); 55 qApp->processEvents( 100 );
54 } 56 }
55 return _resultCount; 57 return _resultCount;
56} 58}
57 59
58void AppLnkSearch::insertItem( void *rec ) 60void AppLnkSearch::insertItem( void *rec )
59{ 61{
60 (void)new AppLnkItem( this, (AppLnk*)rec ); 62 (void)new AppLnkItem( this, (AppLnk*)rec );
61 _resultCount++; 63 _resultCount++;
62} 64}
63 65
64void AppLnkSearch::setSearch(QRegExp re) 66void AppLnkSearch::setSearch(QRegExp re)
65{ 67{
66 setOpen( false ); 68 setOpen( false );
67 SearchGroup::setSearch( re ); 69 SearchGroup::setSearch( re );
68} 70}
69 71
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 5da7ae9..50c76e0 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,92 +1,92 @@
1// 1//
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "datebooksearch.h" 13#include "datebooksearch.h"
14 14
15#include "eventitem.h" 15#include "eventitem.h"
16 16
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <opie/oevent.h> 19#include <opie/oevent.h>
20#include <opie/orecur.h> 20#include <opie/orecur.h>
21#include <opie/odatebookaccess.h> 21#include <opie/odatebookaccess.h>
22#include <qiconset.h> 22#include <qiconset.h>
23#include <qaction.h> 23#include <qaction.h>
24#include <qdatetime.h> 24#include <qdatetime.h>
25#include <qpopupmenu.h> 25#include <qpopupmenu.h>
26 26
27DatebookSearch::DatebookSearch(QListView* parent, QString name) 27DatebookSearch::DatebookSearch(QListView* parent, QString name)
28: SearchGroup(parent, name), _dates(0), _popupMenu(0) 28: SearchGroup(parent, name), _dates(0), _popupMenu(0)
29{ 29{
30 QIconSet is = Resource::loadIconSet( "datebook/DateBook" ); 30 QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" );
31 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 31 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
32 actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); 32 actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true );
33 actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); 33 actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true );
34 Config cfg( "osearch", Config::User ); 34 Config cfg( "osearch", Config::User );
35 cfg.setGroup( "datebook_settings" ); 35 cfg.setGroup( "datebook_settings" );
36 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); 36 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
37 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); 37 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
38} 38}
39 39
40DatebookSearch::~DatebookSearch() 40DatebookSearch::~DatebookSearch()
41{ 41{
42 qDebug("SAVE DATEBOOK SEARCH CONFIG"); 42 qDebug("SAVE DATEBOOK SEARCH CONFIG");
43 Config cfg( "osearch", Config::User ); 43 Config cfg( "osearch", Config::User );
44 cfg.setGroup( "datebook_settings" ); 44 cfg.setGroup( "datebook_settings" );
45 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); 45 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() );
46 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); 46 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() );
47 delete _dates; 47 delete _dates;
48 delete _popupMenu; 48 delete _popupMenu;
49 delete actionShowPastEvents; 49 delete actionShowPastEvents;
50 delete actionSearchInDates; 50 delete actionSearchInDates;
51} 51}
52 52
53 53
54void DatebookSearch::load() 54void DatebookSearch::load()
55{ 55{
56 _dates = new ODateBookAccess(); 56 _dates = new ODateBookAccess();
57 _dates->load(); 57 _dates->load();
58} 58}
59 59
60int DatebookSearch::search() 60int 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
68void DatebookSearch::insertItem( void *rec ) 68void 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 new EventItem( this, ev );
80 _resultCount++; 80 _resultCount++;
81} 81}
82 82
83QPopupMenu* DatebookSearch::popupMenu() 83QPopupMenu* 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 26097a4..b03dbd8 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,95 +1,95 @@
1// 1//
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13 13
14#include <qaction.h> 14#include <qaction.h>
15#include <qfile.h> 15#include <qfile.h>
16#include <qiconset.h> 16#include <qiconset.h>
17#include <qpopupmenu.h> 17#include <qpopupmenu.h>
18#include <qtextstream.h> 18#include <qtextstream.h>
19#include <qpe/applnk.h> 19#include <qpe/applnk.h>
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <opie/owait.h> 23#include <opie/owait.h>
24 24
25#include "doclnkitem.h" 25#include "doclnkitem.h"
26#include "doclnksearch.h" 26#include "doclnksearch.h"
27 27
28DocLnkSearch::DocLnkSearch(QListView* parent, QString name) 28DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
29: AppLnkSearch(parent, name), _popupMenu(0) 29: AppLnkSearch(parent, name), _popupMenu(0)
30{ 30{
31 QIconSet is = Resource::loadIconSet( "osearch/documents" ); 31 QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" );
32 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 32 setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) );
33 33
34 actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); 34 actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true );
35 Config cfg( "osearch", Config::User ); 35 Config cfg( "osearch", Config::User );
36 cfg.setGroup( "doclnk_settings" ); 36 cfg.setGroup( "doclnk_settings" );
37 actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); 37 actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) );
38} 38}
39 39
40 40
41DocLnkSearch::~DocLnkSearch() 41DocLnkSearch::~DocLnkSearch()
42{ 42{
43 Config cfg( "osearch", Config::User ); 43 Config cfg( "osearch", Config::User );
44 cfg.setGroup( "doclnk_settings" ); 44 cfg.setGroup( "doclnk_settings" );
45 cfg.writeEntry( "search_content", actionSearchInFiles->isOn() ); 45 cfg.writeEntry( "search_content", actionSearchInFiles->isOn() );
46} 46}
47 47
48void DocLnkSearch::load() 48void DocLnkSearch::load()
49{ 49{
50 _apps = new DocLnkSet(QPEApplication::documentDir()); 50 _apps = new DocLnkSet(QPEApplication::documentDir());
51} 51}
52 52
53bool DocLnkSearch::searchFile( AppLnk *app ) 53bool DocLnkSearch::searchFile( AppLnk *app )
54{ 54{
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
77void DocLnkSearch::insertItem( void *rec ) 77void DocLnkSearch::insertItem( void *rec )
78{ 78{
79 (void)new DocLnkItem( this, (DocLnk*)rec ); 79 (void)new DocLnkItem( this, (DocLnk*)rec );
80 _resultCount++; 80 _resultCount++;
81} 81}
82 82
83 83
84QPopupMenu* DocLnkSearch::popupMenu() 84QPopupMenu* 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 //(void) new DocLnkItem( this, (DocLnk*)rec ); 91 //(void) new DocLnkItem( this, (DocLnk*)rec );
92 // rec is undeclared here 92 // rec is undeclared here
93#warning FIXME 93#warning FIXME
94 _resultCount++; 94 _resultCount++;
95} 95}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 07403a1..55302cb 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,277 +1,313 @@
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 <qhbox.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qintdict.h> 24#include <qintdict.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qsignalmapper.h> 27#include <qsignalmapper.h>
28#include <qtextbrowser.h> 28#include <qtextbrowser.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31#include <qmenubar.h> 31#include <qmenubar.h>
32#include <qpe/qpemessagebox.h> 32#include <qpe/qpemessagebox.h>
33#include <qpe/resource.h> 33#include <qpe/resource.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qtoolbar.h> 35#include <qtoolbar.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <opie/owait.h> 39#include <opie/owait.h>
40 40
41#include "olistview.h" 41#include "olistview.h"
42#include "olistviewitem.h" 42#include "olistviewitem.h"
43#include "resultitem.h" 43#include "resultitem.h"
44#include "adresssearch.h" 44#include "adresssearch.h"
45#include "todosearch.h" 45#include "todosearch.h"
46#include "datebooksearch.h" 46#include "datebooksearch.h"
47#include "applnksearch.h" 47#include "applnksearch.h"
48#include "doclnksearch.h" 48#include "doclnksearch.h"
49#include "mainwindow.h" 49#include "mainwindow.h"
50 50
51static const char* const image1_data[] = {
52"14 14 3 1",
53". c None",
54"# c #000000",
55"a c #ff0000",
56"..............",
57"..##.......###",
58".#aa#....##aa#",
59"#aaaa#.##aaaa#",
60".##aaa#aaaaa##",
61"...#aaaaaaa#..",
62"....#aaaaa#...",
63"...#aaaaa#....",
64"..#aaaaaaa#...",
65".#aaaaaaaaa#..",
66"#aaaa###aaaa#.",
67"#aaa#..##aaa#.",
68"#aaa#...#aa#..",
69".###.....##..."};
70
71
51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 72MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
52 QMainWindow( parent, name, f ), _currentItem(0) 73 QMainWindow( parent, name, f ), _currentItem(0)
53{ 74{
54 setCaption( tr("OSearch") ); 75 setCaption( tr("OSearch") );
55 76
56 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 77 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
57 78
58 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 79 QFrame *mainFrame = new QFrame( this, "mainFrame" );
59 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 80 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
60 81
61 mainLayout = new QVBoxLayout( mainFrame ); 82 mainLayout = new QVBoxLayout( mainFrame );
62 mainLayout->setSpacing( 0 ); 83 mainLayout->setSpacing( 0 );
63 mainLayout->setMargin( 0 ); 84 mainLayout->setMargin( 3 );
64 85
65 resultsList = new OListView( mainFrame ); 86 resultsList = new OListView( mainFrame );
66 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 87 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
67 mainLayout->addWidget( resultsList ); 88 mainLayout->addWidget( resultsList );
68 89
69 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 90 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
70 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 91 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
71 richEdit = new QTextView( detailsFrame ); 92 richEdit = new QTextView( detailsFrame );
72 QWhatsThis::add( richEdit, tr("The details of the current result") ); 93 QWhatsThis::add( richEdit, tr("The details of the current result") );
73 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 94 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
74 detailsLayout->addWidget( richEdit ); 95 detailsLayout->addWidget( richEdit );
75 96
76 buttonBox = new QHBox( mainFrame, "Button Box" ); 97 buttonBox = new QHBox( mainFrame, "Button Box" );
77 98
78 _buttonCount = 0; 99 _buttonCount = 0;
79 100
80 mainLayout->addWidget( detailsFrame ); 101 mainLayout->addWidget( detailsFrame );
81 mainLayout->addWidget( buttonBox ); 102 mainLayout->addWidget( buttonBox );
82 detailsFrame->hide(); 103 detailsFrame->hide();
83 buttonBox->hide(); 104 buttonBox->hide();
84 105
85 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); 106 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
86 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); 107 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
87 searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); 108 searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
88 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); 109 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
89 searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); 110 searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
90 111
91 setCentralWidget( mainFrame ); 112 setCentralWidget( mainFrame );
92 113
93 popupTimer = new QTimer(); 114 popupTimer = new QTimer();
94 searchTimer = new QTimer(); 115 searchTimer = new QTimer();
95 116
96 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 117 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
97 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 118 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
98 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 119 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
99 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 120 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
100 121
101 signalMapper = new QSignalMapper( this ); 122 signalMapper = new QSignalMapper( this );
102 123
103 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); 124 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
104 125
105 makeMenu(); 126 makeMenu();
106 127
107 Config cfg( "osearch", Config::User ); 128 Config cfg( "osearch", Config::User );
108 cfg.setGroup( "search_settings" ); 129 cfg.setGroup( "search_settings" );
109 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 130 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
110 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 131 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
111// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 132// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
112} 133}
113 134
114void MainWindow::makeMenu() 135void MainWindow::makeMenu()
115{ 136{
116 QToolBar *toolBar = new QToolBar( this ); 137 QToolBar *toolBar = new QToolBar( this );
117 QToolBar *searchBar = new QToolBar(this); 138 QToolBar *searchBar = new QToolBar(this);
118 QMenuBar *menuBar = new QMenuBar( toolBar ); 139 QMenuBar *menuBar = new QMenuBar( toolBar );
119 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 140 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
120// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 141// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
121 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 142 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
122 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 143 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
123 144
124 setToolBarsMovable( false ); 145 setToolBarsMovable( false );
125 toolBar->setHorizontalStretchable( true ); 146 toolBar->setHorizontalStretchable( true );
126 menuBar->insertItem( tr( "Search" ), searchMenu ); 147 menuBar->insertItem( tr( "Search" ), searchMenu );
127 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 148 menuBar->insertItem( tr( "Settings" ), cfgMenu );
128 149
129 //SETTINGS MENU 150 //SETTINGS MENU
130 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 151 cfgMenu->insertItem( tr( "Search" ), searchOptions );
131 QPopupMenu *pop; 152 QPopupMenu *pop;
132 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 153 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
133 pop = s->popupMenu(); 154 pop = s->popupMenu();
134 if (pop){ 155 if (pop){
135 cfgMenu->insertItem( s->text(0), pop ); 156 cfgMenu->insertItem( s->text(0), pop );
136 } 157 }
137 } 158 }
138 159
139 160
140 //SEARCH 161 //SEARCH
141 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 162 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
142 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 163 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
143 // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); 164 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
144 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 165 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
145 SearchAllAction->addTo( searchMenu ); 166 SearchAllAction->addTo( searchMenu );
146 searchMenu->insertItem( tr( "Options" ), searchOptions ); 167 searchMenu->insertItem( tr( "Options" ), searchOptions );
147 168
148 //SEARCH OPTIONS 169 //SEARCH OPTIONS
149 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); 170 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
150 //actionWholeWordsOnly->addTo( searchOptions ); 171 //actionWholeWordsOnly->addTo( searchOptions );
151 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); 172 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
152 actionCaseSensitiv->addTo( searchOptions ); 173 actionCaseSensitiv->addTo( searchOptions );
153 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 174 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
154 actionWildcards->addTo( searchOptions ); 175 actionWildcards->addTo( searchOptions );
155 176
156 //SEARCH BAR 177 //SEARCH BAR
178 LabelEnterText = new QLabel( searchBar, "Label" );
179 LabelEnterText->setAutoMask( FALSE );
180 LabelEnterText->setText( tr( "Search for: " ) );
181
157 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 182 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
158 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 183 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
159 QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); 184 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
160 searchEdit->setFocus(); 185 searchEdit->setFocus();
161 searchBar->setHorizontalStretchable( TRUE ); 186 searchBar->setHorizontalStretchable( TRUE );
162 searchBar->setStretchableWidget( searchEdit ); 187 searchBar->setStretchableWidget( searchEdit );
188
189 //Search button
163 SearchAllAction->addTo( searchBar ); 190 SearchAllAction->addTo( searchBar );
164 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 191
165 this, SLOT( setSearch( const QString & ) ) ); 192 //image ripped of off opie-login/loginwindow.cpp
193 QPixmap image1( ( const char** ) image1_data );
194
195 //Clear text
196 ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
197 ClearSearchText->setText( tr( "" ) );
198 ClearSearchText->setPixmap( image1 );
199
200 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) );
201 connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
166 202
167} 203}
168 204
169MainWindow::~MainWindow() 205MainWindow::~MainWindow()
170{ 206{
171 Config cfg( "osearch", Config::User ); 207 Config cfg( "osearch", Config::User );
172 cfg.setGroup( "search_settings" ); 208 cfg.setGroup( "search_settings" );
173 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 209 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
174 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 210 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
175 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 211 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
176} 212}
177 213
178void MainWindow::setCurrent(QListViewItem *item) 214void MainWindow::setCurrent(QListViewItem *item)
179{ 215{
180 if (!item) return; 216 if (!item) return;
181 _currentItem = (OListViewItem*)item; 217 _currentItem = (OListViewItem*)item;
182 //_currentItem = dynamic_cast<OListViewItem*>(item); 218 //_currentItem = dynamic_cast<OListViewItem*>(item);
183 if (_currentItem->rtti() == OListViewItem::Result){ 219 if (_currentItem->rtti() == OListViewItem::Result){
184 ResultItem *res = (ResultItem*)item; 220 ResultItem *res = (ResultItem*)item;
185 // ResultItem *res = dynamic_cast<ResultItem*>(item); 221 // ResultItem *res = dynamic_cast<ResultItem*>(item);
186 richEdit->setText( res->toRichText() ); 222 richEdit->setText( res->toRichText() );
187 QIntDict<QString> acts = res->actions(); 223 QIntDict<QString> acts = res->actions();
188 QButton *button; 224 QButton *button;
189 for (uint i = 0; i < acts.count(); i++){ 225 for (uint i = 0; i < acts.count(); i++){
190 button = buttonMap[i]; 226 button = buttonMap[i];
191 if (!button) { 227 if (!button) {
192 qWarning(" no button for %s", (*acts[i]).latin1() ); 228 qWarning(" no button for %s", (*acts[i]).latin1() );
193 button = new QPushButton( buttonBox ); 229 button = new QPushButton( buttonBox );
194 buttonMap.insert( i, button ); 230 buttonMap.insert( i, button );
195 signalMapper->setMapping(button, i ); 231 signalMapper->setMapping(button, i );
196 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); 232 connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
197 } 233 }
198 button->setText( *acts[i] ); 234 button->setText( *acts[i] );
199 button->show(); 235 button->show();
200 } 236 }
201 for (uint i = acts.count(); i < _buttonCount; i++){ 237 for (uint i = acts.count(); i < _buttonCount; i++){
202 button = buttonMap[i]; 238 button = buttonMap[i];
203 if (button) button->hide(); 239 if (button) button->hide();
204 } 240 }
205 _buttonCount = acts.count(); 241 _buttonCount = acts.count();
206 detailsFrame->show(); 242 detailsFrame->show();
207 buttonBox->show(); 243 buttonBox->show();
208 244
209 }else { 245 }else {
210 detailsFrame->hide(); 246 detailsFrame->hide();
211 buttonBox->hide(); 247 buttonBox->hide();
212 } 248 }
213 popupTimer->start( 300, true ); 249 popupTimer->start( 300, true );
214} 250}
215 251
216void MainWindow::stopTimer(QListViewItem*) 252void MainWindow::stopTimer(QListViewItem*)
217{ 253{
218 popupTimer->stop(); 254 popupTimer->stop();
219} 255}
220 256
221void MainWindow::showPopup() 257void MainWindow::showPopup()
222{ 258{
223 popupTimer->stop(); 259 popupTimer->stop();
224 if (!_currentItem) return; 260 if (!_currentItem) return;
225 QPopupMenu *pop = _currentItem->popupMenu(); 261 QPopupMenu *pop = _currentItem->popupMenu();
226 if (pop) pop->popup( QCursor::pos() ); 262 if (pop) pop->popup( QCursor::pos() );
227} 263}
228 264
229void MainWindow::setSearch( const QString &key ) 265void MainWindow::setSearch( const QString &key )
230{ 266{
231 searchTimer->stop(); 267 searchTimer->stop();
232 _searchString = key; 268 _searchString = key;
233 searchTimer->start( 300 ); 269 searchTimer->start( 300 );
234} 270}
235 271
236void MainWindow::searchStringChanged() 272void MainWindow::searchStringChanged()
237{ 273{
238#ifdef NEW_OWAIT 274#ifdef NEW_OWAIT
239 OWait("setting search string"); 275 OWait("setting search string");
240#endif 276#endif
241 searchTimer->stop(); 277 searchTimer->stop();
242 QString ss = _searchString; 278 QString ss = _searchString;
243 //ss = Global::stringQuote( _searchString ); 279 //ss = Global::stringQuote( _searchString );
244 //if (actionWholeWordsOnly->isOn()) 280 //if (actionWholeWordsOnly->isOn())
245 // ss = "\\s"+_searchString+"\\s"; 281 // ss = "\\s"+_searchString+"\\s";
246 //qDebug(" set searchString >%s<",ss.latin1()); 282 //qDebug(" set searchString >%s<",ss.latin1());
247 QRegExp re( ss ); 283 QRegExp re( ss );
248 re.setCaseSensitive( actionCaseSensitiv->isOn() ); 284 re.setCaseSensitive( actionCaseSensitiv->isOn() );
249 re.setWildcard( actionWildcards->isOn() ); 285 re.setWildcard( actionWildcards->isOn() );
250 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) 286 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
251 s->setSearch( re ); 287 s->setSearch( re );
252} 288}
253 289
254void MainWindow::searchAll() 290void MainWindow::searchAll()
255{ 291{
256#ifdef NEW_OWAIT 292#ifdef NEW_OWAIT
257 OWait("searching..."); 293 OWait("searching...");
258#endif 294#endif
259 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 295 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
260 s->doSearch(); 296 s->doSearch();
261 //resultsList->repaint(); 297 //resultsList->repaint();
262 } 298 }
263} 299}
264 300
265void MainWindow::slotAction( int act ) 301void MainWindow::slotAction( int act )
266{ 302{
267 if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ 303 if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){
268 ResultItem *res = (ResultItem*)_currentItem; 304 ResultItem *res = (ResultItem*)_currentItem;
269 // ResultItem *res = dynamic_cast<ResultItem*>(item); 305 // ResultItem *res = dynamic_cast<ResultItem*>(item);
270 res->action(act); 306 res->action(act);
271 } 307 }
272} 308}
273 309
274void MainWindow::optionChanged(int ) 310void MainWindow::optionChanged(int )
275{ 311{
276 searchStringChanged(); 312 searchStringChanged();
277} 313}
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index bdc6c5f..9886053 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -1,86 +1,89 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002-2003 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002-2003 Patrick S. Vogt <tille@handhelds.org>
11 11
12#ifndef MAINWINDOW_H 12#ifndef MAINWINDOW_H
13#define MAINWINDOW_H 13#define MAINWINDOW_H
14 14
15#include <qmainwindow.h> 15#include <qmainwindow.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qaction.h> 17#include <qaction.h>
18#include <qlist.h> 18#include <qlist.h>
19 19
20#include <qmap.h> 20#include <qmap.h>
21#include <qtimer.h> 21#include <qtimer.h>
22#include <qpopupmenu.h> 22#include <qpopupmenu.h>
23 23
24class QAction; 24class QAction;
25class QToolBar; 25class QToolBar;
26class QHBox; 26class QHBox;
27class QVBoxLayout; 27class QVBoxLayout;
28class QTextView; 28class QTextView;
29class QFrame; 29class QFrame;
30class OListView; 30class OListView;
31class OListViewItem; 31class OListViewItem;
32class QListViewItem; 32class QListViewItem;
33class QPopupMenu; 33class QPopupMenu;
34class QTimer; 34class QTimer;
35class QLabel;
35 36
36class QSignalMapper; 37class QSignalMapper;
37class QButton; 38class QButton;
38 39
39class SearchGroup; 40class SearchGroup;
40 41
41class MainWindow : public QMainWindow 42class MainWindow : public QMainWindow
42{ 43{
43 Q_OBJECT 44 Q_OBJECT
44 45
45 46
46public: 47public:
47 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 48 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
48 ~MainWindow(); 49 ~MainWindow();
49 static QString appName() { return QString::fromLatin1("osearch"); } 50 static QString appName() { return QString::fromLatin1("osearch"); }
50 51
51public slots: 52public slots:
52 void setCurrent(QListViewItem*); 53 void setCurrent(QListViewItem*);
53 void setSearch( const QString& ); 54 void setSearch( const QString& );
54 void searchAll(); 55 void searchAll();
55 56
56protected slots: 57protected slots:
57 void slotAction(int); 58 void slotAction(int);
58 void showPopup(); 59 void showPopup();
59 void stopTimer( QListViewItem* ); 60 void stopTimer( QListViewItem* );
60 void searchStringChanged(); 61 void searchStringChanged();
61 void optionChanged(int); 62 void optionChanged(int);
62 63
63private: 64private:
64 QHBox *buttonBox; 65 QHBox *buttonBox;
65 QMap<int, QButton*> buttonMap; 66 QMap<int, QButton*> buttonMap;
66 QSignalMapper* signalMapper; 67 QSignalMapper* signalMapper;
67 OListView *resultsList; 68 OListView *resultsList;
68 QTextView *richEdit; 69 QTextView *richEdit;
69 OListViewItem *_currentItem; 70 OListViewItem *_currentItem;
70 QVBoxLayout *mainLayout; 71 QVBoxLayout *mainLayout;
71 QFrame *detailsFrame; 72 QFrame *detailsFrame;
72 QTimer *popupTimer; 73 QTimer *popupTimer;
73 QTimer *searchTimer; 74 QTimer *searchTimer;
75 QToolButton* ClearSearchText;
76 QLabel* LabelEnterText;
74 77
75 QString _searchString; 78 QString _searchString;
76 QList<SearchGroup> searches; 79 QList<SearchGroup> searches;
77 QAction *SearchAllAction; 80 QAction *SearchAllAction;
78 QAction *actionCaseSensitiv; 81 QAction *actionCaseSensitiv;
79 QAction *actionWildcards; 82 QAction *actionWildcards;
80 //QAction *actionWholeWordsOnly; 83 //QAction *actionWholeWordsOnly;
81 uint _buttonCount; 84 uint _buttonCount;
82 void makeMenu(); 85 void makeMenu();
83}; 86};
84 87
85#endif 88#endif
86 89
diff --git a/core/pim/osearch/olistview.cpp b/core/pim/osearch/olistview.cpp
index 06392ba..e678d63 100644
--- a/core/pim/osearch/olistview.cpp
+++ b/core/pim/osearch/olistview.cpp
@@ -1,35 +1,37 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> 9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
10 10
11#include "olistview.h" 11#include "olistview.h"
12#include "olistviewitem.h" 12#include "olistviewitem.h"
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14 14#include <qpe/qpeapplication.h>
15 15
16OListView::OListView(QWidget *parent, const char *name ) 16OListView::OListView(QWidget *parent, const char *name )
17 : QListView(parent,name) 17 : QListView(parent,name)
18{ 18{
19 19
20 setRootIsDecorated( true ); 20 setRootIsDecorated( true );
21 addColumn(tr("Results")); 21 addColumn(tr("Results"),qApp->desktop()->width() - 9 );
22 //setColumnWidthMode(0, Manual);
23
22 setSorting( -1 ); 24 setSorting( -1 );
23 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); 25 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
24} 26}
25 27
26 28
27OListView::~OListView() 29OListView::~OListView()
28{ 30{
29} 31}
30 32
31void OListView::expand(QListViewItem *item) 33void OListView::expand(QListViewItem *item)
32{ 34{
33 ((OListViewItem*)item)->expand(); 35 ((OListViewItem*)item)->expand();
34} 36}
35 37
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index 5c1d7a5..8de875e 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -1,80 +1,80 @@
1// 1//
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "todosearch.h" 13#include "todosearch.h"
14 14
15#include <opie/otodoaccess.h> 15#include <opie/otodoaccess.h>
16#include <opie/otodo.h> 16#include <opie/otodo.h>
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qiconset.h> 19#include <qiconset.h>
20#include <qaction.h> 20#include <qaction.h>
21#include <qpopupmenu.h> 21#include <qpopupmenu.h>
22#include "todoitem.h" 22#include "todoitem.h"
23 23
24TodoSearch::TodoSearch(QListView* parent, QString name) 24TodoSearch::TodoSearch(QListView* parent, QString name)
25: SearchGroup(parent, name), _todos(0), _popupMenu(0) 25: SearchGroup(parent, name), _todos(0), _popupMenu(0)
26{ 26{
27 //AppLnkSet als(QPEApplication::qpeDir()); 27 //AppLnkSet als(QPEApplication::qpeDir());
28 //setPixmap( 0, als.findExec("todolist")->pixmap() ); 28 //setPixmap( 0, als.findExec("todolist")->pixmap() );
29 QIconSet is = Resource::loadIconSet( "todo/TodoList" ); 29 QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" );
30 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 30 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
31 actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true ); 31 actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true );
32 Config cfg( "osearch", Config::User ); 32 Config cfg( "osearch", Config::User );
33 cfg.setGroup( "todo_settings" ); 33 cfg.setGroup( "todo_settings" );
34 actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); 34 actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) );
35 35
36} 36}
37 37
38 38
39TodoSearch::~TodoSearch() 39TodoSearch::~TodoSearch()
40{ 40{
41 Config cfg( "osearch", Config::User ); 41 Config cfg( "osearch", Config::User );
42 cfg.setGroup( "todo_settings" ); 42 cfg.setGroup( "todo_settings" );
43 cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() ); 43 cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() );
44 delete _popupMenu; 44 delete _popupMenu;
45 delete actionShowCompleted; 45 delete actionShowCompleted;
46 delete _todos; 46 delete _todos;
47} 47}
48 48
49 49
50void TodoSearch::load() 50void TodoSearch::load()
51{ 51{
52 _todos = new OTodoAccess(); 52 _todos = new OTodoAccess();
53 _todos->load(); 53 _todos->load();
54} 54}
55 55
56int TodoSearch::search() 56int 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
64void TodoSearch::insertItem( void *rec ) 64void 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 (void)new TodoItem( this, todo ); 69 (void)new TodoItem( this, todo );
70 _resultCount++; 70 _resultCount++;
71} 71}
72 72
73QPopupMenu* TodoSearch::popupMenu() 73QPopupMenu* 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}