author | alwin <alwin> | 2005-03-17 14:01:23 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-17 14:01:23 (UTC) |
commit | 8752141a5341877369f89a42fa1f0b5d08f56dbd (patch) (unidiff) | |
tree | 63dc48ee207a4e9fbb6b9e8abddb239ec724c155 | |
parent | afee05f4b4c1e8dab8463e3423fcfc8f9d45aa8b (diff) | |
download | opie-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.
-rw-r--r-- | core/pim/datebook/datebook.cpp | 45 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 37 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 12 | ||||
-rw-r--r-- | core/pim/datebook/datebooktypes.h | 59 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 489 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.h | 9 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 597 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 93 |
10 files changed, 718 insertions, 634 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 | |||
@@ -77,5 +77,6 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
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 | ||
@@ -1151 +1152,43 @@ QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned | |||
1151 | 1152 | ||
1153 | QValueList<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 | |||
1164 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ) | ||
1165 | { | ||
1166 | return DateBookDBHack::getEffectiveEvents(from,to); | ||
1167 | } | ||
1168 | |||
1169 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start) | ||
1170 | { | ||
1171 | return DateBookDBHack::getEffectiveEvents(start); | ||
1172 | } | ||
1173 | |||
1174 | QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start) | ||
1175 | { | ||
1176 | return getEffectiveEvents(start.date(),start.date()); | ||
1177 | } | ||
1178 | |||
1179 | QValueList<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 | |||
1190 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start) | ||
1191 | { | ||
1192 | odebug << "Ueberlagert 2" << oendl; | ||
1193 | return DateBookDBHack::getEffectiveEvents(start); | ||
1194 | } | ||
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index 54ffcfb..3d7f5b5 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -22,2 +22,4 @@ | |||
22 | 22 | ||
23 | #include "datebooktypes.h" | ||
24 | |||
23 | #include <qpe/datebookdb.h> | 25 | #include <qpe/datebookdb.h> |
@@ -38,35 +40,2 @@ class QDate; | |||
38 | class Ir; | 40 | class Ir; |
39 | class QLibrary; | ||
40 | |||
41 | namespace Opie { | ||
42 | namespace Datebook { | ||
43 | class HolidayPlugin; | ||
44 | class HolidayPluginIf; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | class DateBookDBHack : public DateBookDB { | ||
49 | public: | ||
50 | Event eventByUID(int id); | ||
51 | }; | ||
52 | |||
53 | class DateBookHoliday | ||
54 | { | ||
55 | public: | ||
56 | DateBookHoliday(); | ||
57 | virtual ~DateBookHoliday(); | ||
58 | |||
59 | QStringList holidaylist(const QDate&); | ||
60 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); | ||
61 | protected: | ||
62 | void init(); | ||
63 | void deinit(); | ||
64 | |||
65 | struct HPlugin { | ||
66 | Opie::Datebook::HolidayPlugin*_plugin; | ||
67 | QLibrary*_lib; | ||
68 | Opie::Datebook::HolidayPluginIf*_if; | ||
69 | }; | ||
70 | QValueList<HPlugin*>_pluginlist; | ||
71 | }; | ||
72 | 41 | ||
@@ -139,3 +108,3 @@ private: | |||
139 | private: | 108 | private: |
140 | DateBookDBHack *db; | 109 | DateBookDBHoliday *db; |
141 | DateBookHoliday*db_holiday; | 110 | DateBookHoliday*db_holiday; |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index dfe39e5..00ddd05 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -21,2 +21,3 @@ | |||
21 | #include "datebookday.h" | 21 | #include "datebookday.h" |
22 | #include "datebooktypes.h" | ||
22 | #include "datebookdayheaderimpl.h" | 23 | #include "datebookdayheaderimpl.h" |
@@ -229,3 +230,3 @@ void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) | |||
229 | 230 | ||
230 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name ) | 231 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name ) |
231 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) | 232 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) |
@@ -369,3 +370,3 @@ void DateBookDay::getEvents() | |||
369 | } | 370 | } |
370 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); | 371 | QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate ); |
371 | QValueListIterator<EffectiveEvent> it; | 372 | QValueListIterator<EffectiveEvent> it; |
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index 3e44364..3b75eba 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -30,2 +30,3 @@ | |||
30 | #include "datebook.h" | 30 | #include "datebook.h" |
31 | #include "datebooktypes.h" | ||
31 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
@@ -34,2 +35,3 @@ class DateBookDayHeader; | |||
34 | class DateBookDB; | 35 | class DateBookDB; |
36 | class DateBookDBHoliday; | ||
35 | class DatebookdayAllday; | 37 | class DatebookdayAllday; |
@@ -182,3 +184,3 @@ class DateBookDay : public QVBox | |||
182 | public: | 184 | public: |
183 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb,DateBookHoliday*newHdb, | 185 | DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb,DateBookHoliday*newHdb, |
184 | QWidget *parent, const char *name ); | 186 | QWidget *parent, const char *name ); |
@@ -227,3 +229,3 @@ private: | |||
227 | DatebookdayAllday *m_allDays; | 229 | DatebookdayAllday *m_allDays; |
228 | DateBookDB *db; | 230 | DateBookDBHoliday *db; |
229 | WidgetListClass widgetList; //reimplemented QList for sorting widgets by height | 231 | WidgetListClass widgetList; //reimplemented QList for sorting widgets by height |
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 3c3f482..5b40246 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -32,3 +32,4 @@ DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const cha | |||
32 | setFrameStyle(QFrame::NoFrame|QFrame::Plain); | 32 | setFrameStyle(QFrame::NoFrame|QFrame::Plain); |
33 | setResizePolicy( QScrollView::Default ); | 33 | //setResizePolicy( QScrollView::Default ); |
34 | setResizePolicy(QScrollView::AutoOneFit); | ||
34 | setHScrollBarMode( AlwaysOff ); | 35 | setHScrollBarMode( AlwaysOff ); |
@@ -113,5 +114,9 @@ DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,co | |||
113 | m_Ev.setEvent(ev); | 114 | m_Ev.setEvent(ev); |
114 | setBackgroundColor(yellow); | ||
115 | setText(strDesc); | 115 | setText(strDesc); |
116 | setFrameStyle(QFrame::Raised|QFrame::Panel); | 116 | |
117 | setAlignment(AlignHCenter); | ||
118 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum)); | ||
119 | |||
120 | //setFrameStyle(QFrame::Raised|QFrame::Panel); | ||
121 | //setBackgroundColor(yellow); | ||
117 | 122 | ||
@@ -120,2 +125,3 @@ DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,co | |||
120 | setMinimumSize( QSize( 0, s ) ); | 125 | setMinimumSize( QSize( 0, s ) ); |
126 | |||
121 | m_holiday = true; | 127 | m_holiday = true; |
diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h new file mode 100644 index 0000000..9eb7e89 --- a/dev/null +++ b/core/pim/datebook/datebooktypes.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _DATEBOOK_TYPES_H | ||
2 | #define _DATEBOOK_TYPES_H | ||
3 | |||
4 | #include <qpe/datebookdb.h> | ||
5 | |||
6 | #include <qvaluelist.h> | ||
7 | #include <qstringlist.h> | ||
8 | |||
9 | namespace Opie { | ||
10 | namespace Datebook { | ||
11 | class HolidayPlugin; | ||
12 | class HolidayPluginIf; | ||
13 | } | ||
14 | } | ||
15 | |||
16 | class QLibrary; | ||
17 | |||
18 | class DateBookDBHack : virtual public DateBookDB { | ||
19 | public: | ||
20 | virtual ~DateBookDBHack(){} | ||
21 | Event eventByUID(int id); | ||
22 | }; | ||
23 | |||
24 | class DateBookHoliday | ||
25 | { | ||
26 | public: | ||
27 | DateBookHoliday(); | ||
28 | virtual ~DateBookHoliday(); | ||
29 | |||
30 | QStringList holidaylist(const QDate&); | ||
31 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); | ||
32 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | ||
33 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | ||
34 | |||
35 | protected: | ||
36 | void init(); | ||
37 | void deinit(); | ||
38 | |||
39 | struct HPlugin { | ||
40 | Opie::Datebook::HolidayPlugin*_plugin; | ||
41 | QLibrary*_lib; | ||
42 | Opie::Datebook::HolidayPluginIf*_if; | ||
43 | }; | ||
44 | QValueList<HPlugin*>_pluginlist; | ||
45 | }; | ||
46 | |||
47 | class DateBookDBHoliday:virtual public DateBookDBHack { | ||
48 | public: | ||
49 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} | ||
50 | virtual ~DateBookDBHoliday(){} | ||
51 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | ||
52 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | ||
53 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ); | ||
54 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start); | ||
55 | |||
56 | DateBookHoliday*db_holiday; | ||
57 | }; | ||
58 | |||
59 | #endif | ||
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index 7503751..a509d89 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -21,2 +21,3 @@ | |||
21 | #include "datebookweekheaderimpl.h" | 21 | #include "datebookweekheaderimpl.h" |
22 | #include "datebooktypes.h" | ||
22 | 23 | ||
@@ -54,3 +55,3 @@ void DateBookWeekItem::setGeometry( int x, int y, int w, int h ) | |||
54 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | 55 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, |
55 | QWidget *parent, const char *name ) | 56 | QWidget *parent, const char *name ) |
56 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), | 57 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), |
@@ -74,3 +75,3 @@ DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | |||
74 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), | 75 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), |
75 | this, SLOT(slotChangeClock(bool))); | 76 | this, SLOT(slotChangeClock(bool))); |
76 | 77 | ||
@@ -87,3 +88,3 @@ void DateBookWeekView::initNames() | |||
87 | if ( bFirst ) { | 88 | if ( bFirst ) { |
88 | if ( bOnMonday ) { | 89 | if ( bOnMonday ) { |
89 | for ( int i = 1; i<=7; i++ ) { | 90 | for ( int i = 1; i<=7; i++ ) { |
@@ -92,3 +93,3 @@ void DateBookWeekView::initNames() | |||
92 | 93 | ||
93 | } else { | 94 | } else { |
94 | header->addLabel( Calendar::nameOfDay( 7 ) ); | 95 | header->addLabel( Calendar::nameOfDay( 7 ) ); |
@@ -98,6 +99,6 @@ void DateBookWeekView::initNames() | |||
98 | } | 99 | } |
99 | bFirst = false; | 100 | bFirst = false; |
100 | } else { | 101 | } else { |
101 | // we are change things... | 102 | // we are change things... |
102 | if ( bOnMonday ) { | 103 | if ( bOnMonday ) { |
103 | for ( int i = 1; i<=7; i++ ) { | 104 | for ( int i = 1; i<=7; i++ ) { |
@@ -106,3 +107,3 @@ void DateBookWeekView::initNames() | |||
106 | 107 | ||
107 | } else { | 108 | } else { |
108 | header->setLabel( 1, Calendar::nameOfDay( 7 ) ); | 109 | header->setLabel( 1, Calendar::nameOfDay( 7 ) ); |
@@ -112,3 +113,3 @@ void DateBookWeekView::initNames() | |||
112 | 113 | ||
113 | } | 114 | } |
114 | } | 115 | } |
@@ -120,12 +121,12 @@ void DateBookWeekView::showEvents( QValueList<EffectiveEvent> &ev ) | |||
120 | { | 121 | { |
121 | items.clear(); | 122 | items.clear(); |
122 | QValueListIterator<EffectiveEvent> it; | 123 | QValueListIterator<EffectiveEvent> it; |
123 | for ( it = ev.begin(); it != ev.end(); ++it ) { | 124 | for ( it = ev.begin(); it != ev.end(); ++it ) { |
124 | DateBookWeekItem *i = new DateBookWeekItem( *it ); | 125 | DateBookWeekItem *i = new DateBookWeekItem( *it ); |
125 | if(!((i->event().end().hour()==0) && (i->event().end().minute()==0) && (i->event().startDate()!=i->event().date()))) {// Skip events ending at 00:00 starting at another day. | 126 | if(!((i->event().end().hour()==0) && (i->event().end().minute()==0) && (i->event().startDate()!=i->event().date()))) { // Skip events ending at 00:00 starting at another day. |
126 | positionItem( i ); | 127 | positionItem( i ); |
127 | items.append( i ); | 128 | items.append( i ); |
128 | } | 129 | } |
129 | } | 130 | } |
130 | viewport()->update(); | 131 | viewport()->update(); |
131 | } | 132 | } |
@@ -152,7 +153,7 @@ static inline int db_round30min( int m ) | |||
152 | if ( m < 15 ) | 153 | if ( m < 15 ) |
153 | m = 0; | 154 | m = 0; |
154 | else if ( m < 45 ) | 155 | else if ( m < 45 ) |
155 | m = 1; | 156 | m = 1; |
156 | else | 157 | else |
157 | m = 2; | 158 | m = 2; |
158 | 159 | ||
@@ -164,3 +165,3 @@ void DateBookWeekView::alterDay( int day ) | |||
164 | if ( !bOnMonday ) { | 165 | if ( !bOnMonday ) { |
165 | day--; | 166 | day--; |
166 | } | 167 | } |
@@ -186,7 +187,7 @@ void DateBookWeekView::positionItem( DateBookWeekItem *i ) | |||
186 | if ( ev.event().type() == Event::AllDay ) { | 187 | if ( ev.event().type() == Event::AllDay ) { |
187 | h = (48 * rowHeight) / 2; | 188 | h = (48 * rowHeight) / 2; |
188 | y = 0; | 189 | y = 0; |
189 | } else { | 190 | } else { |
190 | h=y2-y; | 191 | h=y2-y; |
191 | if ( h < (1*rowHeight)/2 ) h = (1*rowHeight)/2; | 192 | if ( h < (1*rowHeight)/2 ) h = (1*rowHeight)/2; |
192 | } | 193 | } |
@@ -195,6 +196,6 @@ void DateBookWeekView::positionItem( DateBookWeekItem *i ) | |||
195 | if ( !bOnMonday ) { | 196 | if ( !bOnMonday ) { |
196 | if ( dow == 7 ) | 197 | if ( dow == 7 ) |
197 | dow = 1; | 198 | dow = 1; |
198 | else | 199 | else |
199 | dow++; | 200 | dow++; |
200 | } | 201 | } |
@@ -204,5 +205,5 @@ void DateBookWeekView::positionItem( DateBookWeekItem *i ) | |||
204 | do { | 205 | do { |
205 | i->setGeometry( x, y, Width, h ); | 206 | i->setGeometry( x, y, Width, h ); |
206 | isect = intersects( i ); | 207 | isect = intersects( i ); |
207 | x += Width - 1; | 208 | x += Width - 1; |
208 | } while ( isect && x < xlim ); | 209 | } while ( isect && x < xlim ); |
@@ -220,8 +221,8 @@ DateBookWeekItem *DateBookWeekView::intersects( const DateBookWeekItem *item ) | |||
220 | for ( ; it.current(); ++it ) { | 221 | for ( ; it.current(); ++it ) { |
221 | DateBookWeekItem *i = it.current(); | 222 | DateBookWeekItem *i = it.current(); |
222 | if ( i != item ) { | 223 | if ( i != item ) { |
223 | if ( i->geometry().intersects( geom ) ) { | 224 | if ( i->geometry().intersects( geom ) ) { |
224 | return i; | 225 | return i; |
225 | } | 226 | } |
226 | } | 227 | } |
227 | } | 228 | } |
@@ -235,8 +236,8 @@ void DateBookWeekView::contentsMousePressEvent( QMouseEvent *e ) | |||
235 | for ( ; it.current(); ++it ) { | 236 | for ( ; it.current(); ++it ) { |
236 | DateBookWeekItem *i = it.current(); | 237 | DateBookWeekItem *i = it.current(); |
237 | if ( i->geometry().contains( e->pos() ) ) { | 238 | if ( i->geometry().contains( e->pos() ) ) { |
238 | showingEvent = true; | 239 | showingEvent = true; |
239 | emit signalShowEvent( i->event() ); | 240 | emit signalShowEvent( i->event() ); |
240 | break; | 241 | break; |
241 | } | 242 | } |
242 | } | 243 | } |
@@ -247,11 +248,11 @@ void DateBookWeekView::contentsMouseReleaseEvent( QMouseEvent *e ) | |||
247 | if ( showingEvent ) { | 248 | if ( showingEvent ) { |
248 | showingEvent = false; | 249 | showingEvent = false; |
249 | emit signalHideEvent(); | 250 | emit signalHideEvent(); |
250 | } else { | 251 | } else { |
251 | int d = header->sectionAt( e->pos().x() ); | 252 | int d = header->sectionAt( e->pos().x() ); |
252 | if ( d > 0 ) { | 253 | if ( d > 0 ) { |
253 | // if ( !bOnMonday ) | 254 | // if ( !bOnMonday ) |
254 | // d--; | 255 | // d--; |
255 | emit showDay( d ); | 256 | emit showDay( d ); |
256 | } | 257 | } |
257 | } | 258 | } |
@@ -264,3 +265,3 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch | |||
264 | for ( int i = 1; i <= 7; i++ ) | 265 | for ( int i = 1; i <= 7; i++ ) |
265 | p->drawLine( header->sectionPos(i)-2, cy, header->sectionPos(i)-2, cy+ch ); | 266 | p->drawLine( header->sectionPos(i)-2, cy, header->sectionPos(i)-2, cy+ch ); |
266 | 267 | ||
@@ -268,30 +269,30 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch | |||
268 | for ( int t = 0; t < 24; t++ ) { | 269 | for ( int t = 0; t < 24; t++ ) { |
269 | int y = t*rowHeight; | 270 | int y = t*rowHeight; |
270 | if ( QRect( 1, y, 20, rowHeight ).intersects( ur ) ) { | 271 | if ( QRect( 1, y, 20, rowHeight ).intersects( ur ) ) { |
271 | QString s; | 272 | QString s; |
272 | if ( ampm ) { | 273 | if ( ampm ) { |
273 | if ( t == 0 ) | 274 | if ( t == 0 ) |
274 | s = QString::number( 12 ); | 275 | s = QString::number( 12 ); |
275 | else if ( t == 12 ) | 276 | else if ( t == 12 ) |
276 | s = QString::number(12) + tr( "p" ); | 277 | s = QString::number(12) + tr( "p" ); |
277 | else if ( t > 12 ) { | 278 | else if ( t > 12 ) { |
278 | if ( t - 12 < 10 ) | 279 | if ( t - 12 < 10 ) |
279 | s = " "; | 280 | s = " "; |
280 | else | 281 | else |
281 | s = ""; | 282 | s = ""; |
282 | s += QString::number( t - 12 ) + tr("p"); | 283 | s += QString::number( t - 12 ) + tr("p"); |
283 | } else { | 284 | } else { |
284 | if ( 12 - t < 3 ) | 285 | if ( 12 - t < 3 ) |
285 | s = ""; | 286 | s = ""; |
286 | else | 287 | else |
287 | s = " "; | 288 | s = " "; |
288 | s += QString::number( t ); | 289 | s += QString::number( t ); |
289 | } | 290 | } |
290 | } else { | 291 | } else { |
291 | s = QString::number( t ); | 292 | s = QString::number( t ); |
292 | if ( s.length() == 1 ) | 293 | if ( s.length() == 1 ) |
293 | s.prepend( "0" ); | 294 | s.prepend( "0" ); |
294 | } | 295 | } |
295 | p->drawText( 1, y+p->fontMetrics().ascent()+1, s ); | 296 | p->drawText( 1, y+p->fontMetrics().ascent()+1, s ); |
296 | } | 297 | } |
297 | } | 298 | } |
@@ -300,7 +301,7 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch | |||
300 | for ( ; it.current(); ++it ) { | 301 | for ( ; it.current(); ++it ) { |
301 | DateBookWeekItem *i = it.current(); | 302 | DateBookWeekItem *i = it.current(); |
302 | if ( i->geometry().intersects( ur ) ) { | 303 | if ( i->geometry().intersects( ur ) ) { |
303 | p->setBrush( i->color() ); | 304 | p->setBrush( i->color() ); |
304 | p->drawRect( i->geometry() ); | 305 | p->drawRect( i->geometry() ); |
305 | } | 306 | } |
306 | } | 307 | } |
@@ -318,3 +319,3 @@ void DateBookWeekView::resizeEvent( QResizeEvent *e ) | |||
318 | header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(), | 319 | header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(), |
319 | visibleWidth(), header->sizeHint().height() ); | 320 | visibleWidth(), header->sizeHint().height() ); |
320 | setMargins( 0, header->sizeHint().height(), 0, 0 ); | 321 | setMargins( 0, header->sizeHint().height(), 0, 0 ); |
@@ -330,3 +331,3 @@ void DateBookWeekView::resizeEvent( QResizeEvent *e ) | |||
330 | for ( int i = 1; i < 7; i++ ) | 331 | for ( int i = 1; i < 7; i++ ) |
331 | header->resizeSection( i, sw ); | 332 | header->resizeSection( i, sw ); |
332 | header->resizeSection( 7, avail - hourWidth - sw*6 ); | 333 | header->resizeSection( 7, avail - hourWidth - sw*6 ); |
@@ -342,4 +343,4 @@ void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) | |||
342 | 343 | ||
343 | DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, | 344 | DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDBHoliday *newDB, |
344 | QWidget *parent, const char *name ) | 345 | QWidget *parent, const char *name ) |
345 | : QWidget( parent, name ), | 346 | : QWidget( parent, name ), |
@@ -350,24 +351,24 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, | |||
350 | { | 351 | { |
351 | setFocusPolicy(StrongFocus); | 352 | setFocusPolicy(StrongFocus); |
352 | QVBoxLayout *vb = new QVBoxLayout( this ); | 353 | QVBoxLayout *vb = new QVBoxLayout( this ); |
353 | header = new DateBookWeekHeader( bStartOnMonday, this ); | 354 | header = new DateBookWeekHeader( bStartOnMonday, this ); |
354 | view = new DateBookWeekView( ampm, startOnMonday, this ); | 355 | view = new DateBookWeekView( ampm, startOnMonday, this ); |
355 | vb->addWidget( header ); | 356 | vb->addWidget( header ); |
356 | vb->addWidget( view ); | 357 | vb->addWidget( view ); |
357 | 358 | ||
358 | lblDesc = new QLabel( this, "event label" ); | 359 | lblDesc = new QLabel( this, "event label" ); |
359 | lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); | 360 | lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); |
360 | lblDesc->setBackgroundColor( yellow ); | 361 | lblDesc->setBackgroundColor( yellow ); |
361 | lblDesc->hide(); | 362 | lblDesc->hide(); |
362 | 363 | ||
363 | tHide = new QTimer( this ); | 364 | tHide = new QTimer( this ); |
364 | 365 | ||
365 | connect( view, SIGNAL( showDay(int) ), this, SLOT( showDay(int) ) ); | 366 | connect( view, SIGNAL( showDay(int) ), this, SLOT( showDay(int) ) ); |
366 | connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) ); | 367 | connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) ); |
367 | connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) ); | 368 | connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) ); |
368 | connect( header, SIGNAL( dateChanged(QDate&) ), this, SLOT( dateChanged(QDate&) ) ); | 369 | connect( header, SIGNAL( dateChanged(QDate&) ), this, SLOT( dateChanged(QDate&) ) ); |
369 | connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) ); | 370 | connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) ); |
370 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); | 371 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); |
371 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool))); | 372 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool))); |
372 | setDate(QDate::currentDate()); | 373 | setDate(QDate::currentDate()); |
373 | } | 374 | } |
@@ -377,16 +378,16 @@ void DateBookWeek::keyPressEvent(QKeyEvent *e) | |||
377 | switch(e->key()) { | 378 | switch(e->key()) { |
378 | case Key_Up: | 379 | case Key_Up: |
379 | view->scrollBy(0, -20); | 380 | view->scrollBy(0, -20); |
380 | break; | 381 | break; |
381 | case Key_Down: | 382 | case Key_Down: |
382 | view->scrollBy(0, 20); | 383 | view->scrollBy(0, 20); |
383 | break; | 384 | break; |
384 | case Key_Left: | 385 | case Key_Left: |
385 | setDate(date().addDays(-7)); | 386 | setDate(date().addDays(-7)); |
386 | break; | 387 | break; |
387 | case Key_Right: | 388 | case Key_Right: |
388 | setDate(date().addDays(7)); | 389 | setDate(date().addDays(7)); |
389 | break; | 390 | break; |
390 | default: | 391 | default: |
391 | e->ignore(); | 392 | e->ignore(); |
392 | } | 393 | } |
@@ -396,12 +397,12 @@ void DateBookWeek::showDay( int day ) | |||
396 | { | 397 | { |
397 | QDate d=bdate; | 398 | QDate d=bdate; |
398 | 399 | ||
399 | // Calculate offset to first day of week. | 400 | // Calculate offset to first day of week. |
400 | int dayoffset=d.dayOfWeek() % 7; | 401 | int dayoffset=d.dayOfWeek() % 7; |
401 | 402 | ||
402 | if(bStartOnMonday) dayoffset--; | 403 | if(bStartOnMonday) dayoffset--; |
403 | 404 | ||
404 | day--; | 405 | day--; |
405 | d=d.addDays(day-dayoffset); | 406 | d=d.addDays(day-dayoffset); |
406 | emit showDate( d.year(), d.month(), d.day() ); | 407 | emit showDate( d.year(), d.month(), d.day() ); |
407 | } | 408 | } |
@@ -410,3 +411,3 @@ void DateBookWeek::setDate( int y, int m, int d ) | |||
410 | { | 411 | { |
411 | setDate(QDate(y, m, d)); | 412 | setDate(QDate(y, m, d)); |
412 | } | 413 | } |
@@ -415,5 +416,5 @@ void DateBookWeek::setDate(QDate newdate) | |||
415 | { | 416 | { |
416 | bdate=newdate; | 417 | bdate=newdate; |
417 | dow = newdate.dayOfWeek(); | 418 | dow = newdate.dayOfWeek(); |
418 | header->setDate( newdate ); | 419 | header->setDate( newdate ); |
419 | } | 420 | } |
@@ -422,4 +423,4 @@ void DateBookWeek::dateChanged( QDate &newdate ) | |||
422 | { | 423 | { |
423 | bdate=newdate; | 424 | bdate=newdate; |
424 | getEvents(); | 425 | getEvents(); |
425 | } | 426 | } |
@@ -428,3 +429,3 @@ QDate DateBookWeek::date() const | |||
428 | { | 429 | { |
429 | return bdate; | 430 | return bdate; |
430 | } | 431 | } |
@@ -433,8 +434,8 @@ void DateBookWeek::getEvents() | |||
433 | { | 434 | { |
434 | QDate startWeek = weekDate(); | 435 | QDate startWeek = weekDate(); |
435 | 436 | ||
436 | QDate endWeek = startWeek.addDays( 6 ); | 437 | QDate endWeek = startWeek.addDays( 6 ); |
437 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek); | 438 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek); |
438 | view->showEvents( eventList ); | 439 | view->showEvents( eventList ); |
439 | view->moveToHour( startTime ); | 440 | view->moveToHour( startTime ); |
440 | } | 441 | } |
@@ -442,3 +443,3 @@ void DateBookWeek::getEvents() | |||
442 | void DateBookWeek::generateAllDayTooltext( QString& text ) { | 443 | void DateBookWeek::generateAllDayTooltext( QString& text ) { |
443 | text += "<b>" + tr("This is an all day event.") + "</b><br>"; | 444 | text += "<b>" + tr("This is an all day event.") + "</b><br>"; |
444 | } | 445 | } |
@@ -446,13 +447,13 @@ void DateBookWeek::generateAllDayTooltext( QString& text ) { | |||
446 | void DateBookWeek::generateNormalTooltext( QString& str, const EffectiveEvent &ev ) { | 447 | void DateBookWeek::generateNormalTooltext( QString& str, const EffectiveEvent &ev ) { |
447 | str += "<b>" + QObject::tr("Start") + "</b>: "; | 448 | str += "<b>" + QObject::tr("Start") + "</b>: "; |
448 | str += TimeString::timeString( ev.event().start().time(), ampm, FALSE ); | 449 | str += TimeString::timeString( ev.event().start().time(), ampm, FALSE ); |
449 | if( ev.startDate()!=ev.endDate() ) { | 450 | if( ev.startDate()!=ev.endDate() ) { |
450 | str += " <i>" + TimeString::longDateString( ev.startDate() )+"</i>"; | 451 | str += " <i>" + TimeString::longDateString( ev.startDate() )+"</i>"; |
451 | } | 452 | } |
452 | str += "<br>"; | 453 | str += "<br>"; |
453 | str += "<b>" + QObject::tr("End") + "</b>: "; | 454 | str += "<b>" + QObject::tr("End") + "</b>: "; |
454 | str += TimeString::timeString( ev.event().end().time(), ampm, FALSE ); | 455 | str += TimeString::timeString( ev.event().end().time(), ampm, FALSE ); |
455 | if( ev.startDate()!=ev.endDate() ) { | 456 | if( ev.startDate()!=ev.endDate() ) { |
456 | str += " <i>" + TimeString::longDateString( ev.endDate() ) + "</i>"; | 457 | str += " <i>" + TimeString::longDateString( ev.endDate() ) + "</i>"; |
457 | } | 458 | } |
458 | } | 459 | } |
@@ -469,5 +470,5 @@ void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) | |||
469 | while ( where != -1 ) { | 470 | while ( where != -1 ) { |
470 | strDesc.remove( where, 1 ); | 471 | strDesc.remove( where, 1 ); |
471 | strDesc.insert( where, "<" ); | 472 | strDesc.insert( where, "<" ); |
472 | where = strDesc.find( "<", where ); | 473 | where = strDesc.find( "<", where ); |
473 | } | 474 | } |
@@ -479,5 +480,5 @@ void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) | |||
479 | // while ( where != -1 ) { | 480 | // while ( where != -1 ) { |
480 | // strCat.remove( where, 1 ); | 481 | // strCat.remove( where, 1 ); |
481 | // strCat.insert( where, "<" ); | 482 | // strCat.insert( where, "<" ); |
482 | // where = strCat.find( "<", where ); | 483 | // where = strCat.find( "<", where ); |
483 | // } | 484 | // } |
@@ -486,5 +487,5 @@ void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) | |||
486 | while ( where != -1 ) { | 487 | while ( where != -1 ) { |
487 | strLocation.remove( where, 1 ); | 488 | strLocation.remove( where, 1 ); |
488 | strLocation.insert( where, "<" ); | 489 | strLocation.insert( where, "<" ); |
489 | where = strLocation.find( "<", where ); | 490 | where = strLocation.find( "<", where ); |
490 | } | 491 | } |
@@ -494,5 +495,5 @@ void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) | |||
494 | while ( where != -1 ) { | 495 | while ( where != -1 ) { |
495 | strNote.remove( where, 1 ); | 496 | strNote.remove( where, 1 ); |
496 | strNote.insert( where, "<" ); | 497 | strNote.insert( where, "<" ); |
497 | where = strNote.find( "<", where ); | 498 | where = strNote.find( "<", where ); |
498 | } | 499 | } |
@@ -503,3 +504,3 @@ void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) | |||
503 | + "<br>" + TimeString::longDateString( ev.date() ) | 504 | + "<br>" + TimeString::longDateString( ev.date() ) |
504 | + "<br>"; | 505 | + "<br>"; |
505 | 506 | ||
@@ -542,10 +543,10 @@ void DateBookWeek::slotYearChanged( int y ) | |||
542 | { | 543 | { |
543 | int totWeek; | 544 | int totWeek; |
544 | QDate d( y, 12, 31 ); | 545 | QDate d( y, 12, 31 ); |
545 | int throwAway; | 546 | int throwAway; |
546 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); | 547 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); |
547 | while ( totWeek == 1 ) { | 548 | while ( totWeek == 1 ) { |
548 | d = d.addDays( -1 ); | 549 | d = d.addDays( -1 ); |
549 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); | 550 | calcWeek( d, totWeek, throwAway, bStartOnMonday ); |
550 | } | 551 | } |
551 | } | 552 | } |
@@ -554,6 +555,6 @@ void DateBookWeek::slotWeekChanged( bool onMonday ) | |||
554 | { | 555 | { |
555 | bStartOnMonday = onMonday; | 556 | bStartOnMonday = onMonday; |
556 | view->setStartOfWeek( bStartOnMonday ); | 557 | view->setStartOfWeek( bStartOnMonday ); |
557 | header->setStartOfWeek( bStartOnMonday ); | 558 | header->setStartOfWeek( bStartOnMonday ); |
558 | redraw(); | 559 | redraw(); |
559 | } | 560 | } |
@@ -562,3 +563,3 @@ void DateBookWeek::slotClockChanged( bool ap ) | |||
562 | { | 563 | { |
563 | ampm = ap; | 564 | ampm = ap; |
564 | } | 565 | } |
@@ -568,11 +569,11 @@ QDate DateBookWeek::weekDate() const | |||
568 | { | 569 | { |
569 | QDate d=bdate; | 570 | QDate d=bdate; |
570 | 571 | ||
571 | // Calculate offset to first day of week. | 572 | // Calculate offset to first day of week. |
572 | int dayoffset=d.dayOfWeek(); | 573 | int dayoffset=d.dayOfWeek(); |
573 | if(bStartOnMonday) dayoffset--; | 574 | if(bStartOnMonday) dayoffset--; |
574 | else if( dayoffset == 7 ) | 575 | else if( dayoffset == 7 ) |
575 | dayoffset = 0; | 576 | dayoffset = 0; |
576 | 577 | ||
577 | return d.addDays(-dayoffset); | 578 | return d.addDays(-dayoffset); |
578 | } | 579 | } |
@@ -602,3 +603,3 @@ QDate DateBookWeek::weekDate() const | |||
602 | bool calcWeek( const QDate &d, int &week, int &year, | 603 | bool calcWeek( const QDate &d, int &week, int &year, |
603 | bool startOnMonday ) | 604 | bool startOnMonday ) |
604 | { | 605 | { |
@@ -613,58 +614,58 @@ bool calcWeek( const QDate &d, int &week, int &year, | |||
613 | if ( !d.isValid() ) | 614 | if ( !d.isValid() ) |
614 | return false; | 615 | return false; |
615 | 616 | ||
616 | if ( startOnMonday ) { | 617 | if ( startOnMonday ) { |
617 | // find the Jan1Weekday; | 618 | // find the Jan1Weekday; |
618 | if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { | 619 | if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { |
619 | yearNumber = d.year() - 1; | 620 | yearNumber = d.year() - 1; |
620 | if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) | 621 | if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) |
621 | weekNumber = 53; | 622 | weekNumber = 53; |
622 | else | 623 | else |
623 | weekNumber = 52; | 624 | weekNumber = 52; |
624 | } else | 625 | } else |
625 | yearNumber = d.year(); | 626 | yearNumber = d.year(); |
626 | if ( yearNumber == d.year() ) { | 627 | if ( yearNumber == d.year() ) { |
627 | int totalDays = 365; | 628 | int totalDays = 365; |
628 | if ( QDate::leapYear(yearNumber) ) | 629 | if ( QDate::leapYear(yearNumber) ) |
629 | totalDays++; | 630 | totalDays++; |
630 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) | 631 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) |
631 | || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { | 632 | || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { |
632 | yearNumber++; | 633 | yearNumber++; |
633 | weekNumber = 1; | 634 | weekNumber = 1; |
634 | } | 635 | } |
635 | } | 636 | } |
636 | if ( yearNumber == d.year() ) { | 637 | if ( yearNumber == d.year() ) { |
637 | int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); | 638 | int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); |
638 | weekNumber = j / 7; | 639 | weekNumber = j / 7; |
639 | if ( jan1WeekDay > 4 ) | 640 | if ( jan1WeekDay > 4 ) |
640 | weekNumber--; | 641 | weekNumber--; |
641 | } | 642 | } |
642 | } else { | 643 | } else { |
643 | // it's better to keep these cases separate... | 644 | // it's better to keep these cases separate... |
644 | if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 | 645 | if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 |
645 | && jan1WeekDay != 7 ) { | 646 | && jan1WeekDay != 7 ) { |
646 | yearNumber = d.year() - 1; | 647 | yearNumber = d.year() - 1; |
647 | if ( jan1WeekDay == 6 | 648 | if ( jan1WeekDay == 6 |
648 | || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { | 649 | || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { |
649 | weekNumber = 53; | 650 | weekNumber = 53; |
650 | }else | 651 | }else |
651 | weekNumber = 52; | 652 | weekNumber = 52; |
652 | } else | 653 | } else |
653 | yearNumber = d.year(); | 654 | yearNumber = d.year(); |
654 | if ( yearNumber == d.year() ) { | 655 | if ( yearNumber == d.year() ) { |
655 | int totalDays = 365; | 656 | int totalDays = 365; |
656 | if ( QDate::leapYear( yearNumber ) ) | 657 | if ( QDate::leapYear( yearNumber ) ) |
657 | totalDays++; | 658 | totalDays++; |
658 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek % 7)) ) { | 659 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek % 7)) ) { |
659 | yearNumber++; | 660 | yearNumber++; |
660 | weekNumber = 1; | 661 | weekNumber = 1; |
661 | } | 662 | } |
662 | } | 663 | } |
663 | if ( yearNumber == d.year() ) { | 664 | if ( yearNumber == d.year() ) { |
664 | int j = d.dayOfYear() + (7 - dayOfWeek % 7) + ( jan1WeekDay - 1 ); | 665 | int j = d.dayOfYear() + (7 - dayOfWeek % 7) + ( jan1WeekDay - 1 ); |
665 | weekNumber = j / 7; | 666 | weekNumber = j / 7; |
666 | if ( jan1WeekDay > 4 ) { | 667 | if ( jan1WeekDay > 4 ) { |
667 | weekNumber--; | 668 | weekNumber--; |
668 | } | 669 | } |
669 | } | 670 | } |
670 | } | 671 | } |
diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h index c273e30..ddf54ed 100644 --- a/core/pim/datebook/datebookweek.h +++ b/core/pim/datebook/datebookweek.h | |||
@@ -30,2 +30,3 @@ | |||
30 | class DateBookDB; | 30 | class DateBookDB; |
31 | class DateBookDBHoliday; | ||
31 | class DateBookWeekHeader; | 32 | class DateBookWeekHeader; |
@@ -60,3 +61,3 @@ public: | |||
60 | DateBookWeekView( bool ampm, bool weekOnMonday, QWidget *parent = 0, | 61 | DateBookWeekView( bool ampm, bool weekOnMonday, QWidget *parent = 0, |
61 | const char *name = 0 ); | 62 | const char *name = 0 ); |
62 | 63 | ||
@@ -102,4 +103,4 @@ class DateBookWeek : public QWidget | |||
102 | public: | 103 | public: |
103 | DateBookWeek( bool ampm, bool weekOnMonday, DateBookDB *newDB, | 104 | DateBookWeek( bool ampm, bool weekOnMonday, DateBookDBHoliday *newDB, |
104 | QWidget *parent = 0, const char *name = 0 ); | 105 | QWidget *parent = 0, const char *name = 0 ); |
105 | void setDate( int y, int m, int d ); | 106 | void setDate( int y, int m, int d ); |
@@ -155,3 +156,3 @@ private: | |||
155 | DateBookWeekView *view; | 156 | DateBookWeekView *view; |
156 | DateBookDB *db; | 157 | DateBookDBHoliday *db; |
157 | QLabel *lblDesc; | 158 | QLabel *lblDesc; |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 771aa00..0555bc7 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -4,2 +4,3 @@ | |||
4 | #include "datebook.h" | 4 | #include "datebook.h" |
5 | #include "datebooktypes.h" | ||
5 | 6 | ||
@@ -22,24 +23,24 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const ch | |||
22 | { | 23 | { |
23 | setBackgroundMode( PaletteButton ); | 24 | setBackgroundMode( PaletteButton ); |
24 | labelDate->setBackgroundMode( PaletteButton ); | 25 | labelDate->setBackgroundMode( PaletteButton ); |
25 | forwardweek->setBackgroundMode( PaletteButton ); | 26 | forwardweek->setBackgroundMode( PaletteButton ); |
26 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | 27 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); |
27 | forwardmonth->setBackgroundMode( PaletteButton ); | 28 | forwardmonth->setBackgroundMode( PaletteButton ); |
28 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | 29 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); |
29 | backweek->setBackgroundMode( PaletteButton ); | 30 | backweek->setBackgroundMode( PaletteButton ); |
30 | backweek->setPixmap( Resource::loadPixmap("back") ); | 31 | backweek->setPixmap( Resource::loadPixmap("back") ); |
31 | backmonth->setBackgroundMode( PaletteButton ); | 32 | backmonth->setBackgroundMode( PaletteButton ); |
32 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | 33 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); |
33 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | 34 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); |
34 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | 35 | DateBookWeekLstHeaderBaseLayout->setMargin(0); |
35 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | 36 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); |
36 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 37 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
37 | 38 | ||
38 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); | 39 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); |
39 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); | 40 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); |
40 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); | 41 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); |
41 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); | 42 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); |
42 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); | 43 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); |
43 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 44 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
44 | bStartOnMonday=onM; | 45 | bStartOnMonday=onM; |
45 | } | 46 | } |
@@ -48,23 +49,23 @@ DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | |||
48 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 49 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
49 | int year,week,dayofweek; | 50 | int year,week,dayofweek; |
50 | date=d; | 51 | date=d; |
51 | dayofweek=d.dayOfWeek(); | 52 | dayofweek=d.dayOfWeek(); |
52 | if(bStartOnMonday) | 53 | if(bStartOnMonday) |
53 | dayofweek--; | 54 | dayofweek--; |
54 | else if( dayofweek == 7 ) | 55 | else if( dayofweek == 7 ) |
55 | /* we already have the right day -7 would lead to the same week */ | 56 | /* we already have the right day -7 would lead to the same week */ |
56 | dayofweek = 0; | 57 | dayofweek = 0; |
57 | 58 | ||
58 | date=date.addDays(-dayofweek); | 59 | date=date.addDays(-dayofweek); |
59 | 60 | ||
60 | calcWeek(date,week,year,bStartOnMonday); | 61 | calcWeek(date,week,year,bStartOnMonday); |
61 | QDate start=date; | 62 | QDate start=date; |
62 | QDate stop=start.addDays(6); | 63 | QDate stop=start.addDays(6); |
63 | labelDate->setText( QString::number(start.day()) + "." + | 64 | labelDate->setText( QString::number(start.day()) + "." + |
64 | Calendar::nameOfMonth( start.month() ) + "-" + | 65 | Calendar::nameOfMonth( start.month() ) + "-" + |
65 | QString::number(stop.day()) + "." + | 66 | QString::number(stop.day()) + "." + |
66 | Calendar::nameOfMonth( stop.month()) +" ("+ | 67 | Calendar::nameOfMonth( stop.month()) +" ("+ |
67 | tr("w")+":"+QString::number( week ) +")"); | 68 | tr("w")+":"+QString::number( week ) +")"); |
68 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! | 69 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! |
69 | emit dateChanged(date); | 70 | emit dateChanged(date); |
70 | } | 71 | } |
@@ -72,18 +73,18 @@ void DateBookWeekLstHeader::setDate(const QDate &d) { | |||
72 | void DateBookWeekLstHeader::pickDate() { | 73 | void DateBookWeekLstHeader::pickDate() { |
73 | static QPopupMenu *m1 = 0; | 74 | static QPopupMenu *m1 = 0; |
74 | static DateBookMonth *picker = 0; | 75 | static DateBookMonth *picker = 0; |
75 | if ( !m1 ) { | 76 | if ( !m1 ) { |
76 | m1 = new QPopupMenu( this ); | 77 | m1 = new QPopupMenu( this ); |
77 | picker = new DateBookMonth( m1, 0, TRUE ); | 78 | picker = new DateBookMonth( m1, 0, TRUE ); |
78 | m1->insertItem( picker ); | 79 | m1->insertItem( picker ); |
79 | connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); | 80 | connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); |
80 | //connect( m1, SIGNAL( aboutToHide() ), | 81 | //connect( m1, SIGNAL( aboutToHide() ), |
81 | //this, SLOT( gotHide() ) ); | 82 | //this, SLOT( gotHide() ) ); |
82 | } | 83 | } |
83 | picker->setDate( date.year(), date.month(), date.day() ); | 84 | picker->setDate( date.year(), date.month(), date.day() ); |
84 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 85 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
85 | picker->setFocus(); | 86 | picker->setFocus(); |
86 | } | 87 | } |
87 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 88 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
88 | setDate(QDate(y,m,d)); | 89 | setDate(QDate(y,m,d)); |
89 | } | 90 | } |
@@ -91,6 +92,6 @@ void DateBookWeekLstHeader::setDate(int y, int m, int d) { | |||
91 | void DateBookWeekLstHeader::nextWeek() { | 92 | void DateBookWeekLstHeader::nextWeek() { |
92 | setDate(date.addDays(7)); | 93 | setDate(date.addDays(7)); |
93 | } | 94 | } |
94 | void DateBookWeekLstHeader::prevWeek() { | 95 | void DateBookWeekLstHeader::prevWeek() { |
95 | setDate(date.addDays(-7)); | 96 | setDate(date.addDays(-7)); |
96 | } | 97 | } |
@@ -98,3 +99,3 @@ void DateBookWeekLstHeader::nextMonth() | |||
98 | { | 99 | { |
99 | setDate(date.addDays(28)); | 100 | setDate(date.addDays(28)); |
100 | } | 101 | } |
@@ -102,3 +103,3 @@ void DateBookWeekLstHeader::prevMonth() | |||
102 | { | 103 | { |
103 | setDate(date.addDays(-28)); | 104 | setDate(date.addDays(-28)); |
104 | } | 105 | } |
@@ -106,14 +107,14 @@ void DateBookWeekLstHeader::prevMonth() | |||
106 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | 107 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, |
107 | QWidget* parent, | 108 | QWidget* parent, |
108 | const char* name, | 109 | const char* name, |
109 | WFlags fl ) | 110 | WFlags fl ) |
110 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 111 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
111 | 112 | ||
112 | date=d; | 113 | date=d; |
113 | 114 | ||
114 | static const QString wdays=tr("MTWTFSSM", "Week days"); | 115 | static const QString wdays=tr("MTWTFSSM", "Week days"); |
115 | char day=wdays[d.dayOfWeek()-1]; | 116 | char day=wdays[d.dayOfWeek()-1]; |
116 | 117 | ||
117 | //dont use dayOfWeek() to save space ! | 118 | //dont use dayOfWeek() to save space ! |
118 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); | 119 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); |
119 | 120 | ||
@@ -121,21 +122,21 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | |||
121 | 122 | ||
122 | if (d == QDate::currentDate()) { | 123 | if (d == QDate::currentDate()) { |
123 | QPalette pal=label->palette(); | 124 | QPalette pal=label->palette(); |
124 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | 125 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); |
125 | label->setPalette(pal); | 126 | label->setPalette(pal); |
126 | 127 | ||
127 | /* | 128 | /* |
128 | QFont f=label->font(); | 129 | QFont f=label->font(); |
129 | f.setItalic(true); | 130 | f.setItalic(true); |
130 | label->setFont(f); | 131 | label->setFont(f); |
131 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | 132 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); |
132 | */ | 133 | */ |
133 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 134 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
134 | QPalette pal=label->palette(); | 135 | QPalette pal=label->palette(); |
135 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 136 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
136 | label->setPalette(pal); | 137 | label->setPalette(pal); |
137 | } | 138 | } |
138 | 139 | ||
139 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 140 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
140 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 141 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
141 | } | 142 | } |
@@ -143,3 +144,3 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | |||
143 | void DateBookWeekLstDayHdr::showDay() { | 144 | void DateBookWeekLstDayHdr::showDay() { |
144 | emit showDate(date.year(), date.month(), date.day()); | 145 | emit showDate(date.year(), date.month(), date.day()); |
145 | } | 146 | } |
@@ -155,47 +156,47 @@ void DateBookWeekLstDayHdr::newEvent() { | |||
155 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 156 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
156 | int weeklistviewconfig, | 157 | int weeklistviewconfig, |
157 | QWidget* parent, | 158 | QWidget* parent, |
158 | const char* name, | 159 | const char* name, |
159 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | 160 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) |
160 | { | 161 | { |
161 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | 162 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
162 | QString s,start,middle,end,day; | 163 | QString s,start,middle,end,day; |
163 | 164 | ||
164 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; | 165 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; |
165 | if(weeklistviewconfig==NONE) {// No times displayed. | 166 | if(weeklistviewconfig==NONE) { // No times displayed. |
166 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 167 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
167 | // middle.sprintf("<--->"); | 168 | // middle.sprintf("<--->"); |
168 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 169 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
169 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 170 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
170 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. | 171 | } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. |
171 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 172 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
172 | middle.sprintf(" |---"); | 173 | middle.sprintf(" |---"); |
173 | end.sprintf("__|__"); | 174 | end.sprintf("__|__"); |
174 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 175 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
175 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | 176 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. |
176 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 177 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
177 | middle.sprintf("<--->"); | 178 | middle.sprintf("<--->"); |
178 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 179 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
179 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 180 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
180 | } | 181 | } |
181 | 182 | ||
182 | if(ev.event().type() == Event::Normal) { | 183 | if(ev.event().type() == Event::Normal) { |
183 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. | 184 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event. |
184 | s=day; | 185 | s=day; |
185 | } else if(ev.startDate()==ev.date()) {// start event. | 186 | } else if(ev.startDate()==ev.date()) { // start event. |
186 | s=start; | 187 | s=start; |
187 | } else if(ev.endDate()==ev.date()) { // end event. | 188 | } else if(ev.endDate()==ev.date()) { // end event. |
188 | s=end; | 189 | s=end; |
189 | } else {// middle day. | 190 | } else { // middle day. |
190 | s=middle; | 191 | s=middle; |
191 | } | 192 | } |
192 | } else { | 193 | } else { |
193 | s=""; | 194 | s=""; |
194 | } | 195 | } |
195 | setText(QString(s) + " " + ev.description()); | 196 | setText(QString(s) + " " + ev.description()); |
196 | //connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 197 | // connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
197 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 198 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
198 | } | 199 | } |
199 | void DateBookWeekLstEvent::editMe() { | 200 | void DateBookWeekLstEvent::editMe() { |
200 | emit editEvent(event.event()); | 201 | emit editEvent(event.event()); |
201 | } | 202 | } |
@@ -212,3 +213,3 @@ void DateBookWeekLstEvent::beamMe() | |||
212 | { | 213 | { |
213 | emit beamEvent( event.event() ); | 214 | emit beamEvent( event.event() ); |
214 | } | 215 | } |
@@ -216,9 +217,9 @@ void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | |||
216 | { | 217 | { |
217 | popmenue = new QPopupMenu; | 218 | popmenue = new QPopupMenu; |
218 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); | 219 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); |
219 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); | 220 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); |
220 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); | 221 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); |
221 | if(Ir::supported()) | 222 | if(Ir::supported()) |
222 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); | 223 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); |
223 | popmenue->popup( mapToGlobal( e->pos() )); | 224 | popmenue->popup( mapToGlobal( e->pos() )); |
224 | } | 225 | } |
@@ -226,57 +227,57 @@ void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | |||
226 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 227 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
227 | const QDate &d, bool onM, | 228 | const QDate &d, bool onM, |
228 | QWidget* parent, | 229 | QWidget* parent, |
229 | const char* name, WFlags fl) | 230 | const char* name, WFlags fl) |
230 | : QWidget( parent, name, fl ) | 231 | : QWidget( parent, name, fl ) |
231 | { | 232 | { |
232 | Config config("DateBook"); | 233 | Config config("DateBook"); |
233 | config.setGroup("Main"); | 234 | config.setGroup("Main"); |
234 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); | 235 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); |
235 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; | 236 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; |
236 | 237 | ||
237 | bStartOnMonday=onM; | 238 | bStartOnMonday=onM; |
238 | setPalette(white); | 239 | setPalette(white); |
239 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 240 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
240 | 241 | ||
241 | QVBoxLayout *layout = new QVBoxLayout( this ); | 242 | QVBoxLayout *layout = new QVBoxLayout( this ); |
242 | 243 | ||
243 | qBubbleSort(ev); | 244 | qBubbleSort(ev); |
244 | QValueListIterator<EffectiveEvent> it; | 245 | QValueListIterator<EffectiveEvent> it; |
245 | it=ev.begin(); | 246 | it=ev.begin(); |
246 | 247 | ||
247 | int dayOrder[7]; | 248 | int dayOrder[7]; |
248 | if (bStartOnMonday) { | 249 | if (bStartOnMonday) { |
249 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 250 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
250 | } else { | 251 | } else { |
251 | for (int d=0; d<7; d++) dayOrder[d]=d; | 252 | for (int d=0; d<7; d++) dayOrder[d]=d; |
252 | dayOrder[0]=7; | 253 | dayOrder[0]=7; |
253 | } | 254 | } |
254 | 255 | ||
255 | // Calculate offset to first day of week. | 256 | // Calculate offset to first day of week. |
256 | int dayoffset=d.dayOfWeek(); | 257 | int dayoffset=d.dayOfWeek(); |
257 | if(bStartOnMonday) dayoffset--; | 258 | if(bStartOnMonday) dayoffset--; |
258 | else if( dayoffset == 7 ) dayoffset = 0; | 259 | else if( dayoffset == 7 ) dayoffset = 0; |
259 | 260 | ||
260 | for (int i=0; i<7; i++) { | 261 | for (int i=0; i<7; i++) { |
261 | // Header | 262 | // Header |
262 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); | 263 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); |
263 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 264 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
264 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 265 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
265 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 266 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
266 | layout->addWidget(hdr); | 267 | layout->addWidget(hdr); |
267 | 268 | ||
268 | // Events | 269 | // Events |
269 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | 270 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { |
270 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. | 271 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. |
271 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); | 272 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); |
272 | layout->addWidget(l); | 273 | layout->addWidget(l); |
273 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 274 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
274 | connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 275 | connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
275 | connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 276 | connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
276 | connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 277 | connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
277 | connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); | 278 | connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); |
278 | } | 279 | } |
279 | it++; | 280 | it++; |
280 | } | 281 | } |
281 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 282 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
282 | } | 283 | } |
@@ -287,37 +288,37 @@ void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | |||
287 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 288 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
288 | QValueList<EffectiveEvent> &ev2, | 289 | QValueList<EffectiveEvent> &ev2, |
289 | QDate &d, bool onM, | 290 | QDate &d, bool onM, |
290 | QWidget* parent, | 291 | QWidget* parent, |
291 | const char* name, WFlags fl) | 292 | const char* name, WFlags fl) |
292 | : QWidget( parent, name, fl ) | 293 | : QWidget( parent, name, fl ) |
293 | { | 294 | { |
294 | QHBoxLayout *layout = new QHBoxLayout( this ); | 295 | QHBoxLayout *layout = new QHBoxLayout( this ); |
295 | 296 | ||
296 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | 297 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); |
297 | layout->addWidget(w); | 298 | layout->addWidget(w); |
298 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 299 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
299 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 300 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
300 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 301 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
301 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 302 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
302 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | 303 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); |
303 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 304 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
304 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 305 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
305 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 306 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
306 | 307 | ||
307 | 308 | ||
308 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | 309 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); |
309 | layout->addWidget(w); | 310 | layout->addWidget(w); |
310 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 311 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
311 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 312 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
312 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 313 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
313 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 314 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
314 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | 315 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); |
315 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 316 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
316 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 317 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
317 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 318 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
318 | } | 319 | } |
319 | 320 | ||
320 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | 321 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, |
321 | QWidget *parent, | 322 | QWidget *parent, |
322 | const char *name ) | 323 | const char *name ) |
323 | : QWidget( parent, name ), | 324 | : QWidget( parent, name ), |
@@ -328,25 +329,25 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | |||
328 | { | 329 | { |
329 | setFocusPolicy(StrongFocus); | 330 | setFocusPolicy(StrongFocus); |
330 | layout = new QVBoxLayout( this ); | 331 | layout = new QVBoxLayout( this ); |
331 | layout->setMargin(0); | 332 | layout->setMargin(0); |
332 | 333 | ||
333 | header=new DateBookWeekLstHeader(onM, this); | 334 | header=new DateBookWeekLstHeader(onM, this); |
334 | layout->addWidget( header ); | 335 | layout->addWidget( header ); |
335 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); | 336 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); |
336 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); | 337 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); |
337 | 338 | ||
338 | scroll=new QScrollView(this); | 339 | scroll=new QScrollView(this); |
339 | scroll->setResizePolicy(QScrollView::AutoOneFit); | 340 | scroll->setResizePolicy(QScrollView::AutoOneFit); |
340 | layout->addWidget(scroll); | 341 | layout->addWidget(scroll); |
341 | 342 | ||
342 | view=NULL; | 343 | view=NULL; |
343 | Config config("DateBook"); | 344 | Config config("DateBook"); |
344 | config.setGroup("Main"); | 345 | config.setGroup("Main"); |
345 | dbl=config.readBoolEntry("weeklst_dbl", false); | 346 | dbl=config.readBoolEntry("weeklst_dbl", false); |
346 | header->dbl->setOn(dbl); | 347 | header->dbl->setOn(dbl); |
347 | } | 348 | } |
348 | DateBookWeekLst::~DateBookWeekLst(){ | 349 | DateBookWeekLst::~DateBookWeekLst(){ |
349 | Config config("DateBook"); | 350 | Config config("DateBook"); |
350 | config.setGroup("Main"); | 351 | config.setGroup("Main"); |
351 | config.writeEntry("weeklst_dbl", dbl); | 352 | config.writeEntry("weeklst_dbl", dbl); |
352 | } | 353 | } |
@@ -354,4 +355,4 @@ DateBookWeekLst::~DateBookWeekLst(){ | |||
354 | void DateBookWeekLst::setDate(const QDate &d) { | 355 | void DateBookWeekLst::setDate(const QDate &d) { |
355 | bdate=d; | 356 | bdate=d; |
356 | header->setDate(d); | 357 | header->setDate(d); |
357 | } | 358 | } |
@@ -359,4 +360,4 @@ void DateBookWeekLst::setDate(const QDate &d) { | |||
359 | void DateBookWeekLst::setDbl(bool on) { | 360 | void DateBookWeekLst::setDbl(bool on) { |
360 | dbl=on; | 361 | dbl=on; |
361 | redraw(); | 362 | redraw(); |
362 | } | 363 | } |
@@ -365,3 +366,3 @@ void DateBookWeekLst::redraw() {getEvents();} | |||
365 | QDate DateBookWeekLst::date() { | 366 | QDate DateBookWeekLst::date() { |
366 | return bdate; | 367 | return bdate; |
367 | } | 368 | } |
@@ -372,11 +373,11 @@ QDate DateBookWeekLst::weekDate() const | |||
372 | { | 373 | { |
373 | QDate d=bdate; | 374 | QDate d=bdate; |
374 | 375 | ||
375 | // Calculate offset to first day of week. | 376 | // Calculate offset to first day of week. |
376 | int dayoffset=d.dayOfWeek(); | 377 | int dayoffset=d.dayOfWeek(); |
377 | if(bStartOnMonday) dayoffset--; | 378 | if(bStartOnMonday) dayoffset--; |
378 | else if( dayoffset == 7 ) | 379 | else if( dayoffset == 7 ) |
379 | dayoffset = 0; | 380 | dayoffset = 0; |
380 | 381 | ||
381 | return d.addDays(-dayoffset); | 382 | return d.addDays(-dayoffset); |
382 | } | 383 | } |
@@ -384,28 +385,28 @@ QDate DateBookWeekLst::weekDate() const | |||
384 | void DateBookWeekLst::getEvents() { | 385 | void DateBookWeekLst::getEvents() { |
385 | QDate start = weekDate(); //date(); | 386 | QDate start = weekDate(); //date(); |
386 | QDate stop = start.addDays(6); | 387 | QDate stop = start.addDays(7); |
387 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); | 388 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); |
388 | 389 | ||
389 | if (view) delete view; | 390 | if (view) delete view; |
390 | if (dbl) { | 391 | if (dbl) { |
391 | QDate start2=start.addDays(7); | 392 | QDate start2=start.addDays(8); |
392 | stop=start2.addDays(6); | 393 | stop=start2.addDays(7); |
393 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); | 394 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); |
394 | view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); | 395 | view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); |
395 | } else { | 396 | } else { |
396 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); | 397 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); |
397 | } | 398 | } |
398 | 399 | ||
399 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 400 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
400 | connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 401 | connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
401 | connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 402 | connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
402 | connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 403 | connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
403 | connect (view, SIGNAL(redraw()), this, SLOT(redraw())); | 404 | connect (view, SIGNAL(redraw()), this, SLOT(redraw())); |
404 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 405 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
405 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 406 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
406 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 407 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
407 | 408 | ||
408 | scroll->addChild(view); | 409 | scroll->addChild(view); |
409 | view->show(); | 410 | view->show(); |
410 | scroll->updateScrollBars(); | 411 | scroll->updateScrollBars(); |
411 | } | 412 | } |
@@ -413,4 +414,4 @@ void DateBookWeekLst::getEvents() { | |||
413 | void DateBookWeekLst::dateChanged(QDate &newdate) { | 414 | void DateBookWeekLst::dateChanged(QDate &newdate) { |
414 | bdate=newdate; | 415 | bdate=newdate; |
415 | getEvents(); | 416 | getEvents(); |
416 | } | 417 | } |
@@ -419,18 +420,18 @@ void DateBookWeekLst::keyPressEvent(QKeyEvent *e) | |||
419 | { | 420 | { |
420 | switch(e->key()) { | 421 | switch(e->key()) { |
421 | case Key_Up: | 422 | case Key_Up: |
422 | scroll->scrollBy(0, -20); | 423 | scroll->scrollBy(0, -20); |
423 | break; | 424 | break; |
424 | case Key_Down: | 425 | case Key_Down: |
425 | scroll->scrollBy(0, 20); | 426 | scroll->scrollBy(0, 20); |
426 | break; | 427 | break; |
427 | case Key_Left: | 428 | case Key_Left: |
428 | header->prevWeek(); | 429 | header->prevWeek(); |
429 | break; | 430 | break; |
430 | case Key_Right: | 431 | case Key_Right: |
431 | header->nextWeek(); | 432 | header->nextWeek(); |
432 | break; | 433 | break; |
433 | default: | 434 | default: |
434 | e->ignore(); | 435 | e->ignore(); |
435 | } | 436 | } |
436 | } | 437 | } |
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index 3bc7f2f..38d7777 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h | |||
@@ -16,2 +16,3 @@ class QDateTime; | |||
16 | class DateBookDB; | 16 | class DateBookDB; |
17 | class DateBookDBHoliday; | ||
17 | 18 | ||
@@ -22,3 +23,3 @@ public: | |||
22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, | 23 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, |
23 | WFlags fl = 0 ); | 24 | WFlags fl = 0 ); |
24 | ~DateBookWeekLstHeader(); | 25 | ~DateBookWeekLstHeader(); |
@@ -27,15 +28,15 @@ public: | |||
27 | public slots: | 28 | public slots: |
28 | void nextWeek(); | 29 | void nextWeek(); |
29 | void prevWeek(); | 30 | void prevWeek(); |
30 | void nextMonth(); | 31 | void nextMonth(); |
31 | void prevMonth(); | 32 | void prevMonth(); |
32 | void pickDate(); | 33 | void pickDate(); |
33 | void setDate(int y, int m, int d); | 34 | void setDate(int y, int m, int d); |
34 | signals: | 35 | signals: |
35 | void dateChanged(QDate &newdate); | 36 | void dateChanged(QDate &newdate); |
36 | void setDbl(bool on); | 37 | void setDbl(bool on); |
37 | private: | 38 | private: |
38 | QDate date; | 39 | QDate date; |
39 | //bool onMonday; | 40 | // bool onMonday; |
40 | bool bStartOnMonday; | 41 | bool bStartOnMonday; |
41 | }; | 42 | }; |
@@ -47,4 +48,4 @@ public: | |||
47 | DateBookWeekLstDayHdr(const QDate &d, bool onM, | 48 | DateBookWeekLstDayHdr(const QDate &d, bool onM, |
48 | QWidget* parent = 0, const char* name = 0, | 49 | QWidget* parent = 0, const char* name = 0, |
49 | WFlags fl = 0 ); | 50 | WFlags fl = 0 ); |
50 | public slots: | 51 | public slots: |
@@ -55,3 +56,3 @@ signals: | |||
55 | void addEvent(const QDateTime &start, const QDateTime &stop, | 56 | void addEvent(const QDateTime &start, const QDateTime &stop, |
56 | const QString &str, const QString &location); | 57 | const QString &str, const QString &location); |
57 | private: | 58 | private: |
@@ -65,4 +66,4 @@ public: | |||
65 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, | 66 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, |
66 | QWidget* parent = 0, const char* name = 0, | 67 | QWidget* parent = 0, const char* name = 0, |
67 | WFlags fl = 0); | 68 | WFlags fl = 0); |
68 | signals: | 69 | signals: |
@@ -90,18 +91,18 @@ public: | |||
90 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, | 91 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, |
91 | QWidget* parent = 0, const char* name = 0, | 92 | QWidget* parent = 0, const char* name = 0, |
92 | WFlags fl = 0 ); | 93 | WFlags fl = 0 ); |
93 | ~DateBookWeekLstView(); | 94 | ~DateBookWeekLstView(); |
94 | signals: | 95 | signals: |
95 | void editEvent(const Event &e); | 96 | void editEvent(const Event &e); |
96 | void duplicateEvent(const Event &e); | 97 | void duplicateEvent(const Event &e); |
97 | void removeEvent(const Event &e); | 98 | void removeEvent(const Event &e); |
98 | void beamEvent(const Event &e); | 99 | void beamEvent(const Event &e); |
99 | void redraw(); | 100 | void redraw(); |
100 | void showDate(int y, int m, int d); | 101 | void showDate(int y, int m, int d); |
101 | void addEvent(const QDateTime &start, const QDateTime &stop, | 102 | void addEvent(const QDateTime &start, const QDateTime &stop, |
102 | const QString &str, const QString &location); | 103 | const QString &str, const QString &location); |
103 | private: | 104 | private: |
104 | bool bStartOnMonday; | 105 | bool bStartOnMonday; |
105 | protected slots: | 106 | protected slots: |
106 | void keyPressEvent(QKeyEvent *); | 107 | void keyPressEvent(QKeyEvent *); |
107 | }; | 108 | }; |
@@ -112,6 +113,6 @@ public: | |||
112 | DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 113 | DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
113 | QValueList<EffectiveEvent> &ev2, | 114 | QValueList<EffectiveEvent> &ev2, |
114 | QDate &d, bool onM, | 115 | QDate &d, bool onM, |
115 | QWidget* parent = 0, const char* name = 0, | 116 | QWidget* parent = 0, const char* name = 0, |
116 | WFlags fl = 0 ); | 117 | WFlags fl = 0 ); |
117 | signals: | 118 | signals: |
@@ -124,3 +125,3 @@ signals: | |||
124 | void addEvent(const QDateTime &start, const QDateTime &stop, | 125 | void addEvent(const QDateTime &start, const QDateTime &stop, |
125 | const QString &str, const QString &location); | 126 | const QString &str, const QString &location); |
126 | }; | 127 | }; |
@@ -132,5 +133,5 @@ class DateBookWeekLst : public QWidget | |||
132 | public: | 133 | public: |
133 | DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, | 134 | DateBookWeekLst( bool ampm, bool onM, DateBookDBHoliday *newDB, |
134 | QWidget *parent = 0, | 135 | QWidget *parent = 0, |
135 | const char *name = 0 ); | 136 | const char *name = 0 ); |
136 | ~DateBookWeekLst(); | 137 | ~DateBookWeekLst(); |
@@ -151,12 +152,12 @@ protected slots: | |||
151 | signals: | 152 | signals: |
152 | void showDate(int y, int m, int d); | 153 | void showDate(int y, int m, int d); |
153 | void addEvent(const QDateTime &start, const QDateTime &stop, | 154 | void addEvent(const QDateTime &start, const QDateTime &stop, |
154 | const QString &str, const QString &location); | 155 | const QString &str, const QString &location); |
155 | void editEvent(const Event &e); | 156 | void editEvent(const Event &e); |
156 | void duplicateEvent(const Event &e); | 157 | void duplicateEvent(const Event &e); |
157 | void removeEvent(const Event &e); | 158 | void removeEvent(const Event &e); |
158 | void beamEvent(const Event &e); | 159 | void beamEvent(const Event &e); |
159 | 160 | ||
160 | private: | 161 | private: |
161 | DateBookDB *db; | 162 | DateBookDBHoliday *db; |
162 | int startTime; | 163 | int startTime; |
@@ -165,3 +166,3 @@ private: | |||
165 | bool dbl; | 166 | bool dbl; |
166 | QDate bdate; | 167 | QDate bdate; |
167 | int year, _week,dow; | 168 | int year, _week,dow; |