summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-03 23:11:33 (UTC)
committer zautrix <zautrix>2005-06-03 23:11:33 (UTC)
commitaa0f7df485c3ff0c298d4924ac1e8a5e9e6da627 (patch) (unidiff)
treeeed3edfc9210e1bca07de6d642dc2486ba8bedfd
parent858b047efb5627824438cb3877e7bec0cebb3751 (diff)
downloadkdepimpi-aa0f7df485c3ff0c298d4924ac1e8a5e9e6da627.zip
kdepimpi-aa0f7df485c3ff0c298d4924ac1e8a5e9e6da627.tar.gz
kdepimpi-aa0f7df485c3ff0c298d4924ac1e8a5e9e6da627.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 36db9c4..c01be9b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -249,769 +249,769 @@ void MissedAlarmTextBrowser::setSource(const QString & n)
249 } else if (n.startsWith("todo:")) { 249 } else if (n.startsWith("todo:")) {
250#ifdef DESKTOP_VERSION 250#ifdef DESKTOP_VERSION
251 emit showIncidence(n.mid(7)); 251 emit showIncidence(n.mid(7));
252#else 252#else
253 emit showIncidence(n.mid(5)); 253 emit showIncidence(n.mid(5));
254#endif 254#endif
255 return; 255 return;
256 } 256 }
257} 257}
258 258
259 259
260class KOBeamPrefs : public QDialog 260class KOBeamPrefs : public QDialog
261{ 261{
262 public: 262 public:
263 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 263 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
264 QDialog( parent, name, true ) 264 QDialog( parent, name, true )
265 { 265 {
266 setCaption( i18n("Beam Options") ); 266 setCaption( i18n("Beam Options") );
267 QVBoxLayout* lay = new QVBoxLayout( this ); 267 QVBoxLayout* lay = new QVBoxLayout( this );
268 lay->setSpacing( 3 ); 268 lay->setSpacing( 3 );
269 lay->setMargin( 3 ); 269 lay->setMargin( 3 );
270 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 270 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
271 lay->addWidget( format ); 271 lay->addWidget( format );
272 format->setExclusive ( true ) ; 272 format->setExclusive ( true ) ;
273 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 273 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
274 lay->addWidget( time ); time->setExclusive ( true ) ; 274 lay->addWidget( time ); time->setExclusive ( true ) ;
275 vcal = new QRadioButton(" vCalendar ", format ); 275 vcal = new QRadioButton(" vCalendar ", format );
276 ical = new QRadioButton(" iCalendar ", format ); 276 ical = new QRadioButton(" iCalendar ", format );
277 vcal->setChecked( true ); 277 vcal->setChecked( true );
278 tz = new QRadioButton(i18n(" With timezone "), time ); 278 tz = new QRadioButton(i18n(" With timezone "), time );
279 local = new QRadioButton(i18n(" Local time "), time ); 279 local = new QRadioButton(i18n(" Local time "), time );
280 tz->setChecked( true ); 280 tz->setChecked( true );
281 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 281 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
282 lay->addWidget( ok ); 282 lay->addWidget( ok );
283 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 283 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
284 lay->addWidget( cancel ); 284 lay->addWidget( cancel );
285 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 285 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
286 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 286 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
287 resize( 200, 200 ); 287 resize( 200, 200 );
288 } 288 }
289 289
290 bool beamVcal() { return vcal->isChecked(); } 290 bool beamVcal() { return vcal->isChecked(); }
291 bool beamLocal() { return local->isChecked(); } 291 bool beamLocal() { return local->isChecked(); }
292private: 292private:
293 QRadioButton* vcal, *ical, *local, *tz; 293 QRadioButton* vcal, *ical, *local, *tz;
294}; 294};
295class KOCatPrefs : public QDialog 295class KOCatPrefs : public QDialog
296{ 296{
297 public: 297 public:
298 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 298 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
299 QDialog( parent, name, true ) 299 QDialog( parent, name, true )
300 { 300 {
301 setCaption( i18n("Manage new Categories") ); 301 setCaption( i18n("Manage new Categories") );
302 QVBoxLayout* lay = new QVBoxLayout( this ); 302 QVBoxLayout* lay = new QVBoxLayout( this );
303 lay->setSpacing( 3 ); 303 lay->setSpacing( 3 );
304 lay->setMargin( 3 ); 304 lay->setMargin( 3 );
305 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 ); 305 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 );
306 lay->addWidget( lab ); 306 lay->addWidget( lab );
307 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 307 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
308 lay->addWidget( format ); 308 lay->addWidget( format );
309 format->setExclusive ( true ) ; 309 format->setExclusive ( true ) ;
310 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 310 addCatBut = new QRadioButton(i18n("Add to category list"), format );
311 new QRadioButton(i18n("Remove from Events/Todos"), format ); 311 new QRadioButton(i18n("Remove from Events/Todos"), format );
312 addCatBut->setChecked( true ); 312 addCatBut->setChecked( true );
313 QPushButton * ok = new QPushButton( i18n("OK"), this ); 313 QPushButton * ok = new QPushButton( i18n("OK"), this );
314 lay->addWidget( ok ); 314 lay->addWidget( ok );
315 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 315 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
316 lay->addWidget( cancel ); 316 lay->addWidget( cancel );
317 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 317 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
318 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 318 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
319 resize( 200, 200 ); 319 resize( 200, 200 );
320 } 320 }
321 321
322 bool addCat() { return addCatBut->isChecked(); } 322 bool addCat() { return addCatBut->isChecked(); }
323private: 323private:
324 QRadioButton* addCatBut; 324 QRadioButton* addCatBut;
325}; 325};
326 326
327 327
328 328
329CalendarView::CalendarView( CalendarResources *calendar, 329CalendarView::CalendarView( CalendarResources *calendar,
330 QWidget *parent, const char *name ) 330 QWidget *parent, const char *name )
331 : CalendarViewBase( parent, name ), 331 : CalendarViewBase( parent, name ),
332 mCalendar( calendar ), 332 mCalendar( calendar ),
333 mResourceManager( calendar->resourceManager() ) 333 mResourceManager( calendar->resourceManager() )
334{ 334{
335 335
336 mEventEditor = 0; 336 mEventEditor = 0;
337 mTodoEditor = 0; 337 mTodoEditor = 0;
338 338
339 init(); 339 init();
340} 340}
341 341
342CalendarView::CalendarView( Calendar *calendar, 342CalendarView::CalendarView( Calendar *calendar,
343 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
344 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
345 mCalendar( calendar ), 345 mCalendar( calendar ),
346 mResourceManager( 0 ) 346 mResourceManager( 0 )
347{ 347{
348 348
349 mEventEditor = 0; 349 mEventEditor = 0;
350 mTodoEditor = 0; 350 mTodoEditor = 0;
351 init(); 351 init();
352} 352}
353 353
354void CalendarView::init() 354void CalendarView::init()
355{ 355{
356 mNextAlarmDateTime = QDateTime::currentDateTime(); 356 mNextAlarmDateTime = QDateTime::currentDateTime();
357 setFocusPolicy ( NoFocus ); 357 setFocusPolicy ( NoFocus );
358 mViewerCallerIsSearchDialog = false; 358 mViewerCallerIsSearchDialog = false;
359 mBlockShowDates = false; 359 mBlockShowDates = false;
360 beamDialog = new KOBeamPrefs(); 360 beamDialog = new KOBeamPrefs();
361 mDatePickerMode = 0; 361 mDatePickerMode = 0;
362 mCurrentSyncDevice = ""; 362 mCurrentSyncDevice = "";
363 writeLocale(); 363 writeLocale();
364 mViewManager = new KOViewManager( this ); 364 mViewManager = new KOViewManager( this );
365 mDialogManager = new KODialogManager( this ); 365 mDialogManager = new KODialogManager( this );
366 mEventViewerDialog = 0; 366 mEventViewerDialog = 0;
367 mModified = false; 367 mModified = false;
368 mReadOnly = false; 368 mReadOnly = false;
369 mSelectedIncidence = 0; 369 mSelectedIncidence = 0;
370 mCalPrinter = 0; 370 mCalPrinter = 0;
371 mFilters.setAutoDelete(true); 371 mFilters.setAutoDelete(true);
372 372
373 mCalendar->registerObserver( this ); 373 mCalendar->registerObserver( this );
374 // TODO: Make sure that view is updated, when calendar is changed. 374 // TODO: Make sure that view is updated, when calendar is changed.
375 375
376 mStorage = new FileStorage( mCalendar ); 376 mStorage = new FileStorage( mCalendar );
377 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 377 mNavigator = new DateNavigator( this, "datevav", mViewManager );
378 378
379 QBoxLayout *topLayout = (QBoxLayout*)layout(); 379 QBoxLayout *topLayout = (QBoxLayout*)layout();
380#ifndef KORG_NOSPLITTER 380#ifndef KORG_NOSPLITTER
381 // create the main layout frames. 381 // create the main layout frames.
382 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 382 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
383 topLayout->addWidget(mPanner); 383 topLayout->addWidget(mPanner);
384 384
385 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 385 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
386 "CalendarView::LeftFrame"); 386 "CalendarView::LeftFrame");
387 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 387 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
388 388
389 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 389 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
390 "CalendarView::DateNavigator" ); 390 "CalendarView::DateNavigator" );
391 391
392 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 392 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
393 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 393 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
394 mTodoList->setNavigator( mNavigator ); 394 mTodoList->setNavigator( mNavigator );
395 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 395 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
396 396
397#ifdef KORG_NORESOURCEVIEW 397#ifdef KORG_NORESOURCEVIEW
398 mResourceView = 0; 398 mResourceView = 0;
399#else 399#else
400 if ( mResourceManager ) { 400 if ( mResourceManager ) {
401 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 401 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
402 mResourceView->updateView(); 402 mResourceView->updateView();
403 connect( mResourceView, SIGNAL( resourcesChanged() ), 403 connect( mResourceView, SIGNAL( resourcesChanged() ),
404 SLOT( updateView() ) ); 404 SLOT( updateView() ) );
405 } else { 405 } else {
406 mResourceView = 0; 406 mResourceView = 0;
407 } 407 }
408#endif 408#endif
409 QWidget *rightBox = new QWidget( mPanner ); 409 QWidget *rightBox = new QWidget( mPanner );
410 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 410 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
411 411
412 mRightFrame = new QWidgetStack( rightBox ); 412 mRightFrame = new QWidgetStack( rightBox );
413 rightLayout->addWidget( mRightFrame, 1 ); 413 rightLayout->addWidget( mRightFrame, 1 );
414 414
415 mLeftFrame = mLeftSplitter; 415 mLeftFrame = mLeftSplitter;
416#else 416#else
417 //QWidget *mainBox = new QWidget( this ); 417 //QWidget *mainBox = new QWidget( this );
418 //QWidget *leftFrame = new QWidget( mainBox ); 418 //QWidget *leftFrame = new QWidget( mainBox );
419 //QBoxLayout * mainBoxLayout; 419 //QBoxLayout * mainBoxLayout;
420 if ( KOPrefs::instance()->mVerticalScreen ) { 420 if ( KOPrefs::instance()->mVerticalScreen ) {
421 //mainBoxLayout = new QVBoxLayout(mainBox); 421 //mainBoxLayout = new QVBoxLayout(mainBox);
422 //leftFrameLayout = new QHBoxLayout(leftFrame ); 422 //leftFrameLayout = new QHBoxLayout(leftFrame );
423 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 423 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
424 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 424 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
425 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 425 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
426 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 426 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
427 } else { 427 } else {
428 //mainBoxLayout = new QHBoxLayout(mainBox); 428 //mainBoxLayout = new QHBoxLayout(mainBox);
429 //leftFrameLayout = new QVBoxLayout(leftFrame ); 429 //leftFrameLayout = new QVBoxLayout(leftFrame );
430 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 430 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
431 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 431 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
432 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 432 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
433 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 433 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
434 } 434 }
435 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 435 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
436 //QBoxLayout * leftFrameLayout; 436 //QBoxLayout * leftFrameLayout;
437 topLayout->addWidget( mMainFrame ); 437 topLayout->addWidget( mMainFrame );
438 //mainBoxLayout->addWidget (mLeftFrame); 438 //mainBoxLayout->addWidget (mLeftFrame);
439 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 439 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
440 "CalendarView::DateNavigator" ); 440 "CalendarView::DateNavigator" );
441#if 0 441#if 0
442 // FIXME 442 // FIXME
443 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 443 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
444 "CalendarView::DateNavigator", QDate::currentDate()); 444 "CalendarView::DateNavigator", QDate::currentDate());
445#endif 445#endif
446 // mDateNavigator->blockSignals( true ); 446 // mDateNavigator->blockSignals( true );
447 //leftFrameLayout->addWidget( mDateNavigator ); 447 //leftFrameLayout->addWidget( mDateNavigator );
448 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 448 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
449 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 449 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
450 mTodoList->setNavigator( mNavigator ); 450 mTodoList->setNavigator( mNavigator );
451#if 0 451#if 0
452 if ( QApplication::desktop()->width() < 480 ) { 452 if ( QApplication::desktop()->width() < 480 ) {
453 leftFrameLayout->addWidget(mFilterView); 453 leftFrameLayout->addWidget(mFilterView);
454 leftFrameLayout->addWidget(mTodoList, 2 ); 454 leftFrameLayout->addWidget(mTodoList, 2 );
455 455
456 } else { 456 } else {
457 leftFrameLayout->addWidget(mTodoList,2 ); 457 leftFrameLayout->addWidget(mTodoList,2 );
458 leftFrameLayout->addWidget(mFilterView ); 458 leftFrameLayout->addWidget(mFilterView );
459 } 459 }
460#endif 460#endif
461 mFilterView->hide(); 461 mFilterView->hide();
462 QWidget *rightBox = new QWidget( mMainFrame ); 462 QWidget *rightBox = new QWidget( mMainFrame );
463 //mainBoxLayout->addWidget ( rightBox, 10 ); 463 //mainBoxLayout->addWidget ( rightBox, 10 );
464 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 464 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
465 mRightFrame = new QWidgetStack( rightBox ); 465 mRightFrame = new QWidgetStack( rightBox );
466 rightLayout->addWidget( mRightFrame, 10 ); 466 rightLayout->addWidget( mRightFrame, 10 );
467 467
468 //mLeftFrame = (QWidget *)leftFrame; 468 //mLeftFrame = (QWidget *)leftFrame;
469 if ( KOPrefs::instance()->mVerticalScreen ) { 469 if ( KOPrefs::instance()->mVerticalScreen ) {
470 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 470 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
471 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 471 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
472 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 472 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
473 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 473 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
474 } else { 474 } else {
475 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 475 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
476 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 476 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
477 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 477 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
478 } 478 }
479 if ( !KOPrefs::instance()->mShowDateNavigator) 479 if ( !KOPrefs::instance()->mShowDateNavigator)
480 mDateNavigator->hide(); 480 mDateNavigator->hide();
481 //qDebug("Calendarview Size %d %d ", width(), height()); 481 //qDebug("Calendarview Size %d %d ", width(), height());
482#endif 482#endif
483 483
484 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 484 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
485 SLOT( showDates( const KCal::DateList & ) ) ); 485 SLOT( showDates( const KCal::DateList & ) ) );
486 486
487 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 487 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
488 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 488 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
489 489
490 490
491 491
492 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 492 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
493 mViewManager, SLOT( showMonth( const QDate & ) ) ); 493 mViewManager, SLOT( showMonth( const QDate & ) ) );
494 494
495 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 495 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
496 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 496 mNavigator, SLOT( selectWeek( const QDate & ) ) );
497 497
498 connect( mDateNavigator, SIGNAL( goPrevYear() ), 498 connect( mDateNavigator, SIGNAL( goPrevYear() ),
499 mNavigator, SLOT( selectPreviousYear() ) ); 499 mNavigator, SLOT( selectPreviousYear() ) );
500 connect( mDateNavigator, SIGNAL( goNextYear() ), 500 connect( mDateNavigator, SIGNAL( goNextYear() ),
501 mNavigator, SLOT( selectNextYear() ) ); 501 mNavigator, SLOT( selectNextYear() ) );
502 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 502 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
503 mNavigator, SLOT( selectPreviousMonth() ) ); 503 mNavigator, SLOT( selectPreviousMonth() ) );
504 connect( mDateNavigator, SIGNAL( goNextMonth() ), 504 connect( mDateNavigator, SIGNAL( goNextMonth() ),
505 mNavigator, SLOT( selectNextMonth() ) ); 505 mNavigator, SLOT( selectNextMonth() ) );
506 506
507 connect( mDateNavigator, SIGNAL( goPrevious() ), 507 connect( mDateNavigator, SIGNAL( goPrevious() ),
508 mNavigator, SLOT( selectPrevious() ) ); 508 mNavigator, SLOT( selectPrevious() ) );
509 connect( mDateNavigator, SIGNAL( goNext() ), 509 connect( mDateNavigator, SIGNAL( goNext() ),
510 mNavigator, SLOT( selectNext() ) ); 510 mNavigator, SLOT( selectNext() ) );
511 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 511 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
512 mNavigator, SLOT( slotMonthSelect( int ) ) ); 512 mNavigator, SLOT( slotMonthSelect( int ) ) );
513 513
514 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 514 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
515 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 515 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
516#if 0 516#if 0
517 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 517 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
518 SLOT( incidenceAdded( Incidence *) ) ); 518 SLOT( incidenceAdded( Incidence *) ) );
519#endif 519#endif
520 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 520 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
521 521
522 connect( this, SIGNAL( configChanged() ), 522 connect( this, SIGNAL( configChanged() ),
523 mDateNavigator, SLOT( updateConfig() ) ); 523 mDateNavigator, SLOT( updateConfig() ) );
524 524
525 connect( mTodoList, SIGNAL( newTodoSignal() ), 525 connect( mTodoList, SIGNAL( newTodoSignal() ),
526 SLOT( newTodo() ) ); 526 SLOT( newTodo() ) );
527 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 527 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
528 SLOT( newSubTodo( Todo * ) ) ); 528 SLOT( newSubTodo( Todo * ) ) );
529 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 529 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
530 SLOT( editTodo( Todo * ) ) ); 530 SLOT( editTodo( Todo * ) ) );
531 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 531 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
532 SLOT( showTodo( Todo *) ) ); 532 SLOT( showTodo( Todo *) ) );
533 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 533 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
534 SLOT( deleteTodo( Todo *) ) ); 534 SLOT( deleteTodo( Todo *) ) );
535 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 535 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
536 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 536 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
537 SLOT( purgeCompleted() ) ); 537 SLOT( purgeCompleted() ) );
538 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 538 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
539 SIGNAL( todoModified( Todo *, int ) ) ); 539 SIGNAL( todoModified( Todo *, int ) ) );
540 540
541 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 541 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
542 this, SLOT ( cloneIncidence( Incidence * ) ) ); 542 this, SLOT ( cloneIncidence( Incidence * ) ) );
543 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 543 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
544 this, SLOT (cancelIncidence( Incidence * ) ) ); 544 this, SLOT (cancelIncidence( Incidence * ) ) );
545 545
546 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 546 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
547 this, SLOT ( moveIncidence( Incidence * ) ) ); 547 this, SLOT ( moveIncidence( Incidence * ) ) );
548 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 548 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
549 this, SLOT ( beamIncidence( Incidence * ) ) ); 549 this, SLOT ( beamIncidence( Incidence * ) ) );
550 550
551 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 551 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
552 this, SLOT ( todo_unsub( Todo * ) ) ); 552 this, SLOT ( todo_unsub( Todo * ) ) );
553 553
554 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 554 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
555 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 555 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
556 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 556 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
557 SLOT( updateTodo( Todo *, int ) ) ); 557 SLOT( updateTodo( Todo *, int ) ) );
558 connect( this, SIGNAL( todoModified( Todo *, int )), this, 558 connect( this, SIGNAL( todoModified( Todo *, int )), this,
559 SLOT( changeTodoDisplay( Todo *, int ) ) ); 559 SLOT( changeTodoDisplay( Todo *, int ) ) );
560 560
561 561
562 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 562 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
563 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 563 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
564 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 564 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
565 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 565 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
566 566
567 567
568 568
569 569
570 570
571 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 571 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
572 SLOT(checkClipboard())); 572 SLOT(checkClipboard()));
573 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 573 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
574 SLOT( processTodoListSelection( Incidence * ) ) ); 574 SLOT( processTodoListSelection( Incidence * ) ) );
575 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 575 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
576 576
577 // kdDebug() << "CalendarView::CalendarView() done" << endl; 577 // kdDebug() << "CalendarView::CalendarView() done" << endl;
578 578
579 mDateFrame = new QVBox(0,0,WType_Popup); 579 mDateFrame = new QVBox(0,0,WType_Popup);
580 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 580 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
581 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 581 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
582 mDateFrame->setLineWidth(3); 582 mDateFrame->setLineWidth(3);
583 mDateFrame->hide(); 583 mDateFrame->hide();
584 mDateFrame->setCaption( i18n( "Pick a date to display")); 584 mDateFrame->setCaption( i18n( "Pick a date to display"));
585 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 585 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
586 586
587 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 587 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
588 588
589 mEventEditor = mDialogManager->getEventEditor(); 589 mEventEditor = mDialogManager->getEventEditor();
590 mTodoEditor = mDialogManager->getTodoEditor(); 590 mTodoEditor = mDialogManager->getTodoEditor();
591 591
592 mFlagEditDescription = false; 592 mFlagEditDescription = false;
593 593
594 mSuspendTimer = new QTimer( this ); 594 mSuspendTimer = new QTimer( this );
595 mAlarmTimer = new QTimer( this ); 595 mAlarmTimer = new QTimer( this );
596 mRecheckAlarmTimer = new QTimer( this ); 596 mRecheckAlarmTimer = new QTimer( this );
597 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 597 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
598 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 598 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
599 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 599 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
600 mAlarmDialog = new AlarmDialog( this ); 600 mAlarmDialog = new AlarmDialog( this );
601 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 601 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
602 mAlarmDialog->setServerNotification( false ); 602 mAlarmDialog->setServerNotification( false );
603 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 603 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
604 604
605 605
606#ifndef DESKTOP_VERSION 606#ifndef DESKTOP_VERSION
607//US listen for arriving address resultsets 607//US listen for arriving address resultsets
608 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 608 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
609 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 609 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
610#endif 610#endif
611 mDateNavigator->setCalendar( mCalendar ); 611 mDateNavigator->setCalendar( mCalendar );
612} 612}
613 613
614 614
615CalendarView::~CalendarView() 615CalendarView::~CalendarView()
616{ 616{
617 // kdDebug() << "~CalendarView()" << endl; 617 // kdDebug() << "~CalendarView()" << endl;
618 //qDebug("CalendarView::~CalendarView() "); 618 //qDebug("CalendarView::~CalendarView() ");
619 delete mDialogManager; 619 delete mDialogManager;
620 delete mViewManager; 620 delete mViewManager;
621 delete mStorage; 621 delete mStorage;
622 delete mDateFrame ; 622 delete mDateFrame ;
623 delete beamDialog; 623 delete beamDialog;
624 delete mEventViewerDialog; 624 delete mEventViewerDialog;
625 //kdDebug() << "~CalendarView() done" << endl; 625 //kdDebug() << "~CalendarView() done" << endl;
626} 626}
627void CalendarView::checkAlarms() 627void CalendarView::checkAlarms()
628{ 628{
629 KConfig *config = KOGlobals::config(); 629 KConfig *config = KOGlobals::config();
630 config->setGroup( "AppRun" ); 630 config->setGroup( "AppRun" );
631 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 631 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
632 int secs = config->readNumEntry( "LatestProgramStop" ) - 30; 632 int secs = config->readNumEntry( "LatestProgramStop" ) - 30;
633 //secs -= ( 3600 * 24*3 ); // debug only 633 secs -= ( 3600 * 24*3 ); // debug only
634 QDateTime latest = dt.addSecs ( secs ); 634 QDateTime latest = dt.addSecs ( secs );
635 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 635 qDebug("KO: Last termination on %s ", latest.toString().latin1());
636 QPtrList<Incidence> el = mCalendar->rawIncidences(); 636 QPtrList<Incidence> el = mCalendar->rawIncidences();
637 QPtrList<Incidence> al; 637 QPtrList<Incidence> al;
638 Incidence* inL = el.first(); 638 Incidence* inL = el.first();
639 while ( inL ) { 639 while ( inL ) {
640 bool ok = false; 640 bool ok = false;
641 int offset = 0; 641 int offset = 0;
642 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 642 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
643 if ( ok ) { 643 if ( ok ) {
644 //qDebug("OK %s",next.toString().latin1()); 644 //qDebug("OK %s",next.toString().latin1());
645 if ( next < QDateTime::currentDateTime() ) { 645 if ( next < QDateTime::currentDateTime() ) {
646 al.append( inL ); 646 al.append( inL );
647 qDebug("found missed alarm: %s ", inL->summary().latin1() ); 647 qDebug("found missed alarm: %s ", inL->summary().latin1() );
648 } 648 }
649 } 649 }
650 inL = el.next(); 650 inL = el.next();
651 } 651 }
652 if ( al.count() ) { 652 if ( al.count() ) {
653 QDialog dia ( this, "huhu", true ); 653 QDialog dia ( this, "huhu", true );
654 dia.setCaption( i18n("KO/Pi: Missing alarm notification!") ); 654 dia.setCaption( i18n("KO/Pi: Missing alarm notification!") );
655 QVBoxLayout* lay = new QVBoxLayout( &dia ); 655 QVBoxLayout* lay = new QVBoxLayout( &dia );
656 lay->setSpacing( 3 ); 656 lay->setSpacing( 3 );
657 lay->setMargin( 3 ); 657 lay->setMargin( 3 );
658 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest ); 658 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest );
659 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 659 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
660 lay->addWidget( matb ); 660 lay->addWidget( matb );
661 dia.resize(240,240); 661 dia.resize(240,240);
662 dia.exec(); 662 dia.exec();
663 663
664 } 664 }
665} 665}
666void CalendarView::showDay( QDate d ) 666void CalendarView::showDay( QDate d )
667{ 667{
668 dateNavigator()->blockSignals( true ); 668 dateNavigator()->blockSignals( true );
669 dateNavigator()->selectDate( d ); 669 dateNavigator()->selectDate( d );
670 dateNavigator()->blockSignals( false ); 670 dateNavigator()->blockSignals( false );
671 mViewManager->showDayView(); 671 mViewManager->showDayView();
672 //dateNavigator()->selectDate( d ); 672 //dateNavigator()->selectDate( d );
673} 673}
674void CalendarView::timerAlarm() 674void CalendarView::timerAlarm()
675{ 675{
676 //qDebug("CalendarView::timerAlarm() "); 676 //qDebug("CalendarView::timerAlarm() ");
677 computeAlarm(mAlarmNotification ); 677 computeAlarm(mAlarmNotification );
678} 678}
679 679
680void CalendarView::suspendAlarm() 680void CalendarView::suspendAlarm()
681{ 681{
682 //qDebug(" CalendarView::suspendAlarm() "); 682 //qDebug(" CalendarView::suspendAlarm() ");
683 computeAlarm(mSuspendAlarmNotification ); 683 computeAlarm(mSuspendAlarmNotification );
684 684
685} 685}
686 686
687void CalendarView::startAlarm( QString mess , QString filename) 687void CalendarView::startAlarm( QString mess , QString filename)
688{ 688{
689 689
690 topLevelWidget()->showNormal(); 690 topLevelWidget()->showNormal();
691 topLevelWidget()->setActiveWindow(); 691 topLevelWidget()->setActiveWindow();
692 topLevelWidget()->raise(); 692 topLevelWidget()->raise();
693 693
694 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 694 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
695 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 695 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
696 696
697} 697}
698 698
699void CalendarView::checkNextTimerAlarm() 699void CalendarView::checkNextTimerAlarm()
700{ 700{
701 mCalendar->checkAlarmForIncidence( 0, true ); 701 mCalendar->checkAlarmForIncidence( 0, true );
702} 702}
703 703
704void CalendarView::computeAlarm( QString msg ) 704void CalendarView::computeAlarm( QString msg )
705{ 705{
706 706
707 QString mess = msg; 707 QString mess = msg;
708 QString mAlarmMessage = mess.mid( 9 ); 708 QString mAlarmMessage = mess.mid( 9 );
709 QString filename = MainWindow::resourcePath(); 709 QString filename = MainWindow::resourcePath();
710 filename += "koalarm.wav"; 710 filename += "koalarm.wav";
711 QString tempfilename; 711 QString tempfilename;
712 if ( mess.left( 13 ) == "suspend_alarm") { 712 if ( mess.left( 13 ) == "suspend_alarm") {
713 bool error = false; 713 bool error = false;
714 int len = mess.mid( 13 ).find("+++"); 714 int len = mess.mid( 13 ).find("+++");
715 if ( len < 2 ) 715 if ( len < 2 )
716 error = true; 716 error = true;
717 else { 717 else {
718 tempfilename = mess.mid( 13, len ); 718 tempfilename = mess.mid( 13, len );
719 if ( !QFile::exists( tempfilename ) ) 719 if ( !QFile::exists( tempfilename ) )
720 error = true; 720 error = true;
721 } 721 }
722 if ( ! error ) { 722 if ( ! error ) {
723 filename = tempfilename; 723 filename = tempfilename;
724 } 724 }
725 mAlarmMessage = mess.mid( 13+len+3 ); 725 mAlarmMessage = mess.mid( 13+len+3 );
726 //qDebug("suspend file %s ",tempfilename.latin1() ); 726 //qDebug("suspend file %s ",tempfilename.latin1() );
727 startAlarm( mAlarmMessage, filename); 727 startAlarm( mAlarmMessage, filename);
728 return; 728 return;
729 } 729 }
730 if ( mess.left( 11 ) == "timer_alarm") { 730 if ( mess.left( 11 ) == "timer_alarm") {
731 //mTimerTime = 0; 731 //mTimerTime = 0;
732 startAlarm( mess.mid( 11 ), filename ); 732 startAlarm( mess.mid( 11 ), filename );
733 return; 733 return;
734 } 734 }
735 if ( mess.left( 10 ) == "proc_alarm") { 735 if ( mess.left( 10 ) == "proc_alarm") {
736 bool error = false; 736 bool error = false;
737 int len = mess.mid( 10 ).find("+++"); 737 int len = mess.mid( 10 ).find("+++");
738 if ( len < 2 ) 738 if ( len < 2 )
739 error = true; 739 error = true;
740 else { 740 else {
741 tempfilename = mess.mid( 10, len ); 741 tempfilename = mess.mid( 10, len );
742 if ( !QFile::exists( tempfilename ) ) 742 if ( !QFile::exists( tempfilename ) )
743 error = true; 743 error = true;
744 } 744 }
745 if ( error ) { 745 if ( error ) {
746 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 746 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
747 mAlarmMessage += mess.mid( 10+len+3+9 ); 747 mAlarmMessage += mess.mid( 10+len+3+9 );
748 } else { 748 } else {
749 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 749 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
750 //qDebug("-----system command %s ",tempfilename.latin1() ); 750 //qDebug("-----system command %s ",tempfilename.latin1() );
751#ifndef _WIN32_ 751#ifndef _WIN32_
752 if ( vfork () == 0 ) { 752 if ( vfork () == 0 ) {
753 execl ( tempfilename.latin1(), 0 ); 753 execl ( tempfilename.latin1(), 0 );
754 return; 754 return;
755 } 755 }
756#else 756#else
757 QProcess* p = new QProcess(); 757 QProcess* p = new QProcess();
758 p->addArgument( tempfilename.latin1() ); 758 p->addArgument( tempfilename.latin1() );
759 p->start(); 759 p->start();
760 return; 760 return;
761#endif 761#endif
762 762
763 return; 763 return;
764 } 764 }
765 765
766 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 766 //qDebug("+++++++system command %s ",tempfilename.latin1() );
767 } 767 }
768 if ( mess.left( 11 ) == "audio_alarm") { 768 if ( mess.left( 11 ) == "audio_alarm") {
769 bool error = false; 769 bool error = false;
770 int len = mess.mid( 11 ).find("+++"); 770 int len = mess.mid( 11 ).find("+++");
771 if ( len < 2 ) 771 if ( len < 2 )
772 error = true; 772 error = true;
773 else { 773 else {
774 tempfilename = mess.mid( 11, len ); 774 tempfilename = mess.mid( 11, len );
775 if ( !QFile::exists( tempfilename ) ) 775 if ( !QFile::exists( tempfilename ) )
776 error = true; 776 error = true;
777 } 777 }
778 if ( ! error ) { 778 if ( ! error ) {
779 filename = tempfilename; 779 filename = tempfilename;
780 } 780 }
781 mAlarmMessage = mess.mid( 11+len+3+9 ); 781 mAlarmMessage = mess.mid( 11+len+3+9 );
782 //qDebug("audio file command %s ",tempfilename.latin1() ); 782 //qDebug("audio file command %s ",tempfilename.latin1() );
783 } 783 }
784 if ( mess.left( 9 ) == "cal_alarm") { 784 if ( mess.left( 9 ) == "cal_alarm") {
785 mAlarmMessage = mess.mid( 9 ) ; 785 mAlarmMessage = mess.mid( 9 ) ;
786 } 786 }
787 787
788 startAlarm( mAlarmMessage, filename ); 788 startAlarm( mAlarmMessage, filename );
789 789
790 790
791} 791}
792 792
793void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 793void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
794{ 794{
795 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 795 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
796 796
797 mSuspendAlarmNotification = noti; 797 mSuspendAlarmNotification = noti;
798 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 798 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
799 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 799 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
800 mSuspendTimer->start( ms , true ); 800 mSuspendTimer->start( ms , true );
801 801
802} 802}
803 803
804void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 804void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
805{ 805{
806 mNextAlarmDateTime = qdt; 806 mNextAlarmDateTime = qdt;
807 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 807 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
808 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 808 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
809#ifndef DESKTOP_VERSION 809#ifndef DESKTOP_VERSION
810 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 810 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
811#endif 811#endif
812 return; 812 return;
813 } 813 }
814 int maxSec; 814 int maxSec;
815 //maxSec = 5; //testing only 815 //maxSec = 5; //testing only
816 maxSec = 86400+3600; // one day+1hour 816 maxSec = 86400+3600; // one day+1hour
817 mAlarmNotification = noti; 817 mAlarmNotification = noti;
818 int sec = QDateTime::currentDateTime().secsTo( qdt ); 818 int sec = QDateTime::currentDateTime().secsTo( qdt );
819 if ( sec > maxSec ) { 819 if ( sec > maxSec ) {
820 mRecheckAlarmTimer->start( maxSec * 1000 ); 820 mRecheckAlarmTimer->start( maxSec * 1000 );
821 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 821 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
822 return; 822 return;
823 } else { 823 } else {
824 mRecheckAlarmTimer->stop(); 824 mRecheckAlarmTimer->stop();
825 } 825 }
826 //qDebug("Alarm timer started with secs: %d ", sec); 826 //qDebug("Alarm timer started with secs: %d ", sec);
827 mAlarmTimer->start( sec *1000 , true ); 827 mAlarmTimer->start( sec *1000 , true );
828 828
829} 829}
830// called by mRecheckAlarmTimer to get next alarm 830// called by mRecheckAlarmTimer to get next alarm
831// we need this, because a QTimer has only a max range of 25 days 831// we need this, because a QTimer has only a max range of 25 days
832void CalendarView::recheckTimerAlarm() 832void CalendarView::recheckTimerAlarm()
833{ 833{
834 mAlarmTimer->stop(); 834 mAlarmTimer->stop();
835 mRecheckAlarmTimer->stop(); 835 mRecheckAlarmTimer->stop();
836 mCalendar->checkAlarmForIncidence( 0, true ); 836 mCalendar->checkAlarmForIncidence( 0, true );
837} 837}
838void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 838void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
839{ 839{
840 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 840 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
841 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 841 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
842#ifndef DESKTOP_VERSION 842#ifndef DESKTOP_VERSION
843 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 843 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
844#endif 844#endif
845 return; 845 return;
846 } 846 }
847 mAlarmTimer->stop(); 847 mAlarmTimer->stop();
848} 848}
849void CalendarView::selectWeekNum ( int num ) 849void CalendarView::selectWeekNum ( int num )
850{ 850{
851 dateNavigator()->blockSignals( true ); 851 dateNavigator()->blockSignals( true );
852 dateNavigator()->selectWeek( num ); 852 dateNavigator()->selectWeek( num );
853 dateNavigator()->blockSignals( false ); 853 dateNavigator()->blockSignals( false );
854 mViewManager->showWeekView(); 854 mViewManager->showWeekView();
855} 855}
856KOViewManager *CalendarView::viewManager() 856KOViewManager *CalendarView::viewManager()
857{ 857{
858 return mViewManager; 858 return mViewManager;
859} 859}
860 860
861KODialogManager *CalendarView::dialogManager() 861KODialogManager *CalendarView::dialogManager()
862{ 862{
863 return mDialogManager; 863 return mDialogManager;
864} 864}
865 865
866QDate CalendarView::startDate() 866QDate CalendarView::startDate()
867{ 867{
868 DateList dates = mNavigator->selectedDates(); 868 DateList dates = mNavigator->selectedDates();
869 869
870 return dates.first(); 870 return dates.first();
871} 871}
872 872
873QDate CalendarView::endDate() 873QDate CalendarView::endDate()
874{ 874{
875 DateList dates = mNavigator->selectedDates(); 875 DateList dates = mNavigator->selectedDates();
876 876
877 return dates.last(); 877 return dates.last();
878} 878}
879 879
880 880
881void CalendarView::createPrinter() 881void CalendarView::createPrinter()
882{ 882{
883#ifndef KORG_NOPRINTER 883#ifndef KORG_NOPRINTER
884 if (!mCalPrinter) { 884 if (!mCalPrinter) {
885 mCalPrinter = new CalPrinter(this, mCalendar); 885 mCalPrinter = new CalPrinter(this, mCalendar);
886 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 886 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
887 } 887 }
888#endif 888#endif
889} 889}
890 890
891 891
892//KOPrefs::instance()->mWriteBackFile 892//KOPrefs::instance()->mWriteBackFile
893//KOPrefs::instance()->mWriteBackExistingOnly 893//KOPrefs::instance()->mWriteBackExistingOnly
894 894
895// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 895// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
896// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 896// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
897// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 897// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
898// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 898// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
899// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 899// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
900// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 900// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
901 901
902int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 902int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
903{ 903{
904 904
905 // 0 equal 905 // 0 equal
906 // 1 take local 906 // 1 take local
907 // 2 take remote 907 // 2 take remote
908 // 3 cancel 908 // 3 cancel
909 QDateTime lastSync = mLastCalendarSync; 909 QDateTime lastSync = mLastCalendarSync;
910 QDateTime localMod = local->lastModified(); 910 QDateTime localMod = local->lastModified();
911 QDateTime remoteMod = remote->lastModified(); 911 QDateTime remoteMod = remote->lastModified();
912 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 912 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
913 bool remCh, locCh; 913 bool remCh, locCh;
914 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 914 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
915 //if ( remCh ) 915 //if ( remCh )
916 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 916 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
917 locCh = ( localMod > mLastCalendarSync ); 917 locCh = ( localMod > mLastCalendarSync );
918 if ( !remCh && ! locCh ) { 918 if ( !remCh && ! locCh ) {
919 //qDebug("both not changed "); 919 //qDebug("both not changed ");
920 lastSync = localMod.addDays(1); 920 lastSync = localMod.addDays(1);
921 if ( mode <= SYNC_PREF_ASK ) 921 if ( mode <= SYNC_PREF_ASK )
922 return 0; 922 return 0;
923 } else { 923 } else {
924 if ( locCh ) { 924 if ( locCh ) {
925 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 925 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
926 lastSync = localMod.addDays( -1 ); 926 lastSync = localMod.addDays( -1 );
927 if ( !remCh ) 927 if ( !remCh )
928 remoteMod = ( lastSync.addDays( -1 ) ); 928 remoteMod = ( lastSync.addDays( -1 ) );
929 } else { 929 } else {
930 //qDebug(" not loc changed "); 930 //qDebug(" not loc changed ");
931 lastSync = localMod.addDays( 1 ); 931 lastSync = localMod.addDays( 1 );
932 if ( remCh ) 932 if ( remCh )
933 remoteMod =( lastSync.addDays( 1 ) ); 933 remoteMod =( lastSync.addDays( 1 ) );
934 934
935 } 935 }
936 } 936 }
937 full = true; 937 full = true;
938 if ( mode < SYNC_PREF_ASK ) 938 if ( mode < SYNC_PREF_ASK )
939 mode = SYNC_PREF_ASK; 939 mode = SYNC_PREF_ASK;
940 } else { 940 } else {
941 if ( localMod == remoteMod ) 941 if ( localMod == remoteMod )
942 // if ( local->revision() == remote->revision() ) 942 // if ( local->revision() == remote->revision() )
943 return 0; 943 return 0;
944 944
945 } 945 }
946 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 946 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
947 947
948 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 948 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
949 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 949 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
950 //full = true; //debug only 950 //full = true; //debug only
951 if ( full ) { 951 if ( full ) {
952 bool equ = false; 952 bool equ = false;
953 if ( local->type() == "Event" ) { 953 if ( local->type() == "Event" ) {
954 equ = (*((Event*) local) == *((Event*) remote)); 954 equ = (*((Event*) local) == *((Event*) remote));
955 } 955 }
956 else if ( local->type() =="Todo" ) 956 else if ( local->type() =="Todo" )
957 equ = (*((Todo*) local) == (*(Todo*) remote)); 957 equ = (*((Todo*) local) == (*(Todo*) remote));
958 else if ( local->type() =="Journal" ) 958 else if ( local->type() =="Journal" )
959 equ = (*((Journal*) local) == *((Journal*) remote)); 959 equ = (*((Journal*) local) == *((Journal*) remote));
960 if ( equ ) { 960 if ( equ ) {
961 //qDebug("equal "); 961 //qDebug("equal ");
962 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 962 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
963 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 963 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
964 } 964 }
965 if ( mode < SYNC_PREF_FORCE_LOCAL ) 965 if ( mode < SYNC_PREF_FORCE_LOCAL )
966 return 0; 966 return 0;
967 967
968 }//else //debug only 968 }//else //debug only
969 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 969 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
970 } 970 }
971 int result; 971 int result;
972 bool localIsNew; 972 bool localIsNew;
973 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 973 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
974 974
975 975
976 // ************************************************ 976 // ************************************************
977 // ************************************************ 977 // ************************************************
978 // ************************************************ 978 // ************************************************
979 // We may have that lastSync > remoteMod AND lastSync > localMod 979 // We may have that lastSync > remoteMod AND lastSync > localMod
980 // BUT remoteMod != localMod 980 // BUT remoteMod != localMod
981 981
982 982
983 if ( full && mode < SYNC_PREF_NEWEST ) 983 if ( full && mode < SYNC_PREF_NEWEST )
984 mode = SYNC_PREF_ASK; 984 mode = SYNC_PREF_ASK;
985 985
986 switch( mode ) { 986 switch( mode ) {
987 case SYNC_PREF_LOCAL: 987 case SYNC_PREF_LOCAL:
988 if ( lastSync > remoteMod ) 988 if ( lastSync > remoteMod )
989 return 1; 989 return 1;
990 if ( lastSync > localMod ) 990 if ( lastSync > localMod )
991 return 2; 991 return 2;
992 return 1; 992 return 1;
993 break; 993 break;
994 case SYNC_PREF_REMOTE: 994 case SYNC_PREF_REMOTE:
995 if ( lastSync > localMod ) 995 if ( lastSync > localMod )
996 return 2; 996 return 2;
997 if ( lastSync > remoteMod ) 997 if ( lastSync > remoteMod )
998 return 1; 998 return 1;
999 return 2; 999 return 2;
1000 break; 1000 break;
1001 case SYNC_PREF_NEWEST: 1001 case SYNC_PREF_NEWEST:
1002 if ( localMod >= remoteMod ) 1002 if ( localMod >= remoteMod )
1003 return 1; 1003 return 1;
1004 else 1004 else
1005 return 2; 1005 return 2;
1006 break; 1006 break;
1007 case SYNC_PREF_ASK: 1007 case SYNC_PREF_ASK:
1008 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1008 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
1009 if ( lastSync > remoteMod && lastSync > localMod) 1009 if ( lastSync > remoteMod && lastSync > localMod)
1010 return 0; 1010 return 0;
1011 if ( lastSync > remoteMod ) 1011 if ( lastSync > remoteMod )
1012 return 1; 1012 return 1;
1013 if ( lastSync > localMod ) 1013 if ( lastSync > localMod )
1014 return 2; 1014 return 2;
1015 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1015 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
1016 localIsNew = localMod >= remoteMod; 1016 localIsNew = localMod >= remoteMod;
1017 if ( localIsNew ) 1017 if ( localIsNew )