summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp18
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/mainwindow.cpp19
-rw-r--r--korganizer/mainwindow.h1
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
@@ -235,7 +235,7 @@ CalendarView::CalendarView( Calendar *calendar,
void CalendarView::init()
{
-
+ mNextAlarmDateTime = QDateTime::currentDateTime();
setFocusPolicy ( WheelFocus );
mViewerCallerIsSearchDialog = false;
mBlockShowDates = false;
@@ -642,6 +642,7 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
{
+ mNextAlarmDateTime = qdt;
//qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
#ifndef DESKTOP_VERSION
@@ -4064,3 +4065,18 @@ void CalendarView::resetFocus()
}
mViewerCallerIsSearchDialog = false;
}
+
+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
@@ -176,6 +176,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
public slots:
+ void showNextAlarms();
void showOpenError();
void watchSavedFile();
void recheckTimerAlarm();
@@ -499,6 +500,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
Todo *selectedTodo();
private:
+ QDateTime mNextAlarmDateTime;
bool mViewerCallerIsSearchDialog;
bool mBlockShowDates;
KSyncManager* mSyncManager;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 95b836c..7a4275b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -590,7 +590,7 @@ void MainWindow::initActions()
mWeekFont.setPointSize( fontPoint );
QFontMetrics f( mWeekFont );
fontWid = f.width( "30" );
- qDebug("dec-- ");
+ //qDebug("dec-- ");
}
connect( mWeekAction, SIGNAL( activated() ),
@@ -1748,7 +1748,10 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
mView->toggleExpand();
break;
case Qt::Key_A:
- mView->toggleAllDaySize();
+ if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
+ mView->showNextAlarms();
+ else
+ mView->toggleAllDaySize();
break;
case Qt::Key_T:
if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
@@ -2133,3 +2136,15 @@ void MainWindow::weekAction()
}
delete popup;
}
+
+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
@@ -104,6 +104,7 @@ class MainWindow : public QMainWindow
void syncFileRequest();
protected:
+ void hideEvent ( QHideEvent * );
QString sentSyncFile();
void displayText( QString, QString);
void enableIncidenceActions( bool );