author | harlekin <harlekin> | 2004-03-01 16:38:12 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-03-01 16:38:12 (UTC) |
commit | 49615014f281a58bd9bde5543692ffddab052755 (patch) (unidiff) | |
tree | fea29073a62a2217ce25976e492772f0636dce80 /core/pim/osearch/datebooksearch.cpp | |
parent | 032f2d909293fb29e6c7e3cf9cce1a12484c80f7 (diff) | |
download | opie-49615014f281a58bd9bde5543692ffddab052755.zip opie-49615014f281a58bd9bde5543692ffddab052755.tar.gz opie-49615014f281a58bd9bde5543692ffddab052755.tar.bz2 |
osearch libopie1->libopie2
Diffstat (limited to 'core/pim/osearch/datebooksearch.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 17 |
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 | |||
27 | DatebookSearch::DatebookSearch(QListView* parent, QString name) | 30 | DatebookSearch::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 | ||
54 | void DatebookSearch::load() | 57 | void DatebookSearch::load() |
55 | { | 58 | { |
56 | _dates = new ODateBookAccess(); | 59 | _dates = new ODateBookAccess(); |
57 | _dates->load(); | 60 | _dates->load(); |
58 | } | 61 | } |
59 | 62 | ||
60 | int DatebookSearch::search() | 63 | int 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 | ||
68 | void DatebookSearch::insertItem( void *rec ) | 71 | void 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 | ||