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 /core/pim/datebook | |
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 | 3 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.h | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 9 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 5 |
10 files changed, 135 insertions, 51 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 | |||
@@ -54,51 +54,52 @@ | |||
54 | #include <qdir.h> | 54 | #include <qdir.h> |
55 | #include <qtopia/qlibrary.h> | 55 | #include <qtopia/qlibrary.h> |
56 | 56 | ||
57 | #include <sys/stat.h> | 57 | #include <sys/stat.h> |
58 | #include <sys/types.h> | 58 | #include <sys/types.h> |
59 | #include <fcntl.h> | 59 | #include <fcntl.h> |
60 | #include <unistd.h> | 60 | #include <unistd.h> |
61 | 61 | ||
62 | #include <stdlib.h> | 62 | #include <stdlib.h> |
63 | 63 | ||
64 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 64 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
65 | : QMainWindow( parent, "datebook", f ), | 65 | : QMainWindow( parent, "datebook", 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; |
93 | weekLstView = 0; | 94 | weekLstView = 0; |
94 | monthView = 0; | 95 | monthView = 0; |
95 | 96 | ||
96 | // QToolBar *bar = new QToolBar( this ); | 97 | // QToolBar *bar = new QToolBar( this ); |
97 | // bar->setHorizontalStretchable( TRUE ); | 98 | // bar->setHorizontalStretchable( TRUE ); |
98 | 99 | ||
99 | // QMenuBar *mb = new QMenuBar( bar ); | 100 | // QMenuBar *mb = new QMenuBar( bar ); |
100 | // mb->setMargin( 0 ); | 101 | // mb->setMargin( 0 ); |
101 | 102 | ||
102 | // QPopupMenu *view = new QPopupMenu( this ); | 103 | // QPopupMenu *view = new QPopupMenu( this ); |
103 | // mb->insertItem( tr( "View" ), view ); | 104 | // mb->insertItem( tr( "View" ), view ); |
104 | 105 | ||
@@ -1128,24 +1129,66 @@ void DateBookHoliday::init() | |||
1128 | } else { | 1129 | } else { |
1129 | } | 1130 | } |
1130 | } else { | 1131 | } else { |
1131 | delete lib; | 1132 | delete lib; |
1132 | } | 1133 | } |
1133 | } | 1134 | } |
1134 | } | 1135 | } |
1135 | 1136 | ||
1136 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) | 1137 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) |
1137 | { | 1138 | { |
1138 | QStringList ret; | 1139 | QStringList ret; |
1139 | QValueList<HPlugin*>::Iterator it; | 1140 | QValueList<HPlugin*>::Iterator it; |
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 | ||
1147 | QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day) | 1148 | QStringList 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 | ||
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 | |||
@@ -1,95 +1,64 @@ | |||
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 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOK_H | 20 | #ifndef DATEBOOK_H |
21 | #define DATEBOOK_H | 21 | #define DATEBOOK_H |
22 | 22 | ||
23 | #include "datebooktypes.h" | ||
24 | |||
23 | #include <qpe/datebookdb.h> | 25 | #include <qpe/datebookdb.h> |
24 | 26 | ||
25 | #include <qmainwindow.h> | 27 | #include <qmainwindow.h> |
26 | 28 | ||
27 | enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values | 29 | enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values |
28 | enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes. | 30 | enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes. |
29 | 31 | ||
30 | class QAction; | 32 | class QAction; |
31 | class QWidgetStack; | 33 | class QWidgetStack; |
32 | class DateBookDay; | 34 | class DateBookDay; |
33 | class DateBookWeek; | 35 | class DateBookWeek; |
34 | class DateBookWeekLst; | 36 | class DateBookWeekLst; |
35 | class DateBookMonth; | 37 | class DateBookMonth; |
36 | class Event; | 38 | class Event; |
37 | class QDate; | 39 | 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 | ||
73 | class DateBook : public QMainWindow | 42 | class DateBook : public QMainWindow |
74 | { | 43 | { |
75 | Q_OBJECT | 44 | Q_OBJECT |
76 | 45 | ||
77 | public: | 46 | public: |
78 | static QString appName() { return QString::fromLatin1("datebook"); } | 47 | static QString appName() { return QString::fromLatin1("datebook"); } |
79 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 48 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
80 | ~DateBook(); | 49 | ~DateBook(); |
81 | 50 | ||
82 | signals: | 51 | signals: |
83 | void newEvent(); | 52 | void newEvent(); |
84 | void signalNotFound(); | 53 | void signalNotFound(); |
85 | void signalWrapAround(); | 54 | void signalWrapAround(); |
86 | 55 | ||
87 | protected: | 56 | protected: |
88 | QDate currentDate(); | 57 | QDate currentDate(); |
89 | void timerEvent( QTimerEvent *e ); | 58 | void timerEvent( QTimerEvent *e ); |
90 | void closeEvent( QCloseEvent *e ); | 59 | void closeEvent( QCloseEvent *e ); |
91 | 60 | ||
92 | void view(int v, const QDate &d); | 61 | void view(int v, const QDate &d); |
93 | 62 | ||
94 | public slots: | 63 | public slots: |
95 | void flush(); | 64 | void flush(); |
@@ -116,49 +85,49 @@ private slots: | |||
116 | void viewMonth(); | 85 | void viewMonth(); |
117 | 86 | ||
118 | void showDay( int y, int m, int d ); | 87 | void showDay( int y, int m, int d ); |
119 | 88 | ||
120 | void insertEvent( const Event &e ); | 89 | void insertEvent( const Event &e ); |
121 | void editEvent( const Event &e ); | 90 | void editEvent( const Event &e ); |
122 | void duplicateEvent( const Event &e ); | 91 | void duplicateEvent( const Event &e ); |
123 | void removeEvent( const Event &e ); | 92 | void removeEvent( const Event &e ); |
124 | 93 | ||
125 | void receive( const QCString &msg, const QByteArray &data ); | 94 | void receive( const QCString &msg, const QByteArray &data ); |
126 | void setDocument( const QString & ); | 95 | void setDocument( const QString & ); |
127 | void beamEvent( const Event &e ); | 96 | void beamEvent( const Event &e ); |
128 | void beamDone( Ir *ir ); | 97 | void beamDone( Ir *ir ); |
129 | 98 | ||
130 | private: | 99 | private: |
131 | void addEvent( const Event &e ); | 100 | void addEvent( const Event &e ); |
132 | void initDay(); | 101 | void initDay(); |
133 | void initWeek(); | 102 | void initWeek(); |
134 | void initWeekLst(); | 103 | void initWeekLst(); |
135 | void initMonth(); | 104 | void initMonth(); |
136 | void loadSettings(); | 105 | void loadSettings(); |
137 | void saveSettings(); | 106 | void saveSettings(); |
138 | 107 | ||
139 | private: | 108 | private: |
140 | DateBookDBHack *db; | 109 | DateBookDBHoliday *db; |
141 | DateBookHoliday*db_holiday; | 110 | DateBookHoliday*db_holiday; |
142 | QWidgetStack *views; | 111 | QWidgetStack *views; |
143 | DateBookDay *dayView; | 112 | DateBookDay *dayView; |
144 | DateBookWeek *weekView; | 113 | DateBookWeek *weekView; |
145 | DateBookMonth *monthView; | 114 | DateBookMonth *monthView; |
146 | DateBookWeekLst *weekLstView; | 115 | DateBookWeekLst *weekLstView; |
147 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; | 116 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; |
148 | int weeklistviewconfig; | 117 | int weeklistviewconfig; |
149 | bool aPreset; // have everything set to alarm? | 118 | bool aPreset; // have everything set to alarm? |
150 | int presetTime; // the standard time for the alarm | 119 | int presetTime; // the standard time for the alarm |
151 | int startTime; | 120 | int startTime; |
152 | int rowStyle; | 121 | int rowStyle; |
153 | int defaultView; | 122 | int defaultView; |
154 | QArray<int> defaultCategories; | 123 | QArray<int> defaultCategories; |
155 | QString defaultLocation; | 124 | QString defaultLocation; |
156 | bool bJumpToCurTime; //should jump to current time in dayview? | 125 | bool bJumpToCurTime; //should jump to current time in dayview? |
157 | bool ampm; | 126 | bool ampm; |
158 | bool onMonday; | 127 | bool onMonday; |
159 | 128 | ||
160 | bool syncing; | 129 | bool syncing; |
161 | bool inSearch; | 130 | bool inSearch; |
162 | 131 | ||
163 | int alarmCounter; | 132 | int alarmCounter; |
164 | 133 | ||
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 | |||
@@ -1,45 +1,46 @@ | |||
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 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "datebookday.h" | 21 | #include "datebookday.h" |
22 | #include "datebooktypes.h" | ||
22 | #include "datebookdayheaderimpl.h" | 23 | #include "datebookdayheaderimpl.h" |
23 | #include "datebookdayallday.h" | 24 | #include "datebookdayallday.h" |
24 | 25 | ||
25 | #include <opie2/oholidayplugin.h> | 26 | #include <opie2/oholidayplugin.h> |
26 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/ir.h> | 29 | #include <qpe/ir.h> |
29 | 30 | ||
30 | #include <qsimplerichtext.h> | 31 | #include <qsimplerichtext.h> |
31 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
32 | 33 | ||
33 | 34 | ||
34 | #include <qtimer.h> | 35 | #include <qtimer.h> |
35 | 36 | ||
36 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) | 37 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) |
37 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) | 38 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) |
38 | { | 39 | { |
39 | enableClipper(TRUE); | 40 | enableClipper(TRUE); |
40 | setTopMargin( 0 ); | 41 | setTopMargin( 0 ); |
41 | horizontalHeader()->hide(); | 42 | horizontalHeader()->hide(); |
42 | setLeftMargin(38); | 43 | setLeftMargin(38); |
43 | setColumnStretchable( 0, TRUE ); | 44 | setColumnStretchable( 0, TRUE ); |
44 | setHScrollBarMode( QScrollView::AlwaysOff ); | 45 | setHScrollBarMode( QScrollView::AlwaysOff ); |
45 | verticalHeader()->setPalette(white); | 46 | verticalHeader()->setPalette(white); |
@@ -206,49 +207,49 @@ DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &star | |||
206 | } | 207 | } |
207 | 208 | ||
208 | void DateBookDayViewQuickLineEdit::slotReturnPressed() | 209 | void DateBookDayViewQuickLineEdit::slotReturnPressed() |
209 | { | 210 | { |
210 | if(active && (!this->text().isEmpty())) { // Fix to avoid having this event beeing added multiple times. | 211 | if(active && (!this->text().isEmpty())) { // Fix to avoid having this event beeing added multiple times. |
211 | quickEvent.setDescription(this->text()); | 212 | quickEvent.setDescription(this->text()); |
212 | connect(this,SIGNAL(insertEvent(const Event&)),this->topLevelWidget(),SLOT(insertEvent(const Event&))); | 213 | connect(this,SIGNAL(insertEvent(const Event&)),this->topLevelWidget(),SLOT(insertEvent(const Event&))); |
213 | emit(insertEvent(quickEvent)); | 214 | emit(insertEvent(quickEvent)); |
214 | active=0; | 215 | active=0; |
215 | } | 216 | } |
216 | /* we need to return to this object.. */ | 217 | /* we need to return to this object.. */ |
217 | QTimer::singleShot(500, this, SLOT(finallyCallClose()) ); // Close and also delete this widget | 218 | QTimer::singleShot(500, this, SLOT(finallyCallClose()) ); // Close and also delete this widget |
218 | } | 219 | } |
219 | void DateBookDayViewQuickLineEdit::finallyCallClose() { | 220 | void DateBookDayViewQuickLineEdit::finallyCallClose() { |
220 | close(true); // also deletes this widget... | 221 | close(true); // also deletes this widget... |
221 | } | 222 | } |
222 | 223 | ||
223 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) | 224 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) |
224 | { | 225 | { |
225 | slotReturnPressed(); // Reuse code to add event and close this widget. | 226 | slotReturnPressed(); // Reuse code to add event and close this widget. |
226 | } | 227 | } |
227 | 228 | ||
228 | //=========================================================================== | 229 | //=========================================================================== |
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 ) |
232 | { | 233 | { |
233 | widgetList.setAutoDelete( true ); | 234 | widgetList.setAutoDelete( true ); |
234 | _holiday_db = newHdb; | 235 | _holiday_db = newHdb; |
235 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); | 236 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); |
236 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); | 237 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); |
237 | 238 | ||
238 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); | 239 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); |
239 | m_allDays->hide(); | 240 | m_allDays->hide(); |
240 | 241 | ||
241 | view = new DateBookDayView( ampm, this, "day view" ); | 242 | view = new DateBookDayView( ampm, this, "day view" ); |
242 | 243 | ||
243 | connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) ); | 244 | connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) ); |
244 | connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) ); | 245 | connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) ); |
245 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); | 246 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); |
246 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); | 247 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); |
247 | connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) ); | 248 | connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) ); |
248 | 249 | ||
249 | QTimer *timer = new QTimer( this ); | 250 | QTimer *timer = new QTimer( this ); |
250 | 251 | ||
251 | connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) ); //connect timer for updating timeMarker & daywidgetcolors | 252 | connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) ); //connect timer for updating timeMarker & daywidgetcolors |
252 | timer->start( 1000*60*5, FALSE ); //update every 5min | 253 | timer->start( 1000*60*5, FALSE ); //update every 5min |
253 | 254 | ||
254 | selectedWidget = 0; | 255 | selectedWidget = 0; |
@@ -346,49 +347,49 @@ void DateBookDay::dateChanged( int y, int m, int d ) | |||
346 | } | 347 | } |
347 | 348 | ||
348 | void DateBookDay::redraw() | 349 | void DateBookDay::redraw() |
349 | { | 350 | { |
350 | if ( isUpdatesEnabled() ) | 351 | if ( isUpdatesEnabled() ) |
351 | relayoutPage(); | 352 | relayoutPage(); |
352 | } | 353 | } |
353 | 354 | ||
354 | void DateBookDay::getEvents() | 355 | void DateBookDay::getEvents() |
355 | { | 356 | { |
356 | widgetList.clear(); | 357 | widgetList.clear(); |
357 | 358 | ||
358 | /* clear the AllDay List */ | 359 | /* clear the AllDay List */ |
359 | m_allDays->hide(); // just in case | 360 | m_allDays->hide(); // just in case |
360 | m_allDays->removeAllEvents(); | 361 | m_allDays->removeAllEvents(); |
361 | 362 | ||
362 | QStringList hdays = _holiday_db->holidaylist(currDate); | 363 | QStringList hdays = _holiday_db->holidaylist(currDate); |
363 | QStringList::Iterator sit; | 364 | QStringList::Iterator sit; |
364 | QObject* object = 0; | 365 | QObject* object = 0; |
365 | for (sit=hdays.begin();sit!=hdays.end();++sit) { | 366 | for (sit=hdays.begin();sit!=hdays.end();++sit) { |
366 | object = m_allDays->addHoliday(*sit); | 367 | object = m_allDays->addHoliday(*sit); |
367 | if (!object) continue; | 368 | if (!object) continue; |
368 | /* not to do something with it */ | 369 | /* not to do something with it */ |
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; |
372 | 373 | ||
373 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 374 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
374 | EffectiveEvent ev=*it; | 375 | EffectiveEvent ev=*it; |
375 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. | 376 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. |
376 | if (ev.event().type() == Event::AllDay ) { | 377 | if (ev.event().type() == Event::AllDay ) { |
377 | object = m_allDays->addEvent( ev ); | 378 | object = m_allDays->addEvent( ev ); |
378 | if (!object) | 379 | if (!object) |
379 | continue; | 380 | continue; |
380 | }else { | 381 | }else { |
381 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); | 382 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); |
382 | widgetList.append( w ); | 383 | widgetList.append( w ); |
383 | object = w; | 384 | object = w; |
384 | } | 385 | } |
385 | 386 | ||
386 | connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) ); | 387 | connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) ); |
387 | connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) ); | 388 | connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) ); |
388 | connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) ); | 389 | connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) ); |
389 | connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) ); | 390 | connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) ); |
390 | 391 | ||
391 | } | 392 | } |
392 | } | 393 | } |
393 | } | 394 | } |
394 | 395 | ||
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 | |||
@@ -7,52 +7,54 @@ | |||
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 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOKDAY_H | 20 | #ifndef DATEBOOKDAY_H |
21 | #define DATEBOOKDAY_H | 21 | #define DATEBOOKDAY_H |
22 | 22 | ||
23 | #include <qpe/event.h> | 23 | #include <qpe/event.h> |
24 | 24 | ||
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qtable.h> | 26 | #include <qtable.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qlist.h> | 28 | #include <qlist.h> |
29 | 29 | ||
30 | #include "datebook.h" | 30 | #include "datebook.h" |
31 | #include "datebooktypes.h" | ||
31 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
32 | 33 | ||
33 | class DateBookDayHeader; | 34 | class DateBookDayHeader; |
34 | class DateBookDB; | 35 | class DateBookDB; |
36 | class DateBookDBHoliday; | ||
35 | class DatebookdayAllday; | 37 | class DatebookdayAllday; |
36 | class QDateTime; | 38 | class QDateTime; |
37 | class QMouseEvent; | 39 | class QMouseEvent; |
38 | class QPaintEvent; | 40 | class QPaintEvent; |
39 | class QResizeEvent; | 41 | class QResizeEvent; |
40 | 42 | ||
41 | class DateBookDayViewQuickLineEdit : public QLineEdit | 43 | class DateBookDayViewQuickLineEdit : public QLineEdit |
42 | { | 44 | { |
43 | Q_OBJECT | 45 | Q_OBJECT |
44 | public: | 46 | public: |
45 | DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); | 47 | DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); |
46 | protected: | 48 | protected: |
47 | Event quickEvent; | 49 | Event quickEvent; |
48 | int active; | 50 | int active; |
49 | void focusOutEvent( QFocusEvent *e ); | 51 | void focusOutEvent( QFocusEvent *e ); |
50 | protected slots: | 52 | protected slots: |
51 | void slotReturnPressed(void); | 53 | void slotReturnPressed(void); |
52 | void finallyCallClose(); | 54 | void finallyCallClose(); |
53 | signals: | 55 | signals: |
54 | void insertEvent(const Event &e); | 56 | void insertEvent(const Event &e); |
55 | }; | 57 | }; |
56 | 58 | ||
57 | 59 | ||
58 | class DateBookDayView : public QTable | 60 | class DateBookDayView : public QTable |
@@ -159,80 +161,80 @@ class WidgetListClass : public QList<DateBookDayWidget> | |||
159 | { | 161 | { |
160 | private: | 162 | private: |
161 | 163 | ||
162 | int compareItems( QCollection::Item s1, QCollection::Item s2 ) | 164 | int compareItems( QCollection::Item s1, QCollection::Item s2 ) |
163 | { | 165 | { |
164 | //hmm, don't punish me for that ;) | 166 | //hmm, don't punish me for that ;) |
165 | if (reinterpret_cast<DateBookDayWidget*>(s1)->geometry().height() > reinterpret_cast<DateBookDayWidget*>(s2)->geometry().height()) | 167 | if (reinterpret_cast<DateBookDayWidget*>(s1)->geometry().height() > reinterpret_cast<DateBookDayWidget*>(s2)->geometry().height()) |
166 | { | 168 | { |
167 | return -1; | 169 | return -1; |
168 | } else | 170 | } else |
169 | { | 171 | { |
170 | return 1; | 172 | return 1; |
171 | } | 173 | } |
172 | } | 174 | } |
173 | 175 | ||
174 | 176 | ||
175 | }; | 177 | }; |
176 | 178 | ||
177 | class DateBookDay : public QVBox | 179 | class DateBookDay : public QVBox |
178 | { | 180 | { |
179 | Q_OBJECT | 181 | Q_OBJECT |
180 | 182 | ||
181 | friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB | 183 | friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB |
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 ); |
185 | void selectedDates( QDateTime &start, QDateTime &end ); | 187 | void selectedDates( QDateTime &start, QDateTime &end ); |
186 | 188 | ||
187 | QDate date() const; | 189 | QDate date() const; |
188 | DateBookDayView *dayView() const { return view; } | 190 | DateBookDayView *dayView() const { return view; } |
189 | void setStartViewTime( int startHere ); | 191 | void setStartViewTime( int startHere ); |
190 | int startViewTime() const; | 192 | int startViewTime() const; |
191 | void setSelectedWidget( DateBookDayWidget * ); | 193 | void setSelectedWidget( DateBookDayWidget * ); |
192 | DateBookDayWidget * getSelectedWidget( void ); | 194 | DateBookDayWidget * getSelectedWidget( void ); |
193 | void setJumpToCurTime( bool bJump ); | 195 | void setJumpToCurTime( bool bJump ); |
194 | void setRowStyle( int style ); | 196 | void setRowStyle( int style ); |
195 | static QDate findRealStart( int uid, const QDate& isIncluded, | 197 | static QDate findRealStart( int uid, const QDate& isIncluded, |
196 | DateBookDB* ); | 198 | DateBookDB* ); |
197 | 199 | ||
198 | public slots: | 200 | public slots: |
199 | void setDate( int y, int m, int d ); | 201 | void setDate( int y, int m, int d ); |
200 | void setDate( QDate ); | 202 | void setDate( QDate ); |
201 | void redraw(); | 203 | void redraw(); |
202 | void slotWeekChanged( bool bStartOnMonday ); | 204 | void slotWeekChanged( bool bStartOnMonday ); |
203 | void updateView(); //updates TimeMarker and DayWidget-colors | 205 | void updateView(); //updates TimeMarker and DayWidget-colors |
204 | 206 | ||
205 | signals: | 207 | signals: |
206 | void removeEvent( const Event& ); | 208 | void removeEvent( const Event& ); |
207 | void editEvent( const Event& ); | 209 | void editEvent( const Event& ); |
208 | void duplicateEvent( const Event& ); | 210 | void duplicateEvent( const Event& ); |
209 | void beamEvent( const Event& ); | 211 | void beamEvent( const Event& ); |
210 | void newEvent(); | 212 | void newEvent(); |
211 | void sigNewEvent( const QString & ); | 213 | void sigNewEvent( const QString & ); |
212 | 214 | ||
213 | protected slots: | 215 | protected slots: |
214 | void keyPressEvent(QKeyEvent *); | 216 | void keyPressEvent(QKeyEvent *); |
215 | 217 | ||
216 | private slots: | 218 | private slots: |
217 | void dateChanged( int y, int m, int d ); | 219 | void dateChanged( int y, int m, int d ); |
218 | void slotColWidthChanged() { relayoutPage(); }; | 220 | void slotColWidthChanged() { relayoutPage(); }; |
219 | 221 | ||
220 | private: | 222 | private: |
221 | void getEvents(); | 223 | void getEvents(); |
222 | void relayoutPage( bool fromResize = false ); | 224 | void relayoutPage( bool fromResize = false ); |
223 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); | 225 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); |
224 | QDate currDate; | 226 | QDate currDate; |
225 | DateBookDayView *view; | 227 | DateBookDayView *view; |
226 | DateBookDayHeader *header; | 228 | DateBookDayHeader *header; |
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 |
230 | int startTime; | 232 | int startTime; |
231 | bool jumpToCurTime; //should we jump to current time in dayview? | 233 | bool jumpToCurTime; //should we jump to current time in dayview? |
232 | int rowStyle; | 234 | int rowStyle; |
233 | DateBookDayWidget *selectedWidget; //actual selected widget (obviously) | 235 | DateBookDayWidget *selectedWidget; //actual selected widget (obviously) |
234 | DateBookDayTimeMarker *timeMarker; //marker for current time | 236 | DateBookDayTimeMarker *timeMarker; //marker for current time |
235 | DateBookHoliday*_holiday_db; | 237 | DateBookHoliday*_holiday_db; |
236 | }; | 238 | }; |
237 | 239 | ||
238 | #endif | 240 | #endif |
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 | |||
@@ -9,49 +9,50 @@ | |||
9 | #include "datebookdayallday.h" | 9 | #include "datebookdayallday.h" |
10 | 10 | ||
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | #include <qpe/ir.h> | 12 | #include <qpe/ir.h> |
13 | #include <qpopupmenu.h> | 13 | #include <qpopupmenu.h> |
14 | #include <qtimer.h> | 14 | #include <qtimer.h> |
15 | 15 | ||
16 | #include "datebookday.h" | 16 | #include "datebookday.h" |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * Constructs a DatebookdayAllday which is a child of 'parent', with the | 19 | * Constructs a DatebookdayAllday which is a child of 'parent', with the |
20 | * name 'name' and widget flags set to 'f' | 20 | * name 'name' and widget flags set to 'f' |
21 | */ | 21 | */ |
22 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) | 22 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) |
23 | : QScrollView( parent, name ),item_count(0),dateBook(db) | 23 | : QScrollView( parent, name ),item_count(0),dateBook(db) |
24 | { | 24 | { |
25 | if ( !name ) | 25 | if ( !name ) |
26 | setName( "DatebookdayAllday" ); | 26 | setName( "DatebookdayAllday" ); |
27 | setMinimumSize( QSize( 0, 0 ) ); | 27 | setMinimumSize( QSize( 0, 0 ) ); |
28 | setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); | 28 | setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); |
29 | 29 | ||
30 | m_MainFrame = new QFrame(viewport()); | 30 | m_MainFrame = new QFrame(viewport()); |
31 | m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); | 31 | m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); |
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 ); |
35 | addChild(m_MainFrame); | 36 | addChild(m_MainFrame); |
36 | 37 | ||
37 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); | 38 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); |
38 | datebookdayalldayLayout->setSpacing( 0 ); | 39 | datebookdayalldayLayout->setSpacing( 0 ); |
39 | datebookdayalldayLayout->setMargin( 0 ); | 40 | datebookdayalldayLayout->setMargin( 0 ); |
40 | 41 | ||
41 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); | 42 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); |
42 | lblDesc->setBackgroundColor(Qt::yellow); | 43 | lblDesc->setBackgroundColor(Qt::yellow); |
43 | lblDesc->hide(); | 44 | lblDesc->hide(); |
44 | subWidgets.setAutoDelete(true); | 45 | subWidgets.setAutoDelete(true); |
45 | } | 46 | } |
46 | 47 | ||
47 | /* | 48 | /* |
48 | * Destroys the object and frees any allocated resources | 49 | * Destroys the object and frees any allocated resources |
49 | */ | 50 | */ |
50 | DatebookdayAllday::~DatebookdayAllday() | 51 | DatebookdayAllday::~DatebookdayAllday() |
51 | { | 52 | { |
52 | // no need to delete child widgets, Qt does it all for us | 53 | // no need to delete child widgets, Qt does it all for us |
53 | } | 54 | } |
54 | 55 | ||
55 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) | 56 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) |
56 | { | 57 | { |
57 | DatebookAlldayDisp * lb; | 58 | DatebookAlldayDisp * lb; |
@@ -90,55 +91,60 @@ DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, | |||
90 | QWidget* parent,const char* name,WFlags f) | 91 | QWidget* parent,const char* name,WFlags f) |
91 | : QLabel(parent,name,f),m_Ev(ev),dateBook(db) | 92 | : QLabel(parent,name,f),m_Ev(ev),dateBook(db) |
92 | { | 93 | { |
93 | QString strDesc = m_Ev.description(); | 94 | QString strDesc = m_Ev.description(); |
94 | strDesc = strDesc.replace(QRegExp("<"),"<"); | 95 | strDesc = strDesc.replace(QRegExp("<"),"<"); |
95 | setBackgroundColor(yellow); | 96 | setBackgroundColor(yellow); |
96 | setText(strDesc); | 97 | setText(strDesc); |
97 | setFrameStyle(QFrame::Raised|QFrame::Panel); | 98 | setFrameStyle(QFrame::Raised|QFrame::Panel); |
98 | 99 | ||
99 | int s = QFontMetrics(font()).height()+4; | 100 | int s = QFontMetrics(font()).height()+4; |
100 | setMaximumHeight( s ); | 101 | setMaximumHeight( s ); |
101 | setMinimumSize( QSize( 0, s ) ); | 102 | setMinimumSize( QSize( 0, s ) ); |
102 | m_holiday = false; | 103 | m_holiday = false; |
103 | } | 104 | } |
104 | 105 | ||
105 | DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,const char* name, WFlags fl) | 106 | DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,const char* name, WFlags fl) |
106 | : QLabel(parent,name,fl),m_Ev(),dateBook(0) | 107 | : QLabel(parent,name,fl),m_Ev(),dateBook(0) |
107 | { | 108 | { |
108 | QString strDesc = aholiday; | 109 | QString strDesc = aholiday; |
109 | strDesc = strDesc.replace(QRegExp("<"),"<"); | 110 | strDesc = strDesc.replace(QRegExp("<"),"<"); |
110 | Event ev; | 111 | Event ev; |
111 | ev.setDescription(strDesc); | 112 | ev.setDescription(strDesc); |
112 | ev.setAllDay(true); | 113 | ev.setAllDay(true); |
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 | ||
118 | int s = QFontMetrics(font()).height()+4; | 123 | int s = QFontMetrics(font()).height()+4; |
119 | setMaximumHeight( s ); | 124 | setMaximumHeight( s ); |
120 | setMinimumSize( QSize( 0, s ) ); | 125 | setMinimumSize( QSize( 0, s ) ); |
126 | |||
121 | m_holiday = true; | 127 | m_holiday = true; |
122 | } | 128 | } |
123 | 129 | ||
124 | DatebookAlldayDisp::~DatebookAlldayDisp() | 130 | DatebookAlldayDisp::~DatebookAlldayDisp() |
125 | { | 131 | { |
126 | } | 132 | } |
127 | 133 | ||
128 | void DatebookAlldayDisp::beam_single_event() | 134 | void DatebookAlldayDisp::beam_single_event() |
129 | { | 135 | { |
130 | if (m_holiday) return; | 136 | if (m_holiday) return; |
131 | // create an Event and beam it... | 137 | // create an Event and beam it... |
132 | /* | 138 | /* |
133 | * Start with the easy stuff. If start and end date is the same we can just use | 139 | * Start with the easy stuff. If start and end date is the same we can just use |
134 | * the values of effective m_Events | 140 | * the values of effective m_Events |
135 | * If it is a multi day m_Event we need to find the real start and end date... | 141 | * If it is a multi day m_Event we need to find the real start and end date... |
136 | */ | 142 | */ |
137 | if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { | 143 | if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { |
138 | Event m_Event( m_Ev.event() ); | 144 | Event m_Event( m_Ev.event() ); |
139 | 145 | ||
140 | QDateTime dt( m_Ev.date(), m_Ev.start() ); | 146 | QDateTime dt( m_Ev.date(), m_Ev.start() ); |
141 | m_Event.setStart( dt ); | 147 | m_Event.setStart( dt ); |
142 | 148 | ||
143 | dt.setTime( m_Ev.end() ); | 149 | dt.setTime( m_Ev.end() ); |
144 | m_Event.setEnd( dt ); | 150 | m_Event.setEnd( dt ); |
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 | |||
@@ -1,45 +1,46 @@ | |||
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 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "datebookweek.h" | 20 | #include "datebookweek.h" |
21 | #include "datebookweekheaderimpl.h" | 21 | #include "datebookweekheaderimpl.h" |
22 | #include "datebooktypes.h" | ||
22 | 23 | ||
23 | #include <qpe/datebookdb.h> | 24 | #include <qpe/datebookdb.h> |
24 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/calendar.h> | 26 | #include <qpe/calendar.h> |
26 | 27 | ||
27 | #include <qheader.h> | 28 | #include <qheader.h> |
28 | #include <qlabel.h> | 29 | #include <qlabel.h> |
29 | #include <qlayout.h> | 30 | #include <qlayout.h> |
30 | #include <qtimer.h> | 31 | #include <qtimer.h> |
31 | 32 | ||
32 | //----------------------------------------------------------------- | 33 | //----------------------------------------------------------------- |
33 | 34 | ||
34 | 35 | ||
35 | DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e ) | 36 | DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e ) |
36 | : ev( e ) | 37 | : ev( e ) |
37 | { | 38 | { |
38 | // with the current implementation change the color for all day events | 39 | // with the current implementation change the color for all day events |
39 | if ( ev.event().type() == Event::AllDay && !ev.event().hasAlarm() ) { | 40 | if ( ev.event().type() == Event::AllDay && !ev.event().hasAlarm() ) { |
40 | c = Qt::green; | 41 | c = Qt::green; |
41 | } else { | 42 | } else { |
42 | c = ev.event().hasAlarm() ? Qt::red : Qt::blue; | 43 | c = ev.event().hasAlarm() ? Qt::red : Qt::blue; |
43 | } | 44 | } |
44 | } | 45 | } |
45 | 46 | ||
@@ -319,49 +320,49 @@ void DateBookWeekView::resizeEvent( QResizeEvent *e ) | |||
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 ); |
321 | */ | 322 | */ |
322 | //BRANCH_1_0 | 323 | //BRANCH_1_0 |
323 | int avail = width()-qApp->style().scrollBarExtent().width()-1; | 324 | int avail = width()-qApp->style().scrollBarExtent().width()-1; |
324 | header->setGeometry( 0, 0, avail, header->sizeHint().height() ); | 325 | header->setGeometry( 0, 0, avail, header->sizeHint().height() ); |
325 | setMargins( 0, header->height(), 0, 0 ); | 326 | setMargins( 0, header->height(), 0, 0 ); |
326 | 327 | ||
327 | 328 | ||
328 | header->resizeSection( 0, hourWidth ); | 329 | header->resizeSection( 0, hourWidth ); |
329 | int sw = (avail - hourWidth) / 7; | 330 | int sw = (avail - hourWidth) / 7; |
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 ); |
333 | } | 334 | } |
334 | 335 | ||
335 | void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) | 336 | void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) |
336 | { | 337 | { |
337 | bOnMonday = bStartOnMonday; | 338 | bOnMonday = bStartOnMonday; |
338 | initNames(); | 339 | initNames(); |
339 | } | 340 | } |
340 | 341 | ||
341 | //------------------------------------------------------------------- | 342 | //------------------------------------------------------------------- |
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 ), |
346 | db( newDB ), | 347 | db( newDB ), |
347 | startTime( 0 ), | 348 | startTime( 0 ), |
348 | ampm( ap ), | 349 | ampm( ap ), |
349 | bStartOnMonday( startOnMonday ) | 350 | bStartOnMonday( startOnMonday ) |
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()) ); |
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 | |||
@@ -7,48 +7,49 @@ | |||
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 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOKWEEK | 20 | #ifndef DATEBOOKWEEK |
21 | #define DATEBOOKWEEK | 21 | #define DATEBOOKWEEK |
22 | 22 | ||
23 | #include <qpe/event.h> | 23 | #include <qpe/event.h> |
24 | 24 | ||
25 | #include <qlist.h> | 25 | #include <qlist.h> |
26 | #include <qscrollview.h> | 26 | #include <qscrollview.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | 29 | ||
30 | class DateBookDB; | 30 | class DateBookDB; |
31 | class DateBookDBHoliday; | ||
31 | class DateBookWeekHeader; | 32 | class DateBookWeekHeader; |
32 | class QDate; | 33 | class QDate; |
33 | class QLabel; | 34 | class QLabel; |
34 | class QResizeEvent; | 35 | class QResizeEvent; |
35 | class QSpinBox; | 36 | class QSpinBox; |
36 | class QTimer; | 37 | class QTimer; |
37 | class QHeader; | 38 | class QHeader; |
38 | 39 | ||
39 | class DateBookWeekItem | 40 | class DateBookWeekItem |
40 | { | 41 | { |
41 | public: | 42 | public: |
42 | DateBookWeekItem( const EffectiveEvent e ); | 43 | DateBookWeekItem( const EffectiveEvent e ); |
43 | 44 | ||
44 | void setGeometry( int x, int y, int w, int h ); | 45 | void setGeometry( int x, int y, int w, int h ); |
45 | QRect geometry() const { return r; } | 46 | QRect geometry() const { return r; } |
46 | 47 | ||
47 | const QColor &color() const { return c; } | 48 | const QColor &color() const { return c; } |
48 | const EffectiveEvent event() const { return ev; } | 49 | const EffectiveEvent event() const { return ev; } |
49 | 50 | ||
50 | private: | 51 | private: |
51 | const EffectiveEvent ev; | 52 | const EffectiveEvent ev; |
52 | QRect r; | 53 | QRect r; |
53 | QColor c; | 54 | QColor c; |
54 | }; | 55 | }; |
@@ -79,49 +80,49 @@ private slots: | |||
79 | 80 | ||
80 | private: | 81 | private: |
81 | void positionItem( DateBookWeekItem *i ); | 82 | void positionItem( DateBookWeekItem *i ); |
82 | DateBookWeekItem *intersects( const DateBookWeekItem * ); | 83 | DateBookWeekItem *intersects( const DateBookWeekItem * ); |
83 | void drawContents( QPainter *p, int cx, int cy, int cw, int ch ); | 84 | void drawContents( QPainter *p, int cx, int cy, int cw, int ch ); |
84 | void contentsMousePressEvent( QMouseEvent * ); | 85 | void contentsMousePressEvent( QMouseEvent * ); |
85 | void contentsMouseReleaseEvent( QMouseEvent * ); | 86 | void contentsMouseReleaseEvent( QMouseEvent * ); |
86 | void resizeEvent( QResizeEvent * ); | 87 | void resizeEvent( QResizeEvent * ); |
87 | void initNames(); | 88 | void initNames(); |
88 | 89 | ||
89 | private: | 90 | private: |
90 | bool ampm; | 91 | bool ampm; |
91 | bool bOnMonday; | 92 | bool bOnMonday; |
92 | QHeader *header; | 93 | QHeader *header; |
93 | QList<DateBookWeekItem> items; | 94 | QList<DateBookWeekItem> items; |
94 | int rowHeight; | 95 | int rowHeight; |
95 | bool showingEvent; | 96 | bool showingEvent; |
96 | }; | 97 | }; |
97 | 98 | ||
98 | class DateBookWeek : public QWidget | 99 | class DateBookWeek : public QWidget |
99 | { | 100 | { |
100 | Q_OBJECT | 101 | Q_OBJECT |
101 | 102 | ||
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 ); |
106 | void setDate( QDate d ); | 107 | void setDate( QDate d ); |
107 | QDate date() const; | 108 | QDate date() const; |
108 | DateBookWeekView *weekView() const { return view; } | 109 | DateBookWeekView *weekView() const { return view; } |
109 | void setStartViewTime( int startHere ); | 110 | void setStartViewTime( int startHere ); |
110 | int startViewTime() const; | 111 | int startViewTime() const; |
111 | int week() const { return _week; }; | 112 | int week() const { return _week; }; |
112 | QDate weekDate() const; | 113 | QDate weekDate() const; |
113 | 114 | ||
114 | public slots: | 115 | public slots: |
115 | void redraw(); | 116 | void redraw(); |
116 | void slotWeekChanged( bool bStartOnMonday ); | 117 | void slotWeekChanged( bool bStartOnMonday ); |
117 | void slotClockChanged( bool a ); | 118 | void slotClockChanged( bool a ); |
118 | 119 | ||
119 | signals: | 120 | signals: |
120 | void showDate( int y, int m, int d ); | 121 | void showDate( int y, int m, int d ); |
121 | 122 | ||
122 | protected slots: | 123 | protected slots: |
123 | void keyPressEvent(QKeyEvent *); | 124 | void keyPressEvent(QKeyEvent *); |
124 | 125 | ||
125 | private slots: | 126 | private slots: |
126 | void showDay( int day ); | 127 | void showDay( int day ); |
127 | void dateChanged( QDate &newdate ); | 128 | void dateChanged( QDate &newdate ); |
@@ -132,35 +133,35 @@ private slots: | |||
132 | private: | 133 | private: |
133 | void getEvents(); | 134 | void getEvents(); |
134 | 135 | ||
135 | /** | 136 | /** |
136 | * Wow that's a hell lot of code duplication | 137 | * Wow that's a hell lot of code duplication |
137 | * in datebook. I vote for a common base class | 138 | * in datebook. I vote for a common base class |
138 | * but never the less. This add a note | 139 | * but never the less. This add a note |
139 | * that the Event is an all day event | 140 | * that the Event is an all day event |
140 | * | 141 | * |
141 | */ | 142 | */ |
142 | void generateAllDayTooltext( QString& text ); | 143 | void generateAllDayTooltext( QString& text ); |
143 | 144 | ||
144 | /** | 145 | /** |
145 | * This will add the times to the text | 146 | * This will add the times to the text |
146 | * It will be shown in the Tooltip bubble | 147 | * It will be shown in the Tooltip bubble |
147 | */ | 148 | */ |
148 | void generateNormalTooltext( QString& text, | 149 | void generateNormalTooltext( QString& text, |
149 | const EffectiveEvent &ev); | 150 | const EffectiveEvent &ev); |
150 | int year; | 151 | int year; |
151 | int _week; | 152 | int _week; |
152 | int dow; | 153 | int dow; |
153 | QDate bdate; | 154 | QDate bdate; |
154 | DateBookWeekHeader *header; | 155 | DateBookWeekHeader *header; |
155 | DateBookWeekView *view; | 156 | DateBookWeekView *view; |
156 | DateBookDB *db; | 157 | DateBookDBHoliday *db; |
157 | QLabel *lblDesc; | 158 | QLabel *lblDesc; |
158 | QTimer *tHide; | 159 | QTimer *tHide; |
159 | int startTime; | 160 | int startTime; |
160 | bool ampm; | 161 | bool ampm; |
161 | bool bStartOnMonday; | 162 | bool bStartOnMonday; |
162 | }; | 163 | }; |
163 | 164 | ||
164 | 165 | ||
165 | bool calcWeek( const QDate &d, int &week, int &year, bool startOnMonday = false ); | 166 | bool calcWeek( const QDate &d, int &week, int &year, bool startOnMonday = false ); |
166 | #endif | 167 | #endif |
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 | |||
@@ -1,28 +1,29 @@ | |||
1 | #include "namespace_hack.h" | 1 | #include "namespace_hack.h" |
2 | #include "datebookweeklst.h" | 2 | #include "datebookweeklst.h" |
3 | 3 | ||
4 | #include "datebook.h" | 4 | #include "datebook.h" |
5 | #include "datebooktypes.h" | ||
5 | 6 | ||
6 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
7 | 8 | ||
8 | #include <qpe/datebookmonth.h> | 9 | #include <qpe/datebookmonth.h> |
9 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
10 | #include <qpe/ir.h> | 11 | #include <qpe/ir.h> |
11 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
12 | 13 | ||
13 | #include <qlayout.h> | 14 | #include <qlayout.h> |
14 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
15 | #include <qtl.h> | 16 | #include <qtl.h> |
16 | 17 | ||
17 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); | 18 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); |
18 | 19 | ||
19 | using namespace Opie::Ui; | 20 | using namespace Opie::Ui; |
20 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) | 21 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) |
21 | : DateBookWeekLstHeaderBase(parent, name, fl) | 22 | : DateBookWeekLstHeaderBase(parent, name, fl) |
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") ); |
@@ -296,49 +297,49 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | |||
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 ), |
324 | db( newDB ), | 325 | db( newDB ), |
325 | startTime( 0 ), | 326 | startTime( 0 ), |
326 | ampm( ap ), | 327 | ampm( ap ), |
327 | bStartOnMonday(onM) | 328 | bStartOnMonday(onM) |
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"); |
@@ -362,55 +363,55 @@ void DateBookWeekLst::setDbl(bool on) { | |||
362 | } | 363 | } |
363 | void DateBookWeekLst::redraw() {getEvents();} | 364 | void DateBookWeekLst::redraw() {getEvents();} |
364 | 365 | ||
365 | QDate DateBookWeekLst::date() { | 366 | QDate DateBookWeekLst::date() { |
366 | return bdate; | 367 | return bdate; |
367 | } | 368 | } |
368 | 369 | ||
369 | // return the date at the beginning of the week... | 370 | // return the date at the beginning of the week... |
370 | // copied from DateBookWeek | 371 | // copied from DateBookWeek |
371 | QDate DateBookWeekLst::weekDate() const | 372 | 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 | } |
383 | 384 | ||
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 | } |
412 | 413 | ||
413 | void DateBookWeekLst::dateChanged(QDate &newdate) { | 414 | void DateBookWeekLst::dateChanged(QDate &newdate) { |
414 | bdate=newdate; | 415 | bdate=newdate; |
415 | getEvents(); | 416 | getEvents(); |
416 | } | 417 | } |
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 | |||
@@ -1,40 +1,41 @@ | |||
1 | #ifndef DATEBOOKWEEKLST | 1 | #ifndef DATEBOOKWEEKLST |
2 | #define DATEBOOKWEEKLST | 2 | #define DATEBOOKWEEKLST |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qdatetime.h> | 5 | #include <qdatetime.h> |
6 | #include <qpe/event.h> | 6 | #include <qpe/event.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qscrollview.h> | 8 | #include <qscrollview.h> |
9 | 9 | ||
10 | #include "datebookweeklstheader.h" | 10 | #include "datebookweeklstheader.h" |
11 | #include "datebookweeklstdayhdr.h" | 11 | #include "datebookweeklstdayhdr.h" |
12 | 12 | ||
13 | #include <opie2/oclickablelabel.h> | 13 | #include <opie2/oclickablelabel.h> |
14 | 14 | ||
15 | class QDateTime; | 15 | class QDateTime; |
16 | class DateBookDB; | 16 | class DateBookDB; |
17 | class DateBookDBHoliday; | ||
17 | 18 | ||
18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase | 19 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase |
19 | { | 20 | { |
20 | Q_OBJECT | 21 | Q_OBJECT |
21 | public: | 22 | 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(); |
25 | void setDate(const QDate &d); | 26 | void setDate(const QDate &d); |
26 | 27 | ||
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; |
@@ -109,69 +110,69 @@ protected slots: | |||
109 | class DateBookWeekLstDblView: public QWidget { | 110 | class DateBookWeekLstDblView: public QWidget { |
110 | Q_OBJECT | 111 | Q_OBJECT |
111 | public: | 112 | 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: |
118 | void editEvent(const Event &e); | 119 | void editEvent(const Event &e); |
119 | void duplicateEvent(const Event &e); | 120 | void duplicateEvent(const Event &e); |
120 | void removeEvent(const Event &e); | 121 | void removeEvent(const Event &e); |
121 | void beamEvent(const Event &e); | 122 | void beamEvent(const Event &e); |
122 | void redraw(); | 123 | void redraw(); |
123 | void showDate(int y, int m, int d); | 124 | void showDate(int y, int m, int d); |
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 | }; |
127 | 128 | ||
128 | class DateBookWeekLst : public QWidget | 129 | class DateBookWeekLst : public QWidget |
129 | { | 130 | { |
130 | Q_OBJECT | 131 | Q_OBJECT |
131 | 132 | ||
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(); |
137 | void setDate( int y, int w ); | 138 | void setDate( int y, int w ); |
138 | void setDate(const QDate &d ); | 139 | void setDate(const QDate &d ); |
139 | int week() const { return _week; }; | 140 | int week() const { return _week; }; |
140 | QDate date(); | 141 | QDate date(); |
141 | QDate weekDate() const; | 142 | QDate weekDate() const; |
142 | 143 | ||
143 | public slots: | 144 | public slots: |
144 | void redraw(); | 145 | void redraw(); |
145 | void dateChanged(QDate &date); | 146 | void dateChanged(QDate &date); |
146 | 147 | ||
147 | protected slots: | 148 | protected slots: |
148 | void keyPressEvent(QKeyEvent *); | 149 | void keyPressEvent(QKeyEvent *); |
149 | void setDbl(bool on); | 150 | void setDbl(bool on); |
150 | 151 | ||
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; |
163 | bool ampm; | 164 | bool ampm; |
164 | bool bStartOnMonday; | 165 | bool bStartOnMonday; |
165 | bool dbl; | 166 | bool dbl; |
166 | QDate bdate; | 167 | QDate bdate; |
167 | int year, _week,dow; | 168 | int year, _week,dow; |
168 | DateBookWeekLstHeader *header; | 169 | DateBookWeekLstHeader *header; |
169 | QWidget *view; | 170 | QWidget *view; |
170 | QVBoxLayout *layout; | 171 | QVBoxLayout *layout; |
171 | QScrollView *scroll; | 172 | QScrollView *scroll; |
172 | 173 | ||
173 | void getEvents(); | 174 | void getEvents(); |
174 | }; | 175 | }; |
175 | 176 | ||
176 | #endif | 177 | #endif |
177 | 178 | ||