author | zautrix <zautrix> | 2005-04-03 04:33:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-03 04:33:19 (UTC) |
commit | f6c8249db564c1276d4c7ed5ad88c6fbac361b8d (patch) (unidiff) | |
tree | 8e5b6e2d6f9a7bc00326f7c0115bf2af53ae9ce8 /korganizer | |
parent | 40e5edc1ab153144f0e824ad2d3a0ab37357e408 (diff) | |
download | kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.zip kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.tar.gz kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.tar.bz2 |
fixes
-rw-r--r-- | korganizer/calendarview.cpp | 19 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 4 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 69 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 11 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 |
5 files changed, 62 insertions, 42 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index beb19d9..76cce26 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -469,128 +469,133 @@ void CalendarView::init() | |||
469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 469 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
470 | 470 | ||
471 | mEventEditor = mDialogManager->getEventEditor(); | 471 | mEventEditor = mDialogManager->getEventEditor(); |
472 | mTodoEditor = mDialogManager->getTodoEditor(); | 472 | mTodoEditor = mDialogManager->getTodoEditor(); |
473 | 473 | ||
474 | mFlagEditDescription = false; | 474 | mFlagEditDescription = false; |
475 | 475 | ||
476 | mSuspendTimer = new QTimer( this ); | 476 | mSuspendTimer = new QTimer( this ); |
477 | mAlarmTimer = new QTimer( this ); | 477 | mAlarmTimer = new QTimer( this ); |
478 | mRecheckAlarmTimer = new QTimer( this ); | 478 | mRecheckAlarmTimer = new QTimer( this ); |
479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 479 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 480 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 481 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
482 | mAlarmDialog = new AlarmDialog( this ); | 482 | mAlarmDialog = new AlarmDialog( this ); |
483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 483 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
484 | mAlarmDialog->setServerNotification( false ); | 484 | mAlarmDialog->setServerNotification( false ); |
485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 485 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
486 | 486 | ||
487 | 487 | ||
488 | #ifndef DESKTOP_VERSION | 488 | #ifndef DESKTOP_VERSION |
489 | //US listen for arriving address resultsets | 489 | //US listen for arriving address resultsets |
490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 490 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 491 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
492 | #endif | 492 | #endif |
493 | mDateNavigator->setCalendar( mCalendar ); | 493 | mDateNavigator->setCalendar( mCalendar ); |
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | CalendarView::~CalendarView() | 497 | CalendarView::~CalendarView() |
498 | { | 498 | { |
499 | // kdDebug() << "~CalendarView()" << endl; | 499 | // kdDebug() << "~CalendarView()" << endl; |
500 | //qDebug("CalendarView::~CalendarView() "); | 500 | //qDebug("CalendarView::~CalendarView() "); |
501 | delete mDialogManager; | 501 | delete mDialogManager; |
502 | delete mViewManager; | 502 | delete mViewManager; |
503 | delete mStorage; | 503 | delete mStorage; |
504 | delete mDateFrame ; | 504 | delete mDateFrame ; |
505 | delete beamDialog; | 505 | delete beamDialog; |
506 | delete mEventViewerDialog; | 506 | delete mEventViewerDialog; |
507 | //kdDebug() << "~CalendarView() done" << endl; | 507 | //kdDebug() << "~CalendarView() done" << endl; |
508 | } | 508 | } |
509 | 509 | ||
510 | void CalendarView::showDay( QDate d ) | 510 | void CalendarView::showDay( QDate d ) |
511 | { | 511 | { |
512 | dateNavigator()->blockSignals( true ); | 512 | dateNavigator()->blockSignals( true ); |
513 | dateNavigator()->selectDate( d ); | 513 | dateNavigator()->selectDate( d ); |
514 | dateNavigator()->blockSignals( false ); | 514 | dateNavigator()->blockSignals( false ); |
515 | mViewManager->showDayView(); | 515 | mViewManager->showDayView(); |
516 | //dateNavigator()->selectDate( d ); | 516 | //dateNavigator()->selectDate( d ); |
517 | } | 517 | } |
518 | void CalendarView::timerAlarm() | 518 | void CalendarView::timerAlarm() |
519 | { | 519 | { |
520 | //qDebug("CalendarView::timerAlarm() "); | 520 | //qDebug("CalendarView::timerAlarm() "); |
521 | computeAlarm(mAlarmNotification ); | 521 | computeAlarm(mAlarmNotification ); |
522 | } | 522 | } |
523 | 523 | ||
524 | void CalendarView::suspendAlarm() | 524 | void CalendarView::suspendAlarm() |
525 | { | 525 | { |
526 | //qDebug(" CalendarView::suspendAlarm() "); | 526 | //qDebug(" CalendarView::suspendAlarm() "); |
527 | computeAlarm(mSuspendAlarmNotification ); | 527 | computeAlarm(mSuspendAlarmNotification ); |
528 | 528 | ||
529 | } | 529 | } |
530 | 530 | ||
531 | void CalendarView::startAlarm( QString mess , QString filename) | 531 | void CalendarView::startAlarm( QString mess , QString filename) |
532 | { | 532 | { |
533 | |||
534 | topLevelWidget()->showNormal(); | ||
535 | topLevelWidget()->setActiveWindow(); | ||
536 | topLevelWidget()->raise(); | ||
537 | |||
533 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 538 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
534 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 539 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
535 | 540 | ||
536 | } | 541 | } |
537 | 542 | ||
538 | void CalendarView::checkNextTimerAlarm() | 543 | void CalendarView::checkNextTimerAlarm() |
539 | { | 544 | { |
540 | mCalendar->checkAlarmForIncidence( 0, true ); | 545 | mCalendar->checkAlarmForIncidence( 0, true ); |
541 | } | 546 | } |
542 | 547 | ||
543 | void CalendarView::computeAlarm( QString msg ) | 548 | void CalendarView::computeAlarm( QString msg ) |
544 | { | 549 | { |
545 | 550 | ||
546 | QString mess = msg; | 551 | QString mess = msg; |
547 | QString mAlarmMessage = mess.mid( 9 ); | 552 | QString mAlarmMessage = mess.mid( 9 ); |
548 | QString filename = MainWindow::resourcePath(); | 553 | QString filename = MainWindow::resourcePath(); |
549 | filename += "koalarm.wav"; | 554 | filename += "koalarm.wav"; |
550 | QString tempfilename; | 555 | QString tempfilename; |
551 | if ( mess.left( 13 ) == "suspend_alarm") { | 556 | if ( mess.left( 13 ) == "suspend_alarm") { |
552 | bool error = false; | 557 | bool error = false; |
553 | int len = mess.mid( 13 ).find("+++"); | 558 | int len = mess.mid( 13 ).find("+++"); |
554 | if ( len < 2 ) | 559 | if ( len < 2 ) |
555 | error = true; | 560 | error = true; |
556 | else { | 561 | else { |
557 | tempfilename = mess.mid( 13, len ); | 562 | tempfilename = mess.mid( 13, len ); |
558 | if ( !QFile::exists( tempfilename ) ) | 563 | if ( !QFile::exists( tempfilename ) ) |
559 | error = true; | 564 | error = true; |
560 | } | 565 | } |
561 | if ( ! error ) { | 566 | if ( ! error ) { |
562 | filename = tempfilename; | 567 | filename = tempfilename; |
563 | } | 568 | } |
564 | mAlarmMessage = mess.mid( 13+len+3 ); | 569 | mAlarmMessage = mess.mid( 13+len+3 ); |
565 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 570 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
566 | startAlarm( mAlarmMessage, filename); | 571 | startAlarm( mAlarmMessage, filename); |
567 | return; | 572 | return; |
568 | } | 573 | } |
569 | if ( mess.left( 11 ) == "timer_alarm") { | 574 | if ( mess.left( 11 ) == "timer_alarm") { |
570 | //mTimerTime = 0; | 575 | //mTimerTime = 0; |
571 | startAlarm( mess.mid( 11 ), filename ); | 576 | startAlarm( mess.mid( 11 ), filename ); |
572 | return; | 577 | return; |
573 | } | 578 | } |
574 | if ( mess.left( 10 ) == "proc_alarm") { | 579 | if ( mess.left( 10 ) == "proc_alarm") { |
575 | bool error = false; | 580 | bool error = false; |
576 | int len = mess.mid( 10 ).find("+++"); | 581 | int len = mess.mid( 10 ).find("+++"); |
577 | if ( len < 2 ) | 582 | if ( len < 2 ) |
578 | error = true; | 583 | error = true; |
579 | else { | 584 | else { |
580 | tempfilename = mess.mid( 10, len ); | 585 | tempfilename = mess.mid( 10, len ); |
581 | if ( !QFile::exists( tempfilename ) ) | 586 | if ( !QFile::exists( tempfilename ) ) |
582 | error = true; | 587 | error = true; |
583 | } | 588 | } |
584 | if ( error ) { | 589 | if ( error ) { |
585 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 590 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
586 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 591 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
587 | } else { | 592 | } else { |
588 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 593 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
589 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 594 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
590 | #ifndef _WIN32_ | 595 | #ifndef _WIN32_ |
591 | if ( vfork () == 0 ) { | 596 | if ( vfork () == 0 ) { |
592 | execl ( tempfilename.latin1(), 0 ); | 597 | execl ( tempfilename.latin1(), 0 ); |
593 | return; | 598 | return; |
594 | } | 599 | } |
595 | #else | 600 | #else |
596 | QProcess* p = new QProcess(); | 601 | QProcess* p = new QProcess(); |
@@ -4033,85 +4038,95 @@ void CalendarView::setSyncManager(KSyncManager* manager) | |||
4033 | void CalendarView::removeSyncInfo( QString syncProfile) | 4038 | void CalendarView::removeSyncInfo( QString syncProfile) |
4034 | { | 4039 | { |
4035 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4040 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4036 | mCalendar->removeSyncInfo( syncProfile ); | 4041 | mCalendar->removeSyncInfo( syncProfile ); |
4037 | 4042 | ||
4038 | } | 4043 | } |
4039 | 4044 | ||
4040 | void CalendarView::undo_delete() | 4045 | void CalendarView::undo_delete() |
4041 | { | 4046 | { |
4042 | //qDebug("undo_delete() "); | 4047 | //qDebug("undo_delete() "); |
4043 | Incidence* undo = mCalendar->undoIncidence(); | 4048 | Incidence* undo = mCalendar->undoIncidence(); |
4044 | if ( !undo ) { | 4049 | if ( !undo ) { |
4045 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4050 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4046 | i18n("KO/Pi")); | 4051 | i18n("KO/Pi")); |
4047 | return; | 4052 | return; |
4048 | } | 4053 | } |
4049 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 4054 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
4050 | i18n("\nAre you sure you want\nto restore this?"), | 4055 | i18n("\nAre you sure you want\nto restore this?"), |
4051 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4056 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4052 | mCalendar->undoDeleteIncidence(); | 4057 | mCalendar->undoDeleteIncidence(); |
4053 | updateView(); | 4058 | updateView(); |
4054 | } | 4059 | } |
4055 | } | 4060 | } |
4056 | 4061 | ||
4057 | void CalendarView::slotViewerClosed() | 4062 | void CalendarView::slotViewerClosed() |
4058 | { | 4063 | { |
4059 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4064 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4060 | } | 4065 | } |
4061 | 4066 | ||
4062 | void CalendarView::resetFocus() | 4067 | void CalendarView::resetFocus() |
4063 | { | 4068 | { |
4064 | if ( mViewerCallerIsSearchDialog ) { | 4069 | if ( mViewerCallerIsSearchDialog ) { |
4065 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 4070 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
4066 | mDialogManager->getSearchDialog()->raise(); | 4071 | mDialogManager->getSearchDialog()->raise(); |
4067 | mDialogManager->getSearchDialog()->setActiveWindow(); | 4072 | mDialogManager->getSearchDialog()->setActiveWindow(); |
4068 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 4073 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
4069 | } else | 4074 | } else |
4070 | mViewerCallerIsSearchDialog = false; | 4075 | mViewerCallerIsSearchDialog = false; |
4071 | } | 4076 | } |
4072 | if ( !mViewerCallerIsSearchDialog ) { | 4077 | if ( !mViewerCallerIsSearchDialog ) { |
4073 | //mViewManager->currentView()->setFocus(); | 4078 | //mViewManager->currentView()->setFocus(); |
4074 | //qDebug("sssssssssssssssset focus "); | 4079 | //qDebug("sssssssssssssssset focus "); |
4075 | topLevelWidget()->raise(); | 4080 | topLevelWidget()->raise(); |
4076 | setActiveWindow(); | 4081 | setActiveWindow(); |
4077 | //setFocus(); | 4082 | //setFocus(); |
4078 | } | 4083 | } |
4079 | mViewerCallerIsSearchDialog = false; | 4084 | mViewerCallerIsSearchDialog = false; |
4080 | } | 4085 | } |
4081 | 4086 | ||
4082 | void CalendarView::showNextAlarms() | 4087 | void CalendarView::showNextAlarms() |
4083 | { | 4088 | { |
4084 | QString message; | 4089 | QString message; |
4085 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); | 4090 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); |
4086 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { | 4091 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { |
4087 | QString sum = mCalendar->nextSummary(); | 4092 | QString sum = mCalendar->nextSummary(); |
4088 | QDateTime nextA = mNextAlarmDateTime; | 4093 | QDateTime nextA = mNextAlarmDateTime; |
4089 | QDateTime cur = QDateTime::currentDateTime(); | 4094 | QDateTime cur = QDateTime::currentDateTime(); |
4090 | int secs = cur.secsTo( nextA ); | 4095 | int secs = cur.secsTo( nextA ); |
4091 | int min = secs /60; | 4096 | int min = secs /60; |
4092 | int hours = min /60; | 4097 | int hours = min /60; |
4093 | min = min % 60; | 4098 | min = min % 60; |
4094 | int days = hours /24; | 4099 | int days = hours /24; |
4095 | hours = hours % 24; | 4100 | hours = hours % 24; |
4096 | 4101 | ||
4097 | message = i18n("The next alarm is in:\n"); | 4102 | //message = i18n("The next alarm is in:\n"); |
4098 | if ( days > 1 ) | 4103 | if ( days > 1 ) |
4099 | message += i18n("%1 days\n").arg( days ); | 4104 | message += i18n("%1 days\n").arg( days ); |
4100 | else if ( days == 1 ) | 4105 | else if ( days == 1 ) |
4101 | message += i18n("1 day\n"); | 4106 | message += i18n("1 day\n"); |
4102 | if ( hours > 1 ) | 4107 | if ( hours > 1 ) |
4103 | message += i18n("%1 hours\n").arg( hours ); | 4108 | message += i18n("%1 hours\n").arg( hours ); |
4104 | else if ( hours == 1 ) | 4109 | else if ( hours == 1 ) |
4105 | message += i18n("1 hour\n"); | 4110 | message += i18n("1 hour\n"); |
4106 | if ( min > 1 ) | 4111 | if ( min > 1 ) |
4107 | message += i18n("%1 minutes\n").arg( min ); | 4112 | message += i18n("%1 minutes\n").arg( min ); |
4108 | else if ( min == 1 ) | 4113 | else if ( min == 1 ) |
4109 | message += i18n("1 minute\n"); | 4114 | message += i18n("1 minute\n"); |
4110 | 4115 | if ( message.isEmpty() ) | |
4116 | message = i18n("The next alarm is in\nless than one minute!"); | ||
4117 | else | ||
4118 | message = i18n("The next alarm is in:\n") + message; | ||
4111 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; | 4119 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; |
4112 | } else { | 4120 | } else { |
4113 | message = i18n("There is no next alarm."); | 4121 | message = i18n("There is no next alarm."); |
4114 | 4122 | ||
4115 | } | 4123 | } |
4124 | #ifdef DESKTOP_VERSION | ||
4125 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | ||
4126 | message += i18n("\nThe internal alarm notification is disabled!\n"); | ||
4127 | message += i18n("Enable it in the settings menu, TAB alarm."); | ||
4128 | } | ||
4129 | |||
4130 | #endif | ||
4116 | KMessageBox::information( this, message); | 4131 | KMessageBox::information( this, message); |
4117 | } | 4132 | } |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index d450a97..6d1e6d5 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -92,191 +92,191 @@ TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | |||
92 | 92 | ||
93 | setHScrollBarMode(AlwaysOff); | 93 | setHScrollBarMode(AlwaysOff); |
94 | setVScrollBarMode(AlwaysOff); | 94 | setVScrollBarMode(AlwaysOff); |
95 | 95 | ||
96 | resizeContents(50,mRows * mCellHeight); | 96 | resizeContents(50,mRows * mCellHeight); |
97 | 97 | ||
98 | viewport()->setBackgroundMode( PaletteBackground ); | 98 | viewport()->setBackgroundMode( PaletteBackground ); |
99 | } | 99 | } |
100 | 100 | ||
101 | void TimeLabels::setCellHeight(int height) | 101 | void TimeLabels::setCellHeight(int height) |
102 | { | 102 | { |
103 | mCellHeight = height; | 103 | mCellHeight = height; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | 106 | /* |
107 | Optimization so that only the "dirty" portion of the scroll view | 107 | Optimization so that only the "dirty" portion of the scroll view |
108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
109 | */ | 109 | */ |
110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
111 | { | 111 | { |
112 | 112 | ||
113 | cx = contentsX() + frameWidth()*2; | 113 | cx = contentsX() + frameWidth()*2; |
114 | cw = contentsWidth() ; | 114 | cw = contentsWidth() ; |
115 | // end of workaround | 115 | // end of workaround |
116 | 116 | ||
117 | int cell = ((int)(cy/mCellHeight)); | 117 | int cell = ((int)(cy/mCellHeight)); |
118 | int y = cell * mCellHeight; | 118 | int y = cell * mCellHeight; |
119 | QFontMetrics fm = fontMetrics(); | 119 | QFontMetrics fm = fontMetrics(); |
120 | QString hour; | 120 | QString hour; |
121 | QString suffix = "am"; | 121 | QString suffix = "am"; |
122 | int timeHeight = fm.ascent(); | 122 | int timeHeight = fm.ascent(); |
123 | QFont nFont = font(); | 123 | QFont nFont = font(); |
124 | p->setFont( font()); | 124 | p->setFont( font()); |
125 | 125 | ||
126 | if (!KGlobal::locale()->use12Clock()) { | 126 | if (!KGlobal::locale()->use12Clock()) { |
127 | suffix = "00"; | 127 | suffix = "00"; |
128 | } else | 128 | } else |
129 | if (cell > 11) suffix = "pm"; | 129 | if (cell > 11) suffix = "pm"; |
130 | 130 | ||
131 | if ( timeHeight > mCellHeight ) { | 131 | if ( timeHeight > mCellHeight ) { |
132 | timeHeight = mCellHeight-1; | 132 | timeHeight = mCellHeight-1; |
133 | int pointS = nFont.pointSize(); | 133 | int pointS = nFont.pointSize(); |
134 | while ( pointS > 4 ) { | 134 | while ( pointS > 4 ) { |
135 | nFont.setPointSize( pointS ); | 135 | nFont.setPointSize( pointS ); |
136 | fm = QFontMetrics( nFont ); | 136 | fm = QFontMetrics( nFont ); |
137 | if ( fm.ascent() < mCellHeight ) | 137 | if ( fm.ascent() < mCellHeight ) |
138 | break; | 138 | break; |
139 | -- pointS; | 139 | -- pointS; |
140 | } | 140 | } |
141 | fm = QFontMetrics( nFont ); | 141 | fm = QFontMetrics( nFont ); |
142 | timeHeight = fm.ascent(); | 142 | timeHeight = fm.ascent(); |
143 | } | 143 | } |
144 | //timeHeight -= (timeHeight/4-2); | 144 | //timeHeight -= (timeHeight/4-2); |
145 | QFont sFont = nFont; | 145 | QFont sFont = nFont; |
146 | sFont.setPointSize( sFont.pointSize()/2 ); | 146 | sFont.setPointSize( sFont.pointSize()/2 ); |
147 | QFontMetrics fmS( sFont ); | 147 | QFontMetrics fmS( sFont ); |
148 | int sHei = fmS.ascent() ; | 148 | int sHei = fmS.ascent() ; |
149 | //sHei -= (sHei/4-2); | 149 | //sHei -= (sHei/4-2); |
150 | int startW = mMiniWidth - frameWidth()-2 ; | 150 | int startW = mMiniWidth - frameWidth()-2 ; |
151 | int tw2 = fmS.width(suffix); | 151 | int tw2 = fmS.width(suffix); |
152 | timeHeight = (timeHeight-1) /2 -1; | 152 | timeHeight = (timeHeight-1) /2 -1; |
153 | //testline | 153 | //testline |
154 | //p->drawLine(0,0,0,contentsHeight()); | 154 | //p->drawLine(0,0,0,contentsHeight()); |
155 | while (y < cy + ch+mCellHeight) { | 155 | while (y < cy + ch+mCellHeight) { |
156 | p->drawLine(startW-tw2 ,y,cw+2,y); | 156 | p->drawLine(startW-tw2+1 ,y,cw+2,y); |
157 | hour.setNum(cell); | 157 | hour.setNum(cell); |
158 | // handle 24h and am/pm time formats | 158 | // handle 24h and am/pm time formats |
159 | if (KGlobal::locale()->use12Clock()) { | 159 | if (KGlobal::locale()->use12Clock()) { |
160 | if (cell == 12) suffix = "pm"; | 160 | if (cell == 12) suffix = "pm"; |
161 | if (cell == 0) hour.setNum(12); | 161 | if (cell == 0) hour.setNum(12); |
162 | if (cell > 12) hour.setNum(cell - 12); | 162 | if (cell > 12) hour.setNum(cell - 12); |
163 | } | 163 | } |
164 | 164 | ||
165 | // center and draw the time label | 165 | // center and draw the time label |
166 | int timeWidth = fm.width(hour); | 166 | int timeWidth = fm.width(hour); |
167 | int offset = startW - timeWidth - tw2 -1 ; | 167 | int offset = startW - timeWidth - tw2 -1 ; |
168 | p->setFont( nFont ); | 168 | p->setFont( nFont ); |
169 | p->drawText( offset, y+ timeHeight, hour); | 169 | p->drawText( offset, y+ timeHeight, hour); |
170 | p->setFont( sFont ); | 170 | p->setFont( sFont ); |
171 | offset = startW - tw2; | 171 | offset = startW - tw2; |
172 | p->drawText( offset, y -1, suffix); | 172 | p->drawText( offset, y -1, suffix); |
173 | 173 | ||
174 | // increment indices | 174 | // increment indices |
175 | y += mCellHeight; | 175 | y += mCellHeight; |
176 | cell++; | 176 | cell++; |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | 180 | ||
181 | 181 | ||
182 | } | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | Calculates the minimum width. | 185 | Calculates the minimum width. |
186 | */ | 186 | */ |
187 | int TimeLabels::minimumWidth() const | 187 | int TimeLabels::minimumWidth() const |
188 | { | 188 | { |
189 | return mMiniWidth; | 189 | return mMiniWidth; |
190 | } | 190 | } |
191 | 191 | ||
192 | /** updates widget's internal state */ | 192 | /** updates widget's internal state */ |
193 | void TimeLabels::updateConfig() | 193 | void TimeLabels::updateConfig() |
194 | { | 194 | { |
195 | mRedrawNeeded = true; | 195 | mRedrawNeeded = true; |
196 | // set the font | 196 | // set the font |
197 | // config->setGroup("Fonts"); | 197 | // config->setGroup("Fonts"); |
198 | // QFont font = config->readFontEntry("TimeBar Font"); | 198 | // QFont font = config->readFontEntry("TimeBar Font"); |
199 | setFont(KOPrefs::instance()->mTimeBarFont); | 199 | setFont(KOPrefs::instance()->mTimeBarFont); |
200 | QString test = "20"; | 200 | QString test = "20"; |
201 | if (KGlobal::locale()->use12Clock()) | 201 | if (KGlobal::locale()->use12Clock()) |
202 | test = "12"; | 202 | test = "12"; |
203 | mMiniWidth = fontMetrics().width(test); | 203 | mMiniWidth = fontMetrics().width(test); |
204 | if (KGlobal::locale()->use12Clock()) | 204 | if (KGlobal::locale()->use12Clock()) |
205 | test = "pm"; | 205 | test = "pm"; |
206 | else { | 206 | else { |
207 | test = "00"; | 207 | test = "00"; |
208 | } | 208 | } |
209 | QFont sFont = font(); | 209 | QFont sFont = font(); |
210 | sFont.setPointSize( sFont.pointSize()/2 ); | 210 | sFont.setPointSize( sFont.pointSize()/2 ); |
211 | QFontMetrics fmS( sFont ); | 211 | QFontMetrics fmS( sFont ); |
212 | mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ; | 212 | mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ; |
213 | // update geometry restrictions based on new settings | 213 | // update geometry restrictions based on new settings |
214 | setFixedWidth( mMiniWidth ); | 214 | setFixedWidth( mMiniWidth ); |
215 | 215 | ||
216 | // update HourSize | 216 | // update HourSize |
217 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 217 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
218 | resizeContents(50,mRows * mCellHeight); | 218 | resizeContents(mMiniWidth,mRows * mCellHeight+1); |
219 | } | 219 | } |
220 | 220 | ||
221 | /** update time label positions */ | 221 | /** update time label positions */ |
222 | void TimeLabels::positionChanged() | 222 | void TimeLabels::positionChanged() |
223 | { | 223 | { |
224 | int adjustment = mAgenda->contentsY(); | 224 | int adjustment = mAgenda->contentsY(); |
225 | setContentsPos(0, adjustment); | 225 | setContentsPos(0, adjustment); |
226 | } | 226 | } |
227 | 227 | ||
228 | /** */ | 228 | /** */ |
229 | void TimeLabels::setAgenda(KOAgenda* agenda) | 229 | void TimeLabels::setAgenda(KOAgenda* agenda) |
230 | { | 230 | { |
231 | mAgenda = agenda; | 231 | mAgenda = agenda; |
232 | } | 232 | } |
233 | 233 | ||
234 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 234 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
235 | { | 235 | { |
236 | mMouseDownY = e->pos().y(); | 236 | mMouseDownY = e->pos().y(); |
237 | mOrgCap = topLevelWidget()->caption(); | 237 | mOrgCap = topLevelWidget()->caption(); |
238 | } | 238 | } |
239 | 239 | ||
240 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 240 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
241 | { | 241 | { |
242 | int diff = mMouseDownY - e->pos().y(); | 242 | int diff = mMouseDownY - e->pos().y(); |
243 | if ( diff < 10 && diff > -10 ) | 243 | if ( diff < 10 && diff > -10 ) |
244 | return; | 244 | return; |
245 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 245 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
246 | if ( tSize < 4 ) | 246 | if ( tSize < 4 ) |
247 | tSize = 4; | 247 | tSize = 4; |
248 | if ( tSize > 22 ) | 248 | if ( tSize > 22 ) |
249 | tSize = 22; | 249 | tSize = 22; |
250 | tSize = (tSize-2)/2; | 250 | tSize = (tSize-2)/2; |
251 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 251 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
252 | 252 | ||
253 | } | 253 | } |
254 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 254 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
255 | { | 255 | { |
256 | topLevelWidget()->setCaption( mOrgCap ); | 256 | topLevelWidget()->setCaption( mOrgCap ); |
257 | int diff = mMouseDownY - e->pos().y(); | 257 | int diff = mMouseDownY - e->pos().y(); |
258 | if ( diff < 10 && diff > -10 ) | 258 | if ( diff < 10 && diff > -10 ) |
259 | return; | 259 | return; |
260 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 260 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
261 | if ( tSize < 4 ) | 261 | if ( tSize < 4 ) |
262 | tSize = 4; | 262 | tSize = 4; |
263 | if ( tSize > 22 ) | 263 | if ( tSize > 22 ) |
264 | tSize = 22; | 264 | tSize = 22; |
265 | tSize = (tSize/2)*2; | 265 | tSize = (tSize/2)*2; |
266 | if ( tSize == KOPrefs::instance()->mHourSize ) | 266 | if ( tSize == KOPrefs::instance()->mHourSize ) |
267 | return; | 267 | return; |
268 | KOPrefs::instance()->mHourSize = tSize; | 268 | KOPrefs::instance()->mHourSize = tSize; |
269 | emit scaleChanged(); | 269 | emit scaleChanged(); |
270 | } | 270 | } |
271 | 271 | ||
272 | /** This is called in response to repaint() */ | 272 | /** This is called in response to repaint() */ |
273 | void TimeLabels::paintEvent(QPaintEvent*) | 273 | void TimeLabels::paintEvent(QPaintEvent*) |
274 | { | 274 | { |
275 | 275 | ||
276 | // kdDebug() << "paintevent..." << endl; | 276 | // kdDebug() << "paintevent..." << endl; |
277 | // this is another hack! | 277 | // this is another hack! |
278 | // QPainter painter(this); | 278 | // QPainter painter(this); |
279 | //QString c | 279 | //QString c |
280 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 280 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
281 | } | 281 | } |
282 | 282 | ||
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index b14ca43..abc80d4 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -166,181 +166,178 @@ void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | |||
166 | #ifndef DESKTOP_VERSION | 166 | #ifndef DESKTOP_VERSION |
167 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 167 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 172 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) |
173 | { | 173 | { |
174 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 174 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); |
175 | 175 | ||
176 | //mAlarmBell = new QLabel(parent); | 176 | //mAlarmBell = new QLabel(parent); |
177 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 177 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
178 | //alarmLayout->addWidget(mAlarmBell); | 178 | //alarmLayout->addWidget(mAlarmBell); |
179 | if ( QApplication::desktop()->width() < 320 ) | 179 | if ( QApplication::desktop()->width() < 320 ) |
180 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 180 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
181 | else | 181 | else |
182 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 182 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
183 | 183 | ||
184 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); | 184 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); |
185 | alarmLayout->addWidget(mAlarmButton); | 185 | alarmLayout->addWidget(mAlarmButton); |
186 | 186 | ||
187 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 187 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
188 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); | 188 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); |
189 | alarmLayout->addWidget(mAlarmTimeEdit); | 189 | alarmLayout->addWidget(mAlarmTimeEdit); |
190 | mAlarmIncrCombo = new QComboBox(false, parent); | 190 | mAlarmIncrCombo = new QComboBox(false, parent); |
191 | if ( QApplication::desktop()->width() < 320 ) { | 191 | if ( QApplication::desktop()->width() < 320 ) { |
192 | mAlarmIncrCombo->insertItem(i18n("min")); | 192 | mAlarmIncrCombo->insertItem(i18n("min")); |
193 | mAlarmIncrCombo->insertItem(i18n("hou")); | 193 | mAlarmIncrCombo->insertItem(i18n("hou")); |
194 | mAlarmIncrCombo->insertItem(i18n("day")); | 194 | mAlarmIncrCombo->insertItem(i18n("day")); |
195 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); | 195 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); |
196 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); | 196 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); |
197 | } else { | 197 | } else { |
198 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 198 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
199 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 199 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
200 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 200 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
201 | } | 201 | } |
202 | 202 | ||
203 | // mAlarmIncrCombo->setMinimumHeight(20); | 203 | // mAlarmIncrCombo->setMinimumHeight(20); |
204 | alarmLayout->addWidget(mAlarmIncrCombo); | 204 | alarmLayout->addWidget(mAlarmIncrCombo); |
205 | mAlarmSoundButton = new QPushButton(parent); | 205 | mAlarmSoundButton = new QPushButton(parent); |
206 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 206 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
207 | mAlarmSoundButton->setToggleButton(true); | 207 | mAlarmSoundButton->setToggleButton(true); |
208 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 208 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
209 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 209 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
210 | alarmLayout->addWidget(mAlarmSoundButton); | 210 | alarmLayout->addWidget(mAlarmSoundButton); |
211 | 211 | ||
212 | mAlarmProgramButton = new QPushButton(parent); | 212 | mAlarmProgramButton = new QPushButton(parent); |
213 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 213 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
214 | mAlarmProgramButton->setToggleButton(true); | 214 | mAlarmProgramButton->setToggleButton(true); |
215 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 215 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
216 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 216 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
217 | alarmLayout->addWidget(mAlarmProgramButton); | 217 | alarmLayout->addWidget(mAlarmProgramButton); |
218 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 218 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
219 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 219 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
220 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 220 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
221 | // mAlarmSoundButton->hide(); | 221 | // mAlarmSoundButton->hide(); |
222 | // mAlarmProgramButton->hide(); | 222 | // mAlarmProgramButton->hide(); |
223 | // } | 223 | // } |
224 | } | 224 | } |
225 | 225 | ||
226 | void KOEditorGeneral::pickAlarmSound() | 226 | void KOEditorGeneral::pickAlarmSound() |
227 | { | 227 | { |
228 | 228 | ||
229 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); | 229 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); |
230 | //QString prefix = mAlarmSound; | 230 | |
231 | if (!mAlarmSoundButton->isOn()) { | 231 | bool oldState = mAlarmSoundButton->isOn(); |
232 | |||
233 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | ||
234 | i18n("*.wav|Wav Files"), 0)); | ||
235 | if (!fileName.isEmpty()) { | ||
236 | mAlarmSound = fileName; | ||
237 | QToolTip::remove(mAlarmSoundButton); | ||
238 | QString dispStr = i18n("Playing '%1'").arg(fileName); | ||
239 | QToolTip::add(mAlarmSoundButton, dispStr); | ||
240 | mAlarmProgramButton->setOn(false); | ||
232 | mAlarmSoundButton->setOn(true); | 241 | mAlarmSoundButton->setOn(true); |
233 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 242 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
234 | } else { | 243 | } else { |
235 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 244 | mAlarmProgramButton->setOn(oldState); |
236 | i18n("*.wav|Wav Files"), 0)); | 245 | mAlarmSoundButton->setOn(!oldState); |
237 | if (!fileName.isEmpty()) { | 246 | |
238 | mAlarmSound = fileName; | 247 | |
239 | QToolTip::remove(mAlarmSoundButton); | ||
240 | QString dispStr = i18n("Playing '%1'").arg(fileName); | ||
241 | QToolTip::add(mAlarmSoundButton, dispStr); | ||
242 | mAlarmProgramButton->setOn(false); | ||
243 | mAlarmSoundButton->setOn(true); | ||
244 | } else { | ||
245 | mAlarmProgramButton->setOn(true); | ||
246 | mAlarmSoundButton->setOn(false); | ||
247 | |||
248 | } | ||
249 | } | 248 | } |
250 | #if 0 | 249 | |
251 | if (mAlarmProgramButton->isOn()) | 250 | if (mAlarmProgramButton->isOn()) |
252 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 251 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
253 | if ( mAlarmSoundButton->isOn()) | 252 | if ( mAlarmSoundButton->isOn()) |
254 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 253 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
255 | #endif | 254 | |
256 | } | 255 | } |
257 | 256 | ||
258 | void KOEditorGeneral::pickAlarmProgram() | 257 | void KOEditorGeneral::pickAlarmProgram() |
259 | { | 258 | { |
260 | if (!mAlarmProgramButton->isOn()) { | 259 | bool oldState = mAlarmProgramButton->isOn(); |
260 | |||
261 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | ||
262 | if (!fileName.isEmpty()) { | ||
263 | mAlarmProgram = fileName; | ||
264 | QToolTip::remove(mAlarmProgramButton); | ||
265 | QString dispStr = i18n("Running '%1'").arg(fileName); | ||
266 | QToolTip::add(mAlarmProgramButton, dispStr); | ||
267 | mAlarmSoundButton->setOn(false); | ||
261 | mAlarmProgramButton->setOn(true); | 268 | mAlarmProgramButton->setOn(true); |
262 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 269 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
263 | } else { | 270 | } else { |
264 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 271 | mAlarmProgramButton->setOn(!oldState); |
265 | if (!fileName.isEmpty()) { | 272 | mAlarmSoundButton->setOn(oldState); |
266 | mAlarmProgram = fileName; | ||
267 | QToolTip::remove(mAlarmProgramButton); | ||
268 | QString dispStr = i18n("Running '%1'").arg(fileName); | ||
269 | QToolTip::add(mAlarmProgramButton, dispStr); | ||
270 | mAlarmSoundButton->setOn(false); | ||
271 | mAlarmProgramButton->setOn(true); | ||
272 | } else { | ||
273 | mAlarmProgramButton->setOn(false); | ||
274 | mAlarmSoundButton->setOn(true); | ||
275 | } | ||
276 | } | 273 | } |
277 | #if 0 | 274 | |
278 | if (mAlarmProgramButton->isOn()) | 275 | if (mAlarmProgramButton->isOn()) |
279 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 276 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
280 | if ( mAlarmSoundButton->isOn()) | 277 | if ( mAlarmSoundButton->isOn()) |
281 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 278 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
282 | #endif | 279 | |
283 | } | 280 | } |
284 | 281 | ||
285 | 282 | ||
286 | QString KOEditorGeneral::getFittingPath( const QString s ) | 283 | QString KOEditorGeneral::getFittingPath( const QString s ) |
287 | { | 284 | { |
288 | int maxlen = 50; | 285 | int maxlen = 50; |
289 | if ( QApplication::desktop()->width() < 640 ) { | 286 | if ( QApplication::desktop()->width() < 640 ) { |
290 | if ( QApplication::desktop()->width() < 320 ) | 287 | if ( QApplication::desktop()->width() < 320 ) |
291 | maxlen = 22; | 288 | maxlen = 22; |
292 | else | 289 | else |
293 | maxlen = 35; | 290 | maxlen = 35; |
294 | } | 291 | } |
295 | if ( s.length() > maxlen ) { | 292 | if ( s.length() > maxlen ) { |
296 | return "..."+s.right(maxlen -3); | 293 | return "..."+s.right(maxlen -3); |
297 | } | 294 | } |
298 | return s; | 295 | return s; |
299 | } | 296 | } |
300 | 297 | ||
301 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 298 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
302 | { | 299 | { |
303 | if ( enable ) { | 300 | if ( enable ) { |
304 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 301 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
305 | mAlarmSoundButton->setOn( true ); | 302 | mAlarmSoundButton->setOn( true ); |
306 | if ( mAlarmSound.isEmpty() ) | 303 | if ( mAlarmSound.isEmpty() ) |
307 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 304 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
308 | else { | 305 | else { |
309 | if ( ! QFile::exists( mAlarmSound ) ) | 306 | if ( ! QFile::exists( mAlarmSound ) ) |
310 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 307 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
311 | } | 308 | } |
312 | } | 309 | } |
313 | } | 310 | } |
314 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | 311 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); |
315 | mAlarmTimeEdit->setEnabled(enable); | 312 | mAlarmTimeEdit->setEnabled(enable); |
316 | mAlarmSoundButton->setEnabled(enable); | 313 | mAlarmSoundButton->setEnabled(enable); |
317 | mAlarmProgramButton->setEnabled(enable); | 314 | mAlarmProgramButton->setEnabled(enable); |
318 | mAlarmIncrCombo->setEnabled(enable); | 315 | mAlarmIncrCombo->setEnabled(enable); |
319 | } | 316 | } |
320 | 317 | ||
321 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 318 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
322 | { | 319 | { |
323 | enableAlarmEdit( !disable ); | 320 | enableAlarmEdit( !disable ); |
324 | } | 321 | } |
325 | 322 | ||
326 | void KOEditorGeneral::enableAlarm( bool enable ) | 323 | void KOEditorGeneral::enableAlarm( bool enable ) |
327 | { | 324 | { |
328 | enableAlarmEdit( enable ); | 325 | enableAlarmEdit( enable ); |
329 | } | 326 | } |
330 | 327 | ||
331 | void KOEditorGeneral::alarmDisable(bool disable) | 328 | void KOEditorGeneral::alarmDisable(bool disable) |
332 | { | 329 | { |
333 | if (!disable) { | 330 | if (!disable) { |
334 | //mAlarmBell->setEnabled(true); | 331 | //mAlarmBell->setEnabled(true); |
335 | mAlarmButton->setEnabled(true); | 332 | mAlarmButton->setEnabled(true); |
336 | } else { | 333 | } else { |
337 | //mAlarmBell->setEnabled(false); | 334 | //mAlarmBell->setEnabled(false); |
338 | mAlarmButton->setEnabled(false); | 335 | mAlarmButton->setEnabled(false); |
339 | mAlarmButton->setChecked(false); | 336 | mAlarmButton->setChecked(false); |
340 | mAlarmTimeEdit->setEnabled(false); | 337 | mAlarmTimeEdit->setEnabled(false); |
341 | mAlarmSoundButton->setEnabled(false); | 338 | mAlarmSoundButton->setEnabled(false); |
342 | mAlarmProgramButton->setEnabled(false); | 339 | mAlarmProgramButton->setEnabled(false); |
343 | mAlarmIncrCombo->setEnabled(false); | 340 | mAlarmIncrCombo->setEnabled(false); |
344 | } | 341 | } |
345 | } | 342 | } |
346 | 343 | ||
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 01cf0ff..395325c 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -143,154 +143,160 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) | |||
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | 145 | ||
146 | DndFactory factory( mCalendar ); | 146 | DndFactory factory( mCalendar ); |
147 | Todo *todo = factory.createDropTodo(e); | 147 | Todo *todo = factory.createDropTodo(e); |
148 | 148 | ||
149 | if (todo) { | 149 | if (todo) { |
150 | e->acceptAction(); | 150 | e->acceptAction(); |
151 | 151 | ||
152 | KOTodoViewItem *destination = | 152 | KOTodoViewItem *destination = |
153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 153 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
154 | Todo *destinationEvent = 0; | 154 | Todo *destinationEvent = 0; |
155 | if (destination) destinationEvent = destination->todo(); | 155 | if (destination) destinationEvent = destination->todo(); |
156 | 156 | ||
157 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 157 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
158 | 158 | ||
159 | if(existingTodo) { | 159 | if(existingTodo) { |
160 | Incidence *to = destinationEvent; | 160 | Incidence *to = destinationEvent; |
161 | while(to) { | 161 | while(to) { |
162 | if (to->uid() == todo->uid()) { | 162 | if (to->uid() == todo->uid()) { |
163 | KMessageBox::sorry(this, | 163 | KMessageBox::sorry(this, |
164 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 164 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
165 | i18n("Drop To-Do")); | 165 | i18n("Drop To-Do")); |
166 | delete todo; | 166 | delete todo; |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | to = to->relatedTo(); | 169 | to = to->relatedTo(); |
170 | } | 170 | } |
171 | internalDrop = true; | 171 | internalDrop = true; |
172 | if ( destinationEvent ) | 172 | if ( destinationEvent ) |
173 | reparentTodoSignal( destinationEvent, existingTodo ); | 173 | reparentTodoSignal( destinationEvent, existingTodo ); |
174 | else | 174 | else |
175 | unparentTodoSignal(existingTodo); | 175 | unparentTodoSignal(existingTodo); |
176 | delete todo; | 176 | delete todo; |
177 | } else { | 177 | } else { |
178 | mCalendar->addTodo(todo); | 178 | mCalendar->addTodo(todo); |
179 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 179 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
180 | if ( destinationEvent ) | 180 | if ( destinationEvent ) |
181 | reparentTodoSignal( destinationEvent, todo ); | 181 | reparentTodoSignal( destinationEvent, todo ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | QString text; | 185 | QString text; |
186 | if (QTextDrag::decode(e,text)) { | 186 | if (QTextDrag::decode(e,text)) { |
187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 187 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 188 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
189 | qDebug("Dropped : " + text); | 189 | qDebug("Dropped : " + text); |
190 | QStringList emails = QStringList::split(",",text); | 190 | QStringList emails = QStringList::split(",",text); |
191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 191 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
192 | int pos = (*it).find("<"); | 192 | int pos = (*it).find("<"); |
193 | QString name = (*it).left(pos); | 193 | QString name = (*it).left(pos); |
194 | QString email = (*it).mid(pos); | 194 | QString email = (*it).mid(pos); |
195 | if (!email.isEmpty() && todoi) { | 195 | if (!email.isEmpty() && todoi) { |
196 | todoi->todo()->addAttendee(new Attendee(name,email)); | 196 | todoi->todo()->addAttendee(new Attendee(name,email)); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | else { | 200 | else { |
201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 201 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
202 | e->ignore(); | 202 | e->ignore(); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | #endif | 205 | #endif |
206 | } | 206 | } |
207 | void KOTodoListView::wheelEvent (QWheelEvent *e) | ||
208 | { | ||
209 | QListView::wheelEvent (e); | ||
210 | } | ||
207 | 211 | ||
208 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 212 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
209 | { | 213 | { |
210 | 214 | ||
211 | QPoint p(contentsToViewport(e->pos())); | 215 | QPoint p(contentsToViewport(e->pos())); |
212 | QListViewItem *i = itemAt(p); | 216 | QListViewItem *i = itemAt(p); |
213 | bool rootClicked = true; | 217 | bool rootClicked = true; |
214 | if (i) { | 218 | if (i) { |
215 | // if the user clicked into the root decoration of the item, don't | 219 | // if the user clicked into the root decoration of the item, don't |
216 | // try to start a drag! | 220 | // try to start a drag! |
217 | int X = p.x(); | 221 | int X = p.x(); |
218 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 222 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
219 | if (X > header()->sectionPos(0) + | 223 | if (X > header()->sectionPos(0) + |
220 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 224 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
221 | itemMargin() +i->height()|| | 225 | itemMargin() +i->height()|| |
222 | X < header()->sectionPos(0)) { | 226 | X < header()->sectionPos(0)) { |
223 | rootClicked = false; | 227 | rootClicked = false; |
224 | } | 228 | } |
225 | } else { | 229 | } else { |
226 | rootClicked = false; | 230 | rootClicked = false; |
227 | } | 231 | } |
228 | #ifndef KORG_NODND | 232 | #ifndef KORG_NODND |
229 | mMousePressed = false; | 233 | mMousePressed = false; |
230 | if (! rootClicked ) { | 234 | if (! rootClicked && !( e->button() == RightButton) ) { |
231 | mPressPos = e->pos(); | 235 | mPressPos = e->pos(); |
232 | mMousePressed = true; | 236 | mMousePressed = true; |
237 | } else { | ||
238 | mMousePressed = false; | ||
233 | } | 239 | } |
234 | #endif | 240 | #endif |
235 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 241 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
236 | #ifndef DESKTOP_VERSION | 242 | #ifndef DESKTOP_VERSION |
237 | if (!( e->button() == RightButton && rootClicked) ) | 243 | if (!( e->button() == RightButton && rootClicked) ) |
238 | QListView::contentsMousePressEvent(e); | 244 | QListView::contentsMousePressEvent(e); |
239 | #else | 245 | #else |
240 | QListView::contentsMousePressEvent(e); | 246 | QListView::contentsMousePressEvent(e); |
241 | #endif | 247 | #endif |
242 | } | 248 | } |
243 | void KOTodoListView::paintEvent(QPaintEvent* e) | 249 | void KOTodoListView::paintEvent(QPaintEvent* e) |
244 | { | 250 | { |
245 | emit paintNeeded(); | 251 | emit paintNeeded(); |
246 | QListView::paintEvent( e); | 252 | QListView::paintEvent( e); |
247 | } | 253 | } |
248 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 254 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
249 | { | 255 | { |
250 | 256 | ||
251 | #ifndef KORG_NODND | 257 | #ifndef KORG_NODND |
252 | //QListView::contentsMouseMoveEvent(e); | 258 | //QListView::contentsMouseMoveEvent(e); |
253 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 259 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
254 | QApplication::startDragDistance()*3) { | 260 | QApplication::startDragDistance()*3) { |
255 | mMousePressed = false; | 261 | mMousePressed = false; |
256 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 262 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
257 | if (item) { | 263 | if (item) { |
258 | DndFactory factory( mCalendar ); | 264 | DndFactory factory( mCalendar ); |
259 | ICalDrag *vd = factory.createDrag( | 265 | ICalDrag *vd = factory.createDrag( |
260 | ((KOTodoViewItem *)item)->todo(),viewport()); | 266 | ((KOTodoViewItem *)item)->todo(),viewport()); |
261 | internalDrop = false; | 267 | internalDrop = false; |
262 | // we cannot do any senseful here, because the DnD is still broken in Qt | 268 | // we cannot do any senseful here, because the DnD is still broken in Qt |
263 | if (vd->drag()) { | 269 | if (vd->drag()) { |
264 | if ( !internalDrop ) { | 270 | if ( !internalDrop ) { |
265 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 271 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
266 | qDebug("Dnd: External move: Delete drag source "); | 272 | qDebug("Dnd: External move: Delete drag source "); |
267 | } else | 273 | } else |
268 | qDebug("Dnd: Internal move "); | 274 | qDebug("Dnd: Internal move "); |
269 | 275 | ||
270 | } else { | 276 | } else { |
271 | if ( !internalDrop ) { | 277 | if ( !internalDrop ) { |
272 | qDebug("Dnd: External Copy"); | 278 | qDebug("Dnd: External Copy"); |
273 | } else | 279 | } else |
274 | qDebug("DnD: Internal copy: Copy pending"); | 280 | qDebug("DnD: Internal copy: Copy pending"); |
275 | } | 281 | } |
276 | } | 282 | } |
277 | } | 283 | } |
278 | #endif | 284 | #endif |
279 | } | 285 | } |
280 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 286 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
281 | { | 287 | { |
282 | if ( !e->isAutoRepeat() ) { | 288 | if ( !e->isAutoRepeat() ) { |
283 | mFlagKeyPressed = false; | 289 | mFlagKeyPressed = false; |
284 | } | 290 | } |
285 | } | 291 | } |
286 | 292 | ||
287 | 293 | ||
288 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 294 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
289 | { | 295 | { |
290 | qApp->processEvents(); | 296 | qApp->processEvents(); |
291 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 297 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
292 | e->ignore(); | 298 | e->ignore(); |
293 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 299 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
294 | return; | 300 | return; |
295 | } | 301 | } |
296 | if (! e->isAutoRepeat() ) | 302 | if (! e->isAutoRepeat() ) |
@@ -1021,129 +1027,129 @@ void KOTodoView::setNewPercentage(int index) | |||
1021 | } else { | 1027 | } else { |
1022 | mActiveItem->todo()->setCompleted(false); | 1028 | mActiveItem->todo()->setCompleted(false); |
1023 | } | 1029 | } |
1024 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1030 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1025 | mActiveItem->construct(); | 1031 | mActiveItem->construct(); |
1026 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1032 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1027 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1033 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1028 | } | 1034 | } |
1029 | } | 1035 | } |
1030 | 1036 | ||
1031 | 1037 | ||
1032 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1038 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1033 | { | 1039 | { |
1034 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1040 | QPopupMenu* tempMenu = new QPopupMenu (this); |
1035 | QStringList checkedCategories = todoItem->todo()->categories (); | 1041 | QStringList checkedCategories = todoItem->todo()->categories (); |
1036 | 1042 | ||
1037 | tempMenu->setCheckable (true); | 1043 | tempMenu->setCheckable (true); |
1038 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1044 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1039 | it != KOPrefs::instance()->mCustomCategories.end (); | 1045 | it != KOPrefs::instance()->mCustomCategories.end (); |
1040 | ++it) { | 1046 | ++it) { |
1041 | int index = tempMenu->insertItem (*it); | 1047 | int index = tempMenu->insertItem (*it); |
1042 | mCategory[index] = *it; | 1048 | mCategory[index] = *it; |
1043 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1049 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
1044 | } | 1050 | } |
1045 | 1051 | ||
1046 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1052 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1047 | return tempMenu; | 1053 | return tempMenu; |
1048 | 1054 | ||
1049 | 1055 | ||
1050 | } | 1056 | } |
1051 | void KOTodoView::changedCategories(int index) | 1057 | void KOTodoView::changedCategories(int index) |
1052 | { | 1058 | { |
1053 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1059 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1054 | QStringList categories = mActiveItem->todo()->categories (); | 1060 | QStringList categories = mActiveItem->todo()->categories (); |
1055 | QString colcat = categories.first(); | 1061 | QString colcat = categories.first(); |
1056 | if (categories.find (mCategory[index]) != categories.end ()) | 1062 | if (categories.find (mCategory[index]) != categories.end ()) |
1057 | categories.remove (mCategory[index]); | 1063 | categories.remove (mCategory[index]); |
1058 | else | 1064 | else |
1059 | categories.insert (categories.end(), mCategory[index]); | 1065 | categories.insert (categories.end(), mCategory[index]); |
1060 | categories.sort (); | 1066 | categories.sort (); |
1061 | if ( !colcat.isEmpty() ) { | 1067 | if ( !colcat.isEmpty() ) { |
1062 | if ( categories.find ( colcat ) != categories.end () ) { | 1068 | if ( categories.find ( colcat ) != categories.end () ) { |
1063 | categories.remove( colcat ); | 1069 | categories.remove( colcat ); |
1064 | categories.prepend( colcat ); | 1070 | categories.prepend( colcat ); |
1065 | } | 1071 | } |
1066 | } | 1072 | } |
1067 | mActiveItem->todo()->setCategories (categories); | 1073 | mActiveItem->todo()->setCategories (categories); |
1068 | mActiveItem->construct(); | 1074 | mActiveItem->construct(); |
1069 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1075 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1070 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1076 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1071 | } | 1077 | } |
1072 | } | 1078 | } |
1073 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1079 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1074 | { | 1080 | { |
1075 | if ( pendingSubtodo != 0 ) { | 1081 | if ( pendingSubtodo != 0 ) { |
1076 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1082 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1077 | } | 1083 | } |
1078 | pendingSubtodo = 0; | 1084 | pendingSubtodo = 0; |
1079 | int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1085 | int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1080 | //qDebug("ROW %d ", row); | 1086 | //qDebug("ROW %d ", row); |
1081 | if (!item) { | 1087 | if (!item) { |
1082 | newTodo(); | 1088 | newTodo(); |
1083 | return; | 1089 | return; |
1084 | } else { | 1090 | } else { |
1085 | if ( row == 1 ) { | 1091 | if ( row == 1 || row == 2 ) { |
1086 | mActiveItem = (KOTodoViewItem *) item; | 1092 | mActiveItem = (KOTodoViewItem *) item; |
1087 | newSubTodo(); | 1093 | newSubTodo(); |
1088 | return; | 1094 | return; |
1089 | } | 1095 | } |
1090 | } | 1096 | } |
1091 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1097 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1092 | editItem( item ); | 1098 | editItem( item ); |
1093 | else | 1099 | else |
1094 | showItem( item , QPoint(), 0 ); | 1100 | showItem( item , QPoint(), 0 ); |
1095 | } | 1101 | } |
1096 | void KOTodoView::itemClicked(QListViewItem *item) | 1102 | void KOTodoView::itemClicked(QListViewItem *item) |
1097 | { | 1103 | { |
1098 | //qDebug("KOTodoView::itemClicked %d", item); | 1104 | //qDebug("KOTodoView::itemClicked %d", item); |
1099 | if (!item) { | 1105 | if (!item) { |
1100 | if ( pendingSubtodo != 0 ) { | 1106 | if ( pendingSubtodo != 0 ) { |
1101 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1107 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1102 | } | 1108 | } |
1103 | pendingSubtodo = 0; | 1109 | pendingSubtodo = 0; |
1104 | return; | 1110 | return; |
1105 | } | 1111 | } |
1106 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1112 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1107 | if ( pendingSubtodo != 0 ) { | 1113 | if ( pendingSubtodo != 0 ) { |
1108 | bool allowReparent = true; | 1114 | bool allowReparent = true; |
1109 | QListViewItem *par = item; | 1115 | QListViewItem *par = item; |
1110 | while ( par ) { | 1116 | while ( par ) { |
1111 | if ( par == pendingSubtodo ) { | 1117 | if ( par == pendingSubtodo ) { |
1112 | allowReparent = false; | 1118 | allowReparent = false; |
1113 | break; | 1119 | break; |
1114 | } | 1120 | } |
1115 | par = par->parent(); | 1121 | par = par->parent(); |
1116 | } | 1122 | } |
1117 | if ( !allowReparent ) { | 1123 | if ( !allowReparent ) { |
1118 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1124 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1119 | qDebug("Recursive reparenting not possible "); | 1125 | qDebug("Recursive reparenting not possible "); |
1120 | pendingSubtodo = 0; | 1126 | pendingSubtodo = 0; |
1121 | } else { | 1127 | } else { |
1122 | Todo* newParent = todoItem->todo(); | 1128 | Todo* newParent = todoItem->todo(); |
1123 | Todo* newSub = pendingSubtodo->todo(); | 1129 | Todo* newSub = pendingSubtodo->todo(); |
1124 | pendingSubtodo = 0; | 1130 | pendingSubtodo = 0; |
1125 | emit reparentTodoSignal( newParent,newSub ); | 1131 | emit reparentTodoSignal( newParent,newSub ); |
1126 | return; | 1132 | return; |
1127 | } | 1133 | } |
1128 | } | 1134 | } |
1129 | #if 0 | 1135 | #if 0 |
1130 | // handled by the item itself | 1136 | // handled by the item itself |
1131 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | 1137 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? |
1132 | qDebug("com %d ",completed ); | 1138 | qDebug("com %d ",completed ); |
1133 | qDebug("itemclicked "); | 1139 | qDebug("itemclicked "); |
1134 | if (todoItem->isOn()) { | 1140 | if (todoItem->isOn()) { |
1135 | qDebug("on "); | 1141 | qDebug("on "); |
1136 | if (!completed) { | 1142 | if (!completed) { |
1137 | qDebug("set true "); | 1143 | qDebug("set true "); |
1138 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1144 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1139 | } | 1145 | } |
1140 | } else { | 1146 | } else { |
1141 | qDebug("not on "); | 1147 | qDebug("not on "); |
1142 | if (completed) { | 1148 | if (completed) { |
1143 | qDebug("set false "); | 1149 | qDebug("set false "); |
1144 | todoItem->todo()->setCompleted(false); | 1150 | todoItem->todo()->setCompleted(false); |
1145 | } | 1151 | } |
1146 | } | 1152 | } |
1147 | #endif | 1153 | #endif |
1148 | } | 1154 | } |
1149 | 1155 | ||
@@ -1210,128 +1216,129 @@ void KOTodoView::setAllOpen() | |||
1210 | } else { | 1216 | } else { |
1211 | storeCurrentItem(); | 1217 | storeCurrentItem(); |
1212 | } | 1218 | } |
1213 | setOpen(mTodoListView->firstChild(), true); | 1219 | setOpen(mTodoListView->firstChild(), true); |
1214 | resetCurrentItem(); | 1220 | resetCurrentItem(); |
1215 | } | 1221 | } |
1216 | void KOTodoView::setAllClose() | 1222 | void KOTodoView::setAllClose() |
1217 | { | 1223 | { |
1218 | if ( isFlatDisplay ) { | 1224 | if ( isFlatDisplay ) { |
1219 | isFlatDisplay = false; | 1225 | isFlatDisplay = false; |
1220 | mPopupMenu->setItemChecked( 8,false ); | 1226 | mPopupMenu->setItemChecked( 8,false ); |
1221 | updateView(); | 1227 | updateView(); |
1222 | } else { | 1228 | } else { |
1223 | storeCurrentItem(); | 1229 | storeCurrentItem(); |
1224 | } | 1230 | } |
1225 | setOpen(mTodoListView->firstChild(), false); | 1231 | setOpen(mTodoListView->firstChild(), false); |
1226 | resetCurrentItem(); | 1232 | resetCurrentItem(); |
1227 | } | 1233 | } |
1228 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1234 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1229 | { | 1235 | { |
1230 | 1236 | ||
1231 | while ( item ) { | 1237 | while ( item ) { |
1232 | setOpen( item->firstChild(), setOpenI ); | 1238 | setOpen( item->firstChild(), setOpenI ); |
1233 | item->setOpen( setOpenI ); | 1239 | item->setOpen( setOpenI ); |
1234 | item = item->nextSibling(); | 1240 | item = item->nextSibling(); |
1235 | } | 1241 | } |
1236 | } | 1242 | } |
1237 | 1243 | ||
1238 | void KOTodoView::displayAllFlat() | 1244 | void KOTodoView::displayAllFlat() |
1239 | { | 1245 | { |
1240 | pendingSubtodo = 0; | 1246 | pendingSubtodo = 0; |
1241 | if ( mBlockUpdate ) { | 1247 | if ( mBlockUpdate ) { |
1242 | return; | 1248 | return; |
1243 | } | 1249 | } |
1244 | mPopupMenu->setItemChecked( 8,true ); | 1250 | mPopupMenu->setItemChecked( 8,true ); |
1245 | isFlatDisplay = true; | 1251 | isFlatDisplay = true; |
1246 | QPtrList<Todo> todoList = calendar()->todos(); | 1252 | QPtrList<Todo> todoList = calendar()->todos(); |
1247 | mTodoMap.clear(); | 1253 | mTodoMap.clear(); |
1248 | mTodoListView->clear(); | 1254 | mTodoListView->clear(); |
1249 | Todo *todo; | 1255 | Todo *todo; |
1250 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1256 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1251 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1257 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1252 | mTodoMap.insert(todo,todoItem); | 1258 | mTodoMap.insert(todo,todoItem); |
1253 | } | 1259 | } |
1254 | mTodoListView->setFocus(); | 1260 | mTodoListView->setFocus(); |
1255 | processSelectionChange(); | 1261 | processSelectionChange(); |
1256 | } | 1262 | } |
1257 | 1263 | ||
1258 | void KOTodoView::setAllFlat() | 1264 | void KOTodoView::setAllFlat() |
1259 | { | 1265 | { |
1260 | if ( isFlatDisplay ) { | 1266 | if ( isFlatDisplay ) { |
1261 | isFlatDisplay = false; | 1267 | isFlatDisplay = false; |
1262 | mPopupMenu->setItemChecked( 8,false ); | 1268 | mPopupMenu->setItemChecked( 8,false ); |
1263 | updateView(); | 1269 | updateView(); |
1264 | return; | 1270 | return; |
1265 | } | 1271 | } |
1266 | storeCurrentItem(); | 1272 | storeCurrentItem(); |
1267 | displayAllFlat(); | 1273 | displayAllFlat(); |
1268 | resetCurrentItem(); | 1274 | resetCurrentItem(); |
1269 | } | 1275 | } |
1270 | 1276 | ||
1271 | void KOTodoView::purgeCompleted() | 1277 | void KOTodoView::purgeCompleted() |
1272 | { | 1278 | { |
1273 | emit purgeCompletedSignal(); | 1279 | emit purgeCompletedSignal(); |
1280 | |||
1274 | } | 1281 | } |
1275 | void KOTodoView::toggleQuickTodo() | 1282 | void KOTodoView::toggleQuickTodo() |
1276 | { | 1283 | { |
1277 | if ( mQuickAdd->isVisible() ) { | 1284 | if ( mQuickAdd->isVisible() ) { |
1278 | mQuickAdd->hide(); | 1285 | mQuickAdd->hide(); |
1279 | KOPrefs::instance()->mEnableQuickTodo = false; | 1286 | KOPrefs::instance()->mEnableQuickTodo = false; |
1280 | } | 1287 | } |
1281 | else { | 1288 | else { |
1282 | mQuickAdd->show(); | 1289 | mQuickAdd->show(); |
1283 | KOPrefs::instance()->mEnableQuickTodo = true; | 1290 | KOPrefs::instance()->mEnableQuickTodo = true; |
1284 | } | 1291 | } |
1285 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1292 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1286 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1293 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1287 | } | 1294 | } |
1288 | 1295 | ||
1289 | void KOTodoView::toggleRunning() | 1296 | void KOTodoView::toggleRunning() |
1290 | { | 1297 | { |
1291 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1298 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1292 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1299 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1293 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1300 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1294 | updateView(); | 1301 | updateView(); |
1295 | } | 1302 | } |
1296 | 1303 | ||
1297 | void KOTodoView::toggleCompleted() | 1304 | void KOTodoView::toggleCompleted() |
1298 | { | 1305 | { |
1299 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1306 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1300 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1307 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1301 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1308 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1302 | updateView(); | 1309 | updateView(); |
1303 | } | 1310 | } |
1304 | 1311 | ||
1305 | void KOTodoView::addQuickTodo() | 1312 | void KOTodoView::addQuickTodo() |
1306 | { | 1313 | { |
1307 | Todo *todo = new Todo(); | 1314 | Todo *todo = new Todo(); |
1308 | todo->setSummary(mQuickAdd->text()); | 1315 | todo->setSummary(mQuickAdd->text()); |
1309 | todo->setOrganizer(KOPrefs::instance()->email()); | 1316 | todo->setOrganizer(KOPrefs::instance()->email()); |
1310 | CalFilter * cf = mCalendar->filter(); | 1317 | CalFilter * cf = mCalendar->filter(); |
1311 | if ( cf ) { | 1318 | if ( cf ) { |
1312 | if ( cf->isEnabled()&& cf->showCategories()) { | 1319 | if ( cf->isEnabled()&& cf->showCategories()) { |
1313 | todo->setCategories(cf->categoryList()); | 1320 | todo->setCategories(cf->categoryList()); |
1314 | } | 1321 | } |
1315 | if ( cf->isEnabled() ) | 1322 | if ( cf->isEnabled() ) |
1316 | todo->setSecrecy( cf->getSecrecy()); | 1323 | todo->setSecrecy( cf->getSecrecy()); |
1317 | } | 1324 | } |
1318 | mCalendar->addTodo(todo); | 1325 | mCalendar->addTodo(todo); |
1319 | mQuickAdd->setText(""); | 1326 | mQuickAdd->setText(""); |
1320 | todoModified (todo, KOGlobals::EVENTADDED ); | 1327 | todoModified (todo, KOGlobals::EVENTADDED ); |
1321 | updateView(); | 1328 | updateView(); |
1322 | } | 1329 | } |
1323 | 1330 | ||
1324 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1331 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1325 | { | 1332 | { |
1326 | // e->ignore(); | 1333 | // e->ignore(); |
1327 | //return; | 1334 | //return; |
1328 | //qDebug("KOTodoView::keyPressEvent "); | 1335 | //qDebug("KOTodoView::keyPressEvent "); |
1329 | switch ( e->key() ) { | 1336 | switch ( e->key() ) { |
1330 | case Qt::Key_Down: | 1337 | case Qt::Key_Down: |
1331 | case Qt::Key_Up: | 1338 | case Qt::Key_Up: |
1332 | QWidget::keyPressEvent ( e ); | 1339 | QWidget::keyPressEvent ( e ); |
1333 | break; | 1340 | break; |
1334 | 1341 | ||
1335 | case Qt::Key_Q: | 1342 | case Qt::Key_Q: |
1336 | toggleQuickTodo(); | 1343 | toggleQuickTodo(); |
1337 | break; | 1344 | break; |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index e553d0e..39976cf 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -7,128 +7,129 @@ | |||
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | class KOTodoViewWhatsThis; | 52 | class KOTodoViewWhatsThis; |
53 | 53 | ||
54 | class DocPrefs; | 54 | class DocPrefs; |
55 | 55 | ||
56 | class KOTodoListView : public KListView | 56 | class KOTodoListView : public KListView |
57 | { | 57 | { |
58 | Q_OBJECT | 58 | Q_OBJECT |
59 | public: | 59 | public: |
60 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 60 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
61 | virtual ~KOTodoListView() {} | 61 | virtual ~KOTodoListView() {} |
62 | 62 | ||
63 | signals: | 63 | signals: |
64 | void paintNeeded(); | 64 | void paintNeeded(); |
65 | void todoDropped(Todo *, int); | 65 | void todoDropped(Todo *, int); |
66 | void double_Clicked(QListViewItem *item); | 66 | void double_Clicked(QListViewItem *item); |
67 | void reparentTodoSignal( Todo *,Todo * ); | 67 | void reparentTodoSignal( Todo *,Todo * ); |
68 | void unparentTodoSignal(Todo *); | 68 | void unparentTodoSignal(Todo *); |
69 | void deleteTodo( Todo * ); | 69 | void deleteTodo( Todo * ); |
70 | protected: | 70 | protected: |
71 | void wheelEvent (QWheelEvent *e); | ||
71 | void contentsDragEnterEvent(QDragEnterEvent *); | 72 | void contentsDragEnterEvent(QDragEnterEvent *); |
72 | void contentsDragMoveEvent(QDragMoveEvent *); | 73 | void contentsDragMoveEvent(QDragMoveEvent *); |
73 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 74 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
74 | void contentsDropEvent(QDropEvent *); | 75 | void contentsDropEvent(QDropEvent *); |
75 | 76 | ||
76 | void contentsMousePressEvent(QMouseEvent *); | 77 | void contentsMousePressEvent(QMouseEvent *); |
77 | void contentsMouseMoveEvent(QMouseEvent *); | 78 | void contentsMouseMoveEvent(QMouseEvent *); |
78 | void contentsMouseReleaseEvent(QMouseEvent *); | 79 | void contentsMouseReleaseEvent(QMouseEvent *); |
79 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 80 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
80 | 81 | ||
81 | private: | 82 | private: |
82 | void paintEvent(QPaintEvent * pevent); | 83 | void paintEvent(QPaintEvent * pevent); |
83 | bool internalDrop; | 84 | bool internalDrop; |
84 | QString mName; | 85 | QString mName; |
85 | Calendar *mCalendar; | 86 | Calendar *mCalendar; |
86 | QPoint mPressPos; | 87 | QPoint mPressPos; |
87 | bool mMousePressed; | 88 | bool mMousePressed; |
88 | QListViewItem *mOldCurrent; | 89 | QListViewItem *mOldCurrent; |
89 | bool mFlagKeyPressed; | 90 | bool mFlagKeyPressed; |
90 | void keyPressEvent ( QKeyEvent * ) ; | 91 | void keyPressEvent ( QKeyEvent * ) ; |
91 | void keyReleaseEvent ( QKeyEvent * ) ; | 92 | void keyReleaseEvent ( QKeyEvent * ) ; |
92 | }; | 93 | }; |
93 | 94 | ||
94 | 95 | ||
95 | /** | 96 | /** |
96 | This is the line-edit on top of the todoview for fast addition of new todos | 97 | This is the line-edit on top of the todoview for fast addition of new todos |
97 | */ | 98 | */ |
98 | class KOQuickTodo : public QLineEdit | 99 | class KOQuickTodo : public QLineEdit |
99 | { | 100 | { |
100 | public: | 101 | public: |
101 | KOQuickTodo(QWidget *parent=0); | 102 | KOQuickTodo(QWidget *parent=0); |
102 | protected: | 103 | protected: |
103 | void focusInEvent(QFocusEvent *ev); | 104 | void focusInEvent(QFocusEvent *ev); |
104 | void focusOutEvent(QFocusEvent *ev); | 105 | void focusOutEvent(QFocusEvent *ev); |
105 | }; | 106 | }; |
106 | 107 | ||
107 | 108 | ||
108 | /** | 109 | /** |
109 | This class provides a multi-column list view of todo events. | 110 | This class provides a multi-column list view of todo events. |
110 | 111 | ||
111 | @short multi-column list view of todo events. | 112 | @short multi-column list view of todo events. |
112 | @author Cornelius Schumacher <schumacher@kde.org> | 113 | @author Cornelius Schumacher <schumacher@kde.org> |
113 | */ | 114 | */ |
114 | class KOTodoView : public KOrg::BaseView | 115 | class KOTodoView : public KOrg::BaseView |
115 | { | 116 | { |
116 | Q_OBJECT | 117 | Q_OBJECT |
117 | public: | 118 | public: |
118 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 119 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
119 | ~KOTodoView(); | 120 | ~KOTodoView(); |
120 | 121 | ||
121 | QPtrList<Incidence> selectedIncidences(); | 122 | QPtrList<Incidence> selectedIncidences(); |
122 | QPtrList<Todo> selectedTodos(); | 123 | QPtrList<Todo> selectedTodos(); |
123 | 124 | ||
124 | DateList selectedDates() | 125 | DateList selectedDates() |
125 | {DateList q; | 126 | {DateList q; |
126 | return q;} | 127 | return q;} |
127 | 128 | ||
128 | /** Return number of shown dates. TodoView does not show dates, */ | 129 | /** Return number of shown dates. TodoView does not show dates, */ |
129 | int currentDateCount() { return 0; } | 130 | int currentDateCount() { return 0; } |
130 | 131 | ||
131 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 132 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
132 | 133 | ||
133 | void setDocumentId( const QString & ); | 134 | void setDocumentId( const QString & ); |
134 | 135 | ||