-rw-r--r-- | korganizer/calendarview.cpp | 21 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 |
2 files changed, 21 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3ab4bb4..a76f2ed 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -117,513 +117,513 @@ | |||
117 | #include "navigatorbar.h" | 117 | #include "navigatorbar.h" |
118 | #include "searchdialog.h" | 118 | #include "searchdialog.h" |
119 | #include "mainwindow.h" | 119 | #include "mainwindow.h" |
120 | #include "categoryeditdialog.h" | 120 | #include "categoryeditdialog.h" |
121 | 121 | ||
122 | #include "calendarview.h" | 122 | #include "calendarview.h" |
123 | #ifndef DESKTOP_VERSION | 123 | #ifndef DESKTOP_VERSION |
124 | #include <qtopia/alarmserver.h> | 124 | #include <qtopia/alarmserver.h> |
125 | #endif | 125 | #endif |
126 | #ifndef _WIN32_ | 126 | #ifndef _WIN32_ |
127 | #include <stdlib.h> | 127 | #include <stdlib.h> |
128 | #include <stdio.h> | 128 | #include <stdio.h> |
129 | #include <unistd.h> | 129 | #include <unistd.h> |
130 | #else | 130 | #else |
131 | #include <qprocess.h> | 131 | #include <qprocess.h> |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | #ifdef DESKTOP_VERSION | 134 | #ifdef DESKTOP_VERSION |
135 | #include <kabc/stdaddressbook.h> | 135 | #include <kabc/stdaddressbook.h> |
136 | #endif | 136 | #endif |
137 | using namespace KOrg; | 137 | using namespace KOrg; |
138 | using namespace KCal; | 138 | using namespace KCal; |
139 | extern int globalFlagBlockAgenda; | 139 | extern int globalFlagBlockAgenda; |
140 | extern int globalFlagBlockStartup; | 140 | extern int globalFlagBlockStartup; |
141 | 141 | ||
142 | 142 | ||
143 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) | 143 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) |
144 | 144 | ||
145 | { | 145 | { |
146 | mAlarms = alarms; | 146 | mAlarms = alarms; |
147 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); | 147 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); |
148 | QString mText = "<table width=\"100%\">\n"; | 148 | QString mText = "<table width=\"100%\">\n"; |
149 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 149 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
150 | #ifdef DESKTOP_VERSION | 150 | #ifdef DESKTOP_VERSION |
151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
152 | #else | 152 | #else |
153 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; | 153 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; |
154 | #endif | 154 | #endif |
155 | // mText += "<img src=\""; | 155 | // mText += "<img src=\""; |
156 | // mText += ipath; | 156 | // mText += ipath; |
157 | // mText += "\">"; | 157 | // mText += "\">"; |
158 | //mEventDate = QDate::currentDate(); | 158 | //mEventDate = QDate::currentDate(); |
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; | 160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; |
161 | #else | 161 | #else |
162 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; | 162 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; |
163 | #endif | 163 | #endif |
164 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 164 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
165 | 165 | ||
166 | Incidence * inc = getNextInc( start ); | 166 | Incidence * inc = getNextInc( start ); |
167 | int time = 0; | 167 | int time = 0; |
168 | //mText += "<table>"; | 168 | //mText += "<table>"; |
169 | while ( inc ) { | 169 | while ( inc ) { |
170 | QDateTime dt ; | 170 | QDateTime dt ; |
171 | QString tempText = "<a "; | 171 | QString tempText = "<a "; |
172 | bool ok; | 172 | bool ok; |
173 | dt = inc->getNextOccurence( start, &ok ); | 173 | dt = inc->getNextOccurence( start, &ok ); |
174 | if ( !ok ) continue; | 174 | if ( !ok ) continue; |
175 | if ( inc->typeID() == eventID ) { | 175 | if ( inc->typeID() == eventID ) { |
176 | tempText += "href=\"event:"; | 176 | tempText += "href=\"event:"; |
177 | } else if ( inc->typeID() == todoID ) { | 177 | } else if ( inc->typeID() == todoID ) { |
178 | tempText += "href=\"todo:"; | 178 | tempText += "href=\"todo:"; |
179 | } | 179 | } |
180 | tempText += inc->uid() + "\">"; | 180 | tempText += inc->uid() + "\">"; |
181 | if ( inc->typeID() == todoID ) | 181 | if ( inc->typeID() == todoID ) |
182 | tempText += i18n("Todo: "); | 182 | tempText += i18n("Todo: "); |
183 | if ( inc->summary().length() > 0 ) | 183 | if ( inc->summary().length() > 0 ) |
184 | tempText += inc->summary(); | 184 | tempText += inc->summary(); |
185 | else | 185 | else |
186 | tempText += i18n("-no summary-"); | 186 | tempText += i18n("-no summary-"); |
187 | QString timestr; | 187 | QString timestr; |
188 | if (!inc->doesFloat()) | 188 | if (!inc->doesFloat()) |
189 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; | 189 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; |
190 | else | 190 | else |
191 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 191 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
192 | if ( dt.date() < QDate::currentDate() && time == 0 ) { | 192 | if ( dt.date() < QDate::currentDate() && time == 0 ) { |
193 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 193 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
194 | mText += "<table>"; | 194 | mText += "<table>"; |
195 | time = 1; | 195 | time = 1; |
196 | } | 196 | } |
197 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { | 197 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { |
198 | if ( time > 0 ) | 198 | if ( time > 0 ) |
199 | mText +="</table>"; | 199 | mText +="</table>"; |
200 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; | 200 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; |
201 | mText += "<table>"; | 201 | mText += "<table>"; |
202 | time = 2; | 202 | time = 2; |
203 | 203 | ||
204 | } | 204 | } |
205 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { | 205 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { |
206 | if ( time > 0 ) | 206 | if ( time > 0 ) |
207 | mText +="</table>"; | 207 | mText +="</table>"; |
208 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; | 208 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; |
209 | mText += "<table>"; | 209 | mText += "<table>"; |
210 | time = 3; | 210 | time = 3; |
211 | } | 211 | } |
212 | mText +="<tr><td><b>"; | 212 | mText +="<tr><td><b>"; |
213 | mText += timestr; | 213 | mText += timestr; |
214 | mText += "</b></td><td>"; | 214 | mText += "</b></td><td>"; |
215 | mText += tempText; | 215 | mText += tempText; |
216 | mText += "</td></tr>\n"; | 216 | mText += "</td></tr>\n"; |
217 | inc = getNextInc( start ); | 217 | inc = getNextInc( start ); |
218 | } | 218 | } |
219 | mText +="</table>"; | 219 | mText +="</table>"; |
220 | setText( mText ); | 220 | setText( mText ); |
221 | } | 221 | } |
222 | 222 | ||
223 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() | 223 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() |
224 | { | 224 | { |
225 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); | 225 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); |
226 | } | 226 | } |
227 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) | 227 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) |
228 | { | 228 | { |
229 | QDateTime dt ; | 229 | QDateTime dt ; |
230 | Incidence * retInc; | 230 | Incidence * retInc; |
231 | Incidence * inc = mAlarms.first(); | 231 | Incidence * inc = mAlarms.first(); |
232 | if ( inc == 0 ) | 232 | if ( inc == 0 ) |
233 | return 0; | 233 | return 0; |
234 | bool ok; | 234 | bool ok; |
235 | dt = inc->getNextOccurence( start, &ok ); | 235 | dt = inc->getNextOccurence( start, &ok ); |
236 | if ( ! ok ) return 0; | 236 | if ( ! ok ) return 0; |
237 | QDateTime dtn ; | 237 | QDateTime dtn ; |
238 | retInc = inc; | 238 | retInc = inc; |
239 | inc = mAlarms.next(); | 239 | inc = mAlarms.next(); |
240 | while ( inc ) { | 240 | while ( inc ) { |
241 | dtn = inc->getNextOccurence( start, &ok ); | 241 | dtn = inc->getNextOccurence( start, &ok ); |
242 | if ( ! ok ) return 0; | 242 | if ( ! ok ) return 0; |
243 | if ( dtn < dt ) { | 243 | if ( dtn < dt ) { |
244 | dt = dtn; | 244 | dt = dtn; |
245 | retInc = inc; | 245 | retInc = inc; |
246 | } | 246 | } |
247 | inc = mAlarms.next(); | 247 | inc = mAlarms.next(); |
248 | } | 248 | } |
249 | mAlarms.remove( retInc ); | 249 | mAlarms.remove( retInc ); |
250 | return retInc; | 250 | return retInc; |
251 | 251 | ||
252 | } | 252 | } |
253 | void MissedAlarmTextBrowser::setSource(const QString & n) | 253 | void MissedAlarmTextBrowser::setSource(const QString & n) |
254 | { | 254 | { |
255 | if (n.startsWith("event:")) { | 255 | if (n.startsWith("event:")) { |
256 | #ifdef DESKTOP_VERSION | 256 | #ifdef DESKTOP_VERSION |
257 | emit showIncidence(n.mid(8)); | 257 | emit showIncidence(n.mid(8)); |
258 | #else | 258 | #else |
259 | emit showIncidence(n.mid(6)); | 259 | emit showIncidence(n.mid(6)); |
260 | #endif | 260 | #endif |
261 | return; | 261 | return; |
262 | } else if (n.startsWith("todo:")) { | 262 | } else if (n.startsWith("todo:")) { |
263 | #ifdef DESKTOP_VERSION | 263 | #ifdef DESKTOP_VERSION |
264 | emit showIncidence(n.mid(7)); | 264 | emit showIncidence(n.mid(7)); |
265 | #else | 265 | #else |
266 | emit showIncidence(n.mid(5)); | 266 | emit showIncidence(n.mid(5)); |
267 | #endif | 267 | #endif |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | class KOBeamPrefs : public QDialog | 273 | class KOBeamPrefs : public QDialog |
274 | { | 274 | { |
275 | public: | 275 | public: |
276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
277 | QDialog( parent, name, true ) | 277 | QDialog( parent, name, true ) |
278 | { | 278 | { |
279 | setCaption( i18n("Beam Options") ); | 279 | setCaption( i18n("Beam Options") ); |
280 | QVBoxLayout* lay = new QVBoxLayout( this ); | 280 | QVBoxLayout* lay = new QVBoxLayout( this ); |
281 | lay->setSpacing( 3 ); | 281 | lay->setSpacing( 3 ); |
282 | lay->setMargin( 3 ); | 282 | lay->setMargin( 3 ); |
283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
284 | lay->addWidget( format ); | 284 | lay->addWidget( format ); |
285 | format->setExclusive ( true ) ; | 285 | format->setExclusive ( true ) ; |
286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
287 | lay->addWidget( time ); time->setExclusive ( true ) ; | 287 | lay->addWidget( time ); time->setExclusive ( true ) ; |
288 | vcal = new QRadioButton(" vCalendar ", format ); | 288 | vcal = new QRadioButton(" vCalendar ", format ); |
289 | ical = new QRadioButton(" iCalendar ", format ); | 289 | ical = new QRadioButton(" iCalendar ", format ); |
290 | vcal->setChecked( true ); | 290 | vcal->setChecked( true ); |
291 | tz = new QRadioButton(i18n(" With timezone "), time ); | 291 | tz = new QRadioButton(i18n(" With timezone "), time ); |
292 | local = new QRadioButton(i18n(" Local time "), time ); | 292 | local = new QRadioButton(i18n(" Local time "), time ); |
293 | tz->setChecked( true ); | 293 | tz->setChecked( true ); |
294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
295 | lay->addWidget( ok ); | 295 | lay->addWidget( ok ); |
296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
297 | lay->addWidget( cancel ); | 297 | lay->addWidget( cancel ); |
298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
300 | resize( 200, 200 ); | 300 | resize( 200, 200 ); |
301 | } | 301 | } |
302 | 302 | ||
303 | bool beamVcal() { return vcal->isChecked(); } | 303 | bool beamVcal() { return vcal->isChecked(); } |
304 | bool beamLocal() { return local->isChecked(); } | 304 | bool beamLocal() { return local->isChecked(); } |
305 | private: | 305 | private: |
306 | QRadioButton* vcal, *ical, *local, *tz; | 306 | QRadioButton* vcal, *ical, *local, *tz; |
307 | }; | 307 | }; |
308 | class KOCatPrefs : public QDialog | 308 | class KOCatPrefs : public QDialog |
309 | { | 309 | { |
310 | public: | 310 | public: |
311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
312 | QDialog( parent, name, true ) | 312 | QDialog( parent, name, true ) |
313 | { | 313 | { |
314 | setCaption( i18n("Manage new Categories") ); | 314 | setCaption( i18n("Manage new Categories") ); |
315 | QVBoxLayout* lay = new QVBoxLayout( this ); | 315 | QVBoxLayout* lay = new QVBoxLayout( this ); |
316 | lay->setSpacing( 3 ); | 316 | lay->setSpacing( 3 ); |
317 | lay->setMargin( 3 ); | 317 | lay->setMargin( 3 ); |
318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); | 318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); |
319 | lay->addWidget( lab ); | 319 | lay->addWidget( lab ); |
320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
321 | lay->addWidget( format ); | 321 | lay->addWidget( format ); |
322 | format->setExclusive ( true ) ; | 322 | format->setExclusive ( true ) ; |
323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
325 | addCatBut->setChecked( true ); | 325 | addCatBut->setChecked( true ); |
326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
327 | lay->addWidget( ok ); | 327 | lay->addWidget( ok ); |
328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
329 | lay->addWidget( cancel ); | 329 | lay->addWidget( cancel ); |
330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
332 | resize( 200, 200 ); | 332 | resize( 200, 200 ); |
333 | } | 333 | } |
334 | 334 | ||
335 | bool addCat() { return addCatBut->isChecked(); } | 335 | bool addCat() { return addCatBut->isChecked(); } |
336 | private: | 336 | private: |
337 | QRadioButton* addCatBut; | 337 | QRadioButton* addCatBut; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | CalendarView::CalendarView( CalendarResources *calendar, | 342 | CalendarView::CalendarView( CalendarResources *calendar, |
343 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
344 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
345 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
346 | mResourceManager( calendar->resourceManager() ) | 346 | mResourceManager( calendar->resourceManager() ) |
347 | { | 347 | { |
348 | 348 | ||
349 | mEventEditor = 0; | 349 | mEventEditor = 0; |
350 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
351 | 351 | ||
352 | init(); | 352 | init(); |
353 | } | 353 | } |
354 | 354 | ||
355 | CalendarView::CalendarView( Calendar *calendar, | 355 | CalendarView::CalendarView( Calendar *calendar, |
356 | QWidget *parent, const char *name ) | 356 | QWidget *parent, const char *name ) |
357 | : CalendarViewBase( parent, name ), | 357 | : CalendarViewBase( parent, name ), |
358 | mCalendar( calendar ), | 358 | mCalendar( calendar ), |
359 | mResourceManager( 0 ) | 359 | mResourceManager( 0 ) |
360 | { | 360 | { |
361 | 361 | ||
362 | mEventEditor = 0; | 362 | mEventEditor = 0; |
363 | mTodoEditor = 0; | 363 | mTodoEditor = 0; |
364 | init(); | 364 | init(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void CalendarView::init() | 367 | void CalendarView::init() |
368 | { | 368 | { |
369 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 369 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
370 | setFocusPolicy (NoFocus ); | 370 | setFocusPolicy (NoFocus ); |
371 | mViewerCallerIsSearchDialog = false; | 371 | mViewerCallerIsSearchDialog = false; |
372 | mBlockShowDates = false; | 372 | mBlockShowDates = false; |
373 | 373 | mConflictingEvent = 0; | |
374 | mDatePickerMode = 0; | 374 | mDatePickerMode = 0; |
375 | mCurrentSyncDevice = ""; | 375 | mCurrentSyncDevice = ""; |
376 | mViewManager = new KOViewManager( this ); | 376 | mViewManager = new KOViewManager( this ); |
377 | mDialogManager = new KODialogManager( this ); | 377 | mDialogManager = new KODialogManager( this ); |
378 | mEventViewerDialog = 0; | 378 | mEventViewerDialog = 0; |
379 | mModified = false; | 379 | mModified = false; |
380 | mReadOnly = false; | 380 | mReadOnly = false; |
381 | mSelectedIncidence = 0; | 381 | mSelectedIncidence = 0; |
382 | mCalPrinter = 0; | 382 | mCalPrinter = 0; |
383 | mFilters.setAutoDelete(true); | 383 | mFilters.setAutoDelete(true); |
384 | 384 | ||
385 | mCalendar->registerObserver( this ); | 385 | mCalendar->registerObserver( this ); |
386 | // TODO: Make sure that view is updated, when calendar is changed. | 386 | // TODO: Make sure that view is updated, when calendar is changed. |
387 | 387 | ||
388 | mStorage = new FileStorage( mCalendar ); | 388 | mStorage = new FileStorage( mCalendar ); |
389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
390 | 390 | ||
391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
392 | #ifndef KORG_NOSPLITTER | 392 | #ifndef KORG_NOSPLITTER |
393 | // create the main layout frames. | 393 | // create the main layout frames. |
394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
395 | topLayout->addWidget(mPanner); | 395 | topLayout->addWidget(mPanner); |
396 | 396 | ||
397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
398 | "CalendarView::LeftFrame"); | 398 | "CalendarView::LeftFrame"); |
399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
400 | 400 | ||
401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
402 | "CalendarView::DateNavigator" ); | 402 | "CalendarView::DateNavigator" ); |
403 | 403 | ||
404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
406 | mTodoList->setNavigator( mNavigator ); | 406 | mTodoList->setNavigator( mNavigator ); |
407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
408 | 408 | ||
409 | #ifdef KORG_NORESOURCEVIEW | 409 | #ifdef KORG_NORESOURCEVIEW |
410 | mResourceView = 0; | 410 | mResourceView = 0; |
411 | #else | 411 | #else |
412 | if ( mResourceManager ) { | 412 | if ( mResourceManager ) { |
413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
414 | mResourceView->updateView(); | 414 | mResourceView->updateView(); |
415 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 415 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
416 | SLOT( updateView() ) ); | 416 | SLOT( updateView() ) ); |
417 | } else { | 417 | } else { |
418 | mResourceView = 0; | 418 | mResourceView = 0; |
419 | } | 419 | } |
420 | #endif | 420 | #endif |
421 | QWidget *rightBox = new QWidget( mPanner ); | 421 | QWidget *rightBox = new QWidget( mPanner ); |
422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
423 | 423 | ||
424 | mRightFrame = new QWidgetStack( rightBox ); | 424 | mRightFrame = new QWidgetStack( rightBox ); |
425 | rightLayout->addWidget( mRightFrame, 1 ); | 425 | rightLayout->addWidget( mRightFrame, 1 ); |
426 | 426 | ||
427 | mLeftFrame = mLeftSplitter; | 427 | mLeftFrame = mLeftSplitter; |
428 | #else | 428 | #else |
429 | //QWidget *mainBox = new QWidget( this ); | 429 | //QWidget *mainBox = new QWidget( this ); |
430 | //QWidget *leftFrame = new QWidget( mainBox ); | 430 | //QWidget *leftFrame = new QWidget( mainBox ); |
431 | //QBoxLayout * mainBoxLayout; | 431 | //QBoxLayout * mainBoxLayout; |
432 | if ( KOPrefs::instance()->mVerticalScreen ) { | 432 | if ( KOPrefs::instance()->mVerticalScreen ) { |
433 | //mainBoxLayout = new QVBoxLayout(mainBox); | 433 | //mainBoxLayout = new QVBoxLayout(mainBox); |
434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
439 | } else { | 439 | } else { |
440 | //mainBoxLayout = new QHBoxLayout(mainBox); | 440 | //mainBoxLayout = new QHBoxLayout(mainBox); |
441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
446 | } | 446 | } |
447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
448 | //QBoxLayout * leftFrameLayout; | 448 | //QBoxLayout * leftFrameLayout; |
449 | topLayout->addWidget( mMainFrame ); | 449 | topLayout->addWidget( mMainFrame ); |
450 | #ifdef DESKTOP_VERSION | 450 | #ifdef DESKTOP_VERSION |
451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); | 451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); |
452 | topLayout->addWidget( mDateScrollBar ); | 452 | topLayout->addWidget( mDateScrollBar ); |
453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); |
454 | if ( QApplication::desktop()->width() < 800 ) | 454 | if ( QApplication::desktop()->width() < 800 ) |
455 | mDateScrollBar->hide(); | 455 | mDateScrollBar->hide(); |
456 | #endif | 456 | #endif |
457 | //mainBoxLayout->addWidget (mLeftFrame); | 457 | //mainBoxLayout->addWidget (mLeftFrame); |
458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
459 | "CalendarView::DateNavigator" ); | 459 | "CalendarView::DateNavigator" ); |
460 | #if 0 | 460 | #if 0 |
461 | // FIXME | 461 | // FIXME |
462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
463 | "CalendarView::DateNavigator", QDate::currentDate()); | 463 | "CalendarView::DateNavigator", QDate::currentDate()); |
464 | #endif | 464 | #endif |
465 | // mDateNavigator->blockSignals( true ); | 465 | // mDateNavigator->blockSignals( true ); |
466 | //leftFrameLayout->addWidget( mDateNavigator ); | 466 | //leftFrameLayout->addWidget( mDateNavigator ); |
467 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 467 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
468 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 468 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
469 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 469 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
470 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 470 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
471 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 471 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
472 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); | 472 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); |
473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
474 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | 474 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); |
475 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 475 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
476 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 476 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
478 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); | 478 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); |
479 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 479 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
480 | 480 | ||
481 | mTodoList->setNavigator( mNavigator ); | 481 | mTodoList->setNavigator( mNavigator ); |
482 | #if 0 | 482 | #if 0 |
483 | if ( QApplication::desktop()->width() < 480 ) { | 483 | if ( QApplication::desktop()->width() < 480 ) { |
484 | leftFrameLayout->addWidget(mFilterView); | 484 | leftFrameLayout->addWidget(mFilterView); |
485 | leftFrameLayout->addWidget(mTodoList, 2 ); | 485 | leftFrameLayout->addWidget(mTodoList, 2 ); |
486 | 486 | ||
487 | } else { | 487 | } else { |
488 | leftFrameLayout->addWidget(mTodoList,2 ); | 488 | leftFrameLayout->addWidget(mTodoList,2 ); |
489 | leftFrameLayout->addWidget(mFilterView ); | 489 | leftFrameLayout->addWidget(mFilterView ); |
490 | } | 490 | } |
491 | #endif | 491 | #endif |
492 | mFilterView->hide(); | 492 | mFilterView->hide(); |
493 | mCalEditView->hide(); | 493 | mCalEditView->hide(); |
494 | QWidget *rightBox = new QWidget( mMainFrame ); | 494 | QWidget *rightBox = new QWidget( mMainFrame ); |
495 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 495 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
496 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 496 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
497 | mRightFrame = new QWidgetStack( rightBox ); | 497 | mRightFrame = new QWidgetStack( rightBox ); |
498 | rightLayout->addWidget( mRightFrame, 10 ); | 498 | rightLayout->addWidget( mRightFrame, 10 ); |
499 | 499 | ||
500 | //mLeftFrame = (QWidget *)leftFrame; | 500 | //mLeftFrame = (QWidget *)leftFrame; |
501 | if ( KOPrefs::instance()->mVerticalScreen ) { | 501 | if ( KOPrefs::instance()->mVerticalScreen ) { |
502 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 502 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
503 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 503 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
504 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 504 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
505 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 505 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
506 | } else { | 506 | } else { |
507 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 507 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
508 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 508 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
509 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 509 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
510 | } | 510 | } |
511 | if ( !KOPrefs::instance()->mShowDateNavigator) | 511 | if ( !KOPrefs::instance()->mShowDateNavigator) |
512 | mDateNavigator->hide(); | 512 | mDateNavigator->hide(); |
513 | //qDebug("Calendarview Size %d %d ", width(), height()); | 513 | //qDebug("Calendarview Size %d %d ", width(), height()); |
514 | #endif | 514 | #endif |
515 | 515 | ||
516 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 516 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
517 | SLOT( showDates( const KCal::DateList & ) ) ); | 517 | SLOT( showDates( const KCal::DateList & ) ) ); |
518 | 518 | ||
519 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 519 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
520 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 520 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
521 | 521 | ||
522 | 522 | ||
523 | 523 | ||
524 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 524 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
525 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 525 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 527 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
528 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 528 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
529 | 529 | ||
530 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 530 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
531 | mNavigator, SLOT( selectPreviousYear() ) ); | 531 | mNavigator, SLOT( selectPreviousYear() ) ); |
532 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 532 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
533 | mNavigator, SLOT( selectNextYear() ) ); | 533 | mNavigator, SLOT( selectNextYear() ) ); |
534 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 534 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
535 | mNavigator, SLOT( selectPreviousMonth() ) ); | 535 | mNavigator, SLOT( selectPreviousMonth() ) ); |
536 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 536 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
537 | mNavigator, SLOT( selectNextMonth() ) ); | 537 | mNavigator, SLOT( selectNextMonth() ) ); |
538 | 538 | ||
539 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 539 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
540 | mNavigator, SLOT( selectPrevious() ) ); | 540 | mNavigator, SLOT( selectPrevious() ) ); |
541 | connect( mDateNavigator, SIGNAL( goNext() ), | 541 | connect( mDateNavigator, SIGNAL( goNext() ), |
542 | mNavigator, SLOT( selectNext() ) ); | 542 | mNavigator, SLOT( selectNext() ) ); |
543 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 543 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
544 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 544 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
545 | 545 | ||
546 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 546 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
547 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 547 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
548 | #if 0 | 548 | #if 0 |
549 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 549 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
550 | SLOT( incidenceAdded( Incidence *) ) ); | 550 | SLOT( incidenceAdded( Incidence *) ) ); |
551 | #endif | 551 | #endif |
552 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 552 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
553 | 553 | ||
554 | connect( this, SIGNAL( configChanged() ), | 554 | connect( this, SIGNAL( configChanged() ), |
555 | mDateNavigator, SLOT( updateConfig() ) ); | 555 | mDateNavigator, SLOT( updateConfig() ) ); |
556 | 556 | ||
557 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 557 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
558 | SLOT( newTodo() ) ); | 558 | SLOT( newTodo() ) ); |
559 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 559 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
560 | SLOT( newSubTodo( Todo * ) ) ); | 560 | SLOT( newSubTodo( Todo * ) ) ); |
561 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 561 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
562 | SLOT( editTodo( Todo * ) ) ); | 562 | SLOT( editTodo( Todo * ) ) ); |
563 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 563 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
564 | SLOT( showTodo( Todo *) ) ); | 564 | SLOT( showTodo( Todo *) ) ); |
565 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 565 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
566 | SLOT( deleteTodo( Todo *) ) ); | 566 | SLOT( deleteTodo( Todo *) ) ); |
567 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 567 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
568 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 568 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
569 | SLOT( purgeCompleted() ) ); | 569 | SLOT( purgeCompleted() ) ); |
570 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 570 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
571 | SIGNAL( todoModified( Todo *, int ) ) ); | 571 | SIGNAL( todoModified( Todo *, int ) ) ); |
572 | 572 | ||
573 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 573 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
574 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 574 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
575 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 575 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
576 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 576 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
577 | 577 | ||
578 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 578 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
579 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 579 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
580 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 580 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
581 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 581 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
582 | 582 | ||
583 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 583 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
584 | this, SLOT ( todo_unsub( Todo * ) ) ); | 584 | this, SLOT ( todo_unsub( Todo * ) ) ); |
585 | 585 | ||
586 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 586 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
587 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 587 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
588 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 588 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
589 | SLOT( updateTodo( Todo *, int ) ) ); | 589 | SLOT( updateTodo( Todo *, int ) ) ); |
590 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 590 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
591 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 591 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
592 | 592 | ||
593 | 593 | ||
594 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 594 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
595 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 595 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
596 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 596 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
597 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 597 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
598 | 598 | ||
599 | 599 | ||
600 | 600 | ||
601 | 601 | ||
602 | 602 | ||
603 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 603 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
604 | SLOT(checkClipboard())); | 604 | SLOT(checkClipboard())); |
605 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 605 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
606 | SLOT( processTodoListSelection( Incidence * ) ) ); | 606 | SLOT( processTodoListSelection( Incidence * ) ) ); |
607 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 607 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
608 | 608 | ||
609 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 609 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
610 | 610 | ||
611 | mDateFrame = new QVBox(0,0,WType_Popup); | 611 | mDateFrame = new QVBox(0,0,WType_Popup); |
612 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 612 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
613 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 613 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
614 | mDateFrame->setLineWidth(3); | 614 | mDateFrame->setLineWidth(3); |
615 | mDateFrame->hide(); | 615 | mDateFrame->hide(); |
616 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 616 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
617 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 617 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
618 | 618 | ||
619 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 619 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
620 | 620 | ||
621 | mEventEditor = mDialogManager->getEventEditor(); | 621 | mEventEditor = mDialogManager->getEventEditor(); |
622 | mTodoEditor = mDialogManager->getTodoEditor(); | 622 | mTodoEditor = mDialogManager->getTodoEditor(); |
623 | 623 | ||
624 | mFlagEditDescription = false; | 624 | mFlagEditDescription = false; |
625 | 625 | ||
626 | mSuspendTimer = new QTimer( this ); | 626 | mSuspendTimer = new QTimer( this ); |
627 | mAlarmTimer = new QTimer( this ); | 627 | mAlarmTimer = new QTimer( this ); |
628 | mRecheckAlarmTimer = new QTimer( this ); | 628 | mRecheckAlarmTimer = new QTimer( this ); |
629 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 629 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
@@ -2540,565 +2540,565 @@ void CalendarView::writeSettings() | |||
2540 | x = wid->geometry().x(); | 2540 | x = wid->geometry().x(); |
2541 | y = wid->geometry().y(); | 2541 | y = wid->geometry().y(); |
2542 | w = wid->width(); | 2542 | w = wid->width(); |
2543 | h = wid->height(); | 2543 | h = wid->height(); |
2544 | list.clear(); | 2544 | list.clear(); |
2545 | list << QString::number( x ); | 2545 | list << QString::number( x ); |
2546 | list << QString::number( y ); | 2546 | list << QString::number( y ); |
2547 | list << QString::number( w ); | 2547 | list << QString::number( w ); |
2548 | list << QString::number( h ); | 2548 | list << QString::number( h ); |
2549 | config->writeEntry("MainLayout",list ); | 2549 | config->writeEntry("MainLayout",list ); |
2550 | 2550 | ||
2551 | wid = mEventEditor; | 2551 | wid = mEventEditor; |
2552 | x = wid->geometry().x(); | 2552 | x = wid->geometry().x(); |
2553 | y = wid->geometry().y(); | 2553 | y = wid->geometry().y(); |
2554 | w = wid->width(); | 2554 | w = wid->width(); |
2555 | h = wid->height(); | 2555 | h = wid->height(); |
2556 | list.clear(); | 2556 | list.clear(); |
2557 | list << QString::number( x ); | 2557 | list << QString::number( x ); |
2558 | list << QString::number( y ); | 2558 | list << QString::number( y ); |
2559 | list << QString::number( w ); | 2559 | list << QString::number( w ); |
2560 | list << QString::number( h ); | 2560 | list << QString::number( h ); |
2561 | config->writeEntry("EditEventLayout",list ); | 2561 | config->writeEntry("EditEventLayout",list ); |
2562 | 2562 | ||
2563 | wid = mTodoEditor; | 2563 | wid = mTodoEditor; |
2564 | x = wid->geometry().x(); | 2564 | x = wid->geometry().x(); |
2565 | y = wid->geometry().y(); | 2565 | y = wid->geometry().y(); |
2566 | w = wid->width(); | 2566 | w = wid->width(); |
2567 | h = wid->height(); | 2567 | h = wid->height(); |
2568 | list.clear(); | 2568 | list.clear(); |
2569 | list << QString::number( x ); | 2569 | list << QString::number( x ); |
2570 | list << QString::number( y ); | 2570 | list << QString::number( y ); |
2571 | list << QString::number( w ); | 2571 | list << QString::number( w ); |
2572 | list << QString::number( h ); | 2572 | list << QString::number( h ); |
2573 | config->writeEntry("EditTodoLayout",list ); | 2573 | config->writeEntry("EditTodoLayout",list ); |
2574 | wid = getEventViewerDialog(); | 2574 | wid = getEventViewerDialog(); |
2575 | x = wid->geometry().x(); | 2575 | x = wid->geometry().x(); |
2576 | y = wid->geometry().y(); | 2576 | y = wid->geometry().y(); |
2577 | w = wid->width(); | 2577 | w = wid->width(); |
2578 | h = wid->height(); | 2578 | h = wid->height(); |
2579 | list.clear(); | 2579 | list.clear(); |
2580 | list << QString::number( x ); | 2580 | list << QString::number( x ); |
2581 | list << QString::number( y ); | 2581 | list << QString::number( y ); |
2582 | list << QString::number( w ); | 2582 | list << QString::number( w ); |
2583 | list << QString::number( h ); | 2583 | list << QString::number( h ); |
2584 | config->writeEntry("ViewerLayout",list ); | 2584 | config->writeEntry("ViewerLayout",list ); |
2585 | wid = mDialogManager->getSearchDialog(); | 2585 | wid = mDialogManager->getSearchDialog(); |
2586 | if ( wid ) { | 2586 | if ( wid ) { |
2587 | x = wid->geometry().x(); | 2587 | x = wid->geometry().x(); |
2588 | y = wid->geometry().y(); | 2588 | y = wid->geometry().y(); |
2589 | w = wid->width(); | 2589 | w = wid->width(); |
2590 | h = wid->height(); | 2590 | h = wid->height(); |
2591 | list.clear(); | 2591 | list.clear(); |
2592 | list << QString::number( x ); | 2592 | list << QString::number( x ); |
2593 | list << QString::number( y ); | 2593 | list << QString::number( y ); |
2594 | list << QString::number( w ); | 2594 | list << QString::number( w ); |
2595 | list << QString::number( h ); | 2595 | list << QString::number( h ); |
2596 | config->writeEntry("SearchLayout",list ); | 2596 | config->writeEntry("SearchLayout",list ); |
2597 | } | 2597 | } |
2598 | #endif | 2598 | #endif |
2599 | 2599 | ||
2600 | 2600 | ||
2601 | config->sync(); | 2601 | config->sync(); |
2602 | } | 2602 | } |
2603 | 2603 | ||
2604 | void CalendarView::readFilterSettings(KConfig *config) | 2604 | void CalendarView::readFilterSettings(KConfig *config) |
2605 | { | 2605 | { |
2606 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2606 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2607 | 2607 | ||
2608 | mFilters.clear(); | 2608 | mFilters.clear(); |
2609 | 2609 | ||
2610 | config->setGroup("General"); | 2610 | config->setGroup("General"); |
2611 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2611 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2612 | 2612 | ||
2613 | QStringList::ConstIterator it = filterList.begin(); | 2613 | QStringList::ConstIterator it = filterList.begin(); |
2614 | QStringList::ConstIterator end = filterList.end(); | 2614 | QStringList::ConstIterator end = filterList.end(); |
2615 | while(it != end) { | 2615 | while(it != end) { |
2616 | // kdDebug() << " filter: " << (*it) << endl; | 2616 | // kdDebug() << " filter: " << (*it) << endl; |
2617 | 2617 | ||
2618 | CalFilter *filter; | 2618 | CalFilter *filter; |
2619 | filter = new CalFilter(*it); | 2619 | filter = new CalFilter(*it); |
2620 | config->setGroup("Filter_" + (*it).utf8()); | 2620 | config->setGroup("Filter_" + (*it).utf8()); |
2621 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2621 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2622 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2622 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2623 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2623 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2624 | mFilters.append(filter); | 2624 | mFilters.append(filter); |
2625 | 2625 | ||
2626 | ++it; | 2626 | ++it; |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | if (mFilters.count() == 0) { | 2629 | if (mFilters.count() == 0) { |
2630 | CalFilter *filter = new CalFilter(i18n("Default")); | 2630 | CalFilter *filter = new CalFilter(i18n("Default")); |
2631 | mFilters.append(filter); | 2631 | mFilters.append(filter); |
2632 | } | 2632 | } |
2633 | mFilterView->updateFilters(); | 2633 | mFilterView->updateFilters(); |
2634 | config->setGroup("FilterView"); | 2634 | config->setGroup("FilterView"); |
2635 | 2635 | ||
2636 | mFilterView->blockSignals(true); | 2636 | mFilterView->blockSignals(true); |
2637 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2637 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2638 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2638 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2639 | mFilterView->blockSignals(false); | 2639 | mFilterView->blockSignals(false); |
2640 | // We do it manually to avoid it being done twice by the above calls | 2640 | // We do it manually to avoid it being done twice by the above calls |
2641 | updateFilter(); | 2641 | updateFilter(); |
2642 | } | 2642 | } |
2643 | 2643 | ||
2644 | void CalendarView::writeFilterSettings(KConfig *config) | 2644 | void CalendarView::writeFilterSettings(KConfig *config) |
2645 | { | 2645 | { |
2646 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2646 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2647 | 2647 | ||
2648 | QStringList filterList; | 2648 | QStringList filterList; |
2649 | 2649 | ||
2650 | CalFilter *filter = mFilters.first(); | 2650 | CalFilter *filter = mFilters.first(); |
2651 | while(filter) { | 2651 | while(filter) { |
2652 | // kdDebug() << " fn: " << filter->name() << endl; | 2652 | // kdDebug() << " fn: " << filter->name() << endl; |
2653 | filterList << filter->name(); | 2653 | filterList << filter->name(); |
2654 | config->setGroup("Filter_" + filter->name().utf8()); | 2654 | config->setGroup("Filter_" + filter->name().utf8()); |
2655 | config->writeEntry("Criteria",filter->criteria()); | 2655 | config->writeEntry("Criteria",filter->criteria()); |
2656 | config->writeEntry("CategoryList",filter->categoryList()); | 2656 | config->writeEntry("CategoryList",filter->categoryList()); |
2657 | filter = mFilters.next(); | 2657 | filter = mFilters.next(); |
2658 | } | 2658 | } |
2659 | config->setGroup("General"); | 2659 | config->setGroup("General"); |
2660 | config->writeEntry("CalendarFilters",filterList); | 2660 | config->writeEntry("CalendarFilters",filterList); |
2661 | 2661 | ||
2662 | config->setGroup("FilterView"); | 2662 | config->setGroup("FilterView"); |
2663 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2663 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2664 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2664 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2665 | } | 2665 | } |
2666 | 2666 | ||
2667 | 2667 | ||
2668 | void CalendarView::goToday() | 2668 | void CalendarView::goToday() |
2669 | { | 2669 | { |
2670 | if ( mViewManager->currentView()->isMonthView() ) | 2670 | if ( mViewManager->currentView()->isMonthView() ) |
2671 | mNavigator->selectTodayMonth(); | 2671 | mNavigator->selectTodayMonth(); |
2672 | else | 2672 | else |
2673 | mNavigator->selectToday(); | 2673 | mNavigator->selectToday(); |
2674 | } | 2674 | } |
2675 | 2675 | ||
2676 | void CalendarView::goNext() | 2676 | void CalendarView::goNext() |
2677 | { | 2677 | { |
2678 | mNavigator->selectNext(); | 2678 | mNavigator->selectNext(); |
2679 | } | 2679 | } |
2680 | 2680 | ||
2681 | void CalendarView::goPrevious() | 2681 | void CalendarView::goPrevious() |
2682 | { | 2682 | { |
2683 | mNavigator->selectPrevious(); | 2683 | mNavigator->selectPrevious(); |
2684 | } | 2684 | } |
2685 | void CalendarView::goNextMonth() | 2685 | void CalendarView::goNextMonth() |
2686 | { | 2686 | { |
2687 | mNavigator->selectNextMonth(); | 2687 | mNavigator->selectNextMonth(); |
2688 | } | 2688 | } |
2689 | 2689 | ||
2690 | void CalendarView::goPreviousMonth() | 2690 | void CalendarView::goPreviousMonth() |
2691 | { | 2691 | { |
2692 | mNavigator->selectPreviousMonth(); | 2692 | mNavigator->selectPreviousMonth(); |
2693 | } | 2693 | } |
2694 | 2694 | ||
2695 | void CalendarView::updateConfig() | 2695 | void CalendarView::updateConfig() |
2696 | { | 2696 | { |
2697 | if ( KOPrefs::instance()->mUseAppColors ) | 2697 | if ( KOPrefs::instance()->mUseAppColors ) |
2698 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2698 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2699 | emit configChanged(); | 2699 | emit configChanged(); |
2700 | mTodoList->updateConfig(); | 2700 | mTodoList->updateConfig(); |
2701 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2701 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2703 | // To make the "fill window" configurations work | 2703 | // To make the "fill window" configurations work |
2704 | //mViewManager->raiseCurrentView(); | 2704 | //mViewManager->raiseCurrentView(); |
2705 | } | 2705 | } |
2706 | 2706 | ||
2707 | 2707 | ||
2708 | void CalendarView::eventChanged(Event *event) | 2708 | void CalendarView::eventChanged(Event *event) |
2709 | { | 2709 | { |
2710 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2710 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2711 | //updateUnmanagedViews(); | 2711 | //updateUnmanagedViews(); |
2712 | } | 2712 | } |
2713 | 2713 | ||
2714 | void CalendarView::eventAdded(Event *event) | 2714 | void CalendarView::eventAdded(Event *event) |
2715 | { | 2715 | { |
2716 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2716 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2717 | } | 2717 | } |
2718 | 2718 | ||
2719 | void CalendarView::eventToBeDeleted(Event *) | 2719 | void CalendarView::eventToBeDeleted(Event *) |
2720 | { | 2720 | { |
2721 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2721 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | void CalendarView::eventDeleted() | 2724 | void CalendarView::eventDeleted() |
2725 | { | 2725 | { |
2726 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2726 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2727 | } | 2727 | } |
2728 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2728 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2729 | { | 2729 | { |
2730 | changeIncidenceDisplay((Incidence *)which, action); | 2730 | changeIncidenceDisplay((Incidence *)which, action); |
2731 | mDateNavigator->updateView(); //LR | 2731 | mDateNavigator->updateView(); //LR |
2732 | //mDialogManager->updateSearchDialog(); | 2732 | //mDialogManager->updateSearchDialog(); |
2733 | 2733 | ||
2734 | if (which) { | 2734 | if (which) { |
2735 | mViewManager->updateWNview(); | 2735 | mViewManager->updateWNview(); |
2736 | //mTodoList->updateView(); | 2736 | //mTodoList->updateView(); |
2737 | } | 2737 | } |
2738 | 2738 | ||
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2741 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2742 | { | 2742 | { |
2743 | updateUnmanagedViews(); | 2743 | updateUnmanagedViews(); |
2744 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2744 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2745 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2745 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2746 | mCalendar->checkAlarmForIncidence( 0, true ); | 2746 | mCalendar->checkAlarmForIncidence( 0, true ); |
2747 | if ( mEventViewerDialog ) | 2747 | if ( mEventViewerDialog ) |
2748 | mEventViewerDialog->hide(); | 2748 | mEventViewerDialog->hide(); |
2749 | } | 2749 | } |
2750 | else | 2750 | else |
2751 | mCalendar->checkAlarmForIncidence( which , false ); | 2751 | mCalendar->checkAlarmForIncidence( which , false ); |
2752 | } | 2752 | } |
2753 | 2753 | ||
2754 | // most of the changeEventDisplays() right now just call the view's | 2754 | // most of the changeEventDisplays() right now just call the view's |
2755 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2755 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2756 | void CalendarView::changeEventDisplay(Event *which, int action) | 2756 | void CalendarView::changeEventDisplay(Event *which, int action) |
2757 | { | 2757 | { |
2758 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2758 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2759 | changeIncidenceDisplay((Incidence *)which, action); | 2759 | changeIncidenceDisplay((Incidence *)which, action); |
2760 | static bool clearallviews = false; | 2760 | static bool clearallviews = false; |
2761 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2761 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2762 | if ( clearallviews ) { | 2762 | if ( clearallviews ) { |
2763 | clearAllViews(); | 2763 | clearAllViews(); |
2764 | clearallviews = false; | 2764 | clearallviews = false; |
2765 | } | 2765 | } |
2766 | return; | 2766 | return; |
2767 | } | 2767 | } |
2768 | clearallviews = true; | 2768 | clearallviews = true; |
2769 | mDateNavigator->updateView(); | 2769 | mDateNavigator->updateView(); |
2770 | //mDialogManager->updateSearchDialog(); | 2770 | //mDialogManager->updateSearchDialog(); |
2771 | if (which) { | 2771 | if (which) { |
2772 | // If there is an event view visible update the display | 2772 | // If there is an event view visible update the display |
2773 | mViewManager->currentView()->changeEventDisplay(which,action); | 2773 | mViewManager->currentView()->changeEventDisplay(which,action); |
2774 | // TODO: check, if update needed | 2774 | // TODO: check, if update needed |
2775 | // if (which->getTodoStatus()) { | 2775 | // if (which->getTodoStatus()) { |
2776 | mTodoList->updateView(); | 2776 | mTodoList->updateView(); |
2777 | if ( action != KOGlobals::EVENTDELETED ) { | 2777 | if ( action != KOGlobals::EVENTDELETED ) { |
2778 | mConflictingEvent = which ; | 2778 | mConflictingEvent = which ; |
2779 | int time = 1000; | 2779 | int time = 1000; |
2780 | #ifdef DESKTOP_VERSION | 2780 | #ifdef DESKTOP_VERSION |
2781 | time = 500; | 2781 | time = 500; |
2782 | #endif | 2782 | #endif |
2783 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 2783 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
2784 | } | 2784 | } |
2785 | // } | 2785 | // } |
2786 | } else { | 2786 | } else { |
2787 | mViewManager->currentView()->updateView(); | 2787 | mViewManager->currentView()->updateView(); |
2788 | } | 2788 | } |
2789 | } | 2789 | } |
2790 | void CalendarView::checkConflictForEvent() | 2790 | void CalendarView::checkConflictForEvent() |
2791 | { | 2791 | { |
2792 | 2792 | ||
2793 | if (!KOPrefs::instance()->mConfirm) | 2793 | if (!KOPrefs::instance()->mConfirm) |
2794 | return; | 2794 | return; |
2795 | if ( ! mConflictingEvent ) return; | 2795 | if ( ! mConflictingEvent ) return; |
2796 | Event * conflictingEvent = mConflictingEvent; | ||
2797 | mConflictingEvent = 0; | ||
2796 | QDateTime current = QDateTime::currentDateTime(); | 2798 | QDateTime current = QDateTime::currentDateTime(); |
2797 | if ( ! mConflictingEvent->matchTime( ¤t, 0 ) ) { | 2799 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
2798 | mConflictingEvent = 0; | ||
2799 | return; | 2800 | return; |
2800 | } | 2801 | } |
2801 | QPtrList<Event> testlist = mCalendar->events(); | 2802 | QPtrList<Event> testlist = mCalendar->events(); |
2802 | Event * test = testlist.first(); | 2803 | Event * test = testlist.first(); |
2803 | QDateTime conflict; | 2804 | QDateTime conflict; |
2804 | QDateTime retVal; | 2805 | QDateTime retVal; |
2805 | bool found = false; | 2806 | bool found = false; |
2806 | Event * cE = 0; | 2807 | Event * cE = 0; |
2807 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 2808 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
2808 | while ( test ) { | 2809 | while ( test ) { |
2809 | qApp->processEvents(); | 2810 | qApp->processEvents(); |
2810 | bool skip = false; | 2811 | bool skip = false; |
2811 | if ( found ) | 2812 | if ( found ) |
2812 | skip = !test->matchTime( ¤t, &conflict ); | 2813 | skip = !test->matchTime( ¤t, &conflict ); |
2813 | else | 2814 | else |
2814 | skip = !test->matchTime( ¤t, 0 ); | 2815 | skip = !test->matchTime( ¤t, 0 ); |
2815 | if ( !skip && !test->doesFloat() ) { | 2816 | if ( !skip && !test->doesFloat() ) { |
2816 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 2817 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2817 | if ( ! found ) { | 2818 | if ( ! found ) { |
2818 | conflict = retVal; | 2819 | conflict = retVal; |
2819 | cE = test; | 2820 | cE = test; |
2820 | } else { | 2821 | } else { |
2821 | if ( retVal < conflict ) { | 2822 | if ( retVal < conflict ) { |
2822 | conflict = retVal; | 2823 | conflict = retVal; |
2823 | cE = test; | 2824 | cE = test; |
2824 | } | 2825 | } |
2825 | } | 2826 | } |
2826 | found = true; | 2827 | found = true; |
2827 | } | 2828 | } |
2828 | } | 2829 | } |
2829 | test = testlist.next(); | 2830 | test = testlist.next(); |
2830 | } | 2831 | } |
2831 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 2832 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
2832 | if ( found ) { | 2833 | if ( found ) { |
2833 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2834 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2834 | qApp->processEvents(); | 2835 | qApp->processEvents(); |
2835 | int km = KMessageBox::warningContinueCancel(this,mess, | 2836 | int km = KMessageBox::warningContinueCancel(this,mess, |
2836 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2837 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2837 | if ( km != KMessageBox::Continue ) { | 2838 | if ( km != KMessageBox::Continue ) { |
2838 | return; | 2839 | return; |
2839 | } | 2840 | } |
2840 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2841 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2841 | mViewManager->showDayView(); | 2842 | mViewManager->showDayView(); |
2842 | mNavigator->slotDaySelect( conflict.date() ); | 2843 | mNavigator->slotDaySelect( conflict.date() ); |
2843 | int hour = conflict.time().hour(); | 2844 | int hour = conflict.time().hour(); |
2844 | mViewManager->agendaView()->setStartHour( hour ); | 2845 | mViewManager->agendaView()->setStartHour( hour ); |
2845 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2846 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2846 | } else | 2847 | } else |
2847 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 2848 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
2848 | mConflictingEvent = 0; | ||
2849 | return; | 2849 | return; |
2850 | 2850 | ||
2851 | } | 2851 | } |
2852 | 2852 | ||
2853 | void CalendarView::updateTodoViews() | 2853 | void CalendarView::updateTodoViews() |
2854 | { | 2854 | { |
2855 | mTodoList->updateView(); | 2855 | mTodoList->updateView(); |
2856 | mViewManager->currentView()->updateView(); | 2856 | mViewManager->currentView()->updateView(); |
2857 | 2857 | ||
2858 | } | 2858 | } |
2859 | 2859 | ||
2860 | 2860 | ||
2861 | 2861 | ||
2862 | void CalendarView::clearAllViews() | 2862 | void CalendarView::clearAllViews() |
2863 | { | 2863 | { |
2864 | mTodoList->clearList(); | 2864 | mTodoList->clearList(); |
2865 | mViewManager->clearAllViews(); | 2865 | mViewManager->clearAllViews(); |
2866 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2866 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2867 | if ( sd ) { | 2867 | if ( sd ) { |
2868 | KOListView* kol = sd->listview(); | 2868 | KOListView* kol = sd->listview(); |
2869 | if ( kol ) | 2869 | if ( kol ) |
2870 | kol->clearList(); | 2870 | kol->clearList(); |
2871 | } | 2871 | } |
2872 | } | 2872 | } |
2873 | void CalendarView::updateView() | 2873 | void CalendarView::updateView() |
2874 | { | 2874 | { |
2875 | static bool clearallviews = false; | 2875 | static bool clearallviews = false; |
2876 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2876 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2877 | if ( clearallviews ) { | 2877 | if ( clearallviews ) { |
2878 | clearAllViews(); | 2878 | clearAllViews(); |
2879 | clearallviews = false; | 2879 | clearallviews = false; |
2880 | } | 2880 | } |
2881 | return; | 2881 | return; |
2882 | } | 2882 | } |
2883 | clearallviews = true; | 2883 | clearallviews = true; |
2884 | DateList tmpList = mNavigator->selectedDates(); | 2884 | DateList tmpList = mNavigator->selectedDates(); |
2885 | 2885 | ||
2886 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2886 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2887 | mTodoList->updateView(); | 2887 | mTodoList->updateView(); |
2888 | // We assume that the navigator only selects consecutive days. | 2888 | // We assume that the navigator only selects consecutive days. |
2889 | updateView( tmpList.first(), tmpList.last() ); | 2889 | updateView( tmpList.first(), tmpList.last() ); |
2890 | } | 2890 | } |
2891 | 2891 | ||
2892 | void CalendarView::updateUnmanagedViews() | 2892 | void CalendarView::updateUnmanagedViews() |
2893 | { | 2893 | { |
2894 | mDateNavigator->updateDayMatrix(); | 2894 | mDateNavigator->updateDayMatrix(); |
2895 | } | 2895 | } |
2896 | 2896 | ||
2897 | int CalendarView::msgItemDelete(const QString name) | 2897 | int CalendarView::msgItemDelete(const QString name) |
2898 | { | 2898 | { |
2899 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2899 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2900 | i18n("This item will be\npermanently deleted."), | 2900 | i18n("This item will be\npermanently deleted."), |
2901 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2901 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2902 | } | 2902 | } |
2903 | 2903 | ||
2904 | 2904 | ||
2905 | void CalendarView::edit_cut() | 2905 | void CalendarView::edit_cut() |
2906 | { | 2906 | { |
2907 | Event *anEvent=0; | 2907 | Event *anEvent=0; |
2908 | 2908 | ||
2909 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2909 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2910 | 2910 | ||
2911 | if (mViewManager->currentView()->isEventView()) { | 2911 | if (mViewManager->currentView()->isEventView()) { |
2912 | if ( incidence && incidence->typeID() == eventID ) { | 2912 | if ( incidence && incidence->typeID() == eventID ) { |
2913 | anEvent = static_cast<Event *>(incidence); | 2913 | anEvent = static_cast<Event *>(incidence); |
2914 | } | 2914 | } |
2915 | } | 2915 | } |
2916 | 2916 | ||
2917 | if (!anEvent) { | 2917 | if (!anEvent) { |
2918 | KNotifyClient::beep(); | 2918 | KNotifyClient::beep(); |
2919 | return; | 2919 | return; |
2920 | } | 2920 | } |
2921 | DndFactory factory( mCalendar ); | 2921 | DndFactory factory( mCalendar ); |
2922 | factory.cutIncidence(anEvent); | 2922 | factory.cutIncidence(anEvent); |
2923 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2923 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2924 | } | 2924 | } |
2925 | 2925 | ||
2926 | void CalendarView::edit_copy() | 2926 | void CalendarView::edit_copy() |
2927 | { | 2927 | { |
2928 | Event *anEvent=0; | 2928 | Event *anEvent=0; |
2929 | 2929 | ||
2930 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2930 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2931 | 2931 | ||
2932 | if (mViewManager->currentView()->isEventView()) { | 2932 | if (mViewManager->currentView()->isEventView()) { |
2933 | if ( incidence && incidence->typeID() == eventID ) { | 2933 | if ( incidence && incidence->typeID() == eventID ) { |
2934 | anEvent = static_cast<Event *>(incidence); | 2934 | anEvent = static_cast<Event *>(incidence); |
2935 | } | 2935 | } |
2936 | } | 2936 | } |
2937 | 2937 | ||
2938 | if (!anEvent) { | 2938 | if (!anEvent) { |
2939 | KNotifyClient::beep(); | 2939 | KNotifyClient::beep(); |
2940 | return; | 2940 | return; |
2941 | } | 2941 | } |
2942 | DndFactory factory( mCalendar ); | 2942 | DndFactory factory( mCalendar ); |
2943 | factory.copyIncidence(anEvent); | 2943 | factory.copyIncidence(anEvent); |
2944 | } | 2944 | } |
2945 | 2945 | ||
2946 | void CalendarView::edit_paste() | 2946 | void CalendarView::edit_paste() |
2947 | { | 2947 | { |
2948 | QDate date = mNavigator->selectedDates().first(); | 2948 | QDate date = mNavigator->selectedDates().first(); |
2949 | 2949 | ||
2950 | DndFactory factory( mCalendar ); | 2950 | DndFactory factory( mCalendar ); |
2951 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2951 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2952 | 2952 | ||
2953 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2953 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2954 | } | 2954 | } |
2955 | void CalendarView::edit_global_options() | 2955 | void CalendarView::edit_global_options() |
2956 | { | 2956 | { |
2957 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2957 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2958 | emit save(); | 2958 | emit save(); |
2959 | emit saveStopTimer(); | 2959 | emit saveStopTimer(); |
2960 | mDialogManager->showGlobalOptionsDialog(); | 2960 | mDialogManager->showGlobalOptionsDialog(); |
2961 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2961 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2962 | emit saveStopTimer(); | 2962 | emit saveStopTimer(); |
2963 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2963 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2964 | i18n("Timezone settings"),i18n("Reload"))) { | 2964 | i18n("Timezone settings"),i18n("Reload"))) { |
2965 | qDebug("KO: TZ reload cancelled "); | 2965 | qDebug("KO: TZ reload cancelled "); |
2966 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2966 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2967 | return; | 2967 | return; |
2968 | } | 2968 | } |
2969 | qDebug("KO: Timezone change "); | 2969 | qDebug("KO: Timezone change "); |
2970 | loadCalendars(); | 2970 | loadCalendars(); |
2971 | setModified(true); | 2971 | setModified(true); |
2972 | } | 2972 | } |
2973 | else | 2973 | else |
2974 | qDebug("KO: No tz change "); | 2974 | qDebug("KO: No tz change "); |
2975 | } | 2975 | } |
2976 | void CalendarView::edit_options() | 2976 | void CalendarView::edit_options() |
2977 | { | 2977 | { |
2978 | mDialogManager->showOptionsDialog(); | 2978 | mDialogManager->showOptionsDialog(); |
2979 | } | 2979 | } |
2980 | 2980 | ||
2981 | 2981 | ||
2982 | void CalendarView::slotSelectPickerDate( QDate d) | 2982 | void CalendarView::slotSelectPickerDate( QDate d) |
2983 | { | 2983 | { |
2984 | mDateFrame->hide(); | 2984 | mDateFrame->hide(); |
2985 | if ( mDatePickerMode == 1 ) { | 2985 | if ( mDatePickerMode == 1 ) { |
2986 | mNavigator->slotDaySelect( d ); | 2986 | mNavigator->slotDaySelect( d ); |
2987 | } else if ( mDatePickerMode == 2 ) { | 2987 | } else if ( mDatePickerMode == 2 ) { |
2988 | if ( mMoveIncidence->typeID() == todoID ) { | 2988 | if ( mMoveIncidence->typeID() == todoID ) { |
2989 | Todo * to = (Todo *) mMoveIncidence; | 2989 | Todo * to = (Todo *) mMoveIncidence; |
2990 | QTime tim; | 2990 | QTime tim; |
2991 | int len = 0; | 2991 | int len = 0; |
2992 | if ( to->hasStartDate() && to->hasDueDate() ) | 2992 | if ( to->hasStartDate() && to->hasDueDate() ) |
2993 | len = to->dtStart().secsTo( to->dtDue()); | 2993 | len = to->dtStart().secsTo( to->dtDue()); |
2994 | if ( to->hasDueDate() ) | 2994 | if ( to->hasDueDate() ) |
2995 | tim = to->dtDue().time(); | 2995 | tim = to->dtDue().time(); |
2996 | else { | 2996 | else { |
2997 | tim = QTime ( 0,0,0 ); | 2997 | tim = QTime ( 0,0,0 ); |
2998 | to->setFloats( true ); | 2998 | to->setFloats( true ); |
2999 | to->setHasDueDate( true ); | 2999 | to->setHasDueDate( true ); |
3000 | } | 3000 | } |
3001 | QDateTime dt ( d,tim ); | 3001 | QDateTime dt ( d,tim ); |
3002 | to->setDtDue( dt ); | 3002 | to->setDtDue( dt ); |
3003 | 3003 | ||
3004 | if ( to->hasStartDate() ) { | 3004 | if ( to->hasStartDate() ) { |
3005 | if ( len>0 ) | 3005 | if ( len>0 ) |
3006 | to->setDtStart(to->dtDue().addSecs( -len )); | 3006 | to->setDtStart(to->dtDue().addSecs( -len )); |
3007 | else | 3007 | else |
3008 | if (to->dtStart() > to->dtDue() ) | 3008 | if (to->dtStart() > to->dtDue() ) |
3009 | to->setDtStart(to->dtDue().addDays( -3 )); | 3009 | to->setDtStart(to->dtDue().addDays( -3 )); |
3010 | } | 3010 | } |
3011 | 3011 | ||
3012 | todoChanged( to ); | 3012 | todoChanged( to ); |
3013 | } else if ( mMoveIncidence->typeID() == eventID ) { | 3013 | } else if ( mMoveIncidence->typeID() == eventID ) { |
3014 | if ( mMoveIncidence->doesRecur() ) { | 3014 | if ( mMoveIncidence->doesRecur() ) { |
3015 | #if 0 | 3015 | #if 0 |
3016 | // PENDING implement this | 3016 | // PENDING implement this |
3017 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 3017 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
3018 | mCalendar()->addIncidence( newInc ); | 3018 | mCalendar()->addIncidence( newInc ); |
3019 | if ( mMoveIncidence->typeID() == todoID ) | 3019 | if ( mMoveIncidence->typeID() == todoID ) |
3020 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 3020 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
3021 | else | 3021 | else |
3022 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 3022 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
3023 | mMoveIncidence = newInc; | 3023 | mMoveIncidence = newInc; |
3024 | 3024 | ||
3025 | #endif | 3025 | #endif |
3026 | } | 3026 | } |
3027 | QTime tim = mMoveIncidence->dtStart().time(); | 3027 | QTime tim = mMoveIncidence->dtStart().time(); |
3028 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 3028 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
3029 | QDateTime dt ( d,tim ); | 3029 | QDateTime dt ( d,tim ); |
3030 | mMoveIncidence->setDtStart( dt ); | 3030 | mMoveIncidence->setDtStart( dt ); |
3031 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 3031 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
3032 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 3032 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
3033 | } else if ( mMoveIncidence->typeID() == journalID ) { | 3033 | } else if ( mMoveIncidence->typeID() == journalID ) { |
3034 | QTime tim = mMoveIncidence->dtStart().time(); | 3034 | QTime tim = mMoveIncidence->dtStart().time(); |
3035 | QDateTime dt ( d,tim ); | 3035 | QDateTime dt ( d,tim ); |
3036 | mMoveIncidence->setDtStart( dt ); | 3036 | mMoveIncidence->setDtStart( dt ); |
3037 | updateView(); | 3037 | updateView(); |
3038 | } | 3038 | } |
3039 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 3039 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
3040 | } | 3040 | } |
3041 | } | 3041 | } |
3042 | 3042 | ||
3043 | void CalendarView::removeCategories() | 3043 | void CalendarView::removeCategories() |
3044 | { | 3044 | { |
3045 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3045 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3046 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3046 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3047 | QStringList catIncList; | 3047 | QStringList catIncList; |
3048 | QStringList newCatList; | 3048 | QStringList newCatList; |
3049 | Incidence* inc = incList.first(); | 3049 | Incidence* inc = incList.first(); |
3050 | uint i; | 3050 | uint i; |
3051 | while ( inc ) { | 3051 | while ( inc ) { |
3052 | newCatList.clear(); | 3052 | newCatList.clear(); |
3053 | catIncList = inc->categories() ; | 3053 | catIncList = inc->categories() ; |
3054 | for( i = 0; i< catIncList.count(); ++i ) { | 3054 | for( i = 0; i< catIncList.count(); ++i ) { |
3055 | if ( catList.contains (catIncList[i])) | 3055 | if ( catList.contains (catIncList[i])) |
3056 | newCatList.append( catIncList[i] ); | 3056 | newCatList.append( catIncList[i] ); |
3057 | } | 3057 | } |
3058 | newCatList.sort(); | 3058 | newCatList.sort(); |
3059 | inc->setCategories( newCatList.join(",") ); | 3059 | inc->setCategories( newCatList.join(",") ); |
3060 | inc = incList.next(); | 3060 | inc = incList.next(); |
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | int CalendarView::addCategories() | 3064 | int CalendarView::addCategories() |
3065 | { | 3065 | { |
3066 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3066 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3067 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3067 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3068 | QStringList catIncList; | 3068 | QStringList catIncList; |
3069 | Incidence* inc = incList.first(); | 3069 | Incidence* inc = incList.first(); |
3070 | uint i; | 3070 | uint i; |
3071 | int count = 0; | 3071 | int count = 0; |
3072 | while ( inc ) { | 3072 | while ( inc ) { |
3073 | catIncList = inc->categories() ; | 3073 | catIncList = inc->categories() ; |
3074 | for( i = 0; i< catIncList.count(); ++i ) { | 3074 | for( i = 0; i< catIncList.count(); ++i ) { |
3075 | if ( !catList.contains (catIncList[i])) { | 3075 | if ( !catList.contains (catIncList[i])) { |
3076 | catList.append( catIncList[i] ); | 3076 | catList.append( catIncList[i] ); |
3077 | //qDebug("add cat %s ", catIncList[i].latin1()); | 3077 | //qDebug("add cat %s ", catIncList[i].latin1()); |
3078 | ++count; | 3078 | ++count; |
3079 | } | 3079 | } |
3080 | } | 3080 | } |
3081 | inc = incList.next(); | 3081 | inc = incList.next(); |
3082 | } | 3082 | } |
3083 | catList.sort(); | 3083 | catList.sort(); |
3084 | KOPrefs::instance()->mCustomCategories = catList; | 3084 | KOPrefs::instance()->mCustomCategories = catList; |
3085 | return count; | 3085 | return count; |
3086 | } | 3086 | } |
3087 | 3087 | ||
3088 | void CalendarView::editCategories() | 3088 | void CalendarView::editCategories() |
3089 | { | 3089 | { |
3090 | qDebug("CalendarView::editCategories() "); | 3090 | qDebug("CalendarView::editCategories() "); |
3091 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); | 3091 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); |
3092 | ced.exec(); | 3092 | ced.exec(); |
3093 | } | 3093 | } |
3094 | void CalendarView::manageCategories() | 3094 | void CalendarView::manageCategories() |
3095 | { | 3095 | { |
3096 | KOCatPrefs* cp = new KOCatPrefs(); | 3096 | KOCatPrefs* cp = new KOCatPrefs(); |
3097 | cp->show(); | 3097 | cp->show(); |
3098 | int w =cp->sizeHint().width() ; | 3098 | int w =cp->sizeHint().width() ; |
3099 | int h = cp->sizeHint().height() ; | 3099 | int h = cp->sizeHint().height() ; |
3100 | int dw = QApplication::desktop()->width(); | 3100 | int dw = QApplication::desktop()->width(); |
3101 | int dh = QApplication::desktop()->height(); | 3101 | int dh = QApplication::desktop()->height(); |
3102 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 3102 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
3103 | if ( !cp->exec() ) { | 3103 | if ( !cp->exec() ) { |
3104 | delete cp; | 3104 | delete cp; |
@@ -3839,518 +3839,519 @@ void CalendarView::deleteEvent(Event *anEvent) | |||
3839 | bool CalendarView::deleteEvent(const QString &uid) | 3839 | bool CalendarView::deleteEvent(const QString &uid) |
3840 | { | 3840 | { |
3841 | Event *ev = mCalendar->event(uid); | 3841 | Event *ev = mCalendar->event(uid); |
3842 | if (ev) { | 3842 | if (ev) { |
3843 | deleteEvent(ev); | 3843 | deleteEvent(ev); |
3844 | return true; | 3844 | return true; |
3845 | } else { | 3845 | } else { |
3846 | return false; | 3846 | return false; |
3847 | } | 3847 | } |
3848 | } | 3848 | } |
3849 | 3849 | ||
3850 | /*****************************************************************************/ | 3850 | /*****************************************************************************/ |
3851 | 3851 | ||
3852 | void CalendarView::action_mail() | 3852 | void CalendarView::action_mail() |
3853 | { | 3853 | { |
3854 | #ifndef KORG_NOMAIL | 3854 | #ifndef KORG_NOMAIL |
3855 | KOMailClient mailClient; | 3855 | KOMailClient mailClient; |
3856 | 3856 | ||
3857 | Incidence *incidence = currentSelection(); | 3857 | Incidence *incidence = currentSelection(); |
3858 | 3858 | ||
3859 | if (!incidence) { | 3859 | if (!incidence) { |
3860 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3860 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3861 | return; | 3861 | return; |
3862 | } | 3862 | } |
3863 | if(incidence->attendeeCount() == 0 ) { | 3863 | if(incidence->attendeeCount() == 0 ) { |
3864 | KMessageBox::sorry(this, | 3864 | KMessageBox::sorry(this, |
3865 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3865 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3866 | return; | 3866 | return; |
3867 | } | 3867 | } |
3868 | 3868 | ||
3869 | CalendarLocal cal_tmp; | 3869 | CalendarLocal cal_tmp; |
3870 | Event *event = 0; | 3870 | Event *event = 0; |
3871 | Event *ev = 0; | 3871 | Event *ev = 0; |
3872 | if ( incidence && incidence->typeID() == eventID ) { | 3872 | if ( incidence && incidence->typeID() == eventID ) { |
3873 | event = static_cast<Event *>(incidence); | 3873 | event = static_cast<Event *>(incidence); |
3874 | ev = new Event(*event); | 3874 | ev = new Event(*event); |
3875 | cal_tmp.addEvent(ev); | 3875 | cal_tmp.addEvent(ev); |
3876 | } | 3876 | } |
3877 | ICalFormat mForm(); | 3877 | ICalFormat mForm(); |
3878 | QString attachment = mForm.toString( &cal_tmp ); | 3878 | QString attachment = mForm.toString( &cal_tmp ); |
3879 | if (ev) delete(ev); | 3879 | if (ev) delete(ev); |
3880 | 3880 | ||
3881 | mailClient.mailAttendees(currentSelection(), attachment); | 3881 | mailClient.mailAttendees(currentSelection(), attachment); |
3882 | 3882 | ||
3883 | #endif | 3883 | #endif |
3884 | 3884 | ||
3885 | #if 0 | 3885 | #if 0 |
3886 | Event *anEvent = 0; | 3886 | Event *anEvent = 0; |
3887 | if (mViewManager->currentView()->isEventView()) { | 3887 | if (mViewManager->currentView()->isEventView()) { |
3888 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3888 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3889 | } | 3889 | } |
3890 | 3890 | ||
3891 | if (!anEvent) { | 3891 | if (!anEvent) { |
3892 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3892 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3893 | return; | 3893 | return; |
3894 | } | 3894 | } |
3895 | if(anEvent->attendeeCount() == 0 ) { | 3895 | if(anEvent->attendeeCount() == 0 ) { |
3896 | KMessageBox::sorry(this, | 3896 | KMessageBox::sorry(this, |
3897 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3897 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3898 | return; | 3898 | return; |
3899 | } | 3899 | } |
3900 | 3900 | ||
3901 | mailobject.emailEvent(anEvent); | 3901 | mailobject.emailEvent(anEvent); |
3902 | #endif | 3902 | #endif |
3903 | } | 3903 | } |
3904 | 3904 | ||
3905 | 3905 | ||
3906 | void CalendarView::schedule_publish(Incidence *incidence) | 3906 | void CalendarView::schedule_publish(Incidence *incidence) |
3907 | { | 3907 | { |
3908 | Event *event = 0; | 3908 | Event *event = 0; |
3909 | Todo *todo = 0; | 3909 | Todo *todo = 0; |
3910 | 3910 | ||
3911 | if (incidence == 0) { | 3911 | if (incidence == 0) { |
3912 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3912 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3913 | if (incidence == 0) { | 3913 | if (incidence == 0) { |
3914 | incidence = mTodoList->selectedIncidences().first(); | 3914 | incidence = mTodoList->selectedIncidences().first(); |
3915 | } | 3915 | } |
3916 | } | 3916 | } |
3917 | if ( incidence && incidence->typeID() == eventID ) { | 3917 | if ( incidence && incidence->typeID() == eventID ) { |
3918 | event = static_cast<Event *>(incidence); | 3918 | event = static_cast<Event *>(incidence); |
3919 | } else { | 3919 | } else { |
3920 | if ( incidence && incidence->typeID() == todoID ) { | 3920 | if ( incidence && incidence->typeID() == todoID ) { |
3921 | todo = static_cast<Todo *>(incidence); | 3921 | todo = static_cast<Todo *>(incidence); |
3922 | } | 3922 | } |
3923 | } | 3923 | } |
3924 | 3924 | ||
3925 | if (!event && !todo) { | 3925 | if (!event && !todo) { |
3926 | KMessageBox::sorry(this,i18n("No event selected.")); | 3926 | KMessageBox::sorry(this,i18n("No event selected.")); |
3927 | return; | 3927 | return; |
3928 | } | 3928 | } |
3929 | 3929 | ||
3930 | PublishDialog *publishdlg = new PublishDialog(); | 3930 | PublishDialog *publishdlg = new PublishDialog(); |
3931 | if (incidence->attendeeCount()>0) { | 3931 | if (incidence->attendeeCount()>0) { |
3932 | QPtrList<Attendee> attendees = incidence->attendees(); | 3932 | QPtrList<Attendee> attendees = incidence->attendees(); |
3933 | attendees.first(); | 3933 | attendees.first(); |
3934 | while ( attendees.current()!=0 ) { | 3934 | while ( attendees.current()!=0 ) { |
3935 | publishdlg->addAttendee(attendees.current()); | 3935 | publishdlg->addAttendee(attendees.current()); |
3936 | attendees.next(); | 3936 | attendees.next(); |
3937 | } | 3937 | } |
3938 | } | 3938 | } |
3939 | bool send = true; | 3939 | bool send = true; |
3940 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3940 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3941 | if ( publishdlg->exec() != QDialog::Accepted ) | 3941 | if ( publishdlg->exec() != QDialog::Accepted ) |
3942 | send = false; | 3942 | send = false; |
3943 | } | 3943 | } |
3944 | if ( send ) { | 3944 | if ( send ) { |
3945 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3945 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3946 | if ( event ) { | 3946 | if ( event ) { |
3947 | Event *ev = new Event(*event); | 3947 | Event *ev = new Event(*event); |
3948 | ev->registerObserver(0); | 3948 | ev->registerObserver(0); |
3949 | ev->clearAttendees(); | 3949 | ev->clearAttendees(); |
3950 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3950 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3951 | delete(ev); | 3951 | delete(ev); |
3952 | } | 3952 | } |
3953 | } else { | 3953 | } else { |
3954 | if ( todo ) { | 3954 | if ( todo ) { |
3955 | Todo *ev = new Todo(*todo); | 3955 | Todo *ev = new Todo(*todo); |
3956 | ev->registerObserver(0); | 3956 | ev->registerObserver(0); |
3957 | ev->clearAttendees(); | 3957 | ev->clearAttendees(); |
3958 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3958 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3959 | delete(ev); | 3959 | delete(ev); |
3960 | } | 3960 | } |
3961 | } | 3961 | } |
3962 | } | 3962 | } |
3963 | } | 3963 | } |
3964 | delete publishdlg; | 3964 | delete publishdlg; |
3965 | } | 3965 | } |
3966 | 3966 | ||
3967 | void CalendarView::schedule_request(Incidence *incidence) | 3967 | void CalendarView::schedule_request(Incidence *incidence) |
3968 | { | 3968 | { |
3969 | schedule(Scheduler::Request,incidence); | 3969 | schedule(Scheduler::Request,incidence); |
3970 | } | 3970 | } |
3971 | 3971 | ||
3972 | void CalendarView::schedule_refresh(Incidence *incidence) | 3972 | void CalendarView::schedule_refresh(Incidence *incidence) |
3973 | { | 3973 | { |
3974 | schedule(Scheduler::Refresh,incidence); | 3974 | schedule(Scheduler::Refresh,incidence); |
3975 | } | 3975 | } |
3976 | 3976 | ||
3977 | void CalendarView::schedule_cancel(Incidence *incidence) | 3977 | void CalendarView::schedule_cancel(Incidence *incidence) |
3978 | { | 3978 | { |
3979 | schedule(Scheduler::Cancel,incidence); | 3979 | schedule(Scheduler::Cancel,incidence); |
3980 | } | 3980 | } |
3981 | 3981 | ||
3982 | void CalendarView::schedule_add(Incidence *incidence) | 3982 | void CalendarView::schedule_add(Incidence *incidence) |
3983 | { | 3983 | { |
3984 | schedule(Scheduler::Add,incidence); | 3984 | schedule(Scheduler::Add,incidence); |
3985 | } | 3985 | } |
3986 | 3986 | ||
3987 | void CalendarView::schedule_reply(Incidence *incidence) | 3987 | void CalendarView::schedule_reply(Incidence *incidence) |
3988 | { | 3988 | { |
3989 | schedule(Scheduler::Reply,incidence); | 3989 | schedule(Scheduler::Reply,incidence); |
3990 | } | 3990 | } |
3991 | 3991 | ||
3992 | void CalendarView::schedule_counter(Incidence *incidence) | 3992 | void CalendarView::schedule_counter(Incidence *incidence) |
3993 | { | 3993 | { |
3994 | schedule(Scheduler::Counter,incidence); | 3994 | schedule(Scheduler::Counter,incidence); |
3995 | } | 3995 | } |
3996 | 3996 | ||
3997 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3997 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3998 | { | 3998 | { |
3999 | schedule(Scheduler::Declinecounter,incidence); | 3999 | schedule(Scheduler::Declinecounter,incidence); |
4000 | } | 4000 | } |
4001 | 4001 | ||
4002 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 4002 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
4003 | { | 4003 | { |
4004 | QDateTime start = QDateTime::currentDateTime(); | 4004 | QDateTime start = QDateTime::currentDateTime(); |
4005 | QDateTime end = start.addDays(daysToPublish); | 4005 | QDateTime end = start.addDays(daysToPublish); |
4006 | 4006 | ||
4007 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 4007 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
4008 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 4008 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
4009 | 4009 | ||
4010 | 4010 | ||
4011 | PublishDialog *publishdlg = new PublishDialog(); | 4011 | PublishDialog *publishdlg = new PublishDialog(); |
4012 | if ( publishdlg->exec() == QDialog::Accepted ) { | 4012 | if ( publishdlg->exec() == QDialog::Accepted ) { |
4013 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 4013 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
4014 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 4014 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
4015 | delete(freebusy); | 4015 | delete(freebusy); |
4016 | } | 4016 | } |
4017 | } | 4017 | } |
4018 | delete publishdlg; | 4018 | delete publishdlg; |
4019 | } | 4019 | } |
4020 | 4020 | ||
4021 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 4021 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
4022 | { | 4022 | { |
4023 | Event *event = 0; | 4023 | Event *event = 0; |
4024 | Todo *todo = 0; | 4024 | Todo *todo = 0; |
4025 | 4025 | ||
4026 | if (incidence == 0) { | 4026 | if (incidence == 0) { |
4027 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 4027 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
4028 | if (incidence == 0) { | 4028 | if (incidence == 0) { |
4029 | incidence = mTodoList->selectedIncidences().first(); | 4029 | incidence = mTodoList->selectedIncidences().first(); |
4030 | } | 4030 | } |
4031 | } | 4031 | } |
4032 | if ( incidence && incidence->typeID() == eventID ) { | 4032 | if ( incidence && incidence->typeID() == eventID ) { |
4033 | event = static_cast<Event *>(incidence); | 4033 | event = static_cast<Event *>(incidence); |
4034 | } | 4034 | } |
4035 | if ( incidence && incidence->typeID() == todoID ) { | 4035 | if ( incidence && incidence->typeID() == todoID ) { |
4036 | todo = static_cast<Todo *>(incidence); | 4036 | todo = static_cast<Todo *>(incidence); |
4037 | } | 4037 | } |
4038 | 4038 | ||
4039 | if (!event && !todo) { | 4039 | if (!event && !todo) { |
4040 | KMessageBox::sorry(this,i18n("No event selected.")); | 4040 | KMessageBox::sorry(this,i18n("No event selected.")); |
4041 | return; | 4041 | return; |
4042 | } | 4042 | } |
4043 | 4043 | ||
4044 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 4044 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
4045 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 4045 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
4046 | return; | 4046 | return; |
4047 | } | 4047 | } |
4048 | 4048 | ||
4049 | Event *ev = 0; | 4049 | Event *ev = 0; |
4050 | if (event) ev = new Event(*event); | 4050 | if (event) ev = new Event(*event); |
4051 | Todo *to = 0; | 4051 | Todo *to = 0; |
4052 | if (todo) to = new Todo(*todo); | 4052 | if (todo) to = new Todo(*todo); |
4053 | 4053 | ||
4054 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 4054 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
4055 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 4055 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
4056 | if (!me) { | 4056 | if (!me) { |
4057 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 4057 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
4058 | return; | 4058 | return; |
4059 | } | 4059 | } |
4060 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 4060 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
4061 | StatusDialog *statdlg = new StatusDialog(this); | 4061 | StatusDialog *statdlg = new StatusDialog(this); |
4062 | if (!statdlg->exec()==QDialog::Accepted) return; | 4062 | if (!statdlg->exec()==QDialog::Accepted) return; |
4063 | me->setStatus( statdlg->status() ); | 4063 | me->setStatus( statdlg->status() ); |
4064 | delete(statdlg); | 4064 | delete(statdlg); |
4065 | } | 4065 | } |
4066 | Attendee *menew = new Attendee(*me); | 4066 | Attendee *menew = new Attendee(*me); |
4067 | if (ev) { | 4067 | if (ev) { |
4068 | ev->clearAttendees(); | 4068 | ev->clearAttendees(); |
4069 | ev->addAttendee(menew,false); | 4069 | ev->addAttendee(menew,false); |
4070 | } else { | 4070 | } else { |
4071 | if (to) { | 4071 | if (to) { |
4072 | todo->clearAttendees(); | 4072 | todo->clearAttendees(); |
4073 | todo->addAttendee(menew,false); | 4073 | todo->addAttendee(menew,false); |
4074 | } | 4074 | } |
4075 | } | 4075 | } |
4076 | } | 4076 | } |
4077 | 4077 | ||
4078 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 4078 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
4079 | if (ev) { | 4079 | if (ev) { |
4080 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 4080 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
4081 | } else { | 4081 | } else { |
4082 | if (to) { | 4082 | if (to) { |
4083 | if ( !dlg->addMessage(to,method) ) delete(to); | 4083 | if ( !dlg->addMessage(to,method) ) delete(to); |
4084 | } | 4084 | } |
4085 | } | 4085 | } |
4086 | } | 4086 | } |
4087 | 4087 | ||
4088 | void CalendarView::openAddressbook() | 4088 | void CalendarView::openAddressbook() |
4089 | { | 4089 | { |
4090 | KRun::runCommand("kaddressbook"); | 4090 | KRun::runCommand("kaddressbook"); |
4091 | } | 4091 | } |
4092 | 4092 | ||
4093 | void CalendarView::setModified(bool modified) | 4093 | void CalendarView::setModified(bool modified) |
4094 | { | 4094 | { |
4095 | //qDebug("CalendarView::setModified %d ", modified); | ||
4095 | if ( modified ) | 4096 | if ( modified ) |
4096 | emit signalmodified(); | 4097 | emit signalmodified(); |
4097 | if (mModified != modified) { | 4098 | mModified = modified; |
4098 | mModified = modified; | 4099 | if ( mModified ) |
4099 | emit modifiedChanged(mModified); | 4100 | emit modifiedChanged(mModified); |
4100 | } | 4101 | |
4101 | } | 4102 | } |
4102 | 4103 | ||
4103 | bool CalendarView::isReadOnly() | 4104 | bool CalendarView::isReadOnly() |
4104 | { | 4105 | { |
4105 | return mReadOnly; | 4106 | return mReadOnly; |
4106 | } | 4107 | } |
4107 | 4108 | ||
4108 | void CalendarView::setReadOnly(bool readOnly) | 4109 | void CalendarView::setReadOnly(bool readOnly) |
4109 | { | 4110 | { |
4110 | if (mReadOnly != readOnly) { | 4111 | if (mReadOnly != readOnly) { |
4111 | mReadOnly = readOnly; | 4112 | mReadOnly = readOnly; |
4112 | emit readOnlyChanged(mReadOnly); | 4113 | emit readOnlyChanged(mReadOnly); |
4113 | } | 4114 | } |
4114 | } | 4115 | } |
4115 | 4116 | ||
4116 | bool CalendarView::isModified() | 4117 | bool CalendarView::isModified() |
4117 | { | 4118 | { |
4118 | return mModified; | 4119 | return mModified; |
4119 | } | 4120 | } |
4120 | void CalendarView::slotprintSelInc() | 4121 | void CalendarView::slotprintSelInc() |
4121 | { | 4122 | { |
4122 | if ( currentSelection() == 0 ) { | 4123 | if ( currentSelection() == 0 ) { |
4123 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 4124 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
4124 | return; | 4125 | return; |
4125 | } | 4126 | } |
4126 | showIncidence(); | 4127 | showIncidence(); |
4127 | getEventViewerDialog()->print(); | 4128 | getEventViewerDialog()->print(); |
4128 | 4129 | ||
4129 | } | 4130 | } |
4130 | void CalendarView::printSetup() | 4131 | void CalendarView::printSetup() |
4131 | { | 4132 | { |
4132 | #ifndef KORG_NOPRINTER | 4133 | #ifndef KORG_NOPRINTER |
4133 | createPrinter(); | 4134 | createPrinter(); |
4134 | 4135 | ||
4135 | mCalPrinter->setupPrinter(); | 4136 | mCalPrinter->setupPrinter(); |
4136 | #endif | 4137 | #endif |
4137 | } | 4138 | } |
4138 | 4139 | ||
4139 | void CalendarView::print() | 4140 | void CalendarView::print() |
4140 | { | 4141 | { |
4141 | #ifndef KORG_NOPRINTER | 4142 | #ifndef KORG_NOPRINTER |
4142 | createPrinter(); | 4143 | createPrinter(); |
4143 | 4144 | ||
4144 | DateList tmpDateList = mNavigator->selectedDates(); | 4145 | DateList tmpDateList = mNavigator->selectedDates(); |
4145 | mCalPrinter->print(CalPrinter::Month, | 4146 | mCalPrinter->print(CalPrinter::Month, |
4146 | tmpDateList.first(), tmpDateList.last()); | 4147 | tmpDateList.first(), tmpDateList.last()); |
4147 | #endif | 4148 | #endif |
4148 | } | 4149 | } |
4149 | 4150 | ||
4150 | void CalendarView::printPreview() | 4151 | void CalendarView::printPreview() |
4151 | { | 4152 | { |
4152 | #ifndef KORG_NOPRINTER | 4153 | #ifndef KORG_NOPRINTER |
4153 | kdDebug() << "CalendarView::printPreview()" << endl; | 4154 | kdDebug() << "CalendarView::printPreview()" << endl; |
4154 | 4155 | ||
4155 | createPrinter(); | 4156 | createPrinter(); |
4156 | 4157 | ||
4157 | DateList tmpDateList = mNavigator->selectedDates(); | 4158 | DateList tmpDateList = mNavigator->selectedDates(); |
4158 | 4159 | ||
4159 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 4160 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
4160 | tmpDateList.last()); | 4161 | tmpDateList.last()); |
4161 | #endif | 4162 | #endif |
4162 | } | 4163 | } |
4163 | 4164 | ||
4164 | void CalendarView::exportICalendar() | 4165 | void CalendarView::exportICalendar() |
4165 | { | 4166 | { |
4166 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 4167 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
4167 | 4168 | ||
4168 | // Force correct extension | 4169 | // Force correct extension |
4169 | if (filename.right(4) != ".ics") filename += ".ics"; | 4170 | if (filename.right(4) != ".ics") filename += ".ics"; |
4170 | 4171 | ||
4171 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 4172 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
4172 | storage.save(); | 4173 | storage.save(); |
4173 | } | 4174 | } |
4174 | 4175 | ||
4175 | bool CalendarView::exportVCalendar( QString filename ) | 4176 | bool CalendarView::exportVCalendar( QString filename ) |
4176 | { | 4177 | { |
4177 | if (mCalendar->journals().count() > 0) { | 4178 | if (mCalendar->journals().count() > 0) { |
4178 | int result = KMessageBox::warningContinueCancel(this, | 4179 | int result = KMessageBox::warningContinueCancel(this, |
4179 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 4180 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
4180 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 4181 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
4181 | true); | 4182 | true); |
4182 | if (result != KMessageBox::Continue) return false; | 4183 | if (result != KMessageBox::Continue) return false; |
4183 | } | 4184 | } |
4184 | 4185 | ||
4185 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 4186 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
4186 | 4187 | ||
4187 | // Force correct extension | 4188 | // Force correct extension |
4188 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 4189 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
4189 | 4190 | ||
4190 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 4191 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
4191 | return storage.save(); | 4192 | return storage.save(); |
4192 | 4193 | ||
4193 | } | 4194 | } |
4194 | 4195 | ||
4195 | void CalendarView::eventUpdated(Incidence *) | 4196 | void CalendarView::eventUpdated(Incidence *) |
4196 | { | 4197 | { |
4197 | setModified(); | 4198 | setModified(); |
4198 | // Don't call updateView here. The code, which has caused the update of the | 4199 | // Don't call updateView here. The code, which has caused the update of the |
4199 | // event is responsible for updating the view. | 4200 | // event is responsible for updating the view. |
4200 | // updateView(); | 4201 | // updateView(); |
4201 | } | 4202 | } |
4202 | 4203 | ||
4203 | void CalendarView::adaptNavigationUnits() | 4204 | void CalendarView::adaptNavigationUnits() |
4204 | { | 4205 | { |
4205 | if (mViewManager->currentView()->isEventView()) { | 4206 | if (mViewManager->currentView()->isEventView()) { |
4206 | int days = mViewManager->currentView()->currentDateCount(); | 4207 | int days = mViewManager->currentView()->currentDateCount(); |
4207 | if (days == 1) { | 4208 | if (days == 1) { |
4208 | emit changeNavStringPrev(i18n("&Previous Day")); | 4209 | emit changeNavStringPrev(i18n("&Previous Day")); |
4209 | emit changeNavStringNext(i18n("&Next Day")); | 4210 | emit changeNavStringNext(i18n("&Next Day")); |
4210 | } else { | 4211 | } else { |
4211 | emit changeNavStringPrev(i18n("&Previous Week")); | 4212 | emit changeNavStringPrev(i18n("&Previous Week")); |
4212 | emit changeNavStringNext(i18n("&Next Week")); | 4213 | emit changeNavStringNext(i18n("&Next Week")); |
4213 | } | 4214 | } |
4214 | } | 4215 | } |
4215 | } | 4216 | } |
4216 | 4217 | ||
4217 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 4218 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
4218 | { | 4219 | { |
4219 | if ( incidence ) mTodoList->clearSelection(); | 4220 | if ( incidence ) mTodoList->clearSelection(); |
4220 | processIncidenceSelection( incidence ); | 4221 | processIncidenceSelection( incidence ); |
4221 | } | 4222 | } |
4222 | 4223 | ||
4223 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 4224 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
4224 | { | 4225 | { |
4225 | if ( incidence && mViewManager->currentView() ) { | 4226 | if ( incidence && mViewManager->currentView() ) { |
4226 | mViewManager->currentView()->clearSelection(); | 4227 | mViewManager->currentView()->clearSelection(); |
4227 | } | 4228 | } |
4228 | processIncidenceSelection( incidence ); | 4229 | processIncidenceSelection( incidence ); |
4229 | } | 4230 | } |
4230 | 4231 | ||
4231 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 4232 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
4232 | { | 4233 | { |
4233 | emit incidenceSelected( incidence ); | 4234 | emit incidenceSelected( incidence ); |
4234 | if ( incidence == mSelectedIncidence ) return; | 4235 | if ( incidence == mSelectedIncidence ) return; |
4235 | mSelectedIncidence = incidence; | 4236 | mSelectedIncidence = incidence; |
4236 | 4237 | ||
4237 | if ( incidence && incidence->typeID() == eventID ) { | 4238 | if ( incidence && incidence->typeID() == eventID ) { |
4238 | Event *event = static_cast<Event *>( incidence ); | 4239 | Event *event = static_cast<Event *>( incidence ); |
4239 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4240 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4240 | emit organizerEventsSelected( true ); | 4241 | emit organizerEventsSelected( true ); |
4241 | } else { | 4242 | } else { |
4242 | emit organizerEventsSelected(false); | 4243 | emit organizerEventsSelected(false); |
4243 | } | 4244 | } |
4244 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4245 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4245 | KOPrefs::instance()->email() ) ) { | 4246 | KOPrefs::instance()->email() ) ) { |
4246 | emit groupEventsSelected( true ); | 4247 | emit groupEventsSelected( true ); |
4247 | } else { | 4248 | } else { |
4248 | emit groupEventsSelected(false); | 4249 | emit groupEventsSelected(false); |
4249 | } | 4250 | } |
4250 | return; | 4251 | return; |
4251 | } else { | 4252 | } else { |
4252 | if ( incidence && incidence->typeID() == todoID ) { | 4253 | if ( incidence && incidence->typeID() == todoID ) { |
4253 | emit todoSelected( true ); | 4254 | emit todoSelected( true ); |
4254 | Todo *event = static_cast<Todo *>( incidence ); | 4255 | Todo *event = static_cast<Todo *>( incidence ); |
4255 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4256 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4256 | emit organizerEventsSelected( true ); | 4257 | emit organizerEventsSelected( true ); |
4257 | } else { | 4258 | } else { |
4258 | emit organizerEventsSelected(false); | 4259 | emit organizerEventsSelected(false); |
4259 | } | 4260 | } |
4260 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4261 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4261 | KOPrefs::instance()->email() ) ) { | 4262 | KOPrefs::instance()->email() ) ) { |
4262 | emit groupEventsSelected( true ); | 4263 | emit groupEventsSelected( true ); |
4263 | } else { | 4264 | } else { |
4264 | emit groupEventsSelected(false); | 4265 | emit groupEventsSelected(false); |
4265 | } | 4266 | } |
4266 | return; | 4267 | return; |
4267 | } else { | 4268 | } else { |
4268 | emit todoSelected( false ); | 4269 | emit todoSelected( false ); |
4269 | emit organizerEventsSelected(false); | 4270 | emit organizerEventsSelected(false); |
4270 | emit groupEventsSelected(false); | 4271 | emit groupEventsSelected(false); |
4271 | } | 4272 | } |
4272 | return; | 4273 | return; |
4273 | } | 4274 | } |
4274 | 4275 | ||
4275 | /* if ( incidence && incidence->typeID() == todoID ) { | 4276 | /* if ( incidence && incidence->typeID() == todoID ) { |
4276 | emit todoSelected( true ); | 4277 | emit todoSelected( true ); |
4277 | } else { | 4278 | } else { |
4278 | emit todoSelected( false ); | 4279 | emit todoSelected( false ); |
4279 | }*/ | 4280 | }*/ |
4280 | } | 4281 | } |
4281 | 4282 | ||
4282 | 4283 | ||
4283 | void CalendarView::checkClipboard() | 4284 | void CalendarView::checkClipboard() |
4284 | { | 4285 | { |
4285 | #ifndef KORG_NODND | 4286 | #ifndef KORG_NODND |
4286 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 4287 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
4287 | emit pasteEnabled(true); | 4288 | emit pasteEnabled(true); |
4288 | } else { | 4289 | } else { |
4289 | emit pasteEnabled(false); | 4290 | emit pasteEnabled(false); |
4290 | } | 4291 | } |
4291 | #endif | 4292 | #endif |
4292 | } | 4293 | } |
4293 | 4294 | ||
4294 | void CalendarView::showDates(const DateList &selectedDates) | 4295 | void CalendarView::showDates(const DateList &selectedDates) |
4295 | { | 4296 | { |
4296 | // kdDebug() << "CalendarView::selectDates()" << endl; | 4297 | // kdDebug() << "CalendarView::selectDates()" << endl; |
4297 | 4298 | ||
4298 | 4299 | ||
4299 | if ( !mBlockShowDates ) { | 4300 | if ( !mBlockShowDates ) { |
4300 | if ( mViewManager->currentView() ) { | 4301 | if ( mViewManager->currentView() ) { |
4301 | updateView( selectedDates.first(), selectedDates.last() ); | 4302 | updateView( selectedDates.first(), selectedDates.last() ); |
4302 | } else { | 4303 | } else { |
4303 | mViewManager->showAgendaView(); | 4304 | mViewManager->showAgendaView(); |
4304 | } | 4305 | } |
4305 | } | 4306 | } |
4306 | 4307 | ||
4307 | QDate date = selectedDates.first(); | 4308 | QDate date = selectedDates.first(); |
4308 | if ( ! date.isValid() ) { | 4309 | if ( ! date.isValid() ) { |
4309 | topLevelWidget()->setCaption(""); | 4310 | topLevelWidget()->setCaption(""); |
4310 | return; | 4311 | return; |
4311 | } | 4312 | } |
4312 | 4313 | ||
4313 | QString selDates; | 4314 | QString selDates; |
4314 | selDates = KGlobal::locale()->formatDate( date, true); | 4315 | selDates = KGlobal::locale()->formatDate( date, true); |
4315 | if (selectedDates.first() < selectedDates.last() ) | 4316 | if (selectedDates.first() < selectedDates.last() ) |
4316 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 4317 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
4317 | else { | 4318 | else { |
4318 | QString addString; | 4319 | QString addString; |
4319 | if ( date == QDateTime::currentDateTime().date() ) | 4320 | if ( date == QDateTime::currentDateTime().date() ) |
4320 | addString = i18n("Today"); | 4321 | addString = i18n("Today"); |
4321 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 4322 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
4322 | addString = i18n("Tomorrow"); | 4323 | addString = i18n("Tomorrow"); |
4323 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 4324 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
4324 | addString = i18n("Yesterday"); | 4325 | addString = i18n("Yesterday"); |
4325 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 4326 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
4326 | addString = i18n("Day before yesterday"); | 4327 | addString = i18n("Day before yesterday"); |
4327 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 4328 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
4328 | addString = i18n("Day after tomorrow"); | 4329 | addString = i18n("Day after tomorrow"); |
4329 | if ( !addString.isEmpty() ) { | 4330 | if ( !addString.isEmpty() ) { |
4330 | topLevelWidget()->setCaption( addString+", " + selDates ); | 4331 | topLevelWidget()->setCaption( addString+", " + selDates ); |
4331 | return; | 4332 | return; |
4332 | } | 4333 | } |
4333 | } | 4334 | } |
4334 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 4335 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
4335 | 4336 | ||
4336 | } | 4337 | } |
4337 | 4338 | ||
4338 | QPtrList<CalFilter> CalendarView::filters() | 4339 | QPtrList<CalFilter> CalendarView::filters() |
4339 | { | 4340 | { |
4340 | return mFilters; | 4341 | return mFilters; |
4341 | 4342 | ||
4342 | } | 4343 | } |
4343 | void CalendarView::editFilters() | 4344 | void CalendarView::editFilters() |
4344 | { | 4345 | { |
4345 | // kdDebug() << "CalendarView::editFilters()" << endl; | 4346 | // kdDebug() << "CalendarView::editFilters()" << endl; |
4346 | 4347 | ||
4347 | CalFilter *filter = mFilters.first(); | 4348 | CalFilter *filter = mFilters.first(); |
4348 | while(filter) { | 4349 | while(filter) { |
4349 | filter = mFilters.next(); | 4350 | filter = mFilters.next(); |
4350 | } | 4351 | } |
4351 | 4352 | ||
4352 | mDialogManager->showFilterEditDialog(&mFilters); | 4353 | mDialogManager->showFilterEditDialog(&mFilters); |
4353 | updateFilter(); | 4354 | updateFilter(); |
4354 | } | 4355 | } |
4355 | void CalendarView::toggleFilter() | 4356 | void CalendarView::toggleFilter() |
4356 | { | 4357 | { |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 279955f..77d0ac8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1661,601 +1661,609 @@ void MainWindow::aboutAutoSaving() | |||
1661 | } | 1661 | } |
1662 | void MainWindow::aboutKnownBugs() | 1662 | void MainWindow::aboutKnownBugs() |
1663 | { | 1663 | { |
1664 | QMessageBox* msg; | 1664 | QMessageBox* msg; |
1665 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1665 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1666 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1666 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1667 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1667 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1668 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1668 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1669 | i18n("\nor report them in the bugtracker on\n") + | 1669 | i18n("\nor report them in the bugtracker on\n") + |
1670 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1670 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1671 | QMessageBox::NoIcon, | 1671 | QMessageBox::NoIcon, |
1672 | QMessageBox::Ok, | 1672 | QMessageBox::Ok, |
1673 | QMessageBox::NoButton, | 1673 | QMessageBox::NoButton, |
1674 | QMessageBox::NoButton); | 1674 | QMessageBox::NoButton); |
1675 | msg->exec(); | 1675 | msg->exec(); |
1676 | delete msg; | 1676 | delete msg; |
1677 | 1677 | ||
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | QString MainWindow::defaultFileName() | 1680 | QString MainWindow::defaultFileName() |
1681 | { | 1681 | { |
1682 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1682 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1683 | } | 1683 | } |
1684 | QString MainWindow::syncFileName() | 1684 | QString MainWindow::syncFileName() |
1685 | { | 1685 | { |
1686 | #ifdef DESKTOP_VERSION | 1686 | #ifdef DESKTOP_VERSION |
1687 | return locateLocal( "tmp", "synccalendar.ics" ); | 1687 | return locateLocal( "tmp", "synccalendar.ics" ); |
1688 | #else | 1688 | #else |
1689 | return QString( "/tmp/synccalendar.ics" ); | 1689 | return QString( "/tmp/synccalendar.ics" ); |
1690 | #endif | 1690 | #endif |
1691 | } | 1691 | } |
1692 | #include "koglobals.h" | 1692 | #include "koglobals.h" |
1693 | #include <kcalendarsystem.h> | 1693 | #include <kcalendarsystem.h> |
1694 | void MainWindow::updateWeek(QDate seda) | 1694 | void MainWindow::updateWeek(QDate seda) |
1695 | { | 1695 | { |
1696 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1696 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1697 | mWeekPixmap.fill( mWeekBgColor ); | 1697 | mWeekPixmap.fill( mWeekBgColor ); |
1698 | QPainter p ( &mWeekPixmap ); | 1698 | QPainter p ( &mWeekPixmap ); |
1699 | p.setFont( mWeekFont ); | 1699 | p.setFont( mWeekFont ); |
1700 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1700 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1701 | p.end(); | 1701 | p.end(); |
1702 | QIconSet icon3 ( mWeekPixmap ); | 1702 | QIconSet icon3 ( mWeekPixmap ); |
1703 | mWeekAction->setIconSet ( icon3 ); | 1703 | mWeekAction->setIconSet ( icon3 ); |
1704 | 1704 | ||
1705 | } | 1705 | } |
1706 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1706 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1707 | { | 1707 | { |
1708 | updateWeek( selectedDates.first() ); | 1708 | updateWeek( selectedDates.first() ); |
1709 | } | 1709 | } |
1710 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1710 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1711 | { | 1711 | { |
1712 | if ( !incidence ) { | 1712 | if ( !incidence ) { |
1713 | mShowAction->setMenuText( i18n("Show") ); | 1713 | mShowAction->setMenuText( i18n("Show") ); |
1714 | enableIncidenceActions( false ); | 1714 | enableIncidenceActions( false ); |
1715 | mNewSubTodoAction->setEnabled( false ); | 1715 | mNewSubTodoAction->setEnabled( false ); |
1716 | setCaptionToDates(); | 1716 | setCaptionToDates(); |
1717 | return; | 1717 | return; |
1718 | } | 1718 | } |
1719 | QString startString = ""; | 1719 | QString startString = ""; |
1720 | if ( incidence->typeID() != todoID ) { | 1720 | if ( incidence->typeID() != todoID ) { |
1721 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1721 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1722 | if ( incidence->doesFloat() ) { | 1722 | if ( incidence->doesFloat() ) { |
1723 | startString += ": "+incidence->dtStartDateStr( true ); | 1723 | startString += ": "+incidence->dtStartDateStr( true ); |
1724 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1724 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1725 | } else { | 1725 | } else { |
1726 | startString = ": "+incidence->dtStartStr(true); | 1726 | startString = ": "+incidence->dtStartStr(true); |
1727 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1727 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1728 | } | 1728 | } |
1729 | } else { | 1729 | } else { |
1730 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1730 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1731 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1731 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1732 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1732 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1733 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1733 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1734 | bool ok; | 1734 | bool ok; |
1735 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1735 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1736 | if ( ok ) { | 1736 | if ( ok ) { |
1737 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1737 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1738 | startString += i18n(" (%1 y.)"). arg( years ); | 1738 | startString += i18n(" (%1 y.)"). arg( years ); |
1739 | } | 1739 | } |
1740 | } | 1740 | } |
1741 | else | 1741 | else |
1742 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1742 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1743 | } | 1743 | } |
1744 | } | 1744 | } |
1745 | else { | 1745 | else { |
1746 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1746 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1747 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1747 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1748 | else | 1748 | else |
1749 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1749 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1750 | } | 1750 | } |
1751 | if ( !incidence->location().isEmpty() ) | 1751 | if ( !incidence->location().isEmpty() ) |
1752 | startString += " (" +incidence->location()+")"; | 1752 | startString += " (" +incidence->location()+")"; |
1753 | setCaption( incidence->summary()+startString); | 1753 | setCaption( incidence->summary()+startString); |
1754 | enableIncidenceActions( true ); | 1754 | enableIncidenceActions( true ); |
1755 | if ( incidence->typeID() == eventID ) { | 1755 | if ( incidence->typeID() == eventID ) { |
1756 | mShowAction->setMenuText( i18n("Show Event") ); | 1756 | mShowAction->setMenuText( i18n("Show Event") ); |
1757 | mNewSubTodoAction->setEnabled( false ); | 1757 | mNewSubTodoAction->setEnabled( false ); |
1758 | } else if ( incidence->typeID() == todoID ) { | 1758 | } else if ( incidence->typeID() == todoID ) { |
1759 | mShowAction->setMenuText( i18n("Show Todo") ); | 1759 | mShowAction->setMenuText( i18n("Show Todo") ); |
1760 | mNewSubTodoAction->setEnabled( true ); | 1760 | mNewSubTodoAction->setEnabled( true ); |
1761 | } else { | 1761 | } else { |
1762 | mShowAction->setMenuText( i18n("Show") ); | 1762 | mShowAction->setMenuText( i18n("Show") ); |
1763 | mNewSubTodoAction->setEnabled( false ); | 1763 | mNewSubTodoAction->setEnabled( false ); |
1764 | } | 1764 | } |
1765 | static QPixmap jP = SmallIcon( "journal" ); | 1765 | static QPixmap jP = SmallIcon( "journal" ); |
1766 | static QPixmap eP = SmallIcon( "newevent" ); | 1766 | static QPixmap eP = SmallIcon( "newevent" ); |
1767 | static QPixmap tP = SmallIcon( "newtodo" ); | 1767 | static QPixmap tP = SmallIcon( "newtodo" ); |
1768 | #ifdef DESKTOP_VERSION | 1768 | #ifdef DESKTOP_VERSION |
1769 | QIconSet icon; | 1769 | QIconSet icon; |
1770 | if ( incidence->typeID() == todoID ) | 1770 | if ( incidence->typeID() == todoID ) |
1771 | icon = QIconSet ( tP ); | 1771 | icon = QIconSet ( tP ); |
1772 | else if ( incidence->typeID() == eventID ) | 1772 | else if ( incidence->typeID() == eventID ) |
1773 | icon = QIconSet ( eP ); | 1773 | icon = QIconSet ( eP ); |
1774 | else if ( incidence->typeID() == journalID ) | 1774 | else if ( incidence->typeID() == journalID ) |
1775 | icon = QIconSet ( jP ); | 1775 | icon = QIconSet ( jP ); |
1776 | mPrintSelAction->setIconSet ( icon ); | 1776 | mPrintSelAction->setIconSet ( icon ); |
1777 | #endif | 1777 | #endif |
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | void MainWindow::enableIncidenceActions( bool enabled ) | 1780 | void MainWindow::enableIncidenceActions( bool enabled ) |
1781 | { | 1781 | { |
1782 | mShowAction->setEnabled( enabled ); | 1782 | mShowAction->setEnabled( enabled ); |
1783 | mEditAction->setEnabled( enabled ); | 1783 | mEditAction->setEnabled( enabled ); |
1784 | mDeleteAction->setEnabled( enabled ); | 1784 | mDeleteAction->setEnabled( enabled ); |
1785 | 1785 | ||
1786 | mCloneAction->setEnabled( enabled ); | 1786 | mCloneAction->setEnabled( enabled ); |
1787 | mMoveAction->setEnabled( enabled ); | 1787 | mMoveAction->setEnabled( enabled ); |
1788 | #ifndef DESKTOP_VERSION | 1788 | #ifndef DESKTOP_VERSION |
1789 | mBeamAction->setEnabled( enabled ); | 1789 | mBeamAction->setEnabled( enabled ); |
1790 | #else | 1790 | #else |
1791 | mPrintSelAction->setEnabled( enabled ); | 1791 | mPrintSelAction->setEnabled( enabled ); |
1792 | #endif | 1792 | #endif |
1793 | mCancelAction->setEnabled( enabled ); | 1793 | mCancelAction->setEnabled( enabled ); |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | void MainWindow::importOL() | 1796 | void MainWindow::importOL() |
1797 | { | 1797 | { |
1798 | #ifdef _OL_IMPORT_ | 1798 | #ifdef _OL_IMPORT_ |
1799 | mView->clearAllViews(); | 1799 | mView->clearAllViews(); |
1800 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1800 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1801 | id->exec(); | 1801 | id->exec(); |
1802 | delete id; | 1802 | delete id; |
1803 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1803 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1804 | mView->updateView(); | 1804 | mView->updateView(); |
1805 | #endif | 1805 | #endif |
1806 | } | 1806 | } |
1807 | void MainWindow::importBday() | 1807 | void MainWindow::importBday() |
1808 | { | 1808 | { |
1809 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1809 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1810 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1810 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1811 | i18n("Import!"), i18n("Cancel"), 0, | 1811 | i18n("Import!"), i18n("Cancel"), 0, |
1812 | 0, 1 ); | 1812 | 0, 1 ); |
1813 | if ( result == 0 ) { | 1813 | if ( result == 0 ) { |
1814 | mView->importBday(); | 1814 | mView->importBday(); |
1815 | 1815 | ||
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | 1818 | ||
1819 | } | 1819 | } |
1820 | void MainWindow::importQtopia() | 1820 | void MainWindow::importQtopia() |
1821 | { | 1821 | { |
1822 | //#ifndef DESKTOP_VERSION | 1822 | //#ifndef DESKTOP_VERSION |
1823 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1823 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1824 | #ifdef DESKTOP_VERSION | 1824 | #ifdef DESKTOP_VERSION |
1825 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1825 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1826 | #endif | 1826 | #endif |
1827 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1827 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1828 | i18n("Import!"), i18n("Cancel"), 0, | 1828 | i18n("Import!"), i18n("Cancel"), 0, |
1829 | 0, 1 ); | 1829 | 0, 1 ); |
1830 | if ( result == 0 ) { | 1830 | if ( result == 0 ) { |
1831 | #ifndef DESKTOP_VERSION | 1831 | #ifndef DESKTOP_VERSION |
1832 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1832 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1833 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1833 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1834 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1834 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1835 | #else | 1835 | #else |
1836 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1836 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1837 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1837 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1838 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1838 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1839 | #endif | 1839 | #endif |
1840 | mView->importQtopia( categories, datebook, todolist ); | 1840 | mView->importQtopia( categories, datebook, todolist ); |
1841 | } | 1841 | } |
1842 | mView->calendar()->reInitAlarmSettings(); | 1842 | mView->calendar()->reInitAlarmSettings(); |
1843 | #if 0 | 1843 | #if 0 |
1844 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1844 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1845 | i18n("Not supported \non desktop!\n"), | 1845 | i18n("Not supported \non desktop!\n"), |
1846 | i18n("Ok"), i18n("Cancel"), 0, | 1846 | i18n("Ok"), i18n("Cancel"), 0, |
1847 | 0, 1 ); | 1847 | 0, 1 ); |
1848 | 1848 | ||
1849 | #endif | 1849 | #endif |
1850 | } | 1850 | } |
1851 | 1851 | ||
1852 | void MainWindow::saveOnClose() | 1852 | void MainWindow::saveOnClose() |
1853 | { | 1853 | { |
1854 | KOPrefs *p = KOPrefs::instance(); | 1854 | KOPrefs *p = KOPrefs::instance(); |
1855 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1855 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1856 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1856 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1857 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1857 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1858 | if ( filterToolBar ) { | 1858 | if ( filterToolBar ) { |
1859 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1859 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1860 | } | 1860 | } |
1861 | #ifdef DESKTOP_VERSION | 1861 | #ifdef DESKTOP_VERSION |
1862 | 1862 | ||
1863 | QPoint myP; | 1863 | QPoint myP; |
1864 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1864 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1865 | if ( p->mToolBarHor ) | 1865 | if ( p->mToolBarHor ) |
1866 | p->mToolBarUp = myP.y() > height()/2; | 1866 | p->mToolBarUp = myP.y() > height()/2; |
1867 | else | 1867 | else |
1868 | p->mToolBarUp = myP.x() > width()/2; | 1868 | p->mToolBarUp = myP.x() > width()/2; |
1869 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1869 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1870 | if ( p->mToolBarHorV ) | 1870 | if ( p->mToolBarHorV ) |
1871 | p->mToolBarUpV = myP.y() > height()/2; | 1871 | p->mToolBarUpV = myP.y() > height()/2; |
1872 | else | 1872 | else |
1873 | p->mToolBarUpV = myP.x() > width()/2 ; | 1873 | p->mToolBarUpV = myP.x() > width()/2 ; |
1874 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1874 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1875 | if ( p->mToolBarHorN ) | 1875 | if ( p->mToolBarHorN ) |
1876 | p->mToolBarUpN = myP.y() > height()/2; | 1876 | p->mToolBarUpN = myP.y() > height()/2; |
1877 | else | 1877 | else |
1878 | p->mToolBarUpN = myP.x() > width()/2 ; | 1878 | p->mToolBarUpN = myP.x() > width()/2 ; |
1879 | if ( filterToolBar ) { | 1879 | if ( filterToolBar ) { |
1880 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1880 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1881 | if ( p->mToolBarHorF ) | 1881 | if ( p->mToolBarHorF ) |
1882 | p->mToolBarUpF = myP.y() > height()/2; | 1882 | p->mToolBarUpF = myP.y() > height()/2; |
1883 | else | 1883 | else |
1884 | p->mToolBarUpF = myP.x() > width()/2 ; | 1884 | p->mToolBarUpF = myP.x() > width()/2 ; |
1885 | } | 1885 | } |
1886 | #else | 1886 | #else |
1887 | if ( p->mToolBarHor ) | 1887 | if ( p->mToolBarHor ) |
1888 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1888 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1889 | else | 1889 | else |
1890 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1890 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1891 | if ( p->mToolBarHorV ) | 1891 | if ( p->mToolBarHorV ) |
1892 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1892 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1893 | else | 1893 | else |
1894 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1894 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1895 | 1895 | ||
1896 | if ( p->mToolBarHorN ) | 1896 | if ( p->mToolBarHorN ) |
1897 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1897 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1898 | else | 1898 | else |
1899 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1899 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1900 | if ( filterToolBar ) { | 1900 | if ( filterToolBar ) { |
1901 | if ( p->mToolBarHorF ) | 1901 | if ( p->mToolBarHorF ) |
1902 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1902 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1903 | else | 1903 | else |
1904 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1904 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1905 | } | 1905 | } |
1906 | #endif | 1906 | #endif |
1907 | save(); | 1907 | save(); |
1908 | mView->writeSettings(); | 1908 | mView->writeSettings(); |
1909 | mView->checkSuspendAlarm(); | 1909 | mView->checkSuspendAlarm(); |
1910 | } | 1910 | } |
1911 | void MainWindow::slotModifiedChanged( bool ) | 1911 | void MainWindow::slotModifiedChanged( bool ) |
1912 | { | 1912 | { |
1913 | if ( mBlockAtStartup ) | 1913 | if ( mBlockAtStartup ) |
1914 | return; | 1914 | return; |
1915 | 1915 | ||
1916 | int msec; | 1916 | int msec; |
1917 | if ( mCalendarModifiedFlag ) { | ||
1918 | //qDebug(" MainWindow timer is running "); | ||
1919 | return; | ||
1920 | } | ||
1917 | // we store the changes after 1 minute, | 1921 | // we store the changes after 1 minute, |
1918 | // and for safety reasons after 10 minutes again | 1922 | // and for safety reasons after 10 minutes again |
1919 | if ( !mSyncManager->blockSave() ) | 1923 | if ( !mSyncManager->blockSave() ) |
1920 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1924 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1921 | else | 1925 | else |
1922 | msec = 1000 * 600; | 1926 | msec = 1000 * 600; |
1923 | mSaveTimer.start( msec, true ); // 1 minute | 1927 | mSaveTimer.start( msec, true ); // 1 minute |
1924 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1928 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1925 | mCalendarModifiedFlag = true; | 1929 | mCalendarModifiedFlag = true; |
1926 | } | 1930 | } |
1927 | void MainWindow::saveStopTimer() | 1931 | void MainWindow::saveStopTimer() |
1928 | { | 1932 | { |
1929 | mSaveTimer.stop(); | 1933 | mSaveTimer.stop(); |
1930 | } | 1934 | } |
1931 | void MainWindow::backupAllFiles() | 1935 | void MainWindow::backupAllFiles() |
1932 | { | 1936 | { |
1933 | QDate reference ( 2000,1,1); | 1937 | QDate reference ( 2000,1,1); |
1934 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1938 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1935 | setCaption(i18n("Creating backup ... please wait ..." )); | 1939 | setCaption(i18n("Creating backup ... please wait ..." )); |
1936 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1940 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1937 | // we need the file path, the backup dir and the number of bups as param | 1941 | // we need the file path, the backup dir and the number of bups as param |
1938 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1942 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1939 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1943 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1940 | bupDir = KGlobalSettings::backupDataDir(); | 1944 | bupDir = KGlobalSettings::backupDataDir(); |
1941 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1945 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1942 | if ( retval == 0 ) { | 1946 | if ( retval == 0 ) { |
1943 | setCaption(i18n("Backup cancelled" )); | 1947 | setCaption(i18n("Backup cancelled" )); |
1944 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1948 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1945 | // retval == 0 : backup skipped for today, try again tomorrow | 1949 | // retval == 0 : backup skipped for today, try again tomorrow |
1946 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1950 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1947 | } else if ( retval == 1 ){ | 1951 | } else if ( retval == 1 ){ |
1948 | qDebug("KO: Backup created."); | 1952 | qDebug("KO: Backup created."); |
1949 | // backup ok | 1953 | // backup ok |
1950 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1954 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1951 | KopiCalendarFile * cal = calendars.first(); | 1955 | KopiCalendarFile * cal = calendars.first(); |
1952 | cal = calendars.next(); | 1956 | cal = calendars.next(); |
1953 | while ( cal ) { | 1957 | while ( cal ) { |
1954 | if ( !cal->mErrorOnLoad ) { | 1958 | if ( !cal->mErrorOnLoad ) { |
1955 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1959 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1956 | } | 1960 | } |
1957 | cal = calendars.next(); | 1961 | cal = calendars.next(); |
1958 | } | 1962 | } |
1959 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1963 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1960 | setCaption(i18n("Backup succesfully finished" )); | 1964 | setCaption(i18n("Backup succesfully finished" )); |
1961 | } else if ( retval == 2 ){ | 1965 | } else if ( retval == 2 ){ |
1962 | setCaption(i18n("Backup globally disabled" )); | 1966 | setCaption(i18n("Backup globally disabled" )); |
1963 | qDebug("KO: Backup globally cancelled."); | 1967 | qDebug("KO: Backup globally cancelled."); |
1964 | // backup globally cancelled | 1968 | // backup globally cancelled |
1965 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1969 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1966 | } | 1970 | } |
1967 | // retval == 3: do nothing, try again later | 1971 | // retval == 3: do nothing, try again later |
1968 | } | 1972 | } |
1969 | void MainWindow::save() | 1973 | void MainWindow::save() |
1970 | { | 1974 | { |
1971 | 1975 | ||
1972 | if ( mView->viewManager()->journalView() ) | 1976 | if ( mView->viewManager()->journalView() ) |
1973 | mView->viewManager()->journalView()->checkModified(); | 1977 | mView->viewManager()->journalView()->checkModified(); |
1974 | if ( !mCalendarModifiedFlag ) { | 1978 | if ( !mCalendarModifiedFlag ) { |
1975 | qDebug("KO: Calendar not modified. Nothing saved."); | 1979 | qDebug("KO: Calendar not modified. Nothing saved."); |
1976 | return; | 1980 | return; |
1977 | } | 1981 | } |
1978 | if ( mSyncManager->blockSave() ) | 1982 | if ( mSyncManager->blockSave() ) { |
1979 | return; | 1983 | return; |
1984 | } | ||
1980 | mSyncManager->setBlockSave(true); | 1985 | mSyncManager->setBlockSave(true); |
1981 | if ( mView->checkAllFileVersions() ) { | 1986 | if ( mView->checkAllFileVersions() ) { |
1982 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1987 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1983 | QDate reference ( 2000,1,1); | 1988 | QDate reference ( 2000,1,1); |
1984 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1989 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1985 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1990 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1986 | backupAllFiles(); | 1991 | backupAllFiles(); |
1987 | } | 1992 | } |
1988 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1993 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1989 | } | 1994 | } |
1990 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1995 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1991 | if ( !isMinimized () ) | 1996 | if ( !isMinimized () ) |
1992 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1997 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1993 | qDebug("KO: Start saving data to file!"); | 1998 | qDebug("KO: Start saving data to file!"); |
1994 | mView->saveCalendars(); | 1999 | mView->saveCalendars(); |
1995 | mCalendarModifiedFlag = false; | 2000 | mCalendarModifiedFlag = false; |
1996 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 2001 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1997 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2002 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1998 | QString savemes; | 2003 | QString savemes; |
1999 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 2004 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
2000 | if ( !isMinimized () ) | 2005 | if ( !isMinimized () ) |
2001 | setCaption(savemes); | 2006 | setCaption(savemes); |
2002 | else | 2007 | else |
2003 | qDebug(savemes); | 2008 | qDebug(savemes); |
2004 | } else | 2009 | } else { |
2005 | setCaption(i18n("Saving cancelled!")); | 2010 | setCaption(i18n("Saving cancelled!")); |
2011 | mCalendarModifiedFlag = false; | ||
2012 | slotModifiedChanged( true ); | ||
2013 | } | ||
2006 | mSyncManager->setBlockSave( false ); | 2014 | mSyncManager->setBlockSave( false ); |
2007 | } | 2015 | } |
2008 | 2016 | ||
2009 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2017 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2010 | { | 2018 | { |
2011 | if ( !e->isAutoRepeat() ) { | 2019 | if ( !e->isAutoRepeat() ) { |
2012 | mFlagKeyPressed = false; | 2020 | mFlagKeyPressed = false; |
2013 | } | 2021 | } |
2014 | } | 2022 | } |
2015 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2023 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2016 | { | 2024 | { |
2017 | qApp->processEvents(); | 2025 | qApp->processEvents(); |
2018 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2026 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2019 | e->ignore(); | 2027 | e->ignore(); |
2020 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2028 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2021 | return; | 2029 | return; |
2022 | } | 2030 | } |
2023 | if (! e->isAutoRepeat() ) | 2031 | if (! e->isAutoRepeat() ) |
2024 | mFlagKeyPressed = true; | 2032 | mFlagKeyPressed = true; |
2025 | KOPrefs *p = KOPrefs::instance(); | 2033 | KOPrefs *p = KOPrefs::instance(); |
2026 | bool showSelectedDates = false; | 2034 | bool showSelectedDates = false; |
2027 | int size; | 2035 | int size; |
2028 | int pro = 0; | 2036 | int pro = 0; |
2029 | //qDebug("MainWindow::keyPressEvent "); | 2037 | //qDebug("MainWindow::keyPressEvent "); |
2030 | switch ( e->key() ) { | 2038 | switch ( e->key() ) { |
2031 | case Qt::Key_Right: | 2039 | case Qt::Key_Right: |
2032 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2040 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2033 | mView->goNextMonth(); | 2041 | mView->goNextMonth(); |
2034 | else | 2042 | else |
2035 | mView->goNext(); | 2043 | mView->goNext(); |
2036 | showSelectedDates = true; | 2044 | showSelectedDates = true; |
2037 | break; | 2045 | break; |
2038 | case Qt::Key_Left: | 2046 | case Qt::Key_Left: |
2039 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2047 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2040 | mView->goPreviousMonth(); | 2048 | mView->goPreviousMonth(); |
2041 | else | 2049 | else |
2042 | mView->goPrevious(); | 2050 | mView->goPrevious(); |
2043 | showSelectedDates = true; | 2051 | showSelectedDates = true; |
2044 | break; | 2052 | break; |
2045 | case Qt::Key_Down: | 2053 | case Qt::Key_Down: |
2046 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2054 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2047 | break; | 2055 | break; |
2048 | case Qt::Key_Up: | 2056 | case Qt::Key_Up: |
2049 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2057 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2050 | break; | 2058 | break; |
2051 | case Qt::Key_K: | 2059 | case Qt::Key_K: |
2052 | mView->viewManager()->showMonthViewWeek(); | 2060 | mView->viewManager()->showMonthViewWeek(); |
2053 | break; | 2061 | break; |
2054 | case Qt::Key_I: | 2062 | case Qt::Key_I: |
2055 | mView->showIncidence(); | 2063 | mView->showIncidence(); |
2056 | break; | 2064 | break; |
2057 | case Qt::Key_Delete: | 2065 | case Qt::Key_Delete: |
2058 | case Qt::Key_Backspace: | 2066 | case Qt::Key_Backspace: |
2059 | mView->deleteIncidence(); | 2067 | mView->deleteIncidence(); |
2060 | break; | 2068 | break; |
2061 | case Qt::Key_D: | 2069 | case Qt::Key_D: |
2062 | mView->viewManager()->showDayView(); | 2070 | mView->viewManager()->showDayView(); |
2063 | showSelectedDates = true; | 2071 | showSelectedDates = true; |
2064 | break; | 2072 | break; |
2065 | case Qt::Key_O: | 2073 | case Qt::Key_O: |
2066 | mView->toggleFilerEnabled( ); | 2074 | mView->toggleFilerEnabled( ); |
2067 | break; | 2075 | break; |
2068 | case Qt::Key_0: | 2076 | case Qt::Key_0: |
2069 | case Qt::Key_1: | 2077 | case Qt::Key_1: |
2070 | case Qt::Key_2: | 2078 | case Qt::Key_2: |
2071 | case Qt::Key_3: | 2079 | case Qt::Key_3: |
2072 | case Qt::Key_4: | 2080 | case Qt::Key_4: |
2073 | case Qt::Key_5: | 2081 | case Qt::Key_5: |
2074 | case Qt::Key_6: | 2082 | case Qt::Key_6: |
2075 | case Qt::Key_7: | 2083 | case Qt::Key_7: |
2076 | case Qt::Key_8: | 2084 | case Qt::Key_8: |
2077 | case Qt::Key_9: | 2085 | case Qt::Key_9: |
2078 | pro = e->key()-48; | 2086 | pro = e->key()-48; |
2079 | if ( pro == 0 ) | 2087 | if ( pro == 0 ) |
2080 | pro = 10; | 2088 | pro = 10; |
2081 | if ( e->state() == Qt::ControlButton) | 2089 | if ( e->state() == Qt::ControlButton) |
2082 | pro += 10; | 2090 | pro += 10; |
2083 | break; | 2091 | break; |
2084 | case Qt::Key_M: | 2092 | case Qt::Key_M: |
2085 | mView->viewManager()->showMonthView(); | 2093 | mView->viewManager()->showMonthView(); |
2086 | showSelectedDates = true; | 2094 | showSelectedDates = true; |
2087 | break; | 2095 | break; |
2088 | case Qt::Key_Insert: | 2096 | case Qt::Key_Insert: |
2089 | mView->newEvent(); | 2097 | mView->newEvent(); |
2090 | break; | 2098 | break; |
2091 | case Qt::Key_S : | 2099 | case Qt::Key_S : |
2092 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2100 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2093 | mView->newSubTodo(); | 2101 | mView->newSubTodo(); |
2094 | else | 2102 | else |
2095 | mView->dialogManager()->showSearchDialog(); | 2103 | mView->dialogManager()->showSearchDialog(); |
2096 | break; | 2104 | break; |
2097 | case Qt::Key_Y : | 2105 | case Qt::Key_Y : |
2098 | case Qt::Key_Z : | 2106 | case Qt::Key_Z : |
2099 | mView->viewManager()->showWorkWeekView(); | 2107 | mView->viewManager()->showWorkWeekView(); |
2100 | showSelectedDates = true; | 2108 | showSelectedDates = true; |
2101 | break; | 2109 | break; |
2102 | case Qt::Key_U : | 2110 | case Qt::Key_U : |
2103 | mView->viewManager()->showWeekView(); | 2111 | mView->viewManager()->showWeekView(); |
2104 | showSelectedDates = true; | 2112 | showSelectedDates = true; |
2105 | break; | 2113 | break; |
2106 | case Qt::Key_H : | 2114 | case Qt::Key_H : |
2107 | keyBindings(); | 2115 | keyBindings(); |
2108 | break; | 2116 | break; |
2109 | case Qt::Key_W: | 2117 | case Qt::Key_W: |
2110 | mView->viewManager()->showWhatsNextView(); | 2118 | mView->viewManager()->showWhatsNextView(); |
2111 | break; | 2119 | break; |
2112 | case Qt::Key_L: | 2120 | case Qt::Key_L: |
2113 | mView->viewManager()->showListView(); | 2121 | mView->viewManager()->showListView(); |
2114 | break; | 2122 | break; |
2115 | case Qt::Key_N: | 2123 | case Qt::Key_N: |
2116 | mView->viewManager()->showNextView(); | 2124 | mView->viewManager()->showNextView(); |
2117 | break; | 2125 | break; |
2118 | case Qt::Key_V: | 2126 | case Qt::Key_V: |
2119 | mView->viewManager()->showTodoView(); | 2127 | mView->viewManager()->showTodoView(); |
2120 | break; | 2128 | break; |
2121 | case Qt::Key_C: | 2129 | case Qt::Key_C: |
2122 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2130 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2123 | break; | 2131 | break; |
2124 | case Qt::Key_P: | 2132 | case Qt::Key_P: |
2125 | mView->showDatePicker( ); | 2133 | mView->showDatePicker( ); |
2126 | break; | 2134 | break; |
2127 | case Qt::Key_F: | 2135 | case Qt::Key_F: |
2128 | mView->editFilters(); | 2136 | mView->editFilters(); |
2129 | break; | 2137 | break; |
2130 | case Qt::Key_R: | 2138 | case Qt::Key_R: |
2131 | mView->toggleFilter(); | 2139 | mView->toggleFilter(); |
2132 | break; | 2140 | break; |
2133 | case Qt::Key_X: | 2141 | case Qt::Key_X: |
2134 | if ( e->state() == Qt::ControlButton ) | 2142 | if ( e->state() == Qt::ControlButton ) |
2135 | mView->toggleDateNavigatorWidget(); | 2143 | mView->toggleDateNavigatorWidget(); |
2136 | else { | 2144 | else { |
2137 | mView->viewManager()->showNextXView(); | 2145 | mView->viewManager()->showNextXView(); |
2138 | showSelectedDates = true; | 2146 | showSelectedDates = true; |
2139 | } | 2147 | } |
2140 | break; | 2148 | break; |
2141 | case Qt::Key_Space: | 2149 | case Qt::Key_Space: |
2142 | mView->toggleExpand(); | 2150 | mView->toggleExpand(); |
2143 | break; | 2151 | break; |
2144 | case Qt::Key_A: | 2152 | case Qt::Key_A: |
2145 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2153 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2146 | mView->showNextAlarms(); | 2154 | mView->showNextAlarms(); |
2147 | else | 2155 | else |
2148 | mView->toggleAllDaySize(); | 2156 | mView->toggleAllDaySize(); |
2149 | break; | 2157 | break; |
2150 | case Qt::Key_T: | 2158 | case Qt::Key_T: |
2151 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2159 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2152 | mView->newTodo(); | 2160 | mView->newTodo(); |
2153 | else { | 2161 | else { |
2154 | mView->goToday(); | 2162 | mView->goToday(); |
2155 | showSelectedDates = true; | 2163 | showSelectedDates = true; |
2156 | } | 2164 | } |
2157 | break; | 2165 | break; |
2158 | case Qt::Key_Q: | 2166 | case Qt::Key_Q: |
2159 | if ( e->state() == Qt::ControlButton ) | 2167 | if ( e->state() == Qt::ControlButton ) |
2160 | mView->conflictNotAll(); | 2168 | mView->conflictNotAll(); |
2161 | else if ( e->state() == Qt::ShiftButton ) | 2169 | else if ( e->state() == Qt::ShiftButton ) |
2162 | mView->conflictAllday(); | 2170 | mView->conflictAllday(); |
2163 | else | 2171 | else |
2164 | mView->conflictAll(); | 2172 | mView->conflictAll(); |
2165 | break; | 2173 | break; |
2166 | case Qt::Key_J: | 2174 | case Qt::Key_J: |
2167 | mView->viewManager()->showJournalView(); | 2175 | mView->viewManager()->showJournalView(); |
2168 | break; | 2176 | break; |
2169 | case Qt::Key_B: | 2177 | case Qt::Key_B: |
2170 | mView->editIncidenceDescription();; | 2178 | mView->editIncidenceDescription();; |
2171 | break; | 2179 | break; |
2172 | // case Qt::Key_Return: | 2180 | // case Qt::Key_Return: |
2173 | case Qt::Key_E: | 2181 | case Qt::Key_E: |
2174 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2182 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2175 | mView->newEvent(); | 2183 | mView->newEvent(); |
2176 | else | 2184 | else |
2177 | mView->editIncidence(); | 2185 | mView->editIncidence(); |
2178 | break; | 2186 | break; |
2179 | case Qt::Key_Plus: | 2187 | case Qt::Key_Plus: |
2180 | size = p->mHourSize +2; | 2188 | size = p->mHourSize +2; |
2181 | if ( size <= 22 ) | 2189 | if ( size <= 22 ) |
2182 | configureAgenda( size ); | 2190 | configureAgenda( size ); |
2183 | break; | 2191 | break; |
2184 | case Qt::Key_Minus: | 2192 | case Qt::Key_Minus: |
2185 | size = p->mHourSize - 2; | 2193 | size = p->mHourSize - 2; |
2186 | if ( size >= 4 ) | 2194 | if ( size >= 4 ) |
2187 | configureAgenda( size ); | 2195 | configureAgenda( size ); |
2188 | break; | 2196 | break; |
2189 | 2197 | ||
2190 | 2198 | ||
2191 | default: | 2199 | default: |
2192 | e->ignore(); | 2200 | e->ignore(); |
2193 | } | 2201 | } |
2194 | if ( pro > 0 ) { | 2202 | if ( pro > 0 ) { |
2195 | selectFilter( pro+1 ); | 2203 | selectFilter( pro+1 ); |
2196 | } | 2204 | } |
2197 | if ( showSelectedDates ) { | 2205 | if ( showSelectedDates ) { |
2198 | ;// setCaptionToDates(); | 2206 | ;// setCaptionToDates(); |
2199 | } | 2207 | } |
2200 | 2208 | ||
2201 | } | 2209 | } |
2202 | void MainWindow::fillFilterMenuTB() | 2210 | void MainWindow::fillFilterMenuTB() |
2203 | { | 2211 | { |
2204 | selectFilterMenuTB->clear(); | 2212 | selectFilterMenuTB->clear(); |
2205 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2213 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2206 | selectFilterMenuTB->insertSeparator(); | 2214 | selectFilterMenuTB->insertSeparator(); |
2207 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2215 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2208 | 2216 | ||
2209 | selectFilterMenuTB->insertSeparator(); | 2217 | selectFilterMenuTB->insertSeparator(); |
2210 | QPtrList<CalFilter> fili = mView->filters(); | 2218 | QPtrList<CalFilter> fili = mView->filters(); |
2211 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2219 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2212 | CalFilter *filter = fili.first(); | 2220 | CalFilter *filter = fili.first(); |
2213 | int iii = 2; | 2221 | int iii = 2; |
2214 | bool checkitem = mView->filterView()->filtersEnabled(); | 2222 | bool checkitem = mView->filterView()->filtersEnabled(); |
2215 | while(filter) { | 2223 | while(filter) { |
2216 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2224 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2217 | if ( filter == curfilter) | 2225 | if ( filter == curfilter) |
2218 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2226 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2219 | filter = fili.next(); | 2227 | filter = fili.next(); |
2220 | ++iii; | 2228 | ++iii; |
2221 | } | 2229 | } |
2222 | if ( !checkitem ) | 2230 | if ( !checkitem ) |
2223 | selectFilterMenuTB->setItemChecked( 1, true ); | 2231 | selectFilterMenuTB->setItemChecked( 1, true ); |
2224 | 2232 | ||
2225 | int x = 0; | 2233 | int x = 0; |
2226 | int y = iconToolBar->height(); | 2234 | int y = iconToolBar->height(); |
2227 | int dX = 0; | 2235 | int dX = 0; |
2228 | int dY = 0; | 2236 | int dY = 0; |
2229 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2237 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2230 | if ( iconToolBar->y() > height()/2 ) { | 2238 | if ( iconToolBar->y() > height()/2 ) { |
2231 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2239 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2232 | y = 0; | 2240 | y = 0; |
2233 | } | 2241 | } |
2234 | } else { | 2242 | } else { |
2235 | if ( iconToolBar->x() > width()/2 ) { // right side | 2243 | if ( iconToolBar->x() > width()/2 ) { // right side |
2236 | x=0; | 2244 | x=0; |
2237 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2245 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2238 | y = 0; | 2246 | y = 0; |
2239 | } else { | 2247 | } else { |
2240 | x= iconToolBar->width(); | 2248 | x= iconToolBar->width(); |
2241 | y = 0; | 2249 | y = 0; |
2242 | } | 2250 | } |
2243 | } | 2251 | } |
2244 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2252 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2245 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2253 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2246 | } | 2254 | } |
2247 | void MainWindow::fillFilterMenu() | 2255 | void MainWindow::fillFilterMenu() |
2248 | { | 2256 | { |
2249 | selectFilterMenu->clear(); | 2257 | selectFilterMenu->clear(); |
2250 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2258 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2251 | selectFilterMenu->insertSeparator(); | 2259 | selectFilterMenu->insertSeparator(); |
2252 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2260 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2253 | 2261 | ||
2254 | selectFilterMenu->insertSeparator(); | 2262 | selectFilterMenu->insertSeparator(); |
2255 | QPtrList<CalFilter> fili = mView->filters(); | 2263 | QPtrList<CalFilter> fili = mView->filters(); |
2256 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2264 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2257 | CalFilter *filter = fili.first(); | 2265 | CalFilter *filter = fili.first(); |
2258 | int iii = 2; | 2266 | int iii = 2; |
2259 | bool checkitem = mView->filterView()->filtersEnabled(); | 2267 | bool checkitem = mView->filterView()->filtersEnabled(); |
2260 | while(filter) { | 2268 | while(filter) { |
2261 | selectFilterMenu->insertItem( filter->name(), iii ); | 2269 | selectFilterMenu->insertItem( filter->name(), iii ); |