summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-18 20:16:48 (UTC)
committer zautrix <zautrix>2005-06-18 20:16:48 (UTC)
commita2e963324e6db541f322002c307b40f24747e036 (patch) (unidiff)
tree5b09ee8c176e0709bb48bd2446fe90d2f3d90c68
parent15e5fcb111968950032089219185ae4322e88f06 (diff)
downloadkdepimpi-a2e963324e6db541f322002c307b40f24747e036.zip
kdepimpi-a2e963324e6db541f322002c307b40f24747e036.tar.gz
kdepimpi-a2e963324e6db541f322002c307b40f24747e036.tar.bz2
filter change update fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/calendarview.cpp3
-rw-r--r--korganizer/mainwindow.cpp2
3 files changed, 6 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 322c0e6..0ebd853 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,139 +1,140 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3 3
4********** VERSION 2.1.8 ************ 4********** VERSION 2.1.8 ************
5 5
6KO/Pi: 6KO/Pi:
7Added info about the completion sate of a todo in the ListView/Searchdialog. 7Added info about the completion state of a todo in the ListView/Searchdialog.
8If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. 8If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well.
9Fixed some updating problems when changing the filter.
9 10
10KA/Pi: 11KA/Pi:
11In the addressee selection dialog now the formatted name is shown, if not empty. 12In the addressee selection dialog now the formatted name is shown, if not empty.
12 13
13Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. 14Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
14Fixed the sorting for size in the file selector on the Z. 15Fixed the sorting for size in the file selector on the Z.
15 16
16Changed the color selection dialog on the Zaurus to a more user friendly version. 17Changed the color selection dialog on the Zaurus to a more user friendly version.
17 18
18********** VERSION 2.1.7 ************ 19********** VERSION 2.1.7 ************
19 20
20KO/Pi: 21KO/Pi:
21Fixed several problems in the new Resource handling. 22Fixed several problems in the new Resource handling.
22Added more options to the search dialog. 23Added more options to the search dialog.
23Fixed a problem in the Month view. 24Fixed a problem in the Month view.
24Added more options to the dialog when setting a todo to stopped. 25Added more options to the dialog when setting a todo to stopped.
25 26
26Fixed two small problems in KO/PiAlarm applet. 27Fixed two small problems in KO/Pi Alarm applet.
27 28
28********** VERSION 2.1.6 ************ 29********** VERSION 2.1.6 ************
29 30
30This release is for testing only. 31This release is for testing only.
31 32
32KO/Pi: 33KO/Pi:
33Added to the list view (the list view is used in search dialog as well) the possibility to print it. 34Added to the list view (the list view is used in search dialog as well) the possibility to print it.
34Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. 35Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
35Added to the list view the possibility to add all subtodos of selected todos to an export/beam. 36Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
36Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. 37Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
37Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. 38Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
38Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. 39Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
39 40
40Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. 41Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars.
41In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. 42In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later.
42Now on every sync the set of calendars is synced which are enabled in the resource view. 43Now on every sync the set of calendars is synced which are enabled in the resource view.
43 44
44A calendar is enabled in the resource view if the "eye" column is checked. 45A calendar is enabled in the resource view if the "eye" column is checked.
45You can set a calendar to be the default for new items( "+" column ). 46You can set a calendar to be the default for new items( "+" column ).
46You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. 47You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly.
47To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... 48To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ...
48 49
49 50
50********** VERSION 2.1.5 ************ 51********** VERSION 2.1.5 ************
51 52
52This is the new stable version. 53This is the new stable version.
53Bugfix: 54Bugfix:
54Fixed a problem with agenda popup on the desktop in KO/Pi. 55Fixed a problem with agenda popup on the desktop in KO/Pi.
55Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. 56Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization.
56Added config option to not display completed todos in agenda view. 57Added config option to not display completed todos in agenda view.
57Addressee view is now using the formatted name, if defined. 58Addressee view is now using the formatted name, if defined.
58That makes it possible to display "lastname, firstname" in that view now. 59That makes it possible to display "lastname, firstname" in that view now.
59To set the formatted name for all contacts, please use menu: 60To set the formatted name for all contacts, please use menu:
60Edit->Change->Set formatted name. 61Edit->Change->Set formatted name.
61Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. 62Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows.
62 63
63********** VERSION 2.1.4 ************ 64********** VERSION 2.1.4 ************
64 65
65Fixed two more bugs in the KA/Pi CSV import dialog: 66Fixed two more bugs in the KA/Pi CSV import dialog:
66Made it possible to read multi-line fields and import it to the "Note" field. 67Made it possible to read multi-line fields and import it to the "Note" field.
67Fixed a problem in mapping custom fields, whatever a custem field is... 68Fixed a problem in mapping custom fields, whatever a custem field is...
68 69
69********** VERSION 2.1.3 ************ 70********** VERSION 2.1.3 ************
70 71
71Changed the menu structure of the alarm applet: 72Changed the menu structure of the alarm applet:
72Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". 73Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
73 74
74Fixed several problems in the KA/Pi CSV import dialog: 75Fixed several problems in the KA/Pi CSV import dialog:
75Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. 76Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
76 77
77 78
78********** VERSION 2.1.2 ************ 79********** VERSION 2.1.2 ************
79 80
80Fixed a problem closing the alarm dialog on Zaurus with "OK" button. 81Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
81 82
82Fixed a problem when importing data from Outlook with mutiple categories set. 83Fixed a problem when importing data from Outlook with mutiple categories set.
83 84
84Changed display of days in datenavigator: 85Changed display of days in datenavigator:
85Birthdays are now blue, not dark green. 86Birthdays are now blue, not dark green.
86When todo view is shown, no birtdays are shown and days with due todos are shown blue. 87When todo view is shown, no birtdays are shown and days with due todos are shown blue.
87When journal view is shown, only holidays are shown and days with journals are blue. 88When journal view is shown, only holidays are shown and days with journals are blue.
88 89
89Added Backup options to global config: 90Added Backup options to global config:
90You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). 91You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ).
91It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. 92It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again.
92The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. 93The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups.
93 94
94********** VERSION 2.1.1 ************ 95********** VERSION 2.1.1 ************
95 96
96Stable release 2.1.1! 97Stable release 2.1.1!
97 98
98KO/Pi: 99KO/Pi:
99Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. 100Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display.
100 101
101********** VERSION 2.1.0 ************ 102********** VERSION 2.1.0 ************
102 103
103Stable release 2.1.0! 104Stable release 2.1.0!
104 105
105Summary of changes/fixes compared to version 2.0.6: 106Summary of changes/fixes compared to version 2.0.6:
106 107
107Many bugs of version 2.0.6 fixed. 108Many bugs of version 2.0.6 fixed.
108Most of them were small bugs, but some of them were important. 109Most of them were small bugs, but some of them were important.
109It is recommended to use version 2.1.0 and not version 2.0.6. 110It is recommended to use version 2.1.0 and not version 2.0.6.
110 111
111Important changes: 112Important changes:
112 113
113Added recurring todos to KO/Pi. 114Added recurring todos to KO/Pi.
114 115
115Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. 116Added global application font settings (for all KDE-Pim/Pi apps) to the general settings.
116 117
117Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 118Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
118 119
119Datenavigator can now display many months. Very useful on the desktop. 120Datenavigator can now display many months. Very useful on the desktop.
120 121
121KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. 122KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements.
122 123
123Made alarm sound working on Linux desktop. 124Made alarm sound working on Linux desktop.
124 125
125Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. 126Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details.
126 127
127Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. 128Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details.
128 129
129Many other usebility enhancements. 130Many other usebility enhancements.
130Special thanks to Ben for his suggestions! 131Special thanks to Ben for his suggestions!
131 132
132You can find the complete changelog 133You can find the complete changelog
133from version 1.7.7 to 2.1.0 134from version 1.7.7 to 2.1.0
134in the source package or on 135in the source package or on
135 136
136http://www.pi-sync.net/html/changelog.html 137http://www.pi-sync.net/html/changelog.html
137 138
138 139
139 140
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index d25f632..08909ed 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3252,1272 +3252,1273 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog()
3252 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 3252 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
3253 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 3253 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
3254 viewManager(), SLOT( showAgendaView( bool ) ) ); 3254 viewManager(), SLOT( showAgendaView( bool ) ) );
3255 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), 3255 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()),
3256 this, SLOT( slotViewerClosed() ) ); 3256 this, SLOT( slotViewerClosed() ) );
3257 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 3257 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
3258 this, SLOT( todoChanged(Todo *) ) ); 3258 this, SLOT( todoChanged(Todo *) ) );
3259 mEventViewerDialog->resize( 640, 480 ); 3259 mEventViewerDialog->resize( 640, 480 );
3260 3260
3261 } 3261 }
3262 return mEventViewerDialog; 3262 return mEventViewerDialog;
3263} 3263}
3264void CalendarView::showEvent(Event *event) 3264void CalendarView::showEvent(Event *event)
3265{ 3265{
3266 getEventViewerDialog()->setEvent(event); 3266 getEventViewerDialog()->setEvent(event);
3267 getEventViewerDialog()->showMe(); 3267 getEventViewerDialog()->showMe();
3268} 3268}
3269 3269
3270void CalendarView::showTodo(Todo *event) 3270void CalendarView::showTodo(Todo *event)
3271{ 3271{
3272 getEventViewerDialog()->setTodo(event); 3272 getEventViewerDialog()->setTodo(event);
3273 getEventViewerDialog()->showMe(); 3273 getEventViewerDialog()->showMe();
3274} 3274}
3275void CalendarView::showJournal( Journal *jour ) 3275void CalendarView::showJournal( Journal *jour )
3276{ 3276{
3277 getEventViewerDialog()->setJournal(jour); 3277 getEventViewerDialog()->setJournal(jour);
3278 getEventViewerDialog()->showMe(); 3278 getEventViewerDialog()->showMe();
3279 3279
3280} 3280}
3281// void CalendarView::todoModified (Todo *event, int changed) 3281// void CalendarView::todoModified (Todo *event, int changed)
3282// { 3282// {
3283// // if (mDialogList.find (event) != mDialogList.end ()) { 3283// // if (mDialogList.find (event) != mDialogList.end ()) {
3284// // kdDebug() << "Todo modified and open" << endl; 3284// // kdDebug() << "Todo modified and open" << endl;
3285// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 3285// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
3286// // temp->modified (changed); 3286// // temp->modified (changed);
3287 3287
3288// // } 3288// // }
3289 3289
3290// mViewManager->updateView(); 3290// mViewManager->updateView();
3291// } 3291// }
3292 3292
3293void CalendarView::appointment_show() 3293void CalendarView::appointment_show()
3294{ 3294{
3295 Event *anEvent = 0; 3295 Event *anEvent = 0;
3296 3296
3297 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3297 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3298 3298
3299 if (mViewManager->currentView()->isEventView()) { 3299 if (mViewManager->currentView()->isEventView()) {
3300 if ( incidence && incidence->typeID() == eventID ) { 3300 if ( incidence && incidence->typeID() == eventID ) {
3301 anEvent = static_cast<Event *>(incidence); 3301 anEvent = static_cast<Event *>(incidence);
3302 } 3302 }
3303 } 3303 }
3304 3304
3305 if (!anEvent) { 3305 if (!anEvent) {
3306 KNotifyClient::beep(); 3306 KNotifyClient::beep();
3307 return; 3307 return;
3308 } 3308 }
3309 3309
3310 showEvent(anEvent); 3310 showEvent(anEvent);
3311} 3311}
3312 3312
3313void CalendarView::appointment_edit() 3313void CalendarView::appointment_edit()
3314{ 3314{
3315 Event *anEvent = 0; 3315 Event *anEvent = 0;
3316 3316
3317 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3317 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3318 3318
3319 if (mViewManager->currentView()->isEventView()) { 3319 if (mViewManager->currentView()->isEventView()) {
3320 if ( incidence && incidence->typeID() == eventID ) { 3320 if ( incidence && incidence->typeID() == eventID ) {
3321 anEvent = static_cast<Event *>(incidence); 3321 anEvent = static_cast<Event *>(incidence);
3322 } 3322 }
3323 } 3323 }
3324 3324
3325 if (!anEvent) { 3325 if (!anEvent) {
3326 KNotifyClient::beep(); 3326 KNotifyClient::beep();
3327 return; 3327 return;
3328 } 3328 }
3329 3329
3330 editEvent(anEvent); 3330 editEvent(anEvent);
3331} 3331}
3332 3332
3333void CalendarView::appointment_delete() 3333void CalendarView::appointment_delete()
3334{ 3334{
3335 Event *anEvent = 0; 3335 Event *anEvent = 0;
3336 3336
3337 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3337 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3338 3338
3339 if (mViewManager->currentView()->isEventView()) { 3339 if (mViewManager->currentView()->isEventView()) {
3340 if ( incidence && incidence->typeID() == eventID ) { 3340 if ( incidence && incidence->typeID() == eventID ) {
3341 anEvent = static_cast<Event *>(incidence); 3341 anEvent = static_cast<Event *>(incidence);
3342 } 3342 }
3343 } 3343 }
3344 3344
3345 if (!anEvent) { 3345 if (!anEvent) {
3346 KNotifyClient::beep(); 3346 KNotifyClient::beep();
3347 return; 3347 return;
3348 } 3348 }
3349 3349
3350 deleteEvent(anEvent); 3350 deleteEvent(anEvent);
3351} 3351}
3352 3352
3353void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3353void CalendarView::todo_resub( Todo * parent, Todo * sub )
3354{ 3354{
3355 if (!sub) return; 3355 if (!sub) return;
3356 if ( sub->relatedTo() == parent ) 3356 if ( sub->relatedTo() == parent )
3357 return; 3357 return;
3358 sub->setRelatedTo(parent); 3358 sub->setRelatedTo(parent);
3359 sub->updated(); 3359 sub->updated();
3360 setModified(true); 3360 setModified(true);
3361 updateView(); 3361 updateView();
3362} 3362}
3363void CalendarView::todo_unsub(Todo *anTodo ) 3363void CalendarView::todo_unsub(Todo *anTodo )
3364{ 3364{
3365 todo_resub( 0, anTodo ); 3365 todo_resub( 0, anTodo );
3366} 3366}
3367 3367
3368void CalendarView::deleteTodo(Todo *todo) 3368void CalendarView::deleteTodo(Todo *todo)
3369{ 3369{
3370 if (!todo) { 3370 if (!todo) {
3371 KNotifyClient::beep(); 3371 KNotifyClient::beep();
3372 return; 3372 return;
3373 } 3373 }
3374 if (KOPrefs::instance()->mConfirm) { 3374 if (KOPrefs::instance()->mConfirm) {
3375 QString text = todo->summary().left(20); 3375 QString text = todo->summary().left(20);
3376 if (!todo->relations().isEmpty()) { 3376 if (!todo->relations().isEmpty()) {
3377 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 3377 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
3378 3378
3379 } 3379 }
3380 switch (msgItemDelete(text)) { 3380 switch (msgItemDelete(text)) {
3381 case KMessageBox::Continue: // OK 3381 case KMessageBox::Continue: // OK
3382 bool deleteT = false; 3382 bool deleteT = false;
3383 if (!todo->relations().isEmpty()) { 3383 if (!todo->relations().isEmpty()) {
3384 deleteT = removeCompletedSubTodos( todo ); 3384 deleteT = removeCompletedSubTodos( todo );
3385 } 3385 }
3386 // deleteT == true: todo already deleted in removeCompletedSubTodos 3386 // deleteT == true: todo already deleted in removeCompletedSubTodos
3387 if ( !deleteT ) { 3387 if ( !deleteT ) {
3388 checkExternalId( todo ); 3388 checkExternalId( todo );
3389 calendar()->deleteTodo(todo); 3389 calendar()->deleteTodo(todo);
3390 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3390 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3391 updateView(); 3391 updateView();
3392 } 3392 }
3393 break; 3393 break;
3394 } // switch 3394 } // switch
3395 } else { 3395 } else {
3396 checkExternalId( todo ); 3396 checkExternalId( todo );
3397 mCalendar->deleteTodo(todo); 3397 mCalendar->deleteTodo(todo);
3398 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3398 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3399 updateView(); 3399 updateView();
3400 } 3400 }
3401 3401
3402 emit updateSearchDialog(); 3402 emit updateSearchDialog();
3403} 3403}
3404void CalendarView::deleteJournal(Journal *jour) 3404void CalendarView::deleteJournal(Journal *jour)
3405{ 3405{
3406 if (!jour) { 3406 if (!jour) {
3407 KNotifyClient::beep(); 3407 KNotifyClient::beep();
3408 return; 3408 return;
3409 } 3409 }
3410 if (KOPrefs::instance()->mConfirm) { 3410 if (KOPrefs::instance()->mConfirm) {
3411 switch (msgItemDelete( jour->description().left(20))) { 3411 switch (msgItemDelete( jour->description().left(20))) {
3412 case KMessageBox::Continue: // OK 3412 case KMessageBox::Continue: // OK
3413 calendar()->deleteJournal(jour); 3413 calendar()->deleteJournal(jour);
3414 updateView(); 3414 updateView();
3415 break; 3415 break;
3416 } // switch 3416 } // switch
3417 } else { 3417 } else {
3418 calendar()->deleteJournal(jour);; 3418 calendar()->deleteJournal(jour);;
3419 updateView(); 3419 updateView();
3420 } 3420 }
3421 emit updateSearchDialog(); 3421 emit updateSearchDialog();
3422} 3422}
3423 3423
3424void CalendarView::deleteEvent(Event *anEvent) 3424void CalendarView::deleteEvent(Event *anEvent)
3425{ 3425{
3426 if (!anEvent) { 3426 if (!anEvent) {
3427 KNotifyClient::beep(); 3427 KNotifyClient::beep();
3428 return; 3428 return;
3429 } 3429 }
3430 3430
3431 if (anEvent->recurrence()->doesRecur()) { 3431 if (anEvent->recurrence()->doesRecur()) {
3432 QDate itemDate = mViewManager->currentSelectionDate(); 3432 QDate itemDate = mViewManager->currentSelectionDate();
3433 int km; 3433 int km;
3434 if (!itemDate.isValid()) { 3434 if (!itemDate.isValid()) {
3435 //kdDebug() << "Date Not Valid" << endl; 3435 //kdDebug() << "Date Not Valid" << endl;
3436 if (KOPrefs::instance()->mConfirm) { 3436 if (KOPrefs::instance()->mConfirm) {
3437 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3437 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3438 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 3438 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
3439 i18n("KO/Pi Confirmation"),i18n("Delete All")); 3439 i18n("KO/Pi Confirmation"),i18n("Delete All"));
3440 if ( km == KMessageBox::Continue ) 3440 if ( km == KMessageBox::Continue )
3441 km = KMessageBox::No; // No = all below 3441 km = KMessageBox::No; // No = all below
3442 } else 3442 } else
3443 km = KMessageBox::No; 3443 km = KMessageBox::No;
3444 } else { 3444 } else {
3445 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 3445 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
3446 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 3446 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
3447 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 3447 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
3448 i18n("KO/Pi Confirmation"),i18n("Current"), 3448 i18n("KO/Pi Confirmation"),i18n("Current"),
3449 i18n("All")); 3449 i18n("All"));
3450 } 3450 }
3451 switch(km) { 3451 switch(km) {
3452 3452
3453 case KMessageBox::No: // Continue // all 3453 case KMessageBox::No: // Continue // all
3454 //qDebug("KMessageBox::No "); 3454 //qDebug("KMessageBox::No ");
3455 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3455 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3456 schedule(Scheduler::Cancel,anEvent); 3456 schedule(Scheduler::Cancel,anEvent);
3457 3457
3458 checkExternalId( anEvent); 3458 checkExternalId( anEvent);
3459 mCalendar->deleteEvent(anEvent); 3459 mCalendar->deleteEvent(anEvent);
3460 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 3460 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
3461 break; 3461 break;
3462 3462
3463 // Disabled because it does not work 3463 // Disabled because it does not work
3464 //#if 0 3464 //#if 0
3465 case KMessageBox::Yes: // just this one 3465 case KMessageBox::Yes: // just this one
3466 //QDate qd = mNavigator->selectedDates().first(); 3466 //QDate qd = mNavigator->selectedDates().first();
3467 //if (!qd.isValid()) { 3467 //if (!qd.isValid()) {
3468 // kdDebug() << "no date selected, or invalid date" << endl; 3468 // kdDebug() << "no date selected, or invalid date" << endl;
3469 // KNotifyClient::beep(); 3469 // KNotifyClient::beep();
3470 // return; 3470 // return;
3471 //} 3471 //}
3472 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 3472 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
3473 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 3473 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
3474 anEvent->addExDate(itemDate); 3474 anEvent->addExDate(itemDate);
3475 int duration = anEvent->recurrence()->duration(); 3475 int duration = anEvent->recurrence()->duration();
3476 if ( duration > 0 ) { 3476 if ( duration > 0 ) {
3477 anEvent->recurrence()->setDuration( duration - 1 ); 3477 anEvent->recurrence()->setDuration( duration - 1 );
3478 } 3478 }
3479 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 3479 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
3480 } 3480 }
3481 break; 3481 break;
3482 //#endif 3482 //#endif
3483 } // switch 3483 } // switch
3484 } else { 3484 } else {
3485 if (KOPrefs::instance()->mConfirm) { 3485 if (KOPrefs::instance()->mConfirm) {
3486 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3486 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3487 i18n("\nAre you sure you want\nto delete this event?"), 3487 i18n("\nAre you sure you want\nto delete this event?"),
3488 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3488 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3489 case KMessageBox::Continue: // OK 3489 case KMessageBox::Continue: // OK
3490 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3490 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3491 schedule(Scheduler::Cancel,anEvent); 3491 schedule(Scheduler::Cancel,anEvent);
3492 checkExternalId( anEvent); 3492 checkExternalId( anEvent);
3493 mCalendar->deleteEvent(anEvent); 3493 mCalendar->deleteEvent(anEvent);
3494 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3494 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3495 break; 3495 break;
3496 } // switch 3496 } // switch
3497 } else { 3497 } else {
3498 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3498 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3499 schedule(Scheduler::Cancel,anEvent); 3499 schedule(Scheduler::Cancel,anEvent);
3500 checkExternalId( anEvent); 3500 checkExternalId( anEvent);
3501 mCalendar->deleteEvent(anEvent); 3501 mCalendar->deleteEvent(anEvent);
3502 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3502 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3503 } 3503 }
3504 } // if-else 3504 } // if-else
3505 emit updateSearchDialog(); 3505 emit updateSearchDialog();
3506} 3506}
3507 3507
3508bool CalendarView::deleteEvent(const QString &uid) 3508bool CalendarView::deleteEvent(const QString &uid)
3509{ 3509{
3510 Event *ev = mCalendar->event(uid); 3510 Event *ev = mCalendar->event(uid);
3511 if (ev) { 3511 if (ev) {
3512 deleteEvent(ev); 3512 deleteEvent(ev);
3513 return true; 3513 return true;
3514 } else { 3514 } else {
3515 return false; 3515 return false;
3516 } 3516 }
3517} 3517}
3518 3518
3519/*****************************************************************************/ 3519/*****************************************************************************/
3520 3520
3521void CalendarView::action_mail() 3521void CalendarView::action_mail()
3522{ 3522{
3523#ifndef KORG_NOMAIL 3523#ifndef KORG_NOMAIL
3524 KOMailClient mailClient; 3524 KOMailClient mailClient;
3525 3525
3526 Incidence *incidence = currentSelection(); 3526 Incidence *incidence = currentSelection();
3527 3527
3528 if (!incidence) { 3528 if (!incidence) {
3529 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3529 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3530 return; 3530 return;
3531 } 3531 }
3532 if(incidence->attendeeCount() == 0 ) { 3532 if(incidence->attendeeCount() == 0 ) {
3533 KMessageBox::sorry(this, 3533 KMessageBox::sorry(this,
3534 i18n("Can't generate mail:\nNo attendees defined.\n")); 3534 i18n("Can't generate mail:\nNo attendees defined.\n"));
3535 return; 3535 return;
3536 } 3536 }
3537 3537
3538 CalendarLocal cal_tmp; 3538 CalendarLocal cal_tmp;
3539 Event *event = 0; 3539 Event *event = 0;
3540 Event *ev = 0; 3540 Event *ev = 0;
3541 if ( incidence && incidence->typeID() == eventID ) { 3541 if ( incidence && incidence->typeID() == eventID ) {
3542 event = static_cast<Event *>(incidence); 3542 event = static_cast<Event *>(incidence);
3543 ev = new Event(*event); 3543 ev = new Event(*event);
3544 cal_tmp.addEvent(ev); 3544 cal_tmp.addEvent(ev);
3545 } 3545 }
3546 ICalFormat mForm(); 3546 ICalFormat mForm();
3547 QString attachment = mForm.toString( &cal_tmp ); 3547 QString attachment = mForm.toString( &cal_tmp );
3548 if (ev) delete(ev); 3548 if (ev) delete(ev);
3549 3549
3550 mailClient.mailAttendees(currentSelection(), attachment); 3550 mailClient.mailAttendees(currentSelection(), attachment);
3551 3551
3552#endif 3552#endif
3553 3553
3554#if 0 3554#if 0
3555 Event *anEvent = 0; 3555 Event *anEvent = 0;
3556 if (mViewManager->currentView()->isEventView()) { 3556 if (mViewManager->currentView()->isEventView()) {
3557 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3557 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3558 } 3558 }
3559 3559
3560 if (!anEvent) { 3560 if (!anEvent) {
3561 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3561 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3562 return; 3562 return;
3563 } 3563 }
3564 if(anEvent->attendeeCount() == 0 ) { 3564 if(anEvent->attendeeCount() == 0 ) {
3565 KMessageBox::sorry(this, 3565 KMessageBox::sorry(this,
3566 i18n("Can't generate mail:\nNo attendees defined.\n")); 3566 i18n("Can't generate mail:\nNo attendees defined.\n"));
3567 return; 3567 return;
3568 } 3568 }
3569 3569
3570 mailobject.emailEvent(anEvent); 3570 mailobject.emailEvent(anEvent);
3571#endif 3571#endif
3572} 3572}
3573 3573
3574 3574
3575void CalendarView::schedule_publish(Incidence *incidence) 3575void CalendarView::schedule_publish(Incidence *incidence)
3576{ 3576{
3577 Event *event = 0; 3577 Event *event = 0;
3578 Todo *todo = 0; 3578 Todo *todo = 0;
3579 3579
3580 if (incidence == 0) { 3580 if (incidence == 0) {
3581 incidence = mViewManager->currentView()->selectedIncidences().first(); 3581 incidence = mViewManager->currentView()->selectedIncidences().first();
3582 if (incidence == 0) { 3582 if (incidence == 0) {
3583 incidence = mTodoList->selectedIncidences().first(); 3583 incidence = mTodoList->selectedIncidences().first();
3584 } 3584 }
3585 } 3585 }
3586 if ( incidence && incidence->typeID() == eventID ) { 3586 if ( incidence && incidence->typeID() == eventID ) {
3587 event = static_cast<Event *>(incidence); 3587 event = static_cast<Event *>(incidence);
3588 } else { 3588 } else {
3589 if ( incidence && incidence->typeID() == todoID ) { 3589 if ( incidence && incidence->typeID() == todoID ) {
3590 todo = static_cast<Todo *>(incidence); 3590 todo = static_cast<Todo *>(incidence);
3591 } 3591 }
3592 } 3592 }
3593 3593
3594 if (!event && !todo) { 3594 if (!event && !todo) {
3595 KMessageBox::sorry(this,i18n("No event selected.")); 3595 KMessageBox::sorry(this,i18n("No event selected."));
3596 return; 3596 return;
3597 } 3597 }
3598 3598
3599 PublishDialog *publishdlg = new PublishDialog(); 3599 PublishDialog *publishdlg = new PublishDialog();
3600 if (incidence->attendeeCount()>0) { 3600 if (incidence->attendeeCount()>0) {
3601 QPtrList<Attendee> attendees = incidence->attendees(); 3601 QPtrList<Attendee> attendees = incidence->attendees();
3602 attendees.first(); 3602 attendees.first();
3603 while ( attendees.current()!=0 ) { 3603 while ( attendees.current()!=0 ) {
3604 publishdlg->addAttendee(attendees.current()); 3604 publishdlg->addAttendee(attendees.current());
3605 attendees.next(); 3605 attendees.next();
3606 } 3606 }
3607 } 3607 }
3608 bool send = true; 3608 bool send = true;
3609 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3609 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3610 if ( publishdlg->exec() != QDialog::Accepted ) 3610 if ( publishdlg->exec() != QDialog::Accepted )
3611 send = false; 3611 send = false;
3612 } 3612 }
3613 if ( send ) { 3613 if ( send ) {
3614 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3614 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3615 if ( event ) { 3615 if ( event ) {
3616 Event *ev = new Event(*event); 3616 Event *ev = new Event(*event);
3617 ev->registerObserver(0); 3617 ev->registerObserver(0);
3618 ev->clearAttendees(); 3618 ev->clearAttendees();
3619 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3619 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3620 delete(ev); 3620 delete(ev);
3621 } 3621 }
3622 } else { 3622 } else {
3623 if ( todo ) { 3623 if ( todo ) {
3624 Todo *ev = new Todo(*todo); 3624 Todo *ev = new Todo(*todo);
3625 ev->registerObserver(0); 3625 ev->registerObserver(0);
3626 ev->clearAttendees(); 3626 ev->clearAttendees();
3627 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3627 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3628 delete(ev); 3628 delete(ev);
3629 } 3629 }
3630 } 3630 }
3631 } 3631 }
3632 } 3632 }
3633 delete publishdlg; 3633 delete publishdlg;
3634} 3634}
3635 3635
3636void CalendarView::schedule_request(Incidence *incidence) 3636void CalendarView::schedule_request(Incidence *incidence)
3637{ 3637{
3638 schedule(Scheduler::Request,incidence); 3638 schedule(Scheduler::Request,incidence);
3639} 3639}
3640 3640
3641void CalendarView::schedule_refresh(Incidence *incidence) 3641void CalendarView::schedule_refresh(Incidence *incidence)
3642{ 3642{
3643 schedule(Scheduler::Refresh,incidence); 3643 schedule(Scheduler::Refresh,incidence);
3644} 3644}
3645 3645
3646void CalendarView::schedule_cancel(Incidence *incidence) 3646void CalendarView::schedule_cancel(Incidence *incidence)
3647{ 3647{
3648 schedule(Scheduler::Cancel,incidence); 3648 schedule(Scheduler::Cancel,incidence);
3649} 3649}
3650 3650
3651void CalendarView::schedule_add(Incidence *incidence) 3651void CalendarView::schedule_add(Incidence *incidence)
3652{ 3652{
3653 schedule(Scheduler::Add,incidence); 3653 schedule(Scheduler::Add,incidence);
3654} 3654}
3655 3655
3656void CalendarView::schedule_reply(Incidence *incidence) 3656void CalendarView::schedule_reply(Incidence *incidence)
3657{ 3657{
3658 schedule(Scheduler::Reply,incidence); 3658 schedule(Scheduler::Reply,incidence);
3659} 3659}
3660 3660
3661void CalendarView::schedule_counter(Incidence *incidence) 3661void CalendarView::schedule_counter(Incidence *incidence)
3662{ 3662{
3663 schedule(Scheduler::Counter,incidence); 3663 schedule(Scheduler::Counter,incidence);
3664} 3664}
3665 3665
3666void CalendarView::schedule_declinecounter(Incidence *incidence) 3666void CalendarView::schedule_declinecounter(Incidence *incidence)
3667{ 3667{
3668 schedule(Scheduler::Declinecounter,incidence); 3668 schedule(Scheduler::Declinecounter,incidence);
3669} 3669}
3670 3670
3671void CalendarView::schedule_publish_freebusy(int daysToPublish) 3671void CalendarView::schedule_publish_freebusy(int daysToPublish)
3672{ 3672{
3673 QDateTime start = QDateTime::currentDateTime(); 3673 QDateTime start = QDateTime::currentDateTime();
3674 QDateTime end = start.addDays(daysToPublish); 3674 QDateTime end = start.addDays(daysToPublish);
3675 3675
3676 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3676 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3677 freebusy->setOrganizer(KOPrefs::instance()->email()); 3677 freebusy->setOrganizer(KOPrefs::instance()->email());
3678 3678
3679 3679
3680 PublishDialog *publishdlg = new PublishDialog(); 3680 PublishDialog *publishdlg = new PublishDialog();
3681 if ( publishdlg->exec() == QDialog::Accepted ) { 3681 if ( publishdlg->exec() == QDialog::Accepted ) {
3682 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3682 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3683 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3683 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3684 delete(freebusy); 3684 delete(freebusy);
3685 } 3685 }
3686 } 3686 }
3687 delete publishdlg; 3687 delete publishdlg;
3688} 3688}
3689 3689
3690void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3690void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3691{ 3691{
3692 Event *event = 0; 3692 Event *event = 0;
3693 Todo *todo = 0; 3693 Todo *todo = 0;
3694 3694
3695 if (incidence == 0) { 3695 if (incidence == 0) {
3696 incidence = mViewManager->currentView()->selectedIncidences().first(); 3696 incidence = mViewManager->currentView()->selectedIncidences().first();
3697 if (incidence == 0) { 3697 if (incidence == 0) {
3698 incidence = mTodoList->selectedIncidences().first(); 3698 incidence = mTodoList->selectedIncidences().first();
3699 } 3699 }
3700 } 3700 }
3701 if ( incidence && incidence->typeID() == eventID ) { 3701 if ( incidence && incidence->typeID() == eventID ) {
3702 event = static_cast<Event *>(incidence); 3702 event = static_cast<Event *>(incidence);
3703 } 3703 }
3704 if ( incidence && incidence->typeID() == todoID ) { 3704 if ( incidence && incidence->typeID() == todoID ) {
3705 todo = static_cast<Todo *>(incidence); 3705 todo = static_cast<Todo *>(incidence);
3706 } 3706 }
3707 3707
3708 if (!event && !todo) { 3708 if (!event && !todo) {
3709 KMessageBox::sorry(this,i18n("No event selected.")); 3709 KMessageBox::sorry(this,i18n("No event selected."));
3710 return; 3710 return;
3711 } 3711 }
3712 3712
3713 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3713 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3714 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3714 KMessageBox::sorry(this,i18n("The event has no attendees."));
3715 return; 3715 return;
3716 } 3716 }
3717 3717
3718 Event *ev = 0; 3718 Event *ev = 0;
3719 if (event) ev = new Event(*event); 3719 if (event) ev = new Event(*event);
3720 Todo *to = 0; 3720 Todo *to = 0;
3721 if (todo) to = new Todo(*todo); 3721 if (todo) to = new Todo(*todo);
3722 3722
3723 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3723 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3724 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3724 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3725 if (!me) { 3725 if (!me) {
3726 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3726 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3727 return; 3727 return;
3728 } 3728 }
3729 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3729 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3730 StatusDialog *statdlg = new StatusDialog(this); 3730 StatusDialog *statdlg = new StatusDialog(this);
3731 if (!statdlg->exec()==QDialog::Accepted) return; 3731 if (!statdlg->exec()==QDialog::Accepted) return;
3732 me->setStatus( statdlg->status() ); 3732 me->setStatus( statdlg->status() );
3733 delete(statdlg); 3733 delete(statdlg);
3734 } 3734 }
3735 Attendee *menew = new Attendee(*me); 3735 Attendee *menew = new Attendee(*me);
3736 if (ev) { 3736 if (ev) {
3737 ev->clearAttendees(); 3737 ev->clearAttendees();
3738 ev->addAttendee(menew,false); 3738 ev->addAttendee(menew,false);
3739 } else { 3739 } else {
3740 if (to) { 3740 if (to) {
3741 todo->clearAttendees(); 3741 todo->clearAttendees();
3742 todo->addAttendee(menew,false); 3742 todo->addAttendee(menew,false);
3743 } 3743 }
3744 } 3744 }
3745 } 3745 }
3746 3746
3747 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3747 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3748 if (ev) { 3748 if (ev) {
3749 if ( !dlg->addMessage(ev,method) ) delete(ev); 3749 if ( !dlg->addMessage(ev,method) ) delete(ev);
3750 } else { 3750 } else {
3751 if (to) { 3751 if (to) {
3752 if ( !dlg->addMessage(to,method) ) delete(to); 3752 if ( !dlg->addMessage(to,method) ) delete(to);
3753 } 3753 }
3754 } 3754 }
3755} 3755}
3756 3756
3757void CalendarView::openAddressbook() 3757void CalendarView::openAddressbook()
3758{ 3758{
3759 KRun::runCommand("kaddressbook"); 3759 KRun::runCommand("kaddressbook");
3760} 3760}
3761 3761
3762void CalendarView::setModified(bool modified) 3762void CalendarView::setModified(bool modified)
3763{ 3763{
3764 if ( modified ) 3764 if ( modified )
3765 emit signalmodified(); 3765 emit signalmodified();
3766 if (mModified != modified) { 3766 if (mModified != modified) {
3767 mModified = modified; 3767 mModified = modified;
3768 emit modifiedChanged(mModified); 3768 emit modifiedChanged(mModified);
3769 } 3769 }
3770} 3770}
3771 3771
3772bool CalendarView::isReadOnly() 3772bool CalendarView::isReadOnly()
3773{ 3773{
3774 return mReadOnly; 3774 return mReadOnly;
3775} 3775}
3776 3776
3777void CalendarView::setReadOnly(bool readOnly) 3777void CalendarView::setReadOnly(bool readOnly)
3778{ 3778{
3779 if (mReadOnly != readOnly) { 3779 if (mReadOnly != readOnly) {
3780 mReadOnly = readOnly; 3780 mReadOnly = readOnly;
3781 emit readOnlyChanged(mReadOnly); 3781 emit readOnlyChanged(mReadOnly);
3782 } 3782 }
3783} 3783}
3784 3784
3785bool CalendarView::isModified() 3785bool CalendarView::isModified()
3786{ 3786{
3787 return mModified; 3787 return mModified;
3788} 3788}
3789void CalendarView::slotprintSelInc() 3789void CalendarView::slotprintSelInc()
3790{ 3790{
3791 if ( currentSelection() == 0 ) { 3791 if ( currentSelection() == 0 ) {
3792 KMessageBox::sorry(this,i18n("There is nothing selected!")); 3792 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3793 return; 3793 return;
3794 } 3794 }
3795 showIncidence(); 3795 showIncidence();
3796 getEventViewerDialog()->print(); 3796 getEventViewerDialog()->print();
3797 3797
3798} 3798}
3799void CalendarView::printSetup() 3799void CalendarView::printSetup()
3800{ 3800{
3801#ifndef KORG_NOPRINTER 3801#ifndef KORG_NOPRINTER
3802 createPrinter(); 3802 createPrinter();
3803 3803
3804 mCalPrinter->setupPrinter(); 3804 mCalPrinter->setupPrinter();
3805#endif 3805#endif
3806} 3806}
3807 3807
3808void CalendarView::print() 3808void CalendarView::print()
3809{ 3809{
3810#ifndef KORG_NOPRINTER 3810#ifndef KORG_NOPRINTER
3811 createPrinter(); 3811 createPrinter();
3812 3812
3813 DateList tmpDateList = mNavigator->selectedDates(); 3813 DateList tmpDateList = mNavigator->selectedDates();
3814 mCalPrinter->print(CalPrinter::Month, 3814 mCalPrinter->print(CalPrinter::Month,
3815 tmpDateList.first(), tmpDateList.last()); 3815 tmpDateList.first(), tmpDateList.last());
3816#endif 3816#endif
3817} 3817}
3818 3818
3819void CalendarView::printPreview() 3819void CalendarView::printPreview()
3820{ 3820{
3821#ifndef KORG_NOPRINTER 3821#ifndef KORG_NOPRINTER
3822 kdDebug() << "CalendarView::printPreview()" << endl; 3822 kdDebug() << "CalendarView::printPreview()" << endl;
3823 3823
3824 createPrinter(); 3824 createPrinter();
3825 3825
3826 DateList tmpDateList = mNavigator->selectedDates(); 3826 DateList tmpDateList = mNavigator->selectedDates();
3827 3827
3828 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3828 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3829 tmpDateList.last()); 3829 tmpDateList.last());
3830#endif 3830#endif
3831} 3831}
3832 3832
3833void CalendarView::exportICalendar() 3833void CalendarView::exportICalendar()
3834{ 3834{
3835 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3835 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3836 3836
3837 // Force correct extension 3837 // Force correct extension
3838 if (filename.right(4) != ".ics") filename += ".ics"; 3838 if (filename.right(4) != ".ics") filename += ".ics";
3839 3839
3840 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3840 FileStorage storage( mCalendar, filename, new ICalFormat() );
3841 storage.save(); 3841 storage.save();
3842} 3842}
3843 3843
3844bool CalendarView::exportVCalendar( QString filename ) 3844bool CalendarView::exportVCalendar( QString filename )
3845{ 3845{
3846 if (mCalendar->journals().count() > 0) { 3846 if (mCalendar->journals().count() > 0) {
3847 int result = KMessageBox::warningContinueCancel(this, 3847 int result = KMessageBox::warningContinueCancel(this,
3848 i18n("The journal entries can not be\nexported to a vCalendar file."), 3848 i18n("The journal entries can not be\nexported to a vCalendar file."),
3849 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3849 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3850 true); 3850 true);
3851 if (result != KMessageBox::Continue) return false; 3851 if (result != KMessageBox::Continue) return false;
3852 } 3852 }
3853 3853
3854 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3854 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3855 3855
3856 // Force correct extension 3856 // Force correct extension
3857 if (filename.right(4) != ".vcs") filename += ".vcs"; 3857 if (filename.right(4) != ".vcs") filename += ".vcs";
3858 3858
3859 FileStorage storage( mCalendar, filename, new VCalFormat ); 3859 FileStorage storage( mCalendar, filename, new VCalFormat );
3860 return storage.save(); 3860 return storage.save();
3861 3861
3862} 3862}
3863 3863
3864void CalendarView::eventUpdated(Incidence *) 3864void CalendarView::eventUpdated(Incidence *)
3865{ 3865{
3866 setModified(); 3866 setModified();
3867 // Don't call updateView here. The code, which has caused the update of the 3867 // Don't call updateView here. The code, which has caused the update of the
3868 // event is responsible for updating the view. 3868 // event is responsible for updating the view.
3869 // updateView(); 3869 // updateView();
3870} 3870}
3871 3871
3872void CalendarView::adaptNavigationUnits() 3872void CalendarView::adaptNavigationUnits()
3873{ 3873{
3874 if (mViewManager->currentView()->isEventView()) { 3874 if (mViewManager->currentView()->isEventView()) {
3875 int days = mViewManager->currentView()->currentDateCount(); 3875 int days = mViewManager->currentView()->currentDateCount();
3876 if (days == 1) { 3876 if (days == 1) {
3877 emit changeNavStringPrev(i18n("&Previous Day")); 3877 emit changeNavStringPrev(i18n("&Previous Day"));
3878 emit changeNavStringNext(i18n("&Next Day")); 3878 emit changeNavStringNext(i18n("&Next Day"));
3879 } else { 3879 } else {
3880 emit changeNavStringPrev(i18n("&Previous Week")); 3880 emit changeNavStringPrev(i18n("&Previous Week"));
3881 emit changeNavStringNext(i18n("&Next Week")); 3881 emit changeNavStringNext(i18n("&Next Week"));
3882 } 3882 }
3883 } 3883 }
3884} 3884}
3885 3885
3886void CalendarView::processMainViewSelection( Incidence *incidence ) 3886void CalendarView::processMainViewSelection( Incidence *incidence )
3887{ 3887{
3888 if ( incidence ) mTodoList->clearSelection(); 3888 if ( incidence ) mTodoList->clearSelection();
3889 processIncidenceSelection( incidence ); 3889 processIncidenceSelection( incidence );
3890} 3890}
3891 3891
3892void CalendarView::processTodoListSelection( Incidence *incidence ) 3892void CalendarView::processTodoListSelection( Incidence *incidence )
3893{ 3893{
3894 if ( incidence && mViewManager->currentView() ) { 3894 if ( incidence && mViewManager->currentView() ) {
3895 mViewManager->currentView()->clearSelection(); 3895 mViewManager->currentView()->clearSelection();
3896 } 3896 }
3897 processIncidenceSelection( incidence ); 3897 processIncidenceSelection( incidence );
3898} 3898}
3899 3899
3900void CalendarView::processIncidenceSelection( Incidence *incidence ) 3900void CalendarView::processIncidenceSelection( Incidence *incidence )
3901{ 3901{
3902 if ( incidence == mSelectedIncidence ) return; 3902 if ( incidence == mSelectedIncidence ) return;
3903 3903
3904 mSelectedIncidence = incidence; 3904 mSelectedIncidence = incidence;
3905 3905
3906 emit incidenceSelected( mSelectedIncidence ); 3906 emit incidenceSelected( mSelectedIncidence );
3907 3907
3908 if ( incidence && incidence->typeID() == eventID ) { 3908 if ( incidence && incidence->typeID() == eventID ) {
3909 Event *event = static_cast<Event *>( incidence ); 3909 Event *event = static_cast<Event *>( incidence );
3910 if ( event->organizer() == KOPrefs::instance()->email() ) { 3910 if ( event->organizer() == KOPrefs::instance()->email() ) {
3911 emit organizerEventsSelected( true ); 3911 emit organizerEventsSelected( true );
3912 } else { 3912 } else {
3913 emit organizerEventsSelected(false); 3913 emit organizerEventsSelected(false);
3914 } 3914 }
3915 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3915 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3916 KOPrefs::instance()->email() ) ) { 3916 KOPrefs::instance()->email() ) ) {
3917 emit groupEventsSelected( true ); 3917 emit groupEventsSelected( true );
3918 } else { 3918 } else {
3919 emit groupEventsSelected(false); 3919 emit groupEventsSelected(false);
3920 } 3920 }
3921 return; 3921 return;
3922 } else { 3922 } else {
3923 if ( incidence && incidence->typeID() == todoID ) { 3923 if ( incidence && incidence->typeID() == todoID ) {
3924 emit todoSelected( true ); 3924 emit todoSelected( true );
3925 Todo *event = static_cast<Todo *>( incidence ); 3925 Todo *event = static_cast<Todo *>( incidence );
3926 if ( event->organizer() == KOPrefs::instance()->email() ) { 3926 if ( event->organizer() == KOPrefs::instance()->email() ) {
3927 emit organizerEventsSelected( true ); 3927 emit organizerEventsSelected( true );
3928 } else { 3928 } else {
3929 emit organizerEventsSelected(false); 3929 emit organizerEventsSelected(false);
3930 } 3930 }
3931 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3931 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3932 KOPrefs::instance()->email() ) ) { 3932 KOPrefs::instance()->email() ) ) {
3933 emit groupEventsSelected( true ); 3933 emit groupEventsSelected( true );
3934 } else { 3934 } else {
3935 emit groupEventsSelected(false); 3935 emit groupEventsSelected(false);
3936 } 3936 }
3937 return; 3937 return;
3938 } else { 3938 } else {
3939 emit todoSelected( false ); 3939 emit todoSelected( false );
3940 emit organizerEventsSelected(false); 3940 emit organizerEventsSelected(false);
3941 emit groupEventsSelected(false); 3941 emit groupEventsSelected(false);
3942 } 3942 }
3943 return; 3943 return;
3944 } 3944 }
3945 3945
3946 /* if ( incidence && incidence->typeID() == todoID ) { 3946 /* if ( incidence && incidence->typeID() == todoID ) {
3947 emit todoSelected( true ); 3947 emit todoSelected( true );
3948 } else { 3948 } else {
3949 emit todoSelected( false ); 3949 emit todoSelected( false );
3950 }*/ 3950 }*/
3951} 3951}
3952 3952
3953 3953
3954void CalendarView::checkClipboard() 3954void CalendarView::checkClipboard()
3955{ 3955{
3956#ifndef KORG_NODND 3956#ifndef KORG_NODND
3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3958 emit pasteEnabled(true); 3958 emit pasteEnabled(true);
3959 } else { 3959 } else {
3960 emit pasteEnabled(false); 3960 emit pasteEnabled(false);
3961 } 3961 }
3962#endif 3962#endif
3963} 3963}
3964 3964
3965void CalendarView::showDates(const DateList &selectedDates) 3965void CalendarView::showDates(const DateList &selectedDates)
3966{ 3966{
3967 // kdDebug() << "CalendarView::selectDates()" << endl; 3967 // kdDebug() << "CalendarView::selectDates()" << endl;
3968 3968
3969 3969
3970 if ( !mBlockShowDates ) { 3970 if ( !mBlockShowDates ) {
3971 if ( mViewManager->currentView() ) { 3971 if ( mViewManager->currentView() ) {
3972 updateView( selectedDates.first(), selectedDates.last() ); 3972 updateView( selectedDates.first(), selectedDates.last() );
3973 } else { 3973 } else {
3974 mViewManager->showAgendaView(); 3974 mViewManager->showAgendaView();
3975 } 3975 }
3976 } 3976 }
3977 3977
3978 QDate date = selectedDates.first(); 3978 QDate date = selectedDates.first();
3979 if ( ! date.isValid() ) { 3979 if ( ! date.isValid() ) {
3980 topLevelWidget()->setCaption(""); 3980 topLevelWidget()->setCaption("");
3981 return; 3981 return;
3982 } 3982 }
3983 3983
3984 QString selDates; 3984 QString selDates;
3985 selDates = KGlobal::locale()->formatDate( date, true); 3985 selDates = KGlobal::locale()->formatDate( date, true);
3986 if (selectedDates.first() < selectedDates.last() ) 3986 if (selectedDates.first() < selectedDates.last() )
3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3988 else { 3988 else {
3989 QString addString; 3989 QString addString;
3990 if ( date == QDateTime::currentDateTime().date() ) 3990 if ( date == QDateTime::currentDateTime().date() )
3991 addString = i18n("Today"); 3991 addString = i18n("Today");
3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3993 addString = i18n("Tomorrow"); 3993 addString = i18n("Tomorrow");
3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3995 addString = i18n("Yesterday"); 3995 addString = i18n("Yesterday");
3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3997 addString = i18n("Day before yesterday"); 3997 addString = i18n("Day before yesterday");
3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3999 addString = i18n("Day after tomorrow"); 3999 addString = i18n("Day after tomorrow");
4000 if ( !addString.isEmpty() ) { 4000 if ( !addString.isEmpty() ) {
4001 topLevelWidget()->setCaption( addString+", " + selDates ); 4001 topLevelWidget()->setCaption( addString+", " + selDates );
4002 return; 4002 return;
4003 } 4003 }
4004 } 4004 }
4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
4006 4006
4007} 4007}
4008 4008
4009QPtrList<CalFilter> CalendarView::filters() 4009QPtrList<CalFilter> CalendarView::filters()
4010{ 4010{
4011 return mFilters; 4011 return mFilters;
4012 4012
4013} 4013}
4014void CalendarView::editFilters() 4014void CalendarView::editFilters()
4015{ 4015{
4016 // kdDebug() << "CalendarView::editFilters()" << endl; 4016 // kdDebug() << "CalendarView::editFilters()" << endl;
4017 4017
4018 CalFilter *filter = mFilters.first(); 4018 CalFilter *filter = mFilters.first();
4019 while(filter) { 4019 while(filter) {
4020 kdDebug() << " Filter: " << filter->name() << endl;
4021 filter = mFilters.next(); 4020 filter = mFilters.next();
4022 } 4021 }
4023 4022
4024 mDialogManager->showFilterEditDialog(&mFilters); 4023 mDialogManager->showFilterEditDialog(&mFilters);
4025 updateFilter(); 4024 updateFilter();
4026} 4025}
4027void CalendarView::toggleFilter() 4026void CalendarView::toggleFilter()
4028{ 4027{
4029 if ( mLeftFrame->isHidden() ) { 4028 if ( mLeftFrame->isHidden() ) {
4030 toggleExpand(); 4029 toggleExpand();
4031 showFilter( true ); 4030 showFilter( true );
4032 } else 4031 } else
4033 showFilter(! mCalEditView->isVisible()); 4032 showFilter(! mCalEditView->isVisible());
4034} 4033}
4035 4034
4036KOFilterView *CalendarView::filterView() 4035KOFilterView *CalendarView::filterView()
4037{ 4036{
4038 return mFilterView; 4037 return mFilterView;
4039} 4038}
4040void CalendarView::selectFilter( int fil ) 4039void CalendarView::selectFilter( int fil )
4041{ 4040{
4042 mFilterView->setSelectedFilter( fil ); 4041 mFilterView->setSelectedFilter( fil );
4042 updateUnmanagedViews();
4043} 4043}
4044void CalendarView::showFilter(bool visible) 4044void CalendarView::showFilter(bool visible)
4045{ 4045{
4046#if 1 4046#if 1
4047 if (visible) { 4047 if (visible) {
4048 mCalEditView->readConfig(); 4048 mCalEditView->readConfig();
4049 mCalEditView->show(); 4049 mCalEditView->show();
4050 QValueList<int> sizes; 4050 QValueList<int> sizes;
4051 sizes = mLeftFrame->sizes(); 4051 sizes = mLeftFrame->sizes();
4052 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4052 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4053 sizes.clear(); 4053 sizes.clear();
4054 sizes << 100; 4054 sizes << 100;
4055 sizes << 0; 4055 sizes << 0;
4056 sizes << 0; 4056 sizes << 0;
4057 sizes << 100; 4057 sizes << 100;
4058 mLeftFrame->setSizes(sizes); 4058 mLeftFrame->setSizes(sizes);
4059 } 4059 }
4060#if 0 4060#if 0
4061 sizes = mLeftFrame->sizes(); 4061 sizes = mLeftFrame->sizes();
4062 int ccc = 0; 4062 int ccc = 0;
4063 while ( ccc < sizes.count()) { 4063 while ( ccc < sizes.count()) {
4064 qDebug("size %d %d ", ccc, sizes[ccc]); 4064 qDebug("size %d %d ", ccc, sizes[ccc]);
4065 ++ccc; 4065 ++ccc;
4066 } 4066 }
4067#endif 4067#endif
4068 4068
4069 } 4069 }
4070 else { 4070 else {
4071 mCalEditView->hide(); 4071 mCalEditView->hide();
4072 } 4072 }
4073#else 4073#else
4074 if (visible) mFilterView->show(); 4074 if (visible) mFilterView->show();
4075 else mFilterView->hide(); 4075 else mFilterView->hide();
4076#endif 4076#endif
4077} 4077}
4078void CalendarView::toggleFilerEnabled( ) 4078void CalendarView::toggleFilerEnabled( )
4079{ 4079{
4080 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 4080 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
4081 if ( !mFilterView->filtersEnabled() ) 4081 if ( !mFilterView->filtersEnabled() )
4082 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 4082 topLevelWidget()->setCaption( i18n("Filter disabled ") );
4083 updateUnmanagedViews();
4083 4084
4084} 4085}
4085void CalendarView::updateFilter() 4086void CalendarView::updateFilter()
4086{ 4087{
4087 CalFilter *filter = mFilterView->selectedFilter(); 4088 CalFilter *filter = mFilterView->selectedFilter();
4088 if (filter) { 4089 if (filter) {
4089 QString mess; 4090 QString mess;
4090 if (mFilterView->filtersEnabled()) { 4091 if (mFilterView->filtersEnabled()) {
4091 mess = i18n("Filter selected: ")+filter->name(); 4092 mess = i18n("Filter selected: ")+filter->name();
4092 filter->setEnabled(true); 4093 filter->setEnabled(true);
4093 } 4094 }
4094 else filter->setEnabled(false); 4095 else filter->setEnabled(false);
4095 mCalendar->setFilter(filter); 4096 mCalendar->setFilter(filter);
4096 updateView(); 4097 updateView();
4097 if ( !mess.isEmpty() ) 4098 if ( !mess.isEmpty() )
4098 topLevelWidget()->setCaption( mess ); 4099 topLevelWidget()->setCaption( mess );
4099 4100
4100 } 4101 }
4101 emit filtersUpdated(); 4102 emit filtersUpdated();
4102} 4103}
4103 4104
4104void CalendarView::filterEdited() 4105void CalendarView::filterEdited()
4105{ 4106{
4106 mFilterView->updateFilters(); 4107 mFilterView->updateFilters();
4107 updateFilter(); 4108 updateFilter();
4108 writeSettings(); 4109 writeSettings();
4109} 4110}
4110 4111
4111 4112
4112void CalendarView::takeOverEvent() 4113void CalendarView::takeOverEvent()
4113{ 4114{
4114 Incidence *incidence = currentSelection(); 4115 Incidence *incidence = currentSelection();
4115 4116
4116 if (!incidence) return; 4117 if (!incidence) return;
4117 4118
4118 incidence->setOrganizer(KOPrefs::instance()->email()); 4119 incidence->setOrganizer(KOPrefs::instance()->email());
4119 incidence->recreate(); 4120 incidence->recreate();
4120 incidence->setReadOnly(false); 4121 incidence->setReadOnly(false);
4121 4122
4122 updateView(); 4123 updateView();
4123} 4124}
4124 4125
4125void CalendarView::takeOverCalendar() 4126void CalendarView::takeOverCalendar()
4126{ 4127{
4127 // TODO: Create Calendar::allIncidences() function and use it here 4128 // TODO: Create Calendar::allIncidences() function and use it here
4128 4129
4129 clearAllViews(); 4130 clearAllViews();
4130 QPtrList<Event> events = mCalendar->events(); 4131 QPtrList<Event> events = mCalendar->events();
4131 for(uint i=0; i<events.count(); ++i) { 4132 for(uint i=0; i<events.count(); ++i) {
4132 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4133 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4133 events.at(i)->recreate(); 4134 events.at(i)->recreate();
4134 events.at(i)->setReadOnly(false); 4135 events.at(i)->setReadOnly(false);
4135 } 4136 }
4136 4137
4137 QPtrList<Todo> todos = mCalendar->todos(); 4138 QPtrList<Todo> todos = mCalendar->todos();
4138 for(uint i=0; i<todos.count(); ++i) { 4139 for(uint i=0; i<todos.count(); ++i) {
4139 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4140 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4140 todos.at(i)->recreate(); 4141 todos.at(i)->recreate();
4141 todos.at(i)->setReadOnly(false); 4142 todos.at(i)->setReadOnly(false);
4142 } 4143 }
4143 4144
4144 QPtrList<Journal> journals = mCalendar->journals(); 4145 QPtrList<Journal> journals = mCalendar->journals();
4145 for(uint i=0; i<journals.count(); ++i) { 4146 for(uint i=0; i<journals.count(); ++i) {
4146 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4147 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4147 journals.at(i)->recreate(); 4148 journals.at(i)->recreate();
4148 journals.at(i)->setReadOnly(false); 4149 journals.at(i)->setReadOnly(false);
4149 } 4150 }
4150 4151
4151 updateView(); 4152 updateView();
4152} 4153}
4153 4154
4154void CalendarView::showIntro() 4155void CalendarView::showIntro()
4155{ 4156{
4156 kdDebug() << "To be implemented." << endl; 4157 kdDebug() << "To be implemented." << endl;
4157} 4158}
4158 4159
4159QWidgetStack *CalendarView::viewStack() 4160QWidgetStack *CalendarView::viewStack()
4160{ 4161{
4161 return mRightFrame; 4162 return mRightFrame;
4162} 4163}
4163 4164
4164QWidget *CalendarView::leftFrame() 4165QWidget *CalendarView::leftFrame()
4165{ 4166{
4166 return ( QWidget *)mLeftFrame; 4167 return ( QWidget *)mLeftFrame;
4167} 4168}
4168 4169
4169DateNavigator *CalendarView::dateNavigator() 4170DateNavigator *CalendarView::dateNavigator()
4170{ 4171{
4171 return mNavigator; 4172 return mNavigator;
4172} 4173}
4173 4174
4174KDateNavigator* CalendarView::dateNavigatorWidget() 4175KDateNavigator* CalendarView::dateNavigatorWidget()
4175{ 4176{
4176 return mDateNavigator->navigatorView(); 4177 return mDateNavigator->navigatorView();
4177} 4178}
4178void CalendarView::toggleDateNavigatorWidget() 4179void CalendarView::toggleDateNavigatorWidget()
4179{ 4180{
4180 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4181 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4181 4182
4182 if (!KOPrefs::instance()->mShowDateNavigator ) 4183 if (!KOPrefs::instance()->mShowDateNavigator )
4183 mDateNavigator->hide(); 4184 mDateNavigator->hide();
4184 else 4185 else
4185 mDateNavigator->show(); 4186 mDateNavigator->show();
4186} 4187}
4187void CalendarView::addView(KOrg::BaseView *view) 4188void CalendarView::addView(KOrg::BaseView *view)
4188{ 4189{
4189 mViewManager->addView(view); 4190 mViewManager->addView(view);
4190} 4191}
4191 4192
4192void CalendarView::showView(KOrg::BaseView *view) 4193void CalendarView::showView(KOrg::BaseView *view)
4193{ 4194{
4194 mViewManager->showView(view, mLeftFrame->isVisible()); 4195 mViewManager->showView(view, mLeftFrame->isVisible());
4195} 4196}
4196 4197
4197Incidence *CalendarView::currentSelection() 4198Incidence *CalendarView::currentSelection()
4198{ 4199{
4199 return mViewManager->currentSelection(); 4200 return mViewManager->currentSelection();
4200} 4201}
4201void CalendarView::toggleAllDaySize() 4202void CalendarView::toggleAllDaySize()
4202{ 4203{
4203 /* 4204 /*
4204 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4205 if ( KOPrefs::instance()->mAllDaySize > 47 )
4205 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4206 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4206 else 4207 else
4207 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4208 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4208 */ 4209 */
4209 viewManager()->agendaView()->toggleAllDay(); 4210 viewManager()->agendaView()->toggleAllDay();
4210} 4211}
4211void CalendarView::toggleExpand() 4212void CalendarView::toggleExpand()
4212{ 4213{
4213 // if ( mLeftFrame->isHidden() ) { 4214 // if ( mLeftFrame->isHidden() ) {
4214 // mLeftFrame->show(); 4215 // mLeftFrame->show();
4215 // emit calendarViewExpanded( false ); 4216 // emit calendarViewExpanded( false );
4216 // } else { 4217 // } else {
4217 // mLeftFrame->hide(); 4218 // mLeftFrame->hide();
4218 // emit calendarViewExpanded( true ); 4219 // emit calendarViewExpanded( true );
4219 // } 4220 // }
4220 //qDebug(" CalendarView::toggleExpand()"); 4221 //qDebug(" CalendarView::toggleExpand()");
4221 globalFlagBlockAgenda = 1; 4222 globalFlagBlockAgenda = 1;
4222 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4223 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4223 globalFlagBlockAgenda = 5; 4224 globalFlagBlockAgenda = 5;
4224 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4225 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4225 //mViewManager->showView( 0, true ); 4226 //mViewManager->showView( 0, true );
4226} 4227}
4227 4228
4228void CalendarView::calendarModified( bool modified, Calendar * ) 4229void CalendarView::calendarModified( bool modified, Calendar * )
4229{ 4230{
4230 setModified( modified ); 4231 setModified( modified );
4231} 4232}
4232 4233
4233Todo *CalendarView::selectedTodo() 4234Todo *CalendarView::selectedTodo()
4234{ 4235{
4235 Incidence *incidence = currentSelection(); 4236 Incidence *incidence = currentSelection();
4236 if ( incidence && incidence->typeID() == todoID ) { 4237 if ( incidence && incidence->typeID() == todoID ) {
4237 return static_cast<Todo *>( incidence ); 4238 return static_cast<Todo *>( incidence );
4238 } 4239 }
4239 4240
4240 incidence = mTodoList->selectedIncidences().first(); 4241 incidence = mTodoList->selectedIncidences().first();
4241 if ( incidence && incidence->typeID() == todoID ) { 4242 if ( incidence && incidence->typeID() == todoID ) {
4242 return static_cast<Todo *>( incidence ); 4243 return static_cast<Todo *>( incidence );
4243 } 4244 }
4244 4245
4245 return 0; 4246 return 0;
4246} 4247}
4247 4248
4248void CalendarView::dialogClosing(Incidence *in) 4249void CalendarView::dialogClosing(Incidence *in)
4249{ 4250{
4250 // mDialogList.remove(in); 4251 // mDialogList.remove(in);
4251} 4252}
4252 4253
4253void CalendarView::showIncidence() 4254void CalendarView::showIncidence()
4254{ 4255{
4255 mViewerCallerIsSearchDialog = false; 4256 mViewerCallerIsSearchDialog = false;
4256 Incidence *incidence = currentSelection(); 4257 Incidence *incidence = currentSelection();
4257 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4258 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4258 if ( incidence ) { 4259 if ( incidence ) {
4259 ShowIncidenceVisitor v; 4260 ShowIncidenceVisitor v;
4260 v.act( incidence, this ); 4261 v.act( incidence, this );
4261 } 4262 }
4262} 4263}
4263void CalendarView::editIncidenceDescription() 4264void CalendarView::editIncidenceDescription()
4264{ 4265{
4265 mFlagEditDescription = true; 4266 mFlagEditDescription = true;
4266 editIncidence(); 4267 editIncidence();
4267 mFlagEditDescription = false; 4268 mFlagEditDescription = false;
4268} 4269}
4269void CalendarView::editIncidence() 4270void CalendarView::editIncidence()
4270{ 4271{
4271 // qDebug("editIncidence() "); 4272 // qDebug("editIncidence() ");
4272 Incidence *incidence = currentSelection(); 4273 Incidence *incidence = currentSelection();
4273 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4274 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4274 if ( incidence ) { 4275 if ( incidence ) {
4275 EditIncidenceVisitor v; 4276 EditIncidenceVisitor v;
4276 v.act( incidence, this ); 4277 v.act( incidence, this );
4277 } 4278 }
4278} 4279}
4279 4280
4280void CalendarView::deleteIncidence() 4281void CalendarView::deleteIncidence()
4281{ 4282{
4282 Incidence *incidence = currentSelection(); 4283 Incidence *incidence = currentSelection();
4283 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4284 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4284 if ( incidence ) { 4285 if ( incidence ) {
4285 deleteIncidence(incidence); 4286 deleteIncidence(incidence);
4286 } 4287 }
4287} 4288}
4288void CalendarView::showIncidence(QString uid) 4289void CalendarView::showIncidence(QString uid)
4289{ 4290{
4290 Incidence *inc = mCalendar->incidence( uid ); 4291 Incidence *inc = mCalendar->incidence( uid );
4291 if ( inc ) 4292 if ( inc )
4292 showIncidence( inc ); 4293 showIncidence( inc );
4293} 4294}
4294void CalendarView::showIncidence(Incidence *incidence) 4295void CalendarView::showIncidence(Incidence *incidence)
4295{ 4296{
4296 mViewerCallerIsSearchDialog = false; 4297 mViewerCallerIsSearchDialog = false;
4297 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4298 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4298 if ( sender() && mDialogManager->getSearchDialog() ) { 4299 if ( sender() && mDialogManager->getSearchDialog() ) {
4299 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4300 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4300 mViewerCallerIsSearchDialog = true; 4301 mViewerCallerIsSearchDialog = true;
4301 } 4302 }
4302 } 4303 }
4303 if ( incidence ) { 4304 if ( incidence ) {
4304 ShowIncidenceVisitor v; 4305 ShowIncidenceVisitor v;
4305 v.act( incidence, this ); 4306 v.act( incidence, this );
4306 } 4307 }
4307} 4308}
4308 4309
4309void CalendarView::editIncidence(Incidence *incidence) 4310void CalendarView::editIncidence(Incidence *incidence)
4310{ 4311{
4311 if ( incidence ) { 4312 if ( incidence ) {
4312 4313
4313 EditIncidenceVisitor v; 4314 EditIncidenceVisitor v;
4314 v.act( incidence, this ); 4315 v.act( incidence, this );
4315 4316
4316 } 4317 }
4317} 4318}
4318 4319
4319void CalendarView::deleteIncidence(Incidence *incidence) 4320void CalendarView::deleteIncidence(Incidence *incidence)
4320{ 4321{
4321 //qDebug(" CalendarView::deleteIncidence "); 4322 //qDebug(" CalendarView::deleteIncidence ");
4322 if ( incidence ) { 4323 if ( incidence ) {
4323 DeleteIncidenceVisitor v; 4324 DeleteIncidenceVisitor v;
4324 v.act( incidence, this ); 4325 v.act( incidence, this );
4325 } 4326 }
4326} 4327}
4327 4328
4328 4329
4329void CalendarView::lookForOutgoingMessages() 4330void CalendarView::lookForOutgoingMessages()
4330{ 4331{
4331 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4332 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4332 ogd->loadMessages(); 4333 ogd->loadMessages();
4333} 4334}
4334 4335
4335void CalendarView::lookForIncomingMessages() 4336void CalendarView::lookForIncomingMessages()
4336{ 4337{
4337 IncomingDialog *icd = mDialogManager->incomingDialog(); 4338 IncomingDialog *icd = mDialogManager->incomingDialog();
4338 icd->retrieve(); 4339 icd->retrieve();
4339} 4340}
4340 4341
4341bool CalendarView::removeCompletedSubTodos( Todo* t ) 4342bool CalendarView::removeCompletedSubTodos( Todo* t )
4342{ 4343{
4343 bool deleteTodo = true; 4344 bool deleteTodo = true;
4344 QPtrList<Incidence> subTodos; 4345 QPtrList<Incidence> subTodos;
4345 Incidence *aTodo; 4346 Incidence *aTodo;
4346 subTodos = t->relations(); 4347 subTodos = t->relations();
4347 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4348 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4348 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4349 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4349 deleteTodo = false; 4350 deleteTodo = false;
4350 } 4351 }
4351 if ( deleteTodo ) { 4352 if ( deleteTodo ) {
4352 if ( t->isCompleted() && !t->doesRecur()) { 4353 if ( t->isCompleted() && !t->doesRecur()) {
4353 checkExternalId( t ); 4354 checkExternalId( t );
4354 mCalendar->deleteTodo( t ); 4355 mCalendar->deleteTodo( t );
4355 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4356 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4356 } 4357 }
4357 else 4358 else
4358 deleteTodo = false; 4359 deleteTodo = false;
4359 } 4360 }
4360 return deleteTodo; 4361 return deleteTodo;
4361 4362
4362} 4363}
4363void CalendarView::purgeCompleted() 4364void CalendarView::purgeCompleted()
4364{ 4365{
4365 int result = KMessageBox::warningContinueCancel(this, 4366 int result = KMessageBox::warningContinueCancel(this,
4366 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4367 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4367 4368
4368 if (result == KMessageBox::Continue) { 4369 if (result == KMessageBox::Continue) {
4369 4370
4370 QPtrList<Todo> todoCal; 4371 QPtrList<Todo> todoCal;
4371 QPtrList<Todo> rootTodos; 4372 QPtrList<Todo> rootTodos;
4372 //QPtrList<Incidence> rel; 4373 //QPtrList<Incidence> rel;
4373 Todo *aTodo;//, *rTodo; 4374 Todo *aTodo;//, *rTodo;
4374 Incidence *rIncidence; 4375 Incidence *rIncidence;
4375 bool childDelete = false; 4376 bool childDelete = false;
4376 bool deletedOne = true; 4377 bool deletedOne = true;
4377 todoCal = calendar()->todos(); 4378 todoCal = calendar()->todos();
4378 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4379 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4379 if ( !aTodo->relatedTo() ) 4380 if ( !aTodo->relatedTo() )
4380 rootTodos.append( aTodo ); 4381 rootTodos.append( aTodo );
4381 } 4382 }
4382 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4383 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4383 removeCompletedSubTodos( aTodo ); 4384 removeCompletedSubTodos( aTodo );
4384 } 4385 }
4385 4386
4386 updateView(); 4387 updateView();
4387 } 4388 }
4388} 4389}
4389 4390
4390void CalendarView::slotCalendarChanged() 4391void CalendarView::slotCalendarChanged()
4391{ 4392{
4392 ; 4393 ;
4393} 4394}
4394 4395
4395void CalendarView::keyPressEvent ( QKeyEvent *e) 4396void CalendarView::keyPressEvent ( QKeyEvent *e)
4396{ 4397{
4397 //qDebug(" alendarView::keyPressEvent "); 4398 //qDebug(" alendarView::keyPressEvent ");
4398 e->ignore(); 4399 e->ignore();
4399} 4400}
4400 4401
4401 4402
4402bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4403bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4403{ 4404{
4404 // mSyncManager = manager; 4405 // mSyncManager = manager;
4405 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4406 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4406 qDebug("KO: SyncKDE request detected!"); 4407 qDebug("KO: SyncKDE request detected!");
4407 } 4408 }
4408 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4409 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4409 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4410 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4410 return syncCalendar( filename, mode ); 4411 return syncCalendar( filename, mode );
4411} 4412}
4412bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4413bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4413{ 4414{
4414 //mSyncManager = manager; 4415 //mSyncManager = manager;
4415 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4416 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4416 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4417 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4417 if ( resource == "sharp" ) 4418 if ( resource == "sharp" )
4418 syncExternal( 0 ); 4419 syncExternal( 0 );
4419 if ( resource == "phone" ) 4420 if ( resource == "phone" )
4420 syncExternal( 1 ); 4421 syncExternal( 1 );
4421 // pending setmodified 4422 // pending setmodified
4422 return true; 4423 return true;
4423} 4424}
4424void CalendarView::setSyncManager(KSyncManager* manager) 4425void CalendarView::setSyncManager(KSyncManager* manager)
4425{ 4426{
4426 mSyncManager = manager; 4427 mSyncManager = manager;
4427} 4428}
4428 4429
4429void CalendarView::removeSyncInfo( QString syncProfile) 4430void CalendarView::removeSyncInfo( QString syncProfile)
4430{ 4431{
4431 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4432 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4432 mCalendar->removeSyncInfo( syncProfile ); 4433 mCalendar->removeSyncInfo( syncProfile );
4433 4434
4434} 4435}
4435 4436
4436void CalendarView::undo_delete() 4437void CalendarView::undo_delete()
4437{ 4438{
4438 //qDebug("undo_delete() "); 4439 //qDebug("undo_delete() ");
4439 Incidence* undo = mCalendar->undoIncidence(); 4440 Incidence* undo = mCalendar->undoIncidence();
4440 if ( !undo ) { 4441 if ( !undo ) {
4441 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4442 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4442 i18n("KO/Pi")); 4443 i18n("KO/Pi"));
4443 return; 4444 return;
4444 } 4445 }
4445 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4446 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4446 i18n("\nAre you sure you want\nto restore this?"), 4447 i18n("\nAre you sure you want\nto restore this?"),
4447 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4448 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4448 mCalendar->undoDeleteIncidence(); 4449 mCalendar->undoDeleteIncidence();
4449 updateView(); 4450 updateView();
4450 } 4451 }
4451} 4452}
4452 4453
4453void CalendarView::slotViewerClosed() 4454void CalendarView::slotViewerClosed()
4454{ 4455{
4455 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4456 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4456} 4457}
4457 4458
4458void CalendarView::resetFocus() 4459void CalendarView::resetFocus()
4459{ 4460{
4460 if ( mViewerCallerIsSearchDialog ) { 4461 if ( mViewerCallerIsSearchDialog ) {
4461 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4462 if ( mDialogManager->getSearchDialog()->isVisible() ){
4462 mDialogManager->getSearchDialog()->raise(); 4463 mDialogManager->getSearchDialog()->raise();
4463 mDialogManager->getSearchDialog()->setActiveWindow(); 4464 mDialogManager->getSearchDialog()->setActiveWindow();
4464 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4465 mDialogManager->getSearchDialog()->listview()->resetFocus();
4465 } else 4466 } else
4466 mViewerCallerIsSearchDialog = false; 4467 mViewerCallerIsSearchDialog = false;
4467 } 4468 }
4468 if ( !mViewerCallerIsSearchDialog ) { 4469 if ( !mViewerCallerIsSearchDialog ) {
4469 //mViewManager->currentView()->setFocus(); 4470 //mViewManager->currentView()->setFocus();
4470 //qDebug("sssssssssssssssset focus "); 4471 //qDebug("sssssssssssssssset focus ");
4471 topLevelWidget()->raise(); 4472 topLevelWidget()->raise();
4472 setActiveWindow(); 4473 setActiveWindow();
4473 //setFocus(); 4474 //setFocus();
4474 } 4475 }
4475 mViewerCallerIsSearchDialog = false; 4476 mViewerCallerIsSearchDialog = false;
4476} 4477}
4477 4478
4478void CalendarView::showNextAlarms() 4479void CalendarView::showNextAlarms()
4479{ 4480{
4480 QString message; 4481 QString message;
4481 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4482 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4482 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4483 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4483 QString sum = mCalendar->nextSummary(); 4484 QString sum = mCalendar->nextSummary();
4484 QDateTime nextA = mNextAlarmDateTime; 4485 QDateTime nextA = mNextAlarmDateTime;
4485 QDateTime cur = QDateTime::currentDateTime(); 4486 QDateTime cur = QDateTime::currentDateTime();
4486 int secs = cur.secsTo( nextA ); 4487 int secs = cur.secsTo( nextA );
4487 int min = secs /60; 4488 int min = secs /60;
4488 int hours = min /60; 4489 int hours = min /60;
4489 min = min % 60; 4490 min = min % 60;
4490 int days = hours /24; 4491 int days = hours /24;
4491 hours = hours % 24; 4492 hours = hours % 24;
4492 4493
4493 //message = i18n("The next alarm is in:\n"); 4494 //message = i18n("The next alarm is in:\n");
4494 if ( days > 1 ) 4495 if ( days > 1 )
4495 message += i18n("%1 days\n").arg( days ); 4496 message += i18n("%1 days\n").arg( days );
4496 else if ( days == 1 ) 4497 else if ( days == 1 )
4497 message += i18n("1 day\n"); 4498 message += i18n("1 day\n");
4498 if ( hours > 1 ) 4499 if ( hours > 1 )
4499 message += i18n("%1 hours\n").arg( hours ); 4500 message += i18n("%1 hours\n").arg( hours );
4500 else if ( hours == 1 ) 4501 else if ( hours == 1 )
4501 message += i18n("1 hour\n"); 4502 message += i18n("1 hour\n");
4502 if ( min > 1 ) 4503 if ( min > 1 )
4503 message += i18n("%1 minutes\n").arg( min ); 4504 message += i18n("%1 minutes\n").arg( min );
4504 else if ( min == 1 ) 4505 else if ( min == 1 )
4505 message += i18n("1 minute\n"); 4506 message += i18n("1 minute\n");
4506 if ( message.isEmpty() ) 4507 if ( message.isEmpty() )
4507 message = i18n("The next alarm is in\nless than one minute!"); 4508 message = i18n("The next alarm is in\nless than one minute!");
4508 else 4509 else
4509 message = i18n("The next alarm is in:\n") + message; 4510 message = i18n("The next alarm is in:\n") + message;
4510 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4511 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4511 } else { 4512 } else {
4512 message = i18n("There is no next alarm."); 4513 message = i18n("There is no next alarm.");
4513 4514
4514 } 4515 }
4515#ifdef DESKTOP_VERSION 4516#ifdef DESKTOP_VERSION
4516 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4517 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4517 message += i18n("\nThe internal alarm notification is disabled!\n"); 4518 message += i18n("\nThe internal alarm notification is disabled!\n");
4518 message += i18n("Enable it in the settings menu, TAB alarm."); 4519 message += i18n("Enable it in the settings menu, TAB alarm.");
4519 } 4520 }
4520 4521
4521#endif 4522#endif
4522 KMessageBox::information( this, message); 4523 KMessageBox::information( this, message);
4523} 4524}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 0367bea..48320a5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1320,1237 +1320,1237 @@ void MainWindow::initActions()
1320 navigatorToolBar->setHorizontalStretchable (true ); 1320 navigatorToolBar->setHorizontalStretchable (true );
1321 iconToolBar->setVerticalStretchable (true ); 1321 iconToolBar->setVerticalStretchable (true );
1322 viewToolBar->setVerticalStretchable (true ); 1322 viewToolBar->setVerticalStretchable (true );
1323 navigatorToolBar->setVerticalStretchable (true ); 1323 navigatorToolBar->setVerticalStretchable (true );
1324 configureToolBarMenu->setItemChecked( 5, true ); 1324 configureToolBarMenu->setItemChecked( 5, true );
1325 } 1325 }
1326 if (p-> mShowIconFilter) 1326 if (p-> mShowIconFilter)
1327 configureToolBarMenu->setItemChecked( 7, true ); 1327 configureToolBarMenu->setItemChecked( 7, true );
1328 if (p-> mShowIconOnetoolbar) 1328 if (p-> mShowIconOnetoolbar)
1329 configureToolBarMenu->setItemChecked( 6, true ); 1329 configureToolBarMenu->setItemChecked( 6, true );
1330 1330
1331 1331
1332 if ( filterMenubar ) { 1332 if ( filterMenubar ) {
1333 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1333 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1334 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1334 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1335 } 1335 }
1336 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1336 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1337 configureAgenda( p->mHourSize ); 1337 configureAgenda( p->mHourSize );
1338 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1338 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1339} 1339}
1340 1340
1341void MainWindow::exportToPhone( int mode ) 1341void MainWindow::exportToPhone( int mode )
1342{ 1342{
1343 1343
1344 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1344 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1345 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1345 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1346 KOex2phonePrefs ex2phone; 1346 KOex2phonePrefs ex2phone;
1347 1347
1348 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1348 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1349 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1349 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1350 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1350 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1351 if ( mode == 1 ) 1351 if ( mode == 1 )
1352 ex2phone.setCaption(i18n("Export complete calendar")); 1352 ex2phone.setCaption(i18n("Export complete calendar"));
1353 if ( mode == 2 ) 1353 if ( mode == 2 )
1354 ex2phone.setCaption(i18n("Export filtered calendar")); 1354 ex2phone.setCaption(i18n("Export filtered calendar"));
1355 1355
1356 if ( !ex2phone.exec() ) { 1356 if ( !ex2phone.exec() ) {
1357 return; 1357 return;
1358 } 1358 }
1359 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1359 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1360 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1360 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1361 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1361 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1362 1362
1363 int inFuture = 0; 1363 int inFuture = 0;
1364 if ( ex2phone.mWriteBackFuture->isChecked() ) 1364 if ( ex2phone.mWriteBackFuture->isChecked() )
1365 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1365 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1366 QPtrList<Incidence> delSel; 1366 QPtrList<Incidence> delSel;
1367 if ( mode == 1 ) 1367 if ( mode == 1 )
1368 delSel = mCalendar->rawIncidences(); 1368 delSel = mCalendar->rawIncidences();
1369 if ( mode == 2 ) 1369 if ( mode == 2 )
1370 delSel = mCalendar->incidences(); 1370 delSel = mCalendar->incidences();
1371 CalendarLocal* cal = new CalendarLocal(); 1371 CalendarLocal* cal = new CalendarLocal();
1372 cal->setLocalTime(); 1372 cal->setLocalTime();
1373 Incidence *incidence = delSel.first(); 1373 Incidence *incidence = delSel.first();
1374 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1374 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1375 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1375 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1376 while ( incidence ) { 1376 while ( incidence ) {
1377 if ( incidence->typeID() != journalID ) { 1377 if ( incidence->typeID() != journalID ) {
1378 bool add = true; 1378 bool add = true;
1379 if ( inFuture ) { 1379 if ( inFuture ) {
1380 QDateTime dt; 1380 QDateTime dt;
1381 if ( incidence->typeID() == todoID ) { 1381 if ( incidence->typeID() == todoID ) {
1382 Todo * t = (Todo*)incidence; 1382 Todo * t = (Todo*)incidence;
1383 if ( t->hasDueDate() ) 1383 if ( t->hasDueDate() )
1384 dt = t->dtDue(); 1384 dt = t->dtDue();
1385 else 1385 else
1386 dt = cur.addSecs( 62 ); 1386 dt = cur.addSecs( 62 );
1387 } 1387 }
1388 else { 1388 else {
1389 bool ok; 1389 bool ok;
1390 dt = incidence->getNextOccurence( cur, &ok ); 1390 dt = incidence->getNextOccurence( cur, &ok );
1391 if ( !ok ) 1391 if ( !ok )
1392 dt = cur.addSecs( -62 ); 1392 dt = cur.addSecs( -62 );
1393 } 1393 }
1394 if ( dt < cur || dt > end ) { 1394 if ( dt < cur || dt > end ) {
1395 add = false; 1395 add = false;
1396 } 1396 }
1397 } 1397 }
1398 if ( add ) { 1398 if ( add ) {
1399 Incidence *in = incidence->clone(); 1399 Incidence *in = incidence->clone();
1400 cal->addIncidence( in ); 1400 cal->addIncidence( in );
1401 } 1401 }
1402 } 1402 }
1403 incidence = delSel.next(); 1403 incidence = delSel.next();
1404 } 1404 }
1405 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1405 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1406 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1406 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1407 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1407 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1408 1408
1409 setCaption( i18n("Writing to phone...")); 1409 setCaption( i18n("Writing to phone..."));
1410 if ( PhoneFormat::writeToPhone( cal ) ) 1410 if ( PhoneFormat::writeToPhone( cal ) )
1411 setCaption( i18n("Export to phone successful!")); 1411 setCaption( i18n("Export to phone successful!"));
1412 else 1412 else
1413 setCaption( i18n("Error exporting to phone!")); 1413 setCaption( i18n("Error exporting to phone!"));
1414 delete cal; 1414 delete cal;
1415} 1415}
1416 1416
1417 1417
1418void MainWindow::setDefaultPreferences() 1418void MainWindow::setDefaultPreferences()
1419{ 1419{
1420 KOPrefs *p = KOPrefs::instance(); 1420 KOPrefs *p = KOPrefs::instance();
1421 1421
1422 p->mCompactDialogs = true; 1422 p->mCompactDialogs = true;
1423 p->mConfirm = true; 1423 p->mConfirm = true;
1424 // p->mEnableQuickTodo = false; 1424 // p->mEnableQuickTodo = false;
1425 1425
1426} 1426}
1427 1427
1428QString MainWindow::resourcePath() 1428QString MainWindow::resourcePath()
1429{ 1429{
1430 return KGlobal::iconLoader()->iconPath(); 1430 return KGlobal::iconLoader()->iconPath();
1431} 1431}
1432 1432
1433void MainWindow::displayText( QString text ,QString cap ) 1433void MainWindow::displayText( QString text ,QString cap )
1434{ 1434{
1435 QDialog dia( this, "name", true ); ; 1435 QDialog dia( this, "name", true ); ;
1436 dia.setCaption( cap ); 1436 dia.setCaption( cap );
1437 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1437 QVBoxLayout* lay = new QVBoxLayout( &dia );
1438 lay->setSpacing( 3 ); 1438 lay->setSpacing( 3 );
1439 lay->setMargin( 3 ); 1439 lay->setMargin( 3 );
1440 QTextBrowser tb ( &dia ); 1440 QTextBrowser tb ( &dia );
1441 lay->addWidget( &tb ); 1441 lay->addWidget( &tb );
1442 tb.setText( text ); 1442 tb.setText( text );
1443#ifdef DESKTOP_VERSION 1443#ifdef DESKTOP_VERSION
1444 dia.resize( 640, 480); 1444 dia.resize( 640, 480);
1445#else 1445#else
1446 dia.showMaximized(); 1446 dia.showMaximized();
1447#endif 1447#endif
1448 dia.exec(); 1448 dia.exec();
1449} 1449}
1450 1450
1451void MainWindow::features() 1451void MainWindow::features()
1452{ 1452{
1453 1453
1454 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1454 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1455} 1455}
1456 1456
1457void MainWindow::usertrans() 1457void MainWindow::usertrans()
1458{ 1458{
1459 1459
1460 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1460 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1461} 1461}
1462 1462
1463void MainWindow::storagehowto() 1463void MainWindow::storagehowto()
1464{ 1464{
1465 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1465 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1466} 1466}
1467void MainWindow::timetrackinghowto() 1467void MainWindow::timetrackinghowto()
1468{ 1468{
1469 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1469 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1470} 1470}
1471void MainWindow::kdesynchowto() 1471void MainWindow::kdesynchowto()
1472{ 1472{
1473 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1473 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1474} 1474}
1475void MainWindow::multisynchowto() 1475void MainWindow::multisynchowto()
1476{ 1476{
1477 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1477 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1478} 1478}
1479void MainWindow::synchowto() 1479void MainWindow::synchowto()
1480{ 1480{
1481 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1481 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1482} 1482}
1483void MainWindow::faq() 1483void MainWindow::faq()
1484{ 1484{
1485 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1485 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1486 1486
1487} 1487}
1488void MainWindow::whatsNew() 1488void MainWindow::whatsNew()
1489{ 1489{
1490 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1490 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1491 1491
1492} 1492}
1493void MainWindow::licence() 1493void MainWindow::licence()
1494{ 1494{
1495 KApplication::showLicence(); 1495 KApplication::showLicence();
1496 1496
1497} 1497}
1498void MainWindow::about() 1498void MainWindow::about()
1499{ 1499{
1500 QString version; 1500 QString version;
1501#include <../version> 1501#include <../version>
1502 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1502 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1503 i18n("KOrganizer/Platform-independent\n") + 1503 i18n("KOrganizer/Platform-independent\n") +
1504 "(KO/Pi) " + version + " - " + 1504 "(KO/Pi) " + version + " - " +
1505 1505
1506#ifdef DESKTOP_VERSION 1506#ifdef DESKTOP_VERSION
1507 i18n("Desktop Edition\n") + 1507 i18n("Desktop Edition\n") +
1508#else 1508#else
1509 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1509 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1510#endif 1510#endif
1511 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1511 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1512} 1512}
1513void MainWindow::keyBindings() 1513void MainWindow::keyBindings()
1514{ 1514{
1515 QString cap = i18n("KO/Pi Keys + Colors"); 1515 QString cap = i18n("KO/Pi Keys + Colors");
1516 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1516 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1517 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1517 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1518 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1518 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1519 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1519 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1520 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1520 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1521 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1521 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1522 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1522 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1523 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1523 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1524 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1524 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1525 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1525 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1526 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1526 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1527 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1527 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1528 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1528 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1529 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1529 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1530 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1530 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1531 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1531 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1532 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1532 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1533 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1533 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1534 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1534 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1535 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1535 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1536 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1536 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1537 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1537 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1538 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1538 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1539 i18n("<p><h3>In agenda view:</h3></p>\n") + 1539 i18n("<p><h3>In agenda view:</h3></p>\n") +
1540 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1540 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1541 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1541 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1542 i18n("<p><h3>In todo view:</h3></p>\n") + 1542 i18n("<p><h3>In todo view:</h3></p>\n") +
1543 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1543 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1544 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1544 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1545 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1545 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1546 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1546 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1547 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1547 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1548 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1548 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1549 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1549 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1550 i18n("<p><h3>In list view:</h3></p>\n") + 1550 i18n("<p><h3>In list view:</h3></p>\n") +
1551 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1551 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1552 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1552 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1553 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1553 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1554 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1554 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1555 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1555 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1556 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1556 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1557 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1557 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1558 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1558 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1559 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1559 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1560 i18n("<p><b>E</b>: Edit item</p>\n") + 1560 i18n("<p><b>E</b>: Edit item</p>\n") +
1561 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1561 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1562 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1562 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1563 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1563 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1564 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1564 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1565 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1565 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1566 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1566 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1567 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1567 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1568 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1568 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1569 i18n("<p><b>White</b>: Item readonly</p>\n"); 1569 i18n("<p><b>White</b>: Item readonly</p>\n");
1570 displayText( text, cap); 1570 displayText( text, cap);
1571} 1571}
1572void MainWindow::aboutAutoSaving() 1572void MainWindow::aboutAutoSaving()
1573{ 1573{
1574 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1574 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1575 1575
1576 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1576 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1577 1577
1578} 1578}
1579void MainWindow::aboutKnownBugs() 1579void MainWindow::aboutKnownBugs()
1580{ 1580{
1581 QMessageBox* msg; 1581 QMessageBox* msg;
1582 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1582 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1583 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1583 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1584 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1584 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1585 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1585 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1586 i18n("\nor report them in the bugtracker on\n") + 1586 i18n("\nor report them in the bugtracker on\n") +
1587 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1587 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1588 QMessageBox::NoIcon, 1588 QMessageBox::NoIcon,
1589 QMessageBox::Ok, 1589 QMessageBox::Ok,
1590 QMessageBox::NoButton, 1590 QMessageBox::NoButton,
1591 QMessageBox::NoButton); 1591 QMessageBox::NoButton);
1592 msg->exec(); 1592 msg->exec();
1593 delete msg; 1593 delete msg;
1594 1594
1595} 1595}
1596 1596
1597QString MainWindow::defaultFileName() 1597QString MainWindow::defaultFileName()
1598{ 1598{
1599 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1599 return locateLocal( "data", "korganizer/mycalendar.ics" );
1600} 1600}
1601QString MainWindow::syncFileName() 1601QString MainWindow::syncFileName()
1602{ 1602{
1603#ifdef DESKTOP_VERSION 1603#ifdef DESKTOP_VERSION
1604 return locateLocal( "tmp", "synccalendar.ics" ); 1604 return locateLocal( "tmp", "synccalendar.ics" );
1605#else 1605#else
1606 return QString( "/tmp/synccalendar.ics" ); 1606 return QString( "/tmp/synccalendar.ics" );
1607#endif 1607#endif
1608} 1608}
1609#include "koglobals.h" 1609#include "koglobals.h"
1610#include <kcalendarsystem.h> 1610#include <kcalendarsystem.h>
1611void MainWindow::updateWeek(QDate seda) 1611void MainWindow::updateWeek(QDate seda)
1612{ 1612{
1613 int weekNum = KGlobal::locale()->weekNum ( seda ); 1613 int weekNum = KGlobal::locale()->weekNum ( seda );
1614 mWeekPixmap.fill( mWeekBgColor ); 1614 mWeekPixmap.fill( mWeekBgColor );
1615 QPainter p ( &mWeekPixmap ); 1615 QPainter p ( &mWeekPixmap );
1616 p.setFont( mWeekFont ); 1616 p.setFont( mWeekFont );
1617 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1617 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1618 p.end(); 1618 p.end();
1619 QIconSet icon3 ( mWeekPixmap ); 1619 QIconSet icon3 ( mWeekPixmap );
1620 mWeekAction->setIconSet ( icon3 ); 1620 mWeekAction->setIconSet ( icon3 );
1621 1621
1622} 1622}
1623void MainWindow::updateWeekNum(const DateList &selectedDates) 1623void MainWindow::updateWeekNum(const DateList &selectedDates)
1624{ 1624{
1625 updateWeek( selectedDates.first() ); 1625 updateWeek( selectedDates.first() );
1626} 1626}
1627void MainWindow::processIncidenceSelection( Incidence *incidence ) 1627void MainWindow::processIncidenceSelection( Incidence *incidence )
1628{ 1628{
1629 1629
1630 if ( !incidence ) { 1630 if ( !incidence ) {
1631 enableIncidenceActions( false ); 1631 enableIncidenceActions( false );
1632 1632
1633 mNewSubTodoAction->setEnabled( false ); 1633 mNewSubTodoAction->setEnabled( false );
1634 setCaptionToDates(); 1634 setCaptionToDates();
1635 return; 1635 return;
1636 1636
1637 } 1637 }
1638 1638
1639 //KGlobal::locale()->formatDateTime(nextA, true); 1639 //KGlobal::locale()->formatDateTime(nextA, true);
1640 QString startString = ""; 1640 QString startString = "";
1641 if ( incidence->typeID() != todoID ) { 1641 if ( incidence->typeID() != todoID ) {
1642 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1642 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1643 if ( incidence->doesFloat() ) { 1643 if ( incidence->doesFloat() ) {
1644 startString += ": "+incidence->dtStartDateStr( true ); 1644 startString += ": "+incidence->dtStartDateStr( true );
1645 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1645 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1646 1646
1647 } else { 1647 } else {
1648 startString = ": "+incidence->dtStartStr(true); 1648 startString = ": "+incidence->dtStartStr(true);
1649 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1649 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1650 1650
1651 } 1651 }
1652 1652
1653 } else { 1653 } else {
1654 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1654 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1655 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1655 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1656 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1656 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1657 1657
1658 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1658 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1659 bool ok; 1659 bool ok;
1660 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1660 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1661 if ( ok ) { 1661 if ( ok ) {
1662 int years = noc.date().year() - incidence->dtStart().date().year(); 1662 int years = noc.date().year() - incidence->dtStart().date().year();
1663 startString += i18n(" (%1 y.)"). arg( years ); 1663 startString += i18n(" (%1 y.)"). arg( years );
1664 } 1664 }
1665 } 1665 }
1666 else 1666 else
1667 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1667 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1668 } 1668 }
1669 1669
1670 } 1670 }
1671 else 1671 else
1672 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1672 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1673 if ( !incidence->location().isEmpty() ) 1673 if ( !incidence->location().isEmpty() )
1674 startString += " (" +incidence->location()+")"; 1674 startString += " (" +incidence->location()+")";
1675 setCaption( incidence->summary()+startString); 1675 setCaption( incidence->summary()+startString);
1676 1676
1677 enableIncidenceActions( true ); 1677 enableIncidenceActions( true );
1678 1678
1679 if ( incidence->typeID() == eventID ) { 1679 if ( incidence->typeID() == eventID ) {
1680 mShowAction->setText( i18n("Show Event...") ); 1680 mShowAction->setText( i18n("Show Event...") );
1681 mEditAction->setText( i18n("Edit Event...") ); 1681 mEditAction->setText( i18n("Edit Event...") );
1682 mDeleteAction->setText( i18n("Delete Event...") ); 1682 mDeleteAction->setText( i18n("Delete Event...") );
1683 1683
1684 mNewSubTodoAction->setEnabled( false ); 1684 mNewSubTodoAction->setEnabled( false );
1685 } else if ( incidence->typeID() == todoID ) { 1685 } else if ( incidence->typeID() == todoID ) {
1686 mShowAction->setText( i18n("Show Todo...") ); 1686 mShowAction->setText( i18n("Show Todo...") );
1687 mEditAction->setText( i18n("Edit Todo...") ); 1687 mEditAction->setText( i18n("Edit Todo...") );
1688 mDeleteAction->setText( i18n("Delete Todo...") ); 1688 mDeleteAction->setText( i18n("Delete Todo...") );
1689 1689
1690 mNewSubTodoAction->setEnabled( true ); 1690 mNewSubTodoAction->setEnabled( true );
1691 } else { 1691 } else {
1692 mShowAction->setText( i18n("Show...") ); 1692 mShowAction->setText( i18n("Show...") );
1693 mShowAction->setText( i18n("Edit...") ); 1693 mShowAction->setText( i18n("Edit...") );
1694 mShowAction->setText( i18n("Delete...") ); 1694 mShowAction->setText( i18n("Delete...") );
1695 1695
1696 mNewSubTodoAction->setEnabled( false ); 1696 mNewSubTodoAction->setEnabled( false );
1697 } 1697 }
1698} 1698}
1699 1699
1700void MainWindow::enableIncidenceActions( bool enabled ) 1700void MainWindow::enableIncidenceActions( bool enabled )
1701{ 1701{
1702 mShowAction->setEnabled( enabled ); 1702 mShowAction->setEnabled( enabled );
1703 mEditAction->setEnabled( enabled ); 1703 mEditAction->setEnabled( enabled );
1704 mDeleteAction->setEnabled( enabled ); 1704 mDeleteAction->setEnabled( enabled );
1705 1705
1706 mCloneAction->setEnabled( enabled ); 1706 mCloneAction->setEnabled( enabled );
1707 mMoveAction->setEnabled( enabled ); 1707 mMoveAction->setEnabled( enabled );
1708 mBeamAction->setEnabled( enabled ); 1708 mBeamAction->setEnabled( enabled );
1709 mCancelAction->setEnabled( enabled ); 1709 mCancelAction->setEnabled( enabled );
1710} 1710}
1711 1711
1712void MainWindow::importOL() 1712void MainWindow::importOL()
1713{ 1713{
1714#ifdef _OL_IMPORT_ 1714#ifdef _OL_IMPORT_
1715 mView->clearAllViews(); 1715 mView->clearAllViews();
1716 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1716 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1717 id->exec(); 1717 id->exec();
1718 delete id; 1718 delete id;
1719 mView->calendar()->checkAlarmForIncidence( 0, true ); 1719 mView->calendar()->checkAlarmForIncidence( 0, true );
1720 mView->updateView(); 1720 mView->updateView();
1721#endif 1721#endif
1722} 1722}
1723void MainWindow::importBday() 1723void MainWindow::importBday()
1724{ 1724{
1725 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1725 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1726 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1726 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1727 i18n("Import!"), i18n("Cancel"), 0, 1727 i18n("Import!"), i18n("Cancel"), 0,
1728 0, 1 ); 1728 0, 1 );
1729 if ( result == 0 ) { 1729 if ( result == 0 ) {
1730 mView->importBday(); 1730 mView->importBday();
1731 1731
1732 } 1732 }
1733 1733
1734 1734
1735} 1735}
1736void MainWindow::importQtopia() 1736void MainWindow::importQtopia()
1737{ 1737{
1738 //#ifndef DESKTOP_VERSION 1738 //#ifndef DESKTOP_VERSION
1739 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1739 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1740#ifdef DESKTOP_VERSION 1740#ifdef DESKTOP_VERSION
1741 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1741 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1742#endif 1742#endif
1743 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1743 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1744 i18n("Import!"), i18n("Cancel"), 0, 1744 i18n("Import!"), i18n("Cancel"), 0,
1745 0, 1 ); 1745 0, 1 );
1746 if ( result == 0 ) { 1746 if ( result == 0 ) {
1747#ifndef DESKTOP_VERSION 1747#ifndef DESKTOP_VERSION
1748 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1748 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1749 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1749 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1750 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1750 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1751#else 1751#else
1752 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1752 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1753 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1753 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1754 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1754 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1755#endif 1755#endif
1756 mView->importQtopia( categories, datebook, todolist ); 1756 mView->importQtopia( categories, datebook, todolist );
1757 } 1757 }
1758 mView->calendar()->reInitAlarmSettings(); 1758 mView->calendar()->reInitAlarmSettings();
1759#if 0 1759#if 0
1760 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1760 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1761 i18n("Not supported \non desktop!\n"), 1761 i18n("Not supported \non desktop!\n"),
1762 i18n("Ok"), i18n("Cancel"), 0, 1762 i18n("Ok"), i18n("Cancel"), 0,
1763 0, 1 ); 1763 0, 1 );
1764 1764
1765#endif 1765#endif
1766} 1766}
1767 1767
1768void MainWindow::saveOnClose() 1768void MainWindow::saveOnClose()
1769{ 1769{
1770 KOPrefs *p = KOPrefs::instance(); 1770 KOPrefs *p = KOPrefs::instance();
1771 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1771 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1772 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1772 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1773 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1773 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1774 if ( filterToolBar ) { 1774 if ( filterToolBar ) {
1775 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1775 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1776 } 1776 }
1777#ifdef DESKTOP_VERSION 1777#ifdef DESKTOP_VERSION
1778 1778
1779 QPoint myP; 1779 QPoint myP;
1780 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1780 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1781 if ( p->mToolBarHor ) 1781 if ( p->mToolBarHor )
1782 p->mToolBarUp = myP.y() > height()/2; 1782 p->mToolBarUp = myP.y() > height()/2;
1783 else 1783 else
1784 p->mToolBarUp = myP.x() > width()/2; 1784 p->mToolBarUp = myP.x() > width()/2;
1785 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1785 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1786 if ( p->mToolBarHorV ) 1786 if ( p->mToolBarHorV )
1787 p->mToolBarUpV = myP.y() > height()/2; 1787 p->mToolBarUpV = myP.y() > height()/2;
1788 else 1788 else
1789 p->mToolBarUpV = myP.x() > width()/2 ; 1789 p->mToolBarUpV = myP.x() > width()/2 ;
1790 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1790 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1791 if ( p->mToolBarHorN ) 1791 if ( p->mToolBarHorN )
1792 p->mToolBarUpN = myP.y() > height()/2; 1792 p->mToolBarUpN = myP.y() > height()/2;
1793 else 1793 else
1794 p->mToolBarUpN = myP.x() > width()/2 ; 1794 p->mToolBarUpN = myP.x() > width()/2 ;
1795 if ( filterToolBar ) { 1795 if ( filterToolBar ) {
1796 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1796 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1797 if ( p->mToolBarHorF ) 1797 if ( p->mToolBarHorF )
1798 p->mToolBarUpF = myP.y() > height()/2; 1798 p->mToolBarUpF = myP.y() > height()/2;
1799 else 1799 else
1800 p->mToolBarUpF = myP.x() > width()/2 ; 1800 p->mToolBarUpF = myP.x() > width()/2 ;
1801 } 1801 }
1802#else 1802#else
1803 if ( p->mToolBarHor ) 1803 if ( p->mToolBarHor )
1804 p->mToolBarUp = iconToolBar->y() > height()/2; 1804 p->mToolBarUp = iconToolBar->y() > height()/2;
1805 else 1805 else
1806 p->mToolBarUp = iconToolBar->x() > width()/2; 1806 p->mToolBarUp = iconToolBar->x() > width()/2;
1807 if ( p->mToolBarHorV ) 1807 if ( p->mToolBarHorV )
1808 p->mToolBarUpV = viewToolBar->y() > height()/2; 1808 p->mToolBarUpV = viewToolBar->y() > height()/2;
1809 else 1809 else
1810 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1810 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1811 1811
1812 if ( p->mToolBarHorN ) 1812 if ( p->mToolBarHorN )
1813 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1813 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1814 else 1814 else
1815 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1815 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1816 if ( filterToolBar ) { 1816 if ( filterToolBar ) {
1817 if ( p->mToolBarHorF ) 1817 if ( p->mToolBarHorF )
1818 p->mToolBarUpF = filterToolBar->y() > height()/2; 1818 p->mToolBarUpF = filterToolBar->y() > height()/2;
1819 else 1819 else
1820 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1820 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1821 } 1821 }
1822#endif 1822#endif
1823 1823
1824 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1824 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1825 save(); 1825 save();
1826 mView->writeSettings(); 1826 mView->writeSettings();
1827} 1827}
1828void MainWindow::slotModifiedChanged( bool changed ) 1828void MainWindow::slotModifiedChanged( bool changed )
1829{ 1829{
1830 if ( mBlockAtStartup ) 1830 if ( mBlockAtStartup )
1831 return; 1831 return;
1832 1832
1833 int msec; 1833 int msec;
1834 // we store the changes after 1 minute, 1834 // we store the changes after 1 minute,
1835 // and for safety reasons after 10 minutes again 1835 // and for safety reasons after 10 minutes again
1836 if ( !mSyncManager->blockSave() ) 1836 if ( !mSyncManager->blockSave() )
1837 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1837 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1838 else 1838 else
1839 msec = 1000 * 600; 1839 msec = 1000 * 600;
1840 mSaveTimer.start( msec, true ); // 1 minute 1840 mSaveTimer.start( msec, true ); // 1 minute
1841 qDebug("KO: Saving File in %d secs!", msec/1000); 1841 qDebug("KO: Saving File in %d secs!", msec/1000);
1842 mCalendarModifiedFlag = true; 1842 mCalendarModifiedFlag = true;
1843} 1843}
1844void MainWindow::saveStopTimer() 1844void MainWindow::saveStopTimer()
1845{ 1845{
1846 mSaveTimer.stop(); 1846 mSaveTimer.stop();
1847} 1847}
1848void MainWindow::save() 1848void MainWindow::save()
1849{ 1849{
1850 if ( !mCalendarModifiedFlag ) { 1850 if ( !mCalendarModifiedFlag ) {
1851 qDebug("KO: Calendar not modified. Nothing saved."); 1851 qDebug("KO: Calendar not modified. Nothing saved.");
1852 return; 1852 return;
1853 } 1853 }
1854 if ( mSyncManager->blockSave() ) 1854 if ( mSyncManager->blockSave() )
1855 return; 1855 return;
1856 mSyncManager->setBlockSave(true); 1856 mSyncManager->setBlockSave(true);
1857 if ( mView->checkAllFileVersions() ) { 1857 if ( mView->checkAllFileVersions() ) {
1858 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1858 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1859 QDate reference ( 2000,1,1); 1859 QDate reference ( 2000,1,1);
1860 int daysTo = reference.daysTo ( QDate::currentDate() ); 1860 int daysTo = reference.daysTo ( QDate::currentDate() );
1861 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1861 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1862 setCaption(i18n("Creating backup ... please wait ..." )); 1862 setCaption(i18n("Creating backup ... please wait ..." ));
1863 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1863 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1864 // we need the file path, the backup dir and the number of bups as param 1864 // we need the file path, the backup dir and the number of bups as param
1865 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1865 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1866 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1866 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1867 bupDir = KGlobalSettings::backupDataDir(); 1867 bupDir = KGlobalSettings::backupDataDir();
1868 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1868 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1869 if ( retval == 0 ) { 1869 if ( retval == 0 ) {
1870 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1870 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1871 // retval == 0 : backup skipped for today, try again tomorrow 1871 // retval == 0 : backup skipped for today, try again tomorrow
1872 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1872 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1873 } else if ( retval == 1 ){ 1873 } else if ( retval == 1 ){
1874 qDebug("KO: Backup created."); 1874 qDebug("KO: Backup created.");
1875 // backup ok 1875 // backup ok
1876 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1876 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1877 KopiCalendarFile * cal = calendars.first(); 1877 KopiCalendarFile * cal = calendars.first();
1878 cal = calendars.next(); 1878 cal = calendars.next();
1879 while ( cal ) { 1879 while ( cal ) {
1880 if ( !cal->mErrorOnLoad ) { 1880 if ( !cal->mErrorOnLoad ) {
1881 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1881 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1882 } 1882 }
1883 cal = calendars.next(); 1883 cal = calendars.next();
1884 } 1884 }
1885 KOPrefs::instance()->mLastBackupDate = daysTo; 1885 KOPrefs::instance()->mLastBackupDate = daysTo;
1886 } else if ( retval == 2 ){ 1886 } else if ( retval == 2 ){
1887 qDebug("KO: Backup globally cancelled."); 1887 qDebug("KO: Backup globally cancelled.");
1888 // backup globally cancelled 1888 // backup globally cancelled
1889 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1889 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1890 } 1890 }
1891 // retval == 3: do nothing, try again later 1891 // retval == 3: do nothing, try again later
1892 } 1892 }
1893 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1893 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1894 } 1894 }
1895 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1895 QTime neededSaveTime = QDateTime::currentDateTime().time();
1896 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1896 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1897 qDebug("KO: Start saving data to file!"); 1897 qDebug("KO: Start saving data to file!");
1898 mView->saveCalendars(); 1898 mView->saveCalendars();
1899 mCalendarModifiedFlag = false; 1899 mCalendarModifiedFlag = false;
1900 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1900 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1901 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1901 qDebug("KO: Needed %d ms for saving.",msNeeded );
1902 QString savemes; 1902 QString savemes;
1903 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1903 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1904 setCaption(savemes); 1904 setCaption(savemes);
1905 } else 1905 } else
1906 setCaption(i18n("Saving cancelled!")); 1906 setCaption(i18n("Saving cancelled!"));
1907 mSyncManager->setBlockSave( false ); 1907 mSyncManager->setBlockSave( false );
1908} 1908}
1909 1909
1910void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1910void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1911{ 1911{
1912 if ( !e->isAutoRepeat() ) { 1912 if ( !e->isAutoRepeat() ) {
1913 mFlagKeyPressed = false; 1913 mFlagKeyPressed = false;
1914 } 1914 }
1915} 1915}
1916void MainWindow::keyPressEvent ( QKeyEvent * e ) 1916void MainWindow::keyPressEvent ( QKeyEvent * e )
1917{ 1917{
1918 qApp->processEvents(); 1918 qApp->processEvents();
1919 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1919 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1920 e->ignore(); 1920 e->ignore();
1921 // qDebug(" ignore %d",e->isAutoRepeat() ); 1921 // qDebug(" ignore %d",e->isAutoRepeat() );
1922 return; 1922 return;
1923 } 1923 }
1924 if (! e->isAutoRepeat() ) 1924 if (! e->isAutoRepeat() )
1925 mFlagKeyPressed = true; 1925 mFlagKeyPressed = true;
1926 KOPrefs *p = KOPrefs::instance(); 1926 KOPrefs *p = KOPrefs::instance();
1927 bool showSelectedDates = false; 1927 bool showSelectedDates = false;
1928 int size; 1928 int size;
1929 int pro = 0; 1929 int pro = 0;
1930 //qDebug("MainWindow::keyPressEvent "); 1930 //qDebug("MainWindow::keyPressEvent ");
1931 switch ( e->key() ) { 1931 switch ( e->key() ) {
1932 case Qt::Key_Right: 1932 case Qt::Key_Right:
1933 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1933 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1934 mView->goNextMonth(); 1934 mView->goNextMonth();
1935 else 1935 else
1936 mView->goNext(); 1936 mView->goNext();
1937 showSelectedDates = true; 1937 showSelectedDates = true;
1938 break; 1938 break;
1939 case Qt::Key_Left: 1939 case Qt::Key_Left:
1940 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1940 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1941 mView->goPreviousMonth(); 1941 mView->goPreviousMonth();
1942 else 1942 else
1943 mView->goPrevious(); 1943 mView->goPrevious();
1944 showSelectedDates = true; 1944 showSelectedDates = true;
1945 break; 1945 break;
1946 case Qt::Key_Down: 1946 case Qt::Key_Down:
1947 mView->viewManager()->agendaView()->scrollOneHourDown(); 1947 mView->viewManager()->agendaView()->scrollOneHourDown();
1948 break; 1948 break;
1949 case Qt::Key_Up: 1949 case Qt::Key_Up:
1950 mView->viewManager()->agendaView()->scrollOneHourUp(); 1950 mView->viewManager()->agendaView()->scrollOneHourUp();
1951 break; 1951 break;
1952 case Qt::Key_K: 1952 case Qt::Key_K:
1953 mView->viewManager()->showMonthViewWeek(); 1953 mView->viewManager()->showMonthViewWeek();
1954 break; 1954 break;
1955 case Qt::Key_I: 1955 case Qt::Key_I:
1956 mView->showIncidence(); 1956 mView->showIncidence();
1957 break; 1957 break;
1958 case Qt::Key_Delete: 1958 case Qt::Key_Delete:
1959 case Qt::Key_Backspace: 1959 case Qt::Key_Backspace:
1960 mView->deleteIncidence(); 1960 mView->deleteIncidence();
1961 break; 1961 break;
1962 case Qt::Key_D: 1962 case Qt::Key_D:
1963 mView->viewManager()->showDayView(); 1963 mView->viewManager()->showDayView();
1964 showSelectedDates = true; 1964 showSelectedDates = true;
1965 break; 1965 break;
1966 case Qt::Key_O: 1966 case Qt::Key_O:
1967 mView->toggleFilerEnabled( ); 1967 mView->toggleFilerEnabled( );
1968 break; 1968 break;
1969 case Qt::Key_0: 1969 case Qt::Key_0:
1970 case Qt::Key_1: 1970 case Qt::Key_1:
1971 case Qt::Key_2: 1971 case Qt::Key_2:
1972 case Qt::Key_3: 1972 case Qt::Key_3:
1973 case Qt::Key_4: 1973 case Qt::Key_4:
1974 case Qt::Key_5: 1974 case Qt::Key_5:
1975 case Qt::Key_6: 1975 case Qt::Key_6:
1976 case Qt::Key_7: 1976 case Qt::Key_7:
1977 case Qt::Key_8: 1977 case Qt::Key_8:
1978 case Qt::Key_9: 1978 case Qt::Key_9:
1979 pro = e->key()-48; 1979 pro = e->key()-48;
1980 if ( pro == 0 ) 1980 if ( pro == 0 )
1981 pro = 10; 1981 pro = 10;
1982 if ( e->state() == Qt::ControlButton) 1982 if ( e->state() == Qt::ControlButton)
1983 pro += 10; 1983 pro += 10;
1984 break; 1984 break;
1985 case Qt::Key_M: 1985 case Qt::Key_M:
1986 mView->viewManager()->showMonthView(); 1986 mView->viewManager()->showMonthView();
1987 showSelectedDates = true; 1987 showSelectedDates = true;
1988 break; 1988 break;
1989 case Qt::Key_Insert: 1989 case Qt::Key_Insert:
1990 mView->newEvent(); 1990 mView->newEvent();
1991 break; 1991 break;
1992 case Qt::Key_S : 1992 case Qt::Key_S :
1993 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1993 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1994 mView->newSubTodo(); 1994 mView->newSubTodo();
1995 else 1995 else
1996 mView->dialogManager()->showSearchDialog(); 1996 mView->dialogManager()->showSearchDialog();
1997 break; 1997 break;
1998 case Qt::Key_Y : 1998 case Qt::Key_Y :
1999 case Qt::Key_Z : 1999 case Qt::Key_Z :
2000 mView->viewManager()->showWorkWeekView(); 2000 mView->viewManager()->showWorkWeekView();
2001 showSelectedDates = true; 2001 showSelectedDates = true;
2002 break; 2002 break;
2003 case Qt::Key_U : 2003 case Qt::Key_U :
2004 mView->viewManager()->showWeekView(); 2004 mView->viewManager()->showWeekView();
2005 showSelectedDates = true; 2005 showSelectedDates = true;
2006 break; 2006 break;
2007 case Qt::Key_H : 2007 case Qt::Key_H :
2008 keyBindings(); 2008 keyBindings();
2009 break; 2009 break;
2010 case Qt::Key_W: 2010 case Qt::Key_W:
2011 mView->viewManager()->showWhatsNextView(); 2011 mView->viewManager()->showWhatsNextView();
2012 break; 2012 break;
2013 case Qt::Key_L: 2013 case Qt::Key_L:
2014 mView->viewManager()->showListView(); 2014 mView->viewManager()->showListView();
2015 break; 2015 break;
2016 case Qt::Key_N: 2016 case Qt::Key_N:
2017 mView->viewManager()->showNextView(); 2017 mView->viewManager()->showNextView();
2018 break; 2018 break;
2019 case Qt::Key_V: 2019 case Qt::Key_V:
2020 mView->viewManager()->showTodoView(); 2020 mView->viewManager()->showTodoView();
2021 break; 2021 break;
2022 case Qt::Key_C: 2022 case Qt::Key_C:
2023 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2023 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2024 break; 2024 break;
2025 case Qt::Key_P: 2025 case Qt::Key_P:
2026 mView->showDatePicker( ); 2026 mView->showDatePicker( );
2027 break; 2027 break;
2028 case Qt::Key_F: 2028 case Qt::Key_F:
2029 mView->editFilters(); 2029 mView->editFilters();
2030 break; 2030 break;
2031 case Qt::Key_R: 2031 case Qt::Key_R:
2032 mView->toggleFilter(); 2032 mView->toggleFilter();
2033 break; 2033 break;
2034 case Qt::Key_X: 2034 case Qt::Key_X:
2035 if ( e->state() == Qt::ControlButton ) 2035 if ( e->state() == Qt::ControlButton )
2036 mView->toggleDateNavigatorWidget(); 2036 mView->toggleDateNavigatorWidget();
2037 else { 2037 else {
2038 mView->viewManager()->showNextXView(); 2038 mView->viewManager()->showNextXView();
2039 showSelectedDates = true; 2039 showSelectedDates = true;
2040 } 2040 }
2041 break; 2041 break;
2042 case Qt::Key_Space: 2042 case Qt::Key_Space:
2043 mView->toggleExpand(); 2043 mView->toggleExpand();
2044 break; 2044 break;
2045 case Qt::Key_A: 2045 case Qt::Key_A:
2046 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2046 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2047 mView->showNextAlarms(); 2047 mView->showNextAlarms();
2048 else 2048 else
2049 mView->toggleAllDaySize(); 2049 mView->toggleAllDaySize();
2050 break; 2050 break;
2051 case Qt::Key_T: 2051 case Qt::Key_T:
2052 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2052 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2053 mView->newTodo(); 2053 mView->newTodo();
2054 else { 2054 else {
2055 mView->goToday(); 2055 mView->goToday();
2056 showSelectedDates = true; 2056 showSelectedDates = true;
2057 } 2057 }
2058 break; 2058 break;
2059 case Qt::Key_J: 2059 case Qt::Key_J:
2060 mView->viewManager()->showJournalView(); 2060 mView->viewManager()->showJournalView();
2061 break; 2061 break;
2062 case Qt::Key_B: 2062 case Qt::Key_B:
2063 mView->editIncidenceDescription();; 2063 mView->editIncidenceDescription();;
2064 break; 2064 break;
2065 // case Qt::Key_Return: 2065 // case Qt::Key_Return:
2066 case Qt::Key_E: 2066 case Qt::Key_E:
2067 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2067 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2068 mView->newEvent(); 2068 mView->newEvent();
2069 else 2069 else
2070 mView->editIncidence(); 2070 mView->editIncidence();
2071 break; 2071 break;
2072 case Qt::Key_Plus: 2072 case Qt::Key_Plus:
2073 size = p->mHourSize +2; 2073 size = p->mHourSize +2;
2074 if ( size <= 22 ) 2074 if ( size <= 22 )
2075 configureAgenda( size ); 2075 configureAgenda( size );
2076 break; 2076 break;
2077 case Qt::Key_Minus: 2077 case Qt::Key_Minus:
2078 size = p->mHourSize - 2; 2078 size = p->mHourSize - 2;
2079 if ( size >= 4 ) 2079 if ( size >= 4 )
2080 configureAgenda( size ); 2080 configureAgenda( size );
2081 break; 2081 break;
2082 2082
2083 2083
2084 default: 2084 default:
2085 e->ignore(); 2085 e->ignore();
2086 } 2086 }
2087 if ( pro > 0 ) { 2087 if ( pro > 0 ) {
2088 mView->selectFilter( pro-1 ); 2088 selectFilter( pro+1 );
2089 } 2089 }
2090 if ( showSelectedDates ) { 2090 if ( showSelectedDates ) {
2091 ;// setCaptionToDates(); 2091 ;// setCaptionToDates();
2092 } 2092 }
2093 2093
2094} 2094}
2095void MainWindow::fillFilterMenuTB() 2095void MainWindow::fillFilterMenuTB()
2096{ 2096{
2097 selectFilterMenuTB->clear(); 2097 selectFilterMenuTB->clear();
2098 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2098 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2099 selectFilterMenuTB->insertSeparator(); 2099 selectFilterMenuTB->insertSeparator();
2100 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2100 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2101 2101
2102 selectFilterMenuTB->insertSeparator(); 2102 selectFilterMenuTB->insertSeparator();
2103 QPtrList<CalFilter> fili = mView->filters(); 2103 QPtrList<CalFilter> fili = mView->filters();
2104 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2104 CalFilter *curfilter = mView->filterView()->selectedFilter();
2105 CalFilter *filter = fili.first(); 2105 CalFilter *filter = fili.first();
2106 int iii = 2; 2106 int iii = 2;
2107 bool checkitem = mView->filterView()->filtersEnabled(); 2107 bool checkitem = mView->filterView()->filtersEnabled();
2108 while(filter) { 2108 while(filter) {
2109 selectFilterMenuTB->insertItem( filter->name(), iii ); 2109 selectFilterMenuTB->insertItem( filter->name(), iii );
2110 if ( filter == curfilter) 2110 if ( filter == curfilter)
2111 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2111 selectFilterMenuTB->setItemChecked( iii, checkitem );
2112 filter = fili.next(); 2112 filter = fili.next();
2113 ++iii; 2113 ++iii;
2114 } 2114 }
2115 if ( !checkitem ) 2115 if ( !checkitem )
2116 selectFilterMenuTB->setItemChecked( 1, true ); 2116 selectFilterMenuTB->setItemChecked( 1, true );
2117 2117
2118 int x = 0; 2118 int x = 0;
2119 int y = iconToolBar->height(); 2119 int y = iconToolBar->height();
2120 int dX = 0; 2120 int dX = 0;
2121 int dY = 0; 2121 int dY = 0;
2122 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2122 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2123 if ( iconToolBar->y() > height()/2 ) { 2123 if ( iconToolBar->y() > height()/2 ) {
2124 dY = selectFilterMenuTB->sizeHint().height()+8; 2124 dY = selectFilterMenuTB->sizeHint().height()+8;
2125 y = 0; 2125 y = 0;
2126 } 2126 }
2127 } else { 2127 } else {
2128 if ( iconToolBar->x() > width()/2 ) { // right side 2128 if ( iconToolBar->x() > width()/2 ) { // right side
2129 x=0; 2129 x=0;
2130 dX= selectFilterMenuTB->sizeHint().width()+8; 2130 dX= selectFilterMenuTB->sizeHint().width()+8;
2131 y = 0; 2131 y = 0;
2132 } else { 2132 } else {
2133 x= iconToolBar->width(); 2133 x= iconToolBar->width();
2134 y = 0; 2134 y = 0;
2135 } 2135 }
2136 } 2136 }
2137 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2137 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2138 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2138 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2139} 2139}
2140void MainWindow::fillFilterMenu() 2140void MainWindow::fillFilterMenu()
2141{ 2141{
2142 selectFilterMenu->clear(); 2142 selectFilterMenu->clear();
2143 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2143 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2144 selectFilterMenu->insertSeparator(); 2144 selectFilterMenu->insertSeparator();
2145 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2145 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2146 2146
2147 selectFilterMenu->insertSeparator(); 2147 selectFilterMenu->insertSeparator();
2148 QPtrList<CalFilter> fili = mView->filters(); 2148 QPtrList<CalFilter> fili = mView->filters();
2149 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2149 CalFilter *curfilter = mView->filterView()->selectedFilter();
2150 CalFilter *filter = fili.first(); 2150 CalFilter *filter = fili.first();
2151 int iii = 2; 2151 int iii = 2;
2152 bool checkitem = mView->filterView()->filtersEnabled(); 2152 bool checkitem = mView->filterView()->filtersEnabled();
2153 while(filter) { 2153 while(filter) {
2154 selectFilterMenu->insertItem( filter->name(), iii ); 2154 selectFilterMenu->insertItem( filter->name(), iii );
2155 if ( filter == curfilter) 2155 if ( filter == curfilter)
2156 selectFilterMenu->setItemChecked( iii, checkitem ); 2156 selectFilterMenu->setItemChecked( iii, checkitem );
2157 filter = fili.next(); 2157 filter = fili.next();
2158 ++iii; 2158 ++iii;
2159 } 2159 }
2160 if ( !checkitem ) 2160 if ( !checkitem )
2161 selectFilterMenu->setItemChecked( 1, true ); 2161 selectFilterMenu->setItemChecked( 1, true );
2162} 2162}
2163void MainWindow::fillFilterMenuPopup() 2163void MainWindow::fillFilterMenuPopup()
2164{ 2164{
2165 filterPopupMenu->clear(); 2165 filterPopupMenu->clear();
2166 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2166 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2167 2167
2168 filterPopupMenu->insertSeparator(); 2168 filterPopupMenu->insertSeparator();
2169 QPtrList<CalFilter> fili = mView->filters(); 2169 QPtrList<CalFilter> fili = mView->filters();
2170 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2170 CalFilter *curfilter = mView->filterView()->selectedFilter();
2171 CalFilter *filter = fili.first(); 2171 CalFilter *filter = fili.first();
2172 int iii = 1; 2172 int iii = 1;
2173 bool checkitem = mView->filterView()->filtersEnabled(); 2173 bool checkitem = mView->filterView()->filtersEnabled();
2174 while(filter) { 2174 while(filter) {
2175 filterPopupMenu->insertItem( filter->name(), iii ); 2175 filterPopupMenu->insertItem( filter->name(), iii );
2176 if ( filter == curfilter) 2176 if ( filter == curfilter)
2177 filterPopupMenu->setItemChecked( iii, checkitem ); 2177 filterPopupMenu->setItemChecked( iii, checkitem );
2178 filter = fili.next(); 2178 filter = fili.next();
2179 ++iii; 2179 ++iii;
2180 } 2180 }
2181 if ( !checkitem ) 2181 if ( !checkitem )
2182 filterPopupMenu->setItemChecked( 0, true ); 2182 filterPopupMenu->setItemChecked( 0, true );
2183} 2183}
2184void MainWindow::selectFilter( int fil ) 2184void MainWindow::selectFilter( int fil )
2185{ 2185{
2186 2186
2187 if ( fil == 0 ) { 2187 if ( fil == 0 ) {
2188 mView->editFilters( ); 2188 mView->editFilters( );
2189 } else if ( fil == 1 ){ 2189 } else if ( fil == 1 ){
2190 if ( mView->filterView()->filtersEnabled() ) 2190 if ( mView->filterView()->filtersEnabled() )
2191 mView->toggleFilerEnabled( ); 2191 mView->toggleFilerEnabled( );
2192 } else { 2192 } else {
2193 if ( !mView->filterView()->filtersEnabled() ) { 2193 if ( !mView->filterView()->filtersEnabled() ) {
2194 mView->filterView()->blockSignals( true ); 2194 mView->filterView()->blockSignals( true );
2195 mView->toggleFilerEnabled( ); 2195 mView->toggleFilerEnabled( );
2196 mView->filterView()->blockSignals( false ); 2196 mView->filterView()->blockSignals( false );
2197 } 2197 }
2198 mView->selectFilter( fil-2 ); 2198 mView->selectFilter( fil-2 );
2199 } 2199 }
2200} 2200}
2201void MainWindow::updateFilterToolbar() 2201void MainWindow::updateFilterToolbar()
2202{ 2202{
2203 if ( filterMenubar ) { 2203 if ( filterMenubar ) {
2204 if ( !mView->filterView()->filtersEnabled() ) { 2204 if ( !mView->filterView()->filtersEnabled() ) {
2205 filterMenubar->changeItem( 0, i18n("No Filter") ); 2205 filterMenubar->changeItem( 0, i18n("No Filter") );
2206 } else { 2206 } else {
2207 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2207 CalFilter *curfilter = mView->filterView()->selectedFilter();
2208 if ( curfilter ) { 2208 if ( curfilter ) {
2209 filterMenubar->changeItem( 0, curfilter->name() ); 2209 filterMenubar->changeItem( 0, curfilter->name() );
2210 } 2210 }
2211 } 2211 }
2212 } 2212 }
2213} 2213}
2214void MainWindow::selectFilterPopup( int fil ) 2214void MainWindow::selectFilterPopup( int fil )
2215{ 2215{
2216 selectFilter( fil + 1 ); 2216 selectFilter( fil + 1 );
2217 2217
2218} 2218}
2219void MainWindow::configureToolBar( int item ) 2219void MainWindow::configureToolBar( int item )
2220{ 2220{
2221 2221
2222 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2222 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2223 KOPrefs *p = KOPrefs::instance(); 2223 KOPrefs *p = KOPrefs::instance();
2224 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2224 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2225 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2225 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2226 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2226 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2227 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2227 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2228 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2228 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2229 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2229 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2230 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2230 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2231 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2231 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2232 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2232 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2233 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2233 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2234 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2234 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2235 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2235 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2236 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2236 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2237 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2237 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2238 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2238 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2239 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2239 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2240 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2240 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2241 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2241 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2242 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2242 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2243 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2243 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2244 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2244 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2245 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2245 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2246 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2246 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2247 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2247 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2248 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2248 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2249 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2249 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2250 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2250 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2251 // initActions(); 2251 // initActions();
2252} 2252}
2253void MainWindow::setCaption ( const QString & c ) 2253void MainWindow::setCaption ( const QString & c )
2254{ 2254{
2255 QString cap = c; 2255 QString cap = c;
2256 cap.replace( QRegExp("\n"), " " ); 2256 cap.replace( QRegExp("\n"), " " );
2257 cap = cap.stripWhiteSpace(); 2257 cap = cap.stripWhiteSpace();
2258 if ( cap.isEmpty() ) 2258 if ( cap.isEmpty() )
2259 cap = "KO/Pi"; 2259 cap = "KO/Pi";
2260 QWidget::setCaption( cap ); 2260 QWidget::setCaption( cap );
2261} 2261}
2262void MainWindow::setCaptionToDates() 2262void MainWindow::setCaptionToDates()
2263{ 2263{
2264 QString selDates; 2264 QString selDates;
2265 QDate date = mView->startDate(); 2265 QDate date = mView->startDate();
2266 if ( ! date.isValid() ) { 2266 if ( ! date.isValid() ) {
2267 setCaption(""); 2267 setCaption("");
2268 return; 2268 return;
2269 } 2269 }
2270 selDates = KGlobal::locale()->formatDate( date, true); 2270 selDates = KGlobal::locale()->formatDate( date, true);
2271 if (mView->startDate() < mView->endDate() ) 2271 if (mView->startDate() < mView->endDate() )
2272 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2272 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2273 else { 2273 else {
2274 QString addString; 2274 QString addString;
2275 if ( date == QDateTime::currentDateTime().date() ) 2275 if ( date == QDateTime::currentDateTime().date() )
2276 addString = i18n("Today"); 2276 addString = i18n("Today");
2277 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2277 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2278 addString = i18n("Tomorrow"); 2278 addString = i18n("Tomorrow");
2279 if ( !addString.isEmpty() ) 2279 if ( !addString.isEmpty() )
2280 selDates = addString+", "+selDates ; 2280 selDates = addString+", "+selDates ;
2281 } 2281 }
2282 setCaption( i18n("Dates: ") + selDates ); 2282 setCaption( i18n("Dates: ") + selDates );
2283 2283
2284} 2284}
2285void MainWindow::showConfigureAgenda( ) 2285void MainWindow::showConfigureAgenda( )
2286{ 2286{
2287 int iii; 2287 int iii;
2288 for ( iii = 1;iii<= 10 ;++iii ){ 2288 for ( iii = 1;iii<= 10 ;++iii ){
2289 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2289 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2290 } 2290 }
2291 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2291 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2292} 2292}
2293void MainWindow::configureAgenda( int item ) 2293void MainWindow::configureAgenda( int item )
2294{ 2294{
2295 if ( KOPrefs::instance()->mHourSize == item ) 2295 if ( KOPrefs::instance()->mHourSize == item )
2296 return; 2296 return;
2297 KOPrefs::instance()->mHourSize=item; 2297 KOPrefs::instance()->mHourSize=item;
2298 mView->viewManager()->agendaView()->updateConfig(); 2298 mView->viewManager()->agendaView()->updateConfig();
2299} 2299}
2300 2300
2301void MainWindow::saveCalendar() 2301void MainWindow::saveCalendar()
2302{ 2302{
2303 QString fn = KOPrefs::instance()->mLastSaveFile; 2303 QString fn = KOPrefs::instance()->mLastSaveFile;
2304 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2304 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2305 2305
2306 if ( fn == "" ) 2306 if ( fn == "" )
2307 return; 2307 return;
2308 QFileInfo info; 2308 QFileInfo info;
2309 info.setFile( fn ); 2309 info.setFile( fn );
2310 QString mes; 2310 QString mes;
2311 bool createbup = true; 2311 bool createbup = true;
2312 if ( info. exists() ) { 2312 if ( info. exists() ) {
2313 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2313 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2314 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2314 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2315 i18n("Overwrite!"), i18n("Cancel"), 0, 2315 i18n("Overwrite!"), i18n("Cancel"), 0,
2316 0, 1 ); 2316 0, 1 );
2317 if ( result != 0 ) { 2317 if ( result != 0 ) {
2318 createbup = false; 2318 createbup = false;
2319 } 2319 }
2320 } 2320 }
2321 if ( createbup ) { 2321 if ( createbup ) {
2322 mView->saveCalendar( fn ); 2322 mView->saveCalendar( fn );
2323 mes = i18n("KO/Pi:Saved %1").arg(fn); 2323 mes = i18n("KO/Pi:Saved %1").arg(fn);
2324 KOPrefs::instance()->mLastSaveFile = fn; 2324 KOPrefs::instance()->mLastSaveFile = fn;
2325 setCaption(mes); 2325 setCaption(mes);
2326 } 2326 }
2327} 2327}
2328void MainWindow::loadCalendar() 2328void MainWindow::loadCalendar()
2329{ 2329{
2330 2330
2331 QString fn = KOPrefs::instance()->mLastLoadFile; 2331 QString fn = KOPrefs::instance()->mLastLoadFile;
2332 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2332 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2333 2333
2334 if ( fn == "" ) 2334 if ( fn == "" )
2335 return; 2335 return;
2336 QFileInfo info; 2336 QFileInfo info;
2337 info.setFile( fn ); 2337 info.setFile( fn );
2338 QString mess; 2338 QString mess;
2339 bool loadbup = true; 2339 bool loadbup = true;
2340 if ( info. exists() ) { 2340 if ( info. exists() ) {
2341 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2341 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2342 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2342 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2343 mess, 2343 mess,
2344 i18n("Load!"), i18n("Cancel"), 0, 2344 i18n("Load!"), i18n("Cancel"), 0,
2345 0, 1 ); 2345 0, 1 );
2346 if ( result != 0 ) { 2346 if ( result != 0 ) {
2347 loadbup = false; 2347 loadbup = false;
2348 } 2348 }
2349 } else { 2349 } else {
2350 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2350 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2351 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2351 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2352 0, 1 ); 2352 0, 1 );
2353 2353
2354 return; 2354 return;
2355 } 2355 }
2356 if ( loadbup ) { 2356 if ( loadbup ) {
2357 mView->openCalendar( fn ); 2357 mView->openCalendar( fn );
2358 KOPrefs::instance()->mLastLoadFile = fn; 2358 KOPrefs::instance()->mLastLoadFile = fn;
2359 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2359 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2360 setCaption(mess); 2360 setCaption(mess);
2361 } 2361 }
2362 2362
2363} 2363}
2364void MainWindow::quickImportIcal() 2364void MainWindow::quickImportIcal()
2365{ 2365{
2366 importFile( KOPrefs::instance()->mLastImportFile, false ); 2366 importFile( KOPrefs::instance()->mLastImportFile, false );
2367} 2367}
2368void MainWindow::importFile( QString fn, bool quick ) 2368void MainWindow::importFile( QString fn, bool quick )
2369{ 2369{
2370 QFileInfo info; 2370 QFileInfo info;
2371 info.setFile( fn ); 2371 info.setFile( fn );
2372 QString mess; 2372 QString mess;
2373 bool loadbup = true; 2373 bool loadbup = true;
2374 if ( !info. exists() ) { 2374 if ( !info. exists() ) {
2375 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2375 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2376 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2376 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2377 mess ); 2377 mess );
2378 return; 2378 return;
2379 } 2379 }
2380 int result = 0; 2380 int result = 0;
2381 if ( !quick ) { 2381 if ( !quick ) {
2382 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2382 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2383 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2383 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2384 mess, 2384 mess,
2385 "Import", "Cancel", 0, 2385 "Import", "Cancel", 0,
2386 0, 1 ); 2386 0, 1 );
2387 } 2387 }
2388 if ( result == 0 ) { 2388 if ( result == 0 ) {
2389 if ( mView->openCalendar( fn, true )) { 2389 if ( mView->openCalendar( fn, true )) {
2390 KOPrefs::instance()->mLastImportFile = fn; 2390 KOPrefs::instance()->mLastImportFile = fn;
2391 setCaption(i18n("Imported file successfully")); 2391 setCaption(i18n("Imported file successfully"));
2392 } else { 2392 } else {
2393 setCaption(i18n("Error importing file")); 2393 setCaption(i18n("Error importing file"));
2394 } 2394 }
2395 } 2395 }
2396} 2396}
2397 2397
2398void MainWindow::importIcal() 2398void MainWindow::importIcal()
2399{ 2399{
2400 2400
2401 QString fn =KOPrefs::instance()->mLastImportFile; 2401 QString fn =KOPrefs::instance()->mLastImportFile;
2402 2402
2403 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2403 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2404 if ( fn == "" ) 2404 if ( fn == "" )
2405 return; 2405 return;
2406 importFile( fn, true ); 2406 importFile( fn, true );
2407 2407
2408} 2408}
2409 2409
2410void MainWindow::exportVCalendar() 2410void MainWindow::exportVCalendar()
2411{ 2411{
2412 QString fn = KOPrefs::instance()->mLastVcalFile; 2412 QString fn = KOPrefs::instance()->mLastVcalFile;
2413 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2413 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2414 if ( fn == "" ) 2414 if ( fn == "" )
2415 return; 2415 return;
2416 QFileInfo info; 2416 QFileInfo info;
2417 info.setFile( fn ); 2417 info.setFile( fn );
2418 QString mes; 2418 QString mes;
2419 bool createbup = true; 2419 bool createbup = true;
2420 if ( info. exists() ) { 2420 if ( info. exists() ) {
2421 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2421 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2422 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2422 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2423 i18n("Overwrite!"), i18n("Cancel"), 0, 2423 i18n("Overwrite!"), i18n("Cancel"), 0,
2424 0, 1 ); 2424 0, 1 );
2425 if ( result != 0 ) { 2425 if ( result != 0 ) {
2426 createbup = false; 2426 createbup = false;
2427 } 2427 }
2428 } 2428 }
2429 if ( createbup ) { 2429 if ( createbup ) {
2430 if ( mView->exportVCalendar( fn ) ) { 2430 if ( mView->exportVCalendar( fn ) ) {
2431 KOPrefs::instance()->mLastVcalFile = fn; 2431 KOPrefs::instance()->mLastVcalFile = fn;
2432 if ( fn.length() > 20 ) 2432 if ( fn.length() > 20 )
2433 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2433 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2434 else 2434 else
2435 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2435 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2436 setCaption(mes); 2436 setCaption(mes);
2437 } 2437 }
2438 } 2438 }
2439 2439
2440} 2440}
2441QString MainWindow::sentSyncFile() 2441QString MainWindow::sentSyncFile()
2442{ 2442{
2443#ifdef DESKTOP_VERSION 2443#ifdef DESKTOP_VERSION
2444 return locateLocal( "tmp", "copysynccal.ics" ); 2444 return locateLocal( "tmp", "copysynccal.ics" );
2445#else 2445#else
2446 return QString( "/tmp/copysynccal.ics" ); 2446 return QString( "/tmp/copysynccal.ics" );
2447#endif 2447#endif
2448} 2448}
2449 2449
2450void MainWindow::syncFileRequest() 2450void MainWindow::syncFileRequest()
2451{ 2451{
2452 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2452 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2453 mSyncManager->slotSyncMenu( 999 ); 2453 mSyncManager->slotSyncMenu( 999 );
2454 } 2454 }
2455 2455
2456 setCaption(i18n("Saving Data to temp file ..." )); 2456 setCaption(i18n("Saving Data to temp file ..." ));
2457 mView->saveCalendar( sentSyncFile() ); 2457 mView->saveCalendar( sentSyncFile() );
2458 setCaption(i18n("Data saved to temp file!" )); 2458 setCaption(i18n("Data saved to temp file!" ));
2459 2459
2460} 2460}
2461void MainWindow::getFile( bool success ) 2461void MainWindow::getFile( bool success )
2462{ 2462{
2463 if ( ! success ) { 2463 if ( ! success ) {
2464 setCaption( i18n("Error receiving file. Nothing changed!") ); 2464 setCaption( i18n("Error receiving file. Nothing changed!") );
2465 return; 2465 return;
2466 } 2466 }
2467 mView->openCalendar( sentSyncFile() ); 2467 mView->openCalendar( sentSyncFile() );
2468 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2468 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2469 mSyncManager->slotSyncMenu( 999 ); 2469 mSyncManager->slotSyncMenu( 999 );
2470 } 2470 }
2471 setCaption( i18n("Pi-Sync successful!") ); 2471 setCaption( i18n("Pi-Sync successful!") );
2472} 2472}
2473void MainWindow::printListView() 2473void MainWindow::printListView()
2474{ 2474{
2475 2475
2476 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2476 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2477 2477
2478 KMessageBox::information( this, message); 2478 KMessageBox::information( this, message);
2479} 2479}
2480void MainWindow::printSel( ) 2480void MainWindow::printSel( )
2481{ 2481{
2482 mView->viewManager()->agendaView()->agenda()->printSelection(); 2482 mView->viewManager()->agendaView()->agenda()->printSelection();
2483} 2483}
2484 2484
2485void MainWindow::printCal() 2485void MainWindow::printCal()
2486{ 2486{
2487 mView->print();//mCp->showDialog(); 2487 mView->print();//mCp->showDialog();
2488} 2488}
2489 2489
2490 2490
2491#include "libkdepim/kdatepicker.h" 2491#include "libkdepim/kdatepicker.h"
2492#include <kdatetbl.h> 2492#include <kdatetbl.h>
2493 2493
2494void MainWindow::weekAction() 2494void MainWindow::weekAction()
2495{ 2495{
2496 int month; 2496 int month;
2497 KPopupFrame* popup = new KPopupFrame(this); 2497 KPopupFrame* popup = new KPopupFrame(this);
2498 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2498 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2499 // ----- 2499 // -----
2500 picker->resize(picker->sizeHint()); 2500 picker->resize(picker->sizeHint());
2501 popup->setMainWidget(picker); 2501 popup->setMainWidget(picker);
2502 picker->setFocus(); 2502 picker->setFocus();
2503 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2503 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2504 int x = 0; 2504 int x = 0;
2505 int y = iconToolBar->height(); 2505 int y = iconToolBar->height();
2506 int dX = 0; 2506 int dX = 0;
2507 int dY = 0; 2507 int dY = 0;
2508 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2508 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2509 if ( iconToolBar->y() > height()/2 ) { 2509 if ( iconToolBar->y() > height()/2 ) {
2510 dY = picker->sizeHint().height()+8; 2510 dY = picker->sizeHint().height()+8;
2511 y = 0; 2511 y = 0;
2512 } 2512 }
2513 } else { 2513 } else {
2514 if ( iconToolBar->x() > width()/2 ) { // right side 2514 if ( iconToolBar->x() > width()/2 ) { // right side
2515 x=0; 2515 x=0;
2516 dX= picker->sizeHint().width()+8; 2516 dX= picker->sizeHint().width()+8;
2517 y = 0; 2517 y = 0;
2518 } else { 2518 } else {
2519 x= iconToolBar->width(); 2519 x= iconToolBar->width();
2520 y = 0; 2520 y = 0;
2521 } 2521 }
2522 } 2522 }
2523 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2523 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2524 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2524 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2525 { 2525 {
2526 month = picker->getResult(); 2526 month = picker->getResult();
2527 emit selectWeek ( month ); 2527 emit selectWeek ( month );
2528 //qDebug("weekSelected %d ", month); 2528 //qDebug("weekSelected %d ", month);
2529 } 2529 }
2530 delete popup; 2530 delete popup;
2531} 2531}
2532 2532
2533void MainWindow::hideEvent ( QHideEvent * ) 2533void MainWindow::hideEvent ( QHideEvent * )
2534{ 2534{
2535 QString message; 2535 QString message;
2536 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2536 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2537 if ( nextA.isValid() ) { 2537 if ( nextA.isValid() ) {
2538 QString sum = mCalendar->nextSummary(); 2538 QString sum = mCalendar->nextSummary();
2539 2539
2540 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)); 2540 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));
2541 setCaption( message ); 2541 setCaption( message );
2542 } 2542 }
2543} 2543}
2544 2544
2545void MainWindow::resizeEvent( QResizeEvent* e) 2545void MainWindow::resizeEvent( QResizeEvent* e)
2546{ 2546{
2547#ifndef DESKTOP_VERSION 2547#ifndef DESKTOP_VERSION
2548 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2548 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2549 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2549 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2550 filterToolBar->hide(); 2550 filterToolBar->hide();
2551 else 2551 else
2552 filterToolBar->show(); 2552 filterToolBar->show();
2553 } 2553 }
2554#endif 2554#endif
2555 QMainWindow::resizeEvent( e); 2555 QMainWindow::resizeEvent( e);
2556} 2556}