summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp33
-rw-r--r--core/pim/datebook/datebooktypes.h8
2 files changed, 39 insertions, 2 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 36c4bd7..a7f6691 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -1,130 +1,132 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19** $Id$ 19** $Id$
20** 20**
21**********************************************************************/ 21**********************************************************************/
22 22
23#define QTOPIA_INTERNAL_FD 23#define QTOPIA_INTERNAL_FD
24 24
25#include "datebook.h" 25#include "datebook.h"
26#include "datebookday.h" 26#include "datebookday.h"
27#include "datebooksettings.h" 27#include "datebooksettings.h"
28#include "datebookweek.h" 28#include "datebookweek.h"
29#include "datebookweeklst.h" 29#include "datebookweeklst.h"
30#include "dateentryimpl.h" 30#include "dateentryimpl.h"
31 31
32#include <opie2/odebug.h> 32#include <opie2/odebug.h>
33#include <opie2/oholidaypluginif.h> 33#include <opie2/oholidaypluginif.h>
34#include <opie2/oholidayplugin.h> 34#include <opie2/oholidayplugin.h>
35#include <opie2/opluginloader.h>
36#include <opie2/todayplugininterface.h>
35 37
36#include <qpe/datebookmonth.h> 38#include <qpe/datebookmonth.h>
37#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
38#include <qpe/config.h> 40#include <qpe/config.h>
39#include <qpe/finddialog.h> 41#include <qpe/finddialog.h>
40#include <qpe/ir.h> 42#include <qpe/ir.h>
41#include <qpe/qpemessagebox.h> 43#include <qpe/qpemessagebox.h>
42#include <qpe/resource.h> 44#include <qpe/resource.h>
43#include <qpe/sound.h> 45#include <qpe/sound.h>
44#include <qpe/tzselect.h> 46#include <qpe/tzselect.h>
45 47
46#include <qaction.h> 48#include <qaction.h>
47#include <qcopchannel_qws.h> 49#include <qcopchannel_qws.h>
48#include <qlayout.h> 50#include <qlayout.h>
49#include <qmessagebox.h> 51#include <qmessagebox.h>
50#include <qtimer.h> 52#include <qtimer.h>
51#include <qtl.h> 53#include <qtl.h>
52#include <qtoolbar.h> 54#include <qtoolbar.h>
53#include <qwidgetstack.h> 55#include <qwidgetstack.h>
54#include <qdir.h> 56#include <qdir.h>
55#include <qtopia/qlibrary.h> 57#include <qtopia/qlibrary.h>
56 58
57#include <sys/stat.h> 59#include <sys/stat.h>
58#include <sys/types.h> 60#include <sys/types.h>
59#include <fcntl.h> 61#include <fcntl.h>
60#include <unistd.h> 62#include <unistd.h>
61 63
62#include <stdlib.h> 64#include <stdlib.h>
63 65
64DateBook::DateBook( QWidget *parent, const char *, WFlags f ) 66DateBook::DateBook( QWidget *parent, const char *, WFlags f )
65 : QMainWindow( parent, "datebook", f ), 67 : QMainWindow( parent, "datebook", f ),
66 aPreset( FALSE ), 68 aPreset( FALSE ),
67 presetTime( -1 ), 69 presetTime( -1 ),
68 startTime( 8 ), // an acceptable default 70 startTime( 8 ), // an acceptable default
69 rowStyle( 0 ), 71 rowStyle( 0 ),
70 bJumpToCurTime(FALSE), 72 bJumpToCurTime(FALSE),
71 syncing(FALSE), 73 syncing(FALSE),
72 inSearch(FALSE), 74 inSearch(FALSE),
73 alarmCounter(0) 75 alarmCounter(0)
74{ 76{
75 bool needEvilHack= false; // if we need an Evil Hack 77 bool needEvilHack= false; // if we need an Evil Hack
76 QTime t; 78 QTime t;
77 t.start(); 79 t.start();
78 db = new DateBookDBHoliday; 80 db = new DateBookDBHoliday;
79 odebug << "loading db t=" << t.elapsed() << oendl; 81 odebug << "loading db t=" << t.elapsed() << oendl;
80 db_holiday = new DateBookHoliday(); 82 db_holiday = new DateBookHoliday();
81 db->db_holiday=db_holiday; 83 db->db_holiday=db_holiday;
82 84
83 loadSettings(); 85 loadSettings();
84 setCaption( tr("Calendar") ); 86 setCaption( tr("Calendar") );
85 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 87 setIcon( Resource::loadPixmap( "datebook_icon" ) );
86 88
87 setToolBarsMovable( FALSE ); 89 setToolBarsMovable( FALSE );
88 90
89 views = new QWidgetStack( this ); 91 views = new QWidgetStack( this );
90 setCentralWidget( views ); 92 setCentralWidget( views );
91 93
92 dayView = 0; 94 dayView = 0;
93 weekView = 0; 95 weekView = 0;
94 weekLstView = 0; 96 weekLstView = 0;
95 monthView = 0; 97 monthView = 0;
96 98
97// QToolBar *bar = new QToolBar( this ); 99// QToolBar *bar = new QToolBar( this );
98// bar->setHorizontalStretchable( TRUE ); 100// bar->setHorizontalStretchable( TRUE );
99 101
100// QMenuBar *mb = new QMenuBar( bar ); 102// QMenuBar *mb = new QMenuBar( bar );
101// mb->setMargin( 0 ); 103// mb->setMargin( 0 );
102 104
103// QPopupMenu *view = new QPopupMenu( this ); 105// QPopupMenu *view = new QPopupMenu( this );
104// mb->insertItem( tr( "View" ), view ); 106// mb->insertItem( tr( "View" ), view );
105 107
106 QToolBar *sub_bar = new QToolBar(this); 108 QToolBar *sub_bar = new QToolBar(this);
107 sub_bar->setHorizontalStretchable(TRUE); 109 sub_bar->setHorizontalStretchable(TRUE);
108 110
109 QActionGroup *g = new QActionGroup( this ); 111 QActionGroup *g = new QActionGroup( this );
110 g->setExclusive( TRUE ); 112 g->setExclusive( TRUE );
111 113
112 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 114 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
113 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 115 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
114 a->addTo( sub_bar ); 116 a->addTo( sub_bar );
115 117
116 sub_bar->addSeparator(); 118 sub_bar->addSeparator();
117 119
118 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); 120 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
119 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 121 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
120 a->addTo( sub_bar ); 122 a->addTo( sub_bar );
121// a->addTo( view ); 123// a->addTo( view );
122 124
123 sub_bar->addSeparator(); 125 sub_bar->addSeparator();
124 126
125 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 127 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
126 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 128 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
127 a->addTo( sub_bar ); 129 a->addTo( sub_bar );
128// a->addTo( view ); 130// a->addTo( view );
129 a->setToggleAction( TRUE ); 131 a->setToggleAction( TRUE );
130 a->setOn( TRUE ); 132 a->setOn( TRUE );
@@ -992,203 +994,234 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt,
992 nonrev.setStart( rev.start() ); 994 nonrev.setStart( rev.start() );
993 inSearch = true; 995 inSearch = true;
994 } 996 }
995 static QDate searchDate = dt; 997 static QDate searchDate = dt;
996 // if true at the end we will start at the begin again and afterwards 998 // if true at the end we will start at the begin again and afterwards
997 // we will emit string not found 999 // we will emit string not found
998 static bool wrapAround = true; 1000 static bool wrapAround = true;
999 bool candidtate; 1001 bool candidtate;
1000 candidtate = false; 1002 candidtate = false;
1001 1003
1002 QValueList<Event> repeats = db->getRawRepeats(); 1004 QValueList<Event> repeats = db->getRawRepeats();
1003 1005
1004 // find the candidate for the first repeat that matches... 1006 // find the candidate for the first repeat that matches...
1005 // first check if there can ever be a match and then compute 1007 // first check if there can ever be a match and then compute
1006 // the next occurence from start. See if this event is closer 1008 // the next occurence from start. See if this event is closer
1007 // to the beginning (start. next < dtEnd) and not smaller then the last 1009 // to the beginning (start. next < dtEnd) and not smaller then the last
1008 // result. If we find a canditate we set the dtEnd to the time 1010 // result. If we find a canditate we set the dtEnd to the time
1009 // of the ocurrence and rev to this occurence. 1011 // of the ocurrence and rev to this occurence.
1010 // set wrap around to true because there might be more events coming 1012 // set wrap around to true because there might be more events coming
1011 // and we're not at the end. 1013 // and we're not at the end.
1012 QValueListConstIterator<Event> it; 1014 QValueListConstIterator<Event> it;
1013 QDate start = dt; 1015 QDate start = dt;
1014 for ( it = repeats.begin(); it != repeats.end(); ++it ) { 1016 for ( it = repeats.begin(); it != repeats.end(); ++it ) {
1015 if ( catComp( (*it).categories(), category ) ) { 1017 if ( catComp( (*it).categories(), category ) ) {
1016 if ( (*it).match( r ) ) { 1018 if ( (*it).match( r ) ) {
1017 if ( nextOccurance( *it, start, next ) ) { 1019 if ( nextOccurance( *it, start, next ) ) {
1018 if ( next < dtEnd && !(next <= rev.start() ) ) { 1020 if ( next < dtEnd && !(next <= rev.start() ) ) {
1019 rev = *it; 1021 rev = *it;
1020 dtEnd = next; 1022 dtEnd = next;
1021 rev.setStart( next ); 1023 rev.setStart( next );
1022 candidtate = true; 1024 candidtate = true;
1023 wrapAround = true; 1025 wrapAround = true;
1024 } 1026 }
1025 } 1027 }
1026 } 1028 }
1027 } 1029 }
1028 } 1030 }
1029 1031
1030 // now the for first non repeat... 1032 // now the for first non repeat...
1031 // dtEnd is set by the previous iteration of repeatingEvents 1033 // dtEnd is set by the previous iteration of repeatingEvents
1032 // check if we find a closer item. Also set dtEnd to find even 1034 // check if we find a closer item. Also set dtEnd to find even
1033 // more close occurrence 1035 // more close occurrence
1034 QValueList<Event> nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() ); 1036 QValueList<Event> nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() );
1035 qHeapSort( nonRepeats.begin(), nonRepeats.end() ); 1037 qHeapSort( nonRepeats.begin(), nonRepeats.end() );
1036 for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) { 1038 for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) {
1037 if ( catComp( (*it).categories(), category ) ) { 1039 if ( catComp( (*it).categories(), category ) ) {
1038 if ( (*it).start() < dtEnd ) { 1040 if ( (*it).start() < dtEnd ) {
1039 if ( (*it).match( r ) && !(*it <= nonrev) ) { 1041 if ( (*it).match( r ) && !(*it <= nonrev) ) {
1040 nonrev = *it; 1042 nonrev = *it;
1041 dtEnd = nonrev.start(); 1043 dtEnd = nonrev.start();
1042 candidtate = true; 1044 candidtate = true;
1043 wrapAround = true; 1045 wrapAround = true;
1044 break; 1046 break;
1045 } 1047 }
1046 } 1048 }
1047 } 1049 }
1048 } 1050 }
1049 if ( candidtate ) { 1051 if ( candidtate ) {
1050 dayView->setStartViewTime( dtEnd.time().hour() ); 1052 dayView->setStartViewTime( dtEnd.time().hour() );
1051 dayView->setDate( dtEnd.date().year(), dtEnd.date().month(), 1053 dayView->setDate( dtEnd.date().year(), dtEnd.date().month(),
1052 dtEnd.date().day() ); 1054 dtEnd.date().day() );
1053 } else { 1055 } else {
1054 if ( wrapAround ) { 1056 if ( wrapAround ) {
1055 emit signalWrapAround(); 1057 emit signalWrapAround();
1056 rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) ); 1058 rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) );
1057 nonrev.setStart( rev.start() ); 1059 nonrev.setStart( rev.start() );
1058 } else 1060 } else
1059 emit signalNotFound(); 1061 emit signalNotFound();
1060 wrapAround = !wrapAround; 1062 wrapAround = !wrapAround;
1061 } 1063 }
1062} 1064}
1063 1065
1064Event DateBookDBHack::eventByUID(int uid) { 1066Event DateBookDBHack::eventByUID(int uid) {
1065 1067
1066 // FIXME: Dirty Hacks to get hold of the private event lists 1068 // FIXME: Dirty Hacks to get hold of the private event lists
1067 QDate start; 1069 QDate start;
1068 QDate end=start.addDays(-1); 1070 QDate end=start.addDays(-1);
1069 QValueList<Event> myEventList=getNonRepeatingEvents(start,end); 1071 QValueList<Event> myEventList=getNonRepeatingEvents(start,end);
1070 QValueList<Event> myRepeatEvents=getRawRepeats(); 1072 QValueList<Event> myRepeatEvents=getRawRepeats();
1071 1073
1072 QValueList<Event>::ConstIterator it; 1074 QValueList<Event>::ConstIterator it;
1073 1075
1074 for (it = myEventList.begin(); it != myEventList.end(); it++) { 1076 for (it = myEventList.begin(); it != myEventList.end(); it++) {
1075 if ((*it).uid() == uid) return *it; 1077 if ((*it).uid() == uid) return *it;
1076 } 1078 }
1077 for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { 1079 for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) {
1078 if ((*it).uid() == uid) return *it; 1080 if ((*it).uid() == uid) return *it;
1079 } 1081 }
1080 1082
1081 Event ev; 1083 Event ev;
1082 return ev; // return at least 1084 return ev; // return at least
1083} 1085}
1084 1086
1085DateBookHoliday::DateBookHoliday() 1087DateBookHoliday::DateBookHoliday()
1086{ 1088{
1087 _pluginlist.clear(); 1089 _pluginlist.clear();
1090 m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false);
1091 m_pluginLoader->setAutoDelete(true);
1088 init(); 1092 init();
1089} 1093}
1090 1094
1091DateBookHoliday::~DateBookHoliday() 1095DateBookHoliday::~DateBookHoliday()
1092{ 1096{
1093 deinit(); 1097 deinit();
1098 delete m_pluginLoader;
1094} 1099}
1095 1100
1096void DateBookHoliday::deinit() 1101void DateBookHoliday::deinit()
1097{ 1102{
1103/*
1098 QValueList<HPlugin*>::Iterator it; 1104 QValueList<HPlugin*>::Iterator it;
1099 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { 1105 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1100 HPlugin*_pl = *it; 1106 HPlugin*_pl = *it;
1101 // destructs itself? 1107 // destructs itself?
1102 _pl->_if->release(); 1108 _pl->_if->release();
1103 _pl->_lib->unload(); 1109 _pl->_lib->unload();
1104 delete _pl->_lib; 1110 delete _pl->_lib;
1105 delete _pl; 1111 delete _pl;
1106 } 1112 }
1107 _pluginlist.clear(); 1113 _pluginlist.clear();
1114*/
1108} 1115}
1109 1116
1117#if 0
1118void debugLst( const Opie::Core::OPluginItem::List& lst ) {
1119 for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
1120 odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl;
1121}
1122#endif
1123
1110void DateBookHoliday::init() 1124void DateBookHoliday::init()
1111{ 1125{
1126#if 0
1112 deinit(); 1127 deinit();
1128#endif
1129 Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false );
1130// debugLst( lst );
1131 for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){
1132 Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN);
1133 if (hif) {
1134 Opie::Datebook::HolidayPlugin*pl = hif->plugin();
1135 if (pl) {
1136 HPlugin*_pl=new HPlugin;
1137 _pl->_plugin = pl;
1138 odebug << "Found holiday " << pl->description()<<oendl;
1139 _pluginlist.append(_pl);
1140 //_pl->_if = hif;
1141 }
1142 }
1143 }
1144#if 0
1113 QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; 1145 QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday";
1114 QDir dir( path, "lib*.so" ); 1146 QDir dir( path, "lib*.so" );
1115 QStringList list = dir.entryList(); 1147 QStringList list = dir.entryList();
1116 QStringList::Iterator it; 1148 QStringList::Iterator it;
1117 for (it=list.begin();it!=list.end();++it) { 1149 for (it=list.begin();it!=list.end();++it) {
1118 Opie::Datebook::HolidayPluginIf*hif = 0; 1150 Opie::Datebook::HolidayPluginIf*hif = 0;
1119 QLibrary*lib=new QLibrary(path+"/"+*it); 1151 QLibrary*lib=new QLibrary(path+"/"+*it);
1120 if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) { 1152 if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) {
1121 Opie::Datebook::HolidayPlugin*pl = hif->plugin(); 1153 Opie::Datebook::HolidayPlugin*pl = hif->plugin();
1122 if (pl) { 1154 if (pl) {
1123 HPlugin*_pl=new HPlugin; 1155 HPlugin*_pl=new HPlugin;
1124 _pl->_plugin = pl; 1156 _pl->_plugin = pl;
1125 odebug << "Found holiday " << pl->description()<<oendl; 1157 odebug << "Found holiday " << pl->description()<<oendl;
1126 _pl->_lib = lib; 1158 _pl->_lib = lib;
1127 _pl->_if = hif; 1159 _pl->_if = hif;
1128 _pluginlist.append(_pl); 1160 _pluginlist.append(_pl);
1129 } else { 1161 } else {
1130 } 1162 }
1131 } else { 1163 } else {
1132 delete lib; 1164 delete lib;
1133 } 1165 }
1134 } 1166 }
1167#endif
1135} 1168}
1136 1169
1137QStringList DateBookHoliday::holidaylist(const QDate&aDate) 1170QStringList DateBookHoliday::holidaylist(const QDate&aDate)
1138{ 1171{
1139 QStringList ret; 1172 QStringList ret;
1140 QValueList<HPlugin*>::Iterator it; 1173 QValueList<HPlugin*>::Iterator it;
1141 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { 1174 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1142 HPlugin*_pl = *it; 1175 HPlugin*_pl = *it;
1143 ret+=_pl->_plugin->entries(aDate); 1176 ret+=_pl->_plugin->entries(aDate);
1144 } 1177 }
1145 return ret; 1178 return ret;
1146} 1179}
1147 1180
1148QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day) 1181QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day)
1149{ 1182{
1150 return holidaylist(QDate(year,month,day)); 1183 return holidaylist(QDate(year,month,day));
1151} 1184}
1152 1185
1153QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to ) 1186QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
1154{ 1187{
1155 QValueList<EffectiveEvent> ret; 1188 QValueList<EffectiveEvent> ret;
1156 QValueList<HPlugin*>::Iterator it; 1189 QValueList<HPlugin*>::Iterator it;
1157 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { 1190 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1158 HPlugin*_pl = *it; 1191 HPlugin*_pl = *it;
1159 ret+=_pl->_plugin->events(from,to); 1192 ret+=_pl->_plugin->events(from,to);
1160 } 1193 }
1161 return ret; 1194 return ret;
1162} 1195}
1163 1196
1164QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ) 1197QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to )
1165{ 1198{
1166 return DateBookDBHack::getEffectiveEvents(from,to); 1199 return DateBookDBHack::getEffectiveEvents(from,to);
1167} 1200}
1168 1201
1169QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start) 1202QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start)
1170{ 1203{
1171 return DateBookDBHack::getEffectiveEvents(start); 1204 return DateBookDBHack::getEffectiveEvents(start);
1172} 1205}
1173 1206
1174QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start) 1207QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start)
1175{ 1208{
1176 return getEffectiveEvents(start.date(),start.date()); 1209 return getEffectiveEvents(start.date(),start.date());
1177} 1210}
1178 1211
1179QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to ) 1212QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
1180{ 1213{
1181 QValueList<EffectiveEvent> ret; 1214 QValueList<EffectiveEvent> ret;
1182 odebug << "Ueberlagert 1" << oendl; 1215 odebug << "Ueberlagert 1" << oendl;
1183 if (db_holiday) { 1216 if (db_holiday) {
1184 ret+=db_holiday->getEffectiveEvents(from,to); 1217 ret+=db_holiday->getEffectiveEvents(from,to);
1185 } 1218 }
1186 ret+=getEffectiveEventsNoHoliday(from,to); 1219 ret+=getEffectiveEventsNoHoliday(from,to);
1187 return ret; 1220 return ret;
1188} 1221}
1189 1222
1190QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start) 1223QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start)
1191{ 1224{
1192 odebug << "Ueberlagert 2" << oendl; 1225 odebug << "Ueberlagert 2" << oendl;
1193 return DateBookDBHack::getEffectiveEvents(start); 1226 return DateBookDBHack::getEffectiveEvents(start);
1194} 1227}
diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h
index 9eb7e89..f944e84 100644
--- a/core/pim/datebook/datebooktypes.h
+++ b/core/pim/datebook/datebooktypes.h
@@ -1,59 +1,63 @@
1#ifndef _DATEBOOK_TYPES_H 1#ifndef _DATEBOOK_TYPES_H
2#define _DATEBOOK_TYPES_H 2#define _DATEBOOK_TYPES_H
3 3
4#include <qpe/datebookdb.h> 4#include <qpe/datebookdb.h>
5 5
6#include <qvaluelist.h> 6#include <qvaluelist.h>
7#include <qstringlist.h> 7#include <qstringlist.h>
8 8
9namespace Opie { 9namespace Opie {
10namespace Datebook { 10namespace Datebook {
11 class HolidayPlugin; 11 class HolidayPlugin;
12 class HolidayPluginIf; 12 class HolidayPluginIf;
13} 13}
14namespace Core {
15 class OPluginLoader;
16}
14} 17}
15 18
16class QLibrary; 19class QLibrary;
17 20
18class DateBookDBHack : virtual public DateBookDB { 21class DateBookDBHack : virtual public DateBookDB {
19 public: 22 public:
20 virtual ~DateBookDBHack(){} 23 virtual ~DateBookDBHack(){}
21 Event eventByUID(int id); 24 Event eventByUID(int id);
22}; 25};
23 26
24class DateBookHoliday 27class DateBookHoliday
25{ 28{
26public: 29public:
27 DateBookHoliday(); 30 DateBookHoliday();
28 virtual ~DateBookHoliday(); 31 virtual ~DateBookHoliday();
29 32
30 QStringList holidaylist(const QDate&); 33 QStringList holidaylist(const QDate&);
31 QStringList holidaylist(unsigned year, unsigned month, unsigned day); 34 QStringList holidaylist(unsigned year, unsigned month, unsigned day);
32 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); 35 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to );
33 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); 36 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start);
34 37
35protected: 38protected:
36 void init(); 39 void init();
37 void deinit(); 40 void deinit();
38 41
39 struct HPlugin { 42 struct HPlugin {
40 Opie::Datebook::HolidayPlugin*_plugin; 43 Opie::Datebook::HolidayPlugin*_plugin;
41 QLibrary*_lib; 44 //QLibrary*_lib;
42 Opie::Datebook::HolidayPluginIf*_if; 45 //Opie::Datebook::HolidayPluginIf*_if;
43 }; 46 };
44 QValueList<HPlugin*>_pluginlist; 47 QValueList<HPlugin*>_pluginlist;
48 Opie::Core::OPluginLoader*m_pluginLoader;
45}; 49};
46 50
47class DateBookDBHoliday:virtual public DateBookDBHack { 51class DateBookDBHoliday:virtual public DateBookDBHack {
48public: 52public:
49 DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} 53 DateBookDBHoliday():DateBookDBHack(){db_holiday=0;}
50 virtual ~DateBookDBHoliday(){} 54 virtual ~DateBookDBHoliday(){}
51 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); 55 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to );
52 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); 56 virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start);
53 virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ); 57 virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to );
54 virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start); 58 virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start);
55 59
56 DateBookHoliday*db_holiday; 60 DateBookHoliday*db_holiday;
57}; 61};
58 62
59#endif 63#endif