summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-29 20:48:31 (UTC)
committer zautrix <zautrix>2005-06-29 20:48:31 (UTC)
commitf55b992a98cc081207b23283aadcf2ecffc90a87 (patch) (unidiff)
treeb0b54ac4f2a164ac7e7ca49bea78f62e4f58fa62 /korganizer
parent8954bae7bb5afc9706e37e808e9c1e237399f214 (diff)
downloadkdepimpi-f55b992a98cc081207b23283aadcf2ecffc90a87.zip
kdepimpi-f55b992a98cc081207b23283aadcf2ecffc90a87.tar.gz
kdepimpi-f55b992a98cc081207b23283aadcf2ecffc90a87.tar.bz2
fixxxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
-rw-r--r--korganizer/calendarview.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 776cdd3..623cf9d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -191,736 +191,744 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
192 mText += "<table>"; 192 mText += "<table>";
193 time = 1; 193 time = 1;
194 } 194 }
195 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 195 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
196 if ( time > 0 ) 196 if ( time > 0 )
197 mText +="</table>"; 197 mText +="</table>";
198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
199 mText += "<table>"; 199 mText += "<table>";
200 time = 2; 200 time = 2;
201 201
202 } 202 }
203 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 203 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
204 if ( time > 0 ) 204 if ( time > 0 )
205 mText +="</table>"; 205 mText +="</table>";
206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
207 mText += "<table>"; 207 mText += "<table>";
208 time = 3; 208 time = 3;
209 } 209 }
210 mText +="<tr><td><b>"; 210 mText +="<tr><td><b>";
211 mText += timestr; 211 mText += timestr;
212 mText += "</b></td><td>"; 212 mText += "</b></td><td>";
213 mText += tempText; 213 mText += tempText;
214 mText += "</td></tr>\n"; 214 mText += "</td></tr>\n";
215 inc = getNextInc( start ); 215 inc = getNextInc( start );
216 } 216 }
217 mText +="</table>"; 217 mText +="</table>";
218 setText( mText ); 218 setText( mText );
219} 219}
220 220
221MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 221MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
222{ 222{
223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
224} 224}
225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
226{ 226{
227 QDateTime dt ; 227 QDateTime dt ;
228 Incidence * retInc; 228 Incidence * retInc;
229 Incidence * inc = mAlarms.first(); 229 Incidence * inc = mAlarms.first();
230 if ( inc == 0 ) 230 if ( inc == 0 )
231 return 0; 231 return 0;
232 bool ok; 232 bool ok;
233 dt = inc->getNextOccurence( start, &ok ); 233 dt = inc->getNextOccurence( start, &ok );
234 if ( ! ok ) return 0; 234 if ( ! ok ) return 0;
235 QDateTime dtn ; 235 QDateTime dtn ;
236 retInc = inc; 236 retInc = inc;
237 inc = mAlarms.next(); 237 inc = mAlarms.next();
238 while ( inc ) { 238 while ( inc ) {
239 dtn = inc->getNextOccurence( start, &ok ); 239 dtn = inc->getNextOccurence( start, &ok );
240 if ( ! ok ) return 0; 240 if ( ! ok ) return 0;
241 if ( dtn < dt ) { 241 if ( dtn < dt ) {
242 dt = dtn; 242 dt = dtn;
243 retInc = inc; 243 retInc = inc;
244 } 244 }
245 inc = mAlarms.next(); 245 inc = mAlarms.next();
246 } 246 }
247 mAlarms.remove( retInc ); 247 mAlarms.remove( retInc );
248 return retInc; 248 return retInc;
249 249
250} 250}
251void MissedAlarmTextBrowser::setSource(const QString & n) 251void MissedAlarmTextBrowser::setSource(const QString & n)
252{ 252{
253 if (n.startsWith("event:")) { 253 if (n.startsWith("event:")) {
254#ifdef DESKTOP_VERSION 254#ifdef DESKTOP_VERSION
255 emit showIncidence(n.mid(8)); 255 emit showIncidence(n.mid(8));
256#else 256#else
257 emit showIncidence(n.mid(6)); 257 emit showIncidence(n.mid(6));
258#endif 258#endif
259 return; 259 return;
260 } else if (n.startsWith("todo:")) { 260 } else if (n.startsWith("todo:")) {
261#ifdef DESKTOP_VERSION 261#ifdef DESKTOP_VERSION
262 emit showIncidence(n.mid(7)); 262 emit showIncidence(n.mid(7));
263#else 263#else
264 emit showIncidence(n.mid(5)); 264 emit showIncidence(n.mid(5));
265#endif 265#endif
266 return; 266 return;
267 } 267 }
268} 268}
269 269
270 270
271class KOBeamPrefs : public QDialog 271class KOBeamPrefs : public QDialog
272{ 272{
273 public: 273 public:
274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
275 QDialog( parent, name, true ) 275 QDialog( parent, name, true )
276 { 276 {
277 setCaption( i18n("Beam Options") ); 277 setCaption( i18n("Beam Options") );
278 QVBoxLayout* lay = new QVBoxLayout( this ); 278 QVBoxLayout* lay = new QVBoxLayout( this );
279 lay->setSpacing( 3 ); 279 lay->setSpacing( 3 );
280 lay->setMargin( 3 ); 280 lay->setMargin( 3 );
281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
282 lay->addWidget( format ); 282 lay->addWidget( format );
283 format->setExclusive ( true ) ; 283 format->setExclusive ( true ) ;
284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
285 lay->addWidget( time ); time->setExclusive ( true ) ; 285 lay->addWidget( time ); time->setExclusive ( true ) ;
286 vcal = new QRadioButton(" vCalendar ", format ); 286 vcal = new QRadioButton(" vCalendar ", format );
287 ical = new QRadioButton(" iCalendar ", format ); 287 ical = new QRadioButton(" iCalendar ", format );
288 vcal->setChecked( true ); 288 vcal->setChecked( true );
289 tz = new QRadioButton(i18n(" With timezone "), time ); 289 tz = new QRadioButton(i18n(" With timezone "), time );
290 local = new QRadioButton(i18n(" Local time "), time ); 290 local = new QRadioButton(i18n(" Local time "), time );
291 tz->setChecked( true ); 291 tz->setChecked( true );
292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
293 lay->addWidget( ok ); 293 lay->addWidget( ok );
294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
295 lay->addWidget( cancel ); 295 lay->addWidget( cancel );
296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
298 resize( 200, 200 ); 298 resize( 200, 200 );
299 } 299 }
300 300
301 bool beamVcal() { return vcal->isChecked(); } 301 bool beamVcal() { return vcal->isChecked(); }
302 bool beamLocal() { return local->isChecked(); } 302 bool beamLocal() { return local->isChecked(); }
303private: 303private:
304 QRadioButton* vcal, *ical, *local, *tz; 304 QRadioButton* vcal, *ical, *local, *tz;
305}; 305};
306class KOCatPrefs : public QDialog 306class KOCatPrefs : public QDialog
307{ 307{
308 public: 308 public:
309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
310 QDialog( parent, name, true ) 310 QDialog( parent, name, true )
311 { 311 {
312 setCaption( i18n("Manage new Categories") ); 312 setCaption( i18n("Manage new Categories") );
313 QVBoxLayout* lay = new QVBoxLayout( this ); 313 QVBoxLayout* lay = new QVBoxLayout( this );
314 lay->setSpacing( 3 ); 314 lay->setSpacing( 3 );
315 lay->setMargin( 3 ); 315 lay->setMargin( 3 );
316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
317 lay->addWidget( lab ); 317 lay->addWidget( lab );
318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
319 lay->addWidget( format ); 319 lay->addWidget( format );
320 format->setExclusive ( true ) ; 320 format->setExclusive ( true ) ;
321 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 321 addCatBut = new QRadioButton(i18n("Add to category list"), format );
322 new QRadioButton(i18n("Remove from Events/Todos"), format ); 322 new QRadioButton(i18n("Remove from Events/Todos"), format );
323 addCatBut->setChecked( true ); 323 addCatBut->setChecked( true );
324 QPushButton * ok = new QPushButton( i18n("OK"), this ); 324 QPushButton * ok = new QPushButton( i18n("OK"), this );
325 lay->addWidget( ok ); 325 lay->addWidget( ok );
326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
327 lay->addWidget( cancel ); 327 lay->addWidget( cancel );
328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
330 resize( 200, 200 ); 330 resize( 200, 200 );
331 } 331 }
332 332
333 bool addCat() { return addCatBut->isChecked(); } 333 bool addCat() { return addCatBut->isChecked(); }
334private: 334private:
335 QRadioButton* addCatBut; 335 QRadioButton* addCatBut;
336}; 336};
337 337
338 338
339 339
340CalendarView::CalendarView( CalendarResources *calendar, 340CalendarView::CalendarView( CalendarResources *calendar,
341 QWidget *parent, const char *name ) 341 QWidget *parent, const char *name )
342 : CalendarViewBase( parent, name ), 342 : CalendarViewBase( parent, name ),
343 mCalendar( calendar ), 343 mCalendar( calendar ),
344 mResourceManager( calendar->resourceManager() ) 344 mResourceManager( calendar->resourceManager() )
345{ 345{
346 346
347 mEventEditor = 0; 347 mEventEditor = 0;
348 mTodoEditor = 0; 348 mTodoEditor = 0;
349 349
350 init(); 350 init();
351} 351}
352 352
353CalendarView::CalendarView( Calendar *calendar, 353CalendarView::CalendarView( Calendar *calendar,
354 QWidget *parent, const char *name ) 354 QWidget *parent, const char *name )
355 : CalendarViewBase( parent, name ), 355 : CalendarViewBase( parent, name ),
356 mCalendar( calendar ), 356 mCalendar( calendar ),
357 mResourceManager( 0 ) 357 mResourceManager( 0 )
358{ 358{
359 359
360 mEventEditor = 0; 360 mEventEditor = 0;
361 mTodoEditor = 0; 361 mTodoEditor = 0;
362 init(); 362 init();
363} 363}
364 364
365void CalendarView::init() 365void CalendarView::init()
366{ 366{
367 mNextAlarmDateTime = QDateTime::currentDateTime(); 367 mNextAlarmDateTime = QDateTime::currentDateTime();
368 setFocusPolicy ( NoFocus ); 368 setFocusPolicy ( NoFocus );
369 mViewerCallerIsSearchDialog = false; 369 mViewerCallerIsSearchDialog = false;
370 mBlockShowDates = false; 370 mBlockShowDates = false;
371 371
372 mDatePickerMode = 0; 372 mDatePickerMode = 0;
373 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
374 mViewManager = new KOViewManager( this ); 374 mViewManager = new KOViewManager( this );
375 mDialogManager = new KODialogManager( this ); 375 mDialogManager = new KODialogManager( this );
376 mEventViewerDialog = 0; 376 mEventViewerDialog = 0;
377 mModified = false; 377 mModified = false;
378 mReadOnly = false; 378 mReadOnly = false;
379 mSelectedIncidence = 0; 379 mSelectedIncidence = 0;
380 mCalPrinter = 0; 380 mCalPrinter = 0;
381 mFilters.setAutoDelete(true); 381 mFilters.setAutoDelete(true);
382 382
383 mCalendar->registerObserver( this ); 383 mCalendar->registerObserver( this );
384 // TODO: Make sure that view is updated, when calendar is changed. 384 // TODO: Make sure that view is updated, when calendar is changed.
385 385
386 mStorage = new FileStorage( mCalendar ); 386 mStorage = new FileStorage( mCalendar );
387 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 387 mNavigator = new DateNavigator( this, "datevav", mViewManager );
388 388
389 QBoxLayout *topLayout = (QBoxLayout*)layout(); 389 QBoxLayout *topLayout = (QBoxLayout*)layout();
390#ifndef KORG_NOSPLITTER 390#ifndef KORG_NOSPLITTER
391 // create the main layout frames. 391 // create the main layout frames.
392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
393 topLayout->addWidget(mPanner); 393 topLayout->addWidget(mPanner);
394 394
395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
396 "CalendarView::LeftFrame"); 396 "CalendarView::LeftFrame");
397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
398 398
399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
400 "CalendarView::DateNavigator" ); 400 "CalendarView::DateNavigator" );
401 401
402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
404 mTodoList->setNavigator( mNavigator ); 404 mTodoList->setNavigator( mNavigator );
405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
406 406
407#ifdef KORG_NORESOURCEVIEW 407#ifdef KORG_NORESOURCEVIEW
408 mResourceView = 0; 408 mResourceView = 0;
409#else 409#else
410 if ( mResourceManager ) { 410 if ( mResourceManager ) {
411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
412 mResourceView->updateView(); 412 mResourceView->updateView();
413 connect( mResourceView, SIGNAL( resourcesChanged() ), 413 connect( mResourceView, SIGNAL( resourcesChanged() ),
414 SLOT( updateView() ) ); 414 SLOT( updateView() ) );
415 } else { 415 } else {
416 mResourceView = 0; 416 mResourceView = 0;
417 } 417 }
418#endif 418#endif
419 QWidget *rightBox = new QWidget( mPanner ); 419 QWidget *rightBox = new QWidget( mPanner );
420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
421 421
422 mRightFrame = new QWidgetStack( rightBox ); 422 mRightFrame = new QWidgetStack( rightBox );
423 rightLayout->addWidget( mRightFrame, 1 ); 423 rightLayout->addWidget( mRightFrame, 1 );
424 424
425 mLeftFrame = mLeftSplitter; 425 mLeftFrame = mLeftSplitter;
426#else 426#else
427 //QWidget *mainBox = new QWidget( this ); 427 //QWidget *mainBox = new QWidget( this );
428 //QWidget *leftFrame = new QWidget( mainBox ); 428 //QWidget *leftFrame = new QWidget( mainBox );
429 //QBoxLayout * mainBoxLayout; 429 //QBoxLayout * mainBoxLayout;
430 if ( KOPrefs::instance()->mVerticalScreen ) { 430 if ( KOPrefs::instance()->mVerticalScreen ) {
431 //mainBoxLayout = new QVBoxLayout(mainBox); 431 //mainBoxLayout = new QVBoxLayout(mainBox);
432 //leftFrameLayout = new QHBoxLayout(leftFrame ); 432 //leftFrameLayout = new QHBoxLayout(leftFrame );
433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
437 } else { 437 } else {
438 //mainBoxLayout = new QHBoxLayout(mainBox); 438 //mainBoxLayout = new QHBoxLayout(mainBox);
439 //leftFrameLayout = new QVBoxLayout(leftFrame ); 439 //leftFrameLayout = new QVBoxLayout(leftFrame );
440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
444 } 444 }
445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
446 //QBoxLayout * leftFrameLayout; 446 //QBoxLayout * leftFrameLayout;
447 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
448 topLayout->addWidget( mMainFrame ); 447 topLayout->addWidget( mMainFrame );
449 topLayout->addWidget( mDateScrollBar ); 448#ifdef DESKTOP_VERSION
449 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
450 topLayout->addWidget( mDateScrollBar );
451 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
452#endif
450 //mainBoxLayout->addWidget (mLeftFrame); 453 //mainBoxLayout->addWidget (mLeftFrame);
451 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 454 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
452 "CalendarView::DateNavigator" ); 455 "CalendarView::DateNavigator" );
453#if 0 456#if 0
454 // FIXME 457 // FIXME
455 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 458 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
456 "CalendarView::DateNavigator", QDate::currentDate()); 459 "CalendarView::DateNavigator", QDate::currentDate());
457#endif 460#endif
458 // mDateNavigator->blockSignals( true ); 461 // mDateNavigator->blockSignals( true );
459 //leftFrameLayout->addWidget( mDateNavigator ); 462 //leftFrameLayout->addWidget( mDateNavigator );
460 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 463 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
461 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 464 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
462 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 465 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
463 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 466 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 467 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
465 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 468 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 469 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
467 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 470 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
468 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 471 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
469 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 472 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
470 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 473 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
471 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 474 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
472 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 475
473 mTodoList->setNavigator( mNavigator ); 476 mTodoList->setNavigator( mNavigator );
474#if 0 477#if 0
475 if ( QApplication::desktop()->width() < 480 ) { 478 if ( QApplication::desktop()->width() < 480 ) {
476 leftFrameLayout->addWidget(mFilterView); 479 leftFrameLayout->addWidget(mFilterView);
477 leftFrameLayout->addWidget(mTodoList, 2 ); 480 leftFrameLayout->addWidget(mTodoList, 2 );
478 481
479 } else { 482 } else {
480 leftFrameLayout->addWidget(mTodoList,2 ); 483 leftFrameLayout->addWidget(mTodoList,2 );
481 leftFrameLayout->addWidget(mFilterView ); 484 leftFrameLayout->addWidget(mFilterView );
482 } 485 }
483#endif 486#endif
484 mFilterView->hide(); 487 mFilterView->hide();
485 mCalEditView->hide(); 488 mCalEditView->hide();
486 QWidget *rightBox = new QWidget( mMainFrame ); 489 QWidget *rightBox = new QWidget( mMainFrame );
487 //mainBoxLayout->addWidget ( rightBox, 10 ); 490 //mainBoxLayout->addWidget ( rightBox, 10 );
488 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 491 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
489 mRightFrame = new QWidgetStack( rightBox ); 492 mRightFrame = new QWidgetStack( rightBox );
490 rightLayout->addWidget( mRightFrame, 10 ); 493 rightLayout->addWidget( mRightFrame, 10 );
491 494
492 //mLeftFrame = (QWidget *)leftFrame; 495 //mLeftFrame = (QWidget *)leftFrame;
493 if ( KOPrefs::instance()->mVerticalScreen ) { 496 if ( KOPrefs::instance()->mVerticalScreen ) {
494 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 497 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
495 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 498 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
496 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 499 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
497 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 500 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
498 } else { 501 } else {
499 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 502 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
500 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 503 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
501 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 504 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
502 } 505 }
503 if ( !KOPrefs::instance()->mShowDateNavigator) 506 if ( !KOPrefs::instance()->mShowDateNavigator)
504 mDateNavigator->hide(); 507 mDateNavigator->hide();
505 //qDebug("Calendarview Size %d %d ", width(), height()); 508 //qDebug("Calendarview Size %d %d ", width(), height());
506#endif 509#endif
507 510
508 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 511 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
509 SLOT( showDates( const KCal::DateList & ) ) ); 512 SLOT( showDates( const KCal::DateList & ) ) );
510 513
511 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 514 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
512 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 515 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
513 516
514 517
515 518
516 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 519 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
517 mViewManager, SLOT( showMonth( const QDate & ) ) ); 520 mViewManager, SLOT( showMonth( const QDate & ) ) );
518 521
519 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 522 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
520 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 523 mNavigator, SLOT( selectWeek( const QDate & ) ) );
521 524
522 connect( mDateNavigator, SIGNAL( goPrevYear() ), 525 connect( mDateNavigator, SIGNAL( goPrevYear() ),
523 mNavigator, SLOT( selectPreviousYear() ) ); 526 mNavigator, SLOT( selectPreviousYear() ) );
524 connect( mDateNavigator, SIGNAL( goNextYear() ), 527 connect( mDateNavigator, SIGNAL( goNextYear() ),
525 mNavigator, SLOT( selectNextYear() ) ); 528 mNavigator, SLOT( selectNextYear() ) );
526 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 529 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
527 mNavigator, SLOT( selectPreviousMonth() ) ); 530 mNavigator, SLOT( selectPreviousMonth() ) );
528 connect( mDateNavigator, SIGNAL( goNextMonth() ), 531 connect( mDateNavigator, SIGNAL( goNextMonth() ),
529 mNavigator, SLOT( selectNextMonth() ) ); 532 mNavigator, SLOT( selectNextMonth() ) );
530 533
531 connect( mDateNavigator, SIGNAL( goPrevious() ), 534 connect( mDateNavigator, SIGNAL( goPrevious() ),
532 mNavigator, SLOT( selectPrevious() ) ); 535 mNavigator, SLOT( selectPrevious() ) );
533 connect( mDateNavigator, SIGNAL( goNext() ), 536 connect( mDateNavigator, SIGNAL( goNext() ),
534 mNavigator, SLOT( selectNext() ) ); 537 mNavigator, SLOT( selectNext() ) );
535 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 538 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
536 mNavigator, SLOT( slotMonthSelect( int ) ) ); 539 mNavigator, SLOT( slotMonthSelect( int ) ) );
537 540
538 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 541 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
539 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 542 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
540#if 0 543#if 0
541 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 544 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
542 SLOT( incidenceAdded( Incidence *) ) ); 545 SLOT( incidenceAdded( Incidence *) ) );
543#endif 546#endif
544 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 547 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
545 548
546 connect( this, SIGNAL( configChanged() ), 549 connect( this, SIGNAL( configChanged() ),
547 mDateNavigator, SLOT( updateConfig() ) ); 550 mDateNavigator, SLOT( updateConfig() ) );
548 551
549 connect( mTodoList, SIGNAL( newTodoSignal() ), 552 connect( mTodoList, SIGNAL( newTodoSignal() ),
550 SLOT( newTodo() ) ); 553 SLOT( newTodo() ) );
551 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 554 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
552 SLOT( newSubTodo( Todo * ) ) ); 555 SLOT( newSubTodo( Todo * ) ) );
553 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 556 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
554 SLOT( editTodo( Todo * ) ) ); 557 SLOT( editTodo( Todo * ) ) );
555 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 558 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
556 SLOT( showTodo( Todo *) ) ); 559 SLOT( showTodo( Todo *) ) );
557 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 560 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
558 SLOT( deleteTodo( Todo *) ) ); 561 SLOT( deleteTodo( Todo *) ) );
559 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 562 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
560 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 563 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
561 SLOT( purgeCompleted() ) ); 564 SLOT( purgeCompleted() ) );
562 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 565 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
563 SIGNAL( todoModified( Todo *, int ) ) ); 566 SIGNAL( todoModified( Todo *, int ) ) );
564 567
565 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 568 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
566 this, SLOT ( cloneIncidence( Incidence * ) ) ); 569 this, SLOT ( cloneIncidence( Incidence * ) ) );
567 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 570 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
568 this, SLOT (cancelIncidence( Incidence * ) ) ); 571 this, SLOT (cancelIncidence( Incidence * ) ) );
569 572
570 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
571 this, SLOT ( moveIncidence( Incidence * ) ) ); 574 this, SLOT ( moveIncidence( Incidence * ) ) );
572 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
573 this, SLOT ( beamIncidence( Incidence * ) ) ); 576 this, SLOT ( beamIncidence( Incidence * ) ) );
574 577
575 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 578 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
576 this, SLOT ( todo_unsub( Todo * ) ) ); 579 this, SLOT ( todo_unsub( Todo * ) ) );
577 580
578 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 581 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
579 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 582 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
580 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 583 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
581 SLOT( updateTodo( Todo *, int ) ) ); 584 SLOT( updateTodo( Todo *, int ) ) );
582 connect( this, SIGNAL( todoModified( Todo *, int )), this, 585 connect( this, SIGNAL( todoModified( Todo *, int )), this,
583 SLOT( changeTodoDisplay( Todo *, int ) ) ); 586 SLOT( changeTodoDisplay( Todo *, int ) ) );
584 587
585 588
586 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 589 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
587 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 590 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
588 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 591 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
589 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 592 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
590 593
591 594
592 595
593 596
594 597
595 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 598 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
596 SLOT(checkClipboard())); 599 SLOT(checkClipboard()));
597 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 600 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
598 SLOT( processTodoListSelection( Incidence * ) ) ); 601 SLOT( processTodoListSelection( Incidence * ) ) );
599 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 602 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
600 603
601 // kdDebug() << "CalendarView::CalendarView() done" << endl; 604 // kdDebug() << "CalendarView::CalendarView() done" << endl;
602 605
603 mDateFrame = new QVBox(0,0,WType_Popup); 606 mDateFrame = new QVBox(0,0,WType_Popup);
604 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 607 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
605 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 608 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
606 mDateFrame->setLineWidth(3); 609 mDateFrame->setLineWidth(3);
607 mDateFrame->hide(); 610 mDateFrame->hide();
608 mDateFrame->setCaption( i18n( "Pick a date to display")); 611 mDateFrame->setCaption( i18n( "Pick a date to display"));
609 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 612 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
610 613
611 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 614 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
612 615
613 mEventEditor = mDialogManager->getEventEditor(); 616 mEventEditor = mDialogManager->getEventEditor();
614 mTodoEditor = mDialogManager->getTodoEditor(); 617 mTodoEditor = mDialogManager->getTodoEditor();
615 618
616 mFlagEditDescription = false; 619 mFlagEditDescription = false;
617 620
618 mSuspendTimer = new QTimer( this ); 621 mSuspendTimer = new QTimer( this );
619 mAlarmTimer = new QTimer( this ); 622 mAlarmTimer = new QTimer( this );
620 mRecheckAlarmTimer = new QTimer( this ); 623 mRecheckAlarmTimer = new QTimer( this );
621 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 624 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
622 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 625 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
623 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 626 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
624 mAlarmDialog = new AlarmDialog( this ); 627 mAlarmDialog = new AlarmDialog( this );
625 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 628 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
626 mAlarmDialog->setServerNotification( false ); 629 mAlarmDialog->setServerNotification( false );
627 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 630 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
628 631
629 632
630#ifndef DESKTOP_VERSION 633#ifndef DESKTOP_VERSION
631//US listen for arriving address resultsets 634//US listen for arriving address resultsets
632 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 635 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
633 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 636 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
634#endif 637#endif
635 mDateNavigator->setCalendar( mCalendar ); 638 mDateNavigator->setCalendar( mCalendar );
636} 639}
637 640
638 641
639CalendarView::~CalendarView() 642CalendarView::~CalendarView()
640{ 643{
641 // kdDebug() << "~CalendarView()" << endl; 644 // kdDebug() << "~CalendarView()" << endl;
642 //qDebug("CalendarView::~CalendarView() "); 645 //qDebug("CalendarView::~CalendarView() ");
643 delete mDialogManager; 646 delete mDialogManager;
644 delete mViewManager; 647 delete mViewManager;
645 delete mStorage; 648 delete mStorage;
646 delete mDateFrame ; 649 delete mDateFrame ;
647 delete mEventViewerDialog; 650 delete mEventViewerDialog;
648 //kdDebug() << "~CalendarView() done" << endl; 651 //kdDebug() << "~CalendarView() done" << endl;
649} 652}
650void CalendarView::setScrollBarStep(int val ) 653void CalendarView::setScrollBarStep(int val )
651{ 654{
655#ifdef DESKTOP_VERSION
652 mDateScrollBar->setLineStep ( val ); 656 mDateScrollBar->setLineStep ( val );
657#endif
653} 658}
654void CalendarView::scrollBarValue(int val ) 659void CalendarView::scrollBarValue(int val )
655{ 660{
661#ifdef DESKTOP_VERSION
662 if ( QApplication::desktop()->width() < 800 ) return;
656 static bool block = false; 663 static bool block = false;
657 if ( block ) return; 664 if ( block ) return;
658 block = true; 665 block = true;
659 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 666 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
660 //qDebug("VAL %d ",val ); 667 //qDebug("VAL %d ",val );
661 int count = mNavigator->selectedDates().count(); 668 int count = mNavigator->selectedDates().count();
662 int year = mNavigator->selectedDates().first().year(); 669 int year = mNavigator->selectedDates().first().year();
663 int day = mNavigator->selectedDates().first().dayOfYear(); 670 int day = mNavigator->selectedDates().first().dayOfYear();
664 if ( val == day -1 ) { 671 if ( val == day -1 ) {
665 block = false; 672 block = false;
666 return; 673 return;
667 } 674 }
668 QDate d ( year,1,1 ); 675 QDate d ( year,1,1 );
669 mNavigator->selectDates( d.addDays( val ), count ); 676 mNavigator->selectDates( d.addDays( val ), count );
670 block = false; 677 block = false;
678#endif
671 679
672} 680}
673 681
674void CalendarView::checkAlarms() 682void CalendarView::checkAlarms()
675{ 683{
676 KConfig *config = KOGlobals::config(); 684 KConfig *config = KOGlobals::config();
677 config->setGroup( "AppRun" ); 685 config->setGroup( "AppRun" );
678 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 686 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
679 int daysto = dt.daysTo( QDate::currentDate() ); 687 int daysto = dt.daysTo( QDate::currentDate() );
680 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 688 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
681 dt = dt.addDays( days ); 689 dt = dt.addDays( days );
682 int secto = dt.secsTo( QDateTime::currentDateTime() ); 690 int secto = dt.secsTo( QDateTime::currentDateTime() );
683 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 691 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
684 //qDebug("KO: Reading program stop %d ", secs); 692 //qDebug("KO: Reading program stop %d ", secs);
685 //secs -= ( 3600 * 24*3 ); // debug only 693 //secs -= ( 3600 * 24*3 ); // debug only
686 QDateTime latest = dt.addSecs ( secs ); 694 QDateTime latest = dt.addSecs ( secs );
687 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 695 qDebug("KO: Last termination on %s ", latest.toString().latin1());
688 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 696 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
689 QPtrList<Incidence> el = mCalendar->rawIncidences(); 697 QPtrList<Incidence> el = mCalendar->rawIncidences();
690 QPtrList<Incidence> al; 698 QPtrList<Incidence> al;
691 Incidence* inL = el.first(); 699 Incidence* inL = el.first();
692 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 700 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
693 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 701 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
694 while ( inL ) { 702 while ( inL ) {
695 bool ok = false; 703 bool ok = false;
696 int offset = 0; 704 int offset = 0;
697 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 705 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
698 if ( ok ) { 706 if ( ok ) {
699 //qDebug("OK %s",next.toString().latin1()); 707 //qDebug("OK %s",next.toString().latin1());
700 if ( next < cur ) { 708 if ( next < cur ) {
701 al.append( inL ); 709 al.append( inL );
702 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 710 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
703 } 711 }
704 } 712 }
705 inL = el.next(); 713 inL = el.next();
706 } 714 }
707 if ( al.count() ) { 715 if ( al.count() ) {
708 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 716 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
709 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 717 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
710 QVBoxLayout* lay = new QVBoxLayout( dia ); 718 QVBoxLayout* lay = new QVBoxLayout( dia );
711 lay->setSpacing( 0 ); 719 lay->setSpacing( 0 );
712 lay->setMargin( 0 ); 720 lay->setMargin( 0 );
713 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 721 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
714 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 722 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
715 lay->addWidget( matb ); 723 lay->addWidget( matb );
716 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 724 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
717 int wid = 210; 725 int wid = 210;
718 int x = QApplication::desktop()->width() - wid - 7; 726 int x = QApplication::desktop()->width() - wid - 7;
719 int y = QApplication::desktop()->height() - wid - 70; 727 int y = QApplication::desktop()->height() - wid - 70;
720 dia->setGeometry ( x,y,wid,wid); 728 dia->setGeometry ( x,y,wid,wid);
721 } else { 729 } else {
722 int si = 220; 730 int si = 220;
723 if ( QApplication::desktop()->width() > 470 ) 731 if ( QApplication::desktop()->width() > 470 )
724 si = 400; 732 si = 400;
725 dia->resize(si,si/2); 733 dia->resize(si,si/2);
726 } 734 }
727 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 735 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
728 dia->show(); 736 dia->show();
729 737
730 } 738 }
731} 739}
732void CalendarView::showDay( QDate d ) 740void CalendarView::showDay( QDate d )
733{ 741{
734 dateNavigator()->blockSignals( true ); 742 dateNavigator()->blockSignals( true );
735 dateNavigator()->selectDate( d ); 743 dateNavigator()->selectDate( d );
736 dateNavigator()->blockSignals( false ); 744 dateNavigator()->blockSignals( false );
737 mViewManager->showDayView(); 745 mViewManager->showDayView();
738 //dateNavigator()->selectDate( d ); 746 //dateNavigator()->selectDate( d );
739} 747}
740void CalendarView::timerAlarm() 748void CalendarView::timerAlarm()
741{ 749{
742 //qDebug("CalendarView::timerAlarm() "); 750 //qDebug("CalendarView::timerAlarm() ");
743 computeAlarm(mAlarmNotification ); 751 computeAlarm(mAlarmNotification );
744} 752}
745 753
746void CalendarView::suspendAlarm() 754void CalendarView::suspendAlarm()
747{ 755{
748 //qDebug(" CalendarView::suspendAlarm() "); 756 //qDebug(" CalendarView::suspendAlarm() ");
749 computeAlarm(mSuspendAlarmNotification ); 757 computeAlarm(mSuspendAlarmNotification );
750 758
751} 759}
752 760
753void CalendarView::startAlarm( QString mess , QString filename) 761void CalendarView::startAlarm( QString mess , QString filename)
754{ 762{
755 763
756 topLevelWidget()->showNormal(); 764 topLevelWidget()->showNormal();
757 topLevelWidget()->setActiveWindow(); 765 topLevelWidget()->setActiveWindow();
758 topLevelWidget()->raise(); 766 topLevelWidget()->raise();
759 767
760 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 768 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
761 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 769 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
762 770
763} 771}
764 772
765void CalendarView::checkNextTimerAlarm() 773void CalendarView::checkNextTimerAlarm()
766{ 774{
767 mCalendar->checkAlarmForIncidence( 0, true ); 775 mCalendar->checkAlarmForIncidence( 0, true );
768} 776}
769 777
770void CalendarView::computeAlarm( QString msg ) 778void CalendarView::computeAlarm( QString msg )
771{ 779{
772 780
773 QString mess = msg; 781 QString mess = msg;
774 QString mAlarmMessage = mess.mid( 9 ); 782 QString mAlarmMessage = mess.mid( 9 );
775 QString filename = MainWindow::resourcePath(); 783 QString filename = MainWindow::resourcePath();
776 filename += "koalarm.wav"; 784 filename += "koalarm.wav";
777 QString tempfilename; 785 QString tempfilename;
778 if ( mess.left( 13 ) == "suspend_alarm") { 786 if ( mess.left( 13 ) == "suspend_alarm") {
779 bool error = false; 787 bool error = false;
780 int len = mess.mid( 13 ).find("+++"); 788 int len = mess.mid( 13 ).find("+++");
781 if ( len < 2 ) 789 if ( len < 2 )
782 error = true; 790 error = true;
783 else { 791 else {
784 tempfilename = mess.mid( 13, len ); 792 tempfilename = mess.mid( 13, len );
785 if ( !QFile::exists( tempfilename ) ) 793 if ( !QFile::exists( tempfilename ) )
786 error = true; 794 error = true;
787 } 795 }
788 if ( ! error ) { 796 if ( ! error ) {
789 filename = tempfilename; 797 filename = tempfilename;
790 } 798 }
791 mAlarmMessage = mess.mid( 13+len+3 ); 799 mAlarmMessage = mess.mid( 13+len+3 );
792 //qDebug("suspend file %s ",tempfilename.latin1() ); 800 //qDebug("suspend file %s ",tempfilename.latin1() );
793 startAlarm( mAlarmMessage, filename); 801 startAlarm( mAlarmMessage, filename);
794 return; 802 return;
795 } 803 }
796 if ( mess.left( 11 ) == "timer_alarm") { 804 if ( mess.left( 11 ) == "timer_alarm") {
797 //mTimerTime = 0; 805 //mTimerTime = 0;
798 startAlarm( mess.mid( 11 ), filename ); 806 startAlarm( mess.mid( 11 ), filename );
799 return; 807 return;
800 } 808 }
801 if ( mess.left( 10 ) == "proc_alarm") { 809 if ( mess.left( 10 ) == "proc_alarm") {
802 bool error = false; 810 bool error = false;
803 int len = mess.mid( 10 ).find("+++"); 811 int len = mess.mid( 10 ).find("+++");
804 if ( len < 2 ) 812 if ( len < 2 )
805 error = true; 813 error = true;
806 else { 814 else {
807 tempfilename = mess.mid( 10, len ); 815 tempfilename = mess.mid( 10, len );
808 if ( !QFile::exists( tempfilename ) ) 816 if ( !QFile::exists( tempfilename ) )
809 error = true; 817 error = true;
810 } 818 }
811 if ( error ) { 819 if ( error ) {
812 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 820 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
813 mAlarmMessage += mess.mid( 10+len+3+9 ); 821 mAlarmMessage += mess.mid( 10+len+3+9 );
814 } else { 822 } else {
815 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 823 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
816 //qDebug("-----system command %s ",tempfilename.latin1() ); 824 //qDebug("-----system command %s ",tempfilename.latin1() );
817#ifndef _WIN32_ 825#ifndef _WIN32_
818 if ( vfork () == 0 ) { 826 if ( vfork () == 0 ) {
819 execl ( tempfilename.latin1(), 0 ); 827 execl ( tempfilename.latin1(), 0 );
820 return; 828 return;
821 } 829 }
822#else 830#else
823 QProcess* p = new QProcess(); 831 QProcess* p = new QProcess();
824 p->addArgument( tempfilename.latin1() ); 832 p->addArgument( tempfilename.latin1() );
825 p->start(); 833 p->start();
826 return; 834 return;
827#endif 835#endif
828 836
829 return; 837 return;
830 } 838 }
831 839
832 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 840 //qDebug("+++++++system command %s ",tempfilename.latin1() );
833 } 841 }
834 if ( mess.left( 11 ) == "audio_alarm") { 842 if ( mess.left( 11 ) == "audio_alarm") {
835 bool error = false; 843 bool error = false;
836 int len = mess.mid( 11 ).find("+++"); 844 int len = mess.mid( 11 ).find("+++");
837 if ( len < 2 ) 845 if ( len < 2 )
838 error = true; 846 error = true;
839 else { 847 else {
840 tempfilename = mess.mid( 11, len ); 848 tempfilename = mess.mid( 11, len );
841 if ( !QFile::exists( tempfilename ) ) 849 if ( !QFile::exists( tempfilename ) )
842 error = true; 850 error = true;
843 } 851 }
844 if ( ! error ) { 852 if ( ! error ) {
845 filename = tempfilename; 853 filename = tempfilename;
846 } 854 }
847 mAlarmMessage = mess.mid( 11+len+3+9 ); 855 mAlarmMessage = mess.mid( 11+len+3+9 );
848 //qDebug("audio file command %s ",tempfilename.latin1() ); 856 //qDebug("audio file command %s ",tempfilename.latin1() );
849 } 857 }
850 if ( mess.left( 9 ) == "cal_alarm") { 858 if ( mess.left( 9 ) == "cal_alarm") {
851 mAlarmMessage = mess.mid( 9 ) ; 859 mAlarmMessage = mess.mid( 9 ) ;
852 } 860 }
853 861
854 startAlarm( mAlarmMessage, filename ); 862 startAlarm( mAlarmMessage, filename );
855 863
856 864
857} 865}
858 866
859void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 867void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
860{ 868{
861 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 869 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
862 870
863 mSuspendAlarmNotification = noti; 871 mSuspendAlarmNotification = noti;
864 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 872 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
865 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 873 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
866 mSuspendTimer->start( ms , true ); 874 mSuspendTimer->start( ms , true );
867 875
868} 876}
869 877
870void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 878void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
871{ 879{
872 mNextAlarmDateTime = qdt; 880 mNextAlarmDateTime = qdt;
873 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 881 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
874 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 882 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
875#ifndef DESKTOP_VERSION 883#ifndef DESKTOP_VERSION
876 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 884 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
877#endif 885#endif
878 return; 886 return;
879 } 887 }
880 int maxSec; 888 int maxSec;
881 //maxSec = 5; //testing only 889 //maxSec = 5; //testing only
882 maxSec = 86400+3600; // one day+1hour 890 maxSec = 86400+3600; // one day+1hour
883 mAlarmNotification = noti; 891 mAlarmNotification = noti;
884 int sec = QDateTime::currentDateTime().secsTo( qdt ); 892 int sec = QDateTime::currentDateTime().secsTo( qdt );
885 if ( sec > maxSec ) { 893 if ( sec > maxSec ) {
886 mRecheckAlarmTimer->start( maxSec * 1000 ); 894 mRecheckAlarmTimer->start( maxSec * 1000 );
887 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 895 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
888 return; 896 return;
889 } else { 897 } else {
890 mRecheckAlarmTimer->stop(); 898 mRecheckAlarmTimer->stop();
891 } 899 }
892 //qDebug("Alarm timer started with secs: %d ", sec); 900 //qDebug("Alarm timer started with secs: %d ", sec);
893 mAlarmTimer->start( sec *1000 , true ); 901 mAlarmTimer->start( sec *1000 , true );
894 902
895} 903}
896// called by mRecheckAlarmTimer to get next alarm 904// called by mRecheckAlarmTimer to get next alarm
897// we need this, because a QTimer has only a max range of 25 days 905// we need this, because a QTimer has only a max range of 25 days
898void CalendarView::recheckTimerAlarm() 906void CalendarView::recheckTimerAlarm()
899{ 907{
900 mAlarmTimer->stop(); 908 mAlarmTimer->stop();
901 mRecheckAlarmTimer->stop(); 909 mRecheckAlarmTimer->stop();
902 mCalendar->checkAlarmForIncidence( 0, true ); 910 mCalendar->checkAlarmForIncidence( 0, true );
903} 911}
904void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 912void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
905{ 913{
906 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 914 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
907 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 915 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
908#ifndef DESKTOP_VERSION 916#ifndef DESKTOP_VERSION
909 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 917 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
910#endif 918#endif
911 return; 919 return;
912 } 920 }
913 mAlarmTimer->stop(); 921 mAlarmTimer->stop();
914} 922}
915void CalendarView::selectWeekNum ( int num ) 923void CalendarView::selectWeekNum ( int num )
916{ 924{
917 dateNavigator()->blockSignals( true ); 925 dateNavigator()->blockSignals( true );
918 dateNavigator()->selectWeek( num ); 926 dateNavigator()->selectWeek( num );
919 dateNavigator()->blockSignals( false ); 927 dateNavigator()->blockSignals( false );
920 mViewManager->showWeekView(); 928 mViewManager->showWeekView();
921} 929}
922KOViewManager *CalendarView::viewManager() 930KOViewManager *CalendarView::viewManager()
923{ 931{
924 return mViewManager; 932 return mViewManager;
925} 933}
926 934
@@ -2331,513 +2339,515 @@ void CalendarView::writeSettings()
2331 QValueList<int> listINT = mLeftFrame->sizes(); 2339 QValueList<int> listINT = mLeftFrame->sizes();
2332 config->writeEntry("Left Splitter Frame",listINT); 2340 config->writeEntry("Left Splitter Frame",listINT);
2333 QValueList<int> listINT2 = mMainFrame->sizes(); 2341 QValueList<int> listINT2 = mMainFrame->sizes();
2334 config->writeEntry("Main Splitter Frame",listINT2); 2342 config->writeEntry("Main Splitter Frame",listINT2);
2335#ifdef DESKTOP_VERSION 2343#ifdef DESKTOP_VERSION
2336 config->setGroup("WidgetLayout"); 2344 config->setGroup("WidgetLayout");
2337 QStringList list ;//= config->readListEntry("MainLayout"); 2345 QStringList list ;//= config->readListEntry("MainLayout");
2338 int x,y,w,h; 2346 int x,y,w,h;
2339 QWidget* wid; 2347 QWidget* wid;
2340 wid = topLevelWidget(); 2348 wid = topLevelWidget();
2341 x = wid->geometry().x(); 2349 x = wid->geometry().x();
2342 y = wid->geometry().y(); 2350 y = wid->geometry().y();
2343 w = wid->width(); 2351 w = wid->width();
2344 h = wid->height(); 2352 h = wid->height();
2345 list.clear(); 2353 list.clear();
2346 list << QString::number( x ); 2354 list << QString::number( x );
2347 list << QString::number( y ); 2355 list << QString::number( y );
2348 list << QString::number( w ); 2356 list << QString::number( w );
2349 list << QString::number( h ); 2357 list << QString::number( h );
2350 config->writeEntry("MainLayout",list ); 2358 config->writeEntry("MainLayout",list );
2351 2359
2352 wid = mEventEditor; 2360 wid = mEventEditor;
2353 x = wid->geometry().x(); 2361 x = wid->geometry().x();
2354 y = wid->geometry().y(); 2362 y = wid->geometry().y();
2355 w = wid->width(); 2363 w = wid->width();
2356 h = wid->height(); 2364 h = wid->height();
2357 list.clear(); 2365 list.clear();
2358 list << QString::number( x ); 2366 list << QString::number( x );
2359 list << QString::number( y ); 2367 list << QString::number( y );
2360 list << QString::number( w ); 2368 list << QString::number( w );
2361 list << QString::number( h ); 2369 list << QString::number( h );
2362 config->writeEntry("EditEventLayout",list ); 2370 config->writeEntry("EditEventLayout",list );
2363 2371
2364 wid = mTodoEditor; 2372 wid = mTodoEditor;
2365 x = wid->geometry().x(); 2373 x = wid->geometry().x();
2366 y = wid->geometry().y(); 2374 y = wid->geometry().y();
2367 w = wid->width(); 2375 w = wid->width();
2368 h = wid->height(); 2376 h = wid->height();
2369 list.clear(); 2377 list.clear();
2370 list << QString::number( x ); 2378 list << QString::number( x );
2371 list << QString::number( y ); 2379 list << QString::number( y );
2372 list << QString::number( w ); 2380 list << QString::number( w );
2373 list << QString::number( h ); 2381 list << QString::number( h );
2374 config->writeEntry("EditTodoLayout",list ); 2382 config->writeEntry("EditTodoLayout",list );
2375 wid = getEventViewerDialog(); 2383 wid = getEventViewerDialog();
2376 x = wid->geometry().x(); 2384 x = wid->geometry().x();
2377 y = wid->geometry().y(); 2385 y = wid->geometry().y();
2378 w = wid->width(); 2386 w = wid->width();
2379 h = wid->height(); 2387 h = wid->height();
2380 list.clear(); 2388 list.clear();
2381 list << QString::number( x ); 2389 list << QString::number( x );
2382 list << QString::number( y ); 2390 list << QString::number( y );
2383 list << QString::number( w ); 2391 list << QString::number( w );
2384 list << QString::number( h ); 2392 list << QString::number( h );
2385 config->writeEntry("ViewerLayout",list ); 2393 config->writeEntry("ViewerLayout",list );
2386 wid = mDialogManager->getSearchDialog(); 2394 wid = mDialogManager->getSearchDialog();
2387 if ( wid ) { 2395 if ( wid ) {
2388 x = wid->geometry().x(); 2396 x = wid->geometry().x();
2389 y = wid->geometry().y(); 2397 y = wid->geometry().y();
2390 w = wid->width(); 2398 w = wid->width();
2391 h = wid->height(); 2399 h = wid->height();
2392 list.clear(); 2400 list.clear();
2393 list << QString::number( x ); 2401 list << QString::number( x );
2394 list << QString::number( y ); 2402 list << QString::number( y );
2395 list << QString::number( w ); 2403 list << QString::number( w );
2396 list << QString::number( h ); 2404 list << QString::number( h );
2397 config->writeEntry("SearchLayout",list ); 2405 config->writeEntry("SearchLayout",list );
2398 } 2406 }
2399#endif 2407#endif
2400 2408
2401 2409
2402 config->sync(); 2410 config->sync();
2403} 2411}
2404 2412
2405void CalendarView::readFilterSettings(KConfig *config) 2413void CalendarView::readFilterSettings(KConfig *config)
2406{ 2414{
2407 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2415 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2408 2416
2409 mFilters.clear(); 2417 mFilters.clear();
2410 2418
2411 config->setGroup("General"); 2419 config->setGroup("General");
2412 QStringList filterList = config->readListEntry("CalendarFilters"); 2420 QStringList filterList = config->readListEntry("CalendarFilters");
2413 2421
2414 QStringList::ConstIterator it = filterList.begin(); 2422 QStringList::ConstIterator it = filterList.begin();
2415 QStringList::ConstIterator end = filterList.end(); 2423 QStringList::ConstIterator end = filterList.end();
2416 while(it != end) { 2424 while(it != end) {
2417 // kdDebug() << " filter: " << (*it) << endl; 2425 // kdDebug() << " filter: " << (*it) << endl;
2418 2426
2419 CalFilter *filter; 2427 CalFilter *filter;
2420 filter = new CalFilter(*it); 2428 filter = new CalFilter(*it);
2421 config->setGroup("Filter_" + (*it).utf8()); 2429 config->setGroup("Filter_" + (*it).utf8());
2422 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2430 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2423 filter->setCriteria(config->readNumEntry("Criteria",0)); 2431 filter->setCriteria(config->readNumEntry("Criteria",0));
2424 filter->setCategoryList(config->readListEntry("CategoryList")); 2432 filter->setCategoryList(config->readListEntry("CategoryList"));
2425 mFilters.append(filter); 2433 mFilters.append(filter);
2426 2434
2427 ++it; 2435 ++it;
2428 } 2436 }
2429 2437
2430 if (mFilters.count() == 0) { 2438 if (mFilters.count() == 0) {
2431 CalFilter *filter = new CalFilter(i18n("Default")); 2439 CalFilter *filter = new CalFilter(i18n("Default"));
2432 mFilters.append(filter); 2440 mFilters.append(filter);
2433 } 2441 }
2434 mFilterView->updateFilters(); 2442 mFilterView->updateFilters();
2435 config->setGroup("FilterView"); 2443 config->setGroup("FilterView");
2436 2444
2437 mFilterView->blockSignals(true); 2445 mFilterView->blockSignals(true);
2438 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2446 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2439 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2447 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2440 mFilterView->blockSignals(false); 2448 mFilterView->blockSignals(false);
2441 // We do it manually to avoid it being done twice by the above calls 2449 // We do it manually to avoid it being done twice by the above calls
2442 updateFilter(); 2450 updateFilter();
2443} 2451}
2444 2452
2445void CalendarView::writeFilterSettings(KConfig *config) 2453void CalendarView::writeFilterSettings(KConfig *config)
2446{ 2454{
2447 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2455 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2448 2456
2449 QStringList filterList; 2457 QStringList filterList;
2450 2458
2451 CalFilter *filter = mFilters.first(); 2459 CalFilter *filter = mFilters.first();
2452 while(filter) { 2460 while(filter) {
2453 // kdDebug() << " fn: " << filter->name() << endl; 2461 // kdDebug() << " fn: " << filter->name() << endl;
2454 filterList << filter->name(); 2462 filterList << filter->name();
2455 config->setGroup("Filter_" + filter->name().utf8()); 2463 config->setGroup("Filter_" + filter->name().utf8());
2456 config->writeEntry("Criteria",filter->criteria()); 2464 config->writeEntry("Criteria",filter->criteria());
2457 config->writeEntry("CategoryList",filter->categoryList()); 2465 config->writeEntry("CategoryList",filter->categoryList());
2458 filter = mFilters.next(); 2466 filter = mFilters.next();
2459 } 2467 }
2460 config->setGroup("General"); 2468 config->setGroup("General");
2461 config->writeEntry("CalendarFilters",filterList); 2469 config->writeEntry("CalendarFilters",filterList);
2462 2470
2463 config->setGroup("FilterView"); 2471 config->setGroup("FilterView");
2464 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2472 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2465 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2473 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2466} 2474}
2467 2475
2468 2476
2469void CalendarView::goToday() 2477void CalendarView::goToday()
2470{ 2478{
2471 if ( mViewManager->currentView()->isMonthView() ) 2479 if ( mViewManager->currentView()->isMonthView() )
2472 mNavigator->selectTodayMonth(); 2480 mNavigator->selectTodayMonth();
2473 else 2481 else
2474 mNavigator->selectToday(); 2482 mNavigator->selectToday();
2475} 2483}
2476 2484
2477void CalendarView::goNext() 2485void CalendarView::goNext()
2478{ 2486{
2479 mNavigator->selectNext(); 2487 mNavigator->selectNext();
2480} 2488}
2481 2489
2482void CalendarView::goPrevious() 2490void CalendarView::goPrevious()
2483{ 2491{
2484 mNavigator->selectPrevious(); 2492 mNavigator->selectPrevious();
2485} 2493}
2486void CalendarView::goNextMonth() 2494void CalendarView::goNextMonth()
2487{ 2495{
2488 mNavigator->selectNextMonth(); 2496 mNavigator->selectNextMonth();
2489} 2497}
2490 2498
2491void CalendarView::goPreviousMonth() 2499void CalendarView::goPreviousMonth()
2492{ 2500{
2493 mNavigator->selectPreviousMonth(); 2501 mNavigator->selectPreviousMonth();
2494} 2502}
2495 2503
2496void CalendarView::updateConfig() 2504void CalendarView::updateConfig()
2497{ 2505{
2498 if ( KOPrefs::instance()->mUseAppColors ) 2506 if ( KOPrefs::instance()->mUseAppColors )
2499 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2507 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2500 emit configChanged(); 2508 emit configChanged();
2501 mTodoList->updateConfig(); 2509 mTodoList->updateConfig();
2502 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2510 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2503 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2511 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2504 // To make the "fill window" configurations work 2512 // To make the "fill window" configurations work
2505 //mViewManager->raiseCurrentView(); 2513 //mViewManager->raiseCurrentView();
2506} 2514}
2507 2515
2508 2516
2509void CalendarView::eventChanged(Event *event) 2517void CalendarView::eventChanged(Event *event)
2510{ 2518{
2511 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2519 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2512 //updateUnmanagedViews(); 2520 //updateUnmanagedViews();
2513} 2521}
2514 2522
2515void CalendarView::eventAdded(Event *event) 2523void CalendarView::eventAdded(Event *event)
2516{ 2524{
2517 changeEventDisplay(event,KOGlobals::EVENTADDED); 2525 changeEventDisplay(event,KOGlobals::EVENTADDED);
2518} 2526}
2519 2527
2520void CalendarView::eventToBeDeleted(Event *) 2528void CalendarView::eventToBeDeleted(Event *)
2521{ 2529{
2522 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2530 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2523} 2531}
2524 2532
2525void CalendarView::eventDeleted() 2533void CalendarView::eventDeleted()
2526{ 2534{
2527 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2535 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2528} 2536}
2529void CalendarView::changeTodoDisplay(Todo *which, int action) 2537void CalendarView::changeTodoDisplay(Todo *which, int action)
2530{ 2538{
2531 changeIncidenceDisplay((Incidence *)which, action); 2539 changeIncidenceDisplay((Incidence *)which, action);
2532 mDateNavigator->updateView(); //LR 2540 mDateNavigator->updateView(); //LR
2533 //mDialogManager->updateSearchDialog(); 2541 //mDialogManager->updateSearchDialog();
2534 2542
2535 if (which) { 2543 if (which) {
2536 mViewManager->updateWNview(); 2544 mViewManager->updateWNview();
2537 //mTodoList->updateView(); 2545 //mTodoList->updateView();
2538 } 2546 }
2539 2547
2540} 2548}
2541 2549
2542void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2550void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2543{ 2551{
2544 updateUnmanagedViews(); 2552 updateUnmanagedViews();
2545 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2553 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2546 if ( action == KOGlobals::EVENTDELETED ) { //delete 2554 if ( action == KOGlobals::EVENTDELETED ) { //delete
2547 mCalendar->checkAlarmForIncidence( 0, true ); 2555 mCalendar->checkAlarmForIncidence( 0, true );
2548 if ( mEventViewerDialog ) 2556 if ( mEventViewerDialog )
2549 mEventViewerDialog->hide(); 2557 mEventViewerDialog->hide();
2550 } 2558 }
2551 else 2559 else
2552 mCalendar->checkAlarmForIncidence( which , false ); 2560 mCalendar->checkAlarmForIncidence( which , false );
2553} 2561}
2554 2562
2555// most of the changeEventDisplays() right now just call the view's 2563// most of the changeEventDisplays() right now just call the view's
2556// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2564// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2557void CalendarView::changeEventDisplay(Event *which, int action) 2565void CalendarView::changeEventDisplay(Event *which, int action)
2558{ 2566{
2559 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2567 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2560 changeIncidenceDisplay((Incidence *)which, action); 2568 changeIncidenceDisplay((Incidence *)which, action);
2561 mDateNavigator->updateView(); 2569 mDateNavigator->updateView();
2562 //mDialogManager->updateSearchDialog(); 2570 //mDialogManager->updateSearchDialog();
2563 2571
2564 if (which) { 2572 if (which) {
2565 // If there is an event view visible update the display 2573 // If there is an event view visible update the display
2566 mViewManager->currentView()->changeEventDisplay(which,action); 2574 mViewManager->currentView()->changeEventDisplay(which,action);
2567 // TODO: check, if update needed 2575 // TODO: check, if update needed
2568 // if (which->getTodoStatus()) { 2576 // if (which->getTodoStatus()) {
2569 mTodoList->updateView(); 2577 mTodoList->updateView();
2570 // } 2578 // }
2571 } else { 2579 } else {
2572 mViewManager->currentView()->updateView(); 2580 mViewManager->currentView()->updateView();
2573 } 2581 }
2574} 2582}
2575 2583
2576 2584
2577void CalendarView::updateTodoViews() 2585void CalendarView::updateTodoViews()
2578{ 2586{
2579 mTodoList->updateView(); 2587 mTodoList->updateView();
2580 mViewManager->currentView()->updateView(); 2588 mViewManager->currentView()->updateView();
2581 2589
2582} 2590}
2583 2591
2584 2592
2585void CalendarView::updateView(const QDate &start, const QDate &end) 2593void CalendarView::updateView(const QDate &start, const QDate &end)
2586{ 2594{
2595#ifdef DESKTOP_VERSION
2587 mDateScrollBar->setValue( start.dayOfYear()-1); 2596 mDateScrollBar->setValue( start.dayOfYear()-1);
2597#endif
2588 mTodoList->updateView(); 2598 mTodoList->updateView();
2589 mViewManager->updateView(start, end); 2599 mViewManager->updateView(start, end);
2590 //mDateNavigator->updateView(); 2600 //mDateNavigator->updateView();
2591} 2601}
2592 2602
2593void CalendarView::clearAllViews() 2603void CalendarView::clearAllViews()
2594{ 2604{
2595 mTodoList->clearList(); 2605 mTodoList->clearList();
2596 mViewManager->clearAllViews(); 2606 mViewManager->clearAllViews();
2597 SearchDialog * sd = mDialogManager->getSearchDialog(); 2607 SearchDialog * sd = mDialogManager->getSearchDialog();
2598 if ( sd ) { 2608 if ( sd ) {
2599 KOListView* kol = sd->listview(); 2609 KOListView* kol = sd->listview();
2600 if ( kol ) 2610 if ( kol )
2601 kol->clearList(); 2611 kol->clearList();
2602 } 2612 }
2603} 2613}
2604void CalendarView::updateView() 2614void CalendarView::updateView()
2605{ 2615{
2606 DateList tmpList = mNavigator->selectedDates(); 2616 DateList tmpList = mNavigator->selectedDates();
2607 2617
2608 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2618 if ( KOPrefs::instance()->mHideNonStartedTodos )
2609 mTodoList->updateView(); 2619 mTodoList->updateView();
2610 // We assume that the navigator only selects consecutive days. 2620 // We assume that the navigator only selects consecutive days.
2611 updateView( tmpList.first(), tmpList.last() ); 2621 updateView( tmpList.first(), tmpList.last() );
2612} 2622}
2613 2623
2614void CalendarView::updateUnmanagedViews() 2624void CalendarView::updateUnmanagedViews()
2615{ 2625{
2616 mDateNavigator->updateDayMatrix(); 2626 mDateNavigator->updateDayMatrix();
2617} 2627}
2618 2628
2619int CalendarView::msgItemDelete(const QString name) 2629int CalendarView::msgItemDelete(const QString name)
2620{ 2630{
2621 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2631 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2622 i18n("This item will be\npermanently deleted."), 2632 i18n("This item will be\npermanently deleted."),
2623 i18n("KO/Pi Confirmation"),i18n("Delete")); 2633 i18n("KO/Pi Confirmation"),i18n("Delete"));
2624} 2634}
2625 2635
2626 2636
2627void CalendarView::edit_cut() 2637void CalendarView::edit_cut()
2628{ 2638{
2629 Event *anEvent=0; 2639 Event *anEvent=0;
2630 2640
2631 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2641 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2632 2642
2633 if (mViewManager->currentView()->isEventView()) { 2643 if (mViewManager->currentView()->isEventView()) {
2634 if ( incidence && incidence->typeID() == eventID ) { 2644 if ( incidence && incidence->typeID() == eventID ) {
2635 anEvent = static_cast<Event *>(incidence); 2645 anEvent = static_cast<Event *>(incidence);
2636 } 2646 }
2637 } 2647 }
2638 2648
2639 if (!anEvent) { 2649 if (!anEvent) {
2640 KNotifyClient::beep(); 2650 KNotifyClient::beep();
2641 return; 2651 return;
2642 } 2652 }
2643 DndFactory factory( mCalendar ); 2653 DndFactory factory( mCalendar );
2644 factory.cutIncidence(anEvent); 2654 factory.cutIncidence(anEvent);
2645 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2655 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2646} 2656}
2647 2657
2648void CalendarView::edit_copy() 2658void CalendarView::edit_copy()
2649{ 2659{
2650 Event *anEvent=0; 2660 Event *anEvent=0;
2651 2661
2652 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2662 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2653 2663
2654 if (mViewManager->currentView()->isEventView()) { 2664 if (mViewManager->currentView()->isEventView()) {
2655 if ( incidence && incidence->typeID() == eventID ) { 2665 if ( incidence && incidence->typeID() == eventID ) {
2656 anEvent = static_cast<Event *>(incidence); 2666 anEvent = static_cast<Event *>(incidence);
2657 } 2667 }
2658 } 2668 }
2659 2669
2660 if (!anEvent) { 2670 if (!anEvent) {
2661 KNotifyClient::beep(); 2671 KNotifyClient::beep();
2662 return; 2672 return;
2663 } 2673 }
2664 DndFactory factory( mCalendar ); 2674 DndFactory factory( mCalendar );
2665 factory.copyIncidence(anEvent); 2675 factory.copyIncidence(anEvent);
2666} 2676}
2667 2677
2668void CalendarView::edit_paste() 2678void CalendarView::edit_paste()
2669{ 2679{
2670 QDate date = mNavigator->selectedDates().first(); 2680 QDate date = mNavigator->selectedDates().first();
2671 2681
2672 DndFactory factory( mCalendar ); 2682 DndFactory factory( mCalendar );
2673 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2683 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2674 2684
2675 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2685 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2676} 2686}
2677void CalendarView::edit_global_options() 2687void CalendarView::edit_global_options()
2678{ 2688{
2679 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2689 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2680 emit save(); 2690 emit save();
2681 emit saveStopTimer(); 2691 emit saveStopTimer();
2682 mDialogManager->showGlobalOptionsDialog(); 2692 mDialogManager->showGlobalOptionsDialog();
2683 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2693 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2684 emit saveStopTimer(); 2694 emit saveStopTimer();
2685 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!"), 2695 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!"),
2686 i18n("Timezone settings"),i18n("Reload"))) { 2696 i18n("Timezone settings"),i18n("Reload"))) {
2687 qDebug("KO: TZ reload cancelled "); 2697 qDebug("KO: TZ reload cancelled ");
2688 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2698 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2689 return; 2699 return;
2690 } 2700 }
2691 qDebug("KO: Timezone change "); 2701 qDebug("KO: Timezone change ");
2692 loadCalendars(); 2702 loadCalendars();
2693 setModified(true); 2703 setModified(true);
2694 } 2704 }
2695 else 2705 else
2696 qDebug("KO: No tz change "); 2706 qDebug("KO: No tz change ");
2697} 2707}
2698void CalendarView::edit_options() 2708void CalendarView::edit_options()
2699{ 2709{
2700 mDialogManager->showOptionsDialog(); 2710 mDialogManager->showOptionsDialog();
2701} 2711}
2702 2712
2703 2713
2704void CalendarView::slotSelectPickerDate( QDate d) 2714void CalendarView::slotSelectPickerDate( QDate d)
2705{ 2715{
2706 mDateFrame->hide(); 2716 mDateFrame->hide();
2707 if ( mDatePickerMode == 1 ) { 2717 if ( mDatePickerMode == 1 ) {
2708 mNavigator->slotDaySelect( d ); 2718 mNavigator->slotDaySelect( d );
2709 } else if ( mDatePickerMode == 2 ) { 2719 } else if ( mDatePickerMode == 2 ) {
2710 if ( mMoveIncidence->typeID() == todoID ) { 2720 if ( mMoveIncidence->typeID() == todoID ) {
2711 Todo * to = (Todo *) mMoveIncidence; 2721 Todo * to = (Todo *) mMoveIncidence;
2712 QTime tim; 2722 QTime tim;
2713 int len = 0; 2723 int len = 0;
2714 if ( to->hasStartDate() && to->hasDueDate() ) 2724 if ( to->hasStartDate() && to->hasDueDate() )
2715 len = to->dtStart().secsTo( to->dtDue()); 2725 len = to->dtStart().secsTo( to->dtDue());
2716 if ( to->hasDueDate() ) 2726 if ( to->hasDueDate() )
2717 tim = to->dtDue().time(); 2727 tim = to->dtDue().time();
2718 else { 2728 else {
2719 tim = QTime ( 0,0,0 ); 2729 tim = QTime ( 0,0,0 );
2720 to->setFloats( true ); 2730 to->setFloats( true );
2721 to->setHasDueDate( true ); 2731 to->setHasDueDate( true );
2722 } 2732 }
2723 QDateTime dt ( d,tim ); 2733 QDateTime dt ( d,tim );
2724 to->setDtDue( dt ); 2734 to->setDtDue( dt );
2725 2735
2726 if ( to->hasStartDate() ) { 2736 if ( to->hasStartDate() ) {
2727 if ( len>0 ) 2737 if ( len>0 )
2728 to->setDtStart(to->dtDue().addSecs( -len )); 2738 to->setDtStart(to->dtDue().addSecs( -len ));
2729 else 2739 else
2730 if (to->dtStart() > to->dtDue() ) 2740 if (to->dtStart() > to->dtDue() )
2731 to->setDtStart(to->dtDue().addDays( -3 )); 2741 to->setDtStart(to->dtDue().addDays( -3 ));
2732 } 2742 }
2733 2743
2734 todoChanged( to ); 2744 todoChanged( to );
2735 } else { 2745 } else {
2736 if ( mMoveIncidence->doesRecur() ) { 2746 if ( mMoveIncidence->doesRecur() ) {
2737#if 0 2747#if 0
2738 // PENDING implement this 2748 // PENDING implement this
2739 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2749 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2740 mCalendar()->addIncidence( newInc ); 2750 mCalendar()->addIncidence( newInc );
2741 if ( mMoveIncidence->typeID() == todoID ) 2751 if ( mMoveIncidence->typeID() == todoID )
2742 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2752 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2743 else 2753 else
2744 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2754 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2745 mMoveIncidence = newInc; 2755 mMoveIncidence = newInc;
2746 2756
2747#endif 2757#endif
2748 } 2758 }
2749 QTime tim = mMoveIncidence->dtStart().time(); 2759 QTime tim = mMoveIncidence->dtStart().time();
2750 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2760 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2751 QDateTime dt ( d,tim ); 2761 QDateTime dt ( d,tim );
2752 mMoveIncidence->setDtStart( dt ); 2762 mMoveIncidence->setDtStart( dt );
2753 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2763 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2754 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2764 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2755 } 2765 }
2756 2766
2757 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2767 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2758 } 2768 }
2759} 2769}
2760 2770
2761void CalendarView::removeCategories() 2771void CalendarView::removeCategories()
2762{ 2772{
2763 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2773 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2764 QStringList catList = KOPrefs::instance()->mCustomCategories; 2774 QStringList catList = KOPrefs::instance()->mCustomCategories;
2765 QStringList catIncList; 2775 QStringList catIncList;
2766 QStringList newCatList; 2776 QStringList newCatList;
2767 Incidence* inc = incList.first(); 2777 Incidence* inc = incList.first();
2768 int i; 2778 int i;
2769 int count = 0; 2779 int count = 0;
2770 while ( inc ) { 2780 while ( inc ) {
2771 newCatList.clear(); 2781 newCatList.clear();
2772 catIncList = inc->categories() ; 2782 catIncList = inc->categories() ;
2773 for( i = 0; i< catIncList.count(); ++i ) { 2783 for( i = 0; i< catIncList.count(); ++i ) {
2774 if ( catList.contains (catIncList[i])) 2784 if ( catList.contains (catIncList[i]))
2775 newCatList.append( catIncList[i] ); 2785 newCatList.append( catIncList[i] );
2776 } 2786 }
2777 newCatList.sort(); 2787 newCatList.sort();
2778 inc->setCategories( newCatList.join(",") ); 2788 inc->setCategories( newCatList.join(",") );
2779 inc = incList.next(); 2789 inc = incList.next();
2780 } 2790 }
2781} 2791}
2782 2792
2783int CalendarView::addCategories() 2793int CalendarView::addCategories()
2784{ 2794{
2785 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2795 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2786 QStringList catList = KOPrefs::instance()->mCustomCategories; 2796 QStringList catList = KOPrefs::instance()->mCustomCategories;
2787 QStringList catIncList; 2797 QStringList catIncList;
2788 Incidence* inc = incList.first(); 2798 Incidence* inc = incList.first();
2789 int i; 2799 int i;
2790 int count = 0; 2800 int count = 0;
2791 while ( inc ) { 2801 while ( inc ) {
2792 catIncList = inc->categories() ; 2802 catIncList = inc->categories() ;
2793 for( i = 0; i< catIncList.count(); ++i ) { 2803 for( i = 0; i< catIncList.count(); ++i ) {
2794 if ( !catList.contains (catIncList[i])) { 2804 if ( !catList.contains (catIncList[i])) {
2795 catList.append( catIncList[i] ); 2805 catList.append( catIncList[i] );
2796 //qDebug("add cat %s ", catIncList[i].latin1()); 2806 //qDebug("add cat %s ", catIncList[i].latin1());
2797 ++count; 2807 ++count;
2798 } 2808 }
2799 } 2809 }
2800 inc = incList.next(); 2810 inc = incList.next();
2801 } 2811 }
2802 catList.sort(); 2812 catList.sort();
2803 KOPrefs::instance()->mCustomCategories = catList; 2813 KOPrefs::instance()->mCustomCategories = catList;
2804 return count; 2814 return count;
2805} 2815}
2806 2816
2807void CalendarView::manageCategories() 2817void CalendarView::manageCategories()
2808{ 2818{
2809 KOCatPrefs* cp = new KOCatPrefs(); 2819 KOCatPrefs* cp = new KOCatPrefs();
2810 cp->show(); 2820 cp->show();
2811 int w =cp->sizeHint().width() ; 2821 int w =cp->sizeHint().width() ;
2812 int h = cp->sizeHint().height() ; 2822 int h = cp->sizeHint().height() ;
2813 int dw = QApplication::desktop()->width(); 2823 int dw = QApplication::desktop()->width();
2814 int dh = QApplication::desktop()->height(); 2824 int dh = QApplication::desktop()->height();
2815 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2825 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2816 if ( !cp->exec() ) { 2826 if ( !cp->exec() ) {
2817 delete cp; 2827 delete cp;
2818 return; 2828 return;
2819 } 2829 }
2820 int count = 0; 2830 int count = 0;
2821 if ( cp->addCat() ) { 2831 if ( cp->addCat() ) {
2822 count = addCategories(); 2832 count = addCategories();
2823 if ( count ) { 2833 if ( count ) {
2824 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2834 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2825 writeSettings(); 2835 writeSettings();
2826 } else 2836 } else
2827 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2837 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2828 } else { 2838 } else {
2829 removeCategories(); 2839 removeCategories();
2830 updateView(); 2840 updateView();
2831 } 2841 }
2832 delete cp; 2842 delete cp;
2833} 2843}
2834 2844
2835void CalendarView::beamIncidence(Incidence * Inc) 2845void CalendarView::beamIncidence(Incidence * Inc)
2836{ 2846{
2837 QPtrList<Incidence> delSel ; 2847 QPtrList<Incidence> delSel ;
2838 delSel.append(Inc); 2848 delSel.append(Inc);
2839 beamIncidenceList( delSel ); 2849 beamIncidenceList( delSel );
2840} 2850}
2841void CalendarView::beamCalendar() 2851void CalendarView::beamCalendar()
2842{ 2852{
2843 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2853 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index c89bbf7..f7e5366 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -282,374 +282,376 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
282 void deleteEvent(Event *); 282 void deleteEvent(Event *);
283 /** Delete the event with the given unique ID. Returns false, if event wasn't 283 /** Delete the event with the given unique ID. Returns false, if event wasn't
284 found. */ 284 found. */
285 bool deleteEvent(const QString &uid); 285 bool deleteEvent(const QString &uid);
286 /** Create a read-only viewer dialog for the supplied event. */ 286 /** Create a read-only viewer dialog for the supplied event. */
287 void showEvent(Event *); 287 void showEvent(Event *);
288 288
289 void editJournal(Journal *); 289 void editJournal(Journal *);
290 void showJournal(Journal *); 290 void showJournal(Journal *);
291 void deleteJournal(Journal *); 291 void deleteJournal(Journal *);
292 /** Create an editor dialog for a todo */ 292 /** Create an editor dialog for a todo */
293 void editTodo(Todo *); 293 void editTodo(Todo *);
294 /** Create a read-only viewer dialog for the supplied todo */ 294 /** Create a read-only viewer dialog for the supplied todo */
295 void showTodo(Todo *); 295 void showTodo(Todo *);
296 /** create new todo */ 296 /** create new todo */
297 void newTodo(); 297 void newTodo();
298 void newTodoDateTime(QDateTime, bool allday); 298 void newTodoDateTime(QDateTime, bool allday);
299 /** create new todo with a parent todo */ 299 /** create new todo with a parent todo */
300 void newSubTodo(); 300 void newSubTodo();
301 /** create new todo with a parent todo */ 301 /** create new todo with a parent todo */
302 void newSubTodo(Todo *); 302 void newSubTodo(Todo *);
303 /** Delete todo */ 303 /** Delete todo */
304 void deleteTodo(Todo *); 304 void deleteTodo(Todo *);
305 305
306 306
307 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 307 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
308 * emitted as result. */ 308 * emitted as result. */
309 void checkClipboard(); 309 void checkClipboard();
310 310
311 /** using the KConfig associated with the kapp variable, read in the 311 /** using the KConfig associated with the kapp variable, read in the
312 * settings from the config file. 312 * settings from the config file.
313 */ 313 */
314 void readSettings(); 314 void readSettings();
315 315
316 /** write current state to config file. */ 316 /** write current state to config file. */
317 void writeSettings(); 317 void writeSettings();
318 318
319 /** read settings for calendar filters */ 319 /** read settings for calendar filters */
320 void readFilterSettings(KConfig *config); 320 void readFilterSettings(KConfig *config);
321 321
322 /** write settings for calendar filters */ 322 /** write settings for calendar filters */
323 void writeFilterSettings(KConfig *config); 323 void writeFilterSettings(KConfig *config);
324 324
325 /** passes on the message that an event has changed to the currently 325 /** passes on the message that an event has changed to the currently
326 * activated view so that it can make appropriate display changes. */ 326 * activated view so that it can make appropriate display changes. */
327 void changeEventDisplay(Event *, int); 327 void changeEventDisplay(Event *, int);
328 void changeIncidenceDisplay(Incidence *, int); 328 void changeIncidenceDisplay(Incidence *, int);
329 void changeTodoDisplay(Todo *, int); 329 void changeTodoDisplay(Todo *, int);
330 330
331 void eventAdded(Event *); 331 void eventAdded(Event *);
332 void eventChanged(Event *); 332 void eventChanged(Event *);
333 void eventToBeDeleted(Event *); 333 void eventToBeDeleted(Event *);
334 void eventDeleted(); 334 void eventDeleted();
335 335
336 void todoAdded(Todo *); 336 void todoAdded(Todo *);
337 void todoChanged(Todo *); 337 void todoChanged(Todo *);
338 void todoToBeDeleted(Todo *); 338 void todoToBeDeleted(Todo *);
339 void todoDeleted(); 339 void todoDeleted();
340 340
341 void updateView(const QDate &start, const QDate &end); 341 void updateView(const QDate &start, const QDate &end);
342 void updateView(); 342 void updateView();
343 void clearAllViews(); 343 void clearAllViews();
344 344
345 /** Full update of visible todo views */ 345 /** Full update of visible todo views */
346 void updateTodoViews(); 346 void updateTodoViews();
347 347
348 void updateUnmanagedViews(); 348 void updateUnmanagedViews();
349 349
350 /** cut the current appointment to the clipboard */ 350 /** cut the current appointment to the clipboard */
351 void edit_cut(); 351 void edit_cut();
352 352
353 /** copy the current appointment(s) to the clipboard */ 353 /** copy the current appointment(s) to the clipboard */
354 void edit_copy(); 354 void edit_copy();
355 355
356 /** paste the current vobject(s) in the clipboard buffer into calendar */ 356 /** paste the current vobject(s) in the clipboard buffer into calendar */
357 void edit_paste(); 357 void edit_paste();
358 358
359 /** edit viewing and configuration options. */ 359 /** edit viewing and configuration options. */
360 void edit_options(); 360 void edit_options();
361 void edit_global_options(); 361 void edit_global_options();
362 /** 362 /**
363 Functions for printing, previewing a print, and setting up printing 363 Functions for printing, previewing a print, and setting up printing
364 parameters. 364 parameters.
365 */ 365 */
366 void print(); 366 void print();
367 void printSetup(); 367 void printSetup();
368 void printPreview(); 368 void printPreview();
369 369
370 /** Export as iCalendar file */ 370 /** Export as iCalendar file */
371 void exportICalendar(); 371 void exportICalendar();
372 372
373 /** Export as vCalendar file */ 373 /** Export as vCalendar file */
374 bool exportVCalendar( QString fn); 374 bool exportVCalendar( QString fn);
375 375
376 /** pop up a dialog to show an existing appointment. */ 376 /** pop up a dialog to show an existing appointment. */
377 void appointment_show(); 377 void appointment_show();
378 /** 378 /**
379 * pop up an Appointment Dialog to edit an existing appointment.Get 379 * pop up an Appointment Dialog to edit an existing appointment.Get
380 * information on the appointment from the list of unique IDs that is 380 * information on the appointment from the list of unique IDs that is
381 * currently in the View, called currIds. 381 * currently in the View, called currIds.
382 */ 382 */
383 void appointment_edit(); 383 void appointment_edit();
384 /** 384 /**
385 * pop up dialog confirming deletion of currently selected event in the 385 * pop up dialog confirming deletion of currently selected event in the
386 * View. 386 * View.
387 */ 387 */
388 void appointment_delete(); 388 void appointment_delete();
389 389
390 /** mails the currently selected event to a particular user as a vCalendar 390 /** mails the currently selected event to a particular user as a vCalendar
391 attachment. */ 391 attachment. */
392 void action_mail(); 392 void action_mail();
393 393
394 /* frees a subtodo from it's relation */ 394 /* frees a subtodo from it's relation */
395 void todo_unsub( Todo * ); 395 void todo_unsub( Todo * );
396 void todo_resub( Todo * parent, Todo * sub ); 396 void todo_resub( Todo * parent, Todo * sub );
397 397
398 /** Take ownership of selected event. */ 398 /** Take ownership of selected event. */
399 void takeOverEvent(); 399 void takeOverEvent();
400 400
401 /** Take ownership of all events in calendar. */ 401 /** Take ownership of all events in calendar. */
402 void takeOverCalendar(); 402 void takeOverCalendar();
403 403
404 /** query whether or not the calendar is "dirty". */ 404 /** query whether or not the calendar is "dirty". */
405 bool isModified(); 405 bool isModified();
406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
407 void setModified(bool modified=true); 407 void setModified(bool modified=true);
408 408
409 /** query if the calendar is read-only. */ 409 /** query if the calendar is read-only. */
410 bool isReadOnly(); 410 bool isReadOnly();
411 /** set state of calendar to read-only */ 411 /** set state of calendar to read-only */
412 void setReadOnly(bool readOnly=true); 412 void setReadOnly(bool readOnly=true);
413 413
414 void eventUpdated(Incidence *); 414 void eventUpdated(Incidence *);
415 415
416 /* iTIP scheduling actions */ 416 /* iTIP scheduling actions */
417 void schedule_publish(Incidence *incidence = 0); 417 void schedule_publish(Incidence *incidence = 0);
418 void schedule_request(Incidence *incidence = 0); 418 void schedule_request(Incidence *incidence = 0);
419 void schedule_refresh(Incidence *incidence = 0); 419 void schedule_refresh(Incidence *incidence = 0);
420 void schedule_cancel(Incidence *incidence = 0); 420 void schedule_cancel(Incidence *incidence = 0);
421 void schedule_add(Incidence *incidence = 0); 421 void schedule_add(Incidence *incidence = 0);
422 void schedule_reply(Incidence *incidence = 0); 422 void schedule_reply(Incidence *incidence = 0);
423 void schedule_counter(Incidence *incidence = 0); 423 void schedule_counter(Incidence *incidence = 0);
424 void schedule_declinecounter(Incidence *incidence = 0); 424 void schedule_declinecounter(Incidence *incidence = 0);
425 void schedule_publish_freebusy(int daysToPublish = 30); 425 void schedule_publish_freebusy(int daysToPublish = 30);
426 426
427 void openAddressbook(); 427 void openAddressbook();
428 428
429 void editFilters(); 429 void editFilters();
430 void toggleFilerEnabled(); 430 void toggleFilerEnabled();
431 QPtrList<CalFilter> filters(); 431 QPtrList<CalFilter> filters();
432 void toggleFilter(); 432 void toggleFilter();
433 void showFilter(bool visible); 433 void showFilter(bool visible);
434 void updateFilter(); 434 void updateFilter();
435 void filterEdited(); 435 void filterEdited();
436 void selectFilter( int ); 436 void selectFilter( int );
437 KOFilterView *filterView(); 437 KOFilterView *filterView();
438 438
439 void showIntro(); 439 void showIntro();
440 440
441 /** Move the curdatepient view date to today */ 441 /** Move the curdatepient view date to today */
442 void goToday(); 442 void goToday();
443 443
444 /** Move to the next date(s) in the current view */ 444 /** Move to the next date(s) in the current view */
445 void goNext(); 445 void goNext();
446 446
447 /** Move to the previous date(s) in the current view */ 447 /** Move to the previous date(s) in the current view */
448 void goPrevious(); 448 void goPrevious();
449 /** Move to the next date(s) in the current view */ 449 /** Move to the next date(s) in the current view */
450 void goNextMonth(); 450 void goNextMonth();
451 451
452 /** Move to the previous date(s) in the current view */ 452 /** Move to the previous date(s) in the current view */
453 void goPreviousMonth(); 453 void goPreviousMonth();
454 454
455 void toggleExpand(); 455 void toggleExpand();
456 void toggleDateNavigatorWidget(); 456 void toggleDateNavigatorWidget();
457 void toggleAllDaySize(); 457 void toggleAllDaySize();
458 void dialogClosing(Incidence *); 458 void dialogClosing(Incidence *);
459 459
460 /** Look for new messages in the inbox */ 460 /** Look for new messages in the inbox */
461 void lookForIncomingMessages(); 461 void lookForIncomingMessages();
462 /** Look for new messages in the outbox */ 462 /** Look for new messages in the outbox */
463 void lookForOutgoingMessages(); 463 void lookForOutgoingMessages();
464 464
465 void processMainViewSelection( Incidence * ); 465 void processMainViewSelection( Incidence * );
466 void processTodoListSelection( Incidence * ); 466 void processTodoListSelection( Incidence * );
467 467
468 void processIncidenceSelection( Incidence * ); 468 void processIncidenceSelection( Incidence * );
469 469
470 void purgeCompleted(); 470 void purgeCompleted();
471 bool removeCompletedSubTodos( Todo* ); 471 bool removeCompletedSubTodos( Todo* );
472 void slotCalendarChanged(); 472 void slotCalendarChanged();
473 bool importBday(); 473 bool importBday();
474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
475 bool importQtopia( const QString &categoriesFile, 475 bool importQtopia( const QString &categoriesFile,
476 const QString &datebookFile, 476 const QString &datebookFile,
477 const QString &tasklistFile ); 477 const QString &tasklistFile );
478 void syncExternal( int mode ); 478 void syncExternal( int mode );
479 void slotSelectPickerDate( QDate ) ; 479 void slotSelectPickerDate( QDate ) ;
480 void showDatePicker() ; 480 void showDatePicker() ;
481 void showDatePickerPopup() ; 481 void showDatePickerPopup() ;
482 void moveIncidence(Incidence *) ; 482 void moveIncidence(Incidence *) ;
483 void beamIncidence(Incidence *) ; 483 void beamIncidence(Incidence *) ;
484 void beamCalendar() ; 484 void beamCalendar() ;
485 void beamFilteredCalendar() ; 485 void beamFilteredCalendar() ;
486 void beamIncidenceList(QPtrList<Incidence>) ; 486 void beamIncidenceList(QPtrList<Incidence>) ;
487 void manageCategories(); 487 void manageCategories();
488 int addCategories(); 488 int addCategories();
489 void removeCategories(); 489 void removeCategories();
490 void setSyncDevice( QString ); 490 void setSyncDevice( QString );
491 void setSyncName( QString ); 491 void setSyncName( QString );
492 void showDay( QDate ); 492 void showDay( QDate );
493 void undo_delete(); 493 void undo_delete();
494 protected slots: 494 protected slots:
495 void resetFocus(); 495 void resetFocus();
496 void scrollBarValue(int); 496 void scrollBarValue(int);
497 void slotViewerClosed(); 497 void slotViewerClosed();
498 void timerAlarm(); 498 void timerAlarm();
499 void suspendAlarm(); 499 void suspendAlarm();
500 void beamDone( Ir *ir ); 500 void beamDone( Ir *ir );
501 /** Select a view or adapt the current view to display the specified dates. */ 501 /** Select a view or adapt the current view to display the specified dates. */
502 void showDates( const KCal::DateList & ); 502 void showDates( const KCal::DateList & );
503 void selectWeekNum ( int ); 503 void selectWeekNum ( int );
504 504
505 public: 505 public:
506 // show a standard warning 506 // show a standard warning
507 // returns KMsgBox::yesNoCancel() 507 // returns KMsgBox::yesNoCancel()
508 int msgCalModified(); 508 int msgCalModified();
509 virtual bool sync(KSyncManager* manager, QString filename, int mode); 509 virtual bool sync(KSyncManager* manager, QString filename, int mode);
510 510
511 virtual bool syncExternal(KSyncManager* manager, QString resource); 511 virtual bool syncExternal(KSyncManager* manager, QString resource);
512 virtual void removeSyncInfo( QString syncProfile); 512 virtual void removeSyncInfo( QString syncProfile);
513 void setSyncManager(KSyncManager* manager); 513 void setSyncManager(KSyncManager* manager);
514 void setLoadedFileVersion(QDateTime); 514 void setLoadedFileVersion(QDateTime);
515 bool checkFileVersion(QString fn); 515 bool checkFileVersion(QString fn);
516 bool checkAllFileVersions(); 516 bool checkAllFileVersions();
517 bool checkFileChanged(QString fn); 517 bool checkFileChanged(QString fn);
518 Event* getLastSyncEvent(); 518 Event* getLastSyncEvent();
519 /** Adapt navigation units correpsonding to step size of navigation of the 519 /** Adapt navigation units correpsonding to step size of navigation of the
520 * current view. 520 * current view.
521 */ 521 */
522 void adaptNavigationUnits(); 522 void adaptNavigationUnits();
523 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 523 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
524 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 524 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
525 //Attendee* getYourAttendee(Event *event); 525 //Attendee* getYourAttendee(Event *event);
526 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 526 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
527 void setScrollBarStep(int val ); 527 void setScrollBarStep(int val );
528 528
529 protected: 529 protected:
530 void schedule(Scheduler::Method, Incidence *incidence = 0); 530 void schedule(Scheduler::Method, Incidence *incidence = 0);
531 531
532 // returns KMsgBox::OKCandel() 532 // returns KMsgBox::OKCandel()
533 int msgItemDelete(const QString name); 533 int msgItemDelete(const QString name);
534 void showEventEditor(); 534 void showEventEditor();
535 void showTodoEditor(); 535 void showTodoEditor();
536 Todo *selectedTodo(); 536 Todo *selectedTodo();
537 private: 537 private:
538#ifdef DESKTOP_VERSION
538 QScrollBar * mDateScrollBar; 539 QScrollBar * mDateScrollBar;
540#endif
539 QDateTime mNextAlarmDateTime; 541 QDateTime mNextAlarmDateTime;
540 bool mViewerCallerIsSearchDialog; 542 bool mViewerCallerIsSearchDialog;
541 bool mBlockShowDates; 543 bool mBlockShowDates;
542 KSyncManager* mSyncManager; 544 KSyncManager* mSyncManager;
543 AlarmDialog * mAlarmDialog; 545 AlarmDialog * mAlarmDialog;
544 QString mAlarmNotification; 546 QString mAlarmNotification;
545 QString mSuspendAlarmNotification; 547 QString mSuspendAlarmNotification;
546 QTimer* mSuspendTimer; 548 QTimer* mSuspendTimer;
547 QTimer* mAlarmTimer; 549 QTimer* mAlarmTimer;
548 QTimer* mRecheckAlarmTimer; 550 QTimer* mRecheckAlarmTimer;
549 void computeAlarm( QString ); 551 void computeAlarm( QString );
550 void startAlarm( QString, QString ); 552 void startAlarm( QString, QString );
551 void setSyncEventsReadOnly(); 553 void setSyncEventsReadOnly();
552 554
553 QDateTime loadedFileVersion; 555 QDateTime loadedFileVersion;
554 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 556 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
555 void checkExternalId( Incidence * inc ); 557 void checkExternalId( Incidence * inc );
556 int mGlobalSyncMode; 558 int mGlobalSyncMode;
557 QString mCurrentSyncDevice; 559 QString mCurrentSyncDevice;
558 QString mCurrentSyncName; 560 QString mCurrentSyncName;
559 void init(); 561 void init();
560 int mDatePickerMode; 562 int mDatePickerMode;
561 bool mFlagEditDescription; 563 bool mFlagEditDescription;
562 QDateTime mLastCalendarSync; 564 QDateTime mLastCalendarSync;
563 void createPrinter(); 565 void createPrinter();
564 566
565 void calendarModified( bool, Calendar * ); 567 void calendarModified( bool, Calendar * );
566 568
567 CalPrinter *mCalPrinter; 569 CalPrinter *mCalPrinter;
568 570
569 QSplitter *mPanner; 571 QSplitter *mPanner;
570 QSplitter *mLeftSplitter; 572 QSplitter *mLeftSplitter;
571 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 573 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
572 QWidgetStack *mRightFrame; 574 QWidgetStack *mRightFrame;
573 575
574 KDatePicker* mDatePicker; 576 KDatePicker* mDatePicker;
575 QVBox* mDateFrame; 577 QVBox* mDateFrame;
576 578
577 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 579 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
578 580
579 KOFilterView *mFilterView; 581 KOFilterView *mFilterView;
580 KOCalEditView *mCalEditView; 582 KOCalEditView *mCalEditView;
581 583
582 ResourceView *mResourceView; 584 ResourceView *mResourceView;
583 585
584 // calendar object for this viewing instance 586 // calendar object for this viewing instance
585 Calendar *mCalendar; 587 Calendar *mCalendar;
586 588
587 CalendarResourceManager *mResourceManager; 589 CalendarResourceManager *mResourceManager;
588 590
589 FileStorage *mStorage; 591 FileStorage *mStorage;
590 592
591 DateNavigator *mNavigator; 593 DateNavigator *mNavigator;
592 594
593 KOViewManager *mViewManager; 595 KOViewManager *mViewManager;
594 KODialogManager *mDialogManager; 596 KODialogManager *mDialogManager;
595 597
596 // Calendar filters 598 // Calendar filters
597 QPtrList<CalFilter> mFilters; 599 QPtrList<CalFilter> mFilters;
598 600
599 // various housekeeping variables. 601 // various housekeeping variables.
600 bool mModified; // flag indicating if calendar is modified 602 bool mModified; // flag indicating if calendar is modified
601 bool mReadOnly; // flag indicating if calendar is read-only 603 bool mReadOnly; // flag indicating if calendar is read-only
602 QDate mSaveSingleDate; 604 QDate mSaveSingleDate;
603 605
604 Incidence *mSelectedIncidence; 606 Incidence *mSelectedIncidence;
605 Incidence *mMoveIncidence; 607 Incidence *mMoveIncidence;
606 QDate mMoveIncidenceOldDate; 608 QDate mMoveIncidenceOldDate;
607 KOTodoView *mTodoList; 609 KOTodoView *mTodoList;
608 KOEventEditor * mEventEditor; 610 KOEventEditor * mEventEditor;
609 KOTodoEditor * mTodoEditor; 611 KOTodoEditor * mTodoEditor;
610 KOEventViewerDialog * mEventViewerDialog; 612 KOEventViewerDialog * mEventViewerDialog;
611 void keyPressEvent ( QKeyEvent *e) ; 613 void keyPressEvent ( QKeyEvent *e) ;
612 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 614 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
613}; 615};
614 616
615 617
616class CalendarViewVisitor : public Incidence::Visitor 618class CalendarViewVisitor : public Incidence::Visitor
617{ 619{
618 public: 620 public:
619 CalendarViewVisitor() : mView( 0 ) {} 621 CalendarViewVisitor() : mView( 0 ) {}
620 622
621 bool act( Incidence *incidence, CalendarView *view ) 623 bool act( Incidence *incidence, CalendarView *view )
622 { 624 {
623 mView = view; 625 mView = view;
624 return incidence->accept( *this ); 626 return incidence->accept( *this );
625 } 627 }
626 628
627 protected: 629 protected:
628 CalendarView *mView; 630 CalendarView *mView;
629}; 631};
630 632
631class ShowIncidenceVisitor : public CalendarViewVisitor 633class ShowIncidenceVisitor : public CalendarViewVisitor
632{ 634{
633 protected: 635 protected:
634 bool visit( Event *event ) { mView->showEvent( event ); return true; } 636 bool visit( Event *event ) { mView->showEvent( event ); return true; }
635 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 637 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
636 bool visit( Journal * j ) { mView->showJournal( j );return true; } 638 bool visit( Journal * j ) { mView->showJournal( j );return true; }
637}; 639};
638 640
639class EditIncidenceVisitor : public CalendarViewVisitor 641class EditIncidenceVisitor : public CalendarViewVisitor
640{ 642{
641 protected: 643 protected:
642 bool visit( Event *event ) { mView->editEvent( event ); return true; } 644 bool visit( Event *event ) { mView->editEvent( event ); return true; }
643 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 645 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
644 bool visit( Journal *j ) { mView->editJournal( j); return true; } 646 bool visit( Journal *j ) { mView->editJournal( j); return true; }
645}; 647};
646 648
647class DeleteIncidenceVisitor : public CalendarViewVisitor 649class DeleteIncidenceVisitor : public CalendarViewVisitor
648{ 650{
649 protected: 651 protected:
650 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 652 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
651 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 653 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
652 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 654 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
653}; 655};
654 656
655#endif 657#endif