-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 19 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
4 files changed, 37 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3a16fe6..73aa733 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -237,3 +237,3 @@ void CalendarView::init() { - + mNextAlarmDateTime = QDateTime::currentDateTime(); setFocusPolicy ( WheelFocus ); @@ -644,2 +644,3 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) { + mNextAlarmDateTime = qdt; //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); @@ -4066 +4067,16 @@ void CalendarView::resetFocus() } + +void CalendarView::showNextAlarms() +{ + QString message; + if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { + QString sum = mCalendar->nextSummary(); + QDateTime nextA = mNextAlarmDateTime; + QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); + message = i18n("The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)").arg( KGlobal::locale()->formatDate(nextA.date() , false)).arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; + } else { + message = i18n("There is no next alarm."); + + } + KMessageBox::information( this, message); +} diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 16e671f..9782ffe 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -178,2 +178,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser public slots: + void showNextAlarms(); void showOpenError(); @@ -501,2 +502,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser private: + QDateTime mNextAlarmDateTime; bool mViewerCallerIsSearchDialog; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 95b836c..7a4275b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -592,3 +592,3 @@ void MainWindow::initActions() fontWid = f.width( "30" ); - qDebug("dec-- "); + //qDebug("dec-- "); } @@ -1750,3 +1750,6 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) case Qt::Key_A: - mView->toggleAllDaySize(); + if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) + mView->showNextAlarms(); + else + mView->toggleAllDaySize(); break; @@ -2135 +2138,13 @@ void MainWindow::weekAction() } + +void MainWindow::hideEvent ( QHideEvent * ) +{ + QString message; + QDateTime nextA = mCalendar->nextAlarmEventDateTime(); + if ( nextA.isValid() ) { + QString sum = mCalendar->nextSummary(); + + message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); + setCaption( message ); + } +} diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 7604529..b3041dc 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -106,2 +106,3 @@ class MainWindow : public QMainWindow protected: + void hideEvent ( QHideEvent * ); QString sentSyncFile(); |