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.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 2b4660a..eeea54b 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,73 +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 "datebooksearch.h" 13#include "datebooksearch.h"
14#include "eventitem.h" 14#include "eventitem.h"
15 15
16#include <opie2/opimevent.h> 16#include <opie2/opimevent.h>
17#include <opie2/opimrecurrence.h> 17#include <opie2/opimrecurrence.h>
18 18
19 19
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/config.h> 21#include <qpe/config.h>
22 22
23#include <qiconset.h>
24#include <qaction.h> 23#include <qaction.h>
25#include <qdatetime.h>
26#include <qpopupmenu.h> 24#include <qpopupmenu.h>
27 25
28 26
29 27
30DatebookSearch::DatebookSearch(QListView* parent, QString name) 28DatebookSearch::DatebookSearch(QListView* parent, QString name)
31: SearchGroup(parent, name), _dates(0), _popupMenu(0) 29: SearchGroup(parent, name), _dates(0), _popupMenu(0)
32{ 30{
33 QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); 31 QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" );
34 setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); 32 setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
35 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 );
36 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 );
37 Config cfg( "osearch", Config::User ); 35 Config cfg( "osearch", Config::User );
38 cfg.setGroup( "datebook_settings" ); 36 cfg.setGroup( "datebook_settings" );
39 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); 37 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
40 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); 38 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
41} 39}
42 40
43DatebookSearch::~DatebookSearch() 41DatebookSearch::~DatebookSearch()
44{ 42{
45 qDebug("SAVE DATEBOOK SEARCH CONFIG"); 43 qDebug("SAVE DATEBOOK SEARCH CONFIG");
46 Config cfg( "osearch", Config::User ); 44 Config cfg( "osearch", Config::User );
47 cfg.setGroup( "datebook_settings" ); 45 cfg.setGroup( "datebook_settings" );
48 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); 46 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() );
49 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); 47 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() );
50 delete _dates; 48 delete _dates;
51 delete _popupMenu; 49 delete _popupMenu;
52 delete actionShowPastEvents; 50 delete actionShowPastEvents;
53 delete actionSearchInDates; 51 delete actionSearchInDates;
54} 52}
55 53
56 54
57void DatebookSearch::load() 55void DatebookSearch::load()
58{ 56{
59 _dates = new ODateBookAccess(); 57 _dates = new ODateBookAccess();
60 _dates->load(); 58 _dates->load();
61} 59}
62 60
63int DatebookSearch::search() 61int DatebookSearch::search()
64{ 62{
65 OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search); 63 OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search);
66 for (uint i = 0; i < results.count(); i++) 64 for (uint i = 0; i < results.count(); i++)
67 insertItem( new OPimEvent( results[i] ) ); 65 insertItem( new OPimEvent( results[i] ) );
68 return _resultCount; 66 return _resultCount;
69} 67}
70 68
71void DatebookSearch::insertItem( void *rec ) 69void DatebookSearch::insertItem( void *rec )
72{ 70{
73 OPimEvent *ev = (OPimEvent*)rec; 71 OPimEvent *ev = (OPimEvent*)rec;