summaryrefslogtreecommitdiff
path: root/core/pim/osearch/datebooksearch.cpp
Unidiff
Diffstat (limited to 'core/pim/osearch/datebooksearch.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/osearch/datebooksearch.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 50c76e0..2b4660a 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -2,37 +2,40 @@
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "datebooksearch.h" 13#include "datebooksearch.h"
14
15#include "eventitem.h" 14#include "eventitem.h"
16 15
16#include <opie2/opimevent.h>
17#include <opie2/opimrecurrence.h>
18
19
17#include <qpe/resource.h> 20#include <qpe/resource.h>
18#include <qpe/config.h> 21#include <qpe/config.h>
19#include <opie/oevent.h> 22
20#include <opie/orecur.h>
21#include <opie/odatebookaccess.h>
22#include <qiconset.h> 23#include <qiconset.h>
23#include <qaction.h> 24#include <qaction.h>
24#include <qdatetime.h> 25#include <qdatetime.h>
25#include <qpopupmenu.h> 26#include <qpopupmenu.h>
26 27
28
29
27DatebookSearch::DatebookSearch(QListView* parent, QString name) 30DatebookSearch::DatebookSearch(QListView* parent, QString name)
28: SearchGroup(parent, name), _dates(0), _popupMenu(0) 31: SearchGroup(parent, name), _dates(0), _popupMenu(0)
29{ 32{
30 QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); 33 QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" );
31 setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); 34 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
32 actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); 35 actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true );
33 actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); 36 actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true );
34 Config cfg( "osearch", Config::User ); 37 Config cfg( "osearch", Config::User );
35 cfg.setGroup( "datebook_settings" ); 38 cfg.setGroup( "datebook_settings" );
36 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); 39 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
37 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); 40 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
38} 41}
@@ -50,33 +53,33 @@ DatebookSearch::~DatebookSearch()
50 delete actionSearchInDates; 53 delete actionSearchInDates;
51} 54}
52 55
53 56
54void DatebookSearch::load() 57void DatebookSearch::load()
55{ 58{
56 _dates = new ODateBookAccess(); 59 _dates = new ODateBookAccess();
57 _dates->load(); 60 _dates->load();
58} 61}
59 62
60int DatebookSearch::search() 63int DatebookSearch::search()
61{ 64{
62 ORecordList<OEvent> results = _dates->matchRegexp(_search); 65 OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search);
63 for (uint i = 0; i < results.count(); i++) 66 for (uint i = 0; i < results.count(); i++)
64 insertItem( new OEvent( results[i] ) ); 67 insertItem( new OPimEvent( results[i] ) );
65 return _resultCount; 68 return _resultCount;
66} 69}
67 70
68void DatebookSearch::insertItem( void *rec ) 71void DatebookSearch::insertItem( void *rec )
69{ 72{
70 OEvent *ev = (OEvent*)rec; 73 OPimEvent *ev = (OPimEvent*)rec;
71 if ( !actionShowPastEvents->isOn() && 74 if ( !actionShowPastEvents->isOn() &&
72 ev->endDateTime() < QDateTime::currentDateTime() && 75 ev->endDateTime() < QDateTime::currentDateTime() &&
73 !ev->recurrence().doesRecur() 76 !ev->recurrence().doesRecur()
74 ) return; 77 ) return;
75 if ( !actionSearchInDates->isOn() && ( 78 if ( !actionSearchInDates->isOn() && (
76 ev->lastHitField() == Qtopia::StartDateTime || 79 ev->lastHitField() == Qtopia::StartDateTime ||
77 ev->lastHitField() == Qtopia::EndDateTime ) 80 ev->lastHitField() == Qtopia::EndDateTime )
78 ) return; 81 ) return;
79 new EventItem( this, ev ); 82 new EventItem( this, ev );
80 _resultCount++; 83 _resultCount++;
81} 84}
82 85