summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
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
@@ -226,25 +226,25 @@ CalendarView::CalendarView( Calendar *calendar,
226 : CalendarViewBase( parent, name ), 226 : CalendarViewBase( parent, name ),
227 mCalendar( calendar ), 227 mCalendar( calendar ),
228 mResourceManager( 0 ) 228 mResourceManager( 0 )
229{ 229{
230 230
231 mEventEditor = 0; 231 mEventEditor = 0;
232 mTodoEditor = 0; 232 mTodoEditor = 0;
233 init(); 233 init();
234} 234}
235 235
236void CalendarView::init() 236void CalendarView::init()
237{ 237{
238 238 mNextAlarmDateTime = QDateTime::currentDateTime();
239 setFocusPolicy ( WheelFocus ); 239 setFocusPolicy ( WheelFocus );
240 mViewerCallerIsSearchDialog = false; 240 mViewerCallerIsSearchDialog = false;
241 mBlockShowDates = false; 241 mBlockShowDates = false;
242 beamDialog = new KOBeamPrefs(); 242 beamDialog = new KOBeamPrefs();
243 mDatePickerMode = 0; 243 mDatePickerMode = 0;
244 mCurrentSyncDevice = ""; 244 mCurrentSyncDevice = "";
245 writeLocale(); 245 writeLocale();
246 mViewManager = new KOViewManager( this ); 246 mViewManager = new KOViewManager( this );
247 mDialogManager = new KODialogManager( this ); 247 mDialogManager = new KODialogManager( this );
248 mEventViewerDialog = 0; 248 mEventViewerDialog = 0;
249 mModified = false; 249 mModified = false;
250 mReadOnly = false; 250 mReadOnly = false;
@@ -633,24 +633,25 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
633{ 633{
634 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 634 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
635 635
636 mSuspendAlarmNotification = noti; 636 mSuspendAlarmNotification = noti;
637 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 637 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
638 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 638 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
639 mSuspendTimer->start( ms , true ); 639 mSuspendTimer->start( ms , true );
640 640
641} 641}
642 642
643void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 643void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
644{ 644{
645 mNextAlarmDateTime = qdt;
645 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 646 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
646 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 647 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
647#ifndef DESKTOP_VERSION 648#ifndef DESKTOP_VERSION
648 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 649 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
649#endif 650#endif
650 return; 651 return;
651 } 652 }
652 int maxSec; 653 int maxSec;
653 //maxSec = 5; //testing only 654 //maxSec = 5; //testing only
654 maxSec = 86400+3600; // one day+1hour 655 maxSec = 86400+3600; // one day+1hour
655 mAlarmNotification = noti; 656 mAlarmNotification = noti;
656 int sec = QDateTime::currentDateTime().secsTo( qdt ); 657 int sec = QDateTime::currentDateTime().secsTo( qdt );
@@ -4055,12 +4056,27 @@ void CalendarView::resetFocus()
4055 } else 4056 } else
4056 mViewerCallerIsSearchDialog = false; 4057 mViewerCallerIsSearchDialog = false;
4057 } 4058 }
4058 if ( !mViewerCallerIsSearchDialog ) { 4059 if ( !mViewerCallerIsSearchDialog ) {
4059 //mViewManager->currentView()->setFocus(); 4060 //mViewManager->currentView()->setFocus();
4060 //qDebug("sssssssssssssssset focus "); 4061 //qDebug("sssssssssssssssset focus ");
4061 topLevelWidget()->raise(); 4062 topLevelWidget()->raise();
4062 setActiveWindow(); 4063 setActiveWindow();
4063 //setFocus(); 4064 //setFocus();
4064 } 4065 }
4065 mViewerCallerIsSearchDialog = false; 4066 mViewerCallerIsSearchDialog = false;
4066} 4067}
4068
4069void CalendarView::showNextAlarms()
4070{
4071 QString message;
4072 if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4073 QString sum = mCalendar->nextSummary();
4074 QDateTime nextA = mNextAlarmDateTime;
4075 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4076 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)) ;
4077 } else {
4078 message = i18n("There is no next alarm.");
4079
4080 }
4081 KMessageBox::information( this, message);
4082}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 16e671f..9782ffe 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -167,24 +167,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
167 167
168 /** Emitted, when the number of outgoing messages has changed. */ 168 /** Emitted, when the number of outgoing messages has changed. */
169 void numOutgoingChanged(int); 169 void numOutgoingChanged(int);
170 170
171 /** Send status message, which can e.g. be displayed in the status bar. */ 171 /** Send status message, which can e.g. be displayed in the status bar. */
172 void statusMessage(const QString &); 172 void statusMessage(const QString &);
173 173
174 void calendarViewExpanded( bool ); 174 void calendarViewExpanded( bool );
175 void updateSearchDialog(); 175 void updateSearchDialog();
176 176
177 177
178 public slots: 178 public slots:
179 void showNextAlarms();
179 void showOpenError(); 180 void showOpenError();
180 void watchSavedFile(); 181 void watchSavedFile();
181 void recheckTimerAlarm(); 182 void recheckTimerAlarm();
182 void checkNextTimerAlarm(); 183 void checkNextTimerAlarm();
183 void addAlarm(const QDateTime &qdt, const QString &noti ); 184 void addAlarm(const QDateTime &qdt, const QString &noti );
184 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 185 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
185 void removeAlarm(const QDateTime &qdt, const QString &noti ); 186 void removeAlarm(const QDateTime &qdt, const QString &noti );
186 187
187 /** options dialog made a changed to the configuration. we catch this 188 /** options dialog made a changed to the configuration. we catch this
188 * and notify all widgets which need to update their configuration. */ 189 * and notify all widgets which need to update their configuration. */
189 void updateConfig(); 190 void updateConfig();
190 191
@@ -490,24 +491,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
490 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 491 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
491 protected: 492 protected:
492 void schedule(Scheduler::Method, Incidence *incidence = 0); 493 void schedule(Scheduler::Method, Incidence *incidence = 0);
493 494
494 // returns KMsgBox::OKCandel() 495 // returns KMsgBox::OKCandel()
495 int msgItemDelete(const QString name); 496 int msgItemDelete(const QString name);
496 void showEventEditor(); 497 void showEventEditor();
497 void showTodoEditor(); 498 void showTodoEditor();
498 void writeLocale(); 499 void writeLocale();
499 Todo *selectedTodo(); 500 Todo *selectedTodo();
500 501
501 private: 502 private:
503 QDateTime mNextAlarmDateTime;
502 bool mViewerCallerIsSearchDialog; 504 bool mViewerCallerIsSearchDialog;
503 bool mBlockShowDates; 505 bool mBlockShowDates;
504 KSyncManager* mSyncManager; 506 KSyncManager* mSyncManager;
505 AlarmDialog * mAlarmDialog; 507 AlarmDialog * mAlarmDialog;
506 QString mAlarmNotification; 508 QString mAlarmNotification;
507 QString mSuspendAlarmNotification; 509 QString mSuspendAlarmNotification;
508 QTimer* mSuspendTimer; 510 QTimer* mSuspendTimer;
509 QTimer* mAlarmTimer; 511 QTimer* mAlarmTimer;
510 QTimer* mRecheckAlarmTimer; 512 QTimer* mRecheckAlarmTimer;
511 void computeAlarm( QString ); 513 void computeAlarm( QString );
512 void startAlarm( QString, QString ); 514 void startAlarm( QString, QString );
513 void setSyncEventsReadOnly(); 515 void setSyncEventsReadOnly();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 95b836c..7a4275b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -581,25 +581,25 @@ void MainWindow::initActions()
581 if ( p-> mShowIconWeekNum ) 581 if ( p-> mShowIconWeekNum )
582 mWeekAction->addTo( iconToolBar ); 582 mWeekAction->addTo( iconToolBar );
583 mWeekFont = font(); 583 mWeekFont = font();
584 584
585 int fontPoint = mWeekFont.pointSize(); 585 int fontPoint = mWeekFont.pointSize();
586 QFontMetrics f( mWeekFont ); 586 QFontMetrics f( mWeekFont );
587 int fontWid = f.width( "30" ); 587 int fontWid = f.width( "30" );
588 while ( fontWid > pixWid ) { 588 while ( fontWid > pixWid ) {
589 --fontPoint; 589 --fontPoint;
590 mWeekFont.setPointSize( fontPoint ); 590 mWeekFont.setPointSize( fontPoint );
591 QFontMetrics f( mWeekFont ); 591 QFontMetrics f( mWeekFont );
592 fontWid = f.width( "30" ); 592 fontWid = f.width( "30" );
593 qDebug("dec-- "); 593 //qDebug("dec-- ");
594 } 594 }
595 595
596 connect( mWeekAction, SIGNAL( activated() ), 596 connect( mWeekAction, SIGNAL( activated() ),
597 this, SLOT( weekAction() ) ); 597 this, SLOT( weekAction() ) );
598 598
599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
600 600
601 //#endif 601 //#endif
602 // ****************** 602 // ******************
603 QAction *action; 603 QAction *action;
604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
605 configureToolBarMenu->setCheckable( true ); 605 configureToolBarMenu->setCheckable( true );
@@ -1739,25 +1739,28 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1740 mView->editFilters(); 1740 mView->editFilters();
1741 else 1741 else
1742 mView->toggleFilter(); 1742 mView->toggleFilter();
1743 break; 1743 break;
1744 case Qt::Key_X: 1744 case Qt::Key_X:
1745 mView->toggleDateNavigatorWidget(); 1745 mView->toggleDateNavigatorWidget();
1746 break; 1746 break;
1747 case Qt::Key_Space: 1747 case Qt::Key_Space:
1748 mView->toggleExpand(); 1748 mView->toggleExpand();
1749 break; 1749 break;
1750 case Qt::Key_A: 1750 case Qt::Key_A:
1751 mView->toggleAllDaySize(); 1751 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1752 mView->showNextAlarms();
1753 else
1754 mView->toggleAllDaySize();
1752 break; 1755 break;
1753 case Qt::Key_T: 1756 case Qt::Key_T:
1754 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1757 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1755 mView->newTodo(); 1758 mView->newTodo();
1756 else { 1759 else {
1757 mView->goToday(); 1760 mView->goToday();
1758 showSelectedDates = true; 1761 showSelectedDates = true;
1759 } 1762 }
1760 break; 1763 break;
1761 case Qt::Key_J: 1764 case Qt::Key_J:
1762 mView->viewManager()->showJournalView(); 1765 mView->viewManager()->showJournalView();
1763 break; 1766 break;
@@ -2124,12 +2127,24 @@ void MainWindow::weekAction()
2124 y = 0; 2127 y = 0;
2125 } 2128 }
2126 } 2129 }
2127 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2130 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2128 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2131 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2129 { 2132 {
2130 month = picker->getResult(); 2133 month = picker->getResult();
2131 emit selectWeek ( month ); 2134 emit selectWeek ( month );
2132 //qDebug("weekSelected %d ", month); 2135 //qDebug("weekSelected %d ", month);
2133 } 2136 }
2134 delete popup; 2137 delete popup;
2135} 2138}
2139
2140void MainWindow::hideEvent ( QHideEvent * )
2141{
2142 QString message;
2143 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2144 if ( nextA.isValid() ) {
2145 QString sum = mCalendar->nextSummary();
2146
2147 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));
2148 setCaption( message );
2149 }
2150}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 7604529..b3041dc 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -95,24 +95,25 @@ class MainWindow : public QMainWindow
95 void selectFilter( int ); 95 void selectFilter( int );
96 void exportToPhone( int ); 96 void exportToPhone( int );
97 void toggleBeamReceive(); 97 void toggleBeamReceive();
98 void disableBR(bool); 98 void disableBR(bool);
99 signals: 99 signals:
100 void selectWeek ( int ); 100 void selectWeek ( int );
101 private slots: 101 private slots:
102 void showConfigureAgenda(); 102 void showConfigureAgenda();
103 void getFile( bool ); 103 void getFile( bool );
104 void syncFileRequest(); 104 void syncFileRequest();
105 105
106 protected: 106 protected:
107 void hideEvent ( QHideEvent * );
107 QString sentSyncFile(); 108 QString sentSyncFile();
108 void displayText( QString, QString); 109 void displayText( QString, QString);
109 void enableIncidenceActions( bool ); 110 void enableIncidenceActions( bool );
110 111
111 private: 112 private:
112 bool mBRdisabled; 113 bool mBRdisabled;
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 QCopChannel* infrared; 115 QCopChannel* infrared;
115#endif 116#endif
116 QAction* brAction; 117 QAction* brAction;
117 KSyncManager* mSyncManager; 118 KSyncManager* mSyncManager;
118 bool mClosed; 119 bool mClosed;