-rw-r--r-- | core/pim/datebook/datebook.cpp | 50 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 124 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 18 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettingsbase.ui | 59 | ||||
-rw-r--r-- | core/pim/datebook/datebooktypes.h | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 5 |
8 files changed, 188 insertions, 84 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index a7f6691..8ae4f84 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -1,1227 +1,1211 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | ** $Id$ | 19 | ** $Id$ |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | 22 | ||
23 | #define QTOPIA_INTERNAL_FD | 23 | #define QTOPIA_INTERNAL_FD |
24 | 24 | ||
25 | #include "datebook.h" | 25 | #include "datebook.h" |
26 | #include "datebookday.h" | 26 | #include "datebookday.h" |
27 | #include "datebooksettings.h" | 27 | #include "datebooksettings.h" |
28 | #include "datebookweek.h" | 28 | #include "datebookweek.h" |
29 | #include "datebookweeklst.h" | 29 | #include "datebookweeklst.h" |
30 | #include "dateentryimpl.h" | 30 | #include "dateentryimpl.h" |
31 | 31 | ||
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | #include <opie2/oholidaypluginif.h> | 33 | #include <opie2/oholidaypluginif.h> |
34 | #include <opie2/oholidayplugin.h> | 34 | #include <opie2/oholidayplugin.h> |
35 | #include <opie2/opluginloader.h> | 35 | #include <opie2/opluginloader.h> |
36 | #include <opie2/todayplugininterface.h> | 36 | #include <opie2/todayplugininterface.h> |
37 | 37 | ||
38 | #include <qpe/datebookmonth.h> | 38 | #include <qpe/datebookmonth.h> |
39 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/finddialog.h> | 41 | #include <qpe/finddialog.h> |
42 | #include <qpe/ir.h> | 42 | #include <qpe/ir.h> |
43 | #include <qpe/qpemessagebox.h> | 43 | #include <qpe/qpemessagebox.h> |
44 | #include <qpe/resource.h> | 44 | #include <qpe/resource.h> |
45 | #include <qpe/sound.h> | 45 | #include <qpe/sound.h> |
46 | #include <qpe/tzselect.h> | 46 | #include <qpe/tzselect.h> |
47 | 47 | ||
48 | #include <qaction.h> | 48 | #include <qaction.h> |
49 | #include <qcopchannel_qws.h> | 49 | #include <qcopchannel_qws.h> |
50 | #include <qlayout.h> | 50 | #include <qlayout.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qtl.h> | 53 | #include <qtl.h> |
54 | #include <qtoolbar.h> | 54 | #include <qtoolbar.h> |
55 | #include <qwidgetstack.h> | 55 | #include <qwidgetstack.h> |
56 | #include <qdir.h> | 56 | #include <qdir.h> |
57 | #include <qtopia/qlibrary.h> | 57 | #include <qtopia/qlibrary.h> |
58 | 58 | ||
59 | #include <sys/stat.h> | 59 | #include <sys/stat.h> |
60 | #include <sys/types.h> | 60 | #include <sys/types.h> |
61 | #include <fcntl.h> | 61 | #include <fcntl.h> |
62 | #include <unistd.h> | 62 | #include <unistd.h> |
63 | 63 | ||
64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
65 | 65 | ||
66 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 66 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
67 | : QMainWindow( parent, "datebook", f ), | 67 | : QMainWindow( parent, "datebook", f ), |
68 | aPreset( FALSE ), | 68 | aPreset( FALSE ), |
69 | presetTime( -1 ), | 69 | presetTime( -1 ), |
70 | startTime( 8 ), // an acceptable default | 70 | startTime( 8 ), // an acceptable default |
71 | rowStyle( 0 ), | 71 | rowStyle( 0 ), |
72 | bJumpToCurTime(FALSE), | 72 | bJumpToCurTime(FALSE), |
73 | syncing(FALSE), | 73 | syncing(FALSE), |
74 | inSearch(FALSE), | 74 | inSearch(FALSE), |
75 | alarmCounter(0) | 75 | alarmCounter(0) |
76 | { | 76 | { |
77 | bool needEvilHack= false; // if we need an Evil Hack | 77 | bool needEvilHack= false; // if we need an Evil Hack |
78 | QTime t; | 78 | QTime t; |
79 | t.start(); | 79 | t.start(); |
80 | db = new DateBookDBHoliday; | 80 | db = new DateBookDBHoliday; |
81 | odebug << "loading db t=" << t.elapsed() << oendl; | 81 | odebug << "loading db t=" << t.elapsed() << oendl; |
82 | db_holiday = new DateBookHoliday(); | 82 | db_holiday = new DateBookHoliday(); |
83 | db->db_holiday=db_holiday; | 83 | db->db_holiday=db_holiday; |
84 | 84 | ||
85 | loadSettings(); | 85 | loadSettings(); |
86 | setCaption( tr("Calendar") ); | 86 | setCaption( tr("Calendar") ); |
87 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 87 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); |
88 | 88 | ||
89 | setToolBarsMovable( FALSE ); | 89 | setToolBarsMovable( FALSE ); |
90 | 90 | ||
91 | views = new QWidgetStack( this ); | 91 | views = new QWidgetStack( this ); |
92 | setCentralWidget( views ); | 92 | setCentralWidget( views ); |
93 | 93 | ||
94 | dayView = 0; | 94 | dayView = 0; |
95 | weekView = 0; | 95 | weekView = 0; |
96 | weekLstView = 0; | 96 | weekLstView = 0; |
97 | monthView = 0; | 97 | monthView = 0; |
98 | 98 | ||
99 | // QToolBar *bar = new QToolBar( this ); | 99 | // QToolBar *bar = new QToolBar( this ); |
100 | // bar->setHorizontalStretchable( TRUE ); | 100 | // bar->setHorizontalStretchable( TRUE ); |
101 | 101 | ||
102 | // QMenuBar *mb = new QMenuBar( bar ); | 102 | // QMenuBar *mb = new QMenuBar( bar ); |
103 | // mb->setMargin( 0 ); | 103 | // mb->setMargin( 0 ); |
104 | 104 | ||
105 | // QPopupMenu *view = new QPopupMenu( this ); | 105 | // QPopupMenu *view = new QPopupMenu( this ); |
106 | // mb->insertItem( tr( "View" ), view ); | 106 | // mb->insertItem( tr( "View" ), view ); |
107 | 107 | ||
108 | QToolBar *sub_bar = new QToolBar(this); | 108 | QToolBar *sub_bar = new QToolBar(this); |
109 | sub_bar->setHorizontalStretchable(TRUE); | 109 | sub_bar->setHorizontalStretchable(TRUE); |
110 | 110 | ||
111 | QActionGroup *g = new QActionGroup( this ); | 111 | QActionGroup *g = new QActionGroup( this ); |
112 | g->setExclusive( TRUE ); | 112 | g->setExclusive( TRUE ); |
113 | 113 | ||
114 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 114 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
115 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 115 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
116 | a->addTo( sub_bar ); | 116 | a->addTo( sub_bar ); |
117 | 117 | ||
118 | sub_bar->addSeparator(); | 118 | sub_bar->addSeparator(); |
119 | 119 | ||
120 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); | 120 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); |
121 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | 121 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); |
122 | a->addTo( sub_bar ); | 122 | a->addTo( sub_bar ); |
123 | // a->addTo( view ); | 123 | // a->addTo( view ); |
124 | 124 | ||
125 | sub_bar->addSeparator(); | 125 | sub_bar->addSeparator(); |
126 | 126 | ||
127 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); | 127 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); |
128 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); | 128 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); |
129 | a->addTo( sub_bar ); | 129 | a->addTo( sub_bar ); |
130 | // a->addTo( view ); | 130 | // a->addTo( view ); |
131 | a->setToggleAction( TRUE ); | 131 | a->setToggleAction( TRUE ); |
132 | a->setOn( TRUE ); | 132 | a->setOn( TRUE ); |
133 | dayAction = a; | 133 | dayAction = a; |
134 | 134 | ||
135 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 135 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); |
136 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 136 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
137 | a->addTo( sub_bar ); | 137 | a->addTo( sub_bar ); |
138 | // a->addTo( view ); | 138 | // a->addTo( view ); |
139 | a->setToggleAction( TRUE ); | 139 | a->setToggleAction( TRUE ); |
140 | weekAction = a; | 140 | weekAction = a; |
141 | 141 | ||
142 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); | 142 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); |
143 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); | 143 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); |
144 | a->addTo( sub_bar ); | 144 | a->addTo( sub_bar ); |
145 | // a->addTo( view ); | 145 | // a->addTo( view ); |
146 | a->setToggleAction( TRUE ); | 146 | a->setToggleAction( TRUE ); |
147 | weekLstAction = a; | 147 | weekLstAction = a; |
148 | 148 | ||
149 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 149 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); |
150 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 150 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
151 | a->addTo( sub_bar ); | 151 | a->addTo( sub_bar ); |
152 | // a->addTo( view ); | 152 | // a->addTo( view ); |
153 | a->setToggleAction( TRUE ); | 153 | a->setToggleAction( TRUE ); |
154 | monthAction = a; | 154 | monthAction = a; |
155 | 155 | ||
156 | sub_bar->addSeparator(); | 156 | sub_bar->addSeparator(); |
157 | 157 | ||
158 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); | 158 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); |
159 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 159 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
160 | a->addTo( sub_bar ); | 160 | a->addTo( sub_bar ); |
161 | 161 | ||
162 | a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); | 162 | a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); |
163 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 163 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
164 | a->addTo( sub_bar ); | 164 | a->addTo( sub_bar ); |
165 | 165 | ||
166 | if(defaultView==DAY) viewDay(); | 166 | if(defaultView==DAY) viewDay(); |
167 | if(defaultView==WEEK) needEvilHack=true; // viewWeek(); | 167 | if(defaultView==WEEK) needEvilHack=true; // viewWeek(); |
168 | if(defaultView==WEEKLST) viewWeekLst(); | 168 | if(defaultView==WEEKLST) viewWeekLst(); |
169 | if(defaultView==MONTH) viewMonth(); | 169 | if(defaultView==MONTH) viewMonth(); |
170 | 170 | ||
171 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); | 171 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); |
172 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); | 172 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); |
173 | 173 | ||
174 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 174 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
175 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 175 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
176 | #endif | 176 | #endif |
177 | 177 | ||
178 | // listen on QPE/System | 178 | // listen on QPE/System |
179 | #if defined(Q_WS_QWS) | 179 | #if defined(Q_WS_QWS) |
180 | #if !defined(QT_NO_COP) | 180 | #if !defined(QT_NO_COP) |
181 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 181 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
182 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); | 182 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); |
183 | channel = new QCopChannel( "QPE/Datebook", this ); | 183 | channel = new QCopChannel( "QPE/Datebook", this ); |
184 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); | 184 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); |
185 | #endif | 185 | #endif |
186 | #endif | 186 | #endif |
187 | 187 | ||
188 | odebug << "done t=" << t.elapsed() << oendl; | 188 | odebug << "done t=" << t.elapsed() << oendl; |
189 | 189 | ||
190 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); | 190 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); |
191 | connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); | 191 | connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); |
192 | /* | 192 | /* |
193 | * Here is a problem description: | 193 | * Here is a problem description: |
194 | * When Weekview is the default view | 194 | * When Weekview is the default view |
195 | * a DateBookWeekView get's created | 195 | * a DateBookWeekView get's created |
196 | * redraw() get's called. So what? | 196 | * redraw() get's called. So what? |
197 | * Remember that we're still in the c'tor | 197 | * Remember that we're still in the c'tor |
198 | * and no final layout has happened? Ok | 198 | * and no final layout has happened? Ok |
199 | * now all Events get arranged. Their x | 199 | * now all Events get arranged. Their x |
200 | * position get's determined by a QHeader | 200 | * position get's determined by a QHeader |
201 | * position. But the QHeader isn't layouted or | 201 | * position. But the QHeader isn't layouted or |
202 | * at the right position. redraw() is a slot | 202 | * at the right position. redraw() is a slot |
203 | * so we'll call it then via a singleShot | 203 | * so we'll call it then via a singleShot |
204 | * from view() | 204 | * from view() |
205 | */ | 205 | */ |
206 | if( needEvilHack ){ | 206 | if( needEvilHack ){ |
207 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); | 207 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | void DateBook::receive( const QCString &msg, const QByteArray &data ) | 211 | void DateBook::receive( const QCString &msg, const QByteArray &data ) |
212 | { | 212 | { |
213 | QDataStream stream( data, IO_ReadOnly ); | 213 | QDataStream stream( data, IO_ReadOnly ); |
214 | if ( msg == "timeChange(QString)" ) { | 214 | if ( msg == "timeChange(QString)" ) { |
215 | // update active view! | 215 | // update active view! |
216 | if ( dayAction->isOn() ) | 216 | if ( dayAction->isOn() ) |
217 | viewDay(); | 217 | viewDay(); |
218 | else if ( weekAction->isOn() ) | 218 | else if ( weekAction->isOn() ) |
219 | viewWeek(); | 219 | viewWeek(); |
220 | else if ( monthAction->isOn() ) | 220 | else if ( monthAction->isOn() ) |
221 | viewMonth(); | 221 | viewMonth(); |
222 | } | 222 | } |
223 | else if (msg == "editEvent(int)") { | 223 | else if (msg == "editEvent(int)") { |
224 | int uid; | 224 | int uid; |
225 | stream >> uid; | 225 | stream >> uid; |
226 | Event e=db->eventByUID(uid); | 226 | Event e=db->eventByUID(uid); |
227 | editEvent(e); | 227 | editEvent(e); |
228 | }else if (msg == "viewDefault(QDate)"){ | 228 | }else if (msg == "viewDefault(QDate)"){ |
229 | QDate day; | 229 | QDate day; |
230 | stream >> day; | 230 | stream >> day; |
231 | viewDefault(day); | 231 | viewDefault(day); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | DateBook::~DateBook() | 235 | DateBook::~DateBook() |
236 | { | 236 | { |
237 | delete db_holiday; | 237 | delete db_holiday; |
238 | } | 238 | } |
239 | 239 | ||
240 | void DateBook::slotSettings() | 240 | void DateBook::slotSettings() |
241 | { | 241 | { |
242 | DateBookSettings frmSettings( ampm, this ); | 242 | DateBookSettings frmSettings( ampm, this ); |
243 | frmSettings.setStartTime( startTime ); | 243 | frmSettings.setStartTime( startTime ); |
244 | frmSettings.setAlarmPreset( aPreset, presetTime ); | 244 | frmSettings.setAlarmPreset( aPreset, presetTime ); |
245 | frmSettings.setJumpToCurTime( bJumpToCurTime ); | 245 | frmSettings.setJumpToCurTime( bJumpToCurTime ); |
246 | frmSettings.setRowStyle( rowStyle ); | 246 | frmSettings.setRowStyle( rowStyle ); |
247 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); | 247 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); |
248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); | 248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); |
249 | frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader()); | ||
249 | 250 | ||
250 | bool found=false; | 251 | bool found=false; |
251 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { | 252 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { |
252 | if ( frmSettings.comboLocation->text(i) == defaultLocation ) { | 253 | if ( frmSettings.comboLocation->text(i) == defaultLocation ) { |
253 | frmSettings.comboLocation->setCurrentItem(i); | 254 | frmSettings.comboLocation->setCurrentItem(i); |
254 | found=true; | 255 | found=true; |
255 | break; | 256 | break; |
256 | } | 257 | } |
257 | } | 258 | } |
258 | if(!found) { | 259 | if(!found) { |
259 | frmSettings.comboLocation->insertItem(defaultLocation); | 260 | frmSettings.comboLocation->insertItem(defaultLocation); |
260 | frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); | 261 | frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); |
261 | } | 262 | } |
262 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); | 263 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); |
263 | 264 | ||
264 | if ( QPEApplication::execDialog( &frmSettings ) ) { | 265 | if ( QPEApplication::execDialog( &frmSettings ) ) { |
266 | db_holiday->pluginManager()->save(); | ||
267 | db_holiday->reloadPlugins(); | ||
268 | |||
265 | aPreset = frmSettings.alarmPreset(); | 269 | aPreset = frmSettings.alarmPreset(); |
266 | presetTime = frmSettings.presetTime(); | 270 | presetTime = frmSettings.presetTime(); |
267 | startTime = frmSettings.startTime(); | 271 | startTime = frmSettings.startTime(); |
268 | bJumpToCurTime = frmSettings.jumpToCurTime(); | 272 | bJumpToCurTime = frmSettings.jumpToCurTime(); |
269 | rowStyle = frmSettings.rowStyle(); | 273 | rowStyle = frmSettings.rowStyle(); |
270 | defaultView=frmSettings.comboDefaultView->currentItem()+1; | 274 | defaultView=frmSettings.comboDefaultView->currentItem()+1; |
271 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); | 275 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); |
272 | defaultLocation=frmSettings.comboLocation->currentText(); | 276 | defaultLocation=frmSettings.comboLocation->currentText(); |
273 | defaultCategories=frmSettings.comboCategory->currentCategories(); | 277 | defaultCategories=frmSettings.comboCategory->currentCategories(); |
274 | 278 | ||
275 | if ( dayView ) { | 279 | if ( dayView ) { |
276 | dayView->setStartViewTime( startTime ); | 280 | dayView->setStartViewTime( startTime ); |
277 | dayView->setJumpToCurTime( bJumpToCurTime ); | 281 | dayView->setJumpToCurTime( bJumpToCurTime ); |
278 | dayView->setRowStyle( rowStyle ); | 282 | dayView->setRowStyle( rowStyle ); |
279 | } | 283 | } |
280 | if ( weekView ) { | 284 | if ( weekView ) { |
281 | weekView->setStartViewTime( startTime ); | 285 | weekView->setStartViewTime( startTime ); |
282 | } | 286 | } |
283 | saveSettings(); | 287 | saveSettings(); |
284 | 288 | ||
285 | // make the change obvious | 289 | // make the change obvious |
286 | if ( views->visibleWidget() ) { | 290 | if ( views->visibleWidget() ) { |
287 | if ( views->visibleWidget() == dayView ) | 291 | if ( views->visibleWidget() == dayView ) |
288 | dayView->redraw(); | 292 | dayView->redraw(); |
289 | else if ( views->visibleWidget() == weekView ) | 293 | else if ( views->visibleWidget() == weekView ) |
290 | weekView->redraw(); | 294 | weekView->redraw(); |
291 | else if ( views->visibleWidget() == weekLstView ) | 295 | else if ( views->visibleWidget() == weekLstView ) |
292 | weekLstView->redraw(); | 296 | weekLstView->redraw(); |
293 | } | 297 | } |
294 | } | 298 | } |
295 | } | 299 | } |
296 | 300 | ||
297 | void DateBook::fileNew() | 301 | void DateBook::fileNew() |
298 | { | 302 | { |
299 | slotNewEventFromKey(""); | 303 | slotNewEventFromKey(""); |
300 | } | 304 | } |
301 | 305 | ||
302 | QString DateBook::checkEvent(const Event &e) | 306 | QString DateBook::checkEvent(const Event &e) |
303 | { | 307 | { |
304 | /* check if overlaps with itself */ | 308 | /* check if overlaps with itself */ |
305 | bool checkFailed = FALSE; | 309 | bool checkFailed = FALSE; |
306 | 310 | ||
307 | /* check the next 12 repeats. should catch most problems */ | 311 | /* check the next 12 repeats. should catch most problems */ |
308 | QDate current_date = e.start().date(); | 312 | QDate current_date = e.start().date(); |
309 | Event previous = e; | 313 | Event previous = e; |
310 | for(int i = 0; i < 12; i++) | 314 | for(int i = 0; i < 12; i++) |
311 | { | 315 | { |
312 | QDateTime next; | 316 | QDateTime next; |
313 | if (!nextOccurance(previous, current_date.addDays(1), next)) { | 317 | if (!nextOccurance(previous, current_date.addDays(1), next)) { |
314 | break; // no more repeats | 318 | break; // no more repeats |
315 | } | 319 | } |
316 | if(next < previous.end()) { | 320 | if(next < previous.end()) { |
317 | checkFailed = TRUE; | 321 | checkFailed = TRUE; |
318 | break; | 322 | break; |
319 | } | 323 | } |
320 | current_date = next.date(); | 324 | current_date = next.date(); |
321 | } | 325 | } |
322 | 326 | ||
323 | if(checkFailed) | 327 | if(checkFailed) |
324 | return tr("Event duration is potentially longer\n" | 328 | return tr("Event duration is potentially longer\n" |
325 | "than interval between repeats."); | 329 | "than interval between repeats."); |
326 | 330 | ||
327 | return QString::null; | 331 | return QString::null; |
328 | } | 332 | } |
329 | 333 | ||
330 | QDate DateBook::currentDate() | 334 | QDate DateBook::currentDate() |
331 | { | 335 | { |
332 | QDate d = QDate::currentDate(); | 336 | QDate d = QDate::currentDate(); |
333 | 337 | ||
334 | if ( dayView && views->visibleWidget() == dayView ) { | 338 | if ( dayView && views->visibleWidget() == dayView ) { |
335 | d = dayView->date(); | 339 | d = dayView->date(); |
336 | } else if ( weekView && views->visibleWidget() == weekView ) { | 340 | } else if ( weekView && views->visibleWidget() == weekView ) { |
337 | d = weekView->date(); | 341 | d = weekView->date(); |
338 | } else if ( weekLstView && views->visibleWidget() == weekLstView ) { | 342 | } else if ( weekLstView && views->visibleWidget() == weekLstView ) { |
339 | d = weekLstView->date(); | 343 | d = weekLstView->date(); |
340 | } else if ( monthView && views->visibleWidget() == monthView ) { | 344 | } else if ( monthView && views->visibleWidget() == monthView ) { |
341 | d = monthView->selectedDate(); | 345 | d = monthView->selectedDate(); |
342 | } | 346 | } |
343 | 347 | ||
344 | return d; | 348 | return d; |
345 | } | 349 | } |
346 | 350 | ||
347 | void DateBook::view(int v, const QDate &d) { | 351 | void DateBook::view(int v, const QDate &d) { |
348 | if (v==DAY) { | 352 | if (v==DAY) { |
349 | initDay(); | 353 | initDay(); |
350 | dayAction->setOn( TRUE ); | 354 | dayAction->setOn( TRUE ); |
351 | dayView->setDate( d ); | 355 | dayView->setDate( d ); |
352 | views->raiseWidget( dayView ); | 356 | views->raiseWidget( dayView ); |
353 | dayView->redraw(); | 357 | dayView->redraw(); |
354 | } else if (v==WEEK) { | 358 | } else if (v==WEEK) { |
355 | initWeek(); | 359 | initWeek(); |
356 | weekAction->setOn( TRUE ); | 360 | weekAction->setOn( TRUE ); |
357 | weekView->setDate( d ); | 361 | weekView->setDate( d ); |
358 | views->raiseWidget( weekView ); | 362 | views->raiseWidget( weekView ); |
359 | weekView->redraw(); | 363 | weekView->redraw(); |
360 | } else if (v==WEEKLST) { | 364 | } else if (v==WEEKLST) { |
361 | initWeekLst(); | 365 | initWeekLst(); |
362 | weekLstAction->setOn( TRUE ); | 366 | weekLstAction->setOn( TRUE ); |
363 | weekLstView->setDate(d); | 367 | weekLstView->setDate(d); |
364 | views->raiseWidget( weekLstView ); | 368 | views->raiseWidget( weekLstView ); |
365 | weekLstView->redraw(); | 369 | weekLstView->redraw(); |
366 | } else if (v==MONTH) { | 370 | } else if (v==MONTH) { |
367 | initMonth(); | 371 | initMonth(); |
368 | monthAction->setOn( TRUE ); | 372 | monthAction->setOn( TRUE ); |
369 | monthView->setDate( d.year(), d.month(), d.day() ); | 373 | monthView->setDate( d.year(), d.month(), d.day() ); |
370 | views->raiseWidget( monthView ); | 374 | views->raiseWidget( monthView ); |
371 | monthView->redraw(); | 375 | monthView->redraw(); |
372 | } | 376 | } |
373 | } | 377 | } |
374 | 378 | ||
375 | void DateBook::viewDefault(const QDate &d) { | 379 | void DateBook::viewDefault(const QDate &d) { |
376 | view(defaultView,d); | 380 | view(defaultView,d); |
377 | } | 381 | } |
378 | 382 | ||
379 | void DateBook::viewDay() { | 383 | void DateBook::viewDay() { |
380 | view(DAY,currentDate()); | 384 | view(DAY,currentDate()); |
381 | } | 385 | } |
382 | 386 | ||
383 | void DateBook::viewWeek() { | 387 | void DateBook::viewWeek() { |
384 | view(WEEK,currentDate()); | 388 | view(WEEK,currentDate()); |
385 | } | 389 | } |
386 | 390 | ||
387 | void DateBook::viewWeekLst() { | 391 | void DateBook::viewWeekLst() { |
388 | view(WEEKLST,currentDate()); | 392 | view(WEEKLST,currentDate()); |
389 | } | 393 | } |
390 | 394 | ||
391 | void DateBook::viewMonth() { | 395 | void DateBook::viewMonth() { |
392 | view(MONTH,currentDate()); | 396 | view(MONTH,currentDate()); |
393 | } | 397 | } |
394 | 398 | ||
395 | void DateBook::insertEvent( const Event &e ) | 399 | void DateBook::insertEvent( const Event &e ) |
396 | { | 400 | { |
397 | Event dupEvent=e; | 401 | Event dupEvent=e; |
398 | if(!dupEvent.isValidUid() ) // tkcRom seems to be different | 402 | if(!dupEvent.isValidUid() ) // tkcRom seems to be different |
399 | dupEvent.assignUid(); | 403 | dupEvent.assignUid(); |
400 | dupEvent.setLocation(defaultLocation); | 404 | dupEvent.setLocation(defaultLocation); |
401 | dupEvent.setCategories(defaultCategories); | 405 | dupEvent.setCategories(defaultCategories); |
402 | db->addEvent(dupEvent); | 406 | db->addEvent(dupEvent); |
403 | emit newEvent(); | 407 | emit newEvent(); |
404 | } | 408 | } |
405 | 409 | ||
406 | void DateBook::duplicateEvent( const Event &e ) | 410 | void DateBook::duplicateEvent( const Event &e ) |
407 | { | 411 | { |
408 | // Alot of code duplication, as this is almost like editEvent(); | 412 | // Alot of code duplication, as this is almost like editEvent(); |
409 | if (syncing) { | 413 | if (syncing) { |
410 | QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); | 414 | QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); |
411 | return; | 415 | return; |
412 | } | 416 | } |
413 | 417 | ||
414 | Event dupevent(e); // Make a duplicate. | 418 | Event dupevent(e); // Make a duplicate. |
415 | 419 | ||
416 | // workaround added for text input. | 420 | // workaround added for text input. |
417 | QDialog editDlg( this, 0, TRUE ); | 421 | QDialog editDlg( this, 0, TRUE ); |
418 | DateEntry *entry; | 422 | DateEntry *entry; |
419 | editDlg.setCaption( tr("Duplicate Event") ); | 423 | editDlg.setCaption( tr("Duplicate Event") ); |
420 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); | 424 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); |
421 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); | 425 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); |
422 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 426 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
423 | // KLUDGE!!! | 427 | // KLUDGE!!! |
424 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 428 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
425 | vb->addWidget( sv ); | 429 | vb->addWidget( sv ); |
426 | entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" ); | 430 | entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" ); |
427 | entry->timezone->setEnabled( FALSE ); | 431 | entry->timezone->setEnabled( FALSE ); |
428 | sv->addChild( entry ); | 432 | sv->addChild( entry ); |
429 | 433 | ||
430 | while ( QPEApplication::execDialog( &editDlg ) ) { | 434 | while ( QPEApplication::execDialog( &editDlg ) ) { |
431 | Event newEv = entry->event(); | 435 | Event newEv = entry->event(); |
432 | QString error = checkEvent(newEv); | 436 | QString error = checkEvent(newEv); |
433 | if (!error.isNull()) { | 437 | if (!error.isNull()) { |
434 | if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) | 438 | if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) |
435 | continue; | 439 | continue; |
436 | } | 440 | } |
437 | /* | 441 | /* |
438 | * The problem: | 442 | * The problem: |
439 | * DateBookDB does remove repeating events not by uid but by the time | 443 | * DateBookDB does remove repeating events not by uid but by the time |
440 | * the recurrence was created | 444 | * the recurrence was created |
441 | * so we need to update that time as well | 445 | * so we need to update that time as well |
442 | */ | 446 | */ |
443 | Event::RepeatPattern rp = newEv.repeatPattern(); | 447 | Event::RepeatPattern rp = newEv.repeatPattern(); |
444 | rp.createTime = ::time( NULL ); | 448 | rp.createTime = ::time( NULL ); |
445 | newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern... | 449 | newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern... |
446 | if( newEv.uid() == e.uid() || !newEv.isValidUid() ) | 450 | if( newEv.uid() == e.uid() || !newEv.isValidUid() ) |
447 | newEv.assignUid(); | 451 | newEv.assignUid(); |
448 | 452 | ||
449 | db->addEvent(newEv); | 453 | db->addEvent(newEv); |
450 | emit newEvent(); | 454 | emit newEvent(); |
451 | break; | 455 | break; |
452 | } | 456 | } |
453 | } | 457 | } |
454 | 458 | ||
455 | void DateBook::editEvent( const Event &e ) | 459 | void DateBook::editEvent( const Event &e ) |
456 | { | 460 | { |
457 | if (syncing) { | 461 | if (syncing) { |
458 | QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); | 462 | QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); |
459 | return; | 463 | return; |
460 | } | 464 | } |
461 | 465 | ||
462 | // workaround added for text input. | 466 | // workaround added for text input. |
463 | QDialog editDlg( this, 0, TRUE ); | 467 | QDialog editDlg( this, 0, TRUE ); |
464 | DateEntry *entry; | 468 | DateEntry *entry; |
465 | editDlg.setCaption( tr("Edit Event") ); | 469 | editDlg.setCaption( tr("Edit Event") ); |
466 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); | 470 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); |
467 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); | 471 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); |
468 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 472 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
469 | // KLUDGE!!! | 473 | // KLUDGE!!! |
470 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 474 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
471 | vb->addWidget( sv ); | 475 | vb->addWidget( sv ); |
472 | entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); | 476 | entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); |
473 | entry->timezone->setEnabled( FALSE ); | 477 | entry->timezone->setEnabled( FALSE ); |
474 | sv->addChild( entry ); | 478 | sv->addChild( entry ); |
475 | 479 | ||
476 | while ( QPEApplication::execDialog( &editDlg ) ) { | 480 | while ( QPEApplication::execDialog( &editDlg ) ) { |
477 | Event newEv = entry->event(); | 481 | Event newEv = entry->event(); |
478 | if(newEv.description().isEmpty() && newEv.notes().isEmpty() ) | 482 | if(newEv.description().isEmpty() && newEv.notes().isEmpty() ) |
479 | break; | 483 | break; |
480 | newEv.setUid(e.uid()); // FIXME: Hack not to clear uid | 484 | newEv.setUid(e.uid()); // FIXME: Hack not to clear uid |
481 | QString error = checkEvent(newEv); | 485 | QString error = checkEvent(newEv); |
482 | if (!error.isNull()) { | 486 | if (!error.isNull()) { |
483 | if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue; | 487 | if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue; |
484 | } | 488 | } |
485 | db->editEvent(e, newEv); | 489 | db->editEvent(e, newEv); |
486 | emit newEvent(); | 490 | emit newEvent(); |
487 | break; | 491 | break; |
488 | } | 492 | } |
489 | } | 493 | } |
490 | 494 | ||
491 | void DateBook::removeEvent( const Event &e ) | 495 | void DateBook::removeEvent( const Event &e ) |
492 | { | 496 | { |
493 | if (syncing) { | 497 | if (syncing) { |
494 | QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); | 498 | QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); |
495 | return; | 499 | return; |
496 | } | 500 | } |
497 | 501 | ||
498 | QString strName = e.description(); | 502 | QString strName = e.description(); |
499 | 503 | ||
500 | if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) | 504 | if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) |
501 | return; | 505 | return; |
502 | 506 | ||
503 | db->removeEvent( e ); | 507 | db->removeEvent( e ); |
504 | if ( views->visibleWidget() == dayView && dayView ) | 508 | if ( views->visibleWidget() == dayView && dayView ) |
505 | dayView->redraw(); | 509 | dayView->redraw(); |
506 | 510 | ||
507 | } | 511 | } |
508 | 512 | ||
509 | void DateBook::addEvent( const Event &e ) | 513 | void DateBook::addEvent( const Event &e ) |
510 | { | 514 | { |
511 | QDate d = e.start().date(); | 515 | QDate d = e.start().date(); |
512 | initDay(); | 516 | initDay(); |
513 | dayView->setDate( d ); | 517 | dayView->setDate( d ); |
514 | } | 518 | } |
515 | 519 | ||
516 | void DateBook::showDay( int year, int month, int day ) | 520 | void DateBook::showDay( int year, int month, int day ) |
517 | { | 521 | { |
518 | QDate d(year, month, day); | 522 | QDate d(year, month, day); |
519 | view(DAY,d); | 523 | view(DAY,d); |
520 | } | 524 | } |
521 | 525 | ||
522 | void DateBook::initDay() | 526 | void DateBook::initDay() |
523 | { | 527 | { |
524 | if ( !dayView ) { | 528 | if ( !dayView ) { |
525 | dayView = new DateBookDay( ampm, onMonday, db, db_holiday, views, "day view" ); | 529 | dayView = new DateBookDay( ampm, onMonday, db, db_holiday, views, "day view" ); |
526 | views->addWidget( dayView, DAY ); | 530 | views->addWidget( dayView, DAY ); |
527 | dayView->setJumpToCurTime( bJumpToCurTime ); | 531 | dayView->setJumpToCurTime( bJumpToCurTime ); |
528 | dayView->setStartViewTime( startTime ); | 532 | dayView->setStartViewTime( startTime ); |
529 | dayView->setRowStyle( rowStyle ); | 533 | dayView->setRowStyle( rowStyle ); |
530 | connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); | 534 | connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); |
531 | connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); | 535 | connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); |
532 | connect( dayView, SIGNAL( removeEvent(const Event&) ), this, SLOT( removeEvent(const Event&) ) ); | 536 | connect( dayView, SIGNAL( removeEvent(const Event&) ), this, SLOT( removeEvent(const Event&) ) ); |
533 | connect( dayView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); | 537 | connect( dayView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); |
534 | connect( dayView, SIGNAL( duplicateEvent(const Event&) ), this, SLOT( duplicateEvent(const Event&) ) ); | 538 | connect( dayView, SIGNAL( duplicateEvent(const Event&) ), this, SLOT( duplicateEvent(const Event&) ) ); |
535 | connect( dayView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) ); | 539 | connect( dayView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) ); |
536 | connect( dayView, SIGNAL(sigNewEvent(const QString&)), this, SLOT(slotNewEventFromKey(const QString&)) ); | 540 | connect( dayView, SIGNAL(sigNewEvent(const QString&)), this, SLOT(slotNewEventFromKey(const QString&)) ); |
537 | } | 541 | } |
538 | } | 542 | } |
539 | 543 | ||
540 | void DateBook::initWeek() | 544 | void DateBook::initWeek() |
541 | { | 545 | { |
542 | if ( !weekView ) { | 546 | if ( !weekView ) { |
543 | weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); | 547 | weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); |
544 | weekView->setStartViewTime( startTime ); | 548 | weekView->setStartViewTime( startTime ); |
545 | views->addWidget( weekView, WEEK ); | 549 | views->addWidget( weekView, WEEK ); |
546 | connect( weekView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) ); | 550 | connect( weekView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) ); |
547 | connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) ); | 551 | connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) ); |
548 | } | 552 | } |
549 | 553 | ||
550 | //But also get it right: the year that we display can be different | 554 | //But also get it right: the year that we display can be different |
551 | //from the year of the current date. So, first find the year | 555 | //from the year of the current date. So, first find the year |
552 | //number of the current week. | 556 | //number of the current week. |
553 | int yearNumber, totWeeks; | 557 | int yearNumber, totWeeks; |
554 | calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); | 558 | calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); |
555 | 559 | ||
556 | QDate d = QDate( yearNumber, 12, 31 ); | 560 | QDate d = QDate( yearNumber, 12, 31 ); |
557 | calcWeek( d, totWeeks, yearNumber, onMonday ); | 561 | calcWeek( d, totWeeks, yearNumber, onMonday ); |
558 | 562 | ||
559 | while ( totWeeks == 1 ) { | 563 | while ( totWeeks == 1 ) { |
560 | d = d.addDays( -1 ); | 564 | d = d.addDays( -1 ); |
561 | calcWeek( d, totWeeks, yearNumber, onMonday ); | 565 | calcWeek( d, totWeeks, yearNumber, onMonday ); |
562 | } | 566 | } |
563 | } | 567 | } |
564 | 568 | ||
565 | void DateBook::initWeekLst() { | 569 | void DateBook::initWeekLst() { |
566 | if ( !weekLstView ) { | 570 | if ( !weekLstView ) { |
567 | weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" ); | 571 | weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" ); |
568 | views->addWidget( weekLstView, WEEKLST ); | 572 | views->addWidget( weekLstView, WEEKLST ); |
569 | 573 | ||
570 | //weekLstView->setStartViewTime( startTime ); | 574 | //weekLstView->setStartViewTime( startTime ); |
571 | connect( weekLstView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) ); | 575 | connect( weekLstView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) ); |
572 | connect( weekLstView, SIGNAL( addEvent(const QDateTime&,const QDateTime&,const QString&, const QString&) ), | 576 | connect( weekLstView, SIGNAL( addEvent(const QDateTime&,const QDateTime&,const QString&, const QString&) ), |
573 | this, SLOT( slotNewEntry(const QDateTime&,const QDateTime&,const QString&, const QString&) ) ); | 577 | this, SLOT( slotNewEntry(const QDateTime&,const QDateTime&,const QString&, const QString&) ) ); |
574 | connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) ); | 578 | connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) ); |
575 | connect( weekLstView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); | 579 | connect( weekLstView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); |
576 | connect( weekLstView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) ); | 580 | connect( weekLstView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) ); |
577 | connect( weekLstView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) ); | 581 | connect( weekLstView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) ); |
578 | connect( weekLstView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); | 582 | connect( weekLstView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); |
579 | } | 583 | } |
580 | } | 584 | } |
581 | 585 | ||
582 | 586 | ||
583 | void DateBook::initMonth() | 587 | void DateBook::initMonth() |
584 | { | 588 | { |
585 | if ( !monthView ) { | 589 | if ( !monthView ) { |
586 | monthView = new DateBookMonth( views, "month view", FALSE, db ); | 590 | monthView = new DateBookMonth( views, "month view", FALSE, db ); |
587 | views->addWidget( monthView, MONTH ); | 591 | views->addWidget( monthView, MONTH ); |
588 | connect( monthView, SIGNAL( dateClicked(int,int,int) ), this, SLOT( showDay(int,int,int) ) ); | 592 | connect( monthView, SIGNAL( dateClicked(int,int,int) ), this, SLOT( showDay(int,int,int) ) ); |
589 | connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) ); | 593 | connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) ); |
590 | qApp->processEvents(); | 594 | qApp->processEvents(); |
591 | } | 595 | } |
592 | } | 596 | } |
593 | 597 | ||
594 | void DateBook::loadSettings() | 598 | void DateBook::loadSettings() |
595 | { | 599 | { |
596 | Config qpeconfig( "qpe" ); | 600 | Config qpeconfig( "qpe" ); |
597 | qpeconfig.setGroup("Time"); | 601 | qpeconfig.setGroup("Time"); |
598 | ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); | 602 | ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); |
599 | onMonday = qpeconfig.readBoolEntry( "MONDAY" ); | 603 | onMonday = qpeconfig.readBoolEntry( "MONDAY" ); |
600 | 604 | ||
601 | Config config("DateBook"); | 605 | Config config("DateBook"); |
602 | config.setGroup("Main"); | 606 | config.setGroup("Main"); |
603 | startTime = config.readNumEntry("startviewtime", 8); | 607 | startTime = config.readNumEntry("startviewtime", 8); |
604 | aPreset = config.readBoolEntry("alarmpreset"); | 608 | aPreset = config.readBoolEntry("alarmpreset"); |
605 | presetTime = config.readNumEntry("presettime"); | 609 | presetTime = config.readNumEntry("presettime"); |
606 | bJumpToCurTime = config.readBoolEntry("jumptocurtime"); | 610 | bJumpToCurTime = config.readBoolEntry("jumptocurtime"); |
607 | rowStyle = config.readNumEntry("rowstyle"); | 611 | rowStyle = config.readNumEntry("rowstyle"); |
608 | defaultView = config.readNumEntry("defaultview",DAY); | 612 | defaultView = config.readNumEntry("defaultview",DAY); |
609 | weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); | 613 | weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); |
610 | 614 | ||
611 | defaultLocation=config.readEntry("defaultLocation"); | 615 | defaultLocation=config.readEntry("defaultLocation"); |
612 | QString tmpString=config.readEntry("defaultCategories"); | 616 | QString tmpString=config.readEntry("defaultCategories"); |
613 | QStringList tmpStringList=QStringList::split(",",tmpString); | 617 | QStringList tmpStringList=QStringList::split(",",tmpString); |
614 | defaultCategories.truncate(0); | 618 | defaultCategories.truncate(0); |
615 | 619 | ||
616 | for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { | 620 | for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { |
617 | defaultCategories.resize(defaultCategories.count()+1); | 621 | defaultCategories.resize(defaultCategories.count()+1); |
618 | defaultCategories[defaultCategories.count()-1]=(*i).toInt(); | 622 | defaultCategories[defaultCategories.count()-1]=(*i).toInt(); |
619 | } | 623 | } |
620 | } | 624 | } |
621 | 625 | ||
622 | void DateBook::saveSettings() | 626 | void DateBook::saveSettings() |
623 | { | 627 | { |
624 | Config config( "qpe" ); | 628 | Config config( "qpe" ); |
625 | Config configDB( "DateBook" ); | 629 | Config configDB( "DateBook" ); |
626 | configDB.setGroup( "Main" ); | 630 | configDB.setGroup( "Main" ); |
627 | configDB.writeEntry("startviewtime",startTime); | 631 | configDB.writeEntry("startviewtime",startTime); |
628 | configDB.writeEntry("alarmpreset",aPreset); | 632 | configDB.writeEntry("alarmpreset",aPreset); |
629 | configDB.writeEntry("presettime",presetTime); | 633 | configDB.writeEntry("presettime",presetTime); |
630 | configDB.writeEntry("jumptocurtime", bJumpToCurTime); | 634 | configDB.writeEntry("jumptocurtime", bJumpToCurTime); |
631 | configDB.writeEntry("rowstyle", rowStyle); | 635 | configDB.writeEntry("rowstyle", rowStyle); |
632 | configDB.writeEntry("defaultview",defaultView); | 636 | configDB.writeEntry("defaultview",defaultView); |
633 | configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); | 637 | configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); |
634 | 638 | ||
635 | configDB.writeEntry("defaultLocation",defaultLocation); | 639 | configDB.writeEntry("defaultLocation",defaultLocation); |
636 | QStringList tmpStringList; | 640 | QStringList tmpStringList; |
637 | for( uint i=0; i<defaultCategories.count(); i++) { | 641 | for( uint i=0; i<defaultCategories.count(); i++) { |
638 | tmpStringList << QString::number(defaultCategories[i]); | 642 | tmpStringList << QString::number(defaultCategories[i]); |
639 | } | 643 | } |
640 | configDB.writeEntry("defaultCategories",tmpStringList.join(",")); | 644 | configDB.writeEntry("defaultCategories",tmpStringList.join(",")); |
641 | } | 645 | } |
642 | 646 | ||
643 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) | 647 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) |
644 | { | 648 | { |
645 | bool needShow = FALSE; | 649 | bool needShow = FALSE; |
646 | if ( msg == "alarm(QDateTime,int)" ) { | 650 | if ( msg == "alarm(QDateTime,int)" ) { |
647 | QDataStream ds(data,IO_ReadOnly); | 651 | QDataStream ds(data,IO_ReadOnly); |
648 | QDateTime when; int warn; | 652 | QDateTime when; int warn; |
649 | ds >> when >> warn; | 653 | ds >> when >> warn; |
650 | 654 | ||
651 | // check to make it's okay to continue, | 655 | // check to make it's okay to continue, |
652 | // this is the case that the time was set ahead, and | 656 | // this is the case that the time was set ahead, and |
653 | // we are forced given a stale alarm... | 657 | // we are forced given a stale alarm... |
654 | QDateTime current = QDateTime::currentDateTime(); | 658 | QDateTime current = QDateTime::currentDateTime(); |
655 | if ( current.time().hour() != when.time().hour() && current.time().minute() != when.time().minute() ) | 659 | if ( current.time().hour() != when.time().hour() && current.time().minute() != when.time().minute() ) |
656 | return; | 660 | return; |
657 | 661 | ||
658 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60)); | 662 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60)); |
659 | if ( list.count() > 0 ) { | 663 | if ( list.count() > 0 ) { |
660 | QString msg; | 664 | QString msg; |
661 | bool bSound = FALSE; | 665 | bool bSound = FALSE; |
662 | int stopTimer = 0; | 666 | int stopTimer = 0; |
663 | bool found = FALSE; | 667 | bool found = FALSE; |
664 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { | 668 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { |
665 | if ( (*it).event().hasAlarm() ) { | 669 | if ( (*it).event().hasAlarm() ) { |
666 | found = TRUE; | 670 | found = TRUE; |
667 | msg += "<CENTER><B>" + (*it).description() + "</B>" | 671 | msg += "<CENTER><B>" + (*it).description() + "</B>" |
668 | + "<BR>" + (*it).location() + "<BR>" | 672 | + "<BR>" + (*it).location() + "<BR>" |
669 | + TimeString::dateString((*it).event().start(),ampm) | 673 | + TimeString::dateString((*it).event().start(),ampm) |
670 | + (warn | 674 | + (warn |
671 | ? tr(" (in " + QString::number(warn) | 675 | ? tr(" (in " + QString::number(warn) |
672 | + tr(" minutes)")) | 676 | + tr(" minutes)")) |
673 | : QString("")) | 677 | : QString("")) |
674 | + "<BR>" | 678 | + "<BR>" |
675 | + (*it).notes() + "</CENTER>"; | 679 | + (*it).notes() + "</CENTER>"; |
676 | if ( (*it).event().alarmSound() != Event::Silent ) { | 680 | if ( (*it).event().alarmSound() != Event::Silent ) { |
677 | bSound = TRUE; | 681 | bSound = TRUE; |
678 | } | 682 | } |
679 | } | 683 | } |
680 | } | 684 | } |
681 | if ( found ) { | 685 | if ( found ) { |
682 | if ( bSound ) { | 686 | if ( bSound ) { |
683 | Sound::soundAlarm(); | 687 | Sound::soundAlarm(); |
684 | alarmCounter = 0; | 688 | alarmCounter = 0; |
685 | stopTimer = startTimer( 5000 ); | 689 | stopTimer = startTimer( 5000 ); |
686 | } | 690 | } |
687 | QDialog dlg( this, 0, TRUE ); | 691 | QDialog dlg( this, 0, TRUE ); |
688 | QVBoxLayout *vb = new QVBoxLayout( &dlg ); | 692 | QVBoxLayout *vb = new QVBoxLayout( &dlg ); |
689 | QScrollView *view = new QScrollView( &dlg, "scrollView"); | 693 | QScrollView *view = new QScrollView( &dlg, "scrollView"); |
690 | view->setResizePolicy( QScrollView::AutoOneFit ); | 694 | view->setResizePolicy( QScrollView::AutoOneFit ); |
691 | vb->addWidget( view ); | 695 | vb->addWidget( view ); |
692 | QLabel *lblMsg = new QLabel( msg, &dlg ); | 696 | QLabel *lblMsg = new QLabel( msg, &dlg ); |
693 | view->addChild( lblMsg ); | 697 | view->addChild( lblMsg ); |
694 | QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg ); | 698 | QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg ); |
695 | connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) ); | 699 | connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) ); |
696 | vb->addWidget( cmdOk ); | 700 | vb->addWidget( cmdOk ); |
697 | 701 | ||
698 | needShow = QPEApplication::execDialog( &dlg ); | 702 | needShow = QPEApplication::execDialog( &dlg ); |
699 | 703 | ||
700 | if ( bSound ) | 704 | if ( bSound ) |
701 | killTimer( stopTimer ); | 705 | killTimer( stopTimer ); |
702 | } | 706 | } |
703 | } | 707 | } |
704 | } else if ( msg == "nextView()" ) { | 708 | } else if ( msg == "nextView()" ) { |
705 | needShow = true; | 709 | needShow = true; |
706 | if ( !qApp-> activeWindow ( )) { | 710 | if ( !qApp-> activeWindow ( )) { |
707 | needShow = TRUE; | 711 | needShow = TRUE; |
708 | } else { | 712 | } else { |
709 | QWidget* cur = views->visibleWidget(); | 713 | QWidget* cur = views->visibleWidget(); |
710 | if ( cur ) { | 714 | if ( cur ) { |
711 | if ( cur == dayView ) | 715 | if ( cur == dayView ) |
712 | viewWeek(); | 716 | viewWeek(); |
713 | else if ( cur == weekView ) | 717 | else if ( cur == weekView ) |
714 | viewWeekLst(); | 718 | viewWeekLst(); |
715 | else if ( cur == weekLstView ) | 719 | else if ( cur == weekLstView ) |
716 | viewMonth(); | 720 | viewMonth(); |
717 | else if ( cur == monthView ) | 721 | else if ( cur == monthView ) |
718 | viewDay(); | 722 | viewDay(); |
719 | needShow = TRUE; | 723 | needShow = TRUE; |
720 | } | 724 | } |
721 | } | 725 | } |
722 | } else if (msg == "editEvent(int)") { | 726 | } else if (msg == "editEvent(int)") { |
723 | /* simple copy from receive */ | 727 | /* simple copy from receive */ |
724 | QDataStream stream(data,IO_ReadOnly); | 728 | QDataStream stream(data,IO_ReadOnly); |
725 | int uid; | 729 | int uid; |
726 | stream >> uid; | 730 | stream >> uid; |
727 | Event e=db->eventByUID(uid); | 731 | Event e=db->eventByUID(uid); |
728 | editEvent(e); | 732 | editEvent(e); |
729 | } else if (msg == "viewDefault(QDate)"){ | 733 | } else if (msg == "viewDefault(QDate)"){ |
730 | /* simple copy from receive */ | 734 | /* simple copy from receive */ |
731 | QDataStream stream(data,IO_ReadOnly); | 735 | QDataStream stream(data,IO_ReadOnly); |
732 | QDate day; | 736 | QDate day; |
733 | stream >> day; | 737 | stream >> day; |
734 | viewDefault(day); | 738 | viewDefault(day); |
735 | needShow = true; | 739 | needShow = true; |
736 | } | 740 | } |
737 | 741 | ||
738 | if ( needShow ) { | 742 | if ( needShow ) { |
739 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 743 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
740 | // showMaximized(); | 744 | // showMaximized(); |
741 | #else | 745 | #else |
742 | // show(); | 746 | // show(); |
743 | #endif | 747 | #endif |
744 | // raise(); | 748 | // raise(); |
745 | QPEApplication::setKeepRunning(); | 749 | QPEApplication::setKeepRunning(); |
746 | // setActiveWindow(); | 750 | // setActiveWindow(); |
747 | } | 751 | } |
748 | } | 752 | } |
749 | 753 | ||
750 | void DateBook::reload() | 754 | void DateBook::reload() |
751 | { | 755 | { |
752 | db->reload(); | 756 | db->reload(); |
753 | if ( dayAction->isOn() ) viewDay(); | 757 | if ( dayAction->isOn() ) viewDay(); |
754 | else if ( weekAction->isOn() ) viewWeek(); | 758 | else if ( weekAction->isOn() ) viewWeek(); |
755 | else if ( monthAction->isOn() ) viewMonth(); | 759 | else if ( monthAction->isOn() ) viewMonth(); |
756 | syncing = FALSE; | 760 | syncing = FALSE; |
757 | } | 761 | } |
758 | 762 | ||
759 | void DateBook::flush() | 763 | void DateBook::flush() |
760 | { | 764 | { |
761 | syncing = TRUE; | 765 | syncing = TRUE; |
762 | db->save(); | 766 | db->save(); |
763 | } | 767 | } |
764 | 768 | ||
765 | void DateBook::timerEvent( QTimerEvent *e ) | 769 | void DateBook::timerEvent( QTimerEvent *e ) |
766 | { | 770 | { |
767 | if ( alarmCounter < 10 ) { | 771 | if ( alarmCounter < 10 ) { |
768 | alarmCounter++; | 772 | alarmCounter++; |
769 | Sound::soundAlarm(); | 773 | Sound::soundAlarm(); |
770 | } else { | 774 | } else { |
771 | killTimer( e->timerId() ); | 775 | killTimer( e->timerId() ); |
772 | } | 776 | } |
773 | } | 777 | } |
774 | 778 | ||
775 | void DateBook::changeClock( bool newClock ) | 779 | void DateBook::changeClock( bool newClock ) |
776 | { | 780 | { |
777 | ampm = newClock; | 781 | ampm = newClock; |
778 | // repaint the affected objects... | 782 | // repaint the affected objects... |
779 | if (dayView) dayView->redraw(); | 783 | if (dayView) dayView->redraw(); |
780 | if (weekView) weekView->redraw(); | 784 | if (weekView) weekView->redraw(); |
781 | if (weekLstView) weekLstView->redraw(); | 785 | if (weekLstView) weekLstView->redraw(); |
782 | } | 786 | } |
783 | 787 | ||
784 | void DateBook::changeWeek( bool m ) | 788 | void DateBook::changeWeek( bool m ) |
785 | { | 789 | { |
786 | /* no need to redraw, each widget catches. Do need to | 790 | /* no need to redraw, each widget catches. Do need to |
787 | store though for widgets we haven't made yet */ | 791 | store though for widgets we haven't made yet */ |
788 | onMonday = m; | 792 | onMonday = m; |
789 | } | 793 | } |
790 | 794 | ||
791 | void DateBook::slotToday() | 795 | void DateBook::slotToday() |
792 | { | 796 | { |
793 | // we need to view today using default view | 797 | // we need to view today using default view |
794 | view(defaultView,QDate::currentDate()); | 798 | view(defaultView,QDate::currentDate()); |
795 | } | 799 | } |
796 | 800 | ||
797 | void DateBook::closeEvent( QCloseEvent *e ) | 801 | void DateBook::closeEvent( QCloseEvent *e ) |
798 | { | 802 | { |
799 | if(syncing) { | 803 | if(syncing) { |
800 | /* no need to save, did that at flush */ | 804 | /* no need to save, did that at flush */ |
801 | e->accept(); | 805 | e->accept(); |
802 | return; | 806 | return; |
803 | } | 807 | } |
804 | 808 | ||
805 | // save settings will generate it's own error messages, no | 809 | // save settings will generate it's own error messages, no |
806 | // need to do checking ourselves. | 810 | // need to do checking ourselves. |
807 | saveSettings(); | 811 | saveSettings(); |
808 | if ( db->save() ) { | 812 | if ( db->save() ) { |
809 | e->accept(); | 813 | e->accept(); |
810 | } else { | 814 | } else { |
811 | if ( QMessageBox::critical( this, tr( "Out of space" ), | 815 | if ( QMessageBox::critical( this, tr( "Out of space" ), |
812 | tr("Calendar was unable to save\n" | 816 | tr("Calendar was unable to save\n" |
813 | "your changes.\n" | 817 | "your changes.\n" |
814 | "Free up some space and try again.\n" | 818 | "Free up some space and try again.\n" |
815 | "\nQuit anyway?"), | 819 | "\nQuit anyway?"), |
816 | QMessageBox::Yes|QMessageBox::Escape, | 820 | QMessageBox::Yes|QMessageBox::Escape, |
817 | QMessageBox::No|QMessageBox::Default ) | 821 | QMessageBox::No|QMessageBox::Default ) |
818 | != QMessageBox::No ) | 822 | != QMessageBox::No ) |
819 | e->accept(); | 823 | e->accept(); |
820 | else | 824 | else |
821 | e->ignore(); | 825 | e->ignore(); |
822 | } | 826 | } |
823 | } | 827 | } |
824 | 828 | ||
825 | // Entering directly from the "keyboard" | 829 | // Entering directly from the "keyboard" |
826 | void DateBook::slotNewEventFromKey( const QString &str ) | 830 | void DateBook::slotNewEventFromKey( const QString &str ) |
827 | { | 831 | { |
828 | if (syncing) { | 832 | if (syncing) { |
829 | QMessageBox::warning( this, tr("Calendar"), | 833 | QMessageBox::warning( this, tr("Calendar"), |
830 | tr( "Can not edit data, currently syncing") ); | 834 | tr( "Can not edit data, currently syncing") ); |
831 | return; | 835 | return; |
832 | } | 836 | } |
833 | 837 | ||
834 | // We get to here from a key pressed in the Day View | 838 | // We get to here from a key pressed in the Day View |
835 | // So we can assume some things. We want the string | 839 | // So we can assume some things. We want the string |
836 | // passed in to be part of the description. | 840 | // passed in to be part of the description. |
837 | QDateTime start, end; | 841 | QDateTime start, end; |
838 | if ( views->visibleWidget() == dayView ) { | 842 | if ( views->visibleWidget() == dayView ) { |
839 | dayView->selectedDates( start, end ); | 843 | dayView->selectedDates( start, end ); |
840 | } else if ( views->visibleWidget() == monthView ) { | 844 | } else if ( views->visibleWidget() == monthView ) { |
841 | QDate d = monthView->selectedDate(); | 845 | QDate d = monthView->selectedDate(); |
842 | start = end = d; | 846 | start = end = d; |
843 | start.setTime( QTime( 10, 0 ) ); | 847 | start.setTime( QTime( 10, 0 ) ); |
844 | end.setTime( QTime( 12, 0 ) ); | 848 | end.setTime( QTime( 12, 0 ) ); |
845 | } else if ( views->visibleWidget() == weekView ) { | 849 | } else if ( views->visibleWidget() == weekView ) { |
846 | QDate d = weekView->date(); | 850 | QDate d = weekView->date(); |
847 | start = end = d; | 851 | start = end = d; |
848 | start.setTime( QTime( 10, 0 ) ); | 852 | start.setTime( QTime( 10, 0 ) ); |
849 | end.setTime( QTime( 12, 0 ) ); | 853 | end.setTime( QTime( 12, 0 ) ); |
850 | } else if ( views->visibleWidget() == weekLstView ) { | 854 | } else if ( views->visibleWidget() == weekLstView ) { |
851 | QDate d = weekLstView->date(); | 855 | QDate d = weekLstView->date(); |
852 | start = end = d; | 856 | start = end = d; |
853 | start.setTime( QTime( 10, 0 ) ); | 857 | start.setTime( QTime( 10, 0 ) ); |
854 | end.setTime( QTime( 12, 0 ) ); | 858 | end.setTime( QTime( 12, 0 ) ); |
855 | } | 859 | } |
856 | slotNewEntry(start, end, str); | 860 | slotNewEntry(start, end, str); |
857 | } | 861 | } |
858 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) { | 862 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) { |
859 | // argh! This really needs to be encapsulated in a class | 863 | // argh! This really needs to be encapsulated in a class |
860 | // or function. | 864 | // or function. |
861 | QDialog newDlg( this, 0, TRUE ); | 865 | QDialog newDlg( this, 0, TRUE ); |
862 | newDlg.setCaption( DateEntryBase::tr("New Event") ); | 866 | newDlg.setCaption( DateEntryBase::tr("New Event") ); |
863 | DateEntry *e; | 867 | DateEntry *e; |
864 | QVBoxLayout *vb = new QVBoxLayout( &newDlg ); | 868 | QVBoxLayout *vb = new QVBoxLayout( &newDlg ); |
865 | QScrollView *sv = new QScrollView( &newDlg ); | 869 | QScrollView *sv = new QScrollView( &newDlg ); |
866 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 870 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
867 | sv->setFrameStyle( QFrame::NoFrame ); | 871 | sv->setFrameStyle( QFrame::NoFrame ); |
868 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 872 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
869 | vb->addWidget( sv ); | 873 | vb->addWidget( sv ); |
870 | 874 | ||
871 | Event ev; | 875 | Event ev; |
872 | ev.setDescription( str ); | 876 | ev.setDescription( str ); |
873 | // When the new gui comes in, change this... | 877 | // When the new gui comes in, change this... |
874 | if(location==0) { | 878 | if(location==0) { |
875 | if(defaultLocation.isEmpty()) { | 879 | if(defaultLocation.isEmpty()) { |
876 | ev.setLocation(tr("(Unknown)")); | 880 | ev.setLocation(tr("(Unknown)")); |
877 | } else { | 881 | } else { |
878 | ev.setLocation( defaultLocation ); | 882 | ev.setLocation( defaultLocation ); |
879 | } | 883 | } |
880 | } else { | 884 | } else { |
881 | ev.setLocation(location); | 885 | ev.setLocation(location); |
882 | } | 886 | } |
883 | ev.setCategories(defaultCategories); | 887 | ev.setCategories(defaultCategories); |
884 | ev.setStart( start ); | 888 | ev.setStart( start ); |
885 | ev.setEnd( end ); | 889 | ev.setEnd( end ); |
886 | 890 | ||
887 | e = new DateEntry( onMonday, ev, ampm, &newDlg ); | 891 | e = new DateEntry( onMonday, ev, ampm, &newDlg ); |
888 | e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); | 892 | e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); |
889 | sv->addChild( e ); | 893 | sv->addChild( e ); |
890 | while ( QPEApplication::execDialog( &newDlg ) ) { | 894 | while ( QPEApplication::execDialog( &newDlg ) ) { |
891 | ev = e->event(); | 895 | ev = e->event(); |
892 | ev.assignUid(); | 896 | ev.assignUid(); |
893 | QString error = checkEvent( ev ); | 897 | QString error = checkEvent( ev ); |
894 | if ( !error.isNull() ) { | 898 | if ( !error.isNull() ) { |
895 | if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) | 899 | if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) |
896 | continue; | 900 | continue; |
897 | } | 901 | } |
898 | db->addEvent( ev ); | 902 | db->addEvent( ev ); |
899 | emit newEvent(); | 903 | emit newEvent(); |
900 | break; | 904 | break; |
901 | } | 905 | } |
902 | } | 906 | } |
903 | 907 | ||
904 | void DateBook::setDocument( const QString &filename ) | 908 | void DateBook::setDocument( const QString &filename ) |
905 | { | 909 | { |
906 | if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; | 910 | if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; |
907 | 911 | ||
908 | QValueList<Event> tl = Event::readVCalendar( filename ); | 912 | QValueList<Event> tl = Event::readVCalendar( filename ); |
909 | for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) { | 913 | for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) { |
910 | db->addEvent( *it ); | 914 | db->addEvent( *it ); |
911 | } | 915 | } |
912 | } | 916 | } |
913 | 917 | ||
914 | static const char * beamfile = "/tmp/obex/event.vcs"; | 918 | static const char * beamfile = "/tmp/obex/event.vcs"; |
915 | 919 | ||
916 | void DateBook::beamEvent( const Event &e ) | 920 | void DateBook::beamEvent( const Event &e ) |
917 | { | 921 | { |
918 | odebug << "trying to beam" << oendl; | 922 | odebug << "trying to beam" << oendl; |
919 | unlink( beamfile ); // delete if exists | 923 | unlink( beamfile ); // delete if exists |
920 | mkdir("/tmp/obex/", 0755); | 924 | mkdir("/tmp/obex/", 0755); |
921 | Event::writeVCalendar( beamfile, e ); | 925 | Event::writeVCalendar( beamfile, e ); |
922 | Ir *ir = new Ir( this ); | 926 | Ir *ir = new Ir( this ); |
923 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 927 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
924 | QString description = e.description(); | 928 | QString description = e.description(); |
925 | ir->send( beamfile, description, "text/x-vCalendar" ); | 929 | ir->send( beamfile, description, "text/x-vCalendar" ); |
926 | } | 930 | } |
927 | 931 | ||
928 | void DateBook::beamDone( Ir *ir ) | 932 | void DateBook::beamDone( Ir *ir ) |
929 | { | 933 | { |
930 | delete ir; | 934 | delete ir; |
931 | unlink( beamfile ); | 935 | unlink( beamfile ); |
932 | } | 936 | } |
933 | 937 | ||
934 | void DateBook::slotFind() | 938 | void DateBook::slotFind() |
935 | { | 939 | { |
936 | // move it to the day view... | 940 | // move it to the day view... |
937 | viewDay(); | 941 | viewDay(); |
938 | FindDialog frmFind( "Calendar", this ); // no tr needed | 942 | FindDialog frmFind( "Calendar", this ); // no tr needed |
939 | frmFind.setUseDate( true ); | 943 | frmFind.setUseDate( true ); |
940 | frmFind.setDate( currentDate() ); | 944 | frmFind.setDate( currentDate() ); |
941 | QObject::connect( &frmFind, | 945 | QObject::connect( &frmFind, |
942 | SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), | 946 | SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), |
943 | this, | 947 | this, |
944 | SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) ); | 948 | SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) ); |
945 | QObject::connect( this, | 949 | QObject::connect( this, |
946 | SIGNAL(signalNotFound()), | 950 | SIGNAL(signalNotFound()), |
947 | &frmFind, | 951 | &frmFind, |
948 | SLOT(slotNotFound()) ); | 952 | SLOT(slotNotFound()) ); |
949 | QObject::connect( this, | 953 | QObject::connect( this, |
950 | SIGNAL(signalWrapAround()), | 954 | SIGNAL(signalWrapAround()), |
951 | &frmFind, | 955 | &frmFind, |
952 | SLOT(slotWrapAround()) ); | 956 | SLOT(slotWrapAround()) ); |
953 | frmFind.move(0,0); | 957 | frmFind.move(0,0); |
954 | frmFind.exec(); | 958 | frmFind.exec(); |
955 | inSearch = false; | 959 | inSearch = false; |
956 | } | 960 | } |
957 | 961 | ||
958 | bool catComp( QArray<int> cats, int category ) | 962 | bool catComp( QArray<int> cats, int category ) |
959 | { | 963 | { |
960 | bool returnMe; | 964 | bool returnMe; |
961 | int i, | 965 | int i, |
962 | count; | 966 | count; |
963 | 967 | ||
964 | count = int(cats.count()); | 968 | count = int(cats.count()); |
965 | returnMe = false; | 969 | returnMe = false; |
966 | if ( (category == -1 && count == 0) || category == -2 ) | 970 | if ( (category == -1 && count == 0) || category == -2 ) |
967 | returnMe = true; | 971 | returnMe = true; |
968 | else { | 972 | else { |
969 | for ( i = 0; i < count; i++ ) { | 973 | for ( i = 0; i < count; i++ ) { |
970 | if ( category == cats[i] ) { | 974 | if ( category == cats[i] ) { |
971 | returnMe = true; | 975 | returnMe = true; |
972 | break; | 976 | break; |
973 | } | 977 | } |
974 | } | 978 | } |
975 | } | 979 | } |
976 | return returnMe; | 980 | return returnMe; |
977 | } | 981 | } |
978 | 982 | ||
979 | 983 | ||
980 | void DateBook::slotDoFind( const QString& txt, const QDate &dt, | 984 | void DateBook::slotDoFind( const QString& txt, const QDate &dt, |
981 | bool caseSensitive, bool /*backwards*/, | 985 | bool caseSensitive, bool /*backwards*/, |
982 | int category ) | 986 | int category ) |
983 | { | 987 | { |
984 | QDateTime dtEnd( QDate(3001, 1, 1), QTime(0, 0, 0) ), | 988 | QDateTime dtEnd( QDate(3001, 1, 1), QTime(0, 0, 0) ), |
985 | next; | 989 | next; |
986 | 990 | ||
987 | QRegExp r( txt ); | 991 | QRegExp r( txt ); |
988 | r.setCaseSensitive( caseSensitive ); | 992 | r.setCaseSensitive( caseSensitive ); |
989 | 993 | ||
990 | 994 | ||
991 | static Event rev, nonrev; | 995 | static Event rev, nonrev; |
992 | if ( !inSearch ) { | 996 | if ( !inSearch ) { |
993 | rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) ); | 997 | rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) ); |
994 | nonrev.setStart( rev.start() ); | 998 | nonrev.setStart( rev.start() ); |
995 | inSearch = true; | 999 | inSearch = true; |
996 | } | 1000 | } |
997 | static QDate searchDate = dt; | 1001 | static QDate searchDate = dt; |
998 | // if true at the end we will start at the begin again and afterwards | 1002 | // if true at the end we will start at the begin again and afterwards |
999 | // we will emit string not found | 1003 | // we will emit string not found |
1000 | static bool wrapAround = true; | 1004 | static bool wrapAround = true; |
1001 | bool candidtate; | 1005 | bool candidtate; |
1002 | candidtate = false; | 1006 | candidtate = false; |
1003 | 1007 | ||
1004 | QValueList<Event> repeats = db->getRawRepeats(); | 1008 | QValueList<Event> repeats = db->getRawRepeats(); |
1005 | 1009 | ||
1006 | // find the candidate for the first repeat that matches... | 1010 | // find the candidate for the first repeat that matches... |
1007 | // first check if there can ever be a match and then compute | 1011 | // first check if there can ever be a match and then compute |
1008 | // the next occurence from start. See if this event is closer | 1012 | // the next occurence from start. See if this event is closer |
1009 | // to the beginning (start. next < dtEnd) and not smaller then the last | 1013 | // to the beginning (start. next < dtEnd) and not smaller then the last |
1010 | // result. If we find a canditate we set the dtEnd to the time | 1014 | // result. If we find a canditate we set the dtEnd to the time |
1011 | // of the ocurrence and rev to this occurence. | 1015 | // of the ocurrence and rev to this occurence. |
1012 | // set wrap around to true because there might be more events coming | 1016 | // set wrap around to true because there might be more events coming |
1013 | // and we're not at the end. | 1017 | // and we're not at the end. |
1014 | QValueListConstIterator<Event> it; | 1018 | QValueListConstIterator<Event> it; |
1015 | QDate start = dt; | 1019 | QDate start = dt; |
1016 | for ( it = repeats.begin(); it != repeats.end(); ++it ) { | 1020 | for ( it = repeats.begin(); it != repeats.end(); ++it ) { |
1017 | if ( catComp( (*it).categories(), category ) ) { | 1021 | if ( catComp( (*it).categories(), category ) ) { |
1018 | if ( (*it).match( r ) ) { | 1022 | if ( (*it).match( r ) ) { |
1019 | if ( nextOccurance( *it, start, next ) ) { | 1023 | if ( nextOccurance( *it, start, next ) ) { |
1020 | if ( next < dtEnd && !(next <= rev.start() ) ) { | 1024 | if ( next < dtEnd && !(next <= rev.start() ) ) { |
1021 | rev = *it; | 1025 | rev = *it; |
1022 | dtEnd = next; | 1026 | dtEnd = next; |
1023 | rev.setStart( next ); | 1027 | rev.setStart( next ); |
1024 | candidtate = true; | 1028 | candidtate = true; |
1025 | wrapAround = true; | 1029 | wrapAround = true; |
1026 | } | 1030 | } |
1027 | } | 1031 | } |
1028 | } | 1032 | } |
1029 | } | 1033 | } |
1030 | } | 1034 | } |
1031 | 1035 | ||
1032 | // now the for first non repeat... | 1036 | // now the for first non repeat... |
1033 | // dtEnd is set by the previous iteration of repeatingEvents | 1037 | // dtEnd is set by the previous iteration of repeatingEvents |
1034 | // check if we find a closer item. Also set dtEnd to find even | 1038 | // check if we find a closer item. Also set dtEnd to find even |
1035 | // more close occurrence | 1039 | // more close occurrence |
1036 | QValueList<Event> nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() ); | 1040 | QValueList<Event> nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() ); |
1037 | qHeapSort( nonRepeats.begin(), nonRepeats.end() ); | 1041 | qHeapSort( nonRepeats.begin(), nonRepeats.end() ); |
1038 | for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) { | 1042 | for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) { |
1039 | if ( catComp( (*it).categories(), category ) ) { | 1043 | if ( catComp( (*it).categories(), category ) ) { |
1040 | if ( (*it).start() < dtEnd ) { | 1044 | if ( (*it).start() < dtEnd ) { |
1041 | if ( (*it).match( r ) && !(*it <= nonrev) ) { | 1045 | if ( (*it).match( r ) && !(*it <= nonrev) ) { |
1042 | nonrev = *it; | 1046 | nonrev = *it; |
1043 | dtEnd = nonrev.start(); | 1047 | dtEnd = nonrev.start(); |
1044 | candidtate = true; | 1048 | candidtate = true; |
1045 | wrapAround = true; | 1049 | wrapAround = true; |
1046 | break; | 1050 | break; |
1047 | } | 1051 | } |
1048 | } | 1052 | } |
1049 | } | 1053 | } |
1050 | } | 1054 | } |
1051 | if ( candidtate ) { | 1055 | if ( candidtate ) { |
1052 | dayView->setStartViewTime( dtEnd.time().hour() ); | 1056 | dayView->setStartViewTime( dtEnd.time().hour() ); |
1053 | dayView->setDate( dtEnd.date().year(), dtEnd.date().month(), | 1057 | dayView->setDate( dtEnd.date().year(), dtEnd.date().month(), |
1054 | dtEnd.date().day() ); | 1058 | dtEnd.date().day() ); |
1055 | } else { | 1059 | } else { |
1056 | if ( wrapAround ) { | 1060 | if ( wrapAround ) { |
1057 | emit signalWrapAround(); | 1061 | emit signalWrapAround(); |
1058 | rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) ); | 1062 | rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) ); |
1059 | nonrev.setStart( rev.start() ); | 1063 | nonrev.setStart( rev.start() ); |
1060 | } else | 1064 | } else |
1061 | emit signalNotFound(); | 1065 | emit signalNotFound(); |
1062 | wrapAround = !wrapAround; | 1066 | wrapAround = !wrapAround; |
1063 | } | 1067 | } |
1064 | } | 1068 | } |
1065 | 1069 | ||
1066 | Event DateBookDBHack::eventByUID(int uid) { | 1070 | Event DateBookDBHack::eventByUID(int uid) { |
1067 | 1071 | ||
1068 | // FIXME: Dirty Hacks to get hold of the private event lists | 1072 | // FIXME: Dirty Hacks to get hold of the private event lists |
1069 | QDate start; | 1073 | QDate start; |
1070 | QDate end=start.addDays(-1); | 1074 | QDate end=start.addDays(-1); |
1071 | QValueList<Event> myEventList=getNonRepeatingEvents(start,end); | 1075 | QValueList<Event> myEventList=getNonRepeatingEvents(start,end); |
1072 | QValueList<Event> myRepeatEvents=getRawRepeats(); | 1076 | QValueList<Event> myRepeatEvents=getRawRepeats(); |
1073 | 1077 | ||
1074 | QValueList<Event>::ConstIterator it; | 1078 | QValueList<Event>::ConstIterator it; |
1075 | 1079 | ||
1076 | for (it = myEventList.begin(); it != myEventList.end(); it++) { | 1080 | for (it = myEventList.begin(); it != myEventList.end(); it++) { |
1077 | if ((*it).uid() == uid) return *it; | 1081 | if ((*it).uid() == uid) return *it; |
1078 | } | 1082 | } |
1079 | for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { | 1083 | for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { |
1080 | if ((*it).uid() == uid) return *it; | 1084 | if ((*it).uid() == uid) return *it; |
1081 | } | 1085 | } |
1082 | 1086 | ||
1083 | Event ev; | 1087 | Event ev; |
1084 | return ev; // return at least | 1088 | return ev; // return at least |
1085 | } | 1089 | } |
1086 | 1090 | ||
1087 | DateBookHoliday::DateBookHoliday() | 1091 | DateBookHoliday::DateBookHoliday() |
1088 | { | 1092 | { |
1089 | _pluginlist.clear(); | 1093 | _pluginlist.clear(); |
1090 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); | 1094 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); |
1091 | m_pluginLoader->setAutoDelete(true); | 1095 | m_pluginLoader->setAutoDelete(true); |
1096 | m_pluginManager = new Opie::Core::OPluginManager(m_pluginLoader); | ||
1097 | m_pluginManager->load(); | ||
1098 | |||
1099 | init(); | ||
1100 | } | ||
1101 | |||
1102 | void DateBookHoliday::reloadPlugins() | ||
1103 | { | ||
1104 | deinit(); | ||
1092 | init(); | 1105 | init(); |
1093 | } | 1106 | } |
1094 | 1107 | ||
1095 | DateBookHoliday::~DateBookHoliday() | 1108 | DateBookHoliday::~DateBookHoliday() |
1096 | { | 1109 | { |
1097 | deinit(); | 1110 | deinit(); |
1098 | delete m_pluginLoader; | 1111 | delete m_pluginLoader; |
1112 | delete m_pluginManager; | ||
1099 | } | 1113 | } |
1100 | 1114 | ||
1101 | void DateBookHoliday::deinit() | 1115 | void DateBookHoliday::deinit() |
1102 | { | 1116 | { |
1103 | /* | ||
1104 | QValueList<HPlugin*>::Iterator it; | 1117 | QValueList<HPlugin*>::Iterator it; |
1105 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1118 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
1106 | HPlugin*_pl = *it; | 1119 | HPlugin*_pl = *it; |
1107 | // destructs itself? | 1120 | *it = 0; |
1108 | _pl->_if->release(); | ||
1109 | _pl->_lib->unload(); | ||
1110 | delete _pl->_lib; | ||
1111 | delete _pl; | 1121 | delete _pl; |
1112 | } | 1122 | } |
1113 | _pluginlist.clear(); | 1123 | _pluginlist.clear(); |
1114 | */ | ||
1115 | } | 1124 | } |
1116 | 1125 | ||
1117 | #if 0 | 1126 | #if 0 |
1118 | void debugLst( const Opie::Core::OPluginItem::List& lst ) { | 1127 | void debugLst( const Opie::Core::OPluginItem::List& lst ) { |
1119 | for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) | 1128 | for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) |
1120 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; | 1129 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; |
1121 | } | 1130 | } |
1122 | #endif | 1131 | #endif |
1123 | 1132 | ||
1124 | void DateBookHoliday::init() | 1133 | void DateBookHoliday::init() |
1125 | { | 1134 | { |
1126 | #if 0 | ||
1127 | deinit(); | 1135 | deinit(); |
1128 | #endif | 1136 | |
1129 | Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false ); | 1137 | Opie::Core::OPluginItem::List lst = m_pluginLoader->filtered(true); |
1130 | // debugLst( lst ); | 1138 | // debugLst( lst ); |
1131 | for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ | 1139 | for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ |
1132 | Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); | 1140 | Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); |
1133 | if (hif) { | 1141 | if (hif) { |
1134 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | 1142 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); |
1135 | if (pl) { | 1143 | if (pl) { |
1136 | HPlugin*_pl=new HPlugin; | 1144 | HPlugin*_pl=new HPlugin; |
1137 | _pl->_plugin = pl; | 1145 | _pl->_plugin = pl; |
1138 | odebug << "Found holiday " << pl->description()<<oendl; | 1146 | odebug << "Found holiday " << pl->description()<<oendl; |
1139 | _pluginlist.append(_pl); | 1147 | _pluginlist.append(_pl); |
1140 | //_pl->_if = hif; | 1148 | //_pl->_if = hif; |
1141 | } | 1149 | } |
1142 | } | 1150 | } |
1143 | } | 1151 | } |
1144 | #if 0 | ||
1145 | QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; | ||
1146 | QDir dir( path, "lib*.so" ); | ||
1147 | QStringList list = dir.entryList(); | ||
1148 | QStringList::Iterator it; | ||
1149 | for (it=list.begin();it!=list.end();++it) { | ||
1150 | Opie::Datebook::HolidayPluginIf*hif = 0; | ||
1151 | QLibrary*lib=new QLibrary(path+"/"+*it); | ||
1152 | if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) { | ||
1153 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | ||
1154 | if (pl) { | ||
1155 | HPlugin*_pl=new HPlugin; | ||
1156 | _pl->_plugin = pl; | ||
1157 | odebug << "Found holiday " << pl->description()<<oendl; | ||
1158 | _pl->_lib = lib; | ||
1159 | _pl->_if = hif; | ||
1160 | _pluginlist.append(_pl); | ||
1161 | } else { | ||
1162 | } | ||
1163 | } else { | ||
1164 | delete lib; | ||
1165 | } | ||
1166 | } | ||
1167 | #endif | ||
1168 | } | 1152 | } |
1169 | 1153 | ||
1170 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) | 1154 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) |
1171 | { | 1155 | { |
1172 | QStringList ret; | 1156 | QStringList ret; |
1173 | QValueList<HPlugin*>::Iterator it; | 1157 | QValueList<HPlugin*>::Iterator it; |
1174 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1158 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
1175 | HPlugin*_pl = *it; | 1159 | HPlugin*_pl = *it; |
1176 | ret+=_pl->_plugin->entries(aDate); | 1160 | ret+=_pl->_plugin->entries(aDate); |
1177 | } | 1161 | } |
1178 | return ret; | 1162 | return ret; |
1179 | } | 1163 | } |
1180 | 1164 | ||
1181 | QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day) | 1165 | QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day) |
1182 | { | 1166 | { |
1183 | return holidaylist(QDate(year,month,day)); | 1167 | return holidaylist(QDate(year,month,day)); |
1184 | } | 1168 | } |
1185 | 1169 | ||
1186 | QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to ) | 1170 | QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to ) |
1187 | { | 1171 | { |
1188 | QValueList<EffectiveEvent> ret; | 1172 | QValueList<EffectiveEvent> ret; |
1189 | QValueList<HPlugin*>::Iterator it; | 1173 | QValueList<HPlugin*>::Iterator it; |
1190 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1174 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
1191 | HPlugin*_pl = *it; | 1175 | HPlugin*_pl = *it; |
1192 | ret+=_pl->_plugin->events(from,to); | 1176 | ret+=_pl->_plugin->events(from,to); |
1193 | } | 1177 | } |
1194 | return ret; | 1178 | return ret; |
1195 | } | 1179 | } |
1196 | 1180 | ||
1197 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ) | 1181 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ) |
1198 | { | 1182 | { |
1199 | return DateBookDBHack::getEffectiveEvents(from,to); | 1183 | return DateBookDBHack::getEffectiveEvents(from,to); |
1200 | } | 1184 | } |
1201 | 1185 | ||
1202 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start) | 1186 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start) |
1203 | { | 1187 | { |
1204 | return DateBookDBHack::getEffectiveEvents(start); | 1188 | return DateBookDBHack::getEffectiveEvents(start); |
1205 | } | 1189 | } |
1206 | 1190 | ||
1207 | QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start) | 1191 | QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start) |
1208 | { | 1192 | { |
1209 | return getEffectiveEvents(start.date(),start.date()); | 1193 | return getEffectiveEvents(start.date(),start.date()); |
1210 | } | 1194 | } |
1211 | 1195 | ||
1212 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to ) | 1196 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to ) |
1213 | { | 1197 | { |
1214 | QValueList<EffectiveEvent> ret; | 1198 | QValueList<EffectiveEvent> ret; |
1215 | odebug << "Ueberlagert 1" << oendl; | 1199 | odebug << "Ueberlagert 1" << oendl; |
1216 | if (db_holiday) { | 1200 | if (db_holiday) { |
1217 | ret+=db_holiday->getEffectiveEvents(from,to); | 1201 | ret+=db_holiday->getEffectiveEvents(from,to); |
1218 | } | 1202 | } |
1219 | ret+=getEffectiveEventsNoHoliday(from,to); | 1203 | ret+=getEffectiveEventsNoHoliday(from,to); |
1220 | return ret; | 1204 | return ret; |
1221 | } | 1205 | } |
1222 | 1206 | ||
1223 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start) | 1207 | QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start) |
1224 | { | 1208 | { |
1225 | odebug << "Ueberlagert 2" << oendl; | 1209 | odebug << "Ueberlagert 2" << oendl; |
1226 | return DateBookDBHack::getEffectiveEvents(start); | 1210 | return DateBookDBHack::getEffectiveEvents(start); |
1227 | } | 1211 | } |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 00ddd05..26f0303 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -1,946 +1,947 @@ | |||
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 "datebooktypes.h" |
23 | #include "datebookdayheaderimpl.h" | 23 | #include "datebookdayheaderimpl.h" |
24 | #include "datebookdayallday.h" | 24 | #include "datebookdayallday.h" |
25 | 25 | ||
26 | #include <opie2/oholidayplugin.h> | 26 | #include <opie2/oholidayplugin.h> |
27 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/ir.h> | 29 | #include <qpe/ir.h> |
30 | 30 | ||
31 | #include <qsimplerichtext.h> | 31 | #include <qsimplerichtext.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | 33 | ||
34 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | 36 | ||
37 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) | 37 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) |
38 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) | 38 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) |
39 | { | 39 | { |
40 | enableClipper(TRUE); | 40 | enableClipper(TRUE); |
41 | setTopMargin( 0 ); | 41 | setTopMargin( 0 ); |
42 | horizontalHeader()->hide(); | 42 | horizontalHeader()->hide(); |
43 | setLeftMargin(38); | 43 | setLeftMargin(38); |
44 | setColumnStretchable( 0, TRUE ); | 44 | setColumnStretchable( 0, TRUE ); |
45 | setHScrollBarMode( QScrollView::AlwaysOff ); | 45 | setHScrollBarMode( QScrollView::AlwaysOff ); |
46 | verticalHeader()->setPalette(white); | 46 | verticalHeader()->setPalette(white); |
47 | verticalHeader()->setResizeEnabled(FALSE); | 47 | verticalHeader()->setResizeEnabled(FALSE); |
48 | setSelectionMode( Single ); | 48 | setSelectionMode( Single ); |
49 | 49 | ||
50 | // get rid of being able to edit things... | 50 | // get rid of being able to edit things... |
51 | QTableItem *tmp; | 51 | QTableItem *tmp; |
52 | int row; | 52 | int row; |
53 | for ( row = 0; row < numRows(); row++ ) { | 53 | for ( row = 0; row < numRows(); row++ ) { |
54 | tmp = new QTableItem( this, QTableItem::Never, QString::null); | 54 | tmp = new QTableItem( this, QTableItem::Never, QString::null); |
55 | setItem( row, 0, tmp ); | 55 | setItem( row, 0, tmp ); |
56 | //setRowHeight( row, 40); | 56 | //setRowHeight( row, 40); |
57 | } | 57 | } |
58 | 58 | ||
59 | initHeader(); | 59 | initHeader(); |
60 | QObject::connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotChangeClock(bool)) ); | 60 | QObject::connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotChangeClock(bool)) ); |
61 | } | 61 | } |
62 | 62 | ||
63 | void DateBookDayView::initHeader() | 63 | void DateBookDayView::initHeader() |
64 | { | 64 | { |
65 | QString strTmp; | 65 | QString strTmp; |
66 | int preferredWidth = 0; | 66 | int preferredWidth = 0; |
67 | for ( int i = 0; i < 24; ++i ) { | 67 | for ( int i = 0; i < 24; ++i ) { |
68 | if ( ampm ) { | 68 | if ( ampm ) { |
69 | if ( i == 0 ) | 69 | if ( i == 0 ) |
70 | strTmp = QString::number(12) + ":00"; | 70 | strTmp = QString::number(12) + ":00"; |
71 | else if ( i == 12 ) | 71 | else if ( i == 12 ) |
72 | strTmp = QString::number(12) + tr(":00p"); | 72 | strTmp = QString::number(12) + tr(":00p"); |
73 | else if ( i > 12 ) | 73 | else if ( i > 12 ) |
74 | strTmp = QString::number( i - 12 ) + tr(":00p"); | 74 | strTmp = QString::number( i - 12 ) + tr(":00p"); |
75 | else | 75 | else |
76 | strTmp = QString::number(i) + ":00"; | 76 | strTmp = QString::number(i) + ":00"; |
77 | } else { | 77 | } else { |
78 | if ( i < 10 ) | 78 | if ( i < 10 ) |
79 | strTmp = "0" + QString::number(i) + ":00"; | 79 | strTmp = "0" + QString::number(i) + ":00"; |
80 | else | 80 | else |
81 | strTmp = QString::number(i) + ":00"; | 81 | strTmp = QString::number(i) + ":00"; |
82 | } | 82 | } |
83 | strTmp = strTmp.rightJustify( 6, ' ' ); | 83 | strTmp = strTmp.rightJustify( 6, ' ' ); |
84 | verticalHeader()->setLabel( i, strTmp ); | 84 | verticalHeader()->setLabel( i, strTmp ); |
85 | 85 | ||
86 | // Compute correct width for current Font (Add some space right) | 86 | // Compute correct width for current Font (Add some space right) |
87 | int actWidth = QFontMetrics( QFont::defaultFont() ).width( strTmp + QString(" ") ); | 87 | int actWidth = QFontMetrics( QFont::defaultFont() ).width( strTmp + QString(" ") ); |
88 | if ( preferredWidth < actWidth ) | 88 | if ( preferredWidth < actWidth ) |
89 | preferredWidth = actWidth; | 89 | preferredWidth = actWidth; |
90 | setRowStretchable( i, FALSE ); | 90 | setRowStretchable( i, FALSE ); |
91 | } | 91 | } |
92 | 92 | ||
93 | // It seems as if the header has a bug. It does not resize | 93 | // It seems as if the header has a bug. It does not resize |
94 | // correct horizontally if it is used vertical.. | 94 | // correct horizontally if it is used vertical.. |
95 | // Thus, we do it manually.. | 95 | // Thus, we do it manually.. |
96 | setLeftMargin( preferredWidth ); | 96 | setLeftMargin( preferredWidth ); |
97 | } | 97 | } |
98 | 98 | ||
99 | void DateBookDayView::slotDateChanged( int y, int m, int d ) | 99 | void DateBookDayView::slotDateChanged( int y, int m, int d ) |
100 | { | 100 | { |
101 | currDate.setYMD(y,m,d); | 101 | currDate.setYMD(y,m,d); |
102 | } | 102 | } |
103 | 103 | ||
104 | void DateBookDayView::slotChangeClock( bool newClock ) | 104 | void DateBookDayView::slotChangeClock( bool newClock ) |
105 | { | 105 | { |
106 | ampm = newClock; | 106 | ampm = newClock; |
107 | initHeader(); | 107 | initHeader(); |
108 | } | 108 | } |
109 | 109 | ||
110 | bool DateBookDayView::whichClock() const | 110 | bool DateBookDayView::whichClock() const |
111 | { | 111 | { |
112 | return ampm; | 112 | return ampm; |
113 | } | 113 | } |
114 | 114 | ||
115 | void DateBookDayView::moveUp() | 115 | void DateBookDayView::moveUp() |
116 | { | 116 | { |
117 | scrollBy(0, -20); | 117 | scrollBy(0, -20); |
118 | } | 118 | } |
119 | 119 | ||
120 | void DateBookDayView::moveDown() | 120 | void DateBookDayView::moveDown() |
121 | { | 121 | { |
122 | scrollBy(0, 20); | 122 | scrollBy(0, 20); |
123 | } | 123 | } |
124 | 124 | ||
125 | void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool ) | 125 | void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool ) |
126 | { | 126 | { |
127 | int w = cr.width(); | 127 | int w = cr.width(); |
128 | int h = cr.height(); | 128 | int h = cr.height(); |
129 | p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) ); | 129 | p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) ); |
130 | if ( showGrid() ) { | 130 | if ( showGrid() ) { |
131 | // Draw our lines | 131 | // Draw our lines |
132 | int x2 = w - 1; | 132 | int x2 = w - 1; |
133 | int y2 = h - 1; | 133 | int y2 = h - 1; |
134 | QPen pen( p->pen() ); | 134 | QPen pen( p->pen() ); |
135 | p->setPen( colorGroup().dark() ); | 135 | p->setPen( colorGroup().dark() ); |
136 | p->drawLine( x2, 0, x2, y2 ); | 136 | p->drawLine( x2, 0, x2, y2 ); |
137 | p->drawLine( 0, y2, x2, y2 ); | 137 | p->drawLine( 0, y2, x2, y2 ); |
138 | 138 | ||
139 | p->setPen( colorGroup().midlight() ); | 139 | p->setPen( colorGroup().midlight() ); |
140 | p->drawLine( 0, y2 - h/2, x2, y2 - h/2); | 140 | p->drawLine( 0, y2 - h/2, x2, y2 - h/2); |
141 | 141 | ||
142 | p->setPen( pen ); | 142 | p->setPen( pen ); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void DateBookDayView::paintFocus( QPainter *, const QRect & ) | 146 | void DateBookDayView::paintFocus( QPainter *, const QRect & ) |
147 | { | 147 | { |
148 | } | 148 | } |
149 | 149 | ||
150 | void DateBookDayView::resizeEvent( QResizeEvent *e ) | 150 | void DateBookDayView::resizeEvent( QResizeEvent *e ) |
151 | { | 151 | { |
152 | QTable::resizeEvent( e ); | 152 | QTable::resizeEvent( e ); |
153 | columnWidthChanged( 0 ); | 153 | columnWidthChanged( 0 ); |
154 | emit sigColWidthChanged(); | 154 | emit sigColWidthChanged(); |
155 | } | 155 | } |
156 | 156 | ||
157 | void DateBookDayView::keyPressEvent( QKeyEvent *e ) | 157 | void DateBookDayView::keyPressEvent( QKeyEvent *e ) |
158 | { | 158 | { |
159 | QString txt = e->text(); | 159 | QString txt = e->text(); |
160 | if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { | 160 | if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { |
161 | // we this is some sort of thing we know about... | 161 | // we this is some sort of thing we know about... |
162 | e->accept(); | 162 | e->accept(); |
163 | emit sigCapturedKey( txt ); | 163 | emit sigCapturedKey( txt ); |
164 | } else { | 164 | } else { |
165 | // I don't know what this key is, do you? | 165 | // I don't know what this key is, do you? |
166 | e->ignore(); | 166 | e->ignore(); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | void DateBookDayView::setRowStyle( int style ) | 170 | void DateBookDayView::setRowStyle( int style ) |
171 | { | 171 | { |
172 | if (style<0) style = 0; | 172 | if (style<0) style = 0; |
173 | 173 | ||
174 | for (int i=0; i<numRows(); i++) | 174 | for (int i=0; i<numRows(); i++) |
175 | setRowHeight(i, style*10+20); | 175 | setRowHeight(i, style*10+20); |
176 | } | 176 | } |
177 | 177 | ||
178 | void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ ) | 178 | void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ ) |
179 | { | 179 | { |
180 | int sh=99,eh=-1; | 180 | int sh=99,eh=-1; |
181 | 181 | ||
182 | for(int i=0;i<this->numSelections();i++) { | 182 | for(int i=0;i<this->numSelections();i++) { |
183 | QTableSelection sel = this->selection( i ); | 183 | QTableSelection sel = this->selection( i ); |
184 | sh = QMIN(sh,sel.topRow()); | 184 | sh = QMIN(sh,sel.topRow()); |
185 | eh = QMAX(sh,sel.bottomRow()+1); | 185 | eh = QMAX(sh,sel.bottomRow()+1); |
186 | } | 186 | } |
187 | if (sh > 23 || eh < 1) { | 187 | if (sh > 23 || eh < 1) { |
188 | sh=8; | 188 | sh=8; |
189 | eh=9; | 189 | eh=9; |
190 | } | 190 | } |
191 | 191 | ||
192 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); | 192 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); |
193 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); | 193 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); |
194 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); | 194 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); |
195 | quickLineEdit->setFocus(); | 195 | quickLineEdit->setFocus(); |
196 | quickLineEdit->show(); | 196 | quickLineEdit->show(); |
197 | } | 197 | } |
198 | 198 | ||
199 | //=========================================================================== | 199 | //=========================================================================== |
200 | 200 | ||
201 | DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) | 201 | DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) |
202 | { | 202 | { |
203 | active=1; | 203 | active=1; |
204 | quickEvent.setStart(start); | 204 | quickEvent.setStart(start); |
205 | quickEvent.setEnd(end); | 205 | quickEvent.setEnd(end); |
206 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); | 206 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); |
207 | } | 207 | } |
208 | 208 | ||
209 | void DateBookDayViewQuickLineEdit::slotReturnPressed() | 209 | void DateBookDayViewQuickLineEdit::slotReturnPressed() |
210 | { | 210 | { |
211 | 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. |
212 | quickEvent.setDescription(this->text()); | 212 | quickEvent.setDescription(this->text()); |
213 | 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&))); |
214 | emit(insertEvent(quickEvent)); | 214 | emit(insertEvent(quickEvent)); |
215 | active=0; | 215 | active=0; |
216 | } | 216 | } |
217 | /* we need to return to this object.. */ | 217 | /* we need to return to this object.. */ |
218 | 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 |
219 | } | 219 | } |
220 | void DateBookDayViewQuickLineEdit::finallyCallClose() { | 220 | void DateBookDayViewQuickLineEdit::finallyCallClose() { |
221 | close(true); // also deletes this widget... | 221 | close(true); // also deletes this widget... |
222 | } | 222 | } |
223 | 223 | ||
224 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) | 224 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) |
225 | { | 225 | { |
226 | slotReturnPressed(); // Reuse code to add event and close this widget. | 226 | slotReturnPressed(); // Reuse code to add event and close this widget. |
227 | } | 227 | } |
228 | 228 | ||
229 | //=========================================================================== | 229 | //=========================================================================== |
230 | 230 | ||
231 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name ) | 231 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name ) |
232 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) | 232 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) |
233 | { | 233 | { |
234 | widgetList.setAutoDelete( true ); | 234 | widgetList.setAutoDelete( true ); |
235 | _holiday_db = newHdb; | 235 | _holiday_db = newHdb; |
236 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); | 236 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); |
237 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); | 237 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); |
238 | 238 | ||
239 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); | 239 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); |
240 | m_allDays->hide(); | 240 | m_allDays->hide(); |
241 | 241 | ||
242 | view = new DateBookDayView( ampm, this, "day view" ); | 242 | view = new DateBookDayView( ampm, this, "day view" ); |
243 | 243 | ||
244 | 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) ) ); |
245 | 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) ) ); |
246 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); | 246 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); |
247 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); | 247 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); |
248 | connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) ); | 248 | connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) ); |
249 | 249 | ||
250 | QTimer *timer = new QTimer( this ); | 250 | QTimer *timer = new QTimer( this ); |
251 | 251 | ||
252 | 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 |
253 | timer->start( 1000*60*5, FALSE ); //update every 5min | 253 | timer->start( 1000*60*5, FALSE ); //update every 5min |
254 | 254 | ||
255 | selectedWidget = 0; | 255 | selectedWidget = 0; |
256 | 256 | ||
257 | timeMarker = new DateBookDayTimeMarker( this ); | 257 | timeMarker = new DateBookDayTimeMarker( this ); |
258 | timeMarker->setTime( QTime::currentTime() ); | 258 | timeMarker->setTime( QTime::currentTime() ); |
259 | rowStyle = -1; // initialize with bogus values | 259 | rowStyle = -1; // initialize with bogus values |
260 | jumpToCurTime = false; | 260 | jumpToCurTime = false; |
261 | } | 261 | } |
262 | 262 | ||
263 | void DateBookDay::setJumpToCurTime( bool bJump ) | 263 | void DateBookDay::setJumpToCurTime( bool bJump ) |
264 | { | 264 | { |
265 | jumpToCurTime = bJump; | 265 | jumpToCurTime = bJump; |
266 | } | 266 | } |
267 | 267 | ||
268 | void DateBookDay::setRowStyle( int style ) | 268 | void DateBookDay::setRowStyle( int style ) |
269 | { | 269 | { |
270 | if (rowStyle != style) view->setRowStyle( style ); | 270 | if (rowStyle != style) view->setRowStyle( style ); |
271 | rowStyle = style; | 271 | rowStyle = style; |
272 | } | 272 | } |
273 | 273 | ||
274 | void DateBookDay::updateView( void ) | 274 | void DateBookDay::updateView( void ) |
275 | { | 275 | { |
276 | timeMarker->setTime( QTime::currentTime() ); | 276 | timeMarker->setTime( QTime::currentTime() ); |
277 | //need to find a way to update all DateBookDayWidgets | 277 | //need to find a way to update all DateBookDayWidgets |
278 | } | 278 | } |
279 | 279 | ||
280 | void DateBookDay::setSelectedWidget( DateBookDayWidget *w ) | 280 | void DateBookDay::setSelectedWidget( DateBookDayWidget *w ) |
281 | { | 281 | { |
282 | selectedWidget = w; | 282 | selectedWidget = w; |
283 | } | 283 | } |
284 | 284 | ||
285 | DateBookDayWidget * DateBookDay::getSelectedWidget( void ) | 285 | DateBookDayWidget * DateBookDay::getSelectedWidget( void ) |
286 | { | 286 | { |
287 | return selectedWidget; | 287 | return selectedWidget; |
288 | } | 288 | } |
289 | 289 | ||
290 | void DateBookDay::selectedDates( QDateTime &start, QDateTime &end ) | 290 | void DateBookDay::selectedDates( QDateTime &start, QDateTime &end ) |
291 | { | 291 | { |
292 | start.setDate( currDate ); | 292 | start.setDate( currDate ); |
293 | end.setDate( currDate ); | 293 | end.setDate( currDate ); |
294 | 294 | ||
295 | int sh=99,eh=-1; | 295 | int sh=99,eh=-1; |
296 | 296 | ||
297 | int n = dayView()->numSelections(); | 297 | int n = dayView()->numSelections(); |
298 | 298 | ||
299 | for (int i=0; i<n; i++) { | 299 | for (int i=0; i<n; i++) { |
300 | QTableSelection sel = dayView()->selection( i ); | 300 | QTableSelection sel = dayView()->selection( i ); |
301 | sh = QMIN(sh,sel.topRow()); | 301 | sh = QMIN(sh,sel.topRow()); |
302 | eh = QMAX(sh,sel.bottomRow()+1); | 302 | eh = QMAX(sh,sel.bottomRow()+1); |
303 | } | 303 | } |
304 | 304 | ||
305 | if (sh > 23 || eh < 1) { | 305 | if (sh > 23 || eh < 1) { |
306 | sh=8; | 306 | sh=8; |
307 | eh=9; | 307 | eh=9; |
308 | } | 308 | } |
309 | 309 | ||
310 | start.setTime( QTime( sh, 0, 0 ) ); | 310 | start.setTime( QTime( sh, 0, 0 ) ); |
311 | end.setTime( QTime( eh, 0, 0 ) ); | 311 | end.setTime( QTime( eh, 0, 0 ) ); |
312 | } | 312 | } |
313 | 313 | ||
314 | void DateBookDay::setDate( int y, int m, int d ) | 314 | void DateBookDay::setDate( int y, int m, int d ) |
315 | { | 315 | { |
316 | header->setDate( y, m, d ); | 316 | header->setDate( y, m, d ); |
317 | selectedWidget = 0; | 317 | selectedWidget = 0; |
318 | } | 318 | } |
319 | 319 | ||
320 | void DateBookDay::setDate( QDate d) | 320 | void DateBookDay::setDate( QDate d) |
321 | { | 321 | { |
322 | header->setDate( d.year(), d.month(), d.day() ); | 322 | header->setDate( d.year(), d.month(), d.day() ); |
323 | selectedWidget = 0; | 323 | selectedWidget = 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | void DateBookDay::dateChanged( int y, int m, int d ) | 326 | void DateBookDay::dateChanged( int y, int m, int d ) |
327 | { | 327 | { |
328 | QDate date( y, m, d ); | 328 | QDate date( y, m, d ); |
329 | if ( currDate == date ) | 329 | if ( currDate == date ) |
330 | return; | 330 | return; |
331 | currDate.setYMD( y, m, d ); | 331 | currDate.setYMD( y, m, d ); |
332 | relayoutPage(); | 332 | relayoutPage(); |
333 | dayView()->clearSelection(); | 333 | dayView()->clearSelection(); |
334 | QTableSelection ts; | 334 | QTableSelection ts; |
335 | 335 | ||
336 | if (jumpToCurTime && this->date() == QDate::currentDate()) | 336 | if (jumpToCurTime && this->date() == QDate::currentDate()) |
337 | { | 337 | { |
338 | ts.init( QTime::currentTime().hour(), 0); | 338 | ts.init( QTime::currentTime().hour(), 0); |
339 | ts.expandTo( QTime::currentTime().hour(), 0); | 339 | ts.expandTo( QTime::currentTime().hour(), 0); |
340 | } else { | 340 | } else { |
341 | ts.init( startTime, 0 ); | 341 | ts.init( startTime, 0 ); |
342 | ts.expandTo( startTime, 0 ); | 342 | ts.expandTo( startTime, 0 ); |
343 | } | 343 | } |
344 | 344 | ||
345 | dayView()->addSelection( ts ); | 345 | dayView()->addSelection( ts ); |
346 | selectedWidget = 0; | 346 | selectedWidget = 0; |
347 | } | 347 | } |
348 | 348 | ||
349 | void DateBookDay::redraw() | 349 | void DateBookDay::redraw() |
350 | { | 350 | { |
351 | if ( isUpdatesEnabled() ) | 351 | if ( isUpdatesEnabled() ) |
352 | relayoutPage(); | 352 | relayoutPage(); |
353 | } | 353 | } |
354 | 354 | ||
355 | void DateBookDay::getEvents() | 355 | void DateBookDay::getEvents() |
356 | { | 356 | { |
357 | widgetList.clear(); | 357 | widgetList.clear(); |
358 | 358 | ||
359 | /* clear the AllDay List */ | 359 | /* clear the AllDay List */ |
360 | m_allDays->hide(); // just in case | 360 | m_allDays->hide(); // just in case |
361 | m_allDays->removeAllEvents(); | 361 | m_allDays->removeAllEvents(); |
362 | 362 | ||
363 | QStringList hdays = _holiday_db->holidaylist(currDate); | 363 | QStringList hdays = _holiday_db->holidaylist(currDate); |
364 | QStringList::Iterator sit; | 364 | QStringList::Iterator sit; |
365 | QObject* object = 0; | 365 | QObject* object = 0; |
366 | |||
367 | /* this way we make sure that holiday dummy events are always | ||
368 | on top of the widgetlist. */ | ||
366 | for (sit=hdays.begin();sit!=hdays.end();++sit) { | 369 | for (sit=hdays.begin();sit!=hdays.end();++sit) { |
367 | object = m_allDays->addHoliday(*sit); | 370 | m_allDays->addHoliday(*sit); |
368 | if (!object) continue; | ||
369 | /* not to do something with it */ | ||
370 | } | 371 | } |
371 | QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate ); | 372 | QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate ); |
372 | QValueListIterator<EffectiveEvent> it; | 373 | QValueListIterator<EffectiveEvent> it; |
373 | 374 | ||
374 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 375 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
375 | EffectiveEvent ev=*it; | 376 | EffectiveEvent ev=*it; |
376 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. | 377 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. |
377 | if (ev.event().type() == Event::AllDay ) { | 378 | if (ev.event().type() == Event::AllDay ) { |
378 | object = m_allDays->addEvent( ev ); | 379 | object = m_allDays->addEvent( ev ); |
379 | if (!object) | 380 | if (!object) |
380 | continue; | 381 | continue; |
381 | }else { | 382 | }else { |
382 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); | 383 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); |
383 | widgetList.append( w ); | 384 | widgetList.append( w ); |
384 | object = w; | 385 | object = w; |
385 | } | 386 | } |
386 | 387 | ||
387 | connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) ); | 388 | connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) ); |
388 | connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) ); | 389 | connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) ); |
389 | connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) ); | 390 | connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) ); |
390 | connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) ); | 391 | connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) ); |
391 | 392 | ||
392 | } | 393 | } |
393 | } | 394 | } |
394 | } | 395 | } |
395 | 396 | ||
396 | static int place( const DateBookDayWidget *item, bool *used, int maxn ) | 397 | static int place( const DateBookDayWidget *item, bool *used, int maxn ) |
397 | { | 398 | { |
398 | int place = 0; | 399 | int place = 0; |
399 | int start = item->event().start().hour(); | 400 | int start = item->event().start().hour(); |
400 | QTime e = item->event().end(); | 401 | QTime e = item->event().end(); |
401 | int end = e.hour(); | 402 | int end = e.hour(); |
402 | if ( e.minute() < 5 ) | 403 | if ( e.minute() < 5 ) |
403 | end--; | 404 | end--; |
404 | if ( end < start ) | 405 | if ( end < start ) |
405 | end = start; | 406 | end = start; |
406 | while ( place < maxn ) { | 407 | while ( place < maxn ) { |
407 | bool free = TRUE; | 408 | bool free = TRUE; |
408 | int s = start; | 409 | int s = start; |
409 | while( s <= end ) { | 410 | while( s <= end ) { |
410 | if ( used[10*s+place] ) { | 411 | if ( used[10*s+place] ) { |
411 | free = FALSE; | 412 | free = FALSE; |
412 | break; | 413 | break; |
413 | } | 414 | } |
414 | s++; | 415 | s++; |
415 | } | 416 | } |
416 | if ( free ) | 417 | if ( free ) |
417 | break; | 418 | break; |
418 | place++; | 419 | place++; |
419 | } | 420 | } |
420 | if ( place == maxn ) { | 421 | if ( place == maxn ) { |
421 | return -1; | 422 | return -1; |
422 | } | 423 | } |
423 | while( start <= end ) { | 424 | while( start <= end ) { |
424 | used[10*start+place] = TRUE; | 425 | used[10*start+place] = TRUE; |
425 | start++; | 426 | start++; |
426 | } | 427 | } |
427 | return place; | 428 | return place; |
428 | } | 429 | } |
429 | 430 | ||
430 | 431 | ||
431 | void DateBookDay::relayoutPage( bool fromResize ) | 432 | void DateBookDay::relayoutPage( bool fromResize ) |
432 | { | 433 | { |
433 | setUpdatesEnabled( FALSE ); | 434 | setUpdatesEnabled( FALSE ); |
434 | if ( !fromResize ) { | 435 | if ( !fromResize ) { |
435 | getEvents(); // no need we already have them! | 436 | getEvents(); // no need we already have them! |
436 | 437 | ||
437 | if (m_allDays->items() > 0 ) | 438 | if (m_allDays->items() > 0 ) |
438 | m_allDays->show(); | 439 | m_allDays->show(); |
439 | /* | 440 | /* |
440 | * else if ( m_allDays->items() == 0 ) already hide in getEvents | 441 | * else if ( m_allDays->items() == 0 ) already hide in getEvents |
441 | */ | 442 | */ |
442 | } | 443 | } |
443 | 444 | ||
444 | widgetList.sort(); | 445 | widgetList.sort(); |
445 | //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning | 446 | //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning |
446 | //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view | 447 | //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view |
447 | 448 | ||
448 | int wCount = widgetList.count(); | 449 | int wCount = widgetList.count(); |
449 | int wid = view->columnWidth(0)-1; | 450 | int wid = view->columnWidth(0)-1; |
450 | int wd; | 451 | int wd; |
451 | int n = 1; | 452 | int n = 1; |
452 | 453 | ||
453 | QArray<int> anzIntersect(wCount); //this stores the number of maximal intersections of each widget | 454 | QArray<int> anzIntersect(wCount); //this stores the number of maximal intersections of each widget |
454 | 455 | ||
455 | for (int i = 0; i<wCount; anzIntersect[i] = 1, i++); | 456 | for (int i = 0; i<wCount; anzIntersect[i] = 1, i++); |
456 | 457 | ||
457 | if ( wCount < 20 ) { | 458 | if ( wCount < 20 ) { |
458 | 459 | ||
459 | QArray<QRect> geometries(wCount); | 460 | QArray<QRect> geometries(wCount); |
460 | for (int i = 0; i < wCount; geometries[i] = widgetList.at(i)->geometry(), i++); //stores geometry for each widget in vector | 461 | for (int i = 0; i < wCount; geometries[i] = widgetList.at(i)->geometry(), i++); //stores geometry for each widget in vector |
461 | 462 | ||
462 | for ( int i = 0; i < wCount; i++) { | 463 | for ( int i = 0; i < wCount; i++) { |
463 | QValueList<int> intersectedWidgets; | 464 | QValueList<int> intersectedWidgets; |
464 | 465 | ||
465 | //find all widgets intersecting with widgetList.at(i) | 466 | //find all widgets intersecting with widgetList.at(i) |
466 | for ( int j = 0; j < wCount; j++) { | 467 | for ( int j = 0; j < wCount; j++) { |
467 | if (i != j) | 468 | if (i != j) |
468 | if (geometries[j].intersects(geometries[i])) | 469 | if (geometries[j].intersects(geometries[i])) |
469 | intersectedWidgets.append(j); | 470 | intersectedWidgets.append(j); |
470 | } | 471 | } |
471 | 472 | ||
472 | //for each of these intersecting widgets find out how many widgets are they intersecting with | 473 | //for each of these intersecting widgets find out how many widgets are they intersecting with |
473 | for ( uint j = 0; j < intersectedWidgets.count(); j++) | 474 | for ( uint j = 0; j < intersectedWidgets.count(); j++) |
474 | { | 475 | { |
475 | QArray<int> inter(wCount); | 476 | QArray<int> inter(wCount); |
476 | inter[j]=1; | 477 | inter[j]=1; |
477 | 478 | ||
478 | if (intersectedWidgets[j] != -1) | 479 | if (intersectedWidgets[j] != -1) |
479 | for ( uint k = j; k < intersectedWidgets.count(); k++) { | 480 | for ( uint k = j; k < intersectedWidgets.count(); k++) { |
480 | if (j != k && intersectedWidgets[k] != -1) | 481 | if (j != k && intersectedWidgets[k] != -1) |
481 | if (geometries[intersectedWidgets[k]].intersects(geometries[intersectedWidgets[j]])) { | 482 | if (geometries[intersectedWidgets[k]].intersects(geometries[intersectedWidgets[j]])) { |
482 | inter[j]++; | 483 | inter[j]++; |
483 | intersectedWidgets[k] = -1; | 484 | intersectedWidgets[k] = -1; |
484 | } | 485 | } |
485 | if (inter[j] > anzIntersect[i]) anzIntersect[i] = inter[j] + 1; | 486 | if (inter[j] > anzIntersect[i]) anzIntersect[i] = inter[j] + 1; |
486 | } | 487 | } |
487 | } | 488 | } |
488 | if (anzIntersect[i] == 1 && intersectedWidgets.count()) anzIntersect[i]++; | 489 | if (anzIntersect[i] == 1 && intersectedWidgets.count()) anzIntersect[i]++; |
489 | } | 490 | } |
490 | 491 | ||
491 | 492 | ||
492 | for ( int i = 0; i < wCount; i++) { | 493 | for ( int i = 0; i < wCount; i++) { |
493 | DateBookDayWidget *w = widgetList.at(i); | 494 | DateBookDayWidget *w = widgetList.at(i); |
494 | QRect geom = w->geometry(); | 495 | QRect geom = w->geometry(); |
495 | geom.setX( 0 ); | 496 | geom.setX( 0 ); |
496 | wd = (view->columnWidth(0)-1) / anzIntersect[i] - (anzIntersect[i]>1?2:0); | 497 | wd = (view->columnWidth(0)-1) / anzIntersect[i] - (anzIntersect[i]>1?2:0); |
497 | geom.setWidth( wd ); | 498 | geom.setWidth( wd ); |
498 | while ( intersects( w, geom ) ) { | 499 | while ( intersects( w, geom ) ) { |
499 | geom.moveBy( wd + 2 + 1, 0 ); | 500 | geom.moveBy( wd + 2 + 1, 0 ); |
500 | } | 501 | } |
501 | w->setGeometry( geom ); | 502 | w->setGeometry( geom ); |
502 | } | 503 | } |
503 | 504 | ||
504 | if (jumpToCurTime && this->date() == QDate::currentDate()) { | 505 | if (jumpToCurTime && this->date() == QDate::currentDate()) { |
505 | view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour | 506 | view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour |
506 | } else { | 507 | } else { |
507 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | 508 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); |
508 | } | 509 | } |
509 | } else { | 510 | } else { |
510 | int hours[24]; | 511 | int hours[24]; |
511 | memset( hours, 0, 24*sizeof( int ) ); | 512 | memset( hours, 0, 24*sizeof( int ) ); |
512 | bool overFlow = FALSE; | 513 | bool overFlow = FALSE; |
513 | for ( int i = 0; i < wCount; i++ ) { | 514 | for ( int i = 0; i < wCount; i++ ) { |
514 | DateBookDayWidget *w = widgetList.at(i); | 515 | DateBookDayWidget *w = widgetList.at(i); |
515 | int start = w->event().start().hour(); | 516 | int start = w->event().start().hour(); |
516 | QTime e = w->event().end(); | 517 | QTime e = w->event().end(); |
517 | int end = e.hour(); | 518 | int end = e.hour(); |
518 | if ( e.minute() < 5 ) | 519 | if ( e.minute() < 5 ) |
519 | end--; | 520 | end--; |
520 | if ( end < start ) | 521 | if ( end < start ) |
521 | end = start; | 522 | end = start; |
522 | while( start <= end ) { | 523 | while( start <= end ) { |
523 | hours[start]++; | 524 | hours[start]++; |
524 | if ( hours[start] >= 10 ) | 525 | if ( hours[start] >= 10 ) |
525 | overFlow = TRUE; | 526 | overFlow = TRUE; |
526 | ++start; | 527 | ++start; |
527 | } | 528 | } |
528 | if ( overFlow ) | 529 | if ( overFlow ) |
529 | break; | 530 | break; |
530 | } | 531 | } |
531 | for ( int i = 0; i < 24; i++ ) { | 532 | for ( int i = 0; i < 24; i++ ) { |
532 | n = QMAX( n, hours[i] ); | 533 | n = QMAX( n, hours[i] ); |
533 | } | 534 | } |
534 | wid = ( view->columnWidth(0)-1 ) / n; | 535 | wid = ( view->columnWidth(0)-1 ) / n; |
535 | 536 | ||
536 | bool used[24*10]; | 537 | bool used[24*10]; |
537 | memset( used, FALSE, 24*10*sizeof( bool ) ); | 538 | memset( used, FALSE, 24*10*sizeof( bool ) ); |
538 | 539 | ||
539 | for ( int i = 0; i < wCount; i++ ) { | 540 | for ( int i = 0; i < wCount; i++ ) { |
540 | DateBookDayWidget *w = widgetList.at(i); | 541 | DateBookDayWidget *w = widgetList.at(i); |
541 | int xp = place( w, used, n ); | 542 | int xp = place( w, used, n ); |
542 | if ( xp != -1 ) { | 543 | if ( xp != -1 ) { |
543 | QRect geom = w->geometry(); | 544 | QRect geom = w->geometry(); |
544 | geom.setX( xp*(wid+2) ); | 545 | geom.setX( xp*(wid+2) ); |
545 | geom.setWidth( wid ); | 546 | geom.setWidth( wid ); |
546 | w->setGeometry( geom ); | 547 | w->setGeometry( geom ); |
547 | } | 548 | } |
548 | } | 549 | } |
549 | 550 | ||
550 | if (jumpToCurTime && this->date() == QDate::currentDate()) { | 551 | if (jumpToCurTime && this->date() == QDate::currentDate()) { |
551 | view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour | 552 | view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour |
552 | } else { | 553 | } else { |
553 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | 554 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); |
554 | } | 555 | } |
555 | } | 556 | } |
556 | 557 | ||
557 | timeMarker->setTime( QTime::currentTime() ); //display timeMarker | 558 | timeMarker->setTime( QTime::currentTime() ); //display timeMarker |
558 | timeMarker->raise(); //on top of all widgets | 559 | timeMarker->raise(); //on top of all widgets |
559 | if (this->date() == QDate::currentDate()) { //only show timeMarker on current day | 560 | if (this->date() == QDate::currentDate()) { //only show timeMarker on current day |
560 | timeMarker->show(); | 561 | timeMarker->show(); |
561 | } else { | 562 | } else { |
562 | timeMarker->hide(); | 563 | timeMarker->hide(); |
563 | } | 564 | } |
564 | setUpdatesEnabled( TRUE ); | 565 | setUpdatesEnabled( TRUE ); |
565 | return; | 566 | return; |
566 | } | 567 | } |
567 | 568 | ||
568 | DateBookDayWidget *DateBookDay::intersects( const DateBookDayWidget *item, const QRect &geom ) | 569 | DateBookDayWidget *DateBookDay::intersects( const DateBookDayWidget *item, const QRect &geom ) |
569 | { | 570 | { |
570 | int i = 0; | 571 | int i = 0; |
571 | DateBookDayWidget *w = widgetList.at(i); | 572 | DateBookDayWidget *w = widgetList.at(i); |
572 | int wCount = widgetList.count(); | 573 | int wCount = widgetList.count(); |
573 | while ( i < wCount && w != item ) { | 574 | while ( i < wCount && w != item ) { |
574 | if ( w->geometry().intersects( geom ) ) { | 575 | if ( w->geometry().intersects( geom ) ) { |
575 | return w; | 576 | return w; |
576 | } | 577 | } |
577 | w = widgetList.at(++i); | 578 | w = widgetList.at(++i); |
578 | } | 579 | } |
579 | 580 | ||
580 | return 0; | 581 | return 0; |
581 | } | 582 | } |
582 | 583 | ||
583 | 584 | ||
584 | QDate DateBookDay::date() const | 585 | QDate DateBookDay::date() const |
585 | { | 586 | { |
586 | return currDate; | 587 | return currDate; |
587 | } | 588 | } |
588 | 589 | ||
589 | void DateBookDay::setStartViewTime( int startHere ) | 590 | void DateBookDay::setStartViewTime( int startHere ) |
590 | { | 591 | { |
591 | startTime = startHere; | 592 | startTime = startHere; |
592 | dayView()->clearSelection(); | 593 | dayView()->clearSelection(); |
593 | QTableSelection ts; | 594 | QTableSelection ts; |
594 | 595 | ||
595 | if (jumpToCurTime && this->date() == QDate::currentDate()) { //this should probably be in datebook.cpp where it's called? | 596 | if (jumpToCurTime && this->date() == QDate::currentDate()) { //this should probably be in datebook.cpp where it's called? |
596 | ts.init( QTime::currentTime().hour(), 0); | 597 | ts.init( QTime::currentTime().hour(), 0); |
597 | ts.expandTo( QTime::currentTime().hour(), 0); | 598 | ts.expandTo( QTime::currentTime().hour(), 0); |
598 | } else { | 599 | } else { |
599 | ts.init( startTime, 0 ); | 600 | ts.init( startTime, 0 ); |
600 | ts.expandTo( startTime, 0 ); | 601 | ts.expandTo( startTime, 0 ); |
601 | } | 602 | } |
602 | 603 | ||
603 | dayView()->addSelection( ts ); | 604 | dayView()->addSelection( ts ); |
604 | } | 605 | } |
605 | 606 | ||
606 | int DateBookDay::startViewTime() const | 607 | int DateBookDay::startViewTime() const |
607 | { | 608 | { |
608 | return startTime; | 609 | return startTime; |
609 | } | 610 | } |
610 | 611 | ||
611 | void DateBookDay::slotWeekChanged( bool bStartOnMonday ) | 612 | void DateBookDay::slotWeekChanged( bool bStartOnMonday ) |
612 | { | 613 | { |
613 | header->setStartOfWeek( bStartOnMonday ); | 614 | header->setStartOfWeek( bStartOnMonday ); |
614 | // redraw(); | 615 | // redraw(); |
615 | } | 616 | } |
616 | 617 | ||
617 | void DateBookDay::keyPressEvent(QKeyEvent *e) | 618 | void DateBookDay::keyPressEvent(QKeyEvent *e) |
618 | { | 619 | { |
619 | switch(e->key()) { | 620 | switch(e->key()) { |
620 | case Key_Up: | 621 | case Key_Up: |
621 | view->moveUp(); | 622 | view->moveUp(); |
622 | break; | 623 | break; |
623 | case Key_Down: | 624 | case Key_Down: |
624 | view->moveDown(); | 625 | view->moveDown(); |
625 | break; | 626 | break; |
626 | case Key_Left: | 627 | case Key_Left: |
627 | setDate(QDate(currDate).addDays(-1)); | 628 | setDate(QDate(currDate).addDays(-1)); |
628 | break; | 629 | break; |
629 | case Key_Right: | 630 | case Key_Right: |
630 | setDate(QDate(currDate).addDays(1)); | 631 | setDate(QDate(currDate).addDays(1)); |
631 | break; | 632 | break; |
632 | default: | 633 | default: |
633 | e->ignore(); | 634 | e->ignore(); |
634 | } | 635 | } |
635 | } | 636 | } |
636 | 637 | ||
637 | //=========================================================================== | 638 | //=========================================================================== |
638 | 639 | ||
639 | DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ) | 640 | DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ) |
640 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) | 641 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) |
641 | { | 642 | { |
642 | // why would someone use "<"? Oh well, fix it up... | 643 | // why would someone use "<"? Oh well, fix it up... |
643 | // I wonder what other things may be messed up... | 644 | // I wonder what other things may be messed up... |
644 | QString strDesc = ev.description(); | 645 | QString strDesc = ev.description(); |
645 | int where = strDesc.find( "<" ); | 646 | int where = strDesc.find( "<" ); |
646 | while ( where != -1 ) { | 647 | while ( where != -1 ) { |
647 | strDesc.remove( where, 1 ); | 648 | strDesc.remove( where, 1 ); |
648 | strDesc.insert( where, "<" ); | 649 | strDesc.insert( where, "<" ); |
649 | where = strDesc.find( "<", where ); | 650 | where = strDesc.find( "<", where ); |
650 | } | 651 | } |
651 | 652 | ||
652 | QString strCat; | 653 | QString strCat; |
653 | // ### Fix later... | 654 | // ### Fix later... |
654 | // QString strCat = ev.category(); | 655 | // QString strCat = ev.category(); |
655 | // where = strCat.find( "<" ); | 656 | // where = strCat.find( "<" ); |
656 | // while ( where != -1 ) { | 657 | // while ( where != -1 ) { |
657 | // strCat.remove( where, 1 ); | 658 | // strCat.remove( where, 1 ); |
658 | // strCat.insert( where, "<" ); | 659 | // strCat.insert( where, "<" ); |
659 | // where = strCat.find( "<", where ); | 660 | // where = strCat.find( "<", where ); |
660 | // } | 661 | // } |
661 | 662 | ||
662 | QString strNote = ev.notes(); | 663 | QString strNote = ev.notes(); |
663 | where = strNote.find( "<" ); | 664 | where = strNote.find( "<" ); |
664 | while ( where != -1 ) { | 665 | while ( where != -1 ) { |
665 | strNote.remove( where, 1 ); | 666 | strNote.remove( where, 1 ); |
666 | strNote.insert( where, "<" ); | 667 | strNote.insert( where, "<" ); |
667 | where = strNote.find( "<", where ); | 668 | where = strNote.find( "<", where ); |
668 | } | 669 | } |
669 | 670 | ||
670 | text = "<b>" + strDesc + "</b><br>" + "<i>"; | 671 | text = "<b>" + strDesc + "</b><br>" + "<i>"; |
671 | if ( !strCat.isEmpty() ) { | 672 | if ( !strCat.isEmpty() ) { |
672 | text += strCat + "</i><br>"; | 673 | text += strCat + "</i><br>"; |
673 | } | 674 | } |
674 | if (ev.event().type() == Event::Normal ) { | 675 | if (ev.event().type() == Event::Normal ) { |
675 | setEventText( text ); | 676 | setEventText( text ); |
676 | } else { | 677 | } else { |
677 | setAllDayText( text ); | 678 | setAllDayText( text ); |
678 | } | 679 | } |
679 | 680 | ||
680 | text += "<br><br>" + strNote; | 681 | text += "<br><br>" + strNote; |
681 | 682 | ||
682 | setBackgroundMode( PaletteBase ); | 683 | setBackgroundMode( PaletteBase ); |
683 | 684 | ||
684 | QTime start = ev.start(); | 685 | QTime start = ev.start(); |
685 | QTime end = ev.end(); | 686 | QTime end = ev.end(); |
686 | int y = start.hour()*60+start.minute(); | 687 | int y = start.hour()*60+start.minute(); |
687 | int h = end.hour()*60+end.minute()-y; | 688 | int h = end.hour()*60+end.minute()-y; |
688 | int rh = dateBook->dayView()->rowHeight(0); | 689 | int rh = dateBook->dayView()->rowHeight(0); |
689 | y = y*rh/60; | 690 | y = y*rh/60; |
690 | h = h*rh/60; | 691 | h = h*rh/60; |
691 | 692 | ||
692 | if ( h < 12 ) h = 12; // Make sure the widget is no smaller than 12 pixels high, so that it's possible to read atleast the first line. | 693 | if ( h < 12 ) h = 12; // Make sure the widget is no smaller than 12 pixels high, so that it's possible to read atleast the first line. |
693 | if ( y > ((24*rh)-12) ) y=(24*rh)-12; // Make sure the widget fits inside the dayview. | 694 | if ( y > ((24*rh)-12) ) y=(24*rh)-12; // Make sure the widget fits inside the dayview. |
694 | geom.setY( y ); | 695 | geom.setY( y ); |
695 | geom.setHeight( h ); | 696 | geom.setHeight( h ); |
696 | geom.setX( 0 ); | 697 | geom.setX( 0 ); |
697 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); | 698 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); |
698 | 699 | ||
699 | } | 700 | } |
700 | 701 | ||
701 | void DateBookDayWidget::setAllDayText( QString &text ) { | 702 | void DateBookDayWidget::setAllDayText( QString &text ) { |
702 | text += "<b>" + tr("This is an all day event.") + "</b>"; | 703 | text += "<b>" + tr("This is an all day event.") + "</b>"; |
703 | } | 704 | } |
704 | 705 | ||
705 | void DateBookDayWidget::setEventText( QString& text ) { | 706 | void DateBookDayWidget::setEventText( QString& text ) { |
706 | bool whichClock = dateBook->dayView()->whichClock(); | 707 | bool whichClock = dateBook->dayView()->whichClock(); |
707 | if ( ev.startDate() != ev.endDate() ) { | 708 | if ( ev.startDate() != ev.endDate() ) { |
708 | text += "<b>" + tr("Start") + "</b>: "; | 709 | text += "<b>" + tr("Start") + "</b>: "; |
709 | text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); | 710 | text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); |
710 | text += " - " + TimeString::longDateString( ev.startDate() ) + "<br>"; | 711 | text += " - " + TimeString::longDateString( ev.startDate() ) + "<br>"; |
711 | text += "<b>" + tr("End") + "</b>: "; | 712 | text += "<b>" + tr("End") + "</b>: "; |
712 | text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); | 713 | text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); |
713 | text += " - " + TimeString::longDateString( ev.endDate() ); | 714 | text += " - " + TimeString::longDateString( ev.endDate() ); |
714 | } else { | 715 | } else { |
715 | text += "<b>" + tr("Time") + "</b>: "; | 716 | text += "<b>" + tr("Time") + "</b>: "; |
716 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | 717 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); |
717 | text += "<b>" + tr(" - ") + "</b>"; | 718 | text += "<b>" + tr(" - ") + "</b>"; |
718 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | 719 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); |
719 | } | 720 | } |
720 | } | 721 | } |
721 | 722 | ||
722 | DateBookDayWidget::~DateBookDayWidget() | 723 | DateBookDayWidget::~DateBookDayWidget() |
723 | { | 724 | { |
724 | } | 725 | } |
725 | 726 | ||
726 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) | 727 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) |
727 | { | 728 | { |
728 | QPainter p( this ); | 729 | QPainter p( this ); |
729 | 730 | ||
730 | if (dateBook->getSelectedWidget() == this) { | 731 | if (dateBook->getSelectedWidget() == this) { |
731 | p.setBrush( QColor( 155, 240, 230 ) ); // selected item | 732 | p.setBrush( QColor( 155, 240, 230 ) ); // selected item |
732 | } else { | 733 | } else { |
733 | if (dateBook->date() == QDate::currentDate()) { | 734 | if (dateBook->date() == QDate::currentDate()) { |
734 | QTime curTime = QTime::currentTime(); | 735 | QTime curTime = QTime::currentTime(); |
735 | if (ev.end() < curTime) { | 736 | if (ev.end() < curTime) { |
736 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive | 737 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive |
737 | } else { | 738 | } else { |
738 | //change color in dependence of the time till the event starts | 739 | //change color in dependence of the time till the event starts |
739 | int duration = curTime.secsTo(ev.start()); | 740 | int duration = curTime.secsTo(ev.start()); |
740 | if (duration < 0) duration = 0; | 741 | if (duration < 0) duration = 0; |
741 | int colChange = duration*160/86400; //86400: secs per day, 160: max color shift | 742 | int colChange = duration*160/86400; //86400: secs per day, 160: max color shift |
742 | p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue | 743 | p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue |
743 | } | 744 | } |
744 | } else { | 745 | } else { |
745 | p.setBrush( QColor( 220, 220, 220 ) ); //light grey, inactive (not current date) | 746 | p.setBrush( QColor( 220, 220, 220 ) ); //light grey, inactive (not current date) |
746 | //perhaps make a distinction between future/past dates | 747 | //perhaps make a distinction between future/past dates |
747 | } | 748 | } |
748 | } | 749 | } |
749 | 750 | ||
750 | p.setPen( QColor(100, 100, 100) ); | 751 | p.setPen( QColor(100, 100, 100) ); |
751 | p.drawRect(rect()); | 752 | p.drawRect(rect()); |
752 | 753 | ||
753 | // p.drawRect(0,0, 5, height()); | 754 | // p.drawRect(0,0, 5, height()); |
754 | 755 | ||
755 | int y = 0; | 756 | int y = 0; |
756 | int d = 0; | 757 | int d = 0; |
757 | 758 | ||
758 | if ( ev.event().hasAlarm() ) { | 759 | if ( ev.event().hasAlarm() ) { |
759 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); | 760 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); |
760 | y = 20; | 761 | y = 20; |
761 | d = 20; | 762 | d = 20; |
762 | } | 763 | } |
763 | 764 | ||
764 | if ( ev.event().hasRepeat() ) { | 765 | if ( ev.event().hasRepeat() ) { |
765 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); | 766 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); |
766 | d = 20; | 767 | d = 20; |
767 | y += 20; | 768 | y += 20; |
768 | } | 769 | } |
769 | 770 | ||
770 | QSimpleRichText rt( text, font() ); | 771 | QSimpleRichText rt( text, font() ); |
771 | rt.setWidth( geom.width() - d - 6 ); | 772 | rt.setWidth( geom.width() - d - 6 ); |
772 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); | 773 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); |
773 | } | 774 | } |
774 | 775 | ||
775 | /* | 776 | /* |
776 | * we need to find the real start date for a uid | 777 | * we need to find the real start date for a uid |
777 | * we need to check from one day to another... | 778 | * we need to check from one day to another... |
778 | */ | 779 | */ |
779 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { | 780 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { |
780 | QDate dt( isIncluded ); | 781 | QDate dt( isIncluded ); |
781 | QDate fnd = dt; | 782 | QDate fnd = dt; |
782 | 783 | ||
783 | bool doAgain = true; | 784 | bool doAgain = true; |
784 | do{ | 785 | do{ |
785 | dt = dt.addDays( -1 ); | 786 | dt = dt.addDays( -1 ); |
786 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); | 787 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); |
787 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { | 788 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { |
788 | EffectiveEvent ev = (*it); | 789 | EffectiveEvent ev = (*it); |
789 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) | 790 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) |
790 | return ev.date(); | 791 | return ev.date(); |
791 | } | 792 | } |
792 | }while (doAgain ); | 793 | }while (doAgain ); |
793 | 794 | ||
794 | return fnd; | 795 | return fnd; |
795 | } | 796 | } |
796 | 797 | ||
797 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | 798 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) |
798 | { | 799 | { |
799 | DateBookDayWidget *item; | 800 | DateBookDayWidget *item; |
800 | 801 | ||
801 | item = dateBook->getSelectedWidget(); | 802 | item = dateBook->getSelectedWidget(); |
802 | if (item) | 803 | if (item) |
803 | item->update(); | 804 | item->update(); |
804 | 805 | ||
805 | dateBook->setSelectedWidget(this); | 806 | dateBook->setSelectedWidget(this); |
806 | update(); | 807 | update(); |
807 | dateBook->repaint(); | 808 | dateBook->repaint(); |
808 | 809 | ||
809 | Event eve = ev.event(); | 810 | Event eve = ev.event(); |
810 | 811 | ||
811 | QPopupMenu m; | 812 | QPopupMenu m; |
812 | m.insertItem( tr( "Edit" ), 1 ); | 813 | m.insertItem( tr( "Edit" ), 1 ); |
813 | m.insertItem( tr( "Duplicate" ), 4 ); | 814 | m.insertItem( tr( "Duplicate" ), 4 ); |
814 | m.insertItem( tr( "Delete" ), 2 ); | 815 | m.insertItem( tr( "Delete" ), 2 ); |
815 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); | 816 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); |
816 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); | 817 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); |
817 | int r = m.exec( e->globalPos() ); | 818 | int r = m.exec( e->globalPos() ); |
818 | if ( r == 1 ) { | 819 | if ( r == 1 ) { |
819 | emit editMe( eve ); | 820 | emit editMe( eve ); |
820 | } else if ( r == 2 ) { | 821 | } else if ( r == 2 ) { |
821 | emit deleteMe( eve ); | 822 | emit deleteMe( eve ); |
822 | } else if ( r == 3 ) { | 823 | } else if ( r == 3 ) { |
823 | emit beamMe( eve ); | 824 | emit beamMe( eve ); |
824 | } else if ( r == 4 ) { | 825 | } else if ( r == 4 ) { |
825 | emit duplicateMe( eve ); | 826 | emit duplicateMe( eve ); |
826 | } else if ( r == 5 ) { | 827 | } else if ( r == 5 ) { |
827 | // create an Event and beam it... | 828 | // create an Event and beam it... |
828 | /* | 829 | /* |
829 | * Start with the easy stuff. If start and end date is the same we can just use | 830 | * Start with the easy stuff. If start and end date is the same we can just use |
830 | * the values of effective events | 831 | * the values of effective events |
831 | * If it is a multi day event we need to find the real start and end date... | 832 | * If it is a multi day event we need to find the real start and end date... |
832 | */ | 833 | */ |
833 | if ( ev.event().start().date() == ev.event().end().date() ) { | 834 | if ( ev.event().start().date() == ev.event().end().date() ) { |
834 | Event event( ev.event() ); | 835 | Event event( ev.event() ); |
835 | 836 | ||
836 | QDateTime dt( ev.date(), ev.start() ); | 837 | QDateTime dt( ev.date(), ev.start() ); |
837 | event.setStart( dt ); | 838 | event.setStart( dt ); |
838 | 839 | ||
839 | dt.setTime( ev.end() ); | 840 | dt.setTime( ev.end() ); |
840 | event.setEnd( dt ); | 841 | event.setEnd( dt ); |
841 | emit beamMe( event ); | 842 | emit beamMe( event ); |
842 | }else { | 843 | }else { |
843 | /* | 844 | /* |
844 | * at least the the Times are right now | 845 | * at least the the Times are right now |
845 | */ | 846 | */ |
846 | QDateTime start( ev.event().start() ); | 847 | QDateTime start( ev.event().start() ); |
847 | QDateTime end ( ev.event().end () ); | 848 | QDateTime end ( ev.event().end () ); |
848 | 849 | ||
849 | 850 | ||
850 | /* | 851 | /* |
851 | * ok we know the start date or we need to find it | 852 | * ok we know the start date or we need to find it |
852 | */ | 853 | */ |
853 | if ( ev.start() != QTime( 0, 0, 0 ) ) { | 854 | if ( ev.start() != QTime( 0, 0, 0 ) ) { |
854 | start.setDate( ev.date() ); | 855 | start.setDate( ev.date() ); |
855 | }else { | 856 | }else { |
856 | QDate dt = DateBookDay::findRealStart( ev.event().uid(), ev.date(), dateBook->db ); | 857 | QDate dt = DateBookDay::findRealStart( ev.event().uid(), ev.date(), dateBook->db ); |
857 | start.setDate( dt ); | 858 | start.setDate( dt ); |
858 | } | 859 | } |
859 | 860 | ||
860 | 861 | ||
861 | /* | 862 | /* |
862 | * ok we know now the end date... | 863 | * ok we know now the end date... |
863 | * else | 864 | * else |
864 | * get to know the offset btw the real start and real end | 865 | * get to know the offset btw the real start and real end |
865 | * and then add it to the new start date... | 866 | * and then add it to the new start date... |
866 | */ | 867 | */ |
867 | if ( ev.end() != QTime(23, 59, 59 ) ) { | 868 | if ( ev.end() != QTime(23, 59, 59 ) ) { |
868 | end.setDate( ev.date() ); | 869 | end.setDate( ev.date() ); |
869 | }else{ | 870 | }else{ |
870 | int days = ev.event().start().date().daysTo( ev.event().end().date() ); | 871 | int days = ev.event().start().date().daysTo( ev.event().end().date() ); |
871 | end.setDate( start.date().addDays( days ) ); | 872 | end.setDate( start.date().addDays( days ) ); |
872 | } | 873 | } |
873 | 874 | ||
874 | 875 | ||
875 | 876 | ||
876 | Event event( ev.event() ); | 877 | Event event( ev.event() ); |
877 | event.setStart( start ); | 878 | event.setStart( start ); |
878 | event.setEnd ( end ); | 879 | event.setEnd ( end ); |
879 | 880 | ||
880 | 881 | ||
881 | emit beamMe( event ); | 882 | emit beamMe( event ); |
882 | } | 883 | } |
883 | } | 884 | } |
884 | } | 885 | } |
885 | 886 | ||
886 | void DateBookDayWidget::setGeometry( const QRect &r ) | 887 | void DateBookDayWidget::setGeometry( const QRect &r ) |
887 | { | 888 | { |
888 | geom = r; | 889 | geom = r; |
889 | setFixedSize( r.width()+1, r.height()+1 ); | 890 | setFixedSize( r.width()+1, r.height()+1 ); |
890 | dateBook->dayView()->moveChild( this, r.x(), r.y()-1 ); | 891 | dateBook->dayView()->moveChild( this, r.x(), r.y()-1 ); |
891 | show(); | 892 | show(); |
892 | } | 893 | } |
893 | 894 | ||
894 | 895 | ||
895 | //--------------------------------------------------------------------------------------------- | 896 | //--------------------------------------------------------------------------------------------- |
896 | //--------------------------------------------------------------------------------------------- | 897 | //--------------------------------------------------------------------------------------------- |
897 | 898 | ||
898 | 899 | ||
899 | DateBookDayTimeMarker::DateBookDayTimeMarker( DateBookDay *db ) | 900 | DateBookDayTimeMarker::DateBookDayTimeMarker( DateBookDay *db ) |
900 | : QWidget( db->dayView()->viewport() ), dateBook( db ) | 901 | : QWidget( db->dayView()->viewport() ), dateBook( db ) |
901 | { | 902 | { |
902 | setBackgroundMode( PaletteBase ); | 903 | setBackgroundMode( PaletteBase ); |
903 | } | 904 | } |
904 | 905 | ||
905 | DateBookDayTimeMarker::~DateBookDayTimeMarker() | 906 | DateBookDayTimeMarker::~DateBookDayTimeMarker() |
906 | { | 907 | { |
907 | } | 908 | } |
908 | 909 | ||
909 | void DateBookDayTimeMarker::paintEvent( QPaintEvent */*e*/ ) | 910 | void DateBookDayTimeMarker::paintEvent( QPaintEvent */*e*/ ) |
910 | { | 911 | { |
911 | QPainter p( this ); | 912 | QPainter p( this ); |
912 | p.setBrush( QColor( 255, 0, 0 ) ); | 913 | p.setBrush( QColor( 255, 0, 0 ) ); |
913 | 914 | ||
914 | QPen pen; | 915 | QPen pen; |
915 | pen.setStyle(NoPen); | 916 | pen.setStyle(NoPen); |
916 | 917 | ||
917 | p.setPen( pen ); | 918 | p.setPen( pen ); |
918 | p.drawRect(rect()); | 919 | p.drawRect(rect()); |
919 | } | 920 | } |
920 | 921 | ||
921 | void DateBookDayTimeMarker::setTime( const QTime &t ) | 922 | void DateBookDayTimeMarker::setTime( const QTime &t ) |
922 | { | 923 | { |
923 | int y = t.hour()*60+t.minute(); | 924 | int y = t.hour()*60+t.minute(); |
924 | int rh = dateBook->dayView()->rowHeight(0); | 925 | int rh = dateBook->dayView()->rowHeight(0); |
925 | y = y*rh/60; | 926 | y = y*rh/60; |
926 | 927 | ||
927 | geom.setX( 0 ); | 928 | geom.setX( 0 ); |
928 | 929 | ||
929 | int x = dateBook->dayView()->columnWidth(0)-1; | 930 | int x = dateBook->dayView()->columnWidth(0)-1; |
930 | geom.setWidth( x ); | 931 | geom.setWidth( x ); |
931 | 932 | ||
932 | geom.setY( y ); | 933 | geom.setY( y ); |
933 | geom.setHeight( 1 ); | 934 | geom.setHeight( 1 ); |
934 | 935 | ||
935 | setGeometry( geom ); | 936 | setGeometry( geom ); |
936 | 937 | ||
937 | time = t; | 938 | time = t; |
938 | } | 939 | } |
939 | 940 | ||
940 | void DateBookDayTimeMarker::setGeometry( const QRect &r ) | 941 | void DateBookDayTimeMarker::setGeometry( const QRect &r ) |
941 | { | 942 | { |
942 | geom = r; | 943 | geom = r; |
943 | setFixedSize( r.width()+1, r.height()+1 ); | 944 | setFixedSize( r.width()+1, r.height()+1 ); |
944 | dateBook->dayView()->moveChild( this, r.x(), r.y()-1 ); | 945 | dateBook->dayView()->moveChild( this, r.x(), r.y()-1 ); |
945 | show(); | 946 | show(); |
946 | } | 947 | } |
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 5b40246..27fce44 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -1,269 +1,269 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** GPL by Rajko Albrecht | 2 | ** GPL by Rajko Albrecht |
3 | ** | 3 | ** |
4 | ** | 4 | ** |
5 | ** | 5 | ** |
6 | ** | 6 | ** |
7 | ** | 7 | ** |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
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 | setResizePolicy(QScrollView::AutoOneFit); |
35 | setHScrollBarMode( AlwaysOff ); | 35 | setHScrollBarMode( AlwaysOff ); |
36 | addChild(m_MainFrame); | 36 | addChild(m_MainFrame); |
37 | 37 | ||
38 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); | 38 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); |
39 | datebookdayalldayLayout->setSpacing( 0 ); | 39 | datebookdayalldayLayout->setSpacing( 0 ); |
40 | datebookdayalldayLayout->setMargin( 0 ); | 40 | datebookdayalldayLayout->setMargin( 0 ); |
41 | 41 | ||
42 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); | 42 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); |
43 | lblDesc->setBackgroundColor(Qt::yellow); | 43 | lblDesc->setBackgroundColor(Qt::yellow); |
44 | lblDesc->hide(); | 44 | lblDesc->hide(); |
45 | subWidgets.setAutoDelete(true); | 45 | subWidgets.setAutoDelete(true); |
46 | } | 46 | } |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Destroys the object and frees any allocated resources | 49 | * Destroys the object and frees any allocated resources |
50 | */ | 50 | */ |
51 | DatebookdayAllday::~DatebookdayAllday() | 51 | DatebookdayAllday::~DatebookdayAllday() |
52 | { | 52 | { |
53 | // 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 |
54 | } | 54 | } |
55 | 55 | ||
56 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) | 56 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) |
57 | { | 57 | { |
58 | DatebookAlldayDisp * lb; | 58 | DatebookAlldayDisp * lb; |
59 | lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); | 59 | lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); |
60 | lb->show(); | 60 | lb->show(); |
61 | datebookdayalldayLayout->addWidget(lb); | 61 | datebookdayalldayLayout->addWidget(lb); |
62 | subWidgets.append(lb); | 62 | subWidgets.append(lb); |
63 | 63 | ||
64 | connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); | 64 | connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); |
65 | ++item_count; | 65 | ++item_count; |
66 | 66 | ||
67 | return lb; | 67 | return lb; |
68 | } | 68 | } |
69 | 69 | ||
70 | DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e) | 70 | DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e) |
71 | { | 71 | { |
72 | DatebookAlldayDisp * lb; | 72 | DatebookAlldayDisp * lb; |
73 | lb = new DatebookAlldayDisp(e,m_MainFrame,NULL); | 73 | lb = new DatebookAlldayDisp(e,m_MainFrame,NULL); |
74 | lb->show(); | 74 | lb->show(); |
75 | datebookdayalldayLayout->addWidget(lb); | 75 | datebookdayalldayLayout->addWidget(lb); |
76 | subWidgets.append(lb); | 76 | subWidgets.append(lb); |
77 | 77 | ||
78 | connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); | 78 | connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); |
79 | ++item_count; | 79 | ++item_count; |
80 | 80 | ||
81 | return lb; | 81 | return lb; |
82 | } | 82 | } |
83 | 83 | ||
84 | void DatebookdayAllday::removeAllEvents() | 84 | void DatebookdayAllday::removeAllEvents() |
85 | { | 85 | { |
86 | subWidgets.clear(); | 86 | subWidgets.clear(); |
87 | item_count = 0; | 87 | item_count = 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, | 90 | DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, |
91 | QWidget* parent,const char* name,WFlags f) | 91 | QWidget* parent,const char* name,WFlags f) |
92 | : QLabel(parent,name,f),m_Ev(ev),dateBook(db) | 92 | : QLabel(parent,name,f),m_Ev(ev),dateBook(db) |
93 | { | 93 | { |
94 | QString strDesc = m_Ev.description(); | 94 | QString strDesc = m_Ev.description(); |
95 | strDesc = strDesc.replace(QRegExp("<"),"<"); | 95 | strDesc = strDesc.replace(QRegExp("<"),"<"); |
96 | setBackgroundColor(yellow); | 96 | setBackgroundColor(yellow); |
97 | setText(strDesc); | 97 | setText(strDesc); |
98 | setFrameStyle(QFrame::Raised|QFrame::Panel); | 98 | setFrameStyle(QFrame::Raised|QFrame::Panel); |
99 | 99 | ||
100 | int s = QFontMetrics(font()).height()+4; | 100 | int s = QFontMetrics(font()).height()+4; |
101 | setMaximumHeight( s ); | 101 | setMaximumHeight( s ); |
102 | setMinimumSize( QSize( 0, s ) ); | 102 | setMinimumSize( QSize( 0, s ) ); |
103 | m_holiday = false; | 103 | m_holiday = false; |
104 | } | 104 | } |
105 | 105 | ||
106 | 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) |
107 | : QLabel(parent,name,fl),m_Ev(),dateBook(0) | 107 | : QLabel(parent,name,fl),m_Ev(),dateBook(0) |
108 | { | 108 | { |
109 | QString strDesc = aholiday; | 109 | QString strDesc = aholiday; |
110 | strDesc = strDesc.replace(QRegExp("<"),"<"); | 110 | strDesc = strDesc.replace(QRegExp("<"),"<"); |
111 | Event ev; | 111 | Event ev; |
112 | ev.setDescription(strDesc); | 112 | ev.setDescription(strDesc); |
113 | ev.setAllDay(true); | 113 | ev.setAllDay(true); |
114 | m_Ev.setEvent(ev); | 114 | m_Ev.setEvent(ev); |
115 | setText(strDesc); | 115 | setText(strDesc); |
116 | 116 | ||
117 | setAlignment(AlignHCenter); | 117 | setAlignment(AlignHCenter); |
118 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum)); | 118 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum)); |
119 | 119 | ||
120 | //setFrameStyle(QFrame::Raised|QFrame::Panel); | 120 | //setFrameStyle(QFrame::Raised|QFrame::Panel); |
121 | //setBackgroundColor(yellow); | 121 | //setBackgroundColor(yellow); |
122 | 122 | ||
123 | int s = QFontMetrics(font()).height()+4; | 123 | int s = QFontMetrics(font()).height()+4; |
124 | setMaximumHeight( s ); | 124 | setMaximumHeight( s ); |
125 | setMinimumSize( QSize( 0, s ) ); | 125 | setMinimumSize( QSize( 0, s ) ); |
126 | 126 | ||
127 | m_holiday = true; | 127 | m_holiday = true; |
128 | } | 128 | } |
129 | 129 | ||
130 | DatebookAlldayDisp::~DatebookAlldayDisp() | 130 | DatebookAlldayDisp::~DatebookAlldayDisp() |
131 | { | 131 | { |
132 | } | 132 | } |
133 | 133 | ||
134 | void DatebookAlldayDisp::beam_single_event() | 134 | void DatebookAlldayDisp::beam_single_event() |
135 | { | 135 | { |
136 | if (m_holiday) return; | 136 | if (m_holiday) return; |
137 | // create an Event and beam it... | 137 | // create an Event and beam it... |
138 | /* | 138 | /* |
139 | * 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 |
140 | * the values of effective m_Events | 140 | * the values of effective m_Events |
141 | * 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... |
142 | */ | 142 | */ |
143 | if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { | 143 | if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { |
144 | Event m_Event( m_Ev.event() ); | 144 | Event m_Event( m_Ev.event() ); |
145 | 145 | ||
146 | QDateTime dt( m_Ev.date(), m_Ev.start() ); | 146 | QDateTime dt( m_Ev.date(), m_Ev.start() ); |
147 | m_Event.setStart( dt ); | 147 | m_Event.setStart( dt ); |
148 | 148 | ||
149 | dt.setTime( m_Ev.end() ); | 149 | dt.setTime( m_Ev.end() ); |
150 | m_Event.setEnd( dt ); | 150 | m_Event.setEnd( dt ); |
151 | emit beamMe( m_Event ); | 151 | emit beamMe( m_Event ); |
152 | }else { | 152 | }else { |
153 | /* | 153 | /* |
154 | * at least the the Times are right now | 154 | * at least the the Times are right now |
155 | */ | 155 | */ |
156 | QDateTime start( m_Ev.event().start() ); | 156 | QDateTime start( m_Ev.event().start() ); |
157 | QDateTime end ( m_Ev.event().end () ); | 157 | QDateTime end ( m_Ev.event().end () ); |
158 | 158 | ||
159 | /* | 159 | /* |
160 | * ok we know the start date or we need to find it | 160 | * ok we know the start date or we need to find it |
161 | */ | 161 | */ |
162 | if ( m_Ev.start() != QTime( 0, 0, 0 ) ) { | 162 | if ( m_Ev.start() != QTime( 0, 0, 0 ) ) { |
163 | start.setDate( m_Ev.date() ); | 163 | start.setDate( m_Ev.date() ); |
164 | }else { | 164 | }else { |
165 | QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook ); | 165 | QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook ); |
166 | start.setDate( dt ); | 166 | start.setDate( dt ); |
167 | } | 167 | } |
168 | 168 | ||
169 | /* | 169 | /* |
170 | * ok we know now the end date... | 170 | * ok we know now the end date... |
171 | * else | 171 | * else |
172 | * get to know the offset btw the real start and real end | 172 | * get to know the offset btw the real start and real end |
173 | * and then add it to the new start date... | 173 | * and then add it to the new start date... |
174 | */ | 174 | */ |
175 | if ( m_Ev.end() != QTime(23, 59, 59 ) ) { | 175 | if ( m_Ev.end() != QTime(23, 59, 59 ) ) { |
176 | end.setDate( m_Ev.date() ); | 176 | end.setDate( m_Ev.date() ); |
177 | }else{ | 177 | }else{ |
178 | int days = m_Ev.event().start().date().daysTo( m_Ev.event().end().date() ); | 178 | int days = m_Ev.event().start().date().daysTo( m_Ev.event().end().date() ); |
179 | end.setDate( start.date().addDays( days ) ); | 179 | end.setDate( start.date().addDays( days ) ); |
180 | } | 180 | } |
181 | Event m_Event( m_Ev.event() ); | 181 | Event m_Event( m_Ev.event() ); |
182 | m_Event.setStart( start ); | 182 | m_Event.setStart( start ); |
183 | m_Event.setEnd ( end ); | 183 | m_Event.setEnd ( end ); |
184 | emit beamMe( m_Event ); | 184 | emit beamMe( m_Event ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) | 188 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) |
189 | { | 189 | { |
190 | Event ev = m_Ev.event(); | 190 | Event ev = m_Ev.event(); |
191 | QColor b = backgroundColor(); | 191 | QColor b = backgroundColor(); |
192 | setBackgroundColor(green); | 192 | setBackgroundColor(green); |
193 | update(); | 193 | update(); |
194 | QPopupMenu m; | 194 | QPopupMenu m; |
195 | if (!m_holiday) { | 195 | if (ev.isValidUid()) { |
196 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); | 196 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); |
197 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); | 197 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); |
198 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); | 198 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); |
199 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); | 199 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); |
200 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); | 200 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); |
201 | } | 201 | } |
202 | m.insertItem( tr( "Info"),6); | 202 | m.insertItem( tr( "Info"),6); |
203 | int r = m.exec( e->globalPos() ); | 203 | int r = m.exec( e->globalPos() ); |
204 | setBackgroundColor(b); | 204 | setBackgroundColor(b); |
205 | update(); | 205 | update(); |
206 | switch (r) { | 206 | switch (r) { |
207 | case 1: | 207 | case 1: |
208 | emit editMe( ev ); | 208 | emit editMe( ev ); |
209 | break; | 209 | break; |
210 | case 2: | 210 | case 2: |
211 | emit deleteMe( ev ); | 211 | emit deleteMe( ev ); |
212 | break; | 212 | break; |
213 | case 3: | 213 | case 3: |
214 | emit beamMe( ev ); | 214 | emit beamMe( ev ); |
215 | break; | 215 | break; |
216 | case 4: | 216 | case 4: |
217 | emit duplicateMe( ev ); | 217 | emit duplicateMe( ev ); |
218 | break; | 218 | break; |
219 | case 5: | 219 | case 5: |
220 | beam_single_event(); | 220 | beam_single_event(); |
221 | break; | 221 | break; |
222 | case 6: | 222 | case 6: |
223 | emit displayMe( ev ); | 223 | emit displayMe( ev ); |
224 | break; | 224 | break; |
225 | default: | 225 | default: |
226 | break; | 226 | break; |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | DatebookEventDesc::DatebookEventDesc(QWidget*parent,const char*name) | 230 | DatebookEventDesc::DatebookEventDesc(QWidget*parent,const char*name) |
231 | :QLabel(parent,name) | 231 | :QLabel(parent,name) |
232 | { | 232 | { |
233 | m_Timer=new QTimer(this); | 233 | m_Timer=new QTimer(this); |
234 | connect(m_Timer,SIGNAL(timeout()),this,SLOT(hide())); | 234 | connect(m_Timer,SIGNAL(timeout()),this,SLOT(hide())); |
235 | setFrameStyle(QFrame::Sunken|QFrame::Panel); | 235 | setFrameStyle(QFrame::Sunken|QFrame::Panel); |
236 | setTextFormat(RichText); | 236 | setTextFormat(RichText); |
237 | } | 237 | } |
238 | 238 | ||
239 | DatebookEventDesc::~DatebookEventDesc() | 239 | DatebookEventDesc::~DatebookEventDesc() |
240 | { | 240 | { |
241 | } | 241 | } |
242 | 242 | ||
243 | void DatebookEventDesc::mousePressEvent(QMouseEvent*) | 243 | void DatebookEventDesc::mousePressEvent(QMouseEvent*) |
244 | { | 244 | { |
245 | hide(); | 245 | hide(); |
246 | if (m_Timer->isActive()) m_Timer->stop(); | 246 | if (m_Timer->isActive()) m_Timer->stop(); |
247 | } | 247 | } |
248 | 248 | ||
249 | void DatebookEventDesc::disp_event(const Event&e) | 249 | void DatebookEventDesc::disp_event(const Event&e) |
250 | { | 250 | { |
251 | if (m_Timer->isActive()) m_Timer->stop(); | 251 | if (m_Timer->isActive()) m_Timer->stop(); |
252 | QString text; | 252 | QString text; |
253 | text = "<b><i>"+e.description()+"</i></b><br>"; | 253 | text = "<b><i>"+e.description()+"</i></b><br>"; |
254 | if (e.notes().length()>0) { | 254 | if (e.notes().length()>0) { |
255 | text+="<b>"+e.notes()+"</b><br>"; | 255 | text+="<b>"+e.notes()+"</b><br>"; |
256 | } | 256 | } |
257 | if (e.location().length()>0) { | 257 | if (e.location().length()>0) { |
258 | text+="<i>"+e.location()+"</i><br>"; | 258 | text+="<i>"+e.location()+"</i><br>"; |
259 | } | 259 | } |
260 | text = text.replace(QRegExp("\n"),"<br>"); | 260 | text = text.replace(QRegExp("\n"),"<br>"); |
261 | setText(text); | 261 | setText(text); |
262 | QSize s = sizeHint(); | 262 | QSize s = sizeHint(); |
263 | s+=QSize(10,10); | 263 | s+=QSize(10,10); |
264 | resize(s); | 264 | resize(s); |
265 | move( QMAX(0,(parentWidget()->width()-width()) / 2), | 265 | move( QMAX(0,(parentWidget()->width()-width()) / 2), |
266 | (parentWidget()->height()-height())/2 ); | 266 | (parentWidget()->height()-height())/2 ); |
267 | show(); | 267 | show(); |
268 | m_Timer->start(2000,true); | 268 | m_Timer->start(2000,true); |
269 | } | 269 | } |
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index cb4b73b..861e266 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp | |||
@@ -1,155 +1,191 @@ | |||
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 "datebooksettings.h" | 21 | #include "datebooksettings.h" |
22 | 22 | ||
23 | #include <opie2/opluginloader.h> | ||
24 | #include <opie2/odebug.h> | ||
25 | |||
23 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
24 | 27 | ||
25 | #include <qspinbox.h> | 28 | #include <qspinbox.h> |
26 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qlistview.h> | ||
31 | #include <qheader.h> | ||
27 | 32 | ||
28 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, | 33 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, |
29 | const char *name, bool modal, WFlags fl ) | 34 | const char *name, bool modal, WFlags fl ) |
30 | : DateBookSettingsBase( parent, name, modal, fl ), | 35 | : DateBookSettingsBase( parent, name, modal, fl ), |
31 | ampm( whichClock ) | 36 | ampm( whichClock ) |
32 | { | 37 | { |
33 | init(); | 38 | init(); |
34 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); | 39 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); |
35 | QArray<int> categories; | 40 | QArray<int> categories; |
36 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); | 41 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); |
42 | m_loader = 0; | ||
43 | m_manager = 0; | ||
44 | m_PluginListView->header()->hide(); | ||
45 | m_PluginListView->setSorting(-1); | ||
37 | } | 46 | } |
38 | 47 | ||
39 | DateBookSettings::~DateBookSettings() | 48 | DateBookSettings::~DateBookSettings() |
40 | { | 49 | { |
41 | } | 50 | } |
42 | 51 | ||
43 | void DateBookSettings::setStartTime( int newStartViewTime ) | 52 | void DateBookSettings::setStartTime( int newStartViewTime ) |
44 | { | 53 | { |
45 | if ( ampm ) { | 54 | if ( ampm ) { |
46 | if ( newStartViewTime >= 12 ) { | 55 | if ( newStartViewTime >= 12 ) { |
47 | newStartViewTime %= 12; | 56 | newStartViewTime %= 12; |
48 | if ( newStartViewTime == 0 ) | 57 | if ( newStartViewTime == 0 ) |
49 | newStartViewTime = 12; | 58 | newStartViewTime = 12; |
50 | spinStart->setSuffix( tr(":00 PM") ); | 59 | spinStart->setSuffix( tr(":00 PM") ); |
51 | } | 60 | } |
52 | else if ( newStartViewTime == 0 ) { | 61 | else if ( newStartViewTime == 0 ) { |
53 | newStartViewTime = 12; | 62 | newStartViewTime = 12; |
54 | spinStart->setSuffix( tr(":00 AM") ); | 63 | spinStart->setSuffix( tr(":00 AM") ); |
55 | } | 64 | } |
56 | oldtime = newStartViewTime; | 65 | oldtime = newStartViewTime; |
57 | } | 66 | } |
58 | spinStart->setValue( newStartViewTime ); | 67 | spinStart->setValue( newStartViewTime ); |
59 | } | 68 | } |
60 | 69 | ||
61 | int DateBookSettings::startTime() const | 70 | int DateBookSettings::startTime() const |
62 | { | 71 | { |
63 | int returnMe = spinStart->value(); | 72 | int returnMe = spinStart->value(); |
64 | if ( ampm ) { | 73 | if ( ampm ) { |
65 | if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) | 74 | if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) |
66 | returnMe += 12; | 75 | returnMe += 12; |
67 | else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) | 76 | else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) |
68 | returnMe = 0; | 77 | returnMe = 0; |
69 | } | 78 | } |
70 | return returnMe; | 79 | return returnMe; |
71 | } | 80 | } |
72 | 81 | ||
82 | void DateBookSettings::setPluginList(Opie::Core::OPluginManager*aManager,Opie::Core::OPluginLoader*aLoader) | ||
83 | { | ||
84 | m_manager = aManager; | ||
85 | m_loader = aLoader; | ||
86 | if (!aManager||!aLoader) return; | ||
87 | Opie::Core::OPluginItem::List inLst = m_loader->allAvailable(true); | ||
88 | QCheckListItem *pitem = 0; | ||
89 | |||
90 | for ( Opie::Core::OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { | ||
91 | pitem = new QCheckListItem(m_PluginListView,(*it).name(),QCheckListItem::CheckBox); | ||
92 | pitem->setOn( (*it).isEnabled() ); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | void DateBookSettings::pluginItemClicked(QListViewItem *aItem) | ||
97 | { | ||
98 | if (!aItem||!m_manager||!m_loader) return; | ||
99 | QCheckListItem*pitem = ((QCheckListItem*)aItem); | ||
100 | |||
101 | Opie::Core::OPluginItem::List lst = m_loader->allAvailable( true ); | ||
102 | for ( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | ||
103 | if ( QString::compare( (*it).name() , pitem->text(0) ) == 0 ) { | ||
104 | m_manager->setEnabled((*it),pitem->isOn()); | ||
105 | break; | ||
106 | } | ||
107 | } | ||
108 | } | ||
73 | 109 | ||
74 | void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime ) | 110 | void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime ) |
75 | { | 111 | { |
76 | chkAlarmPreset->setChecked( bAlarm ); | 112 | chkAlarmPreset->setChecked( bAlarm ); |
77 | if ( presetTime >=5 ) | 113 | if ( presetTime >=5 ) |
78 | spinPreset->setValue( presetTime ); | 114 | spinPreset->setValue( presetTime ); |
79 | } | 115 | } |
80 | 116 | ||
81 | bool DateBookSettings::alarmPreset() const | 117 | bool DateBookSettings::alarmPreset() const |
82 | { | 118 | { |
83 | return chkAlarmPreset->isChecked(); | 119 | return chkAlarmPreset->isChecked(); |
84 | } | 120 | } |
85 | 121 | ||
86 | int DateBookSettings::presetTime() const | 122 | int DateBookSettings::presetTime() const |
87 | { | 123 | { |
88 | return spinPreset->value(); | 124 | return spinPreset->value(); |
89 | } | 125 | } |
90 | 126 | ||
91 | 127 | ||
92 | void DateBookSettings::slot12Hour( int i ) | 128 | void DateBookSettings::slot12Hour( int i ) |
93 | { | 129 | { |
94 | if ( ampm ) { | 130 | if ( ampm ) { |
95 | if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) { | 131 | if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) { |
96 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) | 132 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) |
97 | spinStart->setSuffix( tr(":00 PM") ); | 133 | spinStart->setSuffix( tr(":00 PM") ); |
98 | } else { | 134 | } else { |
99 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) | 135 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) |
100 | spinStart->setSuffix( tr(":00 AM") ); | 136 | spinStart->setSuffix( tr(":00 AM") ); |
101 | } | 137 | } |
102 | oldtime = i; | 138 | oldtime = i; |
103 | } | 139 | } |
104 | } | 140 | } |
105 | 141 | ||
106 | void DateBookSettings::init() | 142 | void DateBookSettings::init() |
107 | { | 143 | { |
108 | if ( ampm ) { | 144 | if ( ampm ) { |
109 | spinStart->setMinValue( 1 ); | 145 | spinStart->setMinValue( 1 ); |
110 | spinStart->setMaxValue( 12 ); | 146 | spinStart->setMaxValue( 12 ); |
111 | spinStart->setValue( 12 ); | 147 | spinStart->setValue( 12 ); |
112 | spinStart->setSuffix( tr(":00 AM") ); | 148 | spinStart->setSuffix( tr(":00 AM") ); |
113 | oldtime = 12; | 149 | oldtime = 12; |
114 | } else { | 150 | } else { |
115 | spinStart->setMinValue( 0 ); | 151 | spinStart->setMinValue( 0 ); |
116 | spinStart->setMaxValue( 23 ); | 152 | spinStart->setMaxValue( 23 ); |
117 | spinStart->setSuffix( tr(":00") ); | 153 | spinStart->setSuffix( tr(":00") ); |
118 | } | 154 | } |
119 | } | 155 | } |
120 | 156 | ||
121 | void DateBookSettings::slotChangeClock( bool whichClock ) | 157 | void DateBookSettings::slotChangeClock( bool whichClock ) |
122 | { | 158 | { |
123 | int saveMe; | 159 | int saveMe; |
124 | saveMe = spinStart->value(); | 160 | saveMe = spinStart->value(); |
125 | if ( ampm && spinStart->suffix().contains( tr("AM"), FALSE ) ) { | 161 | if ( ampm && spinStart->suffix().contains( tr("AM"), FALSE ) ) { |
126 | if ( saveMe == 12 ) | 162 | if ( saveMe == 12 ) |
127 | saveMe = 0; | 163 | saveMe = 0; |
128 | } else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) { | 164 | } else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) { |
129 | if ( saveMe != 12 ) | 165 | if ( saveMe != 12 ) |
130 | saveMe += 12; | 166 | saveMe += 12; |
131 | } | 167 | } |
132 | ampm = whichClock; | 168 | ampm = whichClock; |
133 | init(); | 169 | init(); |
134 | setStartTime( saveMe ); | 170 | setStartTime( saveMe ); |
135 | } | 171 | } |
136 | 172 | ||
137 | void DateBookSettings::setJumpToCurTime( bool bJump ) | 173 | void DateBookSettings::setJumpToCurTime( bool bJump ) |
138 | { | 174 | { |
139 | chkJumpToCurTime->setChecked( bJump ); | 175 | chkJumpToCurTime->setChecked( bJump ); |
140 | } | 176 | } |
141 | 177 | ||
142 | bool DateBookSettings::jumpToCurTime() const | 178 | bool DateBookSettings::jumpToCurTime() const |
143 | { | 179 | { |
144 | return chkJumpToCurTime->isChecked(); | 180 | return chkJumpToCurTime->isChecked(); |
145 | } | 181 | } |
146 | 182 | ||
147 | void DateBookSettings::setRowStyle( int style ) | 183 | void DateBookSettings::setRowStyle( int style ) |
148 | { | 184 | { |
149 | comboRowStyle->setCurrentItem( style ); | 185 | comboRowStyle->setCurrentItem( style ); |
150 | } | 186 | } |
151 | 187 | ||
152 | int DateBookSettings::rowStyle() const | 188 | int DateBookSettings::rowStyle() const |
153 | { | 189 | { |
154 | return comboRowStyle->currentItem(); | 190 | return comboRowStyle->currentItem(); |
155 | } | 191 | } |
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index cf8a0ff..df7d32c 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h | |||
@@ -1,55 +1,71 @@ | |||
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 | #ifndef DATEBOOKSETTINGS_H | 21 | #ifndef DATEBOOKSETTINGS_H |
22 | #define DATEBOOKSETTINGS_H | 22 | #define DATEBOOKSETTINGS_H |
23 | #include "datebooksettingsbase.h" | 23 | #include "datebooksettingsbase.h" |
24 | #include <qpe/categoryselect.h> | 24 | #include <qpe/categoryselect.h> |
25 | 25 | ||
26 | namespace Opie { | ||
27 | namespace Core { | ||
28 | class OPluginManager; | ||
29 | class OGenericPluginLoader; | ||
30 | class OPluginLoader; | ||
31 | } | ||
32 | namespace Ui { | ||
33 | class OPluginConfigWidget; | ||
34 | } | ||
35 | } | ||
36 | |||
26 | class DateBookSettings : public DateBookSettingsBase | 37 | class DateBookSettings : public DateBookSettingsBase |
27 | { | 38 | { |
28 | Q_OBJECT | 39 | Q_OBJECT |
29 | public: | 40 | public: |
30 | DateBookSettings( bool whichClock, QWidget *parent = 0, | 41 | DateBookSettings( bool whichClock, QWidget *parent = 0, |
31 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); | 42 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); |
32 | ~DateBookSettings(); | 43 | ~DateBookSettings(); |
33 | void setStartTime( int newStartViewTime ); | 44 | void setStartTime( int newStartViewTime ); |
34 | int startTime() const; | 45 | int startTime() const; |
35 | void setAlarmPreset( bool bAlarm, int presetTime ); | 46 | void setAlarmPreset( bool bAlarm, int presetTime ); |
36 | bool alarmPreset() const; | 47 | bool alarmPreset() const; |
37 | int presetTime() const; | 48 | int presetTime() const; |
38 | void setAlarmType( int alarmType ); | 49 | void setAlarmType( int alarmType ); |
39 | int alarmType() const; | 50 | int alarmType() const; |
40 | 51 | ||
41 | void setJumpToCurTime( bool bJump ); | 52 | void setJumpToCurTime( bool bJump ); |
42 | bool jumpToCurTime() const; | 53 | bool jumpToCurTime() const; |
43 | void setRowStyle( int style ); | 54 | void setRowStyle( int style ); |
44 | int rowStyle() const; | 55 | int rowStyle() const; |
45 | 56 | ||
57 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); | ||
46 | private slots: | 58 | private slots: |
47 | void slot12Hour( int ); | 59 | void slot12Hour( int ); |
48 | void slotChangeClock( bool ); | 60 | void slotChangeClock( bool ); |
61 | protected slots: | ||
62 | virtual void pluginItemClicked(QListViewItem *); | ||
49 | 63 | ||
50 | private: | 64 | protected: |
51 | void init(); | 65 | void init(); |
52 | bool ampm; | 66 | bool ampm; |
53 | int oldtime; | 67 | int oldtime; |
68 | Opie::Core::OPluginManager*m_manager; | ||
69 | Opie::Core::OPluginLoader*m_loader; | ||
54 | }; | 70 | }; |
55 | #endif | 71 | #endif |
diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui index e613db1..7b3e591 100644 --- a/core/pim/datebook/datebooksettingsbase.ui +++ b/core/pim/datebook/datebooksettingsbase.ui | |||
@@ -1,712 +1,767 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>DateBookSettingsBase</class> | 2 | <class>DateBookSettingsBase</class> |
3 | <comment>********************************************************************** | 3 | <comment>********************************************************************** |
4 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 4 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
5 | ** | 5 | ** |
6 | ** This file is part of Qtopia Environment. | 6 | ** This file is part of Qtopia Environment. |
7 | ** | 7 | ** |
8 | ** This file may be distributed and/or modified under the terms of the | 8 | ** This file may be distributed and/or modified under the terms of the |
9 | ** GNU General Public License version 2 as published by the Free Software | 9 | ** GNU General Public License version 2 as published by the Free Software |
10 | ** Foundation and appearing in the file LICENSE.GPL included in the | 10 | ** Foundation and appearing in the file LICENSE.GPL included in the |
11 | ** packaging of this file. | 11 | ** packaging of this file. |
12 | ** | 12 | ** |
13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
15 | ** | 15 | ** |
16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
17 | ** | 17 | ** |
18 | ** Contact info@trolltech.com if any conditions of this licensing are | 18 | ** Contact info@trolltech.com if any conditions of this licensing are |
19 | ** not clear to you. | 19 | ** not clear to you. |
20 | ** | 20 | ** |
21 | ** $Id$ | 21 | ** $Id$ |
22 | ** | 22 | ** |
23 | **********************************************************************</comment> | 23 | **********************************************************************</comment> |
24 | <widget> | 24 | <widget> |
25 | <class>QDialog</class> | 25 | <class>QDialog</class> |
26 | <property stdset="1"> | 26 | <property stdset="1"> |
27 | <name>name</name> | 27 | <name>name</name> |
28 | <cstring>DateBookSettingsBase</cstring> | 28 | <cstring>DateBookSettingsBase</cstring> |
29 | </property> | 29 | </property> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>geometry</name> | 31 | <name>geometry</name> |
32 | <rect> | 32 | <rect> |
33 | <x>0</x> | 33 | <x>0</x> |
34 | <y>0</y> | 34 | <y>0</y> |
35 | <width>273</width> | 35 | <width>273</width> |
36 | <height>340</height> | 36 | <height>340</height> |
37 | </rect> | 37 | </rect> |
38 | </property> | 38 | </property> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>caption</name> | 40 | <name>caption</name> |
41 | <string>Preferences</string> | 41 | <string>Preferences</string> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <vbox> | 49 | <vbox> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>margin</name> | 51 | <name>margin</name> |
52 | <number>11</number> | 52 | <number>11</number> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>spacing</name> | 55 | <name>spacing</name> |
56 | <number>6</number> | 56 | <number>6</number> |
57 | </property> | 57 | </property> |
58 | <widget> | 58 | <widget> |
59 | <class>QTabWidget</class> | 59 | <class>QTabWidget</class> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>name</name> | 61 | <name>name</name> |
62 | <cstring>TabWidget2</cstring> | 62 | <cstring>TabWidget</cstring> |
63 | </property> | ||
64 | <property> | ||
65 | <name>layoutMargin</name> | ||
66 | </property> | ||
67 | <property> | ||
68 | <name>layoutSpacing</name> | ||
63 | </property> | 69 | </property> |
64 | <widget> | 70 | <widget> |
65 | <class>QWidget</class> | 71 | <class>QWidget</class> |
66 | <property stdset="1"> | 72 | <property stdset="1"> |
67 | <name>name</name> | 73 | <name>name</name> |
68 | <cstring>tab</cstring> | 74 | <cstring>tab</cstring> |
69 | </property> | 75 | </property> |
70 | <attribute> | 76 | <attribute> |
71 | <name>title</name> | 77 | <name>title</name> |
72 | <string>Views</string> | 78 | <string>Views</string> |
73 | </attribute> | 79 | </attribute> |
74 | <vbox> | 80 | <vbox> |
75 | <property stdset="1"> | 81 | <property stdset="1"> |
76 | <name>margin</name> | 82 | <name>margin</name> |
77 | <number>11</number> | 83 | <number>11</number> |
78 | </property> | 84 | </property> |
79 | <property stdset="1"> | 85 | <property stdset="1"> |
80 | <name>spacing</name> | 86 | <name>spacing</name> |
81 | <number>6</number> | 87 | <number>6</number> |
82 | </property> | 88 | </property> |
83 | <widget> | 89 | <widget> |
84 | <class>QLayoutWidget</class> | 90 | <class>QLayoutWidget</class> |
85 | <property stdset="1"> | 91 | <property stdset="1"> |
86 | <name>name</name> | 92 | <name>name</name> |
87 | <cstring>Layout5</cstring> | 93 | <cstring>Layout5</cstring> |
88 | </property> | 94 | </property> |
89 | <hbox> | 95 | <hbox> |
90 | <property stdset="1"> | 96 | <property stdset="1"> |
91 | <name>margin</name> | 97 | <name>margin</name> |
92 | <number>0</number> | 98 | <number>0</number> |
93 | </property> | 99 | </property> |
94 | <property stdset="1"> | 100 | <property stdset="1"> |
95 | <name>spacing</name> | 101 | <name>spacing</name> |
96 | <number>6</number> | 102 | <number>6</number> |
97 | </property> | 103 | </property> |
98 | <spacer> | 104 | <spacer> |
99 | <property> | 105 | <property> |
100 | <name>name</name> | 106 | <name>name</name> |
101 | <cstring>Spacer1</cstring> | 107 | <cstring>Spacer1</cstring> |
102 | </property> | 108 | </property> |
103 | <property stdset="1"> | 109 | <property stdset="1"> |
104 | <name>orientation</name> | 110 | <name>orientation</name> |
105 | <enum>Horizontal</enum> | 111 | <enum>Horizontal</enum> |
106 | </property> | 112 | </property> |
107 | <property stdset="1"> | 113 | <property stdset="1"> |
108 | <name>sizeType</name> | 114 | <name>sizeType</name> |
109 | <enum>Expanding</enum> | 115 | <enum>Expanding</enum> |
110 | </property> | 116 | </property> |
111 | <property> | 117 | <property> |
112 | <name>sizeHint</name> | 118 | <name>sizeHint</name> |
113 | <size> | 119 | <size> |
114 | <width>20</width> | 120 | <width>20</width> |
115 | <height>20</height> | 121 | <height>20</height> |
116 | </size> | 122 | </size> |
117 | </property> | 123 | </property> |
118 | </spacer> | 124 | </spacer> |
119 | <widget> | 125 | <widget> |
120 | <class>QLabel</class> | 126 | <class>QLabel</class> |
121 | <property stdset="1"> | 127 | <property stdset="1"> |
122 | <name>name</name> | 128 | <name>name</name> |
123 | <cstring>TextLabel1_2</cstring> | 129 | <cstring>TextLabel1_2</cstring> |
124 | </property> | 130 | </property> |
125 | <property stdset="1"> | 131 | <property stdset="1"> |
126 | <name>text</name> | 132 | <name>text</name> |
127 | <string>Default view:</string> | 133 | <string>Default view:</string> |
128 | </property> | 134 | </property> |
129 | </widget> | 135 | </widget> |
130 | <widget> | 136 | <widget> |
131 | <class>QComboBox</class> | 137 | <class>QComboBox</class> |
132 | <item> | 138 | <item> |
133 | <property> | 139 | <property> |
134 | <name>text</name> | 140 | <name>text</name> |
135 | <string>Day</string> | 141 | <string>Day</string> |
136 | </property> | 142 | </property> |
137 | </item> | 143 | </item> |
138 | <item> | 144 | <item> |
139 | <property> | 145 | <property> |
140 | <name>text</name> | 146 | <name>text</name> |
141 | <string>Week</string> | 147 | <string>Week</string> |
142 | </property> | 148 | </property> |
143 | </item> | 149 | </item> |
144 | <item> | 150 | <item> |
145 | <property> | 151 | <property> |
146 | <name>text</name> | 152 | <name>text</name> |
147 | <string>Week List</string> | 153 | <string>Week List</string> |
148 | </property> | 154 | </property> |
149 | </item> | 155 | </item> |
150 | <item> | 156 | <item> |
151 | <property> | 157 | <property> |
152 | <name>text</name> | 158 | <name>text</name> |
153 | <string>Month</string> | 159 | <string>Month</string> |
154 | </property> | 160 | </property> |
155 | </item> | 161 | </item> |
156 | <property stdset="1"> | 162 | <property stdset="1"> |
157 | <name>name</name> | 163 | <name>name</name> |
158 | <cstring>comboDefaultView</cstring> | 164 | <cstring>comboDefaultView</cstring> |
159 | </property> | 165 | </property> |
160 | </widget> | 166 | </widget> |
161 | <spacer> | 167 | <spacer> |
162 | <property> | 168 | <property> |
163 | <name>name</name> | 169 | <name>name</name> |
164 | <cstring>Spacer2</cstring> | 170 | <cstring>Spacer2</cstring> |
165 | </property> | 171 | </property> |
166 | <property stdset="1"> | 172 | <property stdset="1"> |
167 | <name>orientation</name> | 173 | <name>orientation</name> |
168 | <enum>Horizontal</enum> | 174 | <enum>Horizontal</enum> |
169 | </property> | 175 | </property> |
170 | <property stdset="1"> | 176 | <property stdset="1"> |
171 | <name>sizeType</name> | 177 | <name>sizeType</name> |
172 | <enum>Expanding</enum> | 178 | <enum>Expanding</enum> |
173 | </property> | 179 | </property> |
174 | <property> | 180 | <property> |
175 | <name>sizeHint</name> | 181 | <name>sizeHint</name> |
176 | <size> | 182 | <size> |
177 | <width>20</width> | 183 | <width>20</width> |
178 | <height>20</height> | 184 | <height>20</height> |
179 | </size> | 185 | </size> |
180 | </property> | 186 | </property> |
181 | </spacer> | 187 | </spacer> |
182 | </hbox> | 188 | </hbox> |
183 | </widget> | 189 | </widget> |
184 | <widget> | 190 | <widget> |
185 | <class>QGroupBox</class> | 191 | <class>QGroupBox</class> |
186 | <property stdset="1"> | 192 | <property stdset="1"> |
187 | <name>name</name> | 193 | <name>name</name> |
188 | <cstring>GroupBox4</cstring> | 194 | <cstring>GroupBox4</cstring> |
189 | </property> | 195 | </property> |
190 | <property stdset="1"> | 196 | <property stdset="1"> |
191 | <name>title</name> | 197 | <name>title</name> |
192 | <string>Day</string> | 198 | <string>Day</string> |
193 | </property> | 199 | </property> |
194 | <vbox> | 200 | <vbox> |
195 | <property stdset="1"> | 201 | <property stdset="1"> |
196 | <name>margin</name> | 202 | <name>margin</name> |
197 | <number>11</number> | 203 | <number>11</number> |
198 | </property> | 204 | </property> |
199 | <property stdset="1"> | 205 | <property stdset="1"> |
200 | <name>spacing</name> | 206 | <name>spacing</name> |
201 | <number>6</number> | 207 | <number>6</number> |
202 | </property> | 208 | </property> |
203 | <widget> | 209 | <widget> |
204 | <class>QCheckBox</class> | 210 | <class>QCheckBox</class> |
205 | <property stdset="1"> | 211 | <property stdset="1"> |
206 | <name>name</name> | 212 | <name>name</name> |
207 | <cstring>chkJumpToCurTime</cstring> | 213 | <cstring>chkJumpToCurTime</cstring> |
208 | </property> | 214 | </property> |
209 | <property stdset="1"> | 215 | <property stdset="1"> |
210 | <name>text</name> | 216 | <name>text</name> |
211 | <string>Jump to current time</string> | 217 | <string>Jump to current time</string> |
212 | </property> | 218 | </property> |
213 | </widget> | 219 | </widget> |
214 | <widget> | 220 | <widget> |
215 | <class>QLayoutWidget</class> | 221 | <class>QLayoutWidget</class> |
216 | <property stdset="1"> | 222 | <property stdset="1"> |
217 | <name>name</name> | 223 | <name>name</name> |
218 | <cstring>Layout5</cstring> | 224 | <cstring>Layout5</cstring> |
219 | </property> | 225 | </property> |
220 | <hbox> | 226 | <hbox> |
221 | <property stdset="1"> | 227 | <property stdset="1"> |
222 | <name>margin</name> | 228 | <name>margin</name> |
223 | <number>0</number> | 229 | <number>0</number> |
224 | </property> | 230 | </property> |
225 | <property stdset="1"> | 231 | <property stdset="1"> |
226 | <name>spacing</name> | 232 | <name>spacing</name> |
227 | <number>6</number> | 233 | <number>6</number> |
228 | </property> | 234 | </property> |
229 | <widget> | 235 | <widget> |
230 | <class>QLabel</class> | 236 | <class>QLabel</class> |
231 | <property stdset="1"> | 237 | <property stdset="1"> |
232 | <name>name</name> | 238 | <name>name</name> |
233 | <cstring>TextLabel1</cstring> | 239 | <cstring>TextLabel1</cstring> |
234 | </property> | 240 | </property> |
235 | <property stdset="1"> | 241 | <property stdset="1"> |
236 | <name>text</name> | 242 | <name>text</name> |
237 | <string>Row style:</string> | 243 | <string>Row style:</string> |
238 | </property> | 244 | </property> |
239 | </widget> | 245 | </widget> |
240 | <widget> | 246 | <widget> |
241 | <class>QComboBox</class> | 247 | <class>QComboBox</class> |
242 | <item> | 248 | <item> |
243 | <property> | 249 | <property> |
244 | <name>text</name> | 250 | <name>text</name> |
245 | <string>Default</string> | 251 | <string>Default</string> |
246 | </property> | 252 | </property> |
247 | </item> | 253 | </item> |
248 | <item> | 254 | <item> |
249 | <property> | 255 | <property> |
250 | <name>text</name> | 256 | <name>text</name> |
251 | <string>Medium</string> | 257 | <string>Medium</string> |
252 | </property> | 258 | </property> |
253 | </item> | 259 | </item> |
254 | <item> | 260 | <item> |
255 | <property> | 261 | <property> |
256 | <name>text</name> | 262 | <name>text</name> |
257 | <string>Large</string> | 263 | <string>Large</string> |
258 | </property> | 264 | </property> |
259 | </item> | 265 | </item> |
260 | <property stdset="1"> | 266 | <property stdset="1"> |
261 | <name>name</name> | 267 | <name>name</name> |
262 | <cstring>comboRowStyle</cstring> | 268 | <cstring>comboRowStyle</cstring> |
263 | </property> | 269 | </property> |
264 | </widget> | 270 | </widget> |
265 | </hbox> | 271 | </hbox> |
266 | </widget> | 272 | </widget> |
267 | </vbox> | 273 | </vbox> |
268 | </widget> | 274 | </widget> |
269 | <widget> | 275 | <widget> |
270 | <class>QGroupBox</class> | 276 | <class>QGroupBox</class> |
271 | <property stdset="1"> | 277 | <property stdset="1"> |
272 | <name>name</name> | 278 | <name>name</name> |
273 | <cstring>GroupBox5</cstring> | 279 | <cstring>GroupBox5</cstring> |
274 | </property> | 280 | </property> |
275 | <property stdset="1"> | 281 | <property stdset="1"> |
276 | <name>title</name> | 282 | <name>title</name> |
277 | <string>Week List</string> | 283 | <string>Week List</string> |
278 | </property> | 284 | </property> |
279 | <vbox> | 285 | <vbox> |
280 | <property stdset="1"> | 286 | <property stdset="1"> |
281 | <name>margin</name> | 287 | <name>margin</name> |
282 | <number>11</number> | 288 | <number>11</number> |
283 | </property> | 289 | </property> |
284 | <property stdset="1"> | 290 | <property stdset="1"> |
285 | <name>spacing</name> | 291 | <name>spacing</name> |
286 | <number>6</number> | 292 | <number>6</number> |
287 | </property> | 293 | </property> |
288 | <widget> | 294 | <widget> |
289 | <class>QLayoutWidget</class> | 295 | <class>QLayoutWidget</class> |
290 | <property stdset="1"> | 296 | <property stdset="1"> |
291 | <name>name</name> | 297 | <name>name</name> |
292 | <cstring>Layout6</cstring> | 298 | <cstring>Layout6</cstring> |
293 | </property> | 299 | </property> |
294 | <hbox> | 300 | <hbox> |
295 | <property stdset="1"> | 301 | <property stdset="1"> |
296 | <name>margin</name> | 302 | <name>margin</name> |
297 | <number>0</number> | 303 | <number>0</number> |
298 | </property> | 304 | </property> |
299 | <property stdset="1"> | 305 | <property stdset="1"> |
300 | <name>spacing</name> | 306 | <name>spacing</name> |
301 | <number>6</number> | 307 | <number>6</number> |
302 | </property> | 308 | </property> |
303 | <widget> | 309 | <widget> |
304 | <class>QLabel</class> | 310 | <class>QLabel</class> |
305 | <property stdset="1"> | 311 | <property stdset="1"> |
306 | <name>name</name> | 312 | <name>name</name> |
307 | <cstring>TextLabel2</cstring> | 313 | <cstring>TextLabel2</cstring> |
308 | </property> | 314 | </property> |
309 | <property stdset="1"> | 315 | <property stdset="1"> |
310 | <name>text</name> | 316 | <name>text</name> |
311 | <string>Time display</string> | 317 | <string>Time display</string> |
312 | </property> | 318 | </property> |
313 | </widget> | 319 | </widget> |
314 | <widget> | 320 | <widget> |
315 | <class>QComboBox</class> | 321 | <class>QComboBox</class> |
316 | <item> | 322 | <item> |
317 | <property> | 323 | <property> |
318 | <name>text</name> | 324 | <name>text</name> |
319 | <string>None</string> | 325 | <string>None</string> |
320 | </property> | 326 | </property> |
321 | </item> | 327 | </item> |
322 | <item> | 328 | <item> |
323 | <property> | 329 | <property> |
324 | <name>text</name> | 330 | <name>text</name> |
325 | <string>Start</string> | 331 | <string>Start</string> |
326 | </property> | 332 | </property> |
327 | </item> | 333 | </item> |
328 | <item> | 334 | <item> |
329 | <property> | 335 | <property> |
330 | <name>text</name> | 336 | <name>text</name> |
331 | <string>Start-End</string> | 337 | <string>Start-End</string> |
332 | </property> | 338 | </property> |
333 | </item> | 339 | </item> |
334 | <property stdset="1"> | 340 | <property stdset="1"> |
335 | <name>name</name> | 341 | <name>name</name> |
336 | <cstring>comboWeekListView</cstring> | 342 | <cstring>comboWeekListView</cstring> |
337 | </property> | 343 | </property> |
338 | </widget> | 344 | </widget> |
339 | </hbox> | 345 | </hbox> |
340 | </widget> | 346 | </widget> |
341 | </vbox> | 347 | </vbox> |
342 | </widget> | 348 | </widget> |
343 | <spacer> | 349 | <spacer> |
344 | <property> | 350 | <property> |
345 | <name>name</name> | 351 | <name>name</name> |
346 | <cstring>Spacer3_2</cstring> | 352 | <cstring>Spacer3_2</cstring> |
347 | </property> | 353 | </property> |
348 | <property stdset="1"> | 354 | <property stdset="1"> |
349 | <name>orientation</name> | 355 | <name>orientation</name> |
350 | <enum>Vertical</enum> | 356 | <enum>Vertical</enum> |
351 | </property> | 357 | </property> |
352 | <property stdset="1"> | 358 | <property stdset="1"> |
353 | <name>sizeType</name> | 359 | <name>sizeType</name> |
354 | <enum>Expanding</enum> | 360 | <enum>Expanding</enum> |
355 | </property> | 361 | </property> |
356 | <property> | 362 | <property> |
357 | <name>sizeHint</name> | 363 | <name>sizeHint</name> |
358 | <size> | 364 | <size> |
359 | <width>20</width> | 365 | <width>20</width> |
360 | <height>20</height> | 366 | <height>20</height> |
361 | </size> | 367 | </size> |
362 | </property> | 368 | </property> |
363 | </spacer> | 369 | </spacer> |
364 | </vbox> | 370 | </vbox> |
365 | </widget> | 371 | </widget> |
366 | <widget> | 372 | <widget> |
367 | <class>QWidget</class> | 373 | <class>QWidget</class> |
368 | <property stdset="1"> | 374 | <property stdset="1"> |
369 | <name>name</name> | 375 | <name>name</name> |
370 | <cstring>tab</cstring> | 376 | <cstring>tab</cstring> |
371 | </property> | 377 | </property> |
372 | <attribute> | 378 | <attribute> |
373 | <name>title</name> | 379 | <name>title</name> |
374 | <string>Misc</string> | 380 | <string>Misc</string> |
375 | </attribute> | 381 | </attribute> |
376 | <vbox> | 382 | <vbox> |
377 | <property stdset="1"> | 383 | <property stdset="1"> |
378 | <name>margin</name> | 384 | <name>margin</name> |
379 | <number>11</number> | 385 | <number>11</number> |
380 | </property> | 386 | </property> |
381 | <property stdset="1"> | 387 | <property stdset="1"> |
382 | <name>spacing</name> | 388 | <name>spacing</name> |
383 | <number>6</number> | 389 | <number>6</number> |
384 | </property> | 390 | </property> |
385 | <widget> | 391 | <widget> |
386 | <class>QGroupBox</class> | 392 | <class>QGroupBox</class> |
387 | <property stdset="1"> | 393 | <property stdset="1"> |
388 | <name>name</name> | 394 | <name>name</name> |
389 | <cstring>GroupBox6</cstring> | 395 | <cstring>GroupBox6</cstring> |
390 | </property> | 396 | </property> |
391 | <property stdset="1"> | 397 | <property stdset="1"> |
392 | <name>title</name> | 398 | <name>title</name> |
393 | <string>Alarm Settings</string> | 399 | <string>Alarm Settings</string> |
394 | </property> | 400 | </property> |
395 | <vbox> | 401 | <vbox> |
396 | <property stdset="1"> | 402 | <property stdset="1"> |
397 | <name>margin</name> | 403 | <name>margin</name> |
398 | <number>11</number> | 404 | <number>11</number> |
399 | </property> | 405 | </property> |
400 | <property stdset="1"> | 406 | <property stdset="1"> |
401 | <name>spacing</name> | 407 | <name>spacing</name> |
402 | <number>6</number> | 408 | <number>6</number> |
403 | </property> | 409 | </property> |
404 | <widget> | 410 | <widget> |
405 | <class>QLayoutWidget</class> | 411 | <class>QLayoutWidget</class> |
406 | <property stdset="1"> | 412 | <property stdset="1"> |
407 | <name>name</name> | 413 | <name>name</name> |
408 | <cstring>Layout6</cstring> | 414 | <cstring>Layout6</cstring> |
409 | </property> | 415 | </property> |
410 | <hbox> | 416 | <hbox> |
411 | <property stdset="1"> | 417 | <property stdset="1"> |
412 | <name>margin</name> | 418 | <name>margin</name> |
413 | <number>0</number> | 419 | <number>0</number> |
414 | </property> | 420 | </property> |
415 | <property stdset="1"> | 421 | <property stdset="1"> |
416 | <name>spacing</name> | 422 | <name>spacing</name> |
417 | <number>6</number> | 423 | <number>6</number> |
418 | </property> | 424 | </property> |
419 | <widget> | 425 | <widget> |
420 | <class>QCheckBox</class> | 426 | <class>QCheckBox</class> |
421 | <property stdset="1"> | 427 | <property stdset="1"> |
422 | <name>name</name> | 428 | <name>name</name> |
423 | <cstring>chkAlarmPreset</cstring> | 429 | <cstring>chkAlarmPreset</cstring> |
424 | </property> | 430 | </property> |
425 | <property stdset="1"> | 431 | <property stdset="1"> |
426 | <name>text</name> | 432 | <name>text</name> |
427 | <string>Alarm Preset</string> | 433 | <string>Alarm Preset</string> |
428 | </property> | 434 | </property> |
429 | </widget> | 435 | </widget> |
430 | <widget> | 436 | <widget> |
431 | <class>QSpinBox</class> | 437 | <class>QSpinBox</class> |
432 | <property stdset="1"> | 438 | <property stdset="1"> |
433 | <name>name</name> | 439 | <name>name</name> |
434 | <cstring>spinPreset</cstring> | 440 | <cstring>spinPreset</cstring> |
435 | </property> | 441 | </property> |
436 | <property stdset="1"> | 442 | <property stdset="1"> |
437 | <name>enabled</name> | 443 | <name>enabled</name> |
438 | <bool>false</bool> | 444 | <bool>false</bool> |
439 | </property> | 445 | </property> |
440 | <property stdset="1"> | 446 | <property stdset="1"> |
441 | <name>suffix</name> | 447 | <name>suffix</name> |
442 | <string> minutes</string> | 448 | <string> minutes</string> |
443 | </property> | 449 | </property> |
444 | <property stdset="1"> | 450 | <property stdset="1"> |
445 | <name>maxValue</name> | 451 | <name>maxValue</name> |
446 | <number>180</number> | 452 | <number>180</number> |
447 | </property> | 453 | </property> |
448 | <property stdset="1"> | 454 | <property stdset="1"> |
449 | <name>minValue</name> | 455 | <name>minValue</name> |
450 | <number>0</number> | 456 | <number>0</number> |
451 | </property> | 457 | </property> |
452 | <property stdset="1"> | 458 | <property stdset="1"> |
453 | <name>lineStep</name> | 459 | <name>lineStep</name> |
454 | <number>5</number> | 460 | <number>5</number> |
455 | </property> | 461 | </property> |
456 | <property stdset="1"> | 462 | <property stdset="1"> |
457 | <name>value</name> | 463 | <name>value</name> |
458 | <number>5</number> | 464 | <number>5</number> |
459 | </property> | 465 | </property> |
460 | </widget> | 466 | </widget> |
461 | </hbox> | 467 | </hbox> |
462 | </widget> | 468 | </widget> |
463 | </vbox> | 469 | </vbox> |
464 | </widget> | 470 | </widget> |
465 | <widget> | 471 | <widget> |
466 | <class>QGroupBox</class> | 472 | <class>QGroupBox</class> |
467 | <property stdset="1"> | 473 | <property stdset="1"> |
468 | <name>name</name> | 474 | <name>name</name> |
469 | <cstring>GroupBox7</cstring> | 475 | <cstring>GroupBox7</cstring> |
470 | </property> | 476 | </property> |
471 | <property stdset="1"> | 477 | <property stdset="1"> |
472 | <name>title</name> | 478 | <name>title</name> |
473 | <string>Start viewing events</string> | 479 | <string>Start viewing events</string> |
474 | </property> | 480 | </property> |
475 | <vbox> | 481 | <vbox> |
476 | <property stdset="1"> | 482 | <property stdset="1"> |
477 | <name>margin</name> | 483 | <name>margin</name> |
478 | <number>11</number> | 484 | <number>11</number> |
479 | </property> | 485 | </property> |
480 | <property stdset="1"> | 486 | <property stdset="1"> |
481 | <name>spacing</name> | 487 | <name>spacing</name> |
482 | <number>6</number> | 488 | <number>6</number> |
483 | </property> | 489 | </property> |
484 | <widget> | 490 | <widget> |
485 | <class>QLayoutWidget</class> | 491 | <class>QLayoutWidget</class> |
486 | <property stdset="1"> | 492 | <property stdset="1"> |
487 | <name>name</name> | 493 | <name>name</name> |
488 | <cstring>Layout1</cstring> | 494 | <cstring>Layout1</cstring> |
489 | </property> | 495 | </property> |
490 | <hbox> | 496 | <hbox> |
491 | <property stdset="1"> | 497 | <property stdset="1"> |
492 | <name>margin</name> | 498 | <name>margin</name> |
493 | <number>0</number> | 499 | <number>0</number> |
494 | </property> | 500 | </property> |
495 | <property stdset="1"> | 501 | <property stdset="1"> |
496 | <name>spacing</name> | 502 | <name>spacing</name> |
497 | <number>6</number> | 503 | <number>6</number> |
498 | </property> | 504 | </property> |
499 | <widget> | 505 | <widget> |
500 | <class>QLabel</class> | 506 | <class>QLabel</class> |
501 | <property stdset="1"> | 507 | <property stdset="1"> |
502 | <name>name</name> | 508 | <name>name</name> |
503 | <cstring>lblStartTime</cstring> | 509 | <cstring>lblStartTime</cstring> |
504 | </property> | 510 | </property> |
505 | <property stdset="1"> | 511 | <property stdset="1"> |
506 | <name>text</name> | 512 | <name>text</name> |
507 | <string>Start Time:</string> | 513 | <string>Start Time:</string> |
508 | </property> | 514 | </property> |
509 | </widget> | 515 | </widget> |
510 | <widget> | 516 | <widget> |
511 | <class>QSpinBox</class> | 517 | <class>QSpinBox</class> |
512 | <property stdset="1"> | 518 | <property stdset="1"> |
513 | <name>name</name> | 519 | <name>name</name> |
514 | <cstring>spinStart</cstring> | 520 | <cstring>spinStart</cstring> |
515 | </property> | 521 | </property> |
516 | <property stdset="1"> | 522 | <property stdset="1"> |
517 | <name>suffix</name> | 523 | <name>suffix</name> |
518 | <string>:00</string> | 524 | <string>:00</string> |
519 | </property> | 525 | </property> |
520 | <property stdset="1"> | 526 | <property stdset="1"> |
521 | <name>wrapping</name> | 527 | <name>wrapping</name> |
522 | <bool>true</bool> | 528 | <bool>true</bool> |
523 | </property> | 529 | </property> |
524 | <property stdset="1"> | 530 | <property stdset="1"> |
525 | <name>maxValue</name> | 531 | <name>maxValue</name> |
526 | <number>23</number> | 532 | <number>23</number> |
527 | </property> | 533 | </property> |
528 | </widget> | 534 | </widget> |
529 | </hbox> | 535 | </hbox> |
530 | </widget> | 536 | </widget> |
531 | </vbox> | 537 | </vbox> |
532 | </widget> | 538 | </widget> |
533 | <widget> | 539 | <widget> |
534 | <class>QGroupBox</class> | 540 | <class>QGroupBox</class> |
535 | <property stdset="1"> | 541 | <property stdset="1"> |
536 | <name>name</name> | 542 | <name>name</name> |
537 | <cstring>GroupBox5_2_2</cstring> | 543 | <cstring>GroupBox5_2_2</cstring> |
538 | </property> | 544 | </property> |
539 | <property stdset="1"> | 545 | <property stdset="1"> |
540 | <name>title</name> | 546 | <name>title</name> |
541 | <string>Defaults</string> | 547 | <string>Defaults</string> |
542 | </property> | 548 | </property> |
543 | <vbox> | 549 | <vbox> |
544 | <property stdset="1"> | 550 | <property stdset="1"> |
545 | <name>margin</name> | 551 | <name>margin</name> |
546 | <number>11</number> | 552 | <number>11</number> |
547 | </property> | 553 | </property> |
548 | <property stdset="1"> | 554 | <property stdset="1"> |
549 | <name>spacing</name> | 555 | <name>spacing</name> |
550 | <number>6</number> | 556 | <number>6</number> |
551 | </property> | 557 | </property> |
552 | <widget> | 558 | <widget> |
553 | <class>QLayoutWidget</class> | 559 | <class>QLayoutWidget</class> |
554 | <property stdset="1"> | 560 | <property stdset="1"> |
555 | <name>name</name> | 561 | <name>name</name> |
556 | <cstring>Layout6_2</cstring> | 562 | <cstring>Layout6_2</cstring> |
557 | </property> | 563 | </property> |
558 | <hbox> | 564 | <hbox> |
559 | <property stdset="1"> | 565 | <property stdset="1"> |
560 | <name>margin</name> | 566 | <name>margin</name> |
561 | <number>0</number> | 567 | <number>0</number> |
562 | </property> | 568 | </property> |
563 | <property stdset="1"> | 569 | <property stdset="1"> |
564 | <name>spacing</name> | 570 | <name>spacing</name> |
565 | <number>6</number> | 571 | <number>6</number> |
566 | </property> | 572 | </property> |
567 | <widget> | 573 | <widget> |
568 | <class>QLabel</class> | 574 | <class>QLabel</class> |
569 | <property stdset="1"> | 575 | <property stdset="1"> |
570 | <name>name</name> | 576 | <name>name</name> |
571 | <cstring>TextLabel2_2_3</cstring> | 577 | <cstring>TextLabel2_2_3</cstring> |
572 | </property> | 578 | </property> |
573 | <property stdset="1"> | 579 | <property stdset="1"> |
574 | <name>frameShape</name> | 580 | <name>frameShape</name> |
575 | <enum>MShape</enum> | 581 | <enum>MShape</enum> |
576 | </property> | 582 | </property> |
577 | <property stdset="1"> | 583 | <property stdset="1"> |
578 | <name>frameShadow</name> | 584 | <name>frameShadow</name> |
579 | <enum>MShadow</enum> | 585 | <enum>MShadow</enum> |
580 | </property> | 586 | </property> |
581 | <property stdset="1"> | 587 | <property stdset="1"> |
582 | <name>text</name> | 588 | <name>text</name> |
583 | <string>Location:</string> | 589 | <string>Location:</string> |
584 | </property> | 590 | </property> |
585 | </widget> | 591 | </widget> |
586 | <widget> | 592 | <widget> |
587 | <class>QComboBox</class> | 593 | <class>QComboBox</class> |
588 | <item> | 594 | <item> |
589 | <property> | 595 | <property> |
590 | <name>text</name> | 596 | <name>text</name> |
591 | <string></string> | 597 | <string></string> |
592 | </property> | 598 | </property> |
593 | </item> | 599 | </item> |
594 | <item> | 600 | <item> |
595 | <property> | 601 | <property> |
596 | <name>text</name> | 602 | <name>text</name> |
597 | <string>Office</string> | 603 | <string>Office</string> |
598 | </property> | 604 | </property> |
599 | </item> | 605 | </item> |
600 | <item> | 606 | <item> |
601 | <property> | 607 | <property> |
602 | <name>text</name> | 608 | <name>text</name> |
603 | <string>Home</string> | 609 | <string>Home</string> |
604 | </property> | 610 | </property> |
605 | </item> | 611 | </item> |
606 | <property stdset="1"> | 612 | <property stdset="1"> |
607 | <name>name</name> | 613 | <name>name</name> |
608 | <cstring>comboLocation</cstring> | 614 | <cstring>comboLocation</cstring> |
609 | </property> | 615 | </property> |
610 | <property stdset="1"> | 616 | <property stdset="1"> |
611 | <name>sizePolicy</name> | 617 | <name>sizePolicy</name> |
612 | <sizepolicy> | 618 | <sizepolicy> |
613 | <hsizetype>7</hsizetype> | 619 | <hsizetype>7</hsizetype> |
614 | <vsizetype>0</vsizetype> | 620 | <vsizetype>0</vsizetype> |
615 | </sizepolicy> | 621 | </sizepolicy> |
616 | </property> | 622 | </property> |
617 | <property stdset="1"> | 623 | <property stdset="1"> |
618 | <name>editable</name> | 624 | <name>editable</name> |
619 | <bool>true</bool> | 625 | <bool>true</bool> |
620 | </property> | 626 | </property> |
621 | <property stdset="1"> | 627 | <property stdset="1"> |
622 | <name>currentItem</name> | 628 | <name>currentItem</name> |
623 | <number>0</number> | 629 | <number>0</number> |
624 | </property> | 630 | </property> |
625 | <property stdset="1"> | 631 | <property stdset="1"> |
626 | <name>duplicatesEnabled</name> | 632 | <name>duplicatesEnabled</name> |
627 | <bool>false</bool> | 633 | <bool>false</bool> |
628 | </property> | 634 | </property> |
629 | </widget> | 635 | </widget> |
630 | </hbox> | 636 | </hbox> |
631 | </widget> | 637 | </widget> |
632 | <widget> | 638 | <widget> |
633 | <class>QLayoutWidget</class> | 639 | <class>QLayoutWidget</class> |
634 | <property stdset="1"> | 640 | <property stdset="1"> |
635 | <name>name</name> | 641 | <name>name</name> |
636 | <cstring>Layout7_2</cstring> | 642 | <cstring>Layout7_2</cstring> |
637 | </property> | 643 | </property> |
638 | <hbox> | 644 | <hbox> |
639 | <property stdset="1"> | 645 | <property stdset="1"> |
640 | <name>margin</name> | 646 | <name>margin</name> |
641 | <number>0</number> | 647 | <number>0</number> |
642 | </property> | 648 | </property> |
643 | <property stdset="1"> | 649 | <property stdset="1"> |
644 | <name>spacing</name> | 650 | <name>spacing</name> |
645 | <number>6</number> | 651 | <number>6</number> |
646 | </property> | 652 | </property> |
647 | <widget> | 653 | <widget> |
648 | <class>QLabel</class> | 654 | <class>QLabel</class> |
649 | <property stdset="1"> | 655 | <property stdset="1"> |
650 | <name>name</name> | 656 | <name>name</name> |
651 | <cstring>TextLabel2_2_2_2</cstring> | 657 | <cstring>TextLabel2_2_2_2</cstring> |
652 | </property> | 658 | </property> |
653 | <property stdset="1"> | 659 | <property stdset="1"> |
654 | <name>text</name> | 660 | <name>text</name> |
655 | <string>Category:</string> | 661 | <string>Category:</string> |
656 | </property> | 662 | </property> |
657 | </widget> | 663 | </widget> |
658 | <widget> | 664 | <widget> |
659 | <class>CategorySelect</class> | 665 | <class>CategorySelect</class> |
660 | <property stdset="1"> | 666 | <property stdset="1"> |
661 | <name>name</name> | 667 | <name>name</name> |
662 | <cstring>comboCategory</cstring> | 668 | <cstring>comboCategory</cstring> |
663 | </property> | 669 | </property> |
664 | </widget> | 670 | </widget> |
665 | </hbox> | 671 | </hbox> |
666 | </widget> | 672 | </widget> |
667 | </vbox> | 673 | </vbox> |
668 | </widget> | 674 | </widget> |
669 | </vbox> | 675 | </vbox> |
670 | </widget> | 676 | </widget> |
677 | <widget> | ||
678 | <class>QWidget</class> | ||
679 | <property stdset="1"> | ||
680 | <name>name</name> | ||
681 | <cstring>plugintab</cstring> | ||
682 | </property> | ||
683 | <attribute> | ||
684 | <name>title</name> | ||
685 | <string>Plugins</string> | ||
686 | </attribute> | ||
687 | <vbox> | ||
688 | <property stdset="1"> | ||
689 | <name>margin</name> | ||
690 | <number>2</number> | ||
691 | </property> | ||
692 | <property stdset="1"> | ||
693 | <name>spacing</name> | ||
694 | <number>2</number> | ||
695 | </property> | ||
696 | <widget> | ||
697 | <class>QListView</class> | ||
698 | <column> | ||
699 | <property> | ||
700 | <name>text</name> | ||
701 | <string>Pluginlist</string> | ||
702 | </property> | ||
703 | <property> | ||
704 | <name>clickable</name> | ||
705 | <bool>true</bool> | ||
706 | </property> | ||
707 | <property> | ||
708 | <name>resizeable</name> | ||
709 | <bool>true</bool> | ||
710 | </property> | ||
711 | </column> | ||
712 | <property stdset="1"> | ||
713 | <name>name</name> | ||
714 | <cstring>m_PluginListView</cstring> | ||
715 | </property> | ||
716 | </widget> | ||
717 | </vbox> | ||
718 | </widget> | ||
671 | </widget> | 719 | </widget> |
672 | </vbox> | 720 | </vbox> |
673 | </widget> | 721 | </widget> |
674 | <customwidgets> | 722 | <customwidgets> |
675 | <customwidget> | 723 | <customwidget> |
676 | <class>CategorySelect</class> | 724 | <class>CategorySelect</class> |
677 | <header location="global">qpe/categoryselect.h</header> | 725 | <header location="global">qpe/categoryselect.h</header> |
678 | <sizehint> | 726 | <sizehint> |
679 | <width>-1</width> | 727 | <width>-1</width> |
680 | <height>-1</height> | 728 | <height>-1</height> |
681 | </sizehint> | 729 | </sizehint> |
682 | <container>0</container> | 730 | <container>0</container> |
683 | <sizepolicy> | 731 | <sizepolicy> |
684 | <hordata>7</hordata> | 732 | <hordata>7</hordata> |
685 | <verdata>1</verdata> | 733 | <verdata>1</verdata> |
686 | </sizepolicy> | 734 | </sizepolicy> |
687 | <pixmap>image0</pixmap> | 735 | <pixmap>image0</pixmap> |
688 | </customwidget> | 736 | </customwidget> |
689 | </customwidgets> | 737 | </customwidgets> |
690 | <images> | 738 | <images> |
691 | <image> | 739 | <image> |
692 | <name>image0</name> | 740 | <name>image0</name> |
693 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | 741 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> |
694 | </image> | 742 | </image> |
695 | </images> | 743 | </images> |
696 | <connections> | 744 | <connections> |
697 | <connection> | 745 | <connection> |
698 | <sender>chkAlarmPreset</sender> | 746 | <sender>chkAlarmPreset</sender> |
699 | <signal>toggled(bool)</signal> | 747 | <signal>toggled(bool)</signal> |
700 | <receiver>spinPreset</receiver> | 748 | <receiver>spinPreset</receiver> |
701 | <slot>setEnabled(bool)</slot> | 749 | <slot>setEnabled(bool)</slot> |
702 | </connection> | 750 | </connection> |
703 | <connection> | 751 | <connection> |
704 | <sender>spinStart</sender> | 752 | <sender>spinStart</sender> |
705 | <signal>valueChanged(int)</signal> | 753 | <signal>valueChanged(int)</signal> |
706 | <receiver>DateBookSettingsBase</receiver> | 754 | <receiver>DateBookSettingsBase</receiver> |
707 | <slot>slot12Hour( int )</slot> | 755 | <slot>slot12Hour( int )</slot> |
708 | </connection> | 756 | </connection> |
709 | <slot access="public">slotChangeClock( bool )</slot> | 757 | <connection> |
758 | <sender>m_PluginListView</sender> | ||
759 | <signal>clicked(QListViewItem*)</signal> | ||
760 | <receiver>DateBookSettingsBase</receiver> | ||
761 | <slot>pluginItemClicked(QListViewItem *)</slot> | ||
762 | </connection> | ||
763 | <slot access="protected">pluginItemClicked(QListViewItem *)</slot> | ||
710 | <slot access="public">slot12Hour( int )</slot> | 764 | <slot access="public">slot12Hour( int )</slot> |
765 | <slot access="public">slotChangeClock( bool )</slot> | ||
711 | </connections> | 766 | </connections> |
712 | </UI> | 767 | </UI> |
diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h index f944e84..2966814 100644 --- a/core/pim/datebook/datebooktypes.h +++ b/core/pim/datebook/datebooktypes.h | |||
@@ -1,63 +1,70 @@ | |||
1 | #ifndef _DATEBOOK_TYPES_H | 1 | #ifndef _DATEBOOK_TYPES_H |
2 | #define _DATEBOOK_TYPES_H | 2 | #define _DATEBOOK_TYPES_H |
3 | 3 | ||
4 | #include <qpe/datebookdb.h> | 4 | #include <qpe/datebookdb.h> |
5 | 5 | ||
6 | #include <qvaluelist.h> | 6 | #include <qvaluelist.h> |
7 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
8 | 8 | ||
9 | namespace Opie { | 9 | namespace Opie { |
10 | namespace Datebook { | 10 | namespace Datebook { |
11 | class HolidayPlugin; | 11 | class HolidayPlugin; |
12 | class HolidayPluginIf; | 12 | class HolidayPluginIf; |
13 | } | 13 | } |
14 | namespace Core { | 14 | namespace Core { |
15 | class OPluginLoader; | 15 | class OPluginLoader; |
16 | class OPluginManager; | ||
16 | } | 17 | } |
17 | } | 18 | } |
18 | 19 | ||
19 | class QLibrary; | 20 | class QLibrary; |
20 | 21 | ||
21 | class DateBookDBHack : virtual public DateBookDB { | 22 | class DateBookDBHack : virtual public DateBookDB { |
22 | public: | 23 | public: |
23 | virtual ~DateBookDBHack(){} | 24 | virtual ~DateBookDBHack(){} |
24 | Event eventByUID(int id); | 25 | Event eventByUID(int id); |
25 | }; | 26 | }; |
26 | 27 | ||
27 | class DateBookHoliday | 28 | class DateBookHoliday |
28 | { | 29 | { |
29 | public: | 30 | public: |
30 | DateBookHoliday(); | 31 | DateBookHoliday(); |
31 | virtual ~DateBookHoliday(); | 32 | virtual ~DateBookHoliday(); |
32 | 33 | ||
33 | QStringList holidaylist(const QDate&); | 34 | QStringList holidaylist(const QDate&); |
34 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); | 35 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); |
35 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | 36 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); |
36 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | 37 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); |
37 | 38 | ||
39 | void reloadPlugins(); | ||
40 | |||
41 | Opie::Core::OPluginLoader*pluginLoader(){return m_pluginLoader;} | ||
42 | Opie::Core::OPluginManager*pluginManager(){return m_pluginManager;} | ||
43 | |||
38 | protected: | 44 | protected: |
39 | void init(); | 45 | void init(); |
40 | void deinit(); | 46 | void deinit(); |
41 | 47 | ||
42 | struct HPlugin { | 48 | struct HPlugin { |
43 | Opie::Datebook::HolidayPlugin*_plugin; | 49 | Opie::Datebook::HolidayPlugin*_plugin; |
44 | //QLibrary*_lib; | 50 | //QLibrary*_lib; |
45 | //Opie::Datebook::HolidayPluginIf*_if; | 51 | //Opie::Datebook::HolidayPluginIf*_if; |
46 | }; | 52 | }; |
47 | QValueList<HPlugin*>_pluginlist; | 53 | QValueList<HPlugin*>_pluginlist; |
48 | Opie::Core::OPluginLoader*m_pluginLoader; | 54 | Opie::Core::OPluginLoader*m_pluginLoader; |
55 | Opie::Core::OPluginManager*m_pluginManager; | ||
49 | }; | 56 | }; |
50 | 57 | ||
51 | class DateBookDBHoliday:virtual public DateBookDBHack { | 58 | class DateBookDBHoliday:virtual public DateBookDBHack { |
52 | public: | 59 | public: |
53 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} | 60 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} |
54 | virtual ~DateBookDBHoliday(){} | 61 | virtual ~DateBookDBHoliday(){} |
55 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | 62 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); |
56 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | 63 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); |
57 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ); | 64 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ); |
58 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start); | 65 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start); |
59 | 66 | ||
60 | DateBookHoliday*db_holiday; | 67 | DateBookHoliday*db_holiday; |
61 | }; | 68 | }; |
62 | 69 | ||
63 | #endif | 70 | #endif |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index b0e78f1..3c871ea 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -1,437 +1,442 @@ | |||
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 | #include "datebooktypes.h" |
6 | 6 | ||
7 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
8 | 8 | ||
9 | #include <qpe/datebookmonth.h> | 9 | #include <qpe/datebookmonth.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qpe/ir.h> | 11 | #include <qpe/ir.h> |
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | 13 | ||
14 | #include <qlayout.h> | 14 | #include <qlayout.h> |
15 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
16 | #include <qtl.h> | 16 | #include <qtl.h> |
17 | 17 | ||
18 | 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); |
19 | 19 | ||
20 | using namespace Opie::Ui; | 20 | using namespace Opie::Ui; |
21 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) | 21 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) |
22 | : DateBookWeekLstHeaderBase(parent, name, fl) | 22 | : DateBookWeekLstHeaderBase(parent, name, fl) |
23 | { | 23 | { |
24 | setBackgroundMode( PaletteButton ); | 24 | setBackgroundMode( PaletteButton ); |
25 | labelDate->setBackgroundMode( PaletteButton ); | 25 | labelDate->setBackgroundMode( PaletteButton ); |
26 | forwardweek->setBackgroundMode( PaletteButton ); | 26 | forwardweek->setBackgroundMode( PaletteButton ); |
27 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | 27 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); |
28 | forwardmonth->setBackgroundMode( PaletteButton ); | 28 | forwardmonth->setBackgroundMode( PaletteButton ); |
29 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | 29 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); |
30 | backweek->setBackgroundMode( PaletteButton ); | 30 | backweek->setBackgroundMode( PaletteButton ); |
31 | backweek->setPixmap( Resource::loadPixmap("back") ); | 31 | backweek->setPixmap( Resource::loadPixmap("back") ); |
32 | backmonth->setBackgroundMode( PaletteButton ); | 32 | backmonth->setBackgroundMode( PaletteButton ); |
33 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | 33 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); |
34 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | 34 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); |
35 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | 35 | DateBookWeekLstHeaderBaseLayout->setMargin(0); |
36 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | 36 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); |
37 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 37 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
38 | 38 | ||
39 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); | 39 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); |
40 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); | 40 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); |
41 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); | 41 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); |
42 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); | 42 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); |
43 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); | 43 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); |
44 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 44 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
45 | bStartOnMonday=onM; | 45 | bStartOnMonday=onM; |
46 | } | 46 | } |
47 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 47 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
48 | 48 | ||
49 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 49 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
50 | int year,week,dayofweek; | 50 | int year,week,dayofweek; |
51 | date=d; | 51 | date=d; |
52 | dayofweek=d.dayOfWeek(); | 52 | dayofweek=d.dayOfWeek(); |
53 | if(bStartOnMonday) | 53 | if(bStartOnMonday) |
54 | dayofweek--; | 54 | dayofweek--; |
55 | else if( dayofweek == 7 ) | 55 | else if( dayofweek == 7 ) |
56 | /* 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 */ |
57 | dayofweek = 0; | 57 | dayofweek = 0; |
58 | 58 | ||
59 | date=date.addDays(-dayofweek); | 59 | date=date.addDays(-dayofweek); |
60 | 60 | ||
61 | calcWeek(date,week,year,bStartOnMonday); | 61 | calcWeek(date,week,year,bStartOnMonday); |
62 | QDate start=date; | 62 | QDate start=date; |
63 | QDate stop=start.addDays(6); | 63 | QDate stop=start.addDays(6); |
64 | labelDate->setText( QString::number(start.day()) + "." + | 64 | labelDate->setText( QString::number(start.day()) + "." + |
65 | Calendar::nameOfMonth( start.month() ) + "-" + | 65 | Calendar::nameOfMonth( start.month() ) + "-" + |
66 | QString::number(stop.day()) + "." + | 66 | QString::number(stop.day()) + "." + |
67 | Calendar::nameOfMonth( stop.month()) +" ("+ | 67 | Calendar::nameOfMonth( stop.month()) +" ("+ |
68 | tr("w")+":"+QString::number( week ) +")"); | 68 | tr("w")+":"+QString::number( week ) +")"); |
69 | 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! |
70 | emit dateChanged(date); | 70 | emit dateChanged(date); |
71 | } | 71 | } |
72 | 72 | ||
73 | void DateBookWeekLstHeader::pickDate() { | 73 | void DateBookWeekLstHeader::pickDate() { |
74 | static QPopupMenu *m1 = 0; | 74 | static QPopupMenu *m1 = 0; |
75 | static DateBookMonth *picker = 0; | 75 | static DateBookMonth *picker = 0; |
76 | if ( !m1 ) { | 76 | if ( !m1 ) { |
77 | m1 = new QPopupMenu( this ); | 77 | m1 = new QPopupMenu( this ); |
78 | picker = new DateBookMonth( m1, 0, TRUE ); | 78 | picker = new DateBookMonth( m1, 0, TRUE ); |
79 | m1->insertItem( picker ); | 79 | m1->insertItem( picker ); |
80 | 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) ) ); |
81 | //connect( m1, SIGNAL( aboutToHide() ), | 81 | //connect( m1, SIGNAL( aboutToHide() ), |
82 | //this, SLOT( gotHide() ) ); | 82 | //this, SLOT( gotHide() ) ); |
83 | } | 83 | } |
84 | picker->setDate( date.year(), date.month(), date.day() ); | 84 | picker->setDate( date.year(), date.month(), date.day() ); |
85 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 85 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
86 | picker->setFocus(); | 86 | picker->setFocus(); |
87 | } | 87 | } |
88 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 88 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
89 | setDate(QDate(y,m,d)); | 89 | setDate(QDate(y,m,d)); |
90 | } | 90 | } |
91 | 91 | ||
92 | void DateBookWeekLstHeader::nextWeek() { | 92 | void DateBookWeekLstHeader::nextWeek() { |
93 | setDate(date.addDays(7)); | 93 | setDate(date.addDays(7)); |
94 | } | 94 | } |
95 | void DateBookWeekLstHeader::prevWeek() { | 95 | void DateBookWeekLstHeader::prevWeek() { |
96 | setDate(date.addDays(-7)); | 96 | setDate(date.addDays(-7)); |
97 | } | 97 | } |
98 | void DateBookWeekLstHeader::nextMonth() | 98 | void DateBookWeekLstHeader::nextMonth() |
99 | { | 99 | { |
100 | setDate(date.addDays(28)); | 100 | setDate(date.addDays(28)); |
101 | } | 101 | } |
102 | void DateBookWeekLstHeader::prevMonth() | 102 | void DateBookWeekLstHeader::prevMonth() |
103 | { | 103 | { |
104 | setDate(date.addDays(-28)); | 104 | setDate(date.addDays(-28)); |
105 | } | 105 | } |
106 | 106 | ||
107 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | 107 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, |
108 | QWidget* parent, | 108 | QWidget* parent, |
109 | const char* name, | 109 | const char* name, |
110 | WFlags fl ) | 110 | WFlags fl ) |
111 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 111 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
112 | 112 | ||
113 | date=d; | 113 | date=d; |
114 | 114 | ||
115 | static const QString wdays=tr("MTWTFSSM", "Week days"); | 115 | static const QString wdays=tr("MTWTFSSM", "Week days"); |
116 | char day=wdays[d.dayOfWeek()-1]; | 116 | char day=wdays[d.dayOfWeek()-1]; |
117 | 117 | ||
118 | //dont use dayOfWeek() to save space ! | 118 | //dont use dayOfWeek() to save space ! |
119 | 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()) ); |
120 | 120 | ||
121 | add->setText("+"); | 121 | add->setText("+"); |
122 | 122 | ||
123 | if (d == QDate::currentDate()) { | 123 | if (d == QDate::currentDate()) { |
124 | QPalette pal=label->palette(); | 124 | QPalette pal=label->palette(); |
125 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | 125 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); |
126 | label->setPalette(pal); | 126 | label->setPalette(pal); |
127 | 127 | ||
128 | /* | 128 | /* |
129 | QFont f=label->font(); | 129 | QFont f=label->font(); |
130 | f.setItalic(true); | 130 | f.setItalic(true); |
131 | label->setFont(f); | 131 | label->setFont(f); |
132 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | 132 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); |
133 | */ | 133 | */ |
134 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 134 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
135 | QPalette pal=label->palette(); | 135 | QPalette pal=label->palette(); |
136 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 136 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
137 | label->setPalette(pal); | 137 | label->setPalette(pal); |
138 | } | 138 | } |
139 | 139 | ||
140 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 140 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
141 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 141 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
142 | } | 142 | } |
143 | 143 | ||
144 | void DateBookWeekLstDayHdr::showDay() { | 144 | void DateBookWeekLstDayHdr::showDay() { |
145 | emit showDate(date.year(), date.month(), date.day()); | 145 | emit showDate(date.year(), date.month(), date.day()); |
146 | } | 146 | } |
147 | 147 | ||
148 | void DateBookWeekLstDayHdr::newEvent() { | 148 | void DateBookWeekLstDayHdr::newEvent() { |
149 | QDateTime start, stop; | 149 | QDateTime start, stop; |
150 | start=stop=date; | 150 | start=stop=date; |
151 | start.setTime(QTime(10,0)); | 151 | start.setTime(QTime(10,0)); |
152 | stop.setTime(QTime(12,0)); | 152 | stop.setTime(QTime(12,0)); |
153 | 153 | ||
154 | emit addEvent(start,stop,"",0); | 154 | emit addEvent(start,stop,"",0); |
155 | } | 155 | } |
156 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 156 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
157 | int weeklistviewconfig, | 157 | int weeklistviewconfig, |
158 | QWidget* parent, | 158 | QWidget* parent, |
159 | const char* name, | 159 | const char* name, |
160 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | 160 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) |
161 | { | 161 | { |
162 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | 162 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
163 | QString s,start,middle,end,day; | 163 | QString s,start,middle,end,day; |
164 | 164 | ||
165 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; | 165 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; |
166 | if(weeklistviewconfig==NONE) { // No times displayed. | 166 | if(weeklistviewconfig==NONE) { // No times displayed. |
167 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 167 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
168 | // middle.sprintf("<--->"); | 168 | // middle.sprintf("<--->"); |
169 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 169 | // end.sprintf("-%.2d:%.2d",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 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
171 | } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. | 171 | } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. |
172 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 172 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
173 | middle.sprintf(" |---"); | 173 | middle.sprintf(" |---"); |
174 | end.sprintf("__|__"); | 174 | end.sprintf("__|__"); |
175 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 175 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
176 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | 176 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. |
177 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 177 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
178 | middle.sprintf("<--->"); | 178 | middle.sprintf("<--->"); |
179 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 179 | end.sprintf("-%.2d:%.2d",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 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
181 | } | 181 | } |
182 | 182 | ||
183 | if(ev.event().type() == Event::Normal) { | 183 | if(ev.event().type() == Event::Normal) { |
184 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event. | 184 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event. |
185 | s=day; | 185 | s=day; |
186 | } else if(ev.startDate()==ev.date()) { // start event. | 186 | } else if(ev.startDate()==ev.date()) { // start event. |
187 | s=start; | 187 | s=start; |
188 | } else if(ev.endDate()==ev.date()) { // end event. | 188 | } else if(ev.endDate()==ev.date()) { // end event. |
189 | s=end; | 189 | s=end; |
190 | } else { // middle day. | 190 | } else { // middle day. |
191 | s=middle; | 191 | s=middle; |
192 | } | 192 | } |
193 | } else { | 193 | } else { |
194 | s=""; | 194 | s=""; |
195 | } | 195 | } |
196 | setText(QString(s) + " " + ev.description()); | 196 | setText(QString(s) + " " + ev.description()); |
197 | // connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 197 | // connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
198 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 198 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
199 | } | 199 | } |
200 | void DateBookWeekLstEvent::editMe() { | 200 | void DateBookWeekLstEvent::editMe() { |
201 | emit editEvent(event.event()); | 201 | emit editEvent(event.event()); |
202 | } | 202 | } |
203 | void DateBookWeekLstEvent::duplicateMe() | 203 | void DateBookWeekLstEvent::duplicateMe() |
204 | { | 204 | { |
205 | emit duplicateEvent(event.event()); | 205 | emit duplicateEvent(event.event()); |
206 | } | 206 | } |
207 | void DateBookWeekLstEvent::deleteMe() | 207 | void DateBookWeekLstEvent::deleteMe() |
208 | { | 208 | { |
209 | emit removeEvent(event.event()); | 209 | emit removeEvent(event.event()); |
210 | emit redraw(); | 210 | emit redraw(); |
211 | } | 211 | } |
212 | void DateBookWeekLstEvent::beamMe() | 212 | void DateBookWeekLstEvent::beamMe() |
213 | { | 213 | { |
214 | emit beamEvent( event.event() ); | 214 | emit beamEvent( event.event() ); |
215 | } | 215 | } |
216 | void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | 216 | void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) |
217 | { | 217 | { |
218 | if (!event.event().isValidUid()) { | ||
219 | // this is just such a holiday event. | ||
220 | return; | ||
221 | } | ||
218 | popmenue = new QPopupMenu; | 222 | popmenue = new QPopupMenu; |
223 | |||
219 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); | 224 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); |
220 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); | 225 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); |
221 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); | 226 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); |
222 | if(Ir::supported()) | 227 | if(Ir::supported()) |
223 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); | 228 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); |
224 | popmenue->popup( mapToGlobal( e->pos() )); | 229 | popmenue->popup( mapToGlobal( e->pos() )); |
225 | } | 230 | } |
226 | 231 | ||
227 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 232 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
228 | const QDate &d, bool onM, | 233 | const QDate &d, bool onM, |
229 | QWidget* parent, | 234 | QWidget* parent, |
230 | const char* name, WFlags fl) | 235 | const char* name, WFlags fl) |
231 | : QWidget( parent, name, fl ) | 236 | : QWidget( parent, name, fl ) |
232 | { | 237 | { |
233 | Config config("DateBook"); | 238 | Config config("DateBook"); |
234 | config.setGroup("Main"); | 239 | config.setGroup("Main"); |
235 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); | 240 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); |
236 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; | 241 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; |
237 | 242 | ||
238 | bStartOnMonday=onM; | 243 | bStartOnMonday=onM; |
239 | setPalette(white); | 244 | setPalette(white); |
240 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 245 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
241 | 246 | ||
242 | QVBoxLayout *layout = new QVBoxLayout( this ); | 247 | QVBoxLayout *layout = new QVBoxLayout( this ); |
243 | 248 | ||
244 | qBubbleSort(ev); | 249 | qBubbleSort(ev); |
245 | QValueListIterator<EffectiveEvent> it; | 250 | QValueListIterator<EffectiveEvent> it; |
246 | it=ev.begin(); | 251 | it=ev.begin(); |
247 | 252 | ||
248 | int dayOrder[7]; | 253 | int dayOrder[7]; |
249 | if (bStartOnMonday) { | 254 | if (bStartOnMonday) { |
250 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 255 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
251 | } else { | 256 | } else { |
252 | for (int d=0; d<7; d++) dayOrder[d]=d; | 257 | for (int d=0; d<7; d++) dayOrder[d]=d; |
253 | dayOrder[0]=7; | 258 | dayOrder[0]=7; |
254 | } | 259 | } |
255 | 260 | ||
256 | // Calculate offset to first day of week. | 261 | // Calculate offset to first day of week. |
257 | int dayoffset=d.dayOfWeek(); | 262 | int dayoffset=d.dayOfWeek(); |
258 | if(bStartOnMonday) dayoffset--; | 263 | if(bStartOnMonday) dayoffset--; |
259 | else if( dayoffset == 7 ) dayoffset = 0; | 264 | else if( dayoffset == 7 ) dayoffset = 0; |
260 | 265 | ||
261 | for (int i=0; i<7; i++) { | 266 | for (int i=0; i<7; i++) { |
262 | // Header | 267 | // Header |
263 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); | 268 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); |
264 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 269 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
265 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 270 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
266 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 271 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
267 | layout->addWidget(hdr); | 272 | layout->addWidget(hdr); |
268 | 273 | ||
269 | // Events | 274 | // Events |
270 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | 275 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { |
271 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. | 276 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. |
272 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); | 277 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); |
273 | layout->addWidget(l); | 278 | layout->addWidget(l); |
274 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 279 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
275 | connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 280 | connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
276 | connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 281 | connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
277 | connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 282 | connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
278 | connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); | 283 | connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); |
279 | } | 284 | } |
280 | it++; | 285 | it++; |
281 | } | 286 | } |
282 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 287 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
283 | } | 288 | } |
284 | } | 289 | } |
285 | DateBookWeekLstView::~DateBookWeekLstView(){} | 290 | DateBookWeekLstView::~DateBookWeekLstView(){} |
286 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | 291 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} |
287 | 292 | ||
288 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 293 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
289 | QValueList<EffectiveEvent> &ev2, | 294 | QValueList<EffectiveEvent> &ev2, |
290 | QDate &d, bool onM, | 295 | QDate &d, bool onM, |
291 | QWidget* parent, | 296 | QWidget* parent, |
292 | const char* name, WFlags fl) | 297 | const char* name, WFlags fl) |
293 | : QWidget( parent, name, fl ) | 298 | : QWidget( parent, name, fl ) |
294 | { | 299 | { |
295 | QHBoxLayout *layout = new QHBoxLayout( this ); | 300 | QHBoxLayout *layout = new QHBoxLayout( this ); |
296 | 301 | ||
297 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | 302 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); |
298 | layout->addWidget(w); | 303 | layout->addWidget(w); |
299 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 304 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
300 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 305 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
301 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 306 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
302 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 307 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
303 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | 308 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); |
304 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 309 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
305 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 310 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
306 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 311 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
307 | 312 | ||
308 | 313 | ||
309 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | 314 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); |
310 | layout->addWidget(w); | 315 | layout->addWidget(w); |
311 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 316 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
312 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 317 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
313 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 318 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
314 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 319 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
315 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | 320 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); |
316 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 321 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
317 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 322 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
318 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 323 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
319 | } | 324 | } |
320 | 325 | ||
321 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, | 326 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, |
322 | QWidget *parent, | 327 | QWidget *parent, |
323 | const char *name ) | 328 | const char *name ) |
324 | : QWidget( parent, name ), | 329 | : QWidget( parent, name ), |
325 | db( newDB ), | 330 | db( newDB ), |
326 | startTime( 0 ), | 331 | startTime( 0 ), |
327 | ampm( ap ), | 332 | ampm( ap ), |
328 | bStartOnMonday(onM) | 333 | bStartOnMonday(onM) |
329 | { | 334 | { |
330 | setFocusPolicy(StrongFocus); | 335 | setFocusPolicy(StrongFocus); |
331 | layout = new QVBoxLayout( this ); | 336 | layout = new QVBoxLayout( this ); |
332 | layout->setMargin(0); | 337 | layout->setMargin(0); |
333 | 338 | ||
334 | header=new DateBookWeekLstHeader(onM, this); | 339 | header=new DateBookWeekLstHeader(onM, this); |
335 | layout->addWidget( header ); | 340 | layout->addWidget( header ); |
336 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); | 341 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); |
337 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); | 342 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); |
338 | 343 | ||
339 | scroll=new QScrollView(this); | 344 | scroll=new QScrollView(this); |
340 | scroll->setResizePolicy(QScrollView::AutoOneFit); | 345 | scroll->setResizePolicy(QScrollView::AutoOneFit); |
341 | layout->addWidget(scroll); | 346 | layout->addWidget(scroll); |
342 | 347 | ||
343 | view=NULL; | 348 | view=NULL; |
344 | Config config("DateBook"); | 349 | Config config("DateBook"); |
345 | config.setGroup("Main"); | 350 | config.setGroup("Main"); |
346 | dbl=config.readBoolEntry("weeklst_dbl", false); | 351 | dbl=config.readBoolEntry("weeklst_dbl", false); |
347 | header->dbl->setOn(dbl); | 352 | header->dbl->setOn(dbl); |
348 | } | 353 | } |
349 | DateBookWeekLst::~DateBookWeekLst(){ | 354 | DateBookWeekLst::~DateBookWeekLst(){ |
350 | Config config("DateBook"); | 355 | Config config("DateBook"); |
351 | config.setGroup("Main"); | 356 | config.setGroup("Main"); |
352 | config.writeEntry("weeklst_dbl", dbl); | 357 | config.writeEntry("weeklst_dbl", dbl); |
353 | } | 358 | } |
354 | 359 | ||
355 | void DateBookWeekLst::setDate(const QDate &d) { | 360 | void DateBookWeekLst::setDate(const QDate &d) { |
356 | bdate=d; | 361 | bdate=d; |
357 | header->setDate(d); | 362 | header->setDate(d); |
358 | } | 363 | } |
359 | 364 | ||
360 | void DateBookWeekLst::setDbl(bool on) { | 365 | void DateBookWeekLst::setDbl(bool on) { |
361 | dbl=on; | 366 | dbl=on; |
362 | redraw(); | 367 | redraw(); |
363 | } | 368 | } |
364 | void DateBookWeekLst::redraw() {getEvents();} | 369 | void DateBookWeekLst::redraw() {getEvents();} |
365 | 370 | ||
366 | QDate DateBookWeekLst::date() { | 371 | QDate DateBookWeekLst::date() { |
367 | return bdate; | 372 | return bdate; |
368 | } | 373 | } |
369 | 374 | ||
370 | // return the date at the beginning of the week... | 375 | // return the date at the beginning of the week... |
371 | // copied from DateBookWeek | 376 | // copied from DateBookWeek |
372 | QDate DateBookWeekLst::weekDate() const | 377 | QDate DateBookWeekLst::weekDate() const |
373 | { | 378 | { |
374 | QDate d=bdate; | 379 | QDate d=bdate; |
375 | 380 | ||
376 | // Calculate offset to first day of week. | 381 | // Calculate offset to first day of week. |
377 | int dayoffset=d.dayOfWeek(); | 382 | int dayoffset=d.dayOfWeek(); |
378 | if(bStartOnMonday) dayoffset--; | 383 | if(bStartOnMonday) dayoffset--; |
379 | else if( dayoffset == 7 ) | 384 | else if( dayoffset == 7 ) |
380 | dayoffset = 0; | 385 | dayoffset = 0; |
381 | 386 | ||
382 | return d.addDays(-dayoffset); | 387 | return d.addDays(-dayoffset); |
383 | } | 388 | } |
384 | 389 | ||
385 | void DateBookWeekLst::getEvents() { | 390 | void DateBookWeekLst::getEvents() { |
386 | QDate start = weekDate(); //date(); | 391 | QDate start = weekDate(); //date(); |
387 | QDate stop = start.addDays(6); | 392 | QDate stop = start.addDays(6); |
388 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); | 393 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); |
389 | 394 | ||
390 | if (view) delete view; | 395 | if (view) delete view; |
391 | if (dbl) { | 396 | if (dbl) { |
392 | QDate start2=start.addDays(7); | 397 | QDate start2=start.addDays(7); |
393 | stop=start2.addDays(6); | 398 | stop=start2.addDays(6); |
394 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); | 399 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); |
395 | view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); | 400 | view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); |
396 | } else { | 401 | } else { |
397 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); | 402 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); |
398 | } | 403 | } |
399 | 404 | ||
400 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 405 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
401 | connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 406 | connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); |
402 | connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 407 | connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); |
403 | connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 408 | connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); |
404 | connect (view, SIGNAL(redraw()), this, SLOT(redraw())); | 409 | connect (view, SIGNAL(redraw()), this, SLOT(redraw())); |
405 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 410 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
406 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 411 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
407 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 412 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
408 | 413 | ||
409 | scroll->addChild(view); | 414 | scroll->addChild(view); |
410 | view->show(); | 415 | view->show(); |
411 | scroll->updateScrollBars(); | 416 | scroll->updateScrollBars(); |
412 | } | 417 | } |
413 | 418 | ||
414 | void DateBookWeekLst::dateChanged(QDate &newdate) { | 419 | void DateBookWeekLst::dateChanged(QDate &newdate) { |
415 | bdate=newdate; | 420 | bdate=newdate; |
416 | getEvents(); | 421 | getEvents(); |
417 | } | 422 | } |
418 | 423 | ||
419 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) | 424 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) |
420 | { | 425 | { |
421 | switch(e->key()) { | 426 | switch(e->key()) { |
422 | case Key_Up: | 427 | case Key_Up: |
423 | scroll->scrollBy(0, -20); | 428 | scroll->scrollBy(0, -20); |
424 | break; | 429 | break; |
425 | case Key_Down: | 430 | case Key_Down: |
426 | scroll->scrollBy(0, 20); | 431 | scroll->scrollBy(0, 20); |
427 | break; | 432 | break; |
428 | case Key_Left: | 433 | case Key_Left: |
429 | header->prevWeek(); | 434 | header->prevWeek(); |
430 | break; | 435 | break; |
431 | case Key_Right: | 436 | case Key_Right: |
432 | header->nextWeek(); | 437 | header->nextWeek(); |
433 | break; | 438 | break; |
434 | default: | 439 | default: |
435 | e->ignore(); | 440 | e->ignore(); |
436 | } | 441 | } |
437 | } | 442 | } |