summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
authoralwin <alwin>2005-03-17 14:01:23 (UTC)
committer alwin <alwin>2005-03-17 14:01:23 (UTC)
commit8752141a5341877369f89a42fa1f0b5d08f56dbd (patch) (unidiff)
tree63dc48ee207a4e9fbb6b9e8abddb239ec724c155 /core/pim/datebook/datebook.cpp
parentafee05f4b4c1e8dab8463e3423fcfc8f9d45aa8b (diff)
downloadopie-8752141a5341877369f89a42fa1f0b5d08f56dbd.zip
opie-8752141a5341877369f89a42fa1f0b5d08f56dbd.tar.gz
opie-8752141a5341877369f89a42fa1f0b5d08f56dbd.tar.bz2
1. datebookweeklist - a week has SEVEN days, not SIX. I'm wondering why
events on sunday never showed there ;) 2. extra file datebooktypes contains some special classes used by datebook so other classes must not include the big mainheader file. 3. added support for holiday-plugins to week-views. Month view is a little bit more tricky 'cause TT has never heard about virtual methods and so I have the choice between complete copy the monthview and make the modifications or changing the interface of datebookdb-class to virtual. both isn't nice.
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index f6aab0c..36c4bd7 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -66,27 +66,28 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
66 aPreset( FALSE ), 66 aPreset( FALSE ),
67 presetTime( -1 ), 67 presetTime( -1 ),
68 startTime( 8 ), // an acceptable default 68 startTime( 8 ), // an acceptable default
69 rowStyle( 0 ), 69 rowStyle( 0 ),
70 bJumpToCurTime(FALSE), 70 bJumpToCurTime(FALSE),
71 syncing(FALSE), 71 syncing(FALSE),
72 inSearch(FALSE), 72 inSearch(FALSE),
73 alarmCounter(0) 73 alarmCounter(0)
74{ 74{
75 bool needEvilHack= false; // if we need an Evil Hack 75 bool needEvilHack= false; // if we need an Evil Hack
76 QTime t; 76 QTime t;
77 t.start(); 77 t.start();
78 db = new DateBookDBHack; 78 db = new DateBookDBHoliday;
79 odebug << "loading db t=" << t.elapsed() << oendl; 79 odebug << "loading db t=" << t.elapsed() << oendl;
80 db_holiday = new DateBookHoliday(); 80 db_holiday = new DateBookHoliday();
81 db->db_holiday=db_holiday;
81 82
82 loadSettings(); 83 loadSettings();
83 setCaption( tr("Calendar") ); 84 setCaption( tr("Calendar") );
84 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 85 setIcon( Resource::loadPixmap( "datebook_icon" ) );
85 86
86 setToolBarsMovable( FALSE ); 87 setToolBarsMovable( FALSE );
87 88
88 views = new QWidgetStack( this ); 89 views = new QWidgetStack( this );
89 setCentralWidget( views ); 90 setCentralWidget( views );
90 91
91 dayView = 0; 92 dayView = 0;
92 weekView = 0; 93 weekView = 0;
@@ -1140,12 +1141,54 @@ QStringList DateBookHoliday::holidaylist(const QDate&aDate)
1140 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { 1141 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1141 HPlugin*_pl = *it; 1142 HPlugin*_pl = *it;
1142 ret+=_pl->_plugin->entries(aDate); 1143 ret+=_pl->_plugin->entries(aDate);
1143 } 1144 }
1144 return ret; 1145 return ret;
1145} 1146}
1146 1147
1147QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day) 1148QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day)
1148{ 1149{
1149 return holidaylist(QDate(year,month,day)); 1150 return holidaylist(QDate(year,month,day));
1150} 1151}
1151 1152
1153QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
1154{
1155 QValueList<EffectiveEvent> ret;
1156 QValueList<HPlugin*>::Iterator it;
1157 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1158 HPlugin*_pl = *it;
1159 ret+=_pl->_plugin->events(from,to);
1160 }
1161 return ret;
1162}
1163
1164QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to )
1165{
1166 return DateBookDBHack::getEffectiveEvents(from,to);
1167}
1168
1169QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start)
1170{
1171 return DateBookDBHack::getEffectiveEvents(start);
1172}
1173
1174QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start)
1175{
1176 return getEffectiveEvents(start.date(),start.date());
1177}
1178
1179QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
1180{
1181 QValueList<EffectiveEvent> ret;
1182 odebug << "Ueberlagert 1" << oendl;
1183 if (db_holiday) {
1184 ret+=db_holiday->getEffectiveEvents(from,to);
1185 }
1186 ret+=getEffectiveEventsNoHoliday(from,to);
1187 return ret;
1188}
1189
1190QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start)
1191{
1192 odebug << "Ueberlagert 2" << oendl;
1193 return DateBookDBHack::getEffectiveEvents(start);
1194}