summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-27 09:46:04 (UTC)
committer zautrix <zautrix>2005-03-27 09:46:04 (UTC)
commitb170a7414ff72016285ea207caa7ccf786530e77 (patch) (side-by-side diff)
treecb635d155fed20ecb33f877659a00d88bedb309e /korganizer
parentee6f7d5329658c567882e8e496c65eef8874496e (diff)
downloadkdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.zip
kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.tar.gz
kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.tar.bz2
many fixes
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,
: CalendarViewBase( parent, name ),
mCalendar( calendar ),
mResourceManager( 0 )
{
mEventEditor = 0;
mTodoEditor = 0;
init();
}
void CalendarView::init()
{
-
+ mNextAlarmDateTime = QDateTime::currentDateTime();
setFocusPolicy ( WheelFocus );
mViewerCallerIsSearchDialog = false;
mBlockShowDates = false;
beamDialog = new KOBeamPrefs();
mDatePickerMode = 0;
mCurrentSyncDevice = "";
writeLocale();
mViewManager = new KOViewManager( this );
mDialogManager = new KODialogManager( this );
mEventViewerDialog = 0;
mModified = false;
mReadOnly = false;
@@ -633,24 +633,25 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
{
//qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
mSuspendAlarmNotification = noti;
int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
//qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
mSuspendTimer->start( ms , true );
}
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
AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
#endif
return;
}
int maxSec;
//maxSec = 5; //testing only
maxSec = 86400+3600; // one day+1hour
mAlarmNotification = noti;
int sec = QDateTime::currentDateTime().secsTo( qdt );
@@ -4055,12 +4056,27 @@ void CalendarView::resetFocus()
} else
mViewerCallerIsSearchDialog = false;
}
if ( !mViewerCallerIsSearchDialog ) {
//mViewManager->currentView()->setFocus();
//qDebug("sssssssssssssssset focus ");
topLevelWidget()->raise();
setActiveWindow();
//setFocus();
}
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
@@ -167,24 +167,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
/** Emitted, when the number of outgoing messages has changed. */
void numOutgoingChanged(int);
/** Send status message, which can e.g. be displayed in the status bar. */
void statusMessage(const QString &);
void calendarViewExpanded( bool );
void updateSearchDialog();
public slots:
+ void showNextAlarms();
void showOpenError();
void watchSavedFile();
void recheckTimerAlarm();
void checkNextTimerAlarm();
void addAlarm(const QDateTime &qdt, const QString &noti );
void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
void removeAlarm(const QDateTime &qdt, const QString &noti );
/** options dialog made a changed to the configuration. we catch this
* and notify all widgets which need to update their configuration. */
void updateConfig();
@@ -490,24 +491,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
protected:
void schedule(Scheduler::Method, Incidence *incidence = 0);
// returns KMsgBox::OKCandel()
int msgItemDelete(const QString name);
void showEventEditor();
void showTodoEditor();
void writeLocale();
Todo *selectedTodo();
private:
+ QDateTime mNextAlarmDateTime;
bool mViewerCallerIsSearchDialog;
bool mBlockShowDates;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
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()
if ( p-> mShowIconWeekNum )
mWeekAction->addTo( iconToolBar );
mWeekFont = font();
int fontPoint = mWeekFont.pointSize();
QFontMetrics f( mWeekFont );
int fontWid = f.width( "30" );
while ( fontWid > pixWid ) {
--fontPoint;
mWeekFont.setPointSize( fontPoint );
QFontMetrics f( mWeekFont );
fontWid = f.width( "30" );
- qDebug("dec-- ");
+ //qDebug("dec-- ");
}
connect( mWeekAction, SIGNAL( activated() ),
this, SLOT( weekAction() ) );
connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
//#endif
// ******************
QAction *action;
// QPopupMenu *configureMenu= new QPopupMenu( menuBar );
configureToolBarMenu->setCheckable( true );
@@ -1739,25 +1739,28 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
mView->editFilters();
else
mView->toggleFilter();
break;
case Qt::Key_X:
mView->toggleDateNavigatorWidget();
break;
case Qt::Key_Space:
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 )
mView->newTodo();
else {
mView->goToday();
showSelectedDates = true;
}
break;
case Qt::Key_J:
mView->viewManager()->showJournalView();
break;
@@ -2124,12 +2127,24 @@ void MainWindow::weekAction()
y = 0;
}
}
//qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
{
month = picker->getResult();
emit selectWeek ( month );
//qDebug("weekSelected %d ", month);
}
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
@@ -95,24 +95,25 @@ class MainWindow : public QMainWindow
void selectFilter( int );
void exportToPhone( int );
void toggleBeamReceive();
void disableBR(bool);
signals:
void selectWeek ( int );
private slots:
void showConfigureAgenda();
void getFile( bool );
void syncFileRequest();
protected:
+ void hideEvent ( QHideEvent * );
QString sentSyncFile();
void displayText( QString, QString);
void enableIncidenceActions( bool );
private:
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
QAction* brAction;
KSyncManager* mSyncManager;
bool mClosed;