-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 | |||
@@ -174,129 +174,129 @@ class KOBeamPrefs : public QDialog | |||
174 | private: | 174 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 175 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 176 | }; |
177 | class KOCatPrefs : public QDialog | 177 | class KOCatPrefs : public QDialog |
178 | { | 178 | { |
179 | public: | 179 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 181 | QDialog( parent, name, true ) |
182 | { | 182 | { |
183 | setCaption( i18n("Manage new Categories") ); | 183 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 184 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 185 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 186 | lay->setMargin( 3 ); |
187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 187 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
188 | lay->addWidget( lab ); | 188 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 190 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 191 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 194 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 196 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 198 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 201 | resize( 200, 200 ); |
202 | } | 202 | } |
203 | 203 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 204 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 205 | private: |
206 | QRadioButton* addCatBut; | 206 | QRadioButton* addCatBut; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 211 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 212 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 213 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 214 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 215 | mResourceManager( calendar->resourceManager() ) |
216 | { | 216 | { |
217 | 217 | ||
218 | mEventEditor = 0; | 218 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 219 | mTodoEditor = 0; |
220 | 220 | ||
221 | init(); | 221 | init(); |
222 | } | 222 | } |
223 | 223 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 224 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 225 | QWidget *parent, const char *name ) |
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 | ||
236 | void CalendarView::init() | 236 | void 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; |
251 | mSelectedIncidence = 0; | 251 | mSelectedIncidence = 0; |
252 | mCalPrinter = 0; | 252 | mCalPrinter = 0; |
253 | mFilters.setAutoDelete(true); | 253 | mFilters.setAutoDelete(true); |
254 | 254 | ||
255 | mCalendar->registerObserver( this ); | 255 | mCalendar->registerObserver( this ); |
256 | // TODO: Make sure that view is updated, when calendar is changed. | 256 | // TODO: Make sure that view is updated, when calendar is changed. |
257 | 257 | ||
258 | mStorage = new FileStorage( mCalendar ); | 258 | mStorage = new FileStorage( mCalendar ); |
259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 259 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
260 | 260 | ||
261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 261 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
262 | #ifndef KORG_NOSPLITTER | 262 | #ifndef KORG_NOSPLITTER |
263 | // create the main layout frames. | 263 | // create the main layout frames. |
264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 264 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
265 | topLayout->addWidget(mPanner); | 265 | topLayout->addWidget(mPanner); |
266 | 266 | ||
267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 267 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
268 | "CalendarView::LeftFrame"); | 268 | "CalendarView::LeftFrame"); |
269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 269 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
270 | 270 | ||
271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 271 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
272 | "CalendarView::DateNavigator" ); | 272 | "CalendarView::DateNavigator" ); |
273 | 273 | ||
274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 274 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 275 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
276 | mTodoList->setNavigator( mNavigator ); | 276 | mTodoList->setNavigator( mNavigator ); |
277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 277 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
278 | 278 | ||
279 | #ifdef KORG_NORESOURCEVIEW | 279 | #ifdef KORG_NORESOURCEVIEW |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | #else | 281 | #else |
282 | if ( mResourceManager ) { | 282 | if ( mResourceManager ) { |
283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 283 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
284 | mResourceView->updateView(); | 284 | mResourceView->updateView(); |
285 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 285 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
286 | SLOT( updateView() ) ); | 286 | SLOT( updateView() ) ); |
287 | } else { | 287 | } else { |
288 | mResourceView = 0; | 288 | mResourceView = 0; |
289 | } | 289 | } |
290 | #endif | 290 | #endif |
291 | QWidget *rightBox = new QWidget( mPanner ); | 291 | QWidget *rightBox = new QWidget( mPanner ); |
292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 292 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
293 | 293 | ||
294 | mRightFrame = new QWidgetStack( rightBox ); | 294 | mRightFrame = new QWidgetStack( rightBox ); |
295 | rightLayout->addWidget( mRightFrame, 1 ); | 295 | rightLayout->addWidget( mRightFrame, 1 ); |
296 | 296 | ||
297 | mLeftFrame = mLeftSplitter; | 297 | mLeftFrame = mLeftSplitter; |
298 | #else | 298 | #else |
299 | //QWidget *mainBox = new QWidget( this ); | 299 | //QWidget *mainBox = new QWidget( this ); |
300 | //QWidget *leftFrame = new QWidget( mainBox ); | 300 | //QWidget *leftFrame = new QWidget( mainBox ); |
301 | //QBoxLayout * mainBoxLayout; | 301 | //QBoxLayout * mainBoxLayout; |
302 | if ( KOPrefs::instance()->mVerticalScreen ) { | 302 | if ( KOPrefs::instance()->mVerticalScreen ) { |
@@ -581,128 +581,129 @@ void CalendarView::computeAlarm( QString msg ) | |||
581 | if ( !QFile::exists( tempfilename ) ) | 581 | if ( !QFile::exists( tempfilename ) ) |
582 | error = true; | 582 | error = true; |
583 | } | 583 | } |
584 | if ( error ) { | 584 | if ( error ) { |
585 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 585 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
586 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 586 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
587 | } else { | 587 | } else { |
588 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 588 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
589 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 589 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
590 | #ifndef _WIN32_ | 590 | #ifndef _WIN32_ |
591 | if ( vfork () == 0 ) { | 591 | if ( vfork () == 0 ) { |
592 | execl ( tempfilename.latin1(), 0 ); | 592 | execl ( tempfilename.latin1(), 0 ); |
593 | return; | 593 | return; |
594 | } | 594 | } |
595 | #else | 595 | #else |
596 | QProcess* p = new QProcess(); | 596 | QProcess* p = new QProcess(); |
597 | p->addArgument( tempfilename.latin1() ); | 597 | p->addArgument( tempfilename.latin1() ); |
598 | p->start(); | 598 | p->start(); |
599 | return; | 599 | return; |
600 | #endif | 600 | #endif |
601 | 601 | ||
602 | return; | 602 | return; |
603 | } | 603 | } |
604 | 604 | ||
605 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 605 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
606 | } | 606 | } |
607 | if ( mess.left( 11 ) == "audio_alarm") { | 607 | if ( mess.left( 11 ) == "audio_alarm") { |
608 | bool error = false; | 608 | bool error = false; |
609 | int len = mess.mid( 11 ).find("+++"); | 609 | int len = mess.mid( 11 ).find("+++"); |
610 | if ( len < 2 ) | 610 | if ( len < 2 ) |
611 | error = true; | 611 | error = true; |
612 | else { | 612 | else { |
613 | tempfilename = mess.mid( 11, len ); | 613 | tempfilename = mess.mid( 11, len ); |
614 | if ( !QFile::exists( tempfilename ) ) | 614 | if ( !QFile::exists( tempfilename ) ) |
615 | error = true; | 615 | error = true; |
616 | } | 616 | } |
617 | if ( ! error ) { | 617 | if ( ! error ) { |
618 | filename = tempfilename; | 618 | filename = tempfilename; |
619 | } | 619 | } |
620 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 620 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
621 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 621 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
622 | } | 622 | } |
623 | if ( mess.left( 9 ) == "cal_alarm") { | 623 | if ( mess.left( 9 ) == "cal_alarm") { |
624 | mAlarmMessage = mess.mid( 9 ) ; | 624 | mAlarmMessage = mess.mid( 9 ) ; |
625 | } | 625 | } |
626 | 626 | ||
627 | startAlarm( mAlarmMessage, filename ); | 627 | startAlarm( mAlarmMessage, filename ); |
628 | 628 | ||
629 | 629 | ||
630 | } | 630 | } |
631 | 631 | ||
632 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 632 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
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 | ||
643 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 643 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
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 ); |
657 | if ( sec > maxSec ) { | 658 | if ( sec > maxSec ) { |
658 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 659 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
659 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 660 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
660 | return; | 661 | return; |
661 | } else { | 662 | } else { |
662 | mRecheckAlarmTimer->stop(); | 663 | mRecheckAlarmTimer->stop(); |
663 | } | 664 | } |
664 | //qDebug("Alarm timer started with secs: %d ", sec); | 665 | //qDebug("Alarm timer started with secs: %d ", sec); |
665 | mAlarmTimer->start( sec *1000 , true ); | 666 | mAlarmTimer->start( sec *1000 , true ); |
666 | 667 | ||
667 | } | 668 | } |
668 | // called by mRecheckAlarmTimer to get next alarm | 669 | // called by mRecheckAlarmTimer to get next alarm |
669 | // we need this, because a QTimer has only a max range of 25 days | 670 | // we need this, because a QTimer has only a max range of 25 days |
670 | void CalendarView::recheckTimerAlarm() | 671 | void CalendarView::recheckTimerAlarm() |
671 | { | 672 | { |
672 | mAlarmTimer->stop(); | 673 | mAlarmTimer->stop(); |
673 | mRecheckAlarmTimer->stop(); | 674 | mRecheckAlarmTimer->stop(); |
674 | mCalendar->checkAlarmForIncidence( 0, true ); | 675 | mCalendar->checkAlarmForIncidence( 0, true ); |
675 | } | 676 | } |
676 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 677 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
677 | { | 678 | { |
678 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 679 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
679 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 680 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
680 | #ifndef DESKTOP_VERSION | 681 | #ifndef DESKTOP_VERSION |
681 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 682 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
682 | #endif | 683 | #endif |
683 | return; | 684 | return; |
684 | } | 685 | } |
685 | mAlarmTimer->stop(); | 686 | mAlarmTimer->stop(); |
686 | } | 687 | } |
687 | void CalendarView::selectWeekNum ( int num ) | 688 | void CalendarView::selectWeekNum ( int num ) |
688 | { | 689 | { |
689 | dateNavigator()->blockSignals( true ); | 690 | dateNavigator()->blockSignals( true ); |
690 | dateNavigator()->selectWeek( num ); | 691 | dateNavigator()->selectWeek( num ); |
691 | dateNavigator()->blockSignals( false ); | 692 | dateNavigator()->blockSignals( false ); |
692 | mViewManager->showWeekView(); | 693 | mViewManager->showWeekView(); |
693 | } | 694 | } |
694 | KOViewManager *CalendarView::viewManager() | 695 | KOViewManager *CalendarView::viewManager() |
695 | { | 696 | { |
696 | return mViewManager; | 697 | return mViewManager; |
697 | } | 698 | } |
698 | 699 | ||
699 | KODialogManager *CalendarView::dialogManager() | 700 | KODialogManager *CalendarView::dialogManager() |
700 | { | 701 | { |
701 | return mDialogManager; | 702 | return mDialogManager; |
702 | } | 703 | } |
703 | 704 | ||
704 | QDate CalendarView::startDate() | 705 | QDate CalendarView::startDate() |
705 | { | 706 | { |
706 | DateList dates = mNavigator->selectedDates(); | 707 | DateList dates = mNavigator->selectedDates(); |
707 | 708 | ||
708 | return dates.first(); | 709 | return dates.first(); |
@@ -4003,64 +4004,79 @@ bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | |||
4003 | { | 4004 | { |
4004 | //mSyncManager = manager; | 4005 | //mSyncManager = manager; |
4005 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4006 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4006 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4007 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4007 | if ( resource == "sharp" ) | 4008 | if ( resource == "sharp" ) |
4008 | syncExternal( 0 ); | 4009 | syncExternal( 0 ); |
4009 | if ( resource == "phone" ) | 4010 | if ( resource == "phone" ) |
4010 | syncExternal( 1 ); | 4011 | syncExternal( 1 ); |
4011 | // pending setmodified | 4012 | // pending setmodified |
4012 | return true; | 4013 | return true; |
4013 | } | 4014 | } |
4014 | void CalendarView::setSyncManager(KSyncManager* manager) | 4015 | void CalendarView::setSyncManager(KSyncManager* manager) |
4015 | { | 4016 | { |
4016 | mSyncManager = manager; | 4017 | mSyncManager = manager; |
4017 | } | 4018 | } |
4018 | 4019 | ||
4019 | void CalendarView::removeSyncInfo( QString syncProfile) | 4020 | void CalendarView::removeSyncInfo( QString syncProfile) |
4020 | { | 4021 | { |
4021 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4022 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4022 | mCalendar->removeSyncInfo( syncProfile ); | 4023 | mCalendar->removeSyncInfo( syncProfile ); |
4023 | 4024 | ||
4024 | } | 4025 | } |
4025 | 4026 | ||
4026 | void CalendarView::undo_delete() | 4027 | void CalendarView::undo_delete() |
4027 | { | 4028 | { |
4028 | //qDebug("undo_delete() "); | 4029 | //qDebug("undo_delete() "); |
4029 | Incidence* undo = mCalendar->undoIncidence(); | 4030 | Incidence* undo = mCalendar->undoIncidence(); |
4030 | if ( !undo ) { | 4031 | if ( !undo ) { |
4031 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4032 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4032 | i18n("KO/Pi")); | 4033 | i18n("KO/Pi")); |
4033 | return; | 4034 | return; |
4034 | } | 4035 | } |
4035 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 4036 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
4036 | i18n("\nAre you sure you want\nto restore this?"), | 4037 | i18n("\nAre you sure you want\nto restore this?"), |
4037 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4038 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4038 | mCalendar->undoDeleteIncidence(); | 4039 | mCalendar->undoDeleteIncidence(); |
4039 | updateView(); | 4040 | updateView(); |
4040 | } | 4041 | } |
4041 | } | 4042 | } |
4042 | 4043 | ||
4043 | void CalendarView::slotViewerClosed() | 4044 | void CalendarView::slotViewerClosed() |
4044 | { | 4045 | { |
4045 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4046 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4046 | } | 4047 | } |
4047 | 4048 | ||
4048 | void CalendarView::resetFocus() | 4049 | void CalendarView::resetFocus() |
4049 | { | 4050 | { |
4050 | if ( mViewerCallerIsSearchDialog ) { | 4051 | if ( mViewerCallerIsSearchDialog ) { |
4051 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 4052 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
4052 | mDialogManager->getSearchDialog()->raise(); | 4053 | mDialogManager->getSearchDialog()->raise(); |
4053 | mDialogManager->getSearchDialog()->setActiveWindow(); | 4054 | mDialogManager->getSearchDialog()->setActiveWindow(); |
4054 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 4055 | mDialogManager->getSearchDialog()->listview()->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 | |||
4069 | void 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 | |||
@@ -115,128 +115,129 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
115 | void showView(KOrg::BaseView *); | 115 | void showView(KOrg::BaseView *); |
116 | KOEventViewerDialog* getEventViewerDialog(); | 116 | KOEventViewerDialog* getEventViewerDialog(); |
117 | Incidence *currentSelection(); | 117 | Incidence *currentSelection(); |
118 | 118 | ||
119 | signals: | 119 | signals: |
120 | void save (); | 120 | void save (); |
121 | void saveStopTimer (); | 121 | void saveStopTimer (); |
122 | void tempDisableBR(bool); | 122 | void tempDisableBR(bool); |
123 | /** This todo has been modified */ | 123 | /** This todo has been modified */ |
124 | void todoModified(Todo *, int); | 124 | void todoModified(Todo *, int); |
125 | 125 | ||
126 | /** when change is made to options dialog, the topwidget will catch this | 126 | /** when change is made to options dialog, the topwidget will catch this |
127 | * and emit this signal which notifies all widgets which have registered | 127 | * and emit this signal which notifies all widgets which have registered |
128 | * for notification to update their settings. */ | 128 | * for notification to update their settings. */ |
129 | void configChanged(); | 129 | void configChanged(); |
130 | /** emitted when the topwidget is closing down, so that any attached | 130 | /** emitted when the topwidget is closing down, so that any attached |
131 | child windows can also close. */ | 131 | child windows can also close. */ |
132 | void closingDown(); | 132 | void closingDown(); |
133 | /** emitted right before we die */ | 133 | /** emitted right before we die */ |
134 | void closed(QWidget *); | 134 | void closed(QWidget *); |
135 | 135 | ||
136 | /** Emitted when state of modified flag changes */ | 136 | /** Emitted when state of modified flag changes */ |
137 | void modifiedChanged(bool); | 137 | void modifiedChanged(bool); |
138 | void signalmodified(); | 138 | void signalmodified(); |
139 | 139 | ||
140 | /** Emitted when state of read-only flag changes */ | 140 | /** Emitted when state of read-only flag changes */ |
141 | void readOnlyChanged(bool); | 141 | void readOnlyChanged(bool); |
142 | 142 | ||
143 | /** Emitted when the unit of navigation changes */ | 143 | /** Emitted when the unit of navigation changes */ |
144 | void changeNavStringPrev(const QString &); | 144 | void changeNavStringPrev(const QString &); |
145 | void changeNavStringNext(const QString &); | 145 | void changeNavStringNext(const QString &); |
146 | 146 | ||
147 | /** Emitted when state of events selection has changed and user is organizer*/ | 147 | /** Emitted when state of events selection has changed and user is organizer*/ |
148 | void organizerEventsSelected(bool); | 148 | void organizerEventsSelected(bool); |
149 | /** Emitted when state of events selection has changed and user is attendee*/ | 149 | /** Emitted when state of events selection has changed and user is attendee*/ |
150 | void groupEventsSelected(bool); | 150 | void groupEventsSelected(bool); |
151 | /** | 151 | /** |
152 | Emitted when an incidence gets selected. If the selection is cleared the | 152 | Emitted when an incidence gets selected. If the selection is cleared the |
153 | signal is emitted with 0 as argument. | 153 | signal is emitted with 0 as argument. |
154 | */ | 154 | */ |
155 | void incidenceSelected( Incidence * ); | 155 | void incidenceSelected( Incidence * ); |
156 | /** Emitted, when a todoitem is selected or deselected. */ | 156 | /** Emitted, when a todoitem is selected or deselected. */ |
157 | void todoSelected( bool ); | 157 | void todoSelected( bool ); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | Emitted, when clipboard content changes. Parameter indicates if paste | 160 | Emitted, when clipboard content changes. Parameter indicates if paste |
161 | is possible or not. | 161 | is possible or not. |
162 | */ | 162 | */ |
163 | void pasteEnabled(bool); | 163 | void pasteEnabled(bool); |
164 | 164 | ||
165 | /** Emitted, when the number of incoming messages has changed. */ | 165 | /** Emitted, when the number of incoming messages has changed. */ |
166 | void numIncomingChanged(int); | 166 | void numIncomingChanged(int); |
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 ¬i ); | 184 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
184 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 185 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
185 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 186 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
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 | ||
191 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 192 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
192 | const QStringList& anniversaryList, const QStringList& realNameList, | 193 | const QStringList& anniversaryList, const QStringList& realNameList, |
193 | const QStringList& emailList, const QStringList& assembledNameList, | 194 | const QStringList& emailList, const QStringList& assembledNameList, |
194 | const QStringList& uidList); | 195 | const QStringList& uidList); |
195 | 196 | ||
196 | /** | 197 | /** |
197 | Load calendar from file \a filename. If \a merge is true, load | 198 | Load calendar from file \a filename. If \a merge is true, load |
198 | calendar into existing one, if it is false, clear calendar, before | 199 | calendar into existing one, if it is false, clear calendar, before |
199 | loading. Return true, if calendar could be successfully loaded. | 200 | loading. Return true, if calendar could be successfully loaded. |
200 | */ | 201 | */ |
201 | bool openCalendar(QString filename, bool merge=false); | 202 | bool openCalendar(QString filename, bool merge=false); |
202 | bool syncCalendar(QString filename,int mode = 0 ); | 203 | bool syncCalendar(QString filename,int mode = 0 ); |
203 | 204 | ||
204 | /** | 205 | /** |
205 | Save calendar data to file. Return true if calendar could be | 206 | Save calendar data to file. Return true if calendar could be |
206 | successfully saved. | 207 | successfully saved. |
207 | */ | 208 | */ |
208 | bool saveCalendar(QString filename); | 209 | bool saveCalendar(QString filename); |
209 | 210 | ||
210 | /** | 211 | /** |
211 | Close calendar. Clear calendar data and reset views to display an empty | 212 | Close calendar. Clear calendar data and reset views to display an empty |
212 | calendar. | 213 | calendar. |
213 | */ | 214 | */ |
214 | void closeCalendar(); | 215 | void closeCalendar(); |
215 | 216 | ||
216 | /** Archive old events of calendar */ | 217 | /** Archive old events of calendar */ |
217 | void archiveCalendar(); | 218 | void archiveCalendar(); |
218 | 219 | ||
219 | void showIncidence(); | 220 | void showIncidence(); |
220 | void editIncidence(); | 221 | void editIncidence(); |
221 | void editIncidenceDescription(); | 222 | void editIncidenceDescription(); |
222 | void deleteIncidence(); | 223 | void deleteIncidence(); |
223 | void cloneIncidence(); | 224 | void cloneIncidence(); |
224 | void moveIncidence(); | 225 | void moveIncidence(); |
225 | void beamIncidence(); | 226 | void beamIncidence(); |
226 | void toggleCancelIncidence(); | 227 | void toggleCancelIncidence(); |
227 | 228 | ||
228 | /** create an editeventwin with supplied date/time, and if bool is true, | 229 | /** create an editeventwin with supplied date/time, and if bool is true, |
229 | * make the event take all day. */ | 230 | * make the event take all day. */ |
230 | void newEvent(QDateTime, QDateTime, bool allDay ); | 231 | void newEvent(QDateTime, QDateTime, bool allDay ); |
231 | void newEvent(QDateTime, QDateTime); | 232 | void newEvent(QDateTime, QDateTime); |
232 | void newEvent(QDateTime fh); | 233 | void newEvent(QDateTime fh); |
233 | void newEvent(QDate dt); | 234 | void newEvent(QDate dt); |
234 | /** create new event without having a date hint. Takes current date as | 235 | /** create new event without having a date hint. Takes current date as |
235 | default hint. */ | 236 | default hint. */ |
236 | void newEvent(); | 237 | void newEvent(); |
237 | void newFloatingEvent(); | 238 | void newFloatingEvent(); |
238 | 239 | ||
239 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 240 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
240 | void showIncidence(Incidence *); | 241 | void showIncidence(Incidence *); |
241 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 242 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
242 | void editIncidence(Incidence *); | 243 | void editIncidence(Incidence *); |
@@ -438,128 +439,129 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
438 | void slotCalendarChanged(); | 439 | void slotCalendarChanged(); |
439 | bool importBday(); | 440 | bool importBday(); |
440 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 441 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
441 | bool importQtopia( const QString &categoriesFile, | 442 | bool importQtopia( const QString &categoriesFile, |
442 | const QString &datebookFile, | 443 | const QString &datebookFile, |
443 | const QString &tasklistFile ); | 444 | const QString &tasklistFile ); |
444 | void syncExternal( int mode ); | 445 | void syncExternal( int mode ); |
445 | void slotSelectPickerDate( QDate ) ; | 446 | void slotSelectPickerDate( QDate ) ; |
446 | void showDatePicker() ; | 447 | void showDatePicker() ; |
447 | void showDatePickerPopup() ; | 448 | void showDatePickerPopup() ; |
448 | void moveIncidence(Incidence *) ; | 449 | void moveIncidence(Incidence *) ; |
449 | void beamIncidence(Incidence *) ; | 450 | void beamIncidence(Incidence *) ; |
450 | void beamCalendar() ; | 451 | void beamCalendar() ; |
451 | void beamFilteredCalendar() ; | 452 | void beamFilteredCalendar() ; |
452 | void beamIncidenceList(QPtrList<Incidence>) ; | 453 | void beamIncidenceList(QPtrList<Incidence>) ; |
453 | void manageCategories(); | 454 | void manageCategories(); |
454 | int addCategories(); | 455 | int addCategories(); |
455 | void removeCategories(); | 456 | void removeCategories(); |
456 | void setSyncDevice( QString ); | 457 | void setSyncDevice( QString ); |
457 | void setSyncName( QString ); | 458 | void setSyncName( QString ); |
458 | void showDay( QDate ); | 459 | void showDay( QDate ); |
459 | void undo_delete(); | 460 | void undo_delete(); |
460 | protected slots: | 461 | protected slots: |
461 | void resetFocus(); | 462 | void resetFocus(); |
462 | void slotViewerClosed(); | 463 | void slotViewerClosed(); |
463 | void timerAlarm(); | 464 | void timerAlarm(); |
464 | void suspendAlarm(); | 465 | void suspendAlarm(); |
465 | void beamDone( Ir *ir ); | 466 | void beamDone( Ir *ir ); |
466 | /** Select a view or adapt the current view to display the specified dates. */ | 467 | /** Select a view or adapt the current view to display the specified dates. */ |
467 | void showDates( const KCal::DateList & ); | 468 | void showDates( const KCal::DateList & ); |
468 | void selectWeekNum ( int ); | 469 | void selectWeekNum ( int ); |
469 | 470 | ||
470 | public: | 471 | public: |
471 | // show a standard warning | 472 | // show a standard warning |
472 | // returns KMsgBox::yesNoCancel() | 473 | // returns KMsgBox::yesNoCancel() |
473 | int msgCalModified(); | 474 | int msgCalModified(); |
474 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 475 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
475 | 476 | ||
476 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 477 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
477 | virtual void removeSyncInfo( QString syncProfile); | 478 | virtual void removeSyncInfo( QString syncProfile); |
478 | void setSyncManager(KSyncManager* manager); | 479 | void setSyncManager(KSyncManager* manager); |
479 | void setLoadedFileVersion(QDateTime); | 480 | void setLoadedFileVersion(QDateTime); |
480 | bool checkFileVersion(QString fn); | 481 | bool checkFileVersion(QString fn); |
481 | bool checkFileChanged(QString fn); | 482 | bool checkFileChanged(QString fn); |
482 | Event* getLastSyncEvent(); | 483 | Event* getLastSyncEvent(); |
483 | /** Adapt navigation units correpsonding to step size of navigation of the | 484 | /** Adapt navigation units correpsonding to step size of navigation of the |
484 | * current view. | 485 | * current view. |
485 | */ | 486 | */ |
486 | void adaptNavigationUnits(); | 487 | void adaptNavigationUnits(); |
487 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 488 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
488 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 489 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
489 | //Attendee* getYourAttendee(Event *event); | 490 | //Attendee* getYourAttendee(Event *event); |
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(); |
514 | 516 | ||
515 | QDateTime loadedFileVersion; | 517 | QDateTime loadedFileVersion; |
516 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 518 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
517 | void checkExternalId( Incidence * inc ); | 519 | void checkExternalId( Incidence * inc ); |
518 | int mGlobalSyncMode; | 520 | int mGlobalSyncMode; |
519 | QString mCurrentSyncDevice; | 521 | QString mCurrentSyncDevice; |
520 | QString mCurrentSyncName; | 522 | QString mCurrentSyncName; |
521 | KOBeamPrefs* beamDialog; | 523 | KOBeamPrefs* beamDialog; |
522 | void init(); | 524 | void init(); |
523 | int mDatePickerMode; | 525 | int mDatePickerMode; |
524 | bool mFlagEditDescription; | 526 | bool mFlagEditDescription; |
525 | QDateTime mLastCalendarSync; | 527 | QDateTime mLastCalendarSync; |
526 | void createPrinter(); | 528 | void createPrinter(); |
527 | 529 | ||
528 | void calendarModified( bool, Calendar * ); | 530 | void calendarModified( bool, Calendar * ); |
529 | 531 | ||
530 | CalPrinter *mCalPrinter; | 532 | CalPrinter *mCalPrinter; |
531 | 533 | ||
532 | QSplitter *mPanner; | 534 | QSplitter *mPanner; |
533 | QSplitter *mLeftSplitter; | 535 | QSplitter *mLeftSplitter; |
534 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 536 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
535 | QWidgetStack *mRightFrame; | 537 | QWidgetStack *mRightFrame; |
536 | 538 | ||
537 | KDatePicker* mDatePicker; | 539 | KDatePicker* mDatePicker; |
538 | QVBox* mDateFrame; | 540 | QVBox* mDateFrame; |
539 | 541 | ||
540 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 542 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
541 | 543 | ||
542 | KOFilterView *mFilterView; | 544 | KOFilterView *mFilterView; |
543 | 545 | ||
544 | ResourceView *mResourceView; | 546 | ResourceView *mResourceView; |
545 | 547 | ||
546 | // calendar object for this viewing instance | 548 | // calendar object for this viewing instance |
547 | Calendar *mCalendar; | 549 | Calendar *mCalendar; |
548 | 550 | ||
549 | CalendarResourceManager *mResourceManager; | 551 | CalendarResourceManager *mResourceManager; |
550 | 552 | ||
551 | FileStorage *mStorage; | 553 | FileStorage *mStorage; |
552 | 554 | ||
553 | DateNavigator *mNavigator; | 555 | DateNavigator *mNavigator; |
554 | 556 | ||
555 | KOViewManager *mViewManager; | 557 | KOViewManager *mViewManager; |
556 | KODialogManager *mDialogManager; | 558 | KODialogManager *mDialogManager; |
557 | 559 | ||
558 | // Calendar filters | 560 | // Calendar filters |
559 | QPtrList<CalFilter> mFilters; | 561 | QPtrList<CalFilter> mFilters; |
560 | 562 | ||
561 | // various housekeeping variables. | 563 | // various housekeeping variables. |
562 | bool mModified; // flag indicating if calendar is modified | 564 | bool mModified; // flag indicating if calendar is modified |
563 | bool mReadOnly; // flag indicating if calendar is read-only | 565 | bool mReadOnly; // flag indicating if calendar is read-only |
564 | QDate mSaveSingleDate; | 566 | QDate mSaveSingleDate; |
565 | 567 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 95b836c..7a4275b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -529,129 +529,129 @@ void MainWindow::initActions() | |||
529 | int pixWid = 22, pixHei = 22; | 529 | int pixWid = 22, pixHei = 22; |
530 | QString pathString = ""; | 530 | QString pathString = ""; |
531 | if ( !p->mToolBarMiniIcons ) { | 531 | if ( !p->mToolBarMiniIcons ) { |
532 | if ( QApplication::desktop()->width() < 480 ) { | 532 | if ( QApplication::desktop()->width() < 480 ) { |
533 | pathString += "icons16/"; | 533 | pathString += "icons16/"; |
534 | pixWid = 18; pixHei = 16; | 534 | pixWid = 18; pixHei = 16; |
535 | } | 535 | } |
536 | } else { | 536 | } else { |
537 | pathString += "iconsmini/"; | 537 | pathString += "iconsmini/"; |
538 | pixWid = 18; pixHei = 16; | 538 | pixWid = 18; pixHei = 16; |
539 | } | 539 | } |
540 | if ( KOPrefs::instance()->mShowFullMenu ) { | 540 | if ( KOPrefs::instance()->mShowFullMenu ) { |
541 | QMenuBar *menuBar1; | 541 | QMenuBar *menuBar1; |
542 | menuBar1 = menuBar(); | 542 | menuBar1 = menuBar(); |
543 | menuBar1->insertItem( i18n("File"), importMenu ); | 543 | menuBar1->insertItem( i18n("File"), importMenu ); |
544 | menuBar1->insertItem( i18n("View"), viewMenu ); | 544 | menuBar1->insertItem( i18n("View"), viewMenu ); |
545 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 545 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
546 | #ifdef DESKTOP_VERSION | 546 | #ifdef DESKTOP_VERSION |
547 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 547 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
548 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 548 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
549 | #else | 549 | #else |
550 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 550 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
551 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 551 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
552 | #endif | 552 | #endif |
553 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 553 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
554 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 554 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
555 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 555 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
556 | } else { | 556 | } else { |
557 | QPEMenuBar *menuBar1; | 557 | QPEMenuBar *menuBar1; |
558 | menuBar1 = new QPEMenuBar( iconToolBar ); | 558 | menuBar1 = new QPEMenuBar( iconToolBar ); |
559 | QPopupMenu *menuBar = new QPopupMenu( this ); | 559 | QPopupMenu *menuBar = new QPopupMenu( this ); |
560 | icon = loadPixmap( pathString + "z_menu" ); | 560 | icon = loadPixmap( pathString + "z_menu" ); |
561 | menuBar1->insertItem( icon.pixmap(), menuBar); | 561 | menuBar1->insertItem( icon.pixmap(), menuBar); |
562 | //menuBar1->insertItem( i18n("ME"), menuBar); | 562 | //menuBar1->insertItem( i18n("ME"), menuBar); |
563 | menuBar->insertItem( i18n("File"), importMenu ); | 563 | menuBar->insertItem( i18n("File"), importMenu ); |
564 | menuBar->insertItem( i18n("View"), viewMenu ); | 564 | menuBar->insertItem( i18n("View"), viewMenu ); |
565 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 565 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
566 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 566 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
567 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 567 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
568 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 568 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
569 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 569 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
570 | menuBar->insertItem( i18n("Help"), helpMenu ); | 570 | menuBar->insertItem( i18n("Help"), helpMenu ); |
571 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 571 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
572 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 572 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
573 | } | 573 | } |
574 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 574 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
575 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 575 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
576 | mWeekBgColor = iconToolBar->backgroundColor(); | 576 | mWeekBgColor = iconToolBar->backgroundColor(); |
577 | mWeekPixmap.resize( pixWid , pixHei ); | 577 | mWeekPixmap.resize( pixWid , pixHei ); |
578 | mWeekPixmap.fill( mWeekBgColor ); | 578 | mWeekPixmap.fill( mWeekBgColor ); |
579 | icon = mWeekPixmap; | 579 | icon = mWeekPixmap; |
580 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 580 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
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 ); |
606 | 606 | ||
607 | 607 | ||
608 | configureAgendaMenu->setCheckable( true ); | 608 | configureAgendaMenu->setCheckable( true ); |
609 | int iii ; | 609 | int iii ; |
610 | for ( iii = 1;iii<= 10 ;++iii ){ | 610 | for ( iii = 1;iii<= 10 ;++iii ){ |
611 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 611 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
612 | } | 612 | } |
613 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 613 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
614 | 614 | ||
615 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 615 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
616 | this, SLOT( showConfigureAgenda( ) ) ); | 616 | this, SLOT( showConfigureAgenda( ) ) ); |
617 | 617 | ||
618 | icon = loadPixmap( pathString + "configure" ); | 618 | icon = loadPixmap( pathString + "configure" ); |
619 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 619 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
620 | action->addTo( actionMenu ); | 620 | action->addTo( actionMenu ); |
621 | connect( action, SIGNAL( activated() ), | 621 | connect( action, SIGNAL( activated() ), |
622 | mView, SLOT( edit_options() ) ); | 622 | mView, SLOT( edit_options() ) ); |
623 | actionMenu->insertSeparator(); | 623 | actionMenu->insertSeparator(); |
624 | 624 | ||
625 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 625 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
626 | action->addTo( actionMenu ); | 626 | action->addTo( actionMenu ); |
627 | connect( action, SIGNAL( activated() ), | 627 | connect( action, SIGNAL( activated() ), |
628 | mView, SLOT( undo_delete() ) ); | 628 | mView, SLOT( undo_delete() ) ); |
629 | actionMenu->insertSeparator(); | 629 | actionMenu->insertSeparator(); |
630 | 630 | ||
631 | icon = loadPixmap( pathString + "newevent" ); | 631 | icon = loadPixmap( pathString + "newevent" ); |
632 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 632 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
633 | configureToolBarMenu->insertSeparator(); | 633 | configureToolBarMenu->insertSeparator(); |
634 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 634 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
635 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
636 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 636 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
637 | ne_action->addTo( actionMenu ); | 637 | ne_action->addTo( actionMenu ); |
638 | connect( ne_action, SIGNAL( activated() ), | 638 | connect( ne_action, SIGNAL( activated() ), |
639 | mView, SLOT( newEvent() ) ); | 639 | mView, SLOT( newEvent() ) ); |
640 | icon = loadPixmap( pathString + "newtodo" ); | 640 | icon = loadPixmap( pathString + "newtodo" ); |
641 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 641 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
642 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 642 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
643 | nt_action->addTo( actionMenu ); | 643 | nt_action->addTo( actionMenu ); |
644 | connect( nt_action, SIGNAL( activated() ), | 644 | connect( nt_action, SIGNAL( activated() ), |
645 | mView, SLOT( newTodo() ) ); | 645 | mView, SLOT( newTodo() ) ); |
646 | 646 | ||
647 | icon = loadPixmap( pathString + "today" ); | 647 | icon = loadPixmap( pathString + "today" ); |
648 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 648 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
649 | today_action->addTo( viewMenu ); | 649 | today_action->addTo( viewMenu ); |
650 | connect( today_action, SIGNAL( activated() ), | 650 | connect( today_action, SIGNAL( activated() ), |
651 | mView, SLOT( goToday() ) ); | 651 | mView, SLOT( goToday() ) ); |
652 | viewMenu->insertSeparator(); | 652 | viewMenu->insertSeparator(); |
653 | 653 | ||
654 | icon = loadPixmap( pathString + "navi" ); | 654 | icon = loadPixmap( pathString + "navi" ); |
655 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 655 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
656 | action->addTo( viewMenu ); | 656 | action->addTo( viewMenu ); |
657 | connect( action, SIGNAL( activated() ), | 657 | connect( action, SIGNAL( activated() ), |
@@ -1687,129 +1687,132 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
1687 | case Qt::Key_9: | 1687 | case Qt::Key_9: |
1688 | pro = e->key()-48; | 1688 | pro = e->key()-48; |
1689 | if ( pro == 0 ) | 1689 | if ( pro == 0 ) |
1690 | pro = 10; | 1690 | pro = 10; |
1691 | if ( e->state() == Qt::ControlButton) | 1691 | if ( e->state() == Qt::ControlButton) |
1692 | pro += 10; | 1692 | pro += 10; |
1693 | break; | 1693 | break; |
1694 | case Qt::Key_M: | 1694 | case Qt::Key_M: |
1695 | mView->viewManager()->showMonthView(); | 1695 | mView->viewManager()->showMonthView(); |
1696 | showSelectedDates = true; | 1696 | showSelectedDates = true; |
1697 | break; | 1697 | break; |
1698 | case Qt::Key_Insert: | 1698 | case Qt::Key_Insert: |
1699 | mView->newEvent(); | 1699 | mView->newEvent(); |
1700 | break; | 1700 | break; |
1701 | case Qt::Key_S : | 1701 | case Qt::Key_S : |
1702 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1702 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1703 | mView->newSubTodo(); | 1703 | mView->newSubTodo(); |
1704 | else | 1704 | else |
1705 | mView->dialogManager()->showSearchDialog(); | 1705 | mView->dialogManager()->showSearchDialog(); |
1706 | break; | 1706 | break; |
1707 | case Qt::Key_Y : | 1707 | case Qt::Key_Y : |
1708 | case Qt::Key_Z : | 1708 | case Qt::Key_Z : |
1709 | mView->viewManager()->showWorkWeekView(); | 1709 | mView->viewManager()->showWorkWeekView(); |
1710 | showSelectedDates = true; | 1710 | showSelectedDates = true; |
1711 | break; | 1711 | break; |
1712 | case Qt::Key_U : | 1712 | case Qt::Key_U : |
1713 | mView->viewManager()->showWeekView(); | 1713 | mView->viewManager()->showWeekView(); |
1714 | showSelectedDates = true; | 1714 | showSelectedDates = true; |
1715 | break; | 1715 | break; |
1716 | case Qt::Key_H : | 1716 | case Qt::Key_H : |
1717 | keyBindings(); | 1717 | keyBindings(); |
1718 | break; | 1718 | break; |
1719 | case Qt::Key_W: | 1719 | case Qt::Key_W: |
1720 | mView->viewManager()->showWhatsNextView(); | 1720 | mView->viewManager()->showWhatsNextView(); |
1721 | break; | 1721 | break; |
1722 | case Qt::Key_L: | 1722 | case Qt::Key_L: |
1723 | mView->viewManager()->showListView(); | 1723 | mView->viewManager()->showListView(); |
1724 | break; | 1724 | break; |
1725 | case Qt::Key_N: | 1725 | case Qt::Key_N: |
1726 | mView->viewManager()->showNextXView(); | 1726 | mView->viewManager()->showNextXView(); |
1727 | showSelectedDates = true; | 1727 | showSelectedDates = true; |
1728 | break; | 1728 | break; |
1729 | case Qt::Key_V: | 1729 | case Qt::Key_V: |
1730 | mView->viewManager()->showTodoView(); | 1730 | mView->viewManager()->showTodoView(); |
1731 | break; | 1731 | break; |
1732 | case Qt::Key_C: | 1732 | case Qt::Key_C: |
1733 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1733 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1734 | break; | 1734 | break; |
1735 | case Qt::Key_P: | 1735 | case Qt::Key_P: |
1736 | mView->showDatePicker( ); | 1736 | mView->showDatePicker( ); |
1737 | break; | 1737 | break; |
1738 | case Qt::Key_F: | 1738 | case Qt::Key_F: |
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; |
1764 | case Qt::Key_B: | 1767 | case Qt::Key_B: |
1765 | mView->editIncidenceDescription();; | 1768 | mView->editIncidenceDescription();; |
1766 | break; | 1769 | break; |
1767 | // case Qt::Key_Return: | 1770 | // case Qt::Key_Return: |
1768 | case Qt::Key_E: | 1771 | case Qt::Key_E: |
1769 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1772 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1770 | mView->newEvent(); | 1773 | mView->newEvent(); |
1771 | else | 1774 | else |
1772 | mView->editIncidence(); | 1775 | mView->editIncidence(); |
1773 | break; | 1776 | break; |
1774 | case Qt::Key_Plus: | 1777 | case Qt::Key_Plus: |
1775 | size = p->mHourSize +2; | 1778 | size = p->mHourSize +2; |
1776 | if ( size <= 22 ) | 1779 | if ( size <= 22 ) |
1777 | configureAgenda( size ); | 1780 | configureAgenda( size ); |
1778 | break; | 1781 | break; |
1779 | case Qt::Key_Minus: | 1782 | case Qt::Key_Minus: |
1780 | size = p->mHourSize - 2; | 1783 | size = p->mHourSize - 2; |
1781 | if ( size >= 4 ) | 1784 | if ( size >= 4 ) |
1782 | configureAgenda( size ); | 1785 | configureAgenda( size ); |
1783 | break; | 1786 | break; |
1784 | 1787 | ||
1785 | 1788 | ||
1786 | default: | 1789 | default: |
1787 | e->ignore(); | 1790 | e->ignore(); |
1788 | } | 1791 | } |
1789 | if ( pro > 0 ) { | 1792 | if ( pro > 0 ) { |
1790 | mView->selectFilter( pro-1 ); | 1793 | mView->selectFilter( pro-1 ); |
1791 | } | 1794 | } |
1792 | if ( showSelectedDates ) { | 1795 | if ( showSelectedDates ) { |
1793 | ;// setCaptionToDates(); | 1796 | ;// setCaptionToDates(); |
1794 | } | 1797 | } |
1795 | 1798 | ||
1796 | } | 1799 | } |
1797 | 1800 | ||
1798 | void MainWindow::fillFilterMenu() | 1801 | void MainWindow::fillFilterMenu() |
1799 | { | 1802 | { |
1800 | selectFilterMenu->clear(); | 1803 | selectFilterMenu->clear(); |
1801 | bool disable = false; | 1804 | bool disable = false; |
1802 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1805 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1803 | selectFilterMenu->insertSeparator(); | 1806 | selectFilterMenu->insertSeparator(); |
1804 | if ( mView->filterView()->filtersEnabled() ) { | 1807 | if ( mView->filterView()->filtersEnabled() ) { |
1805 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1808 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1806 | } | 1809 | } |
1807 | else { | 1810 | else { |
1808 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1811 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1809 | disable = true; | 1812 | disable = true; |
1810 | } | 1813 | } |
1811 | selectFilterMenu->insertSeparator(); | 1814 | selectFilterMenu->insertSeparator(); |
1812 | QPtrList<CalFilter> fili = mView->filters(); | 1815 | QPtrList<CalFilter> fili = mView->filters(); |
1813 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1816 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1814 | CalFilter *filter = fili.first(); | 1817 | CalFilter *filter = fili.first(); |
1815 | int iii = 2; | 1818 | int iii = 2; |
@@ -2072,64 +2075,76 @@ void MainWindow::syncFileRequest() | |||
2072 | void MainWindow::getFile( bool success ) | 2075 | void MainWindow::getFile( bool success ) |
2073 | { | 2076 | { |
2074 | if ( ! success ) { | 2077 | if ( ! success ) { |
2075 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2078 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2076 | return; | 2079 | return; |
2077 | } | 2080 | } |
2078 | mView->openCalendar( sentSyncFile() ); | 2081 | mView->openCalendar( sentSyncFile() ); |
2079 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2082 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2080 | mSyncManager->slotSyncMenu( 999 ); | 2083 | mSyncManager->slotSyncMenu( 999 ); |
2081 | } | 2084 | } |
2082 | setCaption( i18n("Pi-Sync successful!") ); | 2085 | setCaption( i18n("Pi-Sync successful!") ); |
2083 | } | 2086 | } |
2084 | 2087 | ||
2085 | void MainWindow::printSel( ) | 2088 | void MainWindow::printSel( ) |
2086 | { | 2089 | { |
2087 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2090 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2088 | } | 2091 | } |
2089 | 2092 | ||
2090 | void MainWindow::printCal() | 2093 | void MainWindow::printCal() |
2091 | { | 2094 | { |
2092 | mView->print();//mCp->showDialog(); | 2095 | mView->print();//mCp->showDialog(); |
2093 | } | 2096 | } |
2094 | 2097 | ||
2095 | 2098 | ||
2096 | #include "libkdepim/kdatepicker.h" | 2099 | #include "libkdepim/kdatepicker.h" |
2097 | #include <kdatetbl.h> | 2100 | #include <kdatetbl.h> |
2098 | void MainWindow::weekAction() | 2101 | void MainWindow::weekAction() |
2099 | { | 2102 | { |
2100 | int month; | 2103 | int month; |
2101 | KPopupFrame* popup = new KPopupFrame(this); | 2104 | KPopupFrame* popup = new KPopupFrame(this); |
2102 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2105 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2103 | // ----- | 2106 | // ----- |
2104 | picker->resize(picker->sizeHint()); | 2107 | picker->resize(picker->sizeHint()); |
2105 | popup->setMainWidget(picker); | 2108 | popup->setMainWidget(picker); |
2106 | picker->setFocus(); | 2109 | picker->setFocus(); |
2107 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2110 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2108 | int x = 0; | 2111 | int x = 0; |
2109 | int y = iconToolBar->height(); | 2112 | int y = iconToolBar->height(); |
2110 | int dX = 0; | 2113 | int dX = 0; |
2111 | int dY = 0; | 2114 | int dY = 0; |
2112 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2115 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2113 | if ( iconToolBar->y() > height()/2 ) { | 2116 | if ( iconToolBar->y() > height()/2 ) { |
2114 | dY = picker->sizeHint().height()+8; | 2117 | dY = picker->sizeHint().height()+8; |
2115 | y = 0; | 2118 | y = 0; |
2116 | } | 2119 | } |
2117 | } else { | 2120 | } else { |
2118 | if ( iconToolBar->x() > width()/2 ) { // right side | 2121 | if ( iconToolBar->x() > width()/2 ) { // right side |
2119 | x=0; | 2122 | x=0; |
2120 | dX= picker->sizeHint().width()+8; | 2123 | dX= picker->sizeHint().width()+8; |
2121 | y = 0; | 2124 | y = 0; |
2122 | } else { | 2125 | } else { |
2123 | x= iconToolBar->width(); | 2126 | x= iconToolBar->width(); |
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 | |||
2140 | void 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 | |||
@@ -43,118 +43,119 @@ class MainWindow : public QMainWindow | |||
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
47 | ~MainWindow(); | 47 | ~MainWindow(); |
48 | bool beamReceiveEnabled(); | 48 | bool beamReceiveEnabled(); |
49 | static QString defaultFileName(); | 49 | static QString defaultFileName(); |
50 | static QString syncFileName(); | 50 | static QString syncFileName(); |
51 | static QString resourcePath(); | 51 | static QString resourcePath(); |
52 | public slots: | 52 | public slots: |
53 | void setCaption ( const QString & ); | 53 | void setCaption ( const QString & ); |
54 | void updateWeekNum(const KCal::DateList &); | 54 | void updateWeekNum(const KCal::DateList &); |
55 | void updateWeek(QDate); | 55 | void updateWeek(QDate); |
56 | virtual void showMaximized (); | 56 | virtual void showMaximized (); |
57 | void configureAgenda( int ); | 57 | void configureAgenda( int ); |
58 | void recieve( const QCString& msg, const QByteArray& data ); | 58 | void recieve( const QCString& msg, const QByteArray& data ); |
59 | protected slots: | 59 | protected slots: |
60 | void setCaptionToDates(); | 60 | void setCaptionToDates(); |
61 | void weekAction(); | 61 | void weekAction(); |
62 | void about(); | 62 | void about(); |
63 | void licence(); | 63 | void licence(); |
64 | void faq(); | 64 | void faq(); |
65 | void usertrans(); | 65 | void usertrans(); |
66 | void features(); | 66 | void features(); |
67 | void synchowto(); | 67 | void synchowto(); |
68 | void kdesynchowto(); | 68 | void kdesynchowto(); |
69 | void multisynchowto(); | 69 | void multisynchowto(); |
70 | void whatsNew(); | 70 | void whatsNew(); |
71 | void keyBindings(); | 71 | void keyBindings(); |
72 | void aboutAutoSaving();; | 72 | void aboutAutoSaving();; |
73 | void aboutKnownBugs(); | 73 | void aboutKnownBugs(); |
74 | 74 | ||
75 | void processIncidenceSelection( Incidence * ); | 75 | void processIncidenceSelection( Incidence * ); |
76 | 76 | ||
77 | void importQtopia(); | 77 | void importQtopia(); |
78 | void importBday(); | 78 | void importBday(); |
79 | void importOL(); | 79 | void importOL(); |
80 | void importIcal(); | 80 | void importIcal(); |
81 | void importFile( QString, bool ); | 81 | void importFile( QString, bool ); |
82 | void quickImportIcal(); | 82 | void quickImportIcal(); |
83 | 83 | ||
84 | void slotModifiedChanged( bool ); | 84 | void slotModifiedChanged( bool ); |
85 | 85 | ||
86 | void save(); | 86 | void save(); |
87 | void saveStopTimer(); | 87 | void saveStopTimer(); |
88 | void configureToolBar( int ); | 88 | void configureToolBar( int ); |
89 | void printSel(); | 89 | void printSel(); |
90 | void printCal(); | 90 | void printCal(); |
91 | void saveCalendar(); | 91 | void saveCalendar(); |
92 | void loadCalendar(); | 92 | void loadCalendar(); |
93 | void exportVCalendar(); | 93 | void exportVCalendar(); |
94 | void fillFilterMenu(); | 94 | void fillFilterMenu(); |
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; |
119 | void saveOnClose(); | 120 | void saveOnClose(); |
120 | bool mFlagKeyPressed; | 121 | bool mFlagKeyPressed; |
121 | bool mBlockAtStartup; | 122 | bool mBlockAtStartup; |
122 | QPEToolBar *iconToolBar; | 123 | QPEToolBar *iconToolBar; |
123 | void initActions(); | 124 | void initActions(); |
124 | void setDefaultPreferences(); | 125 | void setDefaultPreferences(); |
125 | void keyPressEvent ( QKeyEvent * ) ; | 126 | void keyPressEvent ( QKeyEvent * ) ; |
126 | void keyReleaseEvent ( QKeyEvent * ) ; | 127 | void keyReleaseEvent ( QKeyEvent * ) ; |
127 | QPopupMenu *configureToolBarMenu; | 128 | QPopupMenu *configureToolBarMenu; |
128 | QPopupMenu *selectFilterMenu; | 129 | QPopupMenu *selectFilterMenu; |
129 | QPopupMenu *configureAgendaMenu, *syncMenu; | 130 | QPopupMenu *configureAgendaMenu, *syncMenu; |
130 | CalendarLocal *mCalendar; | 131 | CalendarLocal *mCalendar; |
131 | CalendarView *mView; | 132 | CalendarView *mView; |
132 | QAction *mNewSubTodoAction; | 133 | QAction *mNewSubTodoAction; |
133 | QAction *mWeekAction; | 134 | QAction *mWeekAction; |
134 | QFont mWeekFont; | 135 | QFont mWeekFont; |
135 | QPixmap mWeekPixmap; | 136 | QPixmap mWeekPixmap; |
136 | QColor mWeekBgColor; | 137 | QColor mWeekBgColor; |
137 | 138 | ||
138 | QAction *mShowAction; | 139 | QAction *mShowAction; |
139 | QAction *mEditAction; | 140 | QAction *mEditAction; |
140 | QAction *mDeleteAction; | 141 | QAction *mDeleteAction; |
141 | QAction *mCloneAction; | 142 | QAction *mCloneAction; |
142 | QAction *mMoveAction; | 143 | QAction *mMoveAction; |
143 | QAction *mBeamAction; | 144 | QAction *mBeamAction; |
144 | QAction *mCancelAction; | 145 | QAction *mCancelAction; |
145 | 146 | ||
146 | QAction *mToggleNav; | 147 | QAction *mToggleNav; |
147 | QAction *mToggleFilter; | 148 | QAction *mToggleFilter; |
148 | QAction *mToggleAllday; | 149 | QAction *mToggleAllday; |
149 | 150 | ||
150 | 151 | ||
151 | void closeEvent( QCloseEvent* ce ); | 152 | void closeEvent( QCloseEvent* ce ); |
152 | SimpleAlarmClient mAlarmClient; | 153 | SimpleAlarmClient mAlarmClient; |
153 | QTimer mSaveTimer; | 154 | QTimer mSaveTimer; |
154 | //bool mBlockSaveFlag; | 155 | //bool mBlockSaveFlag; |
155 | bool mCalendarModifiedFlag; | 156 | bool mCalendarModifiedFlag; |
156 | QPixmap loadPixmap( QString ); | 157 | QPixmap loadPixmap( QString ); |
157 | }; | 158 | }; |
158 | 159 | ||
159 | 160 | ||
160 | #endif | 161 | #endif |