summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-03 23:10:45 (UTC)
committer zautrix <zautrix>2005-06-03 23:10:45 (UTC)
commit858b047efb5627824438cb3877e7bec0cebb3751 (patch) (unidiff)
tree7b36963344d4f5019f3a1ecb5eb9290f27c3b3c7
parent0207d193bdb6c66201562a17e68872e018ec223c (diff)
downloadkdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.zip
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.gz
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp167
-rw-r--r--korganizer/calendarview.h20
-rw-r--r--korganizer/kotodoview.cpp2
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/event.cpp6
-rw-r--r--libkcal/event.h2
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/journal.cpp2
-rw-r--r--libkcal/journal.h2
-rw-r--r--libkcal/todo.cpp4
-rw-r--r--libkcal/todo.h2
13 files changed, 206 insertions, 17 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 41868d9..cc8102c 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -605,777 +605,777 @@
605{"Breakfast","Frühstück" }, 605{"Breakfast","Frühstück" },
606{"Competition","Wettkampf" }, 606{"Competition","Wettkampf" },
607{"Dinner","Abendessen" }, 607{"Dinner","Abendessen" },
608{"Education","Erziehung" }, 608{"Education","Erziehung" },
609{"Family","Familie" }, 609{"Family","Familie" },
610{"Favorites","Favoriten" }, 610{"Favorites","Favoriten" },
611{"Festival","Festival" }, 611{"Festival","Festival" },
612{"Fishing","Angeln" }, 612{"Fishing","Angeln" },
613{"Flight","Flug" }, 613{"Flight","Flug" },
614{"Gifts","Geschenk" }, 614{"Gifts","Geschenk" },
615{"Holiday","Feiertag" }, 615{"Holiday","Feiertag" },
616{"Holiday Cards","Ansichtskarten" }, 616{"Holiday Cards","Ansichtskarten" },
617{"Hot Contacts","Heisse Kontakte" }, 617{"Hot Contacts","Heisse Kontakte" },
618{"Hiking","Wandern" }, 618{"Hiking","Wandern" },
619{"Hunting","Jagen" }, 619{"Hunting","Jagen" },
620{"Key Customer","Wichtiger Kunde" }, 620{"Key Customer","Wichtiger Kunde" },
621{"Kids","Kinder" }, 621{"Kids","Kinder" },
622{"Lunch","Mittagessen" }, 622{"Lunch","Mittagessen" },
623{"Meeting","Treffen" }, 623{"Meeting","Treffen" },
624{"Miscellaneous","Verschiedenes" }, 624{"Miscellaneous","Verschiedenes" },
625{"Partner","Partner" }, 625{"Partner","Partner" },
626{"Party","Partie" }, 626{"Party","Partie" },
627{"Personal","Privat" }, 627{"Personal","Privat" },
628{"Personal Travel","Privatreise"}, 628{"Personal Travel","Privatreise"},
629{"PHB","PHB" }, 629{"PHB","PHB" },
630{"Phone Calls","Telefonanruf" }, 630{"Phone Calls","Telefonanruf" },
631{"Projects","Projekt" }, 631{"Projects","Projekt" },
632{"Recurring","Wiederholend" }, 632{"Recurring","Wiederholend" },
633{"School","Schule" }, 633{"School","Schule" },
634{"Shopping","Einkaufen" }, 634{"Shopping","Einkaufen" },
635{"Speach","Rede" }, 635{"Speach","Rede" },
636{"Special Occasion","Spez.Gelegenheit" }, 636{"Special Occasion","Spez.Gelegenheit" },
637{"Sports","Sport" }, 637{"Sports","Sport" },
638{"Talk","Vortrag" }, 638{"Talk","Vortrag" },
639{"Travel","Reise" }, 639{"Travel","Reise" },
640{"TV","TV" }, 640{"TV","TV" },
641{"Germany","Deutschland" }, 641{"Germany","Deutschland" },
642{"Sweden","Schweden" }, 642{"Sweden","Schweden" },
643{"Forest","Wald" }, 643{"Forest","Wald" },
644{ "Desert","Wüste" }, 644{ "Desert","Wüste" },
645{ "Kitchen","Küche" }, 645{ "Kitchen","Küche" },
646{ "Lake","See" }, 646{ "Lake","See" },
647{"University","Universität"}, 647{"University","Universität"},
648{"Vacation","Urlaub" }, 648{"Vacation","Urlaub" },
649{"VIP","VIP" }, 649{"VIP","VIP" },
650{ "Import Sharp Calendar","Importiere Sharp Kalender" }, 650{ "Import Sharp Calendar","Importiere Sharp Kalender" },
651{ "This todo has been cancelled!","Dieses Todo wurde gecancelt!" }, 651{ "This todo has been cancelled!","Dieses Todo wurde gecancelt!" },
652{ "This event has been cancelled!","Dieser Termin wurde gecancelt!" }, 652{ "This event has been cancelled!","Dieser Termin wurde gecancelt!" },
653{ "Cancelled","Gecancelt" }, 653{ "Cancelled","Gecancelt" },
654{ "Multiple sync","Mehrfach Sync" }, 654{ "Multiple sync","Mehrfach Sync" },
655{ "Local file","Lokale Datei" }, 655{ "Local file","Lokale Datei" },
656{ "Last file","Letzte Datei" }, 656{ "Last file","Letzte Datei" },
657{ "Keys + Colors...","Tasten + Farben..." }, 657{ "Keys + Colors...","Tasten + Farben..." },
658{ "Mini icons in toolbar(nr)","Mini Icons in ToolBar(bn)" }, 658{ "Mini icons in toolbar(nr)","Mini Icons in ToolBar(bn)" },
659{ "Quick load/save (w/o Unicode)","Schnelles Laden/Speichern (o Unicode)" }, 659{ "Quick load/save (w/o Unicode)","Schnelles Laden/Speichern (o Unicode)" },
660{ "Choose...","Wähle..." }, 660{ "Choose...","Wähle..." },
661{ "Use colors for application:","Setze Farben für Programm:" }, 661{ "Use colors for application:","Setze Farben für Programm:" },
662{ "Buttons, menus, etc.:","Knöpfe, Menu, etc.:" }, 662{ "Buttons, menus, etc.:","Knöpfe, Menu, etc.:" },
663{ "Frames, labels, etc.:","Rahmen, Label, etc.:" }, 663{ "Frames, labels, etc.:","Rahmen, Label, etc.:" },
664{ "Show parent To-Do's","Zeige Ober-Todos" }, 664{ "Show parent To-Do's","Zeige Ober-Todos" },
665{ "Show location","Zeige Orte" }, 665{ "Show location","Zeige Orte" },
666{ "Show events that recur ","Zeige Termine, die sich wiederholen:" }, 666{ "Show events that recur ","Zeige Termine, die sich wiederholen:" },
667{ "Show in every cell ","Zeige in jeder Zelle " }, 667{ "Show in every cell ","Zeige in jeder Zelle " },
668{ "short month","kurzen Monat" }, 668{ "short month","kurzen Monat" },
669{ "icons","Icons" }, 669{ "icons","Icons" },
670{ "Show Sat/Sun together","Zeige Sam/Son zusammen" }, 670{ "Show Sat/Sun together","Zeige Sam/Son zusammen" },
671{ "Category colors are applied to text","Kategorie Farben färben Text" }, 671{ "Category colors are applied to text","Kategorie Farben färben Text" },
672{ "Month view uses day colors","Monatsansicht zeigt Tagesfarben" }, 672{ "Month view uses day colors","Monatsansicht zeigt Tagesfarben" },
673{ "Day color odd months","Tagesfarbe ungerade Monate" }, 673{ "Day color odd months","Tagesfarbe ungerade Monate" },
674{ "Day color even months","Tagesfarbe gerade Monate" }, 674{ "Day color even months","Tagesfarbe gerade Monate" },
675{ "Color for Sundays + category \"Holiday\"","Farbe für Sonntag + Kateg.\" Feiertag\"" }, 675{ "Color for Sundays + category \"Holiday\"","Farbe für Sonntag + Kateg.\" Feiertag\"" },
676{ "To-do view shows complete as 'xx %'","Zeige Prozent erledigt als 'xx %'" }, 676{ "To-do view shows complete as 'xx %'","Zeige Prozent erledigt als 'xx %'" },
677{ "Small To-do view uses smaller font","Kleine To-do Ansicht nutzt kleineren Font" }, 677{ "Small To-do view uses smaller font","Kleine To-do Ansicht nutzt kleineren Font" },
678{ "Colors are applied to text","Farben werden auf Text angewendet" }, 678{ "Colors are applied to text","Farben werden auf Text angewendet" },
679{ "Use internal alarm notification","Nutze interne Alarm Benachrichtigung" }, 679{ "Use internal alarm notification","Nutze interne Alarm Benachrichtigung" },
680{ "Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n","Achtung: KO/Pi muß ausgeführt werden damit die Benachrichtigung funktioniert. Empfehlung für Zaurus: Diese Option nicht wählen und KO/Pi Alarm Applet installieren.\n" }, 680{ "Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n","Achtung: KO/Pi muß ausgeführt werden damit die Benachrichtigung funktioniert. Empfehlung für Zaurus: Diese Option nicht wählen und KO/Pi Alarm Applet installieren.\n" },
681{ "Play beeps count:","Anzahl der Alarmpiepse: " }, 681{ "Play beeps count:","Anzahl der Alarmpiepse: " },
682{ "Beeps interval in sec:","Zeitintervall der Alarmpiepse: " }, 682{ "Beeps interval in sec:","Zeitintervall der Alarmpiepse: " },
683{ "Default suspend time in min:","Standard Supendierungs Zeit: " }, 683{ "Default suspend time in min:","Standard Supendierungs Zeit: " },
684{ "Auto suspend count:","Anzahl der auto Suspendierungen" }, 684{ "Auto suspend count:","Anzahl der auto Suspendierungen" },
685{ "Alarm *.wav file for newly created alarm:","Alarm *.wav Datei für neu angelegte Alarme:" }, 685{ "Alarm *.wav file for newly created alarm:","Alarm *.wav Datei für neu angelegte Alarme:" },
686{ "New profile","Neues Profil" }, 686{ "New profile","Neues Profil" },
687{ "Clone profile","Klone Profil" }, 687{ "Clone profile","Klone Profil" },
688{ "Delete profile","Lösche Profil" }, 688{ "Delete profile","Lösche Profil" },
689{ "Profile:","Profil:" }, 689{ "Profile:","Profil:" },
690{ "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" }, 690{ "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" },
691{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" }, 691{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" },
692{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" }, 692{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" },
693{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" }, 693{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" },
694{ "Write back file","Schreibe Datei zurück" }, 694{ "Write back file","Schreibe Datei zurück" },
695{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" }, 695{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" },
696{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" }, 696{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" },
697{ "Local device name:","Name dieses Gerätes:" }, 697{ "Local device name:","Name dieses Gerätes:" },
698{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" }, 698{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" },
699{ "Sync preferences","Synchronisations Einstellungen" }, 699{ "Sync preferences","Synchronisations Einstellungen" },
700{ "Profile kind","Profil Art" }, 700{ "Profile kind","Profil Art" },
701{ "Local file","Lokale Datei" }, 701{ "Local file","Lokale Datei" },
702{ "Local file:","Lokale Datei:" }, 702{ "Local file:","Lokale Datei:" },
703{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" }, 703{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" },
704{ "Fill in default values for:","Setze Beispiel Werte ein für:" }, 704{ "Fill in default values for:","Setze Beispiel Werte ein für:" },
705{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" }, 705{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" },
706{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"}, 706{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"},
707{ "Device","Gerät:" }, 707{ "Device","Gerät:" },
708{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" }, 708{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" },
709{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n","Synchronisationsübersicht:\n\n %d items lokal hinzugefügt\n %d items entfernt hinzugefügt\n %d items lokal geändert\n %d items entfernt geändert\n %d items lokal gelöscht\n %d items entfernt gelöscht\n" }, 709{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n","Synchronisationsübersicht:\n\n %d items lokal hinzugefügt\n %d items entfernt hinzugefügt\n %d items lokal geändert\n %d items entfernt geändert\n %d items lokal gelöscht\n %d items entfernt gelöscht\n" },
710{ "Synchronization successful","Synchronisation erfolgreich" }, 710{ "Synchronization successful","Synchronisation erfolgreich" },
711{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." }, 711{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." },
712{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" }, 712{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" },
713{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" }, 713{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" },
714{ "Enter password","Passwort eingeben" }, 714{ "Enter password","Passwort eingeben" },
715{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" }, 715{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" },
716{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." }, 716{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." },
717{ "Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n","Sorry, das Kopierkommando schlug fehl!\nKommando war:\n%1\n \nVersuche Kommando von Kosole um\nDetails für das Fehlschlagen\nzu erfahren.\n" }, 717{ "Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n","Sorry, das Kopierkommando schlug fehl!\nKommando war:\n%1\n \nVersuche Kommando von Kosole um\nDetails für das Fehlschlagen\nzu erfahren.\n" },
718{ "Writing back file result: ","Resultat des Dateizurückschreibens: " }, 718{ "Writing back file result: ","Resultat des Dateizurückschreibens: " },
719{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" }, 719{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" },
720{ "Edit Calendar Filters","Editiere Kalendar Filter" }, 720{ "Edit Calendar Filters","Editiere Kalendar Filter" },
721{ "Enter filter name:","Neuer Filter Name:" }, 721{ "Enter filter name:","Neuer Filter Name:" },
722{ "Add Filter","Filter hinzufügen" }, 722{ "Add Filter","Filter hinzufügen" },
723{ "Question","Frage" }, 723{ "Question","Frage" },
724{ "Filter position: ","Filter Position: " }, 724{ "Filter position: ","Filter Position: " },
725{ "Month View","Monatsansicht" }, 725{ "Month View","Monatsansicht" },
726{ "This profil cannot be deleted!\n","Dieses Profil kann\nnicht gelöscht werden!" }, 726{ "This profil cannot be deleted!\n","Dieses Profil kann\nnicht gelöscht werden!" },
727{ "KO/Pi config error","KO/Pi Konfig. Fehler" }, 727{ "KO/Pi config error","KO/Pi Konfig. Fehler" },
728{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" }, 728{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" },
729{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile haben denselben Namen!\nBitte unterschiedliche Namen wählen!" }, 729{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile haben denselben Namen!\nBitte unterschiedliche Namen wählen!" },
730{ "Access: ","Zugriff: " }, 730{ "Access: ","Zugriff: " },
731{ "Needs Action","Aktion notwendig" }, 731{ "Needs Action","Aktion notwendig" },
732{ "Accepted","Akzeptiert" }, 732{ "Accepted","Akzeptiert" },
733{ "Declined","Abgelehnt" }, 733{ "Declined","Abgelehnt" },
734{ "Tentative","Vorläufig" }, 734{ "Tentative","Vorläufig" },
735{ "Delegated","Beauftragt" }, 735{ "Delegated","Beauftragt" },
736{ "Completed","Vollständig" }, 736{ "Completed","Vollständig" },
737{ "In Process","In Bearbeitung" }, 737{ "In Process","In Bearbeitung" },
738{ "Participant","Teilnehmer" }, 738{ "Participant","Teilnehmer" },
739{ "Optional Participant","Möglicher Teilnehmer" }, 739{ "Optional Participant","Möglicher Teilnehmer" },
740{ "Observer","Beobachter" }, 740{ "Observer","Beobachter" },
741{ "Chair","Vorsitzender" }, 741{ "Chair","Vorsitzender" },
742{ "Not supported \non desktop!\n","" }, 742{ "Not supported \non desktop!\n","" },
743{ "Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. ","Es ist nichts selektiert!\nDieses druckt die volle Breite der Agenda View, so wie man sie sieht.\nUm die vertikale Auswahl zum Drucken zu bestimmen,\nbitte einen vertikalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen.\n(Es wird danach direkt der Termin Dialog angezeigt\n - dort bitte auf Abbrechen klicken) " }, 743{ "Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. ","Es ist nichts selektiert!\nDieses druckt die volle Breite der Agenda View, so wie man sie sieht.\nUm die vertikale Auswahl zum Drucken zu bestimmen,\nbitte einen vertikalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen.\n(Es wird danach direkt der Termin Dialog angezeigt\n - dort bitte auf Abbrechen klicken) " },
744{ "Date range: ","Datums Zeitspanne: " }, 744{ "Date range: ","Datums Zeitspanne: " },
745{ "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " }, 745{ "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " },
746{ "Syncing - close to abort!","Syncing-schließe um abzubrechen." }, 746{ "Syncing - close to abort!","Syncing-schließe um abzubrechen." },
747{ "Add / remove events","Add./entferne Termine" }, 747{ "Add / remove events","Add./entferne Termine" },
748{ "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." }, 748{ "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." },
749{ "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." }, 749{ "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." },
750{ "\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie gepeicherte Datei wurde verändert!\nDatei Grösse: %1 Bytes.\nZuletzt geändert: %2\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, 750{ "\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie gepeicherte Datei wurde verändert!\nDatei Grösse: %1 Bytes.\nZuletzt geändert: %2\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" },
751{ "Overwrite","Überschreiben" }, 751{ "Overwrite","Überschreiben" },
752{ "Sync+save","Syncen+speichern" }, 752{ "Sync+save","Syncen+speichern" },
753{ "Default","Standard" }, 753{ "Default","Standard" },
754{ " Categories added to list! "," Kategorien zur Liste hinzugefügt! " }, 754{ " Categories added to list! "," Kategorien zur Liste hinzugefügt! " },
755{ " %d items?"," %d Einträge?" }, 755{ " %d items?"," %d Einträge?" },
756{ "\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?","\nDieses ist ein\nwiederholender Termin!.\nSind Sie sicher, dass Sie\ndiesen Termin und alle\nWiederholungen löschen möchten?" }, 756{ "\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?","\nDieses ist ein\nwiederholender Termin!.\nSind Sie sicher, dass Sie\ndiesen Termin und alle\nWiederholungen löschen möchten?" },
757{ " ?\n\nDelete:\n"," ?\n\nLösche:\n" }, 757{ " ?\n\nDelete:\n"," ?\n\nLösche:\n" },
758{ "Current","Aktuelle" }, 758{ "Current","Aktuelle" },
759{ "\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n","\nDieses ist ein\nwiederholender Termin!\nMöchten sie alle Wiederholungen\nlöschen, oder nur die aktuelle am:\n" }, 759{ "\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n","\nDieses ist ein\nwiederholender Termin!\nMöchten sie alle Wiederholungen\nlöschen, oder nur die aktuelle am:\n" },
760{ "All","Alle" }, 760{ "All","Alle" },
761{ "Data Loss Warning","Datenverlust Warnung" }, 761{ "Data Loss Warning","Datenverlust Warnung" },
762{ "Proceed","Weitermachen" }, 762{ "Proceed","Weitermachen" },
763{ "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" }, 763{ "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" },
764{ "Filter disabled ","Filter abgeschaltet" }, 764{ "Filter disabled ","Filter abgeschaltet" },
765{ "Filter selected: ","Gewählter Filter: " }, 765{ "Filter selected: ","Gewählter Filter: " },
766{ "Toggle Cancel","Gecancelt ändern" }, 766{ "Toggle Cancel","Gecancelt ändern" },
767{ "&Toggle Cancel","Gecancel&t ändern" }, 767{ "&Toggle Cancel","Gecancel&t ändern" },
768{ "Configure Toolbar","Konfiguriere Toolbar" }, 768{ "Configure Toolbar","Konfiguriere Toolbar" },
769{ "Stretched TB","Gedehnte TB" }, 769{ "Stretched TB","Gedehnte TB" },
770{ "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" }, 770{ "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" },
771{ "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" }, 771{ "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" },
772{ "When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing","Wenn ein Kalender doppelt importiert\nwird, werden doppelte Einträge ignoriert!\nSie können eine Backup Datei anlegen unter\nDatei - Speichere Kalender Backup\num den Import rückgängig machen zu können.\n" }, 772{ "When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing","Wenn ein Kalender doppelt importiert\nwird, werden doppelte Einträge ignoriert!\nSie können eine Backup Datei anlegen unter\nDatei - Speichere Kalender Backup\num den Import rückgängig machen zu können.\n" },
773{ "Not supported \non desktop!\n","Nur verfügbar auf PDA!" }, 773{ "Not supported \non desktop!\n","Nur verfügbar auf PDA!" },
774{ "Imported file successfully","Datei erfolgreich importiert" }, 774{ "Imported file successfully","Datei erfolgreich importiert" },
775{ "Error importing file","Fehler beim Importieren der Datei" }, 775{ "Error importing file","Fehler beim Importieren der Datei" },
776{ "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" }, 776{ "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" },
777{ "Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n","Zu speichernde Datei\existiert bereits!\nExist. Datei vom:\n%1\nÜberschreiben?\n" }, 777{ "Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n","Zu speichernde Datei\existiert bereits!\nExist. Datei vom:\n%1\nÜberschreiben?\n" },
778{ "Overwrite!","Überschreiben!" }, 778{ "Overwrite!","Überschreiben!" },
779{ "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n","Import Datei \n...%1\nvom:\n%2\nDuplizierte Einträge\nwerden nicht importiert!\n" }, 779{ "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n","Import Datei \n...%1\nvom:\n%2\nDuplizierte Einträge\nwerden nicht importiert!\n" },
780{ "Load backup filename","Lade Backup Dateiname" }, 780{ "Load backup filename","Lade Backup Dateiname" },
781{ "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" }, 781{ "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" },
782{ "KO/Pi:Loaded %1","KO/Pi:Geladen %1" }, 782{ "KO/Pi:Loaded %1","KO/Pi:Geladen %1" },
783{ "Save backup filename","Speichere Backup Dateiname" }, 783{ "Save backup filename","Speichere Backup Dateiname" },
784{ "Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n","Backup Datei\nexistiert bereits!\nAlte Backup Datei vom:\n%1\nÜberschreiben?\n" }, 784{ "Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n","Backup Datei\nexistiert bereits!\nAlte Backup Datei vom:\n%1\nÜberschreiben?\n" },
785{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, 785{ "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" },
786{ "Details of attendee","Teilnehmerdetails" }, 786{ "Details of attendee","Teilnehmerdetails" },
787{ "Work phone:\n","Telefon Arbeit:\n" }, 787{ "Work phone:\n","Telefon Arbeit:\n" },
788{ "Work mobile phone:\n","Mobiltelefon Arbeit:\n" }, 788{ "Work mobile phone:\n","Mobiltelefon Arbeit:\n" },
789{ "Home phone:\n","Telefon privat:\n" }, 789{ "Home phone:\n","Telefon privat:\n" },
790{ "Mobile home phone:\n","Mobiltelefon privat:\n" }, 790{ "Mobile home phone:\n","Mobiltelefon privat:\n" },
791{ "Email:\n","Email:\n" }, 791{ "Email:\n","Email:\n" },
792{ "Alarm disabled for this item","Alarm deaktiviert für dieses Item" }, 792{ "Alarm disabled for this item","Alarm deaktiviert für dieses Item" },
793{ "Audio Al.: ","Audio Al.: " }, 793{ "Audio Al.: ","Audio Al.: " },
794{ "Proc.Al.: ","Proz.Al.: " }, 794{ "Proc.Al.: ","Proz.Al.: " },
795{ "No sound set","Kein Sound definiert" }, 795{ "No sound set","Kein Sound definiert" },
796{ "*.wav|Wav Files","*.wav|Wav Dateien" }, 796{ "*.wav|Wav Files","*.wav|Wav Dateien" },
797{ "No program set","Kein Programm definiert" }, 797{ "No program set","Kein Programm definiert" },
798{ "Running '%1'","Ausführen '%1'" }, 798{ "Running '%1'","Ausführen '%1'" },
799{ "Playing '%1'","Abspielen '%1'" }, 799{ "Playing '%1'","Abspielen '%1'" },
800{ "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" }, 800{ "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" },
801{ "Load!","Laden!" }, 801{ "Load!","Laden!" },
802{ "Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n","Backup Datei vom:\n%1\nDas Laden der Backup Datei\nlöscht die aktuellen Daten!\n" }, 802{ "Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n","Backup Datei vom:\n%1\nDas Laden der Backup Datei\nlöscht die aktuellen Daten!\n" },
803{ "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" }, 803{ "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" },
804{ "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" }, 804{ "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" },
805{ "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" }, 805{ "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" },
806{ "Features + hints...","Eigenschaften + Tipps..." }, 806{ "Features + hints...","Eigenschaften + Tipps..." },
807{ "User translation...","Benutzer Übersetzung..." }, 807{ "User translation...","Benutzer Übersetzung..." },
808{ "Sync HowTo...","Synchronisation HowTo..." }, 808{ "Sync HowTo...","Synchronisation HowTo..." },
809{ "Print calendar...","Drucke Kalender..." }, 809{ "Print calendar...","Drucke Kalender..." },
810{ "Anniversary","Jahrestag" }, 810{ "Anniversary","Jahrestag" },
811{ "When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n","Wenn Geburtstage mehrfach importiert\nwerden, werden doppelte Einträge ignoriert\nwenn sie nicht verändert wurden.\n" }, 811{ "When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n","Wenn Geburtstage mehrfach importiert\nwerden, werden doppelte Einträge ignoriert\nwenn sie nicht verändert wurden.\n" },
812{ "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" }, 812{ "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" },
813{ "Next recurrence is on: ","Nächste Wiederholung ist am:" }, 813{ "Next recurrence is on: ","Nächste Wiederholung ist am:" },
814{ "<b>Alarm on: </b>","<b>Alarm am: </b>" }, 814{ "<b>Alarm on: </b>","<b>Alarm am: </b>" },
815{ "<b>Access: </b>","<b>Zugriff: </b>" }, 815{ "<b>Access: </b>","<b>Zugriff: </b>" },
816{ "(%1 min before)","(%1 min vorher)" }, 816{ "(%1 min before)","(%1 min vorher)" },
817{ "<b>Categories: </b>","<b>Kategorien: </b>" }, 817{ "<b>Categories: </b>","<b>Kategorien: </b>" },
818{ "Save Journal/Description...","Speichere Journal/Details..." }, 818{ "Save Journal/Description...","Speichere Journal/Details..." },
819{ "This saves the text/details of selected\nJournals and Events/Todos\nto a text file.","Das speichert den Text bzw.\ndie Details von selektierten\nJournalen und Events/Todos\nin eine Textdatei." }, 819{ "This saves the text/details of selected\nJournals and Events/Todos\nto a text file.","Das speichert den Text bzw.\ndie Details von selektierten\nJournalen und Events/Todos\nin eine Textdatei." },
820{ "Continue","Weitermachen" }, 820{ "Continue","Weitermachen" },
821{ " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" }, 821{ " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" },
822{ "Attendee:","Teilnehmer:" }, 822{ "Attendee:","Teilnehmer:" },
823{ "Click OK to search ->","Klicke zum Suchen auf OK ->" }, 823{ "Click OK to search ->","Klicke zum Suchen auf OK ->" },
824{ "On day ","Am Tag " }, 824{ "On day ","Am Tag " },
825{ "%1 of ","%1 des Monats" }, 825{ "%1 of ","%1 des Monats" },
826{ "%1 of the year","%1 des Jahres" }, 826{ "%1 of the year","%1 des Jahres" },
827{ "Anonymous","Anonymo" }, 827{ "Anonymous","Anonymo" },
828{ "nobody@nowhere","niemand@nirgendwo" }, 828{ "nobody@nowhere","niemand@nirgendwo" },
829{ "calendar.html","calendar.html" }, 829{ "calendar.html","calendar.html" },
830{ " Local Time"," Locale Zeit" }, 830{ " Local Time"," Locale Zeit" },
831{ "Unknown Name","Unbekannter Name" }, 831{ "Unknown Name","Unbekannter Name" },
832{ "unknown@nowhere","unbekannt@nirgendwo" }, 832{ "unknown@nowhere","unbekannt@nirgendwo" },
833{ "Beam via IR!","Beam via IR!" }, 833{ "Beam via IR!","Beam via IR!" },
834{ "Next Month","Nächster Monat" }, 834{ "Next Month","Nächster Monat" },
835{ "Prio","Prio" }, 835{ "Prio","Prio" },
836{ "Reparent Todo","Mache Sub-Todo" }, 836{ "Reparent Todo","Mache Sub-Todo" },
837{ "tomorrow","morgen" }, 837{ "tomorrow","morgen" },
838{ "today","heute" }, 838{ "today","heute" },
839{ "yesterday","gestern" }, 839{ "yesterday","gestern" },
840{ "Ok","Ok" }, 840{ "Ok","Ok" },
841{ "Ok+Agenda","Ok+Agenda" }, 841{ "Ok+Agenda","Ok+Agenda" },
842{ "Email","Email" }, 842{ "Email","Email" },
843{ "RSVP","RSVP" }, 843{ "RSVP","RSVP" },
844{ "Email:","Email:" }, 844{ "Email:","Email:" },
845{ "Appointment Time ","Termin Zeit " }, 845{ "Appointment Time ","Termin Zeit " },
846{ "2","2" }, 846{ "2","2" },
847{ "3","3" }, 847{ "3","3" },
848{ "4","4" }, 848{ "4","4" },
849{ " 0 %"," 0 %" }, 849{ " 0 %"," 0 %" },
850{ " 20 %"," 20 %" }, 850{ " 20 %"," 20 %" },
851{ " 40 %"," 40 %" }, 851{ " 40 %"," 40 %" },
852{ " 60 %"," 60 %" }, 852{ " 60 %"," 60 %" },
853{ " 80 %"," 80 %" }, 853{ " 80 %"," 80 %" },
854{ "100 %","100 %" }, 854{ "100 %","100 %" },
855{ "Filter","Filter" }, 855{ "Filter","Filter" },
856{ "Configure","Konfiguriere" }, 856{ "Configure","Konfiguriere" },
857{ "What's Next","What's Next" }, 857{ "What's Next","What's Next" },
858{ "Complete calendar...","Kompletten Kalender..." }, 858{ "Complete calendar...","Kompletten Kalender..." },
859{ "Filtered calendar...","Gefilterten Kalender..." }, 859{ "Filtered calendar...","Gefilterten Kalender..." },
860{ "Export to phone","Exportiere zum Handy" }, 860{ "Export to phone","Exportiere zum Handy" },
861{ "Beam receive enabled","Beam Empfang an" }, 861{ "Beam receive enabled","Beam Empfang an" },
862{ "What's new?","Was ist neu?" }, 862{ "What's new?","Was ist neu?" },
863{ "FAQ...","FAQ..." }, 863{ "FAQ...","FAQ..." },
864{ "Licence...","Licence..." }, 864{ "Licence...","Licence..." },
865{ "What's This?","What's This?" }, 865{ "What's This?","What's This?" },
866{ "&Edit...","&Editiere..." }, 866{ "&Edit...","&Editiere..." },
867{ "Oktober","Oktober" }, 867{ "Oktober","Oktober" },
868{ "Title","Titel" }, 868{ "Title","Titel" },
869{ "%1 %","%1 %" }, 869{ "%1 %","%1 %" },
870{ "Enable Pi-Sync","Schalte Pi-Sync an" }, 870{ "Enable Pi-Sync","Schalte Pi-Sync an" },
871{ "Import!","Importiere!" }, 871{ "Import!","Importiere!" },
872{ "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" }, 872{ "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" },
873{ "Export to phone options","Export ans Handy Optionen" }, 873{ "Export to phone options","Export ans Handy Optionen" },
874{ "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." }, 874{ "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." },
875{ "I/O device: ","I/O device: " }, 875{ "I/O device: ","I/O device: " },
876{ "Connection: ","Connection: " }, 876{ "Connection: ","Connection: " },
877{ "Model(opt.): ","Model(opt.): " }, 877{ "Model(opt.): ","Model(opt.): " },
878{ "Write back events in future only","Schreibe nur zukünftige Termine zurück" }, 878{ "Write back events in future only","Schreibe nur zukünftige Termine zurück" },
879{ "Max. weeks in future: ","Max. Wochen in der Zukunft: " }, 879{ "Max. weeks in future: ","Max. Wochen in der Zukunft: " },
880{ "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nTodo/Kalender Daten auf dem Handy!" }, 880{ "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nTodo/Kalender Daten auf dem Handy!" },
881{ "Export to mobile phone!","Exportiere auf das Handy!" }, 881{ "Export to mobile phone!","Exportiere auf das Handy!" },
882{ "Export complete calendar","Exportiere kompletten Kalender" }, 882{ "Export complete calendar","Exportiere kompletten Kalender" },
883{ "Writing to phone...","Sende Daten ans Handy..." }, 883{ "Writing to phone...","Sende Daten ans Handy..." },
884{ " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" }, 884{ " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" },
885{ "Retry","Nochmal versuchen" }, 885{ "Retry","Nochmal versuchen" },
886{ "KDE/Pim phone access","KDE/Pim Handy Zugriff" }, 886{ "KDE/Pim phone access","KDE/Pim Handy Zugriff" },
887{ "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" }, 887{ "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" },
888{ "Error exporting to phone!","Fehler beim Export auf das Handy!" }, 888{ "Error exporting to phone!","Fehler beim Export auf das Handy!" },
889{ "Export filtered calendar","Exportiere gefilterten Kalender" }, 889{ "Export filtered calendar","Exportiere gefilterten Kalender" },
890{ "Preferences","Vorlieben" }, 890{ "Preferences","Vorlieben" },
891{ "Global","Global" }, 891{ "Global","Global" },
892{ "Phone","Phone" }, 892{ "Phone","Phone" },
893{ "SMS","SMS" }, 893{ "SMS","SMS" },
894{ "Fax","Fax" }, 894{ "Fax","Fax" },
895{ "Pager","Pager" }, 895{ "Pager","Pager" },
896{ "SIP","SIP" }, 896{ "SIP","SIP" },
897{ "Italian","Italienisch" }, 897{ "Italian","Italienisch" },
898{ "24:00","24:00" }, 898{ "24:00","24:00" },
899{ "12:00am","12:00am" }, 899{ "12:00am","12:00am" },
900{ "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" }, 900{ "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" },
901{ "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" }, 901{ "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" },
902{ "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" }, 902{ "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" },
903{ "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" }, 903{ "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" },
904{ "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" }, 904{ "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" },
905{ "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" }, 905{ "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" },
906{ "Used Mail Client","Benutzter Mail Client" }, 906{ "Used Mail Client","Benutzter Mail Client" },
907{ "Channel:","Channel:" }, 907{ "Channel:","Channel:" },
908{ "Message:","Message:" }, 908{ "Message:","Message:" },
909{ "Parameters:","Parameter:" }, 909{ "Parameters:","Parameter:" },
910{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" }, 910{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" },
911{ "extra Message:","extra Message:" }, 911{ "extra Message:","extra Message:" },
912{ "extra Parameters:","extra Parameter:" }, 912{ "extra Parameters:","extra Parameter:" },
913{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" }, 913{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" },
914{ "External Apps.","Externe Appl." }, 914{ "External Apps.","Externe Appl." },
915{ "24 hours","24 Std." }, 915{ "24 hours","24 Std." },
916{ "3 hours","3 Std." }, 916{ "3 hours","3 Std." },
917{ "1 hour","1 Std." }, 917{ "1 hour","1 Std." },
918{ "15 minutes","15 Min." }, 918{ "15 minutes","15 Min." },
919{ "5 minutes","5 Min." }, 919{ "5 minutes","5 Min." },
920{ "1 minute","1 Min." }, 920{ "1 minute","1 Min." },
921{ "23","23" }, 921{ "23","23" },
922{ "Mon 15","Mon 15" }, 922{ "Mon 15","Mon 15" },
923{ "Configure KO","Konfiguriere KO" }, 923{ "Configure KO","Konfiguriere KO" },
924{ "Event text","Termin Text" }, 924{ "Event text","Termin Text" },
925{ "ToDo","Todo" }, 925{ "ToDo","Todo" },
926{ "Today","Heute" }, 926{ "Today","Heute" },
927{ "What's Next View","What's Next Ansicht" }, 927{ "What's Next View","What's Next Ansicht" },
928{ "Allday Agenda view shows todos","Ganztag Agenda zeigt Todos" }, 928{ "Allday Agenda view shows todos","Ganztag Agenda zeigt Todos" },
929{ "Alarm","Alarm" }, 929{ "Alarm","Alarm" },
930{ "Used %1 Client","Benutzter %1 Client" }, 930{ "Used %1 Client","Benutzter %1 Client" },
931{ "No email client installed","Kein Email Klient installiert" }, 931{ "No email client installed","Kein Email Klient installiert" },
932{ "Userdefined email client","Benutzerdef. Email Klient" }, 932{ "Userdefined email client","Benutzerdef. Email Klient" },
933{ "OM/Pi email client","OM/Pi Email Klient" }, 933{ "OM/Pi email client","OM/Pi Email Klient" },
934{ "Include in multiple ","Beziehe in multiple " }, 934{ "Include in multiple ","Beziehe in multiple " },
935{ "calendar ","Kalender " }, 935{ "calendar ","Kalender " },
936{ "addressbook ","Adressbuch " }, 936{ "addressbook ","Adressbuch " },
937{ "pwmanager","PWmanager" }, 937{ "pwmanager","PWmanager" },
938{ " sync"," Sync ein" }, 938{ " sync"," Sync ein" },
939{ "Write back synced data","Schreibe gesyncte Daten zurück" }, 939{ "Write back synced data","Schreibe gesyncte Daten zurück" },
940{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" }, 940{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" },
941{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" }, 941{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" },
942{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " }, 942{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " },
943{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" }, 943{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" },
944{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" }, 944{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" },
945{ "Help...","Hilfe..." }, 945{ "Help...","Hilfe..." },
946{ "Local file Cal:","Lokale Datei Kal:" }, 946{ "Local file Cal:","Lokale Datei Kal:" },
947{ "Local file ABook:","Lokale Datei ABuch:" }, 947{ "Local file ABook:","Lokale Datei ABuch:" },
948{ "Local file PWMgr:","Lokale Datei PWMgr:" }, 948{ "Local file PWMgr:","Lokale Datei PWMgr:" },
949{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" }, 949{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" },
950{ "Calendar:","Kalender:" }, 950{ "Calendar:","Kalender:" },
951{ "AddressBook:","AdressBuch:" }, 951{ "AddressBook:","AdressBuch:" },
952{ "PWManager:","PWManager:" }, 952{ "PWManager:","PWManager:" },
953{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" }, 953{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" },
954{ "ssh/scp","ssh/scp" }, 954{ "ssh/scp","ssh/scp" },
955{ "ftp","ftp" }, 955{ "ftp","ftp" },
956{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" }, 956{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" },
957{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" }, 957{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" },
958{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" }, 958{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" },
959{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, 959{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" },
960{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, 960{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" },
961{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, 961{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" },
962{ "KDE-Pim sync config","KDE-Pim sync Konfig" }, 962{ "KDE-Pim sync config","KDE-Pim sync Konfig" },
963{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, 963{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" },
964{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" }, 964{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" },
965{ "Port number (Default: %1)","Port Nummer (Default: %1)" }, 965{ "Port number (Default: %1)","Port Nummer (Default: %1)" },
966{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, 966{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" },
967{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, 967{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" },
968{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, 968{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" },
969{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, 969{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" },
970{ "Disable Pi-Sync","Schalte Pi-Sync aus" }, 970{ "Disable Pi-Sync","Schalte Pi-Sync aus" },
971{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen \"Multi-Syncen\"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" }, 971{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen \"Multi-Syncen\"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" },
972{ "KDE-Pim Sync","KDE-Pim Sync" }, 972{ "KDE-Pim Sync","KDE-Pim Sync" },
973{ "Multiple profiles","Multi-Sync Profile" }, 973{ "Multiple profiles","Multi-Sync Profile" },
974{ "Device: ","Gerät: " }, 974{ "Device: ","Gerät: " },
975{ "Multiple sync started.","Multi-Sync gestartet." }, 975{ "Multiple sync started.","Multi-Sync gestartet." },
976{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, 976{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" },
977{ "Turn filter on","Schalte Filter an" }, 977{ "Turn filter on","Schalte Filter an" },
978{ "Turn filter off","Schalte Filter aus" }, 978{ "Turn filter off","Schalte Filter aus" },
979{ "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" }, 979{ "Key bindings KOrganizer/Pi","Tastatur Belegung KOrganizer/Pi" },
980{ "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" }, 980{ "<p><b>White</b>: Item readonly</p>\n","<p><b>Weiss</b>: Eintrag schreibgeschützt</p>\n" },
981{ "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" }, 981{ "<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n","<p><b>Dunkelgelb</b>: Termin/Todo mit Teilnehmern.</p>\n" },
982{ "<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n","<p><b>Schwarz</b>: Termin/Todo mit Teilnehmern. Sie sind der Organisator!</p>\n" }, 982{ "<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n","<p><b>Schwarz</b>: Termin/Todo mit Teilnehmern. Sie sind der Organisator!</p>\n" },
983{ "<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n","<p><b>Dunkelgrün</b>: Information(Beschreibung) verfügbar.([i] in WN Ansicht)</p>\n" }, 983{ "<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n","<p><b>Dunkelgrün</b>: Information(Beschreibung) verfügbar.([i] in WN Ansicht)</p>\n" },
984{ "<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n","<p><b>Blau</b>: Wiederholender Termin.([r] in Whats'Next Ansicht)</p>\n" }, 984{ "<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n","<p><b>Blau</b>: Wiederholender Termin.([r] in Whats'Next Ansicht)</p>\n" },
985{ "<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n","<p><b>Rot</b>: Alarm gesetzt.([a] in Whats'Next Ansicht)</p>\n" }, 985{ "<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n","<p><b>Rot</b>: Alarm gesetzt.([a] in Whats'Next Ansicht)</p>\n" },
986{ "<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n","<p><b>Kreuz</b>: Eintrag gecancelt.([c] in Whats'Next Ansicht)</p>\n" }, 986{ "<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n","<p><b>Kreuz</b>: Eintrag gecancelt.([c] in Whats'Next Ansicht)</p>\n" },
987{ "<p><b>(for square icons in agenda and month view)</b></p>\n","<p><b>(für quadratische Icons in Agenda und Monats Ansicht)</b></p>\n" }, 987{ "<p><b>(for square icons in agenda and month view)</b></p>\n","<p><b>(für quadratische Icons in Agenda und Monats Ansicht)</b></p>\n" },
988{ "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" }, 988{ "<p><h2>KO/Pi icon colors:</h2></p>\n","<p><h2>KO/Pi Icon Farben:</h2></p>\n" },
989{ "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" }, 989{ "<p><b>E</b>: Edit item</p>\n","<p><b>E</b>: Editiere Eintrag</p>\n" },
990{ "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" }, 990{ "<p><b>A</b>: Show agenda view.</p>\n","<p><b>A</b>: Zeige Agenda Ansicht.</p>\n" },
991{ "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" }, 991{ "<p><b>I,C</b>: Close dialog.</p>\n","<p><b>I,C</b>: Schließe Dialog.</p>\n" },
992{ "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" }, 992{ "<p><h3>In event/todo viewer:</h3></p>\n","<p><h3>In Termin/Todo Detail-Anzeige:</h3></p>\n" },
993{ "<p><b>shift+up/down</b>: Goto first/last item</p>\n","<p><b>shift+up/down</b>: Gehe zum ersten/letzten Eintrag</p>\n" }, 993{ "<p><b>shift+up/down</b>: Goto first/last item</p>\n","<p><b>shift+up/down</b>: Gehe zum ersten/letzten Eintrag</p>\n" },
994{ "<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n","<p><b>ctrl+up/down</b>: Gehe hoch/runter 20% aller Einträge</p>\n" }, 994{ "<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n","<p><b>ctrl+up/down</b>: Gehe hoch/runter 20% aller Einträge</p>\n" },
995{ "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" }, 995{ "<p><b>up/down</b>: Next/prev item</p>\n","<p><b>up/down</b>: Nächster/vorheriger Eintrag</p>\n" },
996{ "<p><b>return+shift</b>: Deselect item+one step down</p>\n","<p><b>return+shift</b>: Deselektiere Item+Cursor einen Eintrag runter</p>\n" }, 996{ "<p><b>return+shift</b>: Deselect item+one step down</p>\n","<p><b>return+shift</b>: Deselektiere Item+Cursor einen Eintrag runter</p>\n" },
997{ "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" }, 997{ "<p><b>return</b>: Select item+one step down</p>\n","<p><b>return</b>: Selektiere Item+Cursor einen Eintrag runter</p>\n" },
998{ "<p><b>I</b>: Show info of current item+one step down.</p>\n","<p><b>I</b>: Zeige Detail-Ansicht vom sel.Eintrag+Cursor einen Eintrag runter.</p>\n" }, 998{ "<p><b>I</b>: Show info of current item+one step down.</p>\n","<p><b>I</b>: Zeige Detail-Ansicht vom sel.Eintrag+Cursor einen Eintrag runter.</p>\n" },
999{ "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" }, 999{ "<p><h3>In list view:</h3></p>\n","<p><h3>In Listen Ansicht:</h3></p>\n" },
1000{ "<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n","<p><b>return+shift</b>: Markiere Todo als nicht erledigt+Cursor einen Eintrag runter</p>\n" }, 1000{ "<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n","<p><b>return+shift</b>: Markiere Todo als nicht erledigt+Cursor einen Eintrag runter</p>\n" },
1001{ "<p><b>return</b>: Mark item as completed+one step down.</p>\n","<p><b>return</b>: Markiere Todo als erledigt+Cursor einen Eintrag runter.</p>\n" }, 1001{ "<p><b>return</b>: Mark item as completed+one step down.</p>\n","<p><b>return</b>: Markiere Todo als erledigt+Cursor einen Eintrag runter.</p>\n" },
1002{ "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" }, 1002{ "<p><b>Q</b>: Toggle quick todo line edit.</p>\n","<p><b>Q</b>: Zeige/verstecke Quick Todo Eingabe Zeile.</p>\n" },
1003{ "<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n","<p><b>shift+P</b>: Mache Todo zum neuen <b>P</b>arent Todo für das Todo, welches mit shift+Sselektiert wurde.</p>\n" }, 1003{ "<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n","<p><b>shift+P</b>: Mache Todo zum neuen <b>P</b>arent Todo für das Todo, welches mit shift+Sselektiert wurde.</p>\n" },
1004{ "<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n","<p><b>shift+S</b>: Mache Todo zum <b>S</b>ubtodo</p>\n" }, 1004{ "<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n","<p><b>shift+S</b>: Mache Todo zum <b>S</b>ubtodo</p>\n" },
1005{ "<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n","<p><b>shift+U</b>: <b>U</b>nparent Todo (Mache Sub-Todo zum Toplevel Todo)</p>\n" }, 1005{ "<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n","<p><b>shift+U</b>: <b>U</b>nparent Todo (Mache Sub-Todo zum Toplevel Todo)</p>\n" },
1006{ "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" }, 1006{ "<p><h3>In todo view:</h3></p>\n","<p><h3>In Todo Anzige:</h3></p>\n" },
1007{ "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" }, 1007{ "<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n","<p><b>ctrl+up/down</b>: Scrolle kleine Todo Ansicht</p>\n" },
1008{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" }, 1008{ "<p><b>up/down</b>: Scroll agenda view</p>\n","<p><b>up/down</b>: Scrolle Agenda Ansicht</p>\n" },
1009{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" }, 1009{ "<p><h3>In agenda view:</h3></p>\n","<p><h3>In Agenda Ansicht:</h3></p>\n" },
1010{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" }, 1010{ "<p><b>del,backspace</b>: Delete selected item</p>\n","<p><b>del,backspace</b>: Lösche selektiertes Item</p>\n" },
1011{ "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" }, 1011{ "<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n","<p><b>left</b>: Vorh. Woche | <b>left+ctrl</b>: Vorh. Monat</p>\n" },
1012{ "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" }, 1012{ "<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n","<p><b>right</b>: Nächste Woche | <b>right+ctrl</b>: Nächste Woche</p>\n" },
1013{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" }, 1013{ "<p><b>B</b>: Edit description (details) of selected item</p>\n","<p><b>B</b>: Editiere Beschreibung (Details) des selektierten Items</p>\n" },
1014{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" }, 1014{ "<p><b>C</b>: Show current time in agenda view</p>\n","<p><b>C</b>: Zeige aktuelle Zeit in Agenda Ansicht</p>\n" },
1015{ "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" }, 1015{ "<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n","<p><b>+,-</b> : Zoom rein/raus Agenda | <b>A</b>: Wechsle Ganztag Agenda Höhe</p>\n" },
1016{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X+ctrl</b>: Zeige/verstecke Datumsnavigator</p>\n" }, 1016{ "<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n","<p><b>S+ctrl</b>: Füge Sub-Todo hinzu | <b>X+ctrl</b>: Zeige/verstecke Datumsnavigator</p>\n" },
1017{ "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" }, 1017{ "<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n","<p><b>T</b>: Gehe zu Heute | <b>T+ctrl</b>: Neues Todo</p>\n" },
1018{ "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" }, 1018{ "<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n","<p><b>E</b>: Editiere selektiertes Item |<b> E+ctrl</b>: Neuer Termin</p>\n" },
1019{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monatsansicht</p>\n" }, 1019{ "<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n","<p><b>D</b>: Ein-Tages Ansicht | <b>M</b>: Monatsansicht</p>\n" },
1020{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochenansicht | <b>U</b>: Wochenansicht</p>\n" }, 1020{ "<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n","<p><b>Z,Y</b>: Arbeitswochenansicht | <b>U</b>: Wochenansicht</p>\n" },
1021{ "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" }, 1021{ "<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n","<p><b>V</b>: Todo Ansicht | <b>L</b>: Termin Listen Ansicht</p>\n" },
1022{ "<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ","<p><b>X</b>: Nächste-X-Tage Ansicht | <b>W</b>: What's Next Ansicht\n " }, 1022{ "<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ","<p><b>X</b>: Nächste-X-Tage Ansicht | <b>W</b>: What's Next Ansicht\n " },
1023{ "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" }, 1023{ "<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n","<p><b>1-0</b> (+<b>ctrl</b>): Selektiere Filter 1-10 (11-20)</p>\n" },
1024{ "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" }, 1024{ "<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n","<p><b>O</b>: Filter An/Aus | <b>J</b>: Journal Ansicht</p>\n" },
1025{ "<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n","<p><b>F</b>: Zeige/verstecke Filter Ansicht |<b>F+ctrl</b>: Editiere Filter </p>\n" }, 1025{ "<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n","<p><b>F</b>: Zeige/verstecke Filter Ansicht |<b>F+ctrl</b>: Editiere Filter </p>\n" },
1026{ "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" }, 1026{ "<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n","<p><b>Space</b>: Zeige fullscreen | <b>P</b>: Datums Picker</p>\n" },
1027{ "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" }, 1027{ "<p><b>I</b>: Show info for selected event/todo</p>\n","<p><b>I</b>: Zeige Info (Details) für selektiertes Item</p>\n" },
1028{ "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" }, 1028{ "<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n","<p><b>H</b>: Dieser Hilfe Dialog | <b>S</b>: Such Dialog</p>\n" },
1029{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" }, 1029{ "<p><h2>KO/Pi key shortcuts:</h2></p>\n","<p><h2>KO/Pi Tastatur Kurzbefehle:</h2></p>\n" },
1030{ "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","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" }, 1030{ "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","Nachdem etwas geändert wurde, werden die\nDaten automatisch in die Datei abgespeichert\n~/kdepim/apps/korganizer/mycalendar.ics\nnach (konfigurierbar) drei Minuten.\nAus Sicherheitsgründen wird noch einmal\nnach 10 Min. abgespeichert, wenn keine\nÄnderungen vorgenommen wurden. Die \nDaten werden automatisch gespeichert,\nwenn KO/Pi beendet wird.\nSie können eine Backup-Datei erstellen im\nMenu: Datei - Speichere Kalender Backup\n" },
1031{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" }, 1031{ "Auto Saving in KOrganizer/Pi","Auto Speichern in KOrganizer/Pi" },
1032{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" }, 1032{ "\nhttp://sourceforge.net/projects/kdepimpi\n","\nhttp://sourceforge.net/projects/kdepimpi\n" },
1033{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" }, 1033{ "\nor report them in the bugtracker on\n","\noder trage sie in dem Bugtracker ein auf\n" },
1034{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.info\n" }, 1034{ "\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n","\nBitte melde fehlerhaftes Verhalten an\nlutz@pi-sync.info\n" },
1035{ "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" }, 1035{ "2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n","2) Ein Audio Alarm Daemon\nfür den Zaurus ist verfügbar\nals zusätzliche Anwendung\n" },
1036{ "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","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" }, 1036{ "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","1) Importieren von *.vcs oder *.ics Dateien von\nanderen Anwendungen kann möglicherweise\n nicht richtig funktionieren,\nwenn die Termine Eigenschaften haben,\ndie KO/Pi nicht unterstützt.\n" },
1037{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" }, 1037{ "Known Problems in KOrganizer/Pi","Bekannte Probleme in KOrganizer/Pi" },
1038{ "KO/Pi FAQ","KO/Pi FAQ" }, 1038{ "KO/Pi FAQ","KO/Pi FAQ" },
1039{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" }, 1039{ "PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n","PDA-Edition\nfür: Zaurus 5x00/7x0/860/3000/6000\n" },
1040{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" }, 1040{ "KOrganizer/Platform-independent\n","KOrganizer/Platform-independent\n" },
1041{ "About KOrganizer/Pi","Über KOrganizer/Pi" }, 1041{ "About KOrganizer/Pi","Über KOrganizer/Pi" },
1042{ "From: ","Von: " }, 1042{ "From: ","Von: " },
1043{ "Remove sync info","Entferne Sync Info" }, 1043{ "Remove sync info","Entferne Sync Info" },
1044{ "For all profiles","Für alle Profile" }, 1044{ "For all profiles","Für alle Profile" },
1045{ "Hide not Running","Verstecke nicht Laufende" }, 1045{ "Hide not Running","Verstecke nicht Laufende" },
1046{ "ME","ME" }, 1046{ "ME","ME" },
1047{ "Toolbar","Toolbar" }, 1047{ "Toolbar","Toolbar" },
1048{ "Undo Delete...","Löschen rückgängig machen..." }, 1048{ "Undo Delete...","Löschen rückgängig machen..." },
1049{ "Undo Delete","Löschen rückgängig machen" }, 1049{ "Undo Delete","Löschen rückgängig machen" },
1050{ "KDE Sync HowTo...","KDE Sync HowTo..." }, 1050{ "KDE Sync HowTo...","KDE Sync HowTo..." },
1051{ "Multi Sync HowTo...","Multi Sync HowTo..." }, 1051{ "Multi Sync HowTo...","Multi Sync HowTo..." },
1052{ "Januar","Januar" }, 1052{ "Januar","Januar" },
1053{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" }, 1053{ "KO/Pi Keys + Colors","KO/Pi Tasten + Farben" },
1054{ "No Filter","Kein Filter" }, 1054{ "No Filter","Kein Filter" },
1055{ "Multiple Sync options","Multi Sync Optionen" }, 1055{ "Multiple Sync options","Multi Sync Optionen" },
1056{ "Sync algo options","Sync Ablauf Optionen" }, 1056{ "Sync algo options","Sync Ablauf Optionen" },
1057{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" }, 1057{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" },
1058{ "Incoming calendar filter:","Eingehender Kalender Filter:" }, 1058{ "Incoming calendar filter:","Eingehender Kalender Filter:" },
1059{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" }, 1059{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" },
1060{ "Write back options","Optionen zum Zurückschreiben" }, 1060{ "Write back options","Optionen zum Zurückschreiben" },
1061{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" }, 1061{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" },
1062{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" }, 1062{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" },
1063{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" }, 1063{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" },
1064{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" }, 1064{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" },
1065{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" }, 1065{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" },
1066{ "Time period","Zeitspanne" }, 1066{ "Time period","Zeitspanne" },
1067{ "From ","Von " }, 1067{ "From ","Von " },
1068{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " }, 1068{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " },
1069{ " weeks in the future "," Wochen in der Zukunft " }, 1069{ " weeks in the future "," Wochen in der Zukunft " },
1070{ "Profile kind specific settings","Profil Art abhängige Einstellungen" }, 1070{ "Profile kind specific settings","Profil Art abhängige Einstellungen" },
1071{ "Local temp file:","Lokale temp Datei:" }, 1071{ "Local temp file:","Lokale temp Datei:" },
1072{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" }, 1072{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" },
1073{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" }, 1073{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" },
1074{ "Language","Sprache" }, 1074{ "Language","Sprache" },
1075{ "Time Format","Zeit Format" }, 1075{ "Time Format","Zeit Format" },
1076{ "Time Zone","Zeit Zone" }, 1076{ "Time Zone","Zeit Zone" },
1077{ "%1 groups subscribed","%1 Guppen abboniert" }, 1077{ "%1 groups subscribed","%1 Guppen abboniert" },
1078{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" }, 1078{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" },
1079{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" }, 1079{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" },
1080{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" }, 1080{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" },
1081{ "Save settings","Speichere Einstellungen" }, 1081{ "Save settings","Speichere Einstellungen" },
1082{ "Save standard","Speichere Standard" }, 1082{ "Save standard","Speichere Standard" },
1083{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" }, 1083{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
1084{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" }, 1084{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" },
1085{ "Data storage path","Daten Speicherpfad" }, 1085{ "Data storage path","Daten Speicherpfad" },
1086{ "Language","Sprache" }, 1086{ "Language","Sprache" },
1087{ "Show time in agenda items","Zeige Zeit in Agenda Items" }, 1087{ "Show time in agenda items","Zeige Zeit in Agenda Items" },
1088{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" }, 1088{ "Color for Sundays + category "Holiday"","Farbe für Sonntags + Kategorie "Feiertag"" },
1089{ "Show events that are done","Zeige abgelaufene Termine" }, 1089{ "Show events that are done","Zeige abgelaufene Termine" },
1090{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" }, 1090{ "Hide not running Todos in To-do view","Verstecke nicht laufende Todos" },
1091{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" }, 1091{ "+01:00 Europe/Oslo(CET)","+01:00 Europe/Oslo(CET)" },
1092{ "KO/Pi","KO/Pi" }, 1092{ "KO/Pi","KO/Pi" },
1093{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" }, 1093{ "There is nothing to undo!","Es gibt nichts zum\nRückgängigmachen!" },
1094{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." }, 1094{ "Recreating edit dialog. Please wait...","Recreating edit dialog. Please wait..." },
1095{ "Sound.Al.: ","Sound.Al.: " }, 1095{ "Sound.Al.: ","Sound.Al.: " },
1096{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" }, 1096{ "From: %1 To: %2 %3","Von: %1 Bis: %2 %3" },
1097{ "Restore","Wiederherstellen" }, 1097{ "Restore","Wiederherstellen" },
1098{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" }, 1098{ "\nAre you sure you want\nto restore this?","\nMöchten Sie das wirklicht\nwiederherstellen?" },
1099{ "% completed","% erledigt" }, 1099{ "% completed","% erledigt" },
1100{ "%d item(s) found.","%d Item(s) gefunden." }, 1100{ "%d item(s) found.","%d Item(s) gefunden." },
1101{ "Set complete","Setze auf erledigt" }, 1101{ "Set complete","Setze auf erledigt" },
1102{ "(cancelled)","(gecancelt)" }, 1102{ "(cancelled)","(gecancelt)" },
1103{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" }, 1103{ "Click on the week number to\nshow week in agenda view","Klicke auf die Wochennummer\num die Woche in der Agenda anzuzeigen" },
1104{ " Local time "," Locale Zeit " }, 1104{ " Local time "," Locale Zeit " },
1105{ "Form2","Form2" }, 1105{ "Form2","Form2" },
1106{ "Filter enabled","Filter angeschaltet" }, 1106{ "Filter enabled","Filter angeschaltet" },
1107{ "Edit Filters","Ändere Filter" }, 1107{ "Edit Filters","Ändere Filter" },
1108{ "Print What's Next View...","Drucke What's Next Ansicht..." }, 1108{ "Print What's Next View...","Drucke What's Next Ansicht..." },
1109{ "Agenda","Agenda" }, 1109{ "Agenda","Agenda" },
1110{ " ("," (" }, 1110{ " ("," (" },
1111{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" }, 1111{ "<p><b>Due on:</b> %1</p>","<p><b>Fällig am:</b> %1</p>" },
1112{ "Print","Print" }, 1112{ "Print","Print" },
1113{ "&Setup Printer...","Drucker &Setup..." }, 1113{ "&Setup Printer...","Drucker &Setup..." },
1114{ "View Type","Zeige Typ" }, 1114{ "View Type","Zeige Typ" },
1115{ "Page &orientation:","Seiten Ausrichtung:" }, 1115{ "Page &orientation:","Seiten Ausrichtung:" },
1116{ "Use Default of Selected Style","Default des selektierten Stils" }, 1116{ "Use Default of Selected Style","Default des selektierten Stils" },
1117{ "Use Default Setting of Printer","Default Einstellung des Druckers" }, 1117{ "Use Default Setting of Printer","Default Einstellung des Druckers" },
1118{ "Portrait","Portrait" }, 1118{ "Portrait","Portrait" },
1119{ "Landscape","Landschaft" }, 1119{ "Landscape","Landschaft" },
1120{ "Print day","Drucke Tag" }, 1120{ "Print day","Drucke Tag" },
1121{ "CalPrintDay_Base","CalPrintDay_Base" }, 1121{ "CalPrintDay_Base","CalPrintDay_Base" },
1122{ "Date && Time Range","Datum && Zeitspanne" }, 1122{ "Date && Time Range","Datum && Zeitspanne" },
1123{ "&End date:","&Enddatum:" }, 1123{ "&End date:","&Enddatum:" },
1124{ "&Start date:","&Startdatum:" }, 1124{ "&Start date:","&Startdatum:" },
1125{ "Start &time:","Startzeit:" }, 1125{ "Start &time:","Startzeit:" },
1126{ "End ti&me:","Endzeit:" }, 1126{ "End ti&me:","Endzeit:" },
1127{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" }, 1127{ "E&xtend time range to include all events","Erweitere Zeitspanne um alle Termine einzuschliessen" },
1128{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" }, 1128{ "Include to&dos that are due on the printed day(s)","Inclusive To&dos, die an den selektierten Tagen fällig sind" },
1129{ "Alt+D","Alt+D" }, 1129{ "Alt+D","Alt+D" },
1130{ "&Use colors","Nutze Farben" }, 1130{ "&Use colors","Nutze Farben" },
1131{ "Alt+U","Alt+U" }, 1131{ "Alt+U","Alt+U" },
1132{ "Print week","Drucke Woche" }, 1132{ "Print week","Drucke Woche" },
1133{ "CalPrintWeek_Base","CalPrintWeek_Base" }, 1133{ "CalPrintWeek_Base","CalPrintWeek_Base" },
1134{ "Use &colors","Nutze Farben" }, 1134{ "Use &colors","Nutze Farben" },
1135{ "Type of View","Typ der Ansicht" }, 1135{ "Type of View","Typ der Ansicht" },
1136{ "Print as &Filofax page","Drucke als &Filofax Seite" }, 1136{ "Print as &Filofax page","Drucke als &Filofax Seite" },
1137{ "Alt+F","Alt+F" }, 1137{ "Alt+F","Alt+F" },
1138{ "Print as &timetable view:","Drucke als Zeittabelle:" }, 1138{ "Print as &timetable view:","Drucke als Zeittabelle:" },
1139{ "Alt+T","Alt+T" }, 1139{ "Alt+T","Alt+T" },
1140{ "Print as split week view","Drucke als gesplittete Wochenansicht" }, 1140{ "Print as split week view","Drucke als gesplittete Wochenansicht" },
1141{ "Print month","Drucke Monat" }, 1141{ "Print month","Drucke Monat" },
1142{ "CalPrintMonth_Base","CalPrintMonth_Base" }, 1142{ "CalPrintMonth_Base","CalPrintMonth_Base" },
1143{ "&Start month:","&Startmonat:" }, 1143{ "&Start month:","&Startmonat:" },
1144{ "&End month:","&Endmonat:" }, 1144{ "&End month:","&Endmonat:" },
1145{ "Print week &numbers","Drucke Wochen Nummer(n)" }, 1145{ "Print week &numbers","Drucke Wochen Nummer(n)" },
1146{ "Print todos","Drucke Todos" }, 1146{ "Print todos","Drucke Todos" },
1147{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" }, 1147{ "CalPrintTodoConfig_Base","CalPrintTodoConfig_Base" },
1148{ "Include &description of the item","Inclusive Itembeschreibung" }, 1148{ "Include &description of the item","Inclusive Itembeschreibung" },
1149{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" }, 1149{ "Include d&ue date of the item","Inclusive Fälligkeitsdatum des Items" },
1150{ "Include &priority of the item","Inclusive Priorität des Items" }, 1150{ "Include &priority of the item","Inclusive Priorität des Items" },
1151{ "Items to Print","Zu druckende Items" }, 1151{ "Items to Print","Zu druckende Items" },
1152{ "&From:","Von:" }, 1152{ "&From:","Von:" },
1153{ "&To:","Bis:" }, 1153{ "&To:","Bis:" },
1154{ "Print &all todo items","Drucke alle Todo Items" }, 1154{ "Print &all todo items","Drucke alle Todo Items" },
1155{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" }, 1155{ "Print only &uncompleted items","Drucke nur nicht erledigte Todos" },
1156{ "Only items due in the &range:","Nur Items in dem Zeitraum:" }, 1156{ "Only items due in the &range:","Nur Items in dem Zeitraum:" },
1157{ "Todo List","Todo Liste" }, 1157{ "Todo List","Todo Liste" },
1158{ "&Title:","&Titel:" }, 1158{ "&Title:","&Titel:" },
1159{ "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" }, 1159{ "Co&nnect subtodos with its parent","Verbinde Untertodos mit ihren Ober-Todos" },
1160{ "Todo list","Todo Liste" }, 1160{ "Todo list","Todo Liste" },
1161{ "&Print...","Drucke..." }, 1161{ "&Print...","Drucke..." },
1162{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" }, 1162{ "<qt>Printing on printer <b>%1</b></qt>","<qt>Drucke auf Drucker <b>%1</b></qt>" },
1163{ "[Unconfigured]","[Unkonfiguriert]" }, 1163{ "[Unconfigured]","[Unkonfiguriert]" },
1164{ "OK","OK" }, 1164{ "OK","OK" },
1165{ "FilterEditor","FilterEditor" }, 1165{ "FilterEditor","FilterEditor" },
1166{ "Include","Inclusive" }, 1166{ "Include","Inclusive" },
1167{ "Exclude","Exclusive" }, 1167{ "Exclude","Exclusive" },
1168{ "Edit Selection...","Editiere Auswahl" }, 1168{ "Edit Selection...","Editiere Auswahl" },
1169{ "recurring events","wiederholende Termine" }, 1169{ "recurring events","wiederholende Termine" },
1170{ "recurr. events","wiederh.Termine" }, 1170{ "recurr. events","wiederh.Termine" },
1171{ "completed to-dos","erledigte Todos" }, 1171{ "completed to-dos","erledigte Todos" },
1172{ "events","Termine" }, 1172{ "events","Termine" },
1173{ "todos","Todos" }, 1173{ "todos","Todos" },
1174{ "journals","Journale" }, 1174{ "journals","Journale" },
1175{ "public","öffentl." }, 1175{ "public","öffentl." },
1176{ "private","privat" }, 1176{ "private","privat" },
1177{ "confidential","vertraul." }, 1177{ "confidential","vertraul." },
1178{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" }, 1178{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Untertodos.\nAlle erledigten Untertodos\nwerden auch gelöscht!" },
1179{ "Yesterday","Gestern" }, 1179{ "Yesterday","Gestern" },
1180{ "Day after tomorrow","Übermorgen" }, 1180{ "Day after tomorrow","Übermorgen" },
1181{ "Tomorrow","Morgen" }, 1181{ "Tomorrow","Morgen" },
1182{ "Day before yesterday","Vorgestern" }, 1182{ "Day before yesterday","Vorgestern" },
1183{ "Size %1","Größe %1" }, 1183{ "Size %1","Größe %1" },
1184{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1184{ "New Agendasize: %1","Neue Agendagröße: %1" },
1185{ " (%1 y.)"," (%1 J.)" }, 1185{ " (%1 y.)"," (%1 J.)" },
1186{ "Allday:","Ganztägig:" }, 1186{ "Allday:","Ganztägig:" },
1187{ "compl.todos","erled.Todos" }, 1187{ "compl.todos","erled.Todos" },
1188{ "Day view","Tagesansicht" }, 1188{ "Day view","Tagesansicht" },
1189{ "Next days","Nächste Tage" }, 1189{ "Next days","Nächste Tage" },
1190{ "Next week","Nächste Woche" }, 1190{ "Next week","Nächste Woche" },
1191{ "Next two weeks","Nächste zwei Wochen" }, 1191{ "Next two weeks","Nächste zwei Wochen" },
1192{ "This month","Dieser Monat" }, 1192{ "This month","Dieser Monat" },
1193{ "Journal view","Journal" }, 1193{ "Journal view","Journal" },
1194{ "Display all opened","Zeige alle geöffnet" }, 1194{ "Display all opened","Zeige alle geöffnet" },
1195{ "Display all closed","Zeige alle geschlossen" }, 1195{ "Display all closed","Zeige alle geschlossen" },
1196{ "Display all flat","Zeige alle flach" }, 1196{ "Display all flat","Zeige alle flach" },
1197{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1197{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1198{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1198{ "Default todo done color:","Standard Todo erledigt Farbe" },
1199{ "Select week %1-%2","Wähle Woche %1-%2" }, 1199{ "Select week %1-%2","Wähle Woche %1-%2" },
1200{ "Select Week","Wähle Woche" }, 1200{ "Select Week","Wähle Woche" },
1201{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1201{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1202{ "Set Alarm!","Setze Alarm!" }, 1202{ "Set Alarm!","Setze Alarm!" },
1203{ "Changed alarm for %1 items","Alarm für %1 Items geändert" }, 1203{ "Changed alarm for %1 items","Alarm für %1 Items geändert" },
1204{ " and "," und " }, 1204{ " and "," und " },
1205{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1205{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1206{ "Mail to selected","Mail an Ausgewählte" }, 1206{ "Mail to selected","Mail an Ausgewählte" },
1207{ "Mail to all","Mail an Alle" }, 1207{ "Mail to all","Mail an Alle" },
1208{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1208{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1209{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1209{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1210{ " on"," am" }, 1210{ " on"," am" },
1211{ " completed on "," erledigt am " }, 1211{ " completed on "," erledigt am " },
1212{ "Save as Event template","Speichere als Vorlage" }, 1212{ "Save as Event template","Speichere als Vorlage" },
1213{ "Load Event template","Lade Termin Vorlage" }, 1213{ "Load Event template","Lade Termin Vorlage" },
1214{ "Save as Journal template","Speichere als Journal Vorlage" }, 1214{ "Save as Journal template","Speichere als Journal Vorlage" },
1215{ "Insert Journal template","Füge Journal Vorlage ein" }, 1215{ "Insert Journal template","Füge Journal Vorlage ein" },
1216{ "Sub todos:<br>","Unter Todos:<br>" }, 1216{ "Sub todos:<br>","Unter Todos:<br>" },
1217{ "Parent todo:<br>","Über Todo:<br>" }, 1217{ "Parent todo:<br>","Über Todo:<br>" },
1218{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1218{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1219{ " completed"," erledigt" }, 1219{ " completed"," erledigt" },
1220{ "(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!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1220{ "(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!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.info --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1221{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1221{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1222{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1222{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1223{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1223{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1224{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1224{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1225{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1225{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1226{ "Error","Fehler" }, 1226{ "Error","Fehler" },
1227{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1227{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1228{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1228{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1229{ "Warning","Warnung" }, 1229{ "Warning","Warnung" },
1230{ "Select week number","Wähle Wochen Nummer" }, 1230{ "Select week number","Wähle Wochen Nummer" },
1231{ "Februar","Februar" }, 1231{ "Februar","Februar" },
1232{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1232{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1233{ "W","W" }, 1233{ "W","W" },
1234{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1234{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1235{ "T: %1","T: %1" }, 1235{ "T: %1","T: %1" },
1236{ "Start: ","Start: " }, 1236{ "Start: ","Start: " },
1237{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1237{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1238{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1238{ "Password for remote access:","Passwort für fernen Zugriff:" },
1239{ "Remote IP address:","Ferne IP Adresse:" }, 1239{ "Remote IP address:","Ferne IP Adresse:" },
1240{ "Remote port number:","Ferne Port Nummer:" }, 1240{ "Remote port number:","Ferne Port Nummer:" },
1241{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1241{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1242{ "Remote from: ","Fern von: " }, 1242{ "Remote from: ","Fern von: " },
1243{ "Local from: ","Lokal von: " }, 1243{ "Local from: ","Lokal von: " },
1244{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1244{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1245{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1245{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1246{ "Write back","Schreibe zurück" }, 1246{ "Write back","Schreibe zurück" },
1247{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1247{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1248{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1248{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1249{ "Received sync request","Sync Anfrage erhalten" }, 1249{ "Received sync request","Sync Anfrage erhalten" },
1250{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1250{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1251{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1251{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1252{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1252{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1253{ "Sending file...","Sende Datei..." }, 1253{ "Sending file...","Sende Datei..." },
1254{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1254{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1255{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1255{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1256{ "Received %1 bytes","%1 Bytes erhalten" }, 1256{ "Received %1 bytes","%1 Bytes erhalten" },
1257{ "Writing file to disk...","Speichere Datei..." }, 1257{ "Writing file to disk...","Speichere Datei..." },
1258{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1258{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1259{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1259{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1260{ "Synchronize!","Synchronisiere!" }, 1260{ "Synchronize!","Synchronisiere!" },
1261{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1261{ "High clock skew!","Großer Uhrzeitunterschied!" },
1262{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1262{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1263{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1263{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1264{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1264{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1265{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1265{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1266{ "List week view","Listenwochenansicht" }, 1266{ "List week view","Listenwochenansicht" },
1267{ "List week","Listenwochenansicht" }, 1267{ "List week","Listenwochenansicht" },
1268{ "Next Week","Nächste Woche" }, 1268{ "Next Week","Nächste Woche" },
1269{ "Previous Week","Vorherige Woche" }, 1269{ "Previous Week","Vorherige Woche" },
1270{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1270{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1271{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1271{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1272{ "Details","Details" }, 1272{ "Details","Details" },
1273{ "Created time","Erstellt Zeit" }, 1273{ "Created time","Erstellt Zeit" },
1274{ "Last modified time","Geändert Zeit" }, 1274{ "Last modified time","Geändert Zeit" },
1275{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1275{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1276{ "View Options","Anzeige Optionen" }, 1276{ "View Options","Anzeige Optionen" },
1277{ "<b>Created: ","<b>Erstellt am: " }, 1277{ "<b>Created: ","<b>Erstellt am: " },
1278{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1278{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1279{ "Journal: ","Journal: " }, 1279{ "Journal: ","Journal: " },
1280{ "yearly","jährlich" }, 1280{ "yearly","jährlich" },
1281{ "(%1) ","%1-" }, 1281{ "(%1) ","%1-" },
1282{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1282{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1283{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1283{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1284{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1284{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1285{ "Summary/Loc.","Titel/Ort" }, 1285{ "Summary/Loc.","Titel/Ort" },
1286{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1286{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1287{ "Week Number","Wochennummer" }, 1287{ "Week Number","Wochennummer" },
1288{ "Import","Importiere" }, 1288{ "Import","Importiere" },
1289{ "Export","Exportiere" }, 1289{ "Export","Exportiere" },
1290{ "Beam","Beame" }, 1290{ "Beam","Beame" },
1291{ "Export selected","Exportiere Selektierte" }, 1291{ "Export selected","Exportiere Selektierte" },
1292{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1292{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1293{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1293{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1294{ "Journal/Details...","Journale/Details..." }, 1294{ "Journal/Details...","Journale/Details..." },
1295{ "Agenda View","Agenda Ansicht" }, 1295{ "Agenda View","Agenda Ansicht" },
1296{ "Show current time","Zeige aktuelle Zeit" }, 1296{ "Show current time","Zeige aktuelle Zeit" },
1297{ "Edit new item","Bearbeite neuen Eintrag" }, 1297{ "Edit new item","Bearbeite neuen Eintrag" },
1298{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, 1298{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" },
1299{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1299{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1300{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1300{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1301{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, 1301{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1302{ "%1 days\n","%1 Tagen\n" }, 1302{ "%1 days\n","%1 Tagen\n" },
1303{ "1 day\n","1 Tag\n" }, 1303{ "1 day\n","1 Tag\n" },
1304{ "%1 hours\n","%1 Stunden\n" }, 1304{ "%1 hours\n","%1 Stunden\n" },
1305{ "1 hour\n","1 Stunde\n" }, 1305{ "1 hour\n","1 Stunde\n" },
1306{ "%1 minutes\n","%1 Minuten\n" }, 1306{ "%1 minutes\n","%1 Minuten\n" },
1307{ "1 minute\n","1 Minute\n" }, 1307{ "1 minute\n","1 Minute\n" },
1308{ "Only one toolbar","Nur eine Toolbar" }, 1308{ "Only one toolbar","Nur eine Toolbar" },
1309{ "Print","Drucke" }, 1309{ "Print","Drucke" },
1310{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, 1310{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
1311{ "There is nothing selected!","Es ist nichts ausgewählt!" }, 1311{ "There is nothing selected!","Es ist nichts ausgewählt!" },
1312{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, 1312{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
1313{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, 1313{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
1314{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, 1314{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
1315{ "KO/Pi Printout","KO/Pi Ausdruck" }, 1315{ "KO/Pi Printout","KO/Pi Ausdruck" },
1316{ "Print unscaled","Drucke unskaliert" }, 1316{ "Print unscaled","Drucke unskaliert" },
1317{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, 1317{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
1318{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, 1318{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
1319{ "Printout Mode","Druck Modus" }, 1319{ "Printout Mode","Druck Modus" },
1320{ "Filter menu icon","Filtermenu Icon" }, 1320{ "Filter menu icon","Filtermenu Icon" },
1321{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, 1321{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
1322{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, 1322{ "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" },
1323{ "%1d","%1t" }, 1323{ "%1d","%1t" },
1324{ "%1h","%1std" }, 1324{ "%1h","%1std" },
1325{ "%1min","%1min" }, 1325{ "%1min","%1min" },
1326{ "( %1 before )","( %1 vorher )" }, 1326{ "( %1 before )","( %1 vorher )" },
1327{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1327{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1328{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1328{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1329{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1329{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1330{ "Show Sync Events","Zeige Sync-Ereignisse" }, 1330{ "Show Sync Events","Zeige Sync-Ereignisse" },
1331{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1331{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1332{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1332{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1333{ " on "," am " }, 1333{ " on "," am " },
1334{ "On: ","Am: " }, 1334{ "On: ","Am: " },
1335{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1335{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1336{ "Start/Stop todo...","Starte/Stoppe Todo..." }, 1336{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1337{ "Color for running todos:","Farbe für laufende Todos:" }, 1337{ "Color for running todos:","Farbe für laufende Todos:" },
1338{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, 1338{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1339{ "Todo is started","Todo ist gestartet" }, 1339{ "Todo is started","Todo ist gestartet" },
1340{ "Stop todo","Stoppe Todo" }, 1340{ "Stop todo","Stoppe Todo" },
1341{ "Todo is stopped","Todo ist gestoppt" }, 1341{ "Todo is stopped","Todo ist gestoppt" },
1342{ "Start todo","Starte Todo" }, 1342{ "Start todo","Starte Todo" },
1343{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, 1343{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1344{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, 1344{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" },
1345{ "Todo has subtodos","Todo hat Untertodos" }, 1345{ "Todo has subtodos","Todo hat Untertodos" },
1346{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, 1346{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
1347{ "Colors","Farben" }, 1347{ "Colors","Farben" },
1348{ "Click on new parent item","Klicke auf neues Übertodo" }, 1348{ "Click on new parent item","Klicke auf neues Übertodo" },
1349{ "Reparenting aborted!","Übertodo setzen abgebrochen" }, 1349{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
1350{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, 1350{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
1351{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, 1351{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
1352{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, 1352{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
1353{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, 1353{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
1354{ "times","Zeiten" }, 1354{ "times","Zeiten" },
1355{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, 1355{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" },
1356{ "Backup enabled","Backup angeschaltet" }, 1356{ "Backup enabled","Backup angeschaltet" },
1357{ "Use standard backup dir","Standard Backupverzeichnis" }, 1357{ "Use standard backup dir","Standard Backupverzeichnis" },
1358{ "Number of Backups:","Anzahl der Backups" }, 1358{ "Number of Backups:","Anzahl der Backups" },
1359{ "Make backup every ","Mache ein Backup alle " }, 1359{ "Make backup every ","Mache ein Backup alle " },
1360{ " days"," Tage" }, 1360{ " days"," Tage" },
1361{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, 1361{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
1362{ "Backup Failed!","Backup Problem!" }, 1362{ "Backup Failed!","Backup Problem!" },
1363{ "Try again now","Versuche jetzt nochmal" }, 1363{ "Try again now","Versuche jetzt nochmal" },
1364{ "Try again later","Versuche später nochmal" }, 1364{ "Try again later","Versuche später nochmal" },
1365{ "Try again tomorrow","Versuche morgen nochmal" }, 1365{ "Try again tomorrow","Versuche morgen nochmal" },
1366{ "Disable backup","Schalte Backup ab" }, 1366{ "Disable backup","Schalte Backup ab" },
1367{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" }, 1367{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
1368{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" }, 1368{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
1369{ "Choose action","Wähle Aktion" }, 1369{ "Choose action","Wähle Aktion" },
1370{ "Comment for todo:","Kommentar zum Todo:" }, 1370{ "Comment for todo:","Kommentar zum Todo:" },
1371{ "Stop+note","Stop+Notiz" }, 1371{ "Stop+note","Stop+Notiz" },
1372{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1372{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1373{ "","" }, 1373{ "KO/Pi: Missing alarm notification!","KO/Pi: Benachrichtigung über verpasste Alarme!" },
1374{ "","" }, 1374{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1375{ "","" }, 1375{ "","" },
1376{ "","" }, 1376{ "","" },
1377{ "","" }, 1377{ "","" },
1378{ "","" }, 1378{ "","" },
1379{ "","" }, 1379{ "","" },
1380{ "","" }, 1380{ "","" },
1381{ "","" }, \ No newline at end of file 1381{ "","" }, \ No newline at end of file
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 503ef12..36db9c4 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,2740 +1,2898 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preton.brown@yale.edu) 8 Preston Brown (preton.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 110#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 111#include "statusdialog.h"
112#include "kdatenavigator.h" 112#include "kdatenavigator.h"
113#include "kotodoview.h" 113#include "kotodoview.h"
114#include "datenavigator.h" 114#include "datenavigator.h"
115#include "resourceview.h" 115#include "resourceview.h"
116#include "navigatorbar.h" 116#include "navigatorbar.h"
117#include "searchdialog.h" 117#include "searchdialog.h"
118#include "mainwindow.h" 118#include "mainwindow.h"
119 119
120#include "calendarview.h" 120#include "calendarview.h"
121#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
122#include <qtopia/alarmserver.h> 122#include <qtopia/alarmserver.h>
123#endif 123#endif
124#ifndef _WIN32_ 124#ifndef _WIN32_
125#include <stdlib.h> 125#include <stdlib.h>
126#include <stdio.h> 126#include <stdio.h>
127#include <unistd.h> 127#include <unistd.h>
128#else 128#else
129#include <qprocess.h> 129#include <qprocess.h>
130#endif 130#endif
131 131
132#ifdef DESKTOP_VERSION 132#ifdef DESKTOP_VERSION
133#include <kabc/stdaddressbook.h> 133#include <kabc/stdaddressbook.h>
134#endif 134#endif
135using namespace KOrg; 135using namespace KOrg;
136using namespace KCal; 136using namespace KCal;
137extern int globalFlagBlockAgenda; 137extern int globalFlagBlockAgenda;
138extern int globalFlagBlockStartup; 138extern int globalFlagBlockStartup;
139 139
140 140
141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
142
143{
144 mAlarms = alarms;
145 setBackgroundColor( QColor( 86, 153, 205 ) );
146 QString mText = "<table width=\"100%\">\n";
147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
148#ifdef DESKTOP_VERSION
149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
152#endif
153 // mText += "<img src=\"";
154 // mText += ipath;
155 // mText += "\">";
156 //mEventDate = QDate::currentDate();
157#ifdef DESKTOP_VERSION
158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h1>";
159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
161#endif
162 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
163
164 Incidence * inc = getNextInc( start );
165 int time = 0;
166 mText += "<table>";
167 while ( inc ) {
168 QDateTime dt ;
169 QString tempText = "<a ";
170 bool ok;
171 dt = inc->getNextOccurence( start, &ok );
172 if ( !ok ) continue;
173 if ( inc->type() == "Event" ) {
174 tempText += "href=\"event:";
175 } else if ( inc->type() == "Todo" ) {
176 tempText += "href=\"todo:";
177 }
178 tempText += inc->uid() + "\">";
179 if ( inc->type() == "Todo" )
180 tempText += i18n("Todo: ");
181 if ( inc->summary().length() > 0 )
182 tempText += inc->summary();
183 else
184 tempText += i18n("-no summary-");
185 QString timestr;
186 if (!inc->doesFloat())
187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
188 else
189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
190 if ( dt.date() == QDate::currentDate() && time == 0 ) {
191 time = 1;
192 mText +="</table>";
193 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
194 mText += "<table>";
195
196 }
197 if ( dt.date() > QDate::currentDate() && time != 2 ) {
198 time = 2;
199 mText +="</table>";
200 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
201 mText += "<table>";
202 }
203 mText +="<tr><td><b>";
204 mText += timestr;
205 mText += "</b></td><td>";
206 mText += tempText;
207 mText += "</td></tr>\n";
208 inc = getNextInc( start );
209 }
210 mText +="</table>";
211 setText( mText );
212}
213
214Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
215{
216 QDateTime dt ;
217 Incidence * retInc;
218 Incidence * inc = mAlarms.first();
219 if ( inc == 0 )
220 return 0;
221 bool ok;
222 dt = inc->getNextOccurence( start, &ok );
223 if ( ! ok ) return 0;
224 QDateTime dtn ;
225 retInc = inc;
226 inc = mAlarms.next();
227 while ( inc ) {
228 dtn = inc->getNextOccurence( start, &ok );
229 if ( ! ok ) return 0;
230 if ( dtn < dt ) {
231 dt = dtn;
232 retInc = inc;
233 }
234 inc = mAlarms.next();
235 }
236 mAlarms.remove( retInc );
237 return retInc;
238
239}
240void MissedAlarmTextBrowser::setSource(const QString & n)
241{
242 if (n.startsWith("event:")) {
243#ifdef DESKTOP_VERSION
244 emit showIncidence(n.mid(8));
245#else
246 emit showIncidence(n.mid(6));
247#endif
248 return;
249 } else if (n.startsWith("todo:")) {
250#ifdef DESKTOP_VERSION
251 emit showIncidence(n.mid(7));
252#else
253 emit showIncidence(n.mid(5));
254#endif
255 return;
256 }
257}
258
141 259
142class KOBeamPrefs : public QDialog 260class KOBeamPrefs : public QDialog
143{ 261{
144 public: 262 public:
145 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 263 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
146 QDialog( parent, name, true ) 264 QDialog( parent, name, true )
147 { 265 {
148 setCaption( i18n("Beam Options") ); 266 setCaption( i18n("Beam Options") );
149 QVBoxLayout* lay = new QVBoxLayout( this ); 267 QVBoxLayout* lay = new QVBoxLayout( this );
150 lay->setSpacing( 3 ); 268 lay->setSpacing( 3 );
151 lay->setMargin( 3 ); 269 lay->setMargin( 3 );
152 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 270 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
153 lay->addWidget( format ); 271 lay->addWidget( format );
154 format->setExclusive ( true ) ; 272 format->setExclusive ( true ) ;
155 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 273 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
156 lay->addWidget( time ); time->setExclusive ( true ) ; 274 lay->addWidget( time ); time->setExclusive ( true ) ;
157 vcal = new QRadioButton(" vCalendar ", format ); 275 vcal = new QRadioButton(" vCalendar ", format );
158 ical = new QRadioButton(" iCalendar ", format ); 276 ical = new QRadioButton(" iCalendar ", format );
159 vcal->setChecked( true ); 277 vcal->setChecked( true );
160 tz = new QRadioButton(i18n(" With timezone "), time ); 278 tz = new QRadioButton(i18n(" With timezone "), time );
161 local = new QRadioButton(i18n(" Local time "), time ); 279 local = new QRadioButton(i18n(" Local time "), time );
162 tz->setChecked( true ); 280 tz->setChecked( true );
163 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 281 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
164 lay->addWidget( ok ); 282 lay->addWidget( ok );
165 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 283 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
166 lay->addWidget( cancel ); 284 lay->addWidget( cancel );
167 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 285 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
168 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 286 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
169 resize( 200, 200 ); 287 resize( 200, 200 );
170 } 288 }
171 289
172 bool beamVcal() { return vcal->isChecked(); } 290 bool beamVcal() { return vcal->isChecked(); }
173 bool beamLocal() { return local->isChecked(); } 291 bool beamLocal() { return local->isChecked(); }
174private: 292private:
175 QRadioButton* vcal, *ical, *local, *tz; 293 QRadioButton* vcal, *ical, *local, *tz;
176}; 294};
177class KOCatPrefs : public QDialog 295class KOCatPrefs : public QDialog
178{ 296{
179 public: 297 public:
180 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 298 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
181 QDialog( parent, name, true ) 299 QDialog( parent, name, true )
182 { 300 {
183 setCaption( i18n("Manage new Categories") ); 301 setCaption( i18n("Manage new Categories") );
184 QVBoxLayout* lay = new QVBoxLayout( this ); 302 QVBoxLayout* lay = new QVBoxLayout( this );
185 lay->setSpacing( 3 ); 303 lay->setSpacing( 3 );
186 lay->setMargin( 3 ); 304 lay->setMargin( 3 );
187 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 305 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
188 lay->addWidget( lab ); 306 lay->addWidget( lab );
189 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 307 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
190 lay->addWidget( format ); 308 lay->addWidget( format );
191 format->setExclusive ( true ) ; 309 format->setExclusive ( true ) ;
192 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 310 addCatBut = new QRadioButton(i18n("Add to category list"), format );
193 new QRadioButton(i18n("Remove from Events/Todos"), format ); 311 new QRadioButton(i18n("Remove from Events/Todos"), format );
194 addCatBut->setChecked( true ); 312 addCatBut->setChecked( true );
195 QPushButton * ok = new QPushButton( i18n("OK"), this ); 313 QPushButton * ok = new QPushButton( i18n("OK"), this );
196 lay->addWidget( ok ); 314 lay->addWidget( ok );
197 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 315 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
198 lay->addWidget( cancel ); 316 lay->addWidget( cancel );
199 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 317 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
200 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 318 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
201 resize( 200, 200 ); 319 resize( 200, 200 );
202 } 320 }
203 321
204 bool addCat() { return addCatBut->isChecked(); } 322 bool addCat() { return addCatBut->isChecked(); }
205private: 323private:
206 QRadioButton* addCatBut; 324 QRadioButton* addCatBut;
207}; 325};
208 326
209 327
210 328
211CalendarView::CalendarView( CalendarResources *calendar, 329CalendarView::CalendarView( CalendarResources *calendar,
212 QWidget *parent, const char *name ) 330 QWidget *parent, const char *name )
213 : CalendarViewBase( parent, name ), 331 : CalendarViewBase( parent, name ),
214 mCalendar( calendar ), 332 mCalendar( calendar ),
215 mResourceManager( calendar->resourceManager() ) 333 mResourceManager( calendar->resourceManager() )
216{ 334{
217 335
218 mEventEditor = 0; 336 mEventEditor = 0;
219 mTodoEditor = 0; 337 mTodoEditor = 0;
220 338
221 init(); 339 init();
222} 340}
223 341
224CalendarView::CalendarView( Calendar *calendar, 342CalendarView::CalendarView( Calendar *calendar,
225 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
226 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
227 mCalendar( calendar ), 345 mCalendar( calendar ),
228 mResourceManager( 0 ) 346 mResourceManager( 0 )
229{ 347{
230 348
231 mEventEditor = 0; 349 mEventEditor = 0;
232 mTodoEditor = 0; 350 mTodoEditor = 0;
233 init(); 351 init();
234} 352}
235 353
236void CalendarView::init() 354void CalendarView::init()
237{ 355{
238 mNextAlarmDateTime = QDateTime::currentDateTime(); 356 mNextAlarmDateTime = QDateTime::currentDateTime();
239 setFocusPolicy ( NoFocus ); 357 setFocusPolicy ( NoFocus );
240 mViewerCallerIsSearchDialog = false; 358 mViewerCallerIsSearchDialog = false;
241 mBlockShowDates = false; 359 mBlockShowDates = false;
242 beamDialog = new KOBeamPrefs(); 360 beamDialog = new KOBeamPrefs();
243 mDatePickerMode = 0; 361 mDatePickerMode = 0;
244 mCurrentSyncDevice = ""; 362 mCurrentSyncDevice = "";
245 writeLocale(); 363 writeLocale();
246 mViewManager = new KOViewManager( this ); 364 mViewManager = new KOViewManager( this );
247 mDialogManager = new KODialogManager( this ); 365 mDialogManager = new KODialogManager( this );
248 mEventViewerDialog = 0; 366 mEventViewerDialog = 0;
249 mModified = false; 367 mModified = false;
250 mReadOnly = false; 368 mReadOnly = false;
251 mSelectedIncidence = 0; 369 mSelectedIncidence = 0;
252 mCalPrinter = 0; 370 mCalPrinter = 0;
253 mFilters.setAutoDelete(true); 371 mFilters.setAutoDelete(true);
254 372
255 mCalendar->registerObserver( this ); 373 mCalendar->registerObserver( this );
256 // TODO: Make sure that view is updated, when calendar is changed. 374 // TODO: Make sure that view is updated, when calendar is changed.
257 375
258 mStorage = new FileStorage( mCalendar ); 376 mStorage = new FileStorage( mCalendar );
259 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 377 mNavigator = new DateNavigator( this, "datevav", mViewManager );
260 378
261 QBoxLayout *topLayout = (QBoxLayout*)layout(); 379 QBoxLayout *topLayout = (QBoxLayout*)layout();
262#ifndef KORG_NOSPLITTER 380#ifndef KORG_NOSPLITTER
263 // create the main layout frames. 381 // create the main layout frames.
264 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 382 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
265 topLayout->addWidget(mPanner); 383 topLayout->addWidget(mPanner);
266 384
267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 385 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
268 "CalendarView::LeftFrame"); 386 "CalendarView::LeftFrame");
269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 387 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
270 388
271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 389 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
272 "CalendarView::DateNavigator" ); 390 "CalendarView::DateNavigator" );
273 391
274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 392 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 393 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
276 mTodoList->setNavigator( mNavigator ); 394 mTodoList->setNavigator( mNavigator );
277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 395 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
278 396
279#ifdef KORG_NORESOURCEVIEW 397#ifdef KORG_NORESOURCEVIEW
280 mResourceView = 0; 398 mResourceView = 0;
281#else 399#else
282 if ( mResourceManager ) { 400 if ( mResourceManager ) {
283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 401 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
284 mResourceView->updateView(); 402 mResourceView->updateView();
285 connect( mResourceView, SIGNAL( resourcesChanged() ), 403 connect( mResourceView, SIGNAL( resourcesChanged() ),
286 SLOT( updateView() ) ); 404 SLOT( updateView() ) );
287 } else { 405 } else {
288 mResourceView = 0; 406 mResourceView = 0;
289 } 407 }
290#endif 408#endif
291 QWidget *rightBox = new QWidget( mPanner ); 409 QWidget *rightBox = new QWidget( mPanner );
292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 410 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
293 411
294 mRightFrame = new QWidgetStack( rightBox ); 412 mRightFrame = new QWidgetStack( rightBox );
295 rightLayout->addWidget( mRightFrame, 1 ); 413 rightLayout->addWidget( mRightFrame, 1 );
296 414
297 mLeftFrame = mLeftSplitter; 415 mLeftFrame = mLeftSplitter;
298#else 416#else
299 //QWidget *mainBox = new QWidget( this ); 417 //QWidget *mainBox = new QWidget( this );
300 //QWidget *leftFrame = new QWidget( mainBox ); 418 //QWidget *leftFrame = new QWidget( mainBox );
301 //QBoxLayout * mainBoxLayout; 419 //QBoxLayout * mainBoxLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 420 if ( KOPrefs::instance()->mVerticalScreen ) {
303 //mainBoxLayout = new QVBoxLayout(mainBox); 421 //mainBoxLayout = new QVBoxLayout(mainBox);
304 //leftFrameLayout = new QHBoxLayout(leftFrame ); 422 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 423 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 424 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 425 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 426 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
309 } else { 427 } else {
310 //mainBoxLayout = new QHBoxLayout(mainBox); 428 //mainBoxLayout = new QHBoxLayout(mainBox);
311 //leftFrameLayout = new QVBoxLayout(leftFrame ); 429 //leftFrameLayout = new QVBoxLayout(leftFrame );
312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 430 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 431 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 432 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 433 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
316 } 434 }
317 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 435 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
318 //QBoxLayout * leftFrameLayout; 436 //QBoxLayout * leftFrameLayout;
319 topLayout->addWidget( mMainFrame ); 437 topLayout->addWidget( mMainFrame );
320 //mainBoxLayout->addWidget (mLeftFrame); 438 //mainBoxLayout->addWidget (mLeftFrame);
321 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 439 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
322 "CalendarView::DateNavigator" ); 440 "CalendarView::DateNavigator" );
323#if 0 441#if 0
324 // FIXME 442 // FIXME
325 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 443 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
326 "CalendarView::DateNavigator", QDate::currentDate()); 444 "CalendarView::DateNavigator", QDate::currentDate());
327#endif 445#endif
328 // mDateNavigator->blockSignals( true ); 446 // mDateNavigator->blockSignals( true );
329 //leftFrameLayout->addWidget( mDateNavigator ); 447 //leftFrameLayout->addWidget( mDateNavigator );
330 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 448 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
331 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 449 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
332 mTodoList->setNavigator( mNavigator ); 450 mTodoList->setNavigator( mNavigator );
333#if 0 451#if 0
334 if ( QApplication::desktop()->width() < 480 ) { 452 if ( QApplication::desktop()->width() < 480 ) {
335 leftFrameLayout->addWidget(mFilterView); 453 leftFrameLayout->addWidget(mFilterView);
336 leftFrameLayout->addWidget(mTodoList, 2 ); 454 leftFrameLayout->addWidget(mTodoList, 2 );
337 455
338 } else { 456 } else {
339 leftFrameLayout->addWidget(mTodoList,2 ); 457 leftFrameLayout->addWidget(mTodoList,2 );
340 leftFrameLayout->addWidget(mFilterView ); 458 leftFrameLayout->addWidget(mFilterView );
341 } 459 }
342#endif 460#endif
343 mFilterView->hide(); 461 mFilterView->hide();
344 QWidget *rightBox = new QWidget( mMainFrame ); 462 QWidget *rightBox = new QWidget( mMainFrame );
345 //mainBoxLayout->addWidget ( rightBox, 10 ); 463 //mainBoxLayout->addWidget ( rightBox, 10 );
346 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 464 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
347 mRightFrame = new QWidgetStack( rightBox ); 465 mRightFrame = new QWidgetStack( rightBox );
348 rightLayout->addWidget( mRightFrame, 10 ); 466 rightLayout->addWidget( mRightFrame, 10 );
349 467
350 //mLeftFrame = (QWidget *)leftFrame; 468 //mLeftFrame = (QWidget *)leftFrame;
351 if ( KOPrefs::instance()->mVerticalScreen ) { 469 if ( KOPrefs::instance()->mVerticalScreen ) {
352 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 470 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
353 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 471 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
354 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 472 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
355 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 473 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
356 } else { 474 } else {
357 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 475 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
358 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 476 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
359 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 477 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
360 } 478 }
361 if ( !KOPrefs::instance()->mShowDateNavigator) 479 if ( !KOPrefs::instance()->mShowDateNavigator)
362 mDateNavigator->hide(); 480 mDateNavigator->hide();
363 //qDebug("Calendarview Size %d %d ", width(), height()); 481 //qDebug("Calendarview Size %d %d ", width(), height());
364#endif 482#endif
365 483
366 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 484 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
367 SLOT( showDates( const KCal::DateList & ) ) ); 485 SLOT( showDates( const KCal::DateList & ) ) );
368 486
369 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 487 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
370 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 488 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
371 489
372 490
373 491
374 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 492 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
375 mViewManager, SLOT( showMonth( const QDate & ) ) ); 493 mViewManager, SLOT( showMonth( const QDate & ) ) );
376 494
377 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 495 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
378 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 496 mNavigator, SLOT( selectWeek( const QDate & ) ) );
379 497
380 connect( mDateNavigator, SIGNAL( goPrevYear() ), 498 connect( mDateNavigator, SIGNAL( goPrevYear() ),
381 mNavigator, SLOT( selectPreviousYear() ) ); 499 mNavigator, SLOT( selectPreviousYear() ) );
382 connect( mDateNavigator, SIGNAL( goNextYear() ), 500 connect( mDateNavigator, SIGNAL( goNextYear() ),
383 mNavigator, SLOT( selectNextYear() ) ); 501 mNavigator, SLOT( selectNextYear() ) );
384 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 502 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
385 mNavigator, SLOT( selectPreviousMonth() ) ); 503 mNavigator, SLOT( selectPreviousMonth() ) );
386 connect( mDateNavigator, SIGNAL( goNextMonth() ), 504 connect( mDateNavigator, SIGNAL( goNextMonth() ),
387 mNavigator, SLOT( selectNextMonth() ) ); 505 mNavigator, SLOT( selectNextMonth() ) );
388 506
389 connect( mDateNavigator, SIGNAL( goPrevious() ), 507 connect( mDateNavigator, SIGNAL( goPrevious() ),
390 mNavigator, SLOT( selectPrevious() ) ); 508 mNavigator, SLOT( selectPrevious() ) );
391 connect( mDateNavigator, SIGNAL( goNext() ), 509 connect( mDateNavigator, SIGNAL( goNext() ),
392 mNavigator, SLOT( selectNext() ) ); 510 mNavigator, SLOT( selectNext() ) );
393 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 511 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
394 mNavigator, SLOT( slotMonthSelect( int ) ) ); 512 mNavigator, SLOT( slotMonthSelect( int ) ) );
395 513
396 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 514 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
397 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 515 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
398#if 0 516#if 0
399 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 517 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
400 SLOT( incidenceAdded( Incidence *) ) ); 518 SLOT( incidenceAdded( Incidence *) ) );
401#endif 519#endif
402 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 520 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
403 521
404 connect( this, SIGNAL( configChanged() ), 522 connect( this, SIGNAL( configChanged() ),
405 mDateNavigator, SLOT( updateConfig() ) ); 523 mDateNavigator, SLOT( updateConfig() ) );
406 524
407 connect( mTodoList, SIGNAL( newTodoSignal() ), 525 connect( mTodoList, SIGNAL( newTodoSignal() ),
408 SLOT( newTodo() ) ); 526 SLOT( newTodo() ) );
409 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 527 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
410 SLOT( newSubTodo( Todo * ) ) ); 528 SLOT( newSubTodo( Todo * ) ) );
411 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 529 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
412 SLOT( editTodo( Todo * ) ) ); 530 SLOT( editTodo( Todo * ) ) );
413 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 531 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
414 SLOT( showTodo( Todo *) ) ); 532 SLOT( showTodo( Todo *) ) );
415 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 533 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
416 SLOT( deleteTodo( Todo *) ) ); 534 SLOT( deleteTodo( Todo *) ) );
417 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 535 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
418 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 536 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
419 SLOT( purgeCompleted() ) ); 537 SLOT( purgeCompleted() ) );
420 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 538 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
421 SIGNAL( todoModified( Todo *, int ) ) ); 539 SIGNAL( todoModified( Todo *, int ) ) );
422 540
423 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 541 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
424 this, SLOT ( cloneIncidence( Incidence * ) ) ); 542 this, SLOT ( cloneIncidence( Incidence * ) ) );
425 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 543 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
426 this, SLOT (cancelIncidence( Incidence * ) ) ); 544 this, SLOT (cancelIncidence( Incidence * ) ) );
427 545
428 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 546 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
429 this, SLOT ( moveIncidence( Incidence * ) ) ); 547 this, SLOT ( moveIncidence( Incidence * ) ) );
430 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 548 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
431 this, SLOT ( beamIncidence( Incidence * ) ) ); 549 this, SLOT ( beamIncidence( Incidence * ) ) );
432 550
433 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 551 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
434 this, SLOT ( todo_unsub( Todo * ) ) ); 552 this, SLOT ( todo_unsub( Todo * ) ) );
435 553
436 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 554 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
437 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 555 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
438 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 556 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
439 SLOT( updateTodo( Todo *, int ) ) ); 557 SLOT( updateTodo( Todo *, int ) ) );
440 connect( this, SIGNAL( todoModified( Todo *, int )), this, 558 connect( this, SIGNAL( todoModified( Todo *, int )), this,
441 SLOT( changeTodoDisplay( Todo *, int ) ) ); 559 SLOT( changeTodoDisplay( Todo *, int ) ) );
442 560
443 561
444 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 562 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
445 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 563 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
446 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 564 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
447 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 565 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
448 566
449 567
450 568
451 569
452 570
453 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 571 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
454 SLOT(checkClipboard())); 572 SLOT(checkClipboard()));
455 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 573 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
456 SLOT( processTodoListSelection( Incidence * ) ) ); 574 SLOT( processTodoListSelection( Incidence * ) ) );
457 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 575 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
458 576
459 // kdDebug() << "CalendarView::CalendarView() done" << endl; 577 // kdDebug() << "CalendarView::CalendarView() done" << endl;
460 578
461 mDateFrame = new QVBox(0,0,WType_Popup); 579 mDateFrame = new QVBox(0,0,WType_Popup);
462 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 580 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
463 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 581 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
464 mDateFrame->setLineWidth(3); 582 mDateFrame->setLineWidth(3);
465 mDateFrame->hide(); 583 mDateFrame->hide();
466 mDateFrame->setCaption( i18n( "Pick a date to display")); 584 mDateFrame->setCaption( i18n( "Pick a date to display"));
467 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 585 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
468 586
469 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 587 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
470 588
471 mEventEditor = mDialogManager->getEventEditor(); 589 mEventEditor = mDialogManager->getEventEditor();
472 mTodoEditor = mDialogManager->getTodoEditor(); 590 mTodoEditor = mDialogManager->getTodoEditor();
473 591
474 mFlagEditDescription = false; 592 mFlagEditDescription = false;
475 593
476 mSuspendTimer = new QTimer( this ); 594 mSuspendTimer = new QTimer( this );
477 mAlarmTimer = new QTimer( this ); 595 mAlarmTimer = new QTimer( this );
478 mRecheckAlarmTimer = new QTimer( this ); 596 mRecheckAlarmTimer = new QTimer( this );
479 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 597 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
480 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 598 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
481 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 599 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
482 mAlarmDialog = new AlarmDialog( this ); 600 mAlarmDialog = new AlarmDialog( this );
483 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 601 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
484 mAlarmDialog->setServerNotification( false ); 602 mAlarmDialog->setServerNotification( false );
485 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 603 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
486 604
487 605
488#ifndef DESKTOP_VERSION 606#ifndef DESKTOP_VERSION
489//US listen for arriving address resultsets 607//US listen for arriving address resultsets
490 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 608 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
491 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 609 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
492#endif 610#endif
493 mDateNavigator->setCalendar( mCalendar ); 611 mDateNavigator->setCalendar( mCalendar );
494} 612}
495 613
496 614
497CalendarView::~CalendarView() 615CalendarView::~CalendarView()
498{ 616{
499 // kdDebug() << "~CalendarView()" << endl; 617 // kdDebug() << "~CalendarView()" << endl;
500 //qDebug("CalendarView::~CalendarView() "); 618 //qDebug("CalendarView::~CalendarView() ");
501 delete mDialogManager; 619 delete mDialogManager;
502 delete mViewManager; 620 delete mViewManager;
503 delete mStorage; 621 delete mStorage;
504 delete mDateFrame ; 622 delete mDateFrame ;
505 delete beamDialog; 623 delete beamDialog;
506 delete mEventViewerDialog; 624 delete mEventViewerDialog;
507 //kdDebug() << "~CalendarView() done" << endl; 625 //kdDebug() << "~CalendarView() done" << endl;
508} 626}
627void CalendarView::checkAlarms()
628{
629 KConfig *config = KOGlobals::config();
630 config->setGroup( "AppRun" );
631 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
632 int secs = config->readNumEntry( "LatestProgramStop" ) - 30;
633 //secs -= ( 3600 * 24*3 ); // debug only
634 QDateTime latest = dt.addSecs ( secs );
635 qDebug("KO: Last termination on %s ", latest.toString().latin1());
636 QPtrList<Incidence> el = mCalendar->rawIncidences();
637 QPtrList<Incidence> al;
638 Incidence* inL = el.first();
639 while ( inL ) {
640 bool ok = false;
641 int offset = 0;
642 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
643 if ( ok ) {
644 //qDebug("OK %s",next.toString().latin1());
645 if ( next < QDateTime::currentDateTime() ) {
646 al.append( inL );
647 qDebug("found missed alarm: %s ", inL->summary().latin1() );
648 }
649 }
650 inL = el.next();
651 }
652 if ( al.count() ) {
653 QDialog dia ( this, "huhu", true );
654 dia.setCaption( i18n("KO/Pi: Missing alarm notification!") );
655 QVBoxLayout* lay = new QVBoxLayout( &dia );
656 lay->setSpacing( 3 );
657 lay->setMargin( 3 );
658 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest );
659 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
660 lay->addWidget( matb );
661 dia.resize(240,240);
662 dia.exec();
509 663
664 }
665}
510void CalendarView::showDay( QDate d ) 666void CalendarView::showDay( QDate d )
511{ 667{
512 dateNavigator()->blockSignals( true ); 668 dateNavigator()->blockSignals( true );
513 dateNavigator()->selectDate( d ); 669 dateNavigator()->selectDate( d );
514 dateNavigator()->blockSignals( false ); 670 dateNavigator()->blockSignals( false );
515 mViewManager->showDayView(); 671 mViewManager->showDayView();
516 //dateNavigator()->selectDate( d ); 672 //dateNavigator()->selectDate( d );
517} 673}
518void CalendarView::timerAlarm() 674void CalendarView::timerAlarm()
519{ 675{
520 //qDebug("CalendarView::timerAlarm() "); 676 //qDebug("CalendarView::timerAlarm() ");
521 computeAlarm(mAlarmNotification ); 677 computeAlarm(mAlarmNotification );
522} 678}
523 679
524void CalendarView::suspendAlarm() 680void CalendarView::suspendAlarm()
525{ 681{
526 //qDebug(" CalendarView::suspendAlarm() "); 682 //qDebug(" CalendarView::suspendAlarm() ");
527 computeAlarm(mSuspendAlarmNotification ); 683 computeAlarm(mSuspendAlarmNotification );
528 684
529} 685}
530 686
531void CalendarView::startAlarm( QString mess , QString filename) 687void CalendarView::startAlarm( QString mess , QString filename)
532{ 688{
533 689
534 topLevelWidget()->showNormal(); 690 topLevelWidget()->showNormal();
535 topLevelWidget()->setActiveWindow(); 691 topLevelWidget()->setActiveWindow();
536 topLevelWidget()->raise(); 692 topLevelWidget()->raise();
537 693
538 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 694 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
539 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 695 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
540 696
541} 697}
542 698
543void CalendarView::checkNextTimerAlarm() 699void CalendarView::checkNextTimerAlarm()
544{ 700{
545 mCalendar->checkAlarmForIncidence( 0, true ); 701 mCalendar->checkAlarmForIncidence( 0, true );
546} 702}
547 703
548void CalendarView::computeAlarm( QString msg ) 704void CalendarView::computeAlarm( QString msg )
549{ 705{
550 706
551 QString mess = msg; 707 QString mess = msg;
552 QString mAlarmMessage = mess.mid( 9 ); 708 QString mAlarmMessage = mess.mid( 9 );
553 QString filename = MainWindow::resourcePath(); 709 QString filename = MainWindow::resourcePath();
554 filename += "koalarm.wav"; 710 filename += "koalarm.wav";
555 QString tempfilename; 711 QString tempfilename;
556 if ( mess.left( 13 ) == "suspend_alarm") { 712 if ( mess.left( 13 ) == "suspend_alarm") {
557 bool error = false; 713 bool error = false;
558 int len = mess.mid( 13 ).find("+++"); 714 int len = mess.mid( 13 ).find("+++");
559 if ( len < 2 ) 715 if ( len < 2 )
560 error = true; 716 error = true;
561 else { 717 else {
562 tempfilename = mess.mid( 13, len ); 718 tempfilename = mess.mid( 13, len );
563 if ( !QFile::exists( tempfilename ) ) 719 if ( !QFile::exists( tempfilename ) )
564 error = true; 720 error = true;
565 } 721 }
566 if ( ! error ) { 722 if ( ! error ) {
567 filename = tempfilename; 723 filename = tempfilename;
568 } 724 }
569 mAlarmMessage = mess.mid( 13+len+3 ); 725 mAlarmMessage = mess.mid( 13+len+3 );
570 //qDebug("suspend file %s ",tempfilename.latin1() ); 726 //qDebug("suspend file %s ",tempfilename.latin1() );
571 startAlarm( mAlarmMessage, filename); 727 startAlarm( mAlarmMessage, filename);
572 return; 728 return;
573 } 729 }
574 if ( mess.left( 11 ) == "timer_alarm") { 730 if ( mess.left( 11 ) == "timer_alarm") {
575 //mTimerTime = 0; 731 //mTimerTime = 0;
576 startAlarm( mess.mid( 11 ), filename ); 732 startAlarm( mess.mid( 11 ), filename );
577 return; 733 return;
578 } 734 }
579 if ( mess.left( 10 ) == "proc_alarm") { 735 if ( mess.left( 10 ) == "proc_alarm") {
580 bool error = false; 736 bool error = false;
581 int len = mess.mid( 10 ).find("+++"); 737 int len = mess.mid( 10 ).find("+++");
582 if ( len < 2 ) 738 if ( len < 2 )
583 error = true; 739 error = true;
584 else { 740 else {
585 tempfilename = mess.mid( 10, len ); 741 tempfilename = mess.mid( 10, len );
586 if ( !QFile::exists( tempfilename ) ) 742 if ( !QFile::exists( tempfilename ) )
587 error = true; 743 error = true;
588 } 744 }
589 if ( error ) { 745 if ( error ) {
590 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 746 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
591 mAlarmMessage += mess.mid( 10+len+3+9 ); 747 mAlarmMessage += mess.mid( 10+len+3+9 );
592 } else { 748 } else {
593 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 749 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
594 //qDebug("-----system command %s ",tempfilename.latin1() ); 750 //qDebug("-----system command %s ",tempfilename.latin1() );
595#ifndef _WIN32_ 751#ifndef _WIN32_
596 if ( vfork () == 0 ) { 752 if ( vfork () == 0 ) {
597 execl ( tempfilename.latin1(), 0 ); 753 execl ( tempfilename.latin1(), 0 );
598 return; 754 return;
599 } 755 }
600#else 756#else
601 QProcess* p = new QProcess(); 757 QProcess* p = new QProcess();
602 p->addArgument( tempfilename.latin1() ); 758 p->addArgument( tempfilename.latin1() );
603 p->start(); 759 p->start();
604 return; 760 return;
605#endif 761#endif
606 762
607 return; 763 return;
608 } 764 }
609 765
610 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 766 //qDebug("+++++++system command %s ",tempfilename.latin1() );
611 } 767 }
612 if ( mess.left( 11 ) == "audio_alarm") { 768 if ( mess.left( 11 ) == "audio_alarm") {
613 bool error = false; 769 bool error = false;
614 int len = mess.mid( 11 ).find("+++"); 770 int len = mess.mid( 11 ).find("+++");
615 if ( len < 2 ) 771 if ( len < 2 )
616 error = true; 772 error = true;
617 else { 773 else {
618 tempfilename = mess.mid( 11, len ); 774 tempfilename = mess.mid( 11, len );
619 if ( !QFile::exists( tempfilename ) ) 775 if ( !QFile::exists( tempfilename ) )
620 error = true; 776 error = true;
621 } 777 }
622 if ( ! error ) { 778 if ( ! error ) {
623 filename = tempfilename; 779 filename = tempfilename;
624 } 780 }
625 mAlarmMessage = mess.mid( 11+len+3+9 ); 781 mAlarmMessage = mess.mid( 11+len+3+9 );
626 //qDebug("audio file command %s ",tempfilename.latin1() ); 782 //qDebug("audio file command %s ",tempfilename.latin1() );
627 } 783 }
628 if ( mess.left( 9 ) == "cal_alarm") { 784 if ( mess.left( 9 ) == "cal_alarm") {
629 mAlarmMessage = mess.mid( 9 ) ; 785 mAlarmMessage = mess.mid( 9 ) ;
630 } 786 }
631 787
632 startAlarm( mAlarmMessage, filename ); 788 startAlarm( mAlarmMessage, filename );
633 789
634 790
635} 791}
636 792
637void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 793void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
638{ 794{
639 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 795 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
640 796
641 mSuspendAlarmNotification = noti; 797 mSuspendAlarmNotification = noti;
642 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 798 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
643 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 799 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
644 mSuspendTimer->start( ms , true ); 800 mSuspendTimer->start( ms , true );
645 801
646} 802}
647 803
648void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 804void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
649{ 805{
650 mNextAlarmDateTime = qdt; 806 mNextAlarmDateTime = qdt;
651 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 807 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
652 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 808 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
653#ifndef DESKTOP_VERSION 809#ifndef DESKTOP_VERSION
654 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 810 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
655#endif 811#endif
656 return; 812 return;
657 } 813 }
658 int maxSec; 814 int maxSec;
659 //maxSec = 5; //testing only 815 //maxSec = 5; //testing only
660 maxSec = 86400+3600; // one day+1hour 816 maxSec = 86400+3600; // one day+1hour
661 mAlarmNotification = noti; 817 mAlarmNotification = noti;
662 int sec = QDateTime::currentDateTime().secsTo( qdt ); 818 int sec = QDateTime::currentDateTime().secsTo( qdt );
663 if ( sec > maxSec ) { 819 if ( sec > maxSec ) {
664 mRecheckAlarmTimer->start( maxSec * 1000 ); 820 mRecheckAlarmTimer->start( maxSec * 1000 );
665 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 821 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
666 return; 822 return;
667 } else { 823 } else {
668 mRecheckAlarmTimer->stop(); 824 mRecheckAlarmTimer->stop();
669 } 825 }
670 //qDebug("Alarm timer started with secs: %d ", sec); 826 //qDebug("Alarm timer started with secs: %d ", sec);
671 mAlarmTimer->start( sec *1000 , true ); 827 mAlarmTimer->start( sec *1000 , true );
672 828
673} 829}
674// called by mRecheckAlarmTimer to get next alarm 830// called by mRecheckAlarmTimer to get next alarm
675// we need this, because a QTimer has only a max range of 25 days 831// we need this, because a QTimer has only a max range of 25 days
676void CalendarView::recheckTimerAlarm() 832void CalendarView::recheckTimerAlarm()
677{ 833{
678 mAlarmTimer->stop(); 834 mAlarmTimer->stop();
679 mRecheckAlarmTimer->stop(); 835 mRecheckAlarmTimer->stop();
680 mCalendar->checkAlarmForIncidence( 0, true ); 836 mCalendar->checkAlarmForIncidence( 0, true );
681} 837}
682void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 838void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
683{ 839{
684 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 840 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
685 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 841 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
686#ifndef DESKTOP_VERSION 842#ifndef DESKTOP_VERSION
687 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 843 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
688#endif 844#endif
689 return; 845 return;
690 } 846 }
691 mAlarmTimer->stop(); 847 mAlarmTimer->stop();
692} 848}
693void CalendarView::selectWeekNum ( int num ) 849void CalendarView::selectWeekNum ( int num )
694{ 850{
695 dateNavigator()->blockSignals( true ); 851 dateNavigator()->blockSignals( true );
696 dateNavigator()->selectWeek( num ); 852 dateNavigator()->selectWeek( num );
697 dateNavigator()->blockSignals( false ); 853 dateNavigator()->blockSignals( false );
698 mViewManager->showWeekView(); 854 mViewManager->showWeekView();
699} 855}
700KOViewManager *CalendarView::viewManager() 856KOViewManager *CalendarView::viewManager()
701{ 857{
702 return mViewManager; 858 return mViewManager;
703} 859}
704 860
705KODialogManager *CalendarView::dialogManager() 861KODialogManager *CalendarView::dialogManager()
706{ 862{
707 return mDialogManager; 863 return mDialogManager;
708} 864}
709 865
710QDate CalendarView::startDate() 866QDate CalendarView::startDate()
711{ 867{
712 DateList dates = mNavigator->selectedDates(); 868 DateList dates = mNavigator->selectedDates();
713 869
714 return dates.first(); 870 return dates.first();
715} 871}
716 872
717QDate CalendarView::endDate() 873QDate CalendarView::endDate()
718{ 874{
719 DateList dates = mNavigator->selectedDates(); 875 DateList dates = mNavigator->selectedDates();
720 876
721 return dates.last(); 877 return dates.last();
722} 878}
723 879
724 880
725void CalendarView::createPrinter() 881void CalendarView::createPrinter()
726{ 882{
727#ifndef KORG_NOPRINTER 883#ifndef KORG_NOPRINTER
728 if (!mCalPrinter) { 884 if (!mCalPrinter) {
729 mCalPrinter = new CalPrinter(this, mCalendar); 885 mCalPrinter = new CalPrinter(this, mCalendar);
730 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 886 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
731 } 887 }
732#endif 888#endif
733} 889}
734 890
735 891
736//KOPrefs::instance()->mWriteBackFile 892//KOPrefs::instance()->mWriteBackFile
737//KOPrefs::instance()->mWriteBackExistingOnly 893//KOPrefs::instance()->mWriteBackExistingOnly
738 894
739// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 895// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
740// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 896// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
741// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 897// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
742// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 898// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
743// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 899// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
744// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 900// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
745 901
746int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 902int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
747{ 903{
748 904
749 // 0 equal 905 // 0 equal
750 // 1 take local 906 // 1 take local
751 // 2 take remote 907 // 2 take remote
752 // 3 cancel 908 // 3 cancel
753 QDateTime lastSync = mLastCalendarSync; 909 QDateTime lastSync = mLastCalendarSync;
754 QDateTime localMod = local->lastModified(); 910 QDateTime localMod = local->lastModified();
755 QDateTime remoteMod = remote->lastModified(); 911 QDateTime remoteMod = remote->lastModified();
756 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 912 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
757 bool remCh, locCh; 913 bool remCh, locCh;
758 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 914 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
759 //if ( remCh ) 915 //if ( remCh )
760 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 916 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
761 locCh = ( localMod > mLastCalendarSync ); 917 locCh = ( localMod > mLastCalendarSync );
762 if ( !remCh && ! locCh ) { 918 if ( !remCh && ! locCh ) {
763 //qDebug("both not changed "); 919 //qDebug("both not changed ");
764 lastSync = localMod.addDays(1); 920 lastSync = localMod.addDays(1);
765 if ( mode <= SYNC_PREF_ASK ) 921 if ( mode <= SYNC_PREF_ASK )
766 return 0; 922 return 0;
767 } else { 923 } else {
768 if ( locCh ) { 924 if ( locCh ) {
769 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 925 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
770 lastSync = localMod.addDays( -1 ); 926 lastSync = localMod.addDays( -1 );
771 if ( !remCh ) 927 if ( !remCh )
772 remoteMod = ( lastSync.addDays( -1 ) ); 928 remoteMod = ( lastSync.addDays( -1 ) );
773 } else { 929 } else {
774 //qDebug(" not loc changed "); 930 //qDebug(" not loc changed ");
775 lastSync = localMod.addDays( 1 ); 931 lastSync = localMod.addDays( 1 );
776 if ( remCh ) 932 if ( remCh )
777 remoteMod =( lastSync.addDays( 1 ) ); 933 remoteMod =( lastSync.addDays( 1 ) );
778 934
779 } 935 }
780 } 936 }
781 full = true; 937 full = true;
782 if ( mode < SYNC_PREF_ASK ) 938 if ( mode < SYNC_PREF_ASK )
783 mode = SYNC_PREF_ASK; 939 mode = SYNC_PREF_ASK;
784 } else { 940 } else {
785 if ( localMod == remoteMod ) 941 if ( localMod == remoteMod )
786 // if ( local->revision() == remote->revision() ) 942 // if ( local->revision() == remote->revision() )
787 return 0; 943 return 0;
788 944
789 } 945 }
790 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 946 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
791 947
792 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 948 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
793 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 949 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
794 //full = true; //debug only 950 //full = true; //debug only
795 if ( full ) { 951 if ( full ) {
796 bool equ = false; 952 bool equ = false;
797 if ( local->type() == "Event" ) { 953 if ( local->type() == "Event" ) {
798 equ = (*((Event*) local) == *((Event*) remote)); 954 equ = (*((Event*) local) == *((Event*) remote));
799 } 955 }
800 else if ( local->type() =="Todo" ) 956 else if ( local->type() =="Todo" )
801 equ = (*((Todo*) local) == (*(Todo*) remote)); 957 equ = (*((Todo*) local) == (*(Todo*) remote));
802 else if ( local->type() =="Journal" ) 958 else if ( local->type() =="Journal" )
803 equ = (*((Journal*) local) == *((Journal*) remote)); 959 equ = (*((Journal*) local) == *((Journal*) remote));
804 if ( equ ) { 960 if ( equ ) {
805 //qDebug("equal "); 961 //qDebug("equal ");
806 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 962 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
807 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 963 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
808 } 964 }
809 if ( mode < SYNC_PREF_FORCE_LOCAL ) 965 if ( mode < SYNC_PREF_FORCE_LOCAL )
810 return 0; 966 return 0;
811 967
812 }//else //debug only 968 }//else //debug only
813 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 969 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
814 } 970 }
815 int result; 971 int result;
816 bool localIsNew; 972 bool localIsNew;
817 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 973 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
818 974
819 975
820 // ************************************************ 976 // ************************************************
821 // ************************************************ 977 // ************************************************
822 // ************************************************ 978 // ************************************************
823 // We may have that lastSync > remoteMod AND lastSync > localMod 979 // We may have that lastSync > remoteMod AND lastSync > localMod
824 // BUT remoteMod != localMod 980 // BUT remoteMod != localMod
825 981
826 982
827 if ( full && mode < SYNC_PREF_NEWEST ) 983 if ( full && mode < SYNC_PREF_NEWEST )
828 mode = SYNC_PREF_ASK; 984 mode = SYNC_PREF_ASK;
829 985
830 switch( mode ) { 986 switch( mode ) {
831 case SYNC_PREF_LOCAL: 987 case SYNC_PREF_LOCAL:
832 if ( lastSync > remoteMod ) 988 if ( lastSync > remoteMod )
833 return 1; 989 return 1;
834 if ( lastSync > localMod ) 990 if ( lastSync > localMod )
835 return 2; 991 return 2;
836 return 1; 992 return 1;
837 break; 993 break;
838 case SYNC_PREF_REMOTE: 994 case SYNC_PREF_REMOTE:
839 if ( lastSync > localMod ) 995 if ( lastSync > localMod )
840 return 2; 996 return 2;
841 if ( lastSync > remoteMod ) 997 if ( lastSync > remoteMod )
842 return 1; 998 return 1;
843 return 2; 999 return 2;
844 break; 1000 break;
845 case SYNC_PREF_NEWEST: 1001 case SYNC_PREF_NEWEST:
846 if ( localMod >= remoteMod ) 1002 if ( localMod >= remoteMod )
847 return 1; 1003 return 1;
848 else 1004 else
849 return 2; 1005 return 2;
850 break; 1006 break;
851 case SYNC_PREF_ASK: 1007 case SYNC_PREF_ASK:
852 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1008 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
853 if ( lastSync > remoteMod && lastSync > localMod) 1009 if ( lastSync > remoteMod && lastSync > localMod)
854 return 0; 1010 return 0;
855 if ( lastSync > remoteMod ) 1011 if ( lastSync > remoteMod )
856 return 1; 1012 return 1;
857 if ( lastSync > localMod ) 1013 if ( lastSync > localMod )
858 return 2; 1014 return 2;
859 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1015 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
860 localIsNew = localMod >= remoteMod; 1016 localIsNew = localMod >= remoteMod;
861 if ( localIsNew ) 1017 if ( localIsNew )
862 getEventViewerDialog()->setColorMode( 1 ); 1018 getEventViewerDialog()->setColorMode( 1 );
863 else 1019 else
864 getEventViewerDialog()->setColorMode( 2 ); 1020 getEventViewerDialog()->setColorMode( 2 );
865 getEventViewerDialog()->setIncidence(local); 1021 getEventViewerDialog()->setIncidence(local);
866 if ( localIsNew ) 1022 if ( localIsNew )
867 getEventViewerDialog()->setColorMode( 2 ); 1023 getEventViewerDialog()->setColorMode( 2 );
868 else 1024 else
869 getEventViewerDialog()->setColorMode( 1 ); 1025 getEventViewerDialog()->setColorMode( 1 );
870 getEventViewerDialog()->addIncidence(remote); 1026 getEventViewerDialog()->addIncidence(remote);
871 getEventViewerDialog()->setColorMode( 0 ); 1027 getEventViewerDialog()->setColorMode( 0 );
872 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 1028 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
873 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 1029 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
874 getEventViewerDialog()->showMe(); 1030 getEventViewerDialog()->showMe();
875 result = getEventViewerDialog()->executeS( localIsNew ); 1031 result = getEventViewerDialog()->executeS( localIsNew );
876 return result; 1032 return result;
877 1033
878 break; 1034 break;
879 case SYNC_PREF_FORCE_LOCAL: 1035 case SYNC_PREF_FORCE_LOCAL:
880 return 1; 1036 return 1;
881 break; 1037 break;
882 case SYNC_PREF_FORCE_REMOTE: 1038 case SYNC_PREF_FORCE_REMOTE:
883 return 2; 1039 return 2;
884 break; 1040 break;
885 1041
886 default: 1042 default:
887 // SYNC_PREF_TAKE_BOTH not implemented 1043 // SYNC_PREF_TAKE_BOTH not implemented
888 break; 1044 break;
889 } 1045 }
890 return 0; 1046 return 0;
891} 1047}
892Event* CalendarView::getLastSyncEvent() 1048Event* CalendarView::getLastSyncEvent()
893{ 1049{
894 Event* lse; 1050 Event* lse;
895 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 1051 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
896 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 1052 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
897 if (!lse) { 1053 if (!lse) {
898 lse = new Event(); 1054 lse = new Event();
899 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 1055 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
900 QString sum = ""; 1056 QString sum = "";
901 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 1057 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
902 sum = "E: "; 1058 sum = "E: ";
903 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1059 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
904 lse->setDtStart( mLastCalendarSync ); 1060 lse->setDtStart( mLastCalendarSync );
905 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1061 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
906 lse->setCategories( i18n("SyncEvent") ); 1062 lse->setCategories( i18n("SyncEvent") );
907 lse->setReadOnly( true ); 1063 lse->setReadOnly( true );
908 mCalendar->addEvent( lse ); 1064 mCalendar->addEvent( lse );
909 } 1065 }
910 1066
911 return lse; 1067 return lse;
912 1068
913} 1069}
914 1070
915// we check, if the to delete event has a id for a profile 1071// we check, if the to delete event has a id for a profile
916// if yes, we set this id in the profile to delete 1072// if yes, we set this id in the profile to delete
917void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1073void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
918{ 1074{
919 if ( lastSync.count() == 0 ) { 1075 if ( lastSync.count() == 0 ) {
920 //qDebug(" lastSync.count() == 0"); 1076 //qDebug(" lastSync.count() == 0");
921 return; 1077 return;
922 } 1078 }
923 if ( toDelete->type() == "Journal" ) 1079 if ( toDelete->type() == "Journal" )
924 return; 1080 return;
925 1081
926 Event* eve = lastSync.first(); 1082 Event* eve = lastSync.first();
927 1083
928 while ( eve ) { 1084 while ( eve ) {
929 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1085 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
930 if ( !id.isEmpty() ) { 1086 if ( !id.isEmpty() ) {
931 QString des = eve->description(); 1087 QString des = eve->description();
932 QString pref = "e"; 1088 QString pref = "e";
933 if ( toDelete->type() == "Todo" ) 1089 if ( toDelete->type() == "Todo" )
934 pref = "t"; 1090 pref = "t";
935 des += pref+ id + ","; 1091 des += pref+ id + ",";
936 eve->setReadOnly( false ); 1092 eve->setReadOnly( false );
937 eve->setDescription( des ); 1093 eve->setDescription( des );
938 //qDebug("setdes %s ", des.latin1()); 1094 //qDebug("setdes %s ", des.latin1());
939 eve->setReadOnly( true ); 1095 eve->setReadOnly( true );
940 } 1096 }
941 eve = lastSync.next(); 1097 eve = lastSync.next();
942 } 1098 }
943 1099
944} 1100}
945void CalendarView::checkExternalId( Incidence * inc ) 1101void CalendarView::checkExternalId( Incidence * inc )
946{ 1102{
947 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1103 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
948 checkExternSyncEvent( lastSync, inc ); 1104 checkExternSyncEvent( lastSync, inc );
949 1105
950} 1106}
951bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1107bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
952{ 1108{
953 bool syncOK = true; 1109 bool syncOK = true;
954 int addedEvent = 0; 1110 int addedEvent = 0;
955 int addedEventR = 0; 1111 int addedEventR = 0;
956 int deletedEventR = 0; 1112 int deletedEventR = 0;
957 int deletedEventL = 0; 1113 int deletedEventL = 0;
958 int changedLocal = 0; 1114 int changedLocal = 0;
959 int changedRemote = 0; 1115 int changedRemote = 0;
960 int filteredIN = 0; 1116 int filteredIN = 0;
961 int filteredOUT = 0; 1117 int filteredOUT = 0;
962 //QPtrList<Event> el = local->rawEvents(); 1118 //QPtrList<Event> el = local->rawEvents();
963 Event* eventR; 1119 Event* eventR;
964 QString uid; 1120 QString uid;
965 int take; 1121 int take;
966 Event* eventL; 1122 Event* eventL;
967 Event* eventRSync; 1123 Event* eventRSync;
968 Event* eventLSync; 1124 Event* eventLSync;
969 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 1125 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
970 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 1126 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
971 bool fullDateRange = false; 1127 bool fullDateRange = false;
972 local->resetTempSyncStat(); 1128 local->resetTempSyncStat();
973 mLastCalendarSync = QDateTime::currentDateTime(); 1129 mLastCalendarSync = QDateTime::currentDateTime();
974 if ( mSyncManager->syncWithDesktop() ) { 1130 if ( mSyncManager->syncWithDesktop() ) {
975 remote->resetPilotStat(1); 1131 remote->resetPilotStat(1);
976 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1132 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
977 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 1133 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
978 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 1134 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
979 } else { 1135 } else {
980 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 1136 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
981 } 1137 }
982 } 1138 }
983 QDateTime modifiedCalendar = mLastCalendarSync; 1139 QDateTime modifiedCalendar = mLastCalendarSync;
984 eventLSync = getLastSyncEvent(); 1140 eventLSync = getLastSyncEvent();
985 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 1141 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
986 if ( eventR ) { 1142 if ( eventR ) {
987 eventRSync = (Event*) eventR->clone(); 1143 eventRSync = (Event*) eventR->clone();
988 remote->deleteEvent(eventR ); 1144 remote->deleteEvent(eventR );
989 1145
990 } else { 1146 } else {
991 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 1147 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
992 eventRSync = (Event*)eventLSync->clone(); 1148 eventRSync = (Event*)eventLSync->clone();
993 } else { 1149 } else {
994 fullDateRange = true; 1150 fullDateRange = true;
995 eventRSync = new Event(); 1151 eventRSync = new Event();
996 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 1152 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
997 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 1153 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
998 eventRSync->setDtStart( mLastCalendarSync ); 1154 eventRSync->setDtStart( mLastCalendarSync );
999 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1155 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1000 eventRSync->setCategories( i18n("SyncEvent") ); 1156 eventRSync->setCategories( i18n("SyncEvent") );
1001 } 1157 }
1002 } 1158 }
1003 if ( eventLSync->dtStart() == mLastCalendarSync ) 1159 if ( eventLSync->dtStart() == mLastCalendarSync )
1004 fullDateRange = true; 1160 fullDateRange = true;
1005 1161
1006 if ( ! fullDateRange ) { 1162 if ( ! fullDateRange ) {
1007 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 1163 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
1008 1164
1009 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 1165 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
1010 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 1166 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
1011 fullDateRange = true; 1167 fullDateRange = true;
1012 } 1168 }
1013 } 1169 }
1014 if ( mSyncManager->syncWithDesktop() ) { 1170 if ( mSyncManager->syncWithDesktop() ) {
1015 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 1171 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
1016 } 1172 }
1017 if ( fullDateRange ) 1173 if ( fullDateRange )
1018 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 1174 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
1019 else 1175 else
1020 mLastCalendarSync = eventLSync->dtStart(); 1176 mLastCalendarSync = eventLSync->dtStart();
1021 // for resyncing if own file has changed 1177 // for resyncing if own file has changed
1022 if ( mCurrentSyncDevice == "deleteaftersync" ) { 1178 if ( mCurrentSyncDevice == "deleteaftersync" ) {
1023 mLastCalendarSync = loadedFileVersion; 1179 mLastCalendarSync = loadedFileVersion;
1024 //qDebug("setting mLastCalendarSync "); 1180 //qDebug("setting mLastCalendarSync ");
1025 } 1181 }
1026 //qDebug("*************************** "); 1182 //qDebug("*************************** ");
1027 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1183 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1028 QPtrList<Incidence> er = remote->rawIncidences(); 1184 QPtrList<Incidence> er = remote->rawIncidences();
1029 Incidence* inR = er.first(); 1185 Incidence* inR = er.first();
1030 Incidence* inL; 1186 Incidence* inL;
1031 QProgressBar bar( er.count(),0 ); 1187 QProgressBar bar( er.count(),0 );
1032 bar.setCaption (i18n("Syncing - close to abort!") ); 1188 bar.setCaption (i18n("Syncing - close to abort!") );
1033 1189
1034 // ************** setting up filter ************* 1190 // ************** setting up filter *************
1035 CalFilter *filterIN = 0; 1191 CalFilter *filterIN = 0;
1036 CalFilter *filterOUT = 0; 1192 CalFilter *filterOUT = 0;
1037 CalFilter *filter = mFilters.first(); 1193 CalFilter *filter = mFilters.first();
1038 while(filter) { 1194 while(filter) {
1039 if ( filter->name() == mSyncManager->mFilterInCal ) 1195 if ( filter->name() == mSyncManager->mFilterInCal )
1040 filterIN = filter; 1196 filterIN = filter;
1041 if ( filter->name() == mSyncManager->mFilterOutCal ) 1197 if ( filter->name() == mSyncManager->mFilterOutCal )
1042 filterOUT = filter; 1198 filterOUT = filter;
1043 filter = mFilters.next(); 1199 filter = mFilters.next();
1044 } 1200 }
1045 int w = 300; 1201 int w = 300;
1046 if ( QApplication::desktop()->width() < 320 ) 1202 if ( QApplication::desktop()->width() < 320 )
1047 w = 220; 1203 w = 220;
1048 int h = bar.sizeHint().height() ; 1204 int h = bar.sizeHint().height() ;
1049 int dw = QApplication::desktop()->width(); 1205 int dw = QApplication::desktop()->width();
1050 int dh = QApplication::desktop()->height(); 1206 int dh = QApplication::desktop()->height();
1051 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1207 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1052 bar.show(); 1208 bar.show();
1053 int modulo = (er.count()/10)+1; 1209 int modulo = (er.count()/10)+1;
1054 int incCounter = 0; 1210 int incCounter = 0;
1055 while ( inR ) { 1211 while ( inR ) {
1056 if ( ! bar.isVisible() ) 1212 if ( ! bar.isVisible() )
1057 return false; 1213 return false;
1058 if ( incCounter % modulo == 0 ) 1214 if ( incCounter % modulo == 0 )
1059 bar.setProgress( incCounter ); 1215 bar.setProgress( incCounter );
1060 ++incCounter; 1216 ++incCounter;
1061 uid = inR->uid(); 1217 uid = inR->uid();
1062 bool skipIncidence = false; 1218 bool skipIncidence = false;
1063 if ( uid.left(15) == QString("last-syncEvent-") ) 1219 if ( uid.left(15) == QString("last-syncEvent-") )
1064 skipIncidence = true; 1220 skipIncidence = true;
1065 QString idS; 1221 QString idS;
1066 qApp->processEvents(); 1222 qApp->processEvents();
1067 if ( !skipIncidence ) { 1223 if ( !skipIncidence ) {
1068 inL = local->incidence( uid ); 1224 inL = local->incidence( uid );
1069 if ( inL ) { // maybe conflict - same uid in both calendars 1225 if ( inL ) { // maybe conflict - same uid in both calendars
1070 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1226 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1071 //qDebug("take %d %s ", take, inL->summary().latin1()); 1227 //qDebug("take %d %s ", take, inL->summary().latin1());
1072 if ( take == 3 ) 1228 if ( take == 3 )
1073 return false; 1229 return false;
1074 if ( take == 1 ) {// take local ********************** 1230 if ( take == 1 ) {// take local **********************
1075 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1231 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1076 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1232 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1077 else 1233 else
1078 idS = inR->IDStr(); 1234 idS = inR->IDStr();
1079 remote->deleteIncidence( inR ); 1235 remote->deleteIncidence( inR );
1080 inR = inL->clone(); 1236 inR = inL->clone();
1081 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1237 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1082 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1238 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1083 inR->setIDStr( idS ); 1239 inR->setIDStr( idS );
1084 remote->addIncidence( inR ); 1240 remote->addIncidence( inR );
1085 if ( mSyncManager->syncWithDesktop() ) 1241 if ( mSyncManager->syncWithDesktop() )
1086 inR->setPilotId( 2 ); 1242 inR->setPilotId( 2 );
1087 ++changedRemote; 1243 ++changedRemote;
1088 } else {// take remote ********************** 1244 } else {// take remote **********************
1089 idS = inL->IDStr(); 1245 idS = inL->IDStr();
1090 int pid = inL->pilotId(); 1246 int pid = inL->pilotId();
1091 local->deleteIncidence( inL ); 1247 local->deleteIncidence( inL );
1092 inL = inR->clone(); 1248 inL = inR->clone();
1093 if ( mSyncManager->syncWithDesktop() ) 1249 if ( mSyncManager->syncWithDesktop() )
1094 inL->setPilotId( pid ); 1250 inL->setPilotId( pid );
1095 inL->setIDStr( idS ); 1251 inL->setIDStr( idS );
1096 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1252 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1097 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1253 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1098 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1254 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1099 } 1255 }
1100 local->addIncidence( inL ); 1256 local->addIncidence( inL );
1101 ++changedLocal; 1257 ++changedLocal;
1102 } 1258 }
1103 } 1259 }
1104 } else { // no conflict ********** add or delete remote 1260 } else { // no conflict ********** add or delete remote
1105 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1261 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1106 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1262 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1107 QString des = eventLSync->description(); 1263 QString des = eventLSync->description();
1108 QString pref = "e"; 1264 QString pref = "e";
1109 if ( inR->type() == "Todo" ) 1265 if ( inR->type() == "Todo" )
1110 pref = "t"; 1266 pref = "t";
1111 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1267 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1112 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1268 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1113 //remote->deleteIncidence( inR ); 1269 //remote->deleteIncidence( inR );
1114 ++deletedEventR; 1270 ++deletedEventR;
1115 } else { 1271 } else {
1116 inR->setLastModified( modifiedCalendar ); 1272 inR->setLastModified( modifiedCalendar );
1117 inL = inR->clone(); 1273 inL = inR->clone();
1118 inL->setIDStr( ":" ); 1274 inL->setIDStr( ":" );
1119 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1275 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1120 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1276 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1121 local->addIncidence( inL ); 1277 local->addIncidence( inL );
1122 ++addedEvent; 1278 ++addedEvent;
1123 1279
1124 } 1280 }
1125 } else { 1281 } else {
1126 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1282 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1127 inR->setLastModified( modifiedCalendar ); 1283 inR->setLastModified( modifiedCalendar );
1128 inL = inR->clone(); 1284 inL = inR->clone();
1129 inL->setIDStr( ":" ); 1285 inL->setIDStr( ":" );
1130 local->addIncidence( inL ); 1286 local->addIncidence( inL );
1131 ++addedEvent; 1287 ++addedEvent;
1132 1288
1133 } else { 1289 } else {
1134 checkExternSyncEvent(eventRSyncSharp, inR); 1290 checkExternSyncEvent(eventRSyncSharp, inR);
1135 remote->deleteIncidence( inR ); 1291 remote->deleteIncidence( inR );
1136 ++deletedEventR; 1292 ++deletedEventR;
1137 } 1293 }
1138 } 1294 }
1139 } else { 1295 } else {
1140 ++filteredIN; 1296 ++filteredIN;
1141 } 1297 }
1142 } 1298 }
1143 } 1299 }
1144 inR = er.next(); 1300 inR = er.next();
1145 } 1301 }
1146 QPtrList<Incidence> el = local->rawIncidences(); 1302 QPtrList<Incidence> el = local->rawIncidences();
1147 inL = el.first(); 1303 inL = el.first();
1148 modulo = (el.count()/10)+1; 1304 modulo = (el.count()/10)+1;
1149 bar.setCaption (i18n("Add / remove events") ); 1305 bar.setCaption (i18n("Add / remove events") );
1150 bar.setTotalSteps ( el.count() ) ; 1306 bar.setTotalSteps ( el.count() ) ;
1151 bar.show(); 1307 bar.show();
1152 incCounter = 0; 1308 incCounter = 0;
1153 1309
1154 while ( inL ) { 1310 while ( inL ) {
1155 1311
1156 qApp->processEvents(); 1312 qApp->processEvents();
1157 if ( ! bar.isVisible() ) 1313 if ( ! bar.isVisible() )
1158 return false; 1314 return false;
1159 if ( incCounter % modulo == 0 ) 1315 if ( incCounter % modulo == 0 )
1160 bar.setProgress( incCounter ); 1316 bar.setProgress( incCounter );
1161 ++incCounter; 1317 ++incCounter;
1162 uid = inL->uid(); 1318 uid = inL->uid();
1163 bool skipIncidence = false; 1319 bool skipIncidence = false;
1164 if ( uid.left(15) == QString("last-syncEvent-") ) 1320 if ( uid.left(15) == QString("last-syncEvent-") )
1165 skipIncidence = true; 1321 skipIncidence = true;
1166 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1322 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1167 skipIncidence = true; 1323 skipIncidence = true;
1168 if ( !skipIncidence ) { 1324 if ( !skipIncidence ) {
1169 inR = remote->incidence( uid ); 1325 inR = remote->incidence( uid );
1170 if ( ! inR ) { 1326 if ( ! inR ) {
1171 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1327 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1172 // no conflict ********** add or delete local 1328 // no conflict ********** add or delete local
1173 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1329 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1174 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1330 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1175 checkExternSyncEvent(eventLSyncSharp, inL); 1331 checkExternSyncEvent(eventLSyncSharp, inL);
1176 local->deleteIncidence( inL ); 1332 local->deleteIncidence( inL );
1177 ++deletedEventL; 1333 ++deletedEventL;
1178 } else { 1334 } else {
1179 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1335 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1180 inL->removeID(mCurrentSyncDevice ); 1336 inL->removeID(mCurrentSyncDevice );
1181 ++addedEventR; 1337 ++addedEventR;
1182 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1338 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1183 inL->setLastModified( modifiedCalendar ); 1339 inL->setLastModified( modifiedCalendar );
1184 inR = inL->clone(); 1340 inR = inL->clone();
1185 inR->setIDStr( ":" ); 1341 inR->setIDStr( ":" );
1186 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1342 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1187 remote->addIncidence( inR ); 1343 remote->addIncidence( inR );
1188 } 1344 }
1189 } 1345 }
1190 } else { 1346 } else {
1191 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1347 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1192 checkExternSyncEvent(eventLSyncSharp, inL); 1348 checkExternSyncEvent(eventLSyncSharp, inL);
1193 local->deleteIncidence( inL ); 1349 local->deleteIncidence( inL );
1194 ++deletedEventL; 1350 ++deletedEventL;
1195 } else { 1351 } else {
1196 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1352 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1197 ++addedEventR; 1353 ++addedEventR;
1198 inL->setLastModified( modifiedCalendar ); 1354 inL->setLastModified( modifiedCalendar );
1199 inR = inL->clone(); 1355 inR = inL->clone();
1200 inR->setIDStr( ":" ); 1356 inR->setIDStr( ":" );
1201 remote->addIncidence( inR ); 1357 remote->addIncidence( inR );
1202 } 1358 }
1203 } 1359 }
1204 } 1360 }
1205 } else { 1361 } else {
1206 ++filteredOUT; 1362 ++filteredOUT;
1207 } 1363 }
1208 } 1364 }
1209 } 1365 }
1210 inL = el.next(); 1366 inL = el.next();
1211 } 1367 }
1212 int delFut = 0; 1368 int delFut = 0;
1213 int remRem = 0; 1369 int remRem = 0;
1214 if ( mSyncManager->mWriteBackInFuture ) { 1370 if ( mSyncManager->mWriteBackInFuture ) {
1215 er = remote->rawIncidences(); 1371 er = remote->rawIncidences();
1216 remRem = er.count(); 1372 remRem = er.count();
1217 inR = er.first(); 1373 inR = er.first();
1218 QDateTime dt; 1374 QDateTime dt;
1219 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1375 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1220 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1376 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1221 while ( inR ) { 1377 while ( inR ) {
1222 if ( inR->type() == "Todo" ) { 1378 if ( inR->type() == "Todo" ) {
1223 Todo * t = (Todo*)inR; 1379 Todo * t = (Todo*)inR;
1224 if ( t->hasDueDate() ) 1380 if ( t->hasDueDate() )
1225 dt = t->dtDue(); 1381 dt = t->dtDue();
1226 else 1382 else
1227 dt = cur.addSecs( 62 ); 1383 dt = cur.addSecs( 62 );
1228 } 1384 }
1229 else if (inR->type() == "Event" ) { 1385 else if (inR->type() == "Event" ) {
1230 bool ok; 1386 bool ok;
1231 dt = inR->getNextOccurence( cur, &ok ); 1387 dt = inR->getNextOccurence( cur, &ok );
1232 if ( !ok ) 1388 if ( !ok )
1233 dt = cur.addSecs( -62 ); 1389 dt = cur.addSecs( -62 );
1234 } 1390 }
1235 else 1391 else
1236 dt = inR->dtStart(); 1392 dt = inR->dtStart();
1237 if ( dt < cur || dt > end ) { 1393 if ( dt < cur || dt > end ) {
1238 remote->deleteIncidence( inR ); 1394 remote->deleteIncidence( inR );
1239 ++delFut; 1395 ++delFut;
1240 } 1396 }
1241 inR = er.next(); 1397 inR = er.next();
1242 } 1398 }
1243 } 1399 }
1244 bar.hide(); 1400 bar.hide();
1245 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1401 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1246 eventLSync->setReadOnly( false ); 1402 eventLSync->setReadOnly( false );
1247 eventLSync->setDtStart( mLastCalendarSync ); 1403 eventLSync->setDtStart( mLastCalendarSync );
1248 eventRSync->setDtStart( mLastCalendarSync ); 1404 eventRSync->setDtStart( mLastCalendarSync );
1249 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1405 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1250 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1406 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1251 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1407 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1252 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1408 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1253 eventLSync->setReadOnly( true ); 1409 eventLSync->setReadOnly( true );
1254 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1410 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1255 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1411 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1256 remote->addEvent( eventRSync ); 1412 remote->addEvent( eventRSync );
1257 else 1413 else
1258 delete eventRSync; 1414 delete eventRSync;
1259 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1415 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1260 QString mes; 1416 QString mes;
1261 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1417 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1262 QString delmess; 1418 QString delmess;
1263 if ( delFut ) { 1419 if ( delFut ) {
1264 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1420 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1265 mes += delmess; 1421 mes += delmess;
1266 } 1422 }
1267 mes = i18n("Local calendar changed!\n") +mes; 1423 mes = i18n("Local calendar changed!\n") +mes;
1268 mCalendar->checkAlarmForIncidence( 0, true ); 1424 mCalendar->checkAlarmForIncidence( 0, true );
1269 qDebug( mes ); 1425 qDebug( mes );
1270 if ( mSyncManager->mShowSyncSummary ) { 1426 if ( mSyncManager->mShowSyncSummary ) {
1271 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1427 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1272 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1428 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1273 qDebug("KO: WB cancelled "); 1429 qDebug("KO: WB cancelled ");
1274 mSyncManager->mWriteBackFile = false; 1430 mSyncManager->mWriteBackFile = false;
1275 return syncOK; 1431 return syncOK;
1276 } 1432 }
1277 } 1433 }
1278 return syncOK; 1434 return syncOK;
1279} 1435}
1280 1436
1281void CalendarView::setSyncDevice( QString s ) 1437void CalendarView::setSyncDevice( QString s )
1282{ 1438{
1283 mCurrentSyncDevice= s; 1439 mCurrentSyncDevice= s;
1284} 1440}
1285void CalendarView::setSyncName( QString s ) 1441void CalendarView::setSyncName( QString s )
1286{ 1442{
1287 mCurrentSyncName= s; 1443 mCurrentSyncName= s;
1288} 1444}
1289bool CalendarView::syncCalendar(QString filename, int mode) 1445bool CalendarView::syncCalendar(QString filename, int mode)
1290{ 1446{
1291 //qDebug("syncCalendar %s ", filename.latin1()); 1447 //qDebug("syncCalendar %s ", filename.latin1());
1292 mGlobalSyncMode = SYNC_MODE_NORMAL; 1448 mGlobalSyncMode = SYNC_MODE_NORMAL;
1293 CalendarLocal* calendar = new CalendarLocal(); 1449 CalendarLocal* calendar = new CalendarLocal();
1294 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1450 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1295 FileStorage* storage = new FileStorage( calendar ); 1451 FileStorage* storage = new FileStorage( calendar );
1296 bool syncOK = false; 1452 bool syncOK = false;
1297 storage->setFileName( filename ); 1453 storage->setFileName( filename );
1298 // qDebug("loading ... "); 1454 // qDebug("loading ... ");
1299 if ( storage->load() ) { 1455 if ( storage->load() ) {
1300 getEventViewerDialog()->setSyncMode( true ); 1456 getEventViewerDialog()->setSyncMode( true );
1301 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1457 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1302 getEventViewerDialog()->setSyncMode( false ); 1458 getEventViewerDialog()->setSyncMode( false );
1303 if ( syncOK ) { 1459 if ( syncOK ) {
1304 if ( mSyncManager->mWriteBackFile ) 1460 if ( mSyncManager->mWriteBackFile )
1305 { 1461 {
1306 storage->setSaveFormat( new ICalFormat() ); 1462 storage->setSaveFormat( new ICalFormat() );
1307 storage->save(); 1463 storage->save();
1308 } 1464 }
1309 } 1465 }
1310 setModified( true ); 1466 setModified( true );
1311 } 1467 }
1312 delete storage; 1468 delete storage;
1313 delete calendar; 1469 delete calendar;
1314 if ( syncOK ) 1470 if ( syncOK )
1315 updateView(); 1471 updateView();
1316 return syncOK; 1472 return syncOK;
1317} 1473}
1318 1474
1319void CalendarView::syncExternal( int mode ) 1475void CalendarView::syncExternal( int mode )
1320{ 1476{
1321 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1477 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1322 1478
1323 qApp->processEvents(); 1479 qApp->processEvents();
1324 CalendarLocal* calendar = new CalendarLocal(); 1480 CalendarLocal* calendar = new CalendarLocal();
1325 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1481 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1326 bool syncOK = false; 1482 bool syncOK = false;
1327 bool loadSuccess = false; 1483 bool loadSuccess = false;
1328 PhoneFormat* phoneFormat = 0; 1484 PhoneFormat* phoneFormat = 0;
1329 emit tempDisableBR(true); 1485 emit tempDisableBR(true);
1330#ifndef DESKTOP_VERSION 1486#ifndef DESKTOP_VERSION
1331 SharpFormat* sharpFormat = 0; 1487 SharpFormat* sharpFormat = 0;
1332 if ( mode == 0 ) { // sharp 1488 if ( mode == 0 ) { // sharp
1333 sharpFormat = new SharpFormat () ; 1489 sharpFormat = new SharpFormat () ;
1334 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1490 loadSuccess = sharpFormat->load( calendar, mCalendar );
1335 1491
1336 } else 1492 } else
1337#endif 1493#endif
1338 if ( mode == 1 ) { // phone 1494 if ( mode == 1 ) { // phone
1339 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1495 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1340 mSyncManager->mPhoneDevice, 1496 mSyncManager->mPhoneDevice,
1341 mSyncManager->mPhoneConnection, 1497 mSyncManager->mPhoneConnection,
1342 mSyncManager->mPhoneModel); 1498 mSyncManager->mPhoneModel);
1343 loadSuccess = phoneFormat->load( calendar,mCalendar); 1499 loadSuccess = phoneFormat->load( calendar,mCalendar);
1344 1500
1345 } else { 1501 } else {
1346 emit tempDisableBR(false); 1502 emit tempDisableBR(false);
1347 return; 1503 return;
1348 } 1504 }
1349 if ( loadSuccess ) { 1505 if ( loadSuccess ) {
1350 getEventViewerDialog()->setSyncMode( true ); 1506 getEventViewerDialog()->setSyncMode( true );
1351 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1507 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1352 getEventViewerDialog()->setSyncMode( false ); 1508 getEventViewerDialog()->setSyncMode( false );
1353 qApp->processEvents(); 1509 qApp->processEvents();
1354 if ( syncOK ) { 1510 if ( syncOK ) {
1355 if ( mSyncManager->mWriteBackFile ) 1511 if ( mSyncManager->mWriteBackFile )
1356 { 1512 {
1357 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1513 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1358 Incidence* inc = iL.first(); 1514 Incidence* inc = iL.first();
1359 if ( phoneFormat ) { 1515 if ( phoneFormat ) {
1360 while ( inc ) { 1516 while ( inc ) {
1361 inc->removeID(mCurrentSyncDevice); 1517 inc->removeID(mCurrentSyncDevice);
1362 inc = iL.next(); 1518 inc = iL.next();
1363 } 1519 }
1364 } 1520 }
1365#ifndef DESKTOP_VERSION 1521#ifndef DESKTOP_VERSION
1366 if ( sharpFormat ) 1522 if ( sharpFormat )
1367 sharpFormat->save(calendar); 1523 sharpFormat->save(calendar);
1368#endif 1524#endif
1369 if ( phoneFormat ) 1525 if ( phoneFormat )
1370 phoneFormat->save(calendar); 1526 phoneFormat->save(calendar);
1371 iL = calendar->rawIncidences(); 1527 iL = calendar->rawIncidences();
1372 inc = iL.first(); 1528 inc = iL.first();
1373 Incidence* loc; 1529 Incidence* loc;
1374 while ( inc ) { 1530 while ( inc ) {
1375 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1531 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1376 loc = mCalendar->incidence(inc->uid() ); 1532 loc = mCalendar->incidence(inc->uid() );
1377 if ( loc ) { 1533 if ( loc ) {
1378 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1534 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1379 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1535 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1380 } 1536 }
1381 } 1537 }
1382 inc = iL.next(); 1538 inc = iL.next();
1383 } 1539 }
1384 Incidence* lse = getLastSyncEvent(); 1540 Incidence* lse = getLastSyncEvent();
1385 if ( lse ) { 1541 if ( lse ) {
1386 lse->setReadOnly( false ); 1542 lse->setReadOnly( false );
1387 lse->setDescription( "" ); 1543 lse->setDescription( "" );
1388 lse->setReadOnly( true ); 1544 lse->setReadOnly( true );
1389 } 1545 }
1390 } 1546 }
1391 } else { 1547 } else {
1392 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1548 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1393 } 1549 }
1394 setModified( true ); 1550 setModified( true );
1395 } else { 1551 } else {
1396 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1552 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1397 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1553 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1398 question, i18n("Ok")) ; 1554 question, i18n("Ok")) ;
1399 1555
1400 } 1556 }
1401 delete calendar; 1557 delete calendar;
1402 updateView(); 1558 updateView();
1403 emit tempDisableBR(false); 1559 emit tempDisableBR(false);
1404 return ;//syncOK; 1560 return ;//syncOK;
1405 1561
1406} 1562}
1407 1563
1408bool CalendarView::importBday() 1564bool CalendarView::importBday()
1409{ 1565{
1410#ifndef KORG_NOKABC 1566#ifndef KORG_NOKABC
1411 1567
1412#ifdef DESKTOP_VERSION 1568#ifdef DESKTOP_VERSION
1413 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1569 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1414 KABC::AddressBook::Iterator it; 1570 KABC::AddressBook::Iterator it;
1415 int count = 0; 1571 int count = 0;
1416 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1572 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1417 ++count; 1573 ++count;
1418 } 1574 }
1419 QProgressBar bar(count,0 ); 1575 QProgressBar bar(count,0 );
1420 int w = 300; 1576 int w = 300;
1421 if ( QApplication::desktop()->width() < 320 ) 1577 if ( QApplication::desktop()->width() < 320 )
1422 w = 220; 1578 w = 220;
1423 int h = bar.sizeHint().height() ; 1579 int h = bar.sizeHint().height() ;
1424 int dw = QApplication::desktop()->width(); 1580 int dw = QApplication::desktop()->width();
1425 int dh = QApplication::desktop()->height(); 1581 int dh = QApplication::desktop()->height();
1426 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1582 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1427 bar.show(); 1583 bar.show();
1428 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1584 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1429 qApp->processEvents(); 1585 qApp->processEvents();
1430 count = 0; 1586 count = 0;
1431 int addCount = 0; 1587 int addCount = 0;
1432 KCal::Attendee* a = 0; 1588 KCal::Attendee* a = 0;
1433 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1589 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1434 if ( ! bar.isVisible() ) 1590 if ( ! bar.isVisible() )
1435 return false; 1591 return false;
1436 bar.setProgress( count++ ); 1592 bar.setProgress( count++ );
1437 qApp->processEvents(); 1593 qApp->processEvents();
1438 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1594 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1439 if ( (*it).birthday().date().isValid() ){ 1595 if ( (*it).birthday().date().isValid() ){
1440 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1596 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1441 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1597 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1442 ++addCount; 1598 ++addCount;
1443 } 1599 }
1444 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1600 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1445 if ( anni.isValid() ){ 1601 if ( anni.isValid() ){
1446 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1602 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1447 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1603 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1448 ++addCount; 1604 ++addCount;
1449 } 1605 }
1450 } 1606 }
1451 updateView(); 1607 updateView();
1452 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1608 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1453#else //DESKTOP_VERSION 1609#else //DESKTOP_VERSION
1454 1610
1455 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1611 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1456 // the result should now arrive through method insertBirthdays 1612 // the result should now arrive through method insertBirthdays
1457 1613
1458#endif //DESKTOP_VERSION 1614#endif //DESKTOP_VERSION
1459 1615
1460#endif //KORG_NOKABC 1616#endif //KORG_NOKABC
1461 1617
1462 1618
1463 return true; 1619 return true;
1464} 1620}
1465 1621
1466// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1622// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1467void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1623void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1468 const QStringList& anniversaryList, const QStringList& realNameList, 1624 const QStringList& anniversaryList, const QStringList& realNameList,
1469 const QStringList& emailList, const QStringList& assembledNameList, 1625 const QStringList& emailList, const QStringList& assembledNameList,
1470 const QStringList& uidList) 1626 const QStringList& uidList)
1471{ 1627{
1472 //qDebug("KO::CalendarView::insertBirthdays"); 1628 //qDebug("KO::CalendarView::insertBirthdays");
1473 if (uid == this->name()) 1629 if (uid == this->name())
1474 { 1630 {
1475 int count = birthdayList.count(); 1631 int count = birthdayList.count();
1476 int addCount = 0; 1632 int addCount = 0;
1477 KCal::Attendee* a = 0; 1633 KCal::Attendee* a = 0;
1478 1634
1479 //qDebug("CalView 1 %i", count); 1635 //qDebug("CalView 1 %i", count);
1480 1636
1481 QProgressBar bar(count,0 ); 1637 QProgressBar bar(count,0 );
1482 int w = 300; 1638 int w = 300;
1483 if ( QApplication::desktop()->width() < 320 ) 1639 if ( QApplication::desktop()->width() < 320 )
1484 w = 220; 1640 w = 220;
1485 int h = bar.sizeHint().height() ; 1641 int h = bar.sizeHint().height() ;
1486 int dw = QApplication::desktop()->width(); 1642 int dw = QApplication::desktop()->width();
1487 int dh = QApplication::desktop()->height(); 1643 int dh = QApplication::desktop()->height();
1488 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1644 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1489 bar.show(); 1645 bar.show();
1490 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1646 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1491 qApp->processEvents(); 1647 qApp->processEvents();
1492 1648
1493 QDate birthday; 1649 QDate birthday;
1494 QDate anniversary; 1650 QDate anniversary;
1495 QString realName; 1651 QString realName;
1496 QString email; 1652 QString email;
1497 QString assembledName; 1653 QString assembledName;
1498 QString uid; 1654 QString uid;
1499 bool ok = true; 1655 bool ok = true;
1500 for ( int i = 0; i < count; i++) 1656 for ( int i = 0; i < count; i++)
1501 { 1657 {
1502 if ( ! bar.isVisible() ) 1658 if ( ! bar.isVisible() )
1503 return; 1659 return;
1504 bar.setProgress( i ); 1660 bar.setProgress( i );
1505 qApp->processEvents(); 1661 qApp->processEvents();
1506 1662
1507 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1663 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1508 if (!ok) { 1664 if (!ok) {
1509 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1665 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1510 } 1666 }
1511 1667
1512 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1668 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1513 if (!ok) { 1669 if (!ok) {
1514 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1670 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1515 } 1671 }
1516 realName = realNameList[i]; 1672 realName = realNameList[i];
1517 email = emailList[i]; 1673 email = emailList[i];
1518 assembledName = assembledNameList[i]; 1674 assembledName = assembledNameList[i];
1519 uid = uidList[i]; 1675 uid = uidList[i];
1520 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1676 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1521 1677
1522 if ( birthday.isValid() ){ 1678 if ( birthday.isValid() ){
1523 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1679 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1524 KCal::Attendee::ReqParticipant,uid) ; 1680 KCal::Attendee::ReqParticipant,uid) ;
1525 if ( addAnniversary( birthday, assembledName, a, true ) ) 1681 if ( addAnniversary( birthday, assembledName, a, true ) )
1526 ++addCount; 1682 ++addCount;
1527 } 1683 }
1528 1684
1529 if ( anniversary.isValid() ){ 1685 if ( anniversary.isValid() ){
1530 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1686 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1531 KCal::Attendee::ReqParticipant,uid) ; 1687 KCal::Attendee::ReqParticipant,uid) ;
1532 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1688 if ( addAnniversary( anniversary, assembledName, a, false ) )
1533 ++addCount; 1689 ++addCount;
1534 } 1690 }
1535 } 1691 }
1536 1692
1537 updateView(); 1693 updateView();
1538 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1694 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1539 1695
1540 } 1696 }
1541 1697
1542} 1698}
1543 1699
1544 1700
1545 1701
1546bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1702bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1547{ 1703{
1548 //qDebug("addAnni "); 1704 //qDebug("addAnni ");
1549 Event * ev = new Event(); 1705 Event * ev = new Event();
1550 ev->setOrganizer(KOPrefs::instance()->email()); 1706 ev->setOrganizer(KOPrefs::instance()->email());
1551 if ( a ) { 1707 if ( a ) {
1552 ev->addAttendee( a ); 1708 ev->addAttendee( a );
1553 } 1709 }
1554 QString kind; 1710 QString kind;
1555 if ( birthday ) { 1711 if ( birthday ) {
1556 kind = i18n( "Birthday" ); 1712 kind = i18n( "Birthday" );
1557 ev->setSummary( name + " (" + QString::number(date.year()) +")"); 1713 ev->setSummary( name + " (" + QString::number(date.year()) +")");
1558 } 1714 }
1559 else { 1715 else {
1560 kind = i18n( "Anniversary" ); 1716 kind = i18n( "Anniversary" );
1561 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); 1717 ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind );
1562 } 1718 }
1563 ev->setCategories( kind ); 1719 ev->setCategories( kind );
1564 ev->setDtStart( QDateTime(date) ); 1720 ev->setDtStart( QDateTime(date) );
1565 ev->setDtEnd( QDateTime(date) ); 1721 ev->setDtEnd( QDateTime(date) );
1566 ev->setFloats( true ); 1722 ev->setFloats( true );
1567 Recurrence * rec = ev->recurrence(); 1723 Recurrence * rec = ev->recurrence();
1568 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1724 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1569 rec->addYearlyNum( date.month() ); 1725 rec->addYearlyNum( date.month() );
1570 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1726 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1571 delete ev; 1727 delete ev;
1572 return false; 1728 return false;
1573 } 1729 }
1574 return true; 1730 return true;
1575 1731
1576} 1732}
1577bool CalendarView::importQtopia( const QString &categories, 1733bool CalendarView::importQtopia( const QString &categories,
1578 const QString &datebook, 1734 const QString &datebook,
1579 const QString &todolist ) 1735 const QString &todolist )
1580{ 1736{
1581 1737
1582 QtopiaFormat qtopiaFormat; 1738 QtopiaFormat qtopiaFormat;
1583 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1739 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1584 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1740 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1585 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1741 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1586 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1742 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1587 1743
1588 updateView(); 1744 updateView();
1589 return true; 1745 return true;
1590 1746
1591#if 0 1747#if 0
1592 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1748 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1593 mCurrentSyncDevice = "qtopia-XML"; 1749 mCurrentSyncDevice = "qtopia-XML";
1594 if ( mSyncManager->mAskForPreferences ) 1750 if ( mSyncManager->mAskForPreferences )
1595 edit_sync_options(); 1751 edit_sync_options();
1596 qApp->processEvents(); 1752 qApp->processEvents();
1597 CalendarLocal* calendar = new CalendarLocal(); 1753 CalendarLocal* calendar = new CalendarLocal();
1598 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1754 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1599 bool syncOK = false; 1755 bool syncOK = false;
1600 QtopiaFormat qtopiaFormat; 1756 QtopiaFormat qtopiaFormat;
1601 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1757 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1602 bool loadOk = true; 1758 bool loadOk = true;
1603 if ( !categories.isEmpty() ) 1759 if ( !categories.isEmpty() )
1604 loadOk = qtopiaFormat.load( calendar, categories ); 1760 loadOk = qtopiaFormat.load( calendar, categories );
1605 if ( loadOk && !datebook.isEmpty() ) 1761 if ( loadOk && !datebook.isEmpty() )
1606 loadOk = qtopiaFormat.load( calendar, datebook ); 1762 loadOk = qtopiaFormat.load( calendar, datebook );
1607 if ( loadOk && !todolist.isEmpty() ) 1763 if ( loadOk && !todolist.isEmpty() )
1608 loadOk = qtopiaFormat.load( calendar, todolist ); 1764 loadOk = qtopiaFormat.load( calendar, todolist );
1609 1765
1610 if ( loadOk ) { 1766 if ( loadOk ) {
1611 getEventViewerDialog()->setSyncMode( true ); 1767 getEventViewerDialog()->setSyncMode( true );
1612 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1768 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1613 getEventViewerDialog()->setSyncMode( false ); 1769 getEventViewerDialog()->setSyncMode( false );
1614 qApp->processEvents(); 1770 qApp->processEvents();
1615 if ( syncOK ) { 1771 if ( syncOK ) {
1616 if ( mSyncManager->mWriteBackFile ) 1772 if ( mSyncManager->mWriteBackFile )
1617 { 1773 {
1618 // write back XML file 1774 // write back XML file
1619 1775
1620 } 1776 }
1621 setModified( true ); 1777 setModified( true );
1622 } 1778 }
1623 } else { 1779 } else {
1624 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1780 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1625 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1781 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1626 question, i18n("Ok")) ; 1782 question, i18n("Ok")) ;
1627 } 1783 }
1628 delete calendar; 1784 delete calendar;
1629 updateView(); 1785 updateView();
1630 return syncOK; 1786 return syncOK;
1631 1787
1632 1788
1633#endif 1789#endif
1634 1790
1635} 1791}
1636 1792
1637void CalendarView::setSyncEventsReadOnly() 1793void CalendarView::setSyncEventsReadOnly()
1638{ 1794{
1639 Event * ev; 1795 Event * ev;
1640 QPtrList<Event> eL = mCalendar->rawEvents(); 1796 QPtrList<Event> eL = mCalendar->rawEvents();
1641 ev = eL.first(); 1797 ev = eL.first();
1642 while ( ev ) { 1798 while ( ev ) {
1643 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1799 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1644 ev->setReadOnly( true ); 1800 ev->setReadOnly( true );
1645 ev = eL.next(); 1801 ev = eL.next();
1646 } 1802 }
1647} 1803}
1648bool CalendarView::openCalendar(QString filename, bool merge) 1804bool CalendarView::openCalendar(QString filename, bool merge)
1649{ 1805{
1650 1806
1651 if (filename.isEmpty()) { 1807 if (filename.isEmpty()) {
1652 return false; 1808 return false;
1653 } 1809 }
1654 1810
1655 if (!QFile::exists(filename)) { 1811 if (!QFile::exists(filename)) {
1656 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1812 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1657 return false; 1813 return false;
1658 } 1814 }
1659 1815
1660 globalFlagBlockAgenda = 1; 1816 globalFlagBlockAgenda = 1;
1661 if (!merge) { 1817 if (!merge) {
1662 mTodoList->clearList(); 1818 mTodoList->clearList();
1663 mViewManager->setDocumentId( filename ); 1819 mViewManager->setDocumentId( filename );
1664 mCalendar->close(); 1820 mCalendar->close();
1665 } 1821 }
1666 mStorage->setFileName( filename ); 1822 mStorage->setFileName( filename );
1667 1823
1668 if ( mStorage->load() ) { 1824 if ( mStorage->load() ) {
1669 if ( merge ) ;//setModified( true ); 1825 if ( merge ) ;//setModified( true );
1670 else { 1826 else {
1671 //setModified( true ); 1827 //setModified( true );
1672 mViewManager->setDocumentId( filename ); 1828 mViewManager->setDocumentId( filename );
1673 mDialogManager->setDocumentId( filename ); 1829 mDialogManager->setDocumentId( filename );
1674 mTodoList->setDocumentId( filename ); 1830 mTodoList->setDocumentId( filename );
1675 } 1831 }
1676 globalFlagBlockAgenda = 2; 1832 globalFlagBlockAgenda = 2;
1677 // if ( getLastSyncEvent() ) 1833 // if ( getLastSyncEvent() )
1678 // getLastSyncEvent()->setReadOnly( true ); 1834 // getLastSyncEvent()->setReadOnly( true );
1679 mCalendar->reInitAlarmSettings(); 1835 mCalendar->reInitAlarmSettings();
1680 setSyncEventsReadOnly(); 1836 setSyncEventsReadOnly();
1681 updateUnmanagedViews(); 1837 updateUnmanagedViews();
1682 updateView(); 1838 updateView();
1683 if ( filename != MainWindow::defaultFileName() ) { 1839 if ( filename != MainWindow::defaultFileName() ) {
1684 saveCalendar( MainWindow::defaultFileName() ); 1840 saveCalendar( MainWindow::defaultFileName() );
1685 } else { 1841 } else {
1686 QFileInfo finf ( MainWindow::defaultFileName()); 1842 QFileInfo finf ( MainWindow::defaultFileName());
1687 if ( finf.exists() ) { 1843 if ( finf.exists() ) {
1688 setLoadedFileVersion( finf.lastModified () ); 1844 setLoadedFileVersion( finf.lastModified () );
1689 } 1845 }
1690 } 1846 }
1691 return true; 1847 return true;
1692 } else { 1848 } else {
1693 // while failing to load, the calendar object could 1849 // while failing to load, the calendar object could
1694 // have become partially populated. Clear it out. 1850 // have become partially populated. Clear it out.
1695 if ( !merge ) { 1851 if ( !merge ) {
1696 mCalendar->close(); 1852 mCalendar->close();
1697 mViewManager->setDocumentId( filename ); 1853 mViewManager->setDocumentId( filename );
1698 mDialogManager->setDocumentId( filename ); 1854 mDialogManager->setDocumentId( filename );
1699 mTodoList->setDocumentId( filename ); 1855 mTodoList->setDocumentId( filename );
1700 } 1856 }
1701 1857
1702 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1858 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1703 1859
1704 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1860 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1705 globalFlagBlockAgenda = 2; 1861 globalFlagBlockAgenda = 2;
1706 mCalendar->reInitAlarmSettings(); 1862 mCalendar->reInitAlarmSettings();
1707 setSyncEventsReadOnly(); 1863 setSyncEventsReadOnly();
1708 updateUnmanagedViews(); 1864 updateUnmanagedViews();
1709 updateView(); 1865 updateView();
1710 } 1866 }
1711 return false; 1867 return false;
1712} 1868}
1713void CalendarView::showOpenError() 1869void CalendarView::showOpenError()
1714{ 1870{
1715 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1871 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1716} 1872}
1717void CalendarView::setLoadedFileVersion(QDateTime dt) 1873void CalendarView::setLoadedFileVersion(QDateTime dt)
1718{ 1874{
1719 loadedFileVersion = dt; 1875 loadedFileVersion = dt;
1720} 1876}
1721bool CalendarView::checkFileChanged(QString fn) 1877bool CalendarView::checkFileChanged(QString fn)
1722{ 1878{
1723 QFileInfo finf ( fn ); 1879 QFileInfo finf ( fn );
1724 if ( !finf.exists() ) 1880 if ( !finf.exists() )
1725 return true; 1881 return true;
1726 QDateTime dt = finf.lastModified (); 1882 QDateTime dt = finf.lastModified ();
1727 if ( dt <= loadedFileVersion ) 1883 if ( dt <= loadedFileVersion )
1728 return false; 1884 return false;
1729 return true; 1885 return true;
1730 1886
1731} 1887}
1732void CalendarView::watchSavedFile() 1888void CalendarView::watchSavedFile()
1733{ 1889{
1734 QFileInfo finf ( MainWindow::defaultFileName()); 1890 QFileInfo finf ( MainWindow::defaultFileName());
1735 if ( !finf.exists() ) 1891 if ( !finf.exists() )
1736 return; 1892 return;
1737 QDateTime dt = finf.lastModified (); 1893 QDateTime dt = finf.lastModified ();
1738 if ( dt < loadedFileVersion ) { 1894 if ( dt < loadedFileVersion ) {
1739 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1895 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1740 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1896 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1741 return; 1897 return;
1742 } 1898 }
1743 loadedFileVersion = dt; 1899 loadedFileVersion = dt;
1744} 1900}
1745 1901
1746bool CalendarView::checkFileVersion(QString fn) 1902bool CalendarView::checkFileVersion(QString fn)
1747{ 1903{
1748 QFileInfo finf ( fn ); 1904 QFileInfo finf ( fn );
1749 if ( !finf.exists() ) 1905 if ( !finf.exists() )
1750 return true; 1906 return true;
1751 QDateTime dt = finf.lastModified (); 1907 QDateTime dt = finf.lastModified ();
1752 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1908 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1753 //qDebug("file on disk version %s",dt.toString().latin1()); 1909 //qDebug("file on disk version %s",dt.toString().latin1());
1754 if ( dt <= loadedFileVersion ) 1910 if ( dt <= loadedFileVersion )
1755 return true; 1911 return true;
1756 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 1912 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
1757 i18n("KO/Pi Warning"),i18n("Overwrite"), 1913 i18n("KO/Pi Warning"),i18n("Overwrite"),
1758 i18n("Sync+save")); 1914 i18n("Sync+save"));
1759 1915
1760 if ( km == KMessageBox::Cancel ) 1916 if ( km == KMessageBox::Cancel )
1761 return false; 1917 return false;
1762 if ( km == KMessageBox::Yes ) 1918 if ( km == KMessageBox::Yes )
1763 return true; 1919 return true;
1764 1920
1765 setSyncDevice("deleteaftersync" ); 1921 setSyncDevice("deleteaftersync" );
1766 mSyncManager->mAskForPreferences = true; 1922 mSyncManager->mAskForPreferences = true;
1767 mSyncManager->mSyncAlgoPrefs = 3; 1923 mSyncManager->mSyncAlgoPrefs = 3;
1768 mSyncManager->mWriteBackFile = false; 1924 mSyncManager->mWriteBackFile = false;
1769 mSyncManager->mWriteBackExistingOnly = false; 1925 mSyncManager->mWriteBackExistingOnly = false;
1770 mSyncManager->mShowSyncSummary = false; 1926 mSyncManager->mShowSyncSummary = false;
1771 syncCalendar( fn, 3 ); 1927 syncCalendar( fn, 3 );
1772 Event * e = getLastSyncEvent(); 1928 Event * e = getLastSyncEvent();
1773 mCalendar->deleteEvent ( e ); 1929 mCalendar->deleteEvent ( e );
1774 updateView(); 1930 updateView();
1775 return true; 1931 return true;
1776} 1932}
1777 1933
1778bool CalendarView::saveCalendar( QString filename ) 1934bool CalendarView::saveCalendar( QString filename )
1779{ 1935{
1780 1936
1781 // Store back all unsaved data into calendar object 1937 // Store back all unsaved data into calendar object
1782 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1938 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1783 if ( mViewManager->currentView() ) 1939 if ( mViewManager->currentView() )
1784 mViewManager->currentView()->flushView(); 1940 mViewManager->currentView()->flushView();
1785 1941
1786 1942
1787 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1943 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1788 mStorage->setSaveFormat( new ICalFormat() ); 1944 mStorage->setSaveFormat( new ICalFormat() );
1789 mStorage->setFileName( filename ); 1945 mStorage->setFileName( filename );
1790 bool success; 1946 bool success;
1791 success = mStorage->save(); 1947 success = mStorage->save();
1792 if ( !success ) { 1948 if ( !success ) {
1793 return false; 1949 return false;
1794 } 1950 }
1795 if ( filename == MainWindow::defaultFileName() ) { 1951 if ( filename == MainWindow::defaultFileName() ) {
1796 setLoadedFileVersion( lfv ); 1952 setLoadedFileVersion( lfv );
1797 watchSavedFile(); 1953 watchSavedFile();
1798 } 1954 }
1799 return true; 1955 return true;
1800} 1956}
1801 1957
1802void CalendarView::closeCalendar() 1958void CalendarView::closeCalendar()
1803{ 1959{
1804 1960
1805 // child windows no longer valid 1961 // child windows no longer valid
1806 emit closingDown(); 1962 emit closingDown();
1807 1963
1808 mCalendar->close(); 1964 mCalendar->close();
1809 setModified(false); 1965 setModified(false);
1810 updateView(); 1966 updateView();
1811} 1967}
1812 1968
1813void CalendarView::archiveCalendar() 1969void CalendarView::archiveCalendar()
1814{ 1970{
1815 mDialogManager->showArchiveDialog(); 1971 mDialogManager->showArchiveDialog();
1816} 1972}
1817 1973
1818 1974
1819void CalendarView::readSettings() 1975void CalendarView::readSettings()
1820{ 1976{
1821 1977
1822 1978
1823 // mViewManager->showAgendaView(); 1979 // mViewManager->showAgendaView();
1824 QString str; 1980 QString str;
1825 //qDebug("CalendarView::readSettings() "); 1981 //qDebug("CalendarView::readSettings() ");
1826 // read settings from the KConfig, supplying reasonable 1982 // read settings from the KConfig, supplying reasonable
1827 // defaults where none are to be found 1983 // defaults where none are to be found
1828 KConfig *config = KOGlobals::config(); 1984 KConfig *config = KOGlobals::config();
1829#ifndef KORG_NOSPLITTER 1985#ifndef KORG_NOSPLITTER
1830 config->setGroup("KOrganizer Geometry"); 1986 config->setGroup("KOrganizer Geometry");
1831 1987
1832 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1988 QValueList<int> sizes = config->readIntListEntry("Separator1");
1833 if (sizes.count() != 2) { 1989 if (sizes.count() != 2) {
1834 sizes << mDateNavigator->minimumSizeHint().width(); 1990 sizes << mDateNavigator->minimumSizeHint().width();
1835 sizes << 300; 1991 sizes << 300;
1836 } 1992 }
1837 mPanner->setSizes(sizes); 1993 mPanner->setSizes(sizes);
1838 1994
1839 sizes = config->readIntListEntry("Separator2"); 1995 sizes = config->readIntListEntry("Separator2");
1840 if ( ( mResourceView && sizes.count() == 4 ) || 1996 if ( ( mResourceView && sizes.count() == 4 ) ||
1841 ( !mResourceView && sizes.count() == 3 ) ) { 1997 ( !mResourceView && sizes.count() == 3 ) ) {
1842 mLeftSplitter->setSizes(sizes); 1998 mLeftSplitter->setSizes(sizes);
1843 } 1999 }
1844#endif 2000#endif
1845 globalFlagBlockAgenda = 1; 2001 globalFlagBlockAgenda = 1;
1846 mViewManager->showAgendaView(); 2002 mViewManager->showAgendaView();
1847 //mViewManager->readSettings( config ); 2003 //mViewManager->readSettings( config );
1848 mTodoList->restoreLayout(config,QString("Todo Layout")); 2004 mTodoList->restoreLayout(config,QString("Todo Layout"));
1849 readFilterSettings(config); 2005 readFilterSettings(config);
1850 2006
1851#ifdef DESKTOP_VERSION 2007#ifdef DESKTOP_VERSION
1852 config->setGroup("WidgetLayout"); 2008 config->setGroup("WidgetLayout");
1853 QStringList list; 2009 QStringList list;
1854 list = config->readListEntry("MainLayout"); 2010 list = config->readListEntry("MainLayout");
1855 int x,y,w,h; 2011 int x,y,w,h;
1856 if ( ! list.isEmpty() ) { 2012 if ( ! list.isEmpty() ) {
1857 x = list[0].toInt(); 2013 x = list[0].toInt();
1858 y = list[1].toInt(); 2014 y = list[1].toInt();
1859 w = list[2].toInt(); 2015 w = list[2].toInt();
1860 h = list[3].toInt(); 2016 h = list[3].toInt();
1861 KApplication::testCoords( &x,&y,&w,&h ); 2017 KApplication::testCoords( &x,&y,&w,&h );
1862 topLevelWidget()->setGeometry(x,y,w,h); 2018 topLevelWidget()->setGeometry(x,y,w,h);
1863 2019
1864 } else { 2020 } else {
1865 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 2021 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1866 } 2022 }
1867 list = config->readListEntry("EditEventLayout"); 2023 list = config->readListEntry("EditEventLayout");
1868 if ( ! list.isEmpty() ) { 2024 if ( ! list.isEmpty() ) {
1869 x = list[0].toInt(); 2025 x = list[0].toInt();
1870 y = list[1].toInt(); 2026 y = list[1].toInt();
1871 w = list[2].toInt(); 2027 w = list[2].toInt();
1872 h = list[3].toInt(); 2028 h = list[3].toInt();
1873 KApplication::testCoords( &x,&y,&w,&h ); 2029 KApplication::testCoords( &x,&y,&w,&h );
1874 mEventEditor->setGeometry(x,y,w,h); 2030 mEventEditor->setGeometry(x,y,w,h);
1875 2031
1876 } 2032 }
1877 list = config->readListEntry("EditTodoLayout"); 2033 list = config->readListEntry("EditTodoLayout");
1878 if ( ! list.isEmpty() ) { 2034 if ( ! list.isEmpty() ) {
1879 x = list[0].toInt(); 2035 x = list[0].toInt();
1880 y = list[1].toInt(); 2036 y = list[1].toInt();
1881 w = list[2].toInt(); 2037 w = list[2].toInt();
1882 h = list[3].toInt(); 2038 h = list[3].toInt();
1883 KApplication::testCoords( &x,&y,&w,&h ); 2039 KApplication::testCoords( &x,&y,&w,&h );
1884 mTodoEditor->setGeometry(x,y,w,h); 2040 mTodoEditor->setGeometry(x,y,w,h);
1885 2041
1886 } 2042 }
1887 list = config->readListEntry("ViewerLayout"); 2043 list = config->readListEntry("ViewerLayout");
1888 if ( ! list.isEmpty() ) { 2044 if ( ! list.isEmpty() ) {
1889 x = list[0].toInt(); 2045 x = list[0].toInt();
1890 y = list[1].toInt(); 2046 y = list[1].toInt();
1891 w = list[2].toInt(); 2047 w = list[2].toInt();
1892 h = list[3].toInt(); 2048 h = list[3].toInt();
1893 KApplication::testCoords( &x,&y,&w,&h ); 2049 KApplication::testCoords( &x,&y,&w,&h );
1894 getEventViewerDialog()->setGeometry(x,y,w,h); 2050 getEventViewerDialog()->setGeometry(x,y,w,h);
1895 } 2051 }
1896#endif 2052#endif
1897 config->setGroup( "Views" ); 2053 config->setGroup( "Views" );
1898 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 2054 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1899 2055
1900 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 2056 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1901 2057
1902 int resetval = 0; 2058 int resetval = 0;
1903 int maxVal = 0; 2059 int maxVal = 0;
1904 if (sizes.count() != 3) { 2060 if (sizes.count() != 3) {
1905 if ( KOPrefs::instance()->mVerticalScreen ) { 2061 if ( KOPrefs::instance()->mVerticalScreen ) {
1906 resetval = mDateNavigator->sizeHint().width()+2; 2062 resetval = mDateNavigator->sizeHint().width()+2;
1907 } else { 2063 } else {
1908 resetval = mDateNavigator->sizeHint().height()+2; 2064 resetval = mDateNavigator->sizeHint().height()+2;
1909 } 2065 }
1910 } 2066 }
1911 if ( resetval ) { 2067 if ( resetval ) {
1912 sizes.clear(); 2068 sizes.clear();
1913 if ( KOPrefs::instance()->mVerticalScreen ) { 2069 if ( KOPrefs::instance()->mVerticalScreen ) {
1914 maxVal = QApplication::desktop()->width() -10; 2070 maxVal = QApplication::desktop()->width() -10;
1915 } else { 2071 } else {
1916 maxVal = QApplication::desktop()->height()-10; 2072 maxVal = QApplication::desktop()->height()-10;
1917 } 2073 }
1918 sizes << resetval; 2074 sizes << resetval;
1919 if ( maxVal < resetval + resetval) 2075 if ( maxVal < resetval + resetval)
1920 resetval = maxVal - resetval; 2076 resetval = maxVal - resetval;
1921 sizes << resetval; 2077 sizes << resetval;
1922 sizes << 100; 2078 sizes << 100;
1923 } 2079 }
1924 mLeftFrame->setSizes(sizes); 2080 mLeftFrame->setSizes(sizes);
1925 sizes = config->readIntListEntry("Main Splitter Frame"); 2081 sizes = config->readIntListEntry("Main Splitter Frame");
1926 resetval = 0; 2082 resetval = 0;
1927 maxVal = 0; 2083 maxVal = 0;
1928 if (sizes.count() != 2) { 2084 if (sizes.count() != 2) {
1929 if ( !KOPrefs::instance()->mVerticalScreen ) { 2085 if ( !KOPrefs::instance()->mVerticalScreen ) {
1930 resetval = mDateNavigator->sizeHint().width()+2; 2086 resetval = mDateNavigator->sizeHint().width()+2;
1931 } else { 2087 } else {
1932 resetval = mDateNavigator->sizeHint().height()+2; 2088 resetval = mDateNavigator->sizeHint().height()+2;
1933 } 2089 }
1934 } 2090 }
1935 if ( resetval ) { 2091 if ( resetval ) {
1936 sizes.clear(); 2092 sizes.clear();
1937 if ( !KOPrefs::instance()->mVerticalScreen ) { 2093 if ( !KOPrefs::instance()->mVerticalScreen ) {
1938 maxVal = QApplication::desktop()->width() -10; 2094 maxVal = QApplication::desktop()->width() -10;
1939 } else { 2095 } else {
1940 maxVal = QApplication::desktop()->height()-10; 2096 maxVal = QApplication::desktop()->height()-10;
1941 } 2097 }
1942 sizes << resetval; 2098 sizes << resetval;
1943 if ( maxVal < resetval + resetval) 2099 if ( maxVal < resetval + resetval)
1944 resetval = maxVal - resetval; 2100 resetval = maxVal - resetval;
1945 sizes << resetval; 2101 sizes << resetval;
1946 } 2102 }
1947 mMainFrame->setSizes(sizes); 2103 mMainFrame->setSizes(sizes);
1948 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 2104 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1949 else if ( dateCount == 7 ) mNavigator->selectWeek(); 2105 else if ( dateCount == 7 ) mNavigator->selectWeek();
1950 else mNavigator->selectDates( dateCount ); 2106 else mNavigator->selectDates( dateCount );
1951 // mViewManager->readSettings( config ); 2107 // mViewManager->readSettings( config );
1952 updateConfig(); 2108 updateConfig();
1953 globalFlagBlockAgenda = 2; 2109 globalFlagBlockAgenda = 2;
1954 mViewManager->readSettings( config ); 2110 mViewManager->readSettings( config );
1955 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 2111 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
1956} 2112}
1957 2113
1958 2114
1959void CalendarView::writeSettings() 2115void CalendarView::writeSettings()
1960{ 2116{
1961 // kdDebug() << "CalendarView::writeSettings" << endl; 2117 // kdDebug() << "CalendarView::writeSettings" << endl;
1962 2118
1963 KConfig *config = KOGlobals::config(); 2119 KConfig *config = KOGlobals::config();
1964 2120
1965 mViewManager->writeSettings( config ); 2121 mViewManager->writeSettings( config );
1966 mTodoList->saveLayout(config,QString("Todo Layout")); 2122 mTodoList->saveLayout(config,QString("Todo Layout"));
1967 mDialogManager->writeSettings( config ); 2123 mDialogManager->writeSettings( config );
1968 //KOPrefs::instance()->usrWriteConfig(); 2124 //KOPrefs::instance()->usrWriteConfig();
1969 KOPrefs::instance()->writeConfig(); 2125 KOPrefs::instance()->writeConfig();
1970 2126
1971 writeFilterSettings(config); 2127 writeFilterSettings(config);
1972 2128 config->setGroup( "AppRun" );
2129 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2130 config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) );
1973 config->setGroup( "Views" ); 2131 config->setGroup( "Views" );
1974 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2132 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1975 2133
1976 QValueList<int> listINT = mLeftFrame->sizes(); 2134 QValueList<int> listINT = mLeftFrame->sizes();
1977 config->writeEntry("Left Splitter Frame",listINT); 2135 config->writeEntry("Left Splitter Frame",listINT);
1978 QValueList<int> listINT2 = mMainFrame->sizes(); 2136 QValueList<int> listINT2 = mMainFrame->sizes();
1979 config->writeEntry("Main Splitter Frame",listINT2); 2137 config->writeEntry("Main Splitter Frame",listINT2);
1980#ifdef DESKTOP_VERSION 2138#ifdef DESKTOP_VERSION
1981 config->setGroup("WidgetLayout"); 2139 config->setGroup("WidgetLayout");
1982 QStringList list ;//= config->readListEntry("MainLayout"); 2140 QStringList list ;//= config->readListEntry("MainLayout");
1983 int x,y,w,h; 2141 int x,y,w,h;
1984 QWidget* wid; 2142 QWidget* wid;
1985 wid = topLevelWidget(); 2143 wid = topLevelWidget();
1986 x = wid->geometry().x(); 2144 x = wid->geometry().x();
1987 y = wid->geometry().y(); 2145 y = wid->geometry().y();
1988 w = wid->width(); 2146 w = wid->width();
1989 h = wid->height(); 2147 h = wid->height();
1990 list.clear(); 2148 list.clear();
1991 list << QString::number( x ); 2149 list << QString::number( x );
1992 list << QString::number( y ); 2150 list << QString::number( y );
1993 list << QString::number( w ); 2151 list << QString::number( w );
1994 list << QString::number( h ); 2152 list << QString::number( h );
1995 config->writeEntry("MainLayout",list ); 2153 config->writeEntry("MainLayout",list );
1996 2154
1997 wid = mEventEditor; 2155 wid = mEventEditor;
1998 x = wid->geometry().x(); 2156 x = wid->geometry().x();
1999 y = wid->geometry().y(); 2157 y = wid->geometry().y();
2000 w = wid->width(); 2158 w = wid->width();
2001 h = wid->height(); 2159 h = wid->height();
2002 list.clear(); 2160 list.clear();
2003 list << QString::number( x ); 2161 list << QString::number( x );
2004 list << QString::number( y ); 2162 list << QString::number( y );
2005 list << QString::number( w ); 2163 list << QString::number( w );
2006 list << QString::number( h ); 2164 list << QString::number( h );
2007 config->writeEntry("EditEventLayout",list ); 2165 config->writeEntry("EditEventLayout",list );
2008 2166
2009 wid = mTodoEditor; 2167 wid = mTodoEditor;
2010 x = wid->geometry().x(); 2168 x = wid->geometry().x();
2011 y = wid->geometry().y(); 2169 y = wid->geometry().y();
2012 w = wid->width(); 2170 w = wid->width();
2013 h = wid->height(); 2171 h = wid->height();
2014 list.clear(); 2172 list.clear();
2015 list << QString::number( x ); 2173 list << QString::number( x );
2016 list << QString::number( y ); 2174 list << QString::number( y );
2017 list << QString::number( w ); 2175 list << QString::number( w );
2018 list << QString::number( h ); 2176 list << QString::number( h );
2019 config->writeEntry("EditTodoLayout",list ); 2177 config->writeEntry("EditTodoLayout",list );
2020 wid = getEventViewerDialog(); 2178 wid = getEventViewerDialog();
2021 x = wid->geometry().x(); 2179 x = wid->geometry().x();
2022 y = wid->geometry().y(); 2180 y = wid->geometry().y();
2023 w = wid->width(); 2181 w = wid->width();
2024 h = wid->height(); 2182 h = wid->height();
2025 list.clear(); 2183 list.clear();
2026 list << QString::number( x ); 2184 list << QString::number( x );
2027 list << QString::number( y ); 2185 list << QString::number( y );
2028 list << QString::number( w ); 2186 list << QString::number( w );
2029 list << QString::number( h ); 2187 list << QString::number( h );
2030 config->writeEntry("ViewerLayout",list ); 2188 config->writeEntry("ViewerLayout",list );
2031 wid = mDialogManager->getSearchDialog(); 2189 wid = mDialogManager->getSearchDialog();
2032 if ( wid ) { 2190 if ( wid ) {
2033 x = wid->geometry().x(); 2191 x = wid->geometry().x();
2034 y = wid->geometry().y(); 2192 y = wid->geometry().y();
2035 w = wid->width(); 2193 w = wid->width();
2036 h = wid->height(); 2194 h = wid->height();
2037 list.clear(); 2195 list.clear();
2038 list << QString::number( x ); 2196 list << QString::number( x );
2039 list << QString::number( y ); 2197 list << QString::number( y );
2040 list << QString::number( w ); 2198 list << QString::number( w );
2041 list << QString::number( h ); 2199 list << QString::number( h );
2042 config->writeEntry("SearchLayout",list ); 2200 config->writeEntry("SearchLayout",list );
2043 } 2201 }
2044#endif 2202#endif
2045 2203
2046 2204
2047 config->sync(); 2205 config->sync();
2048} 2206}
2049 2207
2050void CalendarView::readFilterSettings(KConfig *config) 2208void CalendarView::readFilterSettings(KConfig *config)
2051{ 2209{
2052 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2210 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2053 2211
2054 mFilters.clear(); 2212 mFilters.clear();
2055 2213
2056 config->setGroup("General"); 2214 config->setGroup("General");
2057 QStringList filterList = config->readListEntry("CalendarFilters"); 2215 QStringList filterList = config->readListEntry("CalendarFilters");
2058 2216
2059 QStringList::ConstIterator it = filterList.begin(); 2217 QStringList::ConstIterator it = filterList.begin();
2060 QStringList::ConstIterator end = filterList.end(); 2218 QStringList::ConstIterator end = filterList.end();
2061 while(it != end) { 2219 while(it != end) {
2062 // kdDebug() << " filter: " << (*it) << endl; 2220 // kdDebug() << " filter: " << (*it) << endl;
2063 2221
2064 CalFilter *filter; 2222 CalFilter *filter;
2065 filter = new CalFilter(*it); 2223 filter = new CalFilter(*it);
2066 config->setGroup("Filter_" + (*it).utf8()); 2224 config->setGroup("Filter_" + (*it).utf8());
2067 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2225 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2068 filter->setCriteria(config->readNumEntry("Criteria",0)); 2226 filter->setCriteria(config->readNumEntry("Criteria",0));
2069 filter->setCategoryList(config->readListEntry("CategoryList")); 2227 filter->setCategoryList(config->readListEntry("CategoryList"));
2070 mFilters.append(filter); 2228 mFilters.append(filter);
2071 2229
2072 ++it; 2230 ++it;
2073 } 2231 }
2074 2232
2075 if (mFilters.count() == 0) { 2233 if (mFilters.count() == 0) {
2076 CalFilter *filter = new CalFilter(i18n("Default")); 2234 CalFilter *filter = new CalFilter(i18n("Default"));
2077 mFilters.append(filter); 2235 mFilters.append(filter);
2078 } 2236 }
2079 mFilterView->updateFilters(); 2237 mFilterView->updateFilters();
2080 config->setGroup("FilterView"); 2238 config->setGroup("FilterView");
2081 2239
2082 mFilterView->blockSignals(true); 2240 mFilterView->blockSignals(true);
2083 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2241 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2084 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2242 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2085 mFilterView->blockSignals(false); 2243 mFilterView->blockSignals(false);
2086 // We do it manually to avoid it being done twice by the above calls 2244 // We do it manually to avoid it being done twice by the above calls
2087 updateFilter(); 2245 updateFilter();
2088} 2246}
2089 2247
2090void CalendarView::writeFilterSettings(KConfig *config) 2248void CalendarView::writeFilterSettings(KConfig *config)
2091{ 2249{
2092 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2250 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2093 2251
2094 QStringList filterList; 2252 QStringList filterList;
2095 2253
2096 CalFilter *filter = mFilters.first(); 2254 CalFilter *filter = mFilters.first();
2097 while(filter) { 2255 while(filter) {
2098 // kdDebug() << " fn: " << filter->name() << endl; 2256 // kdDebug() << " fn: " << filter->name() << endl;
2099 filterList << filter->name(); 2257 filterList << filter->name();
2100 config->setGroup("Filter_" + filter->name().utf8()); 2258 config->setGroup("Filter_" + filter->name().utf8());
2101 config->writeEntry("Criteria",filter->criteria()); 2259 config->writeEntry("Criteria",filter->criteria());
2102 config->writeEntry("CategoryList",filter->categoryList()); 2260 config->writeEntry("CategoryList",filter->categoryList());
2103 filter = mFilters.next(); 2261 filter = mFilters.next();
2104 } 2262 }
2105 config->setGroup("General"); 2263 config->setGroup("General");
2106 config->writeEntry("CalendarFilters",filterList); 2264 config->writeEntry("CalendarFilters",filterList);
2107 2265
2108 config->setGroup("FilterView"); 2266 config->setGroup("FilterView");
2109 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2267 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2110 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2268 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2111} 2269}
2112 2270
2113 2271
2114void CalendarView::goToday() 2272void CalendarView::goToday()
2115{ 2273{
2116 if ( mViewManager->currentView()->isMonthView() ) 2274 if ( mViewManager->currentView()->isMonthView() )
2117 mNavigator->selectTodayMonth(); 2275 mNavigator->selectTodayMonth();
2118 else 2276 else
2119 mNavigator->selectToday(); 2277 mNavigator->selectToday();
2120} 2278}
2121 2279
2122void CalendarView::goNext() 2280void CalendarView::goNext()
2123{ 2281{
2124 mNavigator->selectNext(); 2282 mNavigator->selectNext();
2125} 2283}
2126 2284
2127void CalendarView::goPrevious() 2285void CalendarView::goPrevious()
2128{ 2286{
2129 mNavigator->selectPrevious(); 2287 mNavigator->selectPrevious();
2130} 2288}
2131void CalendarView::goNextMonth() 2289void CalendarView::goNextMonth()
2132{ 2290{
2133 mNavigator->selectNextMonth(); 2291 mNavigator->selectNextMonth();
2134} 2292}
2135 2293
2136void CalendarView::goPreviousMonth() 2294void CalendarView::goPreviousMonth()
2137{ 2295{
2138 mNavigator->selectPreviousMonth(); 2296 mNavigator->selectPreviousMonth();
2139} 2297}
2140void CalendarView::writeLocale() 2298void CalendarView::writeLocale()
2141{ 2299{
2142 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2300 //KPimGlobalPrefs::instance()->setGlobalConfig();
2143#if 0 2301#if 0
2144 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2302 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2145 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2303 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2146 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2304 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2147 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2305 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2148 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2306 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2149 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2307 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2150 dummy = KOPrefs::instance()->mUserDateFormatShort; 2308 dummy = KOPrefs::instance()->mUserDateFormatShort;
2151 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2309 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2152 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2310 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2153 KOPrefs::instance()->mDaylightsavingStart, 2311 KOPrefs::instance()->mDaylightsavingStart,
2154 KOPrefs::instance()->mDaylightsavingEnd ); 2312 KOPrefs::instance()->mDaylightsavingEnd );
2155 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2313 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2156#endif 2314#endif
2157} 2315}
2158void CalendarView::updateConfig() 2316void CalendarView::updateConfig()
2159{ 2317{
2160 writeLocale(); 2318 writeLocale();
2161 if ( KOPrefs::instance()->mUseAppColors ) 2319 if ( KOPrefs::instance()->mUseAppColors )
2162 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2320 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2163 emit configChanged(); 2321 emit configChanged();
2164 mTodoList->updateConfig(); 2322 mTodoList->updateConfig();
2165 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2323 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2166 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2324 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2167 // To make the "fill window" configurations work 2325 // To make the "fill window" configurations work
2168 //mViewManager->raiseCurrentView(); 2326 //mViewManager->raiseCurrentView();
2169} 2327}
2170 2328
2171 2329
2172void CalendarView::eventChanged(Event *event) 2330void CalendarView::eventChanged(Event *event)
2173{ 2331{
2174 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2332 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2175 //updateUnmanagedViews(); 2333 //updateUnmanagedViews();
2176} 2334}
2177 2335
2178void CalendarView::eventAdded(Event *event) 2336void CalendarView::eventAdded(Event *event)
2179{ 2337{
2180 changeEventDisplay(event,KOGlobals::EVENTADDED); 2338 changeEventDisplay(event,KOGlobals::EVENTADDED);
2181} 2339}
2182 2340
2183void CalendarView::eventToBeDeleted(Event *) 2341void CalendarView::eventToBeDeleted(Event *)
2184{ 2342{
2185 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2343 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2186} 2344}
2187 2345
2188void CalendarView::eventDeleted() 2346void CalendarView::eventDeleted()
2189{ 2347{
2190 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2348 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2191} 2349}
2192void CalendarView::changeTodoDisplay(Todo *which, int action) 2350void CalendarView::changeTodoDisplay(Todo *which, int action)
2193{ 2351{
2194 changeIncidenceDisplay((Incidence *)which, action); 2352 changeIncidenceDisplay((Incidence *)which, action);
2195 mDateNavigator->updateView(); //LR 2353 mDateNavigator->updateView(); //LR
2196 //mDialogManager->updateSearchDialog(); 2354 //mDialogManager->updateSearchDialog();
2197 2355
2198 if (which) { 2356 if (which) {
2199 mViewManager->updateWNview(); 2357 mViewManager->updateWNview();
2200 //mTodoList->updateView(); 2358 //mTodoList->updateView();
2201 } 2359 }
2202 2360
2203} 2361}
2204 2362
2205void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2363void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2206{ 2364{
2207 updateUnmanagedViews(); 2365 updateUnmanagedViews();
2208 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2366 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2209 if ( action == KOGlobals::EVENTDELETED ) { //delete 2367 if ( action == KOGlobals::EVENTDELETED ) { //delete
2210 mCalendar->checkAlarmForIncidence( 0, true ); 2368 mCalendar->checkAlarmForIncidence( 0, true );
2211 if ( mEventViewerDialog ) 2369 if ( mEventViewerDialog )
2212 mEventViewerDialog->hide(); 2370 mEventViewerDialog->hide();
2213 } 2371 }
2214 else 2372 else
2215 mCalendar->checkAlarmForIncidence( which , false ); 2373 mCalendar->checkAlarmForIncidence( which , false );
2216} 2374}
2217 2375
2218// most of the changeEventDisplays() right now just call the view's 2376// most of the changeEventDisplays() right now just call the view's
2219// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2377// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2220void CalendarView::changeEventDisplay(Event *which, int action) 2378void CalendarView::changeEventDisplay(Event *which, int action)
2221{ 2379{
2222 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2380 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2223 changeIncidenceDisplay((Incidence *)which, action); 2381 changeIncidenceDisplay((Incidence *)which, action);
2224 mDateNavigator->updateView(); 2382 mDateNavigator->updateView();
2225 //mDialogManager->updateSearchDialog(); 2383 //mDialogManager->updateSearchDialog();
2226 2384
2227 if (which) { 2385 if (which) {
2228 // If there is an event view visible update the display 2386 // If there is an event view visible update the display
2229 mViewManager->currentView()->changeEventDisplay(which,action); 2387 mViewManager->currentView()->changeEventDisplay(which,action);
2230 // TODO: check, if update needed 2388 // TODO: check, if update needed
2231 // if (which->getTodoStatus()) { 2389 // if (which->getTodoStatus()) {
2232 mTodoList->updateView(); 2390 mTodoList->updateView();
2233 // } 2391 // }
2234 } else { 2392 } else {
2235 mViewManager->currentView()->updateView(); 2393 mViewManager->currentView()->updateView();
2236 } 2394 }
2237} 2395}
2238 2396
2239 2397
2240void CalendarView::updateTodoViews() 2398void CalendarView::updateTodoViews()
2241{ 2399{
2242 mTodoList->updateView(); 2400 mTodoList->updateView();
2243 mViewManager->currentView()->updateView(); 2401 mViewManager->currentView()->updateView();
2244 2402
2245} 2403}
2246 2404
2247 2405
2248void CalendarView::updateView(const QDate &start, const QDate &end) 2406void CalendarView::updateView(const QDate &start, const QDate &end)
2249{ 2407{
2250 mTodoList->updateView(); 2408 mTodoList->updateView();
2251 mViewManager->updateView(start, end); 2409 mViewManager->updateView(start, end);
2252 //mDateNavigator->updateView(); 2410 //mDateNavigator->updateView();
2253} 2411}
2254 2412
2255void CalendarView::updateView() 2413void CalendarView::updateView()
2256{ 2414{
2257 DateList tmpList = mNavigator->selectedDates(); 2415 DateList tmpList = mNavigator->selectedDates();
2258 2416
2259 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2417 if ( KOPrefs::instance()->mHideNonStartedTodos )
2260 mTodoList->updateView(); 2418 mTodoList->updateView();
2261 // We assume that the navigator only selects consecutive days. 2419 // We assume that the navigator only selects consecutive days.
2262 updateView( tmpList.first(), tmpList.last() ); 2420 updateView( tmpList.first(), tmpList.last() );
2263} 2421}
2264 2422
2265void CalendarView::updateUnmanagedViews() 2423void CalendarView::updateUnmanagedViews()
2266{ 2424{
2267 mDateNavigator->updateDayMatrix(); 2425 mDateNavigator->updateDayMatrix();
2268} 2426}
2269 2427
2270int CalendarView::msgItemDelete(const QString name) 2428int CalendarView::msgItemDelete(const QString name)
2271{ 2429{
2272 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2430 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2273 i18n("This item will be\npermanently deleted."), 2431 i18n("This item will be\npermanently deleted."),
2274 i18n("KO/Pi Confirmation"),i18n("Delete")); 2432 i18n("KO/Pi Confirmation"),i18n("Delete"));
2275} 2433}
2276 2434
2277 2435
2278void CalendarView::edit_cut() 2436void CalendarView::edit_cut()
2279{ 2437{
2280 Event *anEvent=0; 2438 Event *anEvent=0;
2281 2439
2282 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2440 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2283 2441
2284 if (mViewManager->currentView()->isEventView()) { 2442 if (mViewManager->currentView()->isEventView()) {
2285 if ( incidence && incidence->type() == "Event" ) { 2443 if ( incidence && incidence->type() == "Event" ) {
2286 anEvent = static_cast<Event *>(incidence); 2444 anEvent = static_cast<Event *>(incidence);
2287 } 2445 }
2288 } 2446 }
2289 2447
2290 if (!anEvent) { 2448 if (!anEvent) {
2291 KNotifyClient::beep(); 2449 KNotifyClient::beep();
2292 return; 2450 return;
2293 } 2451 }
2294 DndFactory factory( mCalendar ); 2452 DndFactory factory( mCalendar );
2295 factory.cutIncidence(anEvent); 2453 factory.cutIncidence(anEvent);
2296 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2454 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2297} 2455}
2298 2456
2299void CalendarView::edit_copy() 2457void CalendarView::edit_copy()
2300{ 2458{
2301 Event *anEvent=0; 2459 Event *anEvent=0;
2302 2460
2303 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2461 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2304 2462
2305 if (mViewManager->currentView()->isEventView()) { 2463 if (mViewManager->currentView()->isEventView()) {
2306 if ( incidence && incidence->type() == "Event" ) { 2464 if ( incidence && incidence->type() == "Event" ) {
2307 anEvent = static_cast<Event *>(incidence); 2465 anEvent = static_cast<Event *>(incidence);
2308 } 2466 }
2309 } 2467 }
2310 2468
2311 if (!anEvent) { 2469 if (!anEvent) {
2312 KNotifyClient::beep(); 2470 KNotifyClient::beep();
2313 return; 2471 return;
2314 } 2472 }
2315 DndFactory factory( mCalendar ); 2473 DndFactory factory( mCalendar );
2316 factory.copyIncidence(anEvent); 2474 factory.copyIncidence(anEvent);
2317} 2475}
2318 2476
2319void CalendarView::edit_paste() 2477void CalendarView::edit_paste()
2320{ 2478{
2321 QDate date = mNavigator->selectedDates().first(); 2479 QDate date = mNavigator->selectedDates().first();
2322 2480
2323 DndFactory factory( mCalendar ); 2481 DndFactory factory( mCalendar );
2324 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2482 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2325 2483
2326 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2484 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2327} 2485}
2328 2486
2329void CalendarView::edit_options() 2487void CalendarView::edit_options()
2330{ 2488{
2331 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2489 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2332 emit save(); 2490 emit save();
2333 emit saveStopTimer(); 2491 emit saveStopTimer();
2334 mDialogManager->showOptionsDialog(); 2492 mDialogManager->showOptionsDialog();
2335 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2493 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2336 emit saveStopTimer(); 2494 emit saveStopTimer();
2337 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2495 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2338 i18n("Timezone settings"),i18n("Reload"))) { 2496 i18n("Timezone settings"),i18n("Reload"))) {
2339 qDebug("KO: TZ reload cancelled "); 2497 qDebug("KO: TZ reload cancelled ");
2340 return; 2498 return;
2341 } 2499 }
2342 qDebug("KO: Timezone change "); 2500 qDebug("KO: Timezone change ");
2343 openCalendar( MainWindow::defaultFileName() ); 2501 openCalendar( MainWindow::defaultFileName() );
2344 setModified(true); 2502 setModified(true);
2345 } 2503 }
2346 else 2504 else
2347 qDebug("KO: No tz change "); 2505 qDebug("KO: No tz change ");
2348 2506
2349} 2507}
2350 2508
2351 2509
2352void CalendarView::slotSelectPickerDate( QDate d) 2510void CalendarView::slotSelectPickerDate( QDate d)
2353{ 2511{
2354 mDateFrame->hide(); 2512 mDateFrame->hide();
2355 if ( mDatePickerMode == 1 ) { 2513 if ( mDatePickerMode == 1 ) {
2356 mNavigator->slotDaySelect( d ); 2514 mNavigator->slotDaySelect( d );
2357 } else if ( mDatePickerMode == 2 ) { 2515 } else if ( mDatePickerMode == 2 ) {
2358 if ( mMoveIncidence->type() == "Todo" ) { 2516 if ( mMoveIncidence->type() == "Todo" ) {
2359 Todo * to = (Todo *) mMoveIncidence; 2517 Todo * to = (Todo *) mMoveIncidence;
2360 QTime tim; 2518 QTime tim;
2361 int len = 0; 2519 int len = 0;
2362 if ( to->hasStartDate() && to->hasDueDate() ) 2520 if ( to->hasStartDate() && to->hasDueDate() )
2363 len = to->dtStart().secsTo( to->dtDue()); 2521 len = to->dtStart().secsTo( to->dtDue());
2364 if ( to->hasDueDate() ) 2522 if ( to->hasDueDate() )
2365 tim = to->dtDue().time(); 2523 tim = to->dtDue().time();
2366 else { 2524 else {
2367 tim = QTime ( 0,0,0 ); 2525 tim = QTime ( 0,0,0 );
2368 to->setFloats( true ); 2526 to->setFloats( true );
2369 to->setHasDueDate( true ); 2527 to->setHasDueDate( true );
2370 } 2528 }
2371 QDateTime dt ( d,tim ); 2529 QDateTime dt ( d,tim );
2372 to->setDtDue( dt ); 2530 to->setDtDue( dt );
2373 2531
2374 if ( to->hasStartDate() ) { 2532 if ( to->hasStartDate() ) {
2375 if ( len>0 ) 2533 if ( len>0 )
2376 to->setDtStart(to->dtDue().addSecs( -len )); 2534 to->setDtStart(to->dtDue().addSecs( -len ));
2377 else 2535 else
2378 if (to->dtStart() > to->dtDue() ) 2536 if (to->dtStart() > to->dtDue() )
2379 to->setDtStart(to->dtDue().addDays( -3 )); 2537 to->setDtStart(to->dtDue().addDays( -3 ));
2380 } 2538 }
2381 2539
2382 todoChanged( to ); 2540 todoChanged( to );
2383 } else { 2541 } else {
2384 if ( mMoveIncidence->doesRecur() ) { 2542 if ( mMoveIncidence->doesRecur() ) {
2385#if 0 2543#if 0
2386 // PENDING implement this 2544 // PENDING implement this
2387 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2545 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2388 mCalendar()->addIncidence( newInc ); 2546 mCalendar()->addIncidence( newInc );
2389 if ( mMoveIncidence->type() == "Todo" ) 2547 if ( mMoveIncidence->type() == "Todo" )
2390 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2548 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2391 else 2549 else
2392 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2550 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2393 mMoveIncidence = newInc; 2551 mMoveIncidence = newInc;
2394 2552
2395#endif 2553#endif
2396 } 2554 }
2397 QTime tim = mMoveIncidence->dtStart().time(); 2555 QTime tim = mMoveIncidence->dtStart().time();
2398 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2556 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2399 QDateTime dt ( d,tim ); 2557 QDateTime dt ( d,tim );
2400 mMoveIncidence->setDtStart( dt ); 2558 mMoveIncidence->setDtStart( dt );
2401 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2559 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2402 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2560 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2403 } 2561 }
2404 2562
2405 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2563 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2406 } 2564 }
2407} 2565}
2408 2566
2409void CalendarView::removeCategories() 2567void CalendarView::removeCategories()
2410{ 2568{
2411 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2569 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2412 QStringList catList = KOPrefs::instance()->mCustomCategories; 2570 QStringList catList = KOPrefs::instance()->mCustomCategories;
2413 QStringList catIncList; 2571 QStringList catIncList;
2414 QStringList newCatList; 2572 QStringList newCatList;
2415 Incidence* inc = incList.first(); 2573 Incidence* inc = incList.first();
2416 int i; 2574 int i;
2417 int count = 0; 2575 int count = 0;
2418 while ( inc ) { 2576 while ( inc ) {
2419 newCatList.clear(); 2577 newCatList.clear();
2420 catIncList = inc->categories() ; 2578 catIncList = inc->categories() ;
2421 for( i = 0; i< catIncList.count(); ++i ) { 2579 for( i = 0; i< catIncList.count(); ++i ) {
2422 if ( catList.contains (catIncList[i])) 2580 if ( catList.contains (catIncList[i]))
2423 newCatList.append( catIncList[i] ); 2581 newCatList.append( catIncList[i] );
2424 } 2582 }
2425 newCatList.sort(); 2583 newCatList.sort();
2426 inc->setCategories( newCatList.join(",") ); 2584 inc->setCategories( newCatList.join(",") );
2427 inc = incList.next(); 2585 inc = incList.next();
2428 } 2586 }
2429} 2587}
2430 2588
2431int CalendarView::addCategories() 2589int CalendarView::addCategories()
2432{ 2590{
2433 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2591 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2434 QStringList catList = KOPrefs::instance()->mCustomCategories; 2592 QStringList catList = KOPrefs::instance()->mCustomCategories;
2435 QStringList catIncList; 2593 QStringList catIncList;
2436 Incidence* inc = incList.first(); 2594 Incidence* inc = incList.first();
2437 int i; 2595 int i;
2438 int count = 0; 2596 int count = 0;
2439 while ( inc ) { 2597 while ( inc ) {
2440 catIncList = inc->categories() ; 2598 catIncList = inc->categories() ;
2441 for( i = 0; i< catIncList.count(); ++i ) { 2599 for( i = 0; i< catIncList.count(); ++i ) {
2442 if ( !catList.contains (catIncList[i])) { 2600 if ( !catList.contains (catIncList[i])) {
2443 catList.append( catIncList[i] ); 2601 catList.append( catIncList[i] );
2444 //qDebug("add cat %s ", catIncList[i].latin1()); 2602 //qDebug("add cat %s ", catIncList[i].latin1());
2445 ++count; 2603 ++count;
2446 } 2604 }
2447 } 2605 }
2448 inc = incList.next(); 2606 inc = incList.next();
2449 } 2607 }
2450 catList.sort(); 2608 catList.sort();
2451 KOPrefs::instance()->mCustomCategories = catList; 2609 KOPrefs::instance()->mCustomCategories = catList;
2452 return count; 2610 return count;
2453} 2611}
2454 2612
2455void CalendarView::manageCategories() 2613void CalendarView::manageCategories()
2456{ 2614{
2457 KOCatPrefs* cp = new KOCatPrefs(); 2615 KOCatPrefs* cp = new KOCatPrefs();
2458 cp->show(); 2616 cp->show();
2459 int w =cp->sizeHint().width() ; 2617 int w =cp->sizeHint().width() ;
2460 int h = cp->sizeHint().height() ; 2618 int h = cp->sizeHint().height() ;
2461 int dw = QApplication::desktop()->width(); 2619 int dw = QApplication::desktop()->width();
2462 int dh = QApplication::desktop()->height(); 2620 int dh = QApplication::desktop()->height();
2463 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2621 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2464 if ( !cp->exec() ) { 2622 if ( !cp->exec() ) {
2465 delete cp; 2623 delete cp;
2466 return; 2624 return;
2467 } 2625 }
2468 int count = 0; 2626 int count = 0;
2469 if ( cp->addCat() ) { 2627 if ( cp->addCat() ) {
2470 count = addCategories(); 2628 count = addCategories();
2471 if ( count ) { 2629 if ( count ) {
2472 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2630 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2473 writeSettings(); 2631 writeSettings();
2474 } else 2632 } else
2475 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2633 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2476 } else { 2634 } else {
2477 removeCategories(); 2635 removeCategories();
2478 updateView(); 2636 updateView();
2479 } 2637 }
2480 delete cp; 2638 delete cp;
2481} 2639}
2482 2640
2483void CalendarView::beamIncidence(Incidence * Inc) 2641void CalendarView::beamIncidence(Incidence * Inc)
2484{ 2642{
2485 QPtrList<Incidence> delSel ; 2643 QPtrList<Incidence> delSel ;
2486 delSel.append(Inc); 2644 delSel.append(Inc);
2487 beamIncidenceList( delSel ); 2645 beamIncidenceList( delSel );
2488} 2646}
2489void CalendarView::beamCalendar() 2647void CalendarView::beamCalendar()
2490{ 2648{
2491 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2649 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2492 //qDebug("beamCalendar() "); 2650 //qDebug("beamCalendar() ");
2493 beamIncidenceList( delSel ); 2651 beamIncidenceList( delSel );
2494} 2652}
2495void CalendarView::beamFilteredCalendar() 2653void CalendarView::beamFilteredCalendar()
2496{ 2654{
2497 QPtrList<Incidence> delSel = mCalendar->incidences(); 2655 QPtrList<Incidence> delSel = mCalendar->incidences();
2498 //qDebug("beamFilteredCalendar() "); 2656 //qDebug("beamFilteredCalendar() ");
2499 beamIncidenceList( delSel ); 2657 beamIncidenceList( delSel );
2500} 2658}
2501void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2659void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2502{ 2660{
2503 if ( beamDialog->exec () == QDialog::Rejected ) 2661 if ( beamDialog->exec () == QDialog::Rejected )
2504 return; 2662 return;
2505#ifdef DESKTOP_VERSION 2663#ifdef DESKTOP_VERSION
2506 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2664 QString fn = locateLocal( "tmp", "kopibeamfile" );
2507#else 2665#else
2508 QString fn = "/tmp/kopibeamfile"; 2666 QString fn = "/tmp/kopibeamfile";
2509#endif 2667#endif
2510 QString mes; 2668 QString mes;
2511 bool createbup = true; 2669 bool createbup = true;
2512 if ( createbup ) { 2670 if ( createbup ) {
2513 QString description = "\n"; 2671 QString description = "\n";
2514 CalendarLocal* cal = new CalendarLocal(); 2672 CalendarLocal* cal = new CalendarLocal();
2515 if ( beamDialog->beamLocal() ) 2673 if ( beamDialog->beamLocal() )
2516 cal->setLocalTime(); 2674 cal->setLocalTime();
2517 else 2675 else
2518 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2676 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2519 Incidence *incidence = delSel.first(); 2677 Incidence *incidence = delSel.first();
2520 bool addText = false; 2678 bool addText = false;
2521 if ( delSel.count() < 10 ) 2679 if ( delSel.count() < 10 )
2522 addText = true; 2680 addText = true;
2523 else { 2681 else {
2524 description.sprintf(i18n(" %d items?"),delSel.count() ); 2682 description.sprintf(i18n(" %d items?"),delSel.count() );
2525 } 2683 }
2526 while ( incidence ) { 2684 while ( incidence ) {
2527 Incidence *in = incidence->clone(); 2685 Incidence *in = incidence->clone();
2528 if ( ! in->summary().isEmpty() ) { 2686 if ( ! in->summary().isEmpty() ) {
2529 in->setDescription(""); 2687 in->setDescription("");
2530 } else { 2688 } else {
2531 in->setSummary( in->description().left(20)); 2689 in->setSummary( in->description().left(20));
2532 in->setDescription(""); 2690 in->setDescription("");
2533 } 2691 }
2534 if ( addText ) 2692 if ( addText )
2535 description += in->summary() + "\n"; 2693 description += in->summary() + "\n";
2536 cal->addIncidence( in ); 2694 cal->addIncidence( in );
2537 incidence = delSel.next(); 2695 incidence = delSel.next();
2538 } 2696 }
2539 if ( beamDialog->beamVcal() ) { 2697 if ( beamDialog->beamVcal() ) {
2540 fn += ".vcs"; 2698 fn += ".vcs";
2541 FileStorage storage( cal, fn, new VCalFormat ); 2699 FileStorage storage( cal, fn, new VCalFormat );
2542 storage.save(); 2700 storage.save();
2543 } else { 2701 } else {
2544 fn += ".ics"; 2702 fn += ".ics";
2545 FileStorage storage( cal, fn, new ICalFormat( ) ); 2703 FileStorage storage( cal, fn, new ICalFormat( ) );
2546 storage.save(); 2704 storage.save();
2547 } 2705 }
2548 delete cal; 2706 delete cal;
2549 mes = i18n("KO/Pi: Ready for beaming"); 2707 mes = i18n("KO/Pi: Ready for beaming");
2550 topLevelWidget()->setCaption(mes); 2708 topLevelWidget()->setCaption(mes);
2551 KApplication::convert2latin1( fn ); 2709 KApplication::convert2latin1( fn );
2552#ifndef DESKTOP_VERSION 2710#ifndef DESKTOP_VERSION
2553 Ir *ir = new Ir( this ); 2711 Ir *ir = new Ir( this );
2554 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2712 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2555 ir->send( fn, description, "text/x-vCalendar" ); 2713 ir->send( fn, description, "text/x-vCalendar" );
2556#endif 2714#endif
2557 } 2715 }
2558} 2716}
2559void CalendarView::beamDone( Ir *ir ) 2717void CalendarView::beamDone( Ir *ir )
2560{ 2718{
2561#ifndef DESKTOP_VERSION 2719#ifndef DESKTOP_VERSION
2562 delete ir; 2720 delete ir;
2563#endif 2721#endif
2564 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2722 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2565 topLevelWidget()->raise(); 2723 topLevelWidget()->raise();
2566} 2724}
2567 2725
2568void CalendarView::moveIncidence(Incidence * inc ) 2726void CalendarView::moveIncidence(Incidence * inc )
2569{ 2727{
2570 if ( !inc ) return; 2728 if ( !inc ) return;
2571 showDatePickerPopup(); 2729 showDatePickerPopup();
2572 mDatePickerMode = 2; 2730 mDatePickerMode = 2;
2573 mMoveIncidence = inc ; 2731 mMoveIncidence = inc ;
2574 QDate da; 2732 QDate da;
2575 if ( mMoveIncidence->type() == "Todo" ) { 2733 if ( mMoveIncidence->type() == "Todo" ) {
2576 Todo * to = (Todo *) mMoveIncidence; 2734 Todo * to = (Todo *) mMoveIncidence;
2577 if ( to->hasDueDate() ) 2735 if ( to->hasDueDate() )
2578 da = to->dtDue().date(); 2736 da = to->dtDue().date();
2579 else 2737 else
2580 da = QDate::currentDate(); 2738 da = QDate::currentDate();
2581 } else { 2739 } else {
2582 da = mMoveIncidence->dtStart().date(); 2740 da = mMoveIncidence->dtStart().date();
2583 } 2741 }
2584 //PENDING set date for recurring incidence to date of recurrence 2742 //PENDING set date for recurring incidence to date of recurrence
2585 //mMoveIncidenceOldDate; 2743 //mMoveIncidenceOldDate;
2586 mDatePicker->setDate( da ); 2744 mDatePicker->setDate( da );
2587} 2745}
2588void CalendarView::showDatePickerPopup() 2746void CalendarView::showDatePickerPopup()
2589{ 2747{
2590 if ( mDateFrame->isVisible() ) 2748 if ( mDateFrame->isVisible() )
2591 mDateFrame->hide(); 2749 mDateFrame->hide();
2592 else { 2750 else {
2593 int offX = 0, offY = 0; 2751 int offX = 0, offY = 0;
2594#ifdef DESKTOP_VERSION 2752#ifdef DESKTOP_VERSION
2595 int w =mDatePicker->sizeHint().width() ; 2753 int w =mDatePicker->sizeHint().width() ;
2596 int h = mDatePicker->sizeHint().height() ; 2754 int h = mDatePicker->sizeHint().height() ;
2597 int dw = topLevelWidget()->width(); 2755 int dw = topLevelWidget()->width();
2598 int dh = topLevelWidget()->height(); 2756 int dh = topLevelWidget()->height();
2599 offX = topLevelWidget()->x(); 2757 offX = topLevelWidget()->x();
2600 offY = topLevelWidget()->y(); 2758 offY = topLevelWidget()->y();
2601#else 2759#else
2602 int w =mDatePicker->sizeHint().width() ; 2760 int w =mDatePicker->sizeHint().width() ;
2603 int h = mDatePicker->sizeHint().height() ; 2761 int h = mDatePicker->sizeHint().height() ;
2604 int dw = QApplication::desktop()->width(); 2762 int dw = QApplication::desktop()->width();
2605 int dh = QApplication::desktop()->height(); 2763 int dh = QApplication::desktop()->height();
2606#endif 2764#endif
2607 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2765 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2608 mDateFrame->show(); 2766 mDateFrame->show();
2609 } 2767 }
2610} 2768}
2611void CalendarView::showDatePicker( ) 2769void CalendarView::showDatePicker( )
2612{ 2770{
2613 showDatePickerPopup(); 2771 showDatePickerPopup();
2614 mDatePickerMode = 1; 2772 mDatePickerMode = 1;
2615 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2773 mDatePicker->setDate( mNavigator->selectedDates().first() );
2616} 2774}
2617 2775
2618void CalendarView::showEventEditor() 2776void CalendarView::showEventEditor()
2619{ 2777{
2620#ifdef DESKTOP_VERSION 2778#ifdef DESKTOP_VERSION
2621 int x,y,w,h; 2779 int x,y,w,h;
2622 x = mEventEditor->geometry().x(); 2780 x = mEventEditor->geometry().x();
2623 y = mEventEditor->geometry().y(); 2781 y = mEventEditor->geometry().y();
2624 w = mEventEditor->width(); 2782 w = mEventEditor->width();
2625 h = mEventEditor->height(); 2783 h = mEventEditor->height();
2626 mEventEditor->show(); 2784 mEventEditor->show();
2627 mEventEditor->setGeometry(x,y,w,h); 2785 mEventEditor->setGeometry(x,y,w,h);
2628#else 2786#else
2629 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2787 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2630 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2788 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2631 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2789 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2632 qApp->processEvents(); 2790 qApp->processEvents();
2633 delete mEventEditor; 2791 delete mEventEditor;
2634 mEventEditor = mDialogManager->getEventEditor(); 2792 mEventEditor = mDialogManager->getEventEditor();
2635 topLevelWidget()->setCaption( i18n("") ); 2793 topLevelWidget()->setCaption( i18n("") );
2636 } 2794 }
2637 mEventEditor->showMaximized(); 2795 mEventEditor->showMaximized();
2638#endif 2796#endif
2639} 2797}
2640void CalendarView::showTodoEditor() 2798void CalendarView::showTodoEditor()
2641{ 2799{
2642#ifdef DESKTOP_VERSION 2800#ifdef DESKTOP_VERSION
2643 int x,y,w,h; 2801 int x,y,w,h;
2644 x = mTodoEditor->geometry().x(); 2802 x = mTodoEditor->geometry().x();
2645 y = mTodoEditor->geometry().y(); 2803 y = mTodoEditor->geometry().y();
2646 w = mTodoEditor->width(); 2804 w = mTodoEditor->width();
2647 h = mTodoEditor->height(); 2805 h = mTodoEditor->height();
2648 mTodoEditor->show(); 2806 mTodoEditor->show();
2649 mTodoEditor->setGeometry(x,y,w,h); 2807 mTodoEditor->setGeometry(x,y,w,h);
2650#else 2808#else
2651 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2809 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2652 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2810 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2653 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2811 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2654 qApp->processEvents(); 2812 qApp->processEvents();
2655 delete mTodoEditor; 2813 delete mTodoEditor;
2656 mTodoEditor = mDialogManager->getTodoEditor(); 2814 mTodoEditor = mDialogManager->getTodoEditor();
2657 topLevelWidget()->setCaption( i18n("") ); 2815 topLevelWidget()->setCaption( i18n("") );
2658 } 2816 }
2659 mTodoEditor->showMaximized(); 2817 mTodoEditor->showMaximized();
2660#endif 2818#endif
2661} 2819}
2662 2820
2663void CalendarView::cloneIncidence() 2821void CalendarView::cloneIncidence()
2664{ 2822{
2665 Incidence *incidence = currentSelection(); 2823 Incidence *incidence = currentSelection();
2666 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2824 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2667 if ( incidence ) { 2825 if ( incidence ) {
2668 cloneIncidence(incidence); 2826 cloneIncidence(incidence);
2669 } 2827 }
2670} 2828}
2671void CalendarView::moveIncidence() 2829void CalendarView::moveIncidence()
2672{ 2830{
2673 Incidence *incidence = currentSelection(); 2831 Incidence *incidence = currentSelection();
2674 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2832 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2675 if ( incidence ) { 2833 if ( incidence ) {
2676 moveIncidence(incidence); 2834 moveIncidence(incidence);
2677 } 2835 }
2678} 2836}
2679void CalendarView::beamIncidence() 2837void CalendarView::beamIncidence()
2680{ 2838{
2681 Incidence *incidence = currentSelection(); 2839 Incidence *incidence = currentSelection();
2682 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2840 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2683 if ( incidence ) { 2841 if ( incidence ) {
2684 beamIncidence(incidence); 2842 beamIncidence(incidence);
2685 } 2843 }
2686} 2844}
2687void CalendarView::toggleCancelIncidence() 2845void CalendarView::toggleCancelIncidence()
2688{ 2846{
2689 Incidence *incidence = currentSelection(); 2847 Incidence *incidence = currentSelection();
2690 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2848 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2691 if ( incidence ) { 2849 if ( incidence ) {
2692 cancelIncidence(incidence); 2850 cancelIncidence(incidence);
2693 } 2851 }
2694} 2852}
2695 2853
2696 2854
2697void CalendarView::cancelIncidence(Incidence * inc ) 2855void CalendarView::cancelIncidence(Incidence * inc )
2698{ 2856{
2699 inc->setCancelled( ! inc->cancelled() ); 2857 inc->setCancelled( ! inc->cancelled() );
2700 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2858 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2701 updateView(); 2859 updateView();
2702} 2860}
2703void CalendarView::cloneIncidence(Incidence * orgInc ) 2861void CalendarView::cloneIncidence(Incidence * orgInc )
2704{ 2862{
2705 Incidence * newInc = orgInc->clone(); 2863 Incidence * newInc = orgInc->clone();
2706 newInc->recreate(); 2864 newInc->recreate();
2707 2865
2708 if ( newInc->type() == "Todo" ) { 2866 if ( newInc->type() == "Todo" ) {
2709 Todo* t = (Todo*) newInc; 2867 Todo* t = (Todo*) newInc;
2710 bool cloneSub = false; 2868 bool cloneSub = false;
2711 if ( orgInc->relations().count() ) { 2869 if ( orgInc->relations().count() ) {
2712 int result = KMessageBox::warningYesNoCancel(this, 2870 int result = KMessageBox::warningYesNoCancel(this,
2713 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), 2871 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
2714 i18n("Todo has subtodos"), 2872 i18n("Todo has subtodos"),
2715 i18n("Yes"), 2873 i18n("Yes"),
2716 i18n("No")); 2874 i18n("No"));
2717 2875
2718 if ( result == KMessageBox::Cancel ) { 2876 if ( result == KMessageBox::Cancel ) {
2719 delete t; 2877 delete t;
2720 return; 2878 return;
2721 } 2879 }
2722 if (result == KMessageBox::Yes) cloneSub = true; 2880 if (result == KMessageBox::Yes) cloneSub = true;
2723 } 2881 }
2724 showTodoEditor(); 2882 showTodoEditor();
2725 mTodoEditor->editTodo( t ); 2883 mTodoEditor->editTodo( t );
2726 if ( mTodoEditor->exec() ) { 2884 if ( mTodoEditor->exec() ) {
2727 if ( cloneSub ) { 2885 if ( cloneSub ) {
2728 orgInc->cloneRelations( t ); 2886 orgInc->cloneRelations( t );
2729 mCalendar->addIncidenceBranch( t ); 2887 mCalendar->addIncidenceBranch( t );
2730 updateView(); 2888 updateView();
2731 2889
2732 } else { 2890 } else {
2733 mCalendar->addTodo( t ); 2891 mCalendar->addTodo( t );
2734 updateView(); 2892 updateView();
2735 } 2893 }
2736 } else { 2894 } else {
2737 delete t; 2895 delete t;
2738 } 2896 }
2739 } 2897 }
2740 else { 2898 else {
@@ -3156,999 +3314,1004 @@ void CalendarView::deleteEvent(Event *anEvent)
3156 } else { 3314 } else {
3157 if (KOPrefs::instance()->mConfirm) { 3315 if (KOPrefs::instance()->mConfirm) {
3158 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3316 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3159 i18n("\nAre you sure you want\nto delete this event?"), 3317 i18n("\nAre you sure you want\nto delete this event?"),
3160 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3318 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3161 case KMessageBox::Continue: // OK 3319 case KMessageBox::Continue: // OK
3162 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3320 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3163 schedule(Scheduler::Cancel,anEvent); 3321 schedule(Scheduler::Cancel,anEvent);
3164 checkExternalId( anEvent); 3322 checkExternalId( anEvent);
3165 mCalendar->deleteEvent(anEvent); 3323 mCalendar->deleteEvent(anEvent);
3166 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3324 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3167 break; 3325 break;
3168 } // switch 3326 } // switch
3169 } else { 3327 } else {
3170 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3328 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3171 schedule(Scheduler::Cancel,anEvent); 3329 schedule(Scheduler::Cancel,anEvent);
3172 checkExternalId( anEvent); 3330 checkExternalId( anEvent);
3173 mCalendar->deleteEvent(anEvent); 3331 mCalendar->deleteEvent(anEvent);
3174 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3332 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3175 } 3333 }
3176 } // if-else 3334 } // if-else
3177 emit updateSearchDialog(); 3335 emit updateSearchDialog();
3178} 3336}
3179 3337
3180bool CalendarView::deleteEvent(const QString &uid) 3338bool CalendarView::deleteEvent(const QString &uid)
3181{ 3339{
3182 Event *ev = mCalendar->event(uid); 3340 Event *ev = mCalendar->event(uid);
3183 if (ev) { 3341 if (ev) {
3184 deleteEvent(ev); 3342 deleteEvent(ev);
3185 return true; 3343 return true;
3186 } else { 3344 } else {
3187 return false; 3345 return false;
3188 } 3346 }
3189} 3347}
3190 3348
3191/*****************************************************************************/ 3349/*****************************************************************************/
3192 3350
3193void CalendarView::action_mail() 3351void CalendarView::action_mail()
3194{ 3352{
3195#ifndef KORG_NOMAIL 3353#ifndef KORG_NOMAIL
3196 KOMailClient mailClient; 3354 KOMailClient mailClient;
3197 3355
3198 Incidence *incidence = currentSelection(); 3356 Incidence *incidence = currentSelection();
3199 3357
3200 if (!incidence) { 3358 if (!incidence) {
3201 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3359 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3202 return; 3360 return;
3203 } 3361 }
3204 if(incidence->attendeeCount() == 0 ) { 3362 if(incidence->attendeeCount() == 0 ) {
3205 KMessageBox::sorry(this, 3363 KMessageBox::sorry(this,
3206 i18n("Can't generate mail:\nNo attendees defined.\n")); 3364 i18n("Can't generate mail:\nNo attendees defined.\n"));
3207 return; 3365 return;
3208 } 3366 }
3209 3367
3210 CalendarLocal cal_tmp; 3368 CalendarLocal cal_tmp;
3211 Event *event = 0; 3369 Event *event = 0;
3212 Event *ev = 0; 3370 Event *ev = 0;
3213 if ( incidence && incidence->type() == "Event" ) { 3371 if ( incidence && incidence->type() == "Event" ) {
3214 event = static_cast<Event *>(incidence); 3372 event = static_cast<Event *>(incidence);
3215 ev = new Event(*event); 3373 ev = new Event(*event);
3216 cal_tmp.addEvent(ev); 3374 cal_tmp.addEvent(ev);
3217 } 3375 }
3218 ICalFormat mForm(); 3376 ICalFormat mForm();
3219 QString attachment = mForm.toString( &cal_tmp ); 3377 QString attachment = mForm.toString( &cal_tmp );
3220 if (ev) delete(ev); 3378 if (ev) delete(ev);
3221 3379
3222 mailClient.mailAttendees(currentSelection(), attachment); 3380 mailClient.mailAttendees(currentSelection(), attachment);
3223 3381
3224#endif 3382#endif
3225 3383
3226#if 0 3384#if 0
3227 Event *anEvent = 0; 3385 Event *anEvent = 0;
3228 if (mViewManager->currentView()->isEventView()) { 3386 if (mViewManager->currentView()->isEventView()) {
3229 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3387 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3230 } 3388 }
3231 3389
3232 if (!anEvent) { 3390 if (!anEvent) {
3233 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3391 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3234 return; 3392 return;
3235 } 3393 }
3236 if(anEvent->attendeeCount() == 0 ) { 3394 if(anEvent->attendeeCount() == 0 ) {
3237 KMessageBox::sorry(this, 3395 KMessageBox::sorry(this,
3238 i18n("Can't generate mail:\nNo attendees defined.\n")); 3396 i18n("Can't generate mail:\nNo attendees defined.\n"));
3239 return; 3397 return;
3240 } 3398 }
3241 3399
3242 mailobject.emailEvent(anEvent); 3400 mailobject.emailEvent(anEvent);
3243#endif 3401#endif
3244} 3402}
3245 3403
3246 3404
3247void CalendarView::schedule_publish(Incidence *incidence) 3405void CalendarView::schedule_publish(Incidence *incidence)
3248{ 3406{
3249 Event *event = 0; 3407 Event *event = 0;
3250 Todo *todo = 0; 3408 Todo *todo = 0;
3251 3409
3252 if (incidence == 0) { 3410 if (incidence == 0) {
3253 incidence = mViewManager->currentView()->selectedIncidences().first(); 3411 incidence = mViewManager->currentView()->selectedIncidences().first();
3254 if (incidence == 0) { 3412 if (incidence == 0) {
3255 incidence = mTodoList->selectedIncidences().first(); 3413 incidence = mTodoList->selectedIncidences().first();
3256 } 3414 }
3257 } 3415 }
3258 if ( incidence && incidence->type() == "Event" ) { 3416 if ( incidence && incidence->type() == "Event" ) {
3259 event = static_cast<Event *>(incidence); 3417 event = static_cast<Event *>(incidence);
3260 } else { 3418 } else {
3261 if ( incidence && incidence->type() == "Todo" ) { 3419 if ( incidence && incidence->type() == "Todo" ) {
3262 todo = static_cast<Todo *>(incidence); 3420 todo = static_cast<Todo *>(incidence);
3263 } 3421 }
3264 } 3422 }
3265 3423
3266 if (!event && !todo) { 3424 if (!event && !todo) {
3267 KMessageBox::sorry(this,i18n("No event selected.")); 3425 KMessageBox::sorry(this,i18n("No event selected."));
3268 return; 3426 return;
3269 } 3427 }
3270 3428
3271 PublishDialog *publishdlg = new PublishDialog(); 3429 PublishDialog *publishdlg = new PublishDialog();
3272 if (incidence->attendeeCount()>0) { 3430 if (incidence->attendeeCount()>0) {
3273 QPtrList<Attendee> attendees = incidence->attendees(); 3431 QPtrList<Attendee> attendees = incidence->attendees();
3274 attendees.first(); 3432 attendees.first();
3275 while ( attendees.current()!=0 ) { 3433 while ( attendees.current()!=0 ) {
3276 publishdlg->addAttendee(attendees.current()); 3434 publishdlg->addAttendee(attendees.current());
3277 attendees.next(); 3435 attendees.next();
3278 } 3436 }
3279 } 3437 }
3280 bool send = true; 3438 bool send = true;
3281 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3439 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3282 if ( publishdlg->exec() != QDialog::Accepted ) 3440 if ( publishdlg->exec() != QDialog::Accepted )
3283 send = false; 3441 send = false;
3284 } 3442 }
3285 if ( send ) { 3443 if ( send ) {
3286 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3444 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3287 if ( event ) { 3445 if ( event ) {
3288 Event *ev = new Event(*event); 3446 Event *ev = new Event(*event);
3289 ev->registerObserver(0); 3447 ev->registerObserver(0);
3290 ev->clearAttendees(); 3448 ev->clearAttendees();
3291 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3449 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3292 delete(ev); 3450 delete(ev);
3293 } 3451 }
3294 } else { 3452 } else {
3295 if ( todo ) { 3453 if ( todo ) {
3296 Todo *ev = new Todo(*todo); 3454 Todo *ev = new Todo(*todo);
3297 ev->registerObserver(0); 3455 ev->registerObserver(0);
3298 ev->clearAttendees(); 3456 ev->clearAttendees();
3299 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3457 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3300 delete(ev); 3458 delete(ev);
3301 } 3459 }
3302 } 3460 }
3303 } 3461 }
3304 } 3462 }
3305 delete publishdlg; 3463 delete publishdlg;
3306} 3464}
3307 3465
3308void CalendarView::schedule_request(Incidence *incidence) 3466void CalendarView::schedule_request(Incidence *incidence)
3309{ 3467{
3310 schedule(Scheduler::Request,incidence); 3468 schedule(Scheduler::Request,incidence);
3311} 3469}
3312 3470
3313void CalendarView::schedule_refresh(Incidence *incidence) 3471void CalendarView::schedule_refresh(Incidence *incidence)
3314{ 3472{
3315 schedule(Scheduler::Refresh,incidence); 3473 schedule(Scheduler::Refresh,incidence);
3316} 3474}
3317 3475
3318void CalendarView::schedule_cancel(Incidence *incidence) 3476void CalendarView::schedule_cancel(Incidence *incidence)
3319{ 3477{
3320 schedule(Scheduler::Cancel,incidence); 3478 schedule(Scheduler::Cancel,incidence);
3321} 3479}
3322 3480
3323void CalendarView::schedule_add(Incidence *incidence) 3481void CalendarView::schedule_add(Incidence *incidence)
3324{ 3482{
3325 schedule(Scheduler::Add,incidence); 3483 schedule(Scheduler::Add,incidence);
3326} 3484}
3327 3485
3328void CalendarView::schedule_reply(Incidence *incidence) 3486void CalendarView::schedule_reply(Incidence *incidence)
3329{ 3487{
3330 schedule(Scheduler::Reply,incidence); 3488 schedule(Scheduler::Reply,incidence);
3331} 3489}
3332 3490
3333void CalendarView::schedule_counter(Incidence *incidence) 3491void CalendarView::schedule_counter(Incidence *incidence)
3334{ 3492{
3335 schedule(Scheduler::Counter,incidence); 3493 schedule(Scheduler::Counter,incidence);
3336} 3494}
3337 3495
3338void CalendarView::schedule_declinecounter(Incidence *incidence) 3496void CalendarView::schedule_declinecounter(Incidence *incidence)
3339{ 3497{
3340 schedule(Scheduler::Declinecounter,incidence); 3498 schedule(Scheduler::Declinecounter,incidence);
3341} 3499}
3342 3500
3343void CalendarView::schedule_publish_freebusy(int daysToPublish) 3501void CalendarView::schedule_publish_freebusy(int daysToPublish)
3344{ 3502{
3345 QDateTime start = QDateTime::currentDateTime(); 3503 QDateTime start = QDateTime::currentDateTime();
3346 QDateTime end = start.addDays(daysToPublish); 3504 QDateTime end = start.addDays(daysToPublish);
3347 3505
3348 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3506 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3349 freebusy->setOrganizer(KOPrefs::instance()->email()); 3507 freebusy->setOrganizer(KOPrefs::instance()->email());
3350 3508
3351 3509
3352 PublishDialog *publishdlg = new PublishDialog(); 3510 PublishDialog *publishdlg = new PublishDialog();
3353 if ( publishdlg->exec() == QDialog::Accepted ) { 3511 if ( publishdlg->exec() == QDialog::Accepted ) {
3354 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3512 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3355 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3513 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3356 delete(freebusy); 3514 delete(freebusy);
3357 } 3515 }
3358 } 3516 }
3359 delete publishdlg; 3517 delete publishdlg;
3360} 3518}
3361 3519
3362void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3520void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3363{ 3521{
3364 Event *event = 0; 3522 Event *event = 0;
3365 Todo *todo = 0; 3523 Todo *todo = 0;
3366 3524
3367 if (incidence == 0) { 3525 if (incidence == 0) {
3368 incidence = mViewManager->currentView()->selectedIncidences().first(); 3526 incidence = mViewManager->currentView()->selectedIncidences().first();
3369 if (incidence == 0) { 3527 if (incidence == 0) {
3370 incidence = mTodoList->selectedIncidences().first(); 3528 incidence = mTodoList->selectedIncidences().first();
3371 } 3529 }
3372 } 3530 }
3373 if ( incidence && incidence->type() == "Event" ) { 3531 if ( incidence && incidence->type() == "Event" ) {
3374 event = static_cast<Event *>(incidence); 3532 event = static_cast<Event *>(incidence);
3375 } 3533 }
3376 if ( incidence && incidence->type() == "Todo" ) { 3534 if ( incidence && incidence->type() == "Todo" ) {
3377 todo = static_cast<Todo *>(incidence); 3535 todo = static_cast<Todo *>(incidence);
3378 } 3536 }
3379 3537
3380 if (!event && !todo) { 3538 if (!event && !todo) {
3381 KMessageBox::sorry(this,i18n("No event selected.")); 3539 KMessageBox::sorry(this,i18n("No event selected."));
3382 return; 3540 return;
3383 } 3541 }
3384 3542
3385 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3543 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3386 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3544 KMessageBox::sorry(this,i18n("The event has no attendees."));
3387 return; 3545 return;
3388 } 3546 }
3389 3547
3390 Event *ev = 0; 3548 Event *ev = 0;
3391 if (event) ev = new Event(*event); 3549 if (event) ev = new Event(*event);
3392 Todo *to = 0; 3550 Todo *to = 0;
3393 if (todo) to = new Todo(*todo); 3551 if (todo) to = new Todo(*todo);
3394 3552
3395 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3553 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3396 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3554 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3397 if (!me) { 3555 if (!me) {
3398 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3556 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3399 return; 3557 return;
3400 } 3558 }
3401 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3559 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3402 StatusDialog *statdlg = new StatusDialog(this); 3560 StatusDialog *statdlg = new StatusDialog(this);
3403 if (!statdlg->exec()==QDialog::Accepted) return; 3561 if (!statdlg->exec()==QDialog::Accepted) return;
3404 me->setStatus( statdlg->status() ); 3562 me->setStatus( statdlg->status() );
3405 delete(statdlg); 3563 delete(statdlg);
3406 } 3564 }
3407 Attendee *menew = new Attendee(*me); 3565 Attendee *menew = new Attendee(*me);
3408 if (ev) { 3566 if (ev) {
3409 ev->clearAttendees(); 3567 ev->clearAttendees();
3410 ev->addAttendee(menew,false); 3568 ev->addAttendee(menew,false);
3411 } else { 3569 } else {
3412 if (to) { 3570 if (to) {
3413 todo->clearAttendees(); 3571 todo->clearAttendees();
3414 todo->addAttendee(menew,false); 3572 todo->addAttendee(menew,false);
3415 } 3573 }
3416 } 3574 }
3417 } 3575 }
3418 3576
3419 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3577 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3420 if (ev) { 3578 if (ev) {
3421 if ( !dlg->addMessage(ev,method) ) delete(ev); 3579 if ( !dlg->addMessage(ev,method) ) delete(ev);
3422 } else { 3580 } else {
3423 if (to) { 3581 if (to) {
3424 if ( !dlg->addMessage(to,method) ) delete(to); 3582 if ( !dlg->addMessage(to,method) ) delete(to);
3425 } 3583 }
3426 } 3584 }
3427} 3585}
3428 3586
3429void CalendarView::openAddressbook() 3587void CalendarView::openAddressbook()
3430{ 3588{
3431 KRun::runCommand("kaddressbook"); 3589 KRun::runCommand("kaddressbook");
3432} 3590}
3433 3591
3434void CalendarView::setModified(bool modified) 3592void CalendarView::setModified(bool modified)
3435{ 3593{
3436 if ( modified ) 3594 if ( modified )
3437 emit signalmodified(); 3595 emit signalmodified();
3438 if (mModified != modified) { 3596 if (mModified != modified) {
3439 mModified = modified; 3597 mModified = modified;
3440 emit modifiedChanged(mModified); 3598 emit modifiedChanged(mModified);
3441 } 3599 }
3442} 3600}
3443 3601
3444bool CalendarView::isReadOnly() 3602bool CalendarView::isReadOnly()
3445{ 3603{
3446 return mReadOnly; 3604 return mReadOnly;
3447} 3605}
3448 3606
3449void CalendarView::setReadOnly(bool readOnly) 3607void CalendarView::setReadOnly(bool readOnly)
3450{ 3608{
3451 if (mReadOnly != readOnly) { 3609 if (mReadOnly != readOnly) {
3452 mReadOnly = readOnly; 3610 mReadOnly = readOnly;
3453 emit readOnlyChanged(mReadOnly); 3611 emit readOnlyChanged(mReadOnly);
3454 } 3612 }
3455} 3613}
3456 3614
3457bool CalendarView::isModified() 3615bool CalendarView::isModified()
3458{ 3616{
3459 return mModified; 3617 return mModified;
3460} 3618}
3461void CalendarView::slotprintSelInc() 3619void CalendarView::slotprintSelInc()
3462{ 3620{
3463 if ( currentSelection() == 0 ) { 3621 if ( currentSelection() == 0 ) {
3464 KMessageBox::sorry(this,i18n("There is nothing selected!")); 3622 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3465 return; 3623 return;
3466 } 3624 }
3467 showIncidence(); 3625 showIncidence();
3468 getEventViewerDialog()->print(); 3626 getEventViewerDialog()->print();
3469 3627
3470} 3628}
3471void CalendarView::printSetup() 3629void CalendarView::printSetup()
3472{ 3630{
3473#ifndef KORG_NOPRINTER 3631#ifndef KORG_NOPRINTER
3474 createPrinter(); 3632 createPrinter();
3475 3633
3476 mCalPrinter->setupPrinter(); 3634 mCalPrinter->setupPrinter();
3477#endif 3635#endif
3478} 3636}
3479 3637
3480void CalendarView::print() 3638void CalendarView::print()
3481{ 3639{
3482#ifndef KORG_NOPRINTER 3640#ifndef KORG_NOPRINTER
3483 createPrinter(); 3641 createPrinter();
3484 3642
3485 DateList tmpDateList = mNavigator->selectedDates(); 3643 DateList tmpDateList = mNavigator->selectedDates();
3486 mCalPrinter->print(CalPrinter::Month, 3644 mCalPrinter->print(CalPrinter::Month,
3487 tmpDateList.first(), tmpDateList.last()); 3645 tmpDateList.first(), tmpDateList.last());
3488#endif 3646#endif
3489} 3647}
3490 3648
3491void CalendarView::printPreview() 3649void CalendarView::printPreview()
3492{ 3650{
3493#ifndef KORG_NOPRINTER 3651#ifndef KORG_NOPRINTER
3494 kdDebug() << "CalendarView::printPreview()" << endl; 3652 kdDebug() << "CalendarView::printPreview()" << endl;
3495 3653
3496 createPrinter(); 3654 createPrinter();
3497 3655
3498 DateList tmpDateList = mNavigator->selectedDates(); 3656 DateList tmpDateList = mNavigator->selectedDates();
3499 3657
3500 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3658 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3501 tmpDateList.last()); 3659 tmpDateList.last());
3502#endif 3660#endif
3503} 3661}
3504 3662
3505void CalendarView::exportICalendar() 3663void CalendarView::exportICalendar()
3506{ 3664{
3507 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3665 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3508 3666
3509 // Force correct extension 3667 // Force correct extension
3510 if (filename.right(4) != ".ics") filename += ".ics"; 3668 if (filename.right(4) != ".ics") filename += ".ics";
3511 3669
3512 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3670 FileStorage storage( mCalendar, filename, new ICalFormat() );
3513 storage.save(); 3671 storage.save();
3514} 3672}
3515 3673
3516bool CalendarView::exportVCalendar( QString filename ) 3674bool CalendarView::exportVCalendar( QString filename )
3517{ 3675{
3518 if (mCalendar->journals().count() > 0) { 3676 if (mCalendar->journals().count() > 0) {
3519 int result = KMessageBox::warningContinueCancel(this, 3677 int result = KMessageBox::warningContinueCancel(this,
3520 i18n("The journal entries can not be\nexported to a vCalendar file."), 3678 i18n("The journal entries can not be\nexported to a vCalendar file."),
3521 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3679 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3522 true); 3680 true);
3523 if (result != KMessageBox::Continue) return false; 3681 if (result != KMessageBox::Continue) return false;
3524 } 3682 }
3525 3683
3526 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3684 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3527 3685
3528 // Force correct extension 3686 // Force correct extension
3529 if (filename.right(4) != ".vcs") filename += ".vcs"; 3687 if (filename.right(4) != ".vcs") filename += ".vcs";
3530 3688
3531 FileStorage storage( mCalendar, filename, new VCalFormat ); 3689 FileStorage storage( mCalendar, filename, new VCalFormat );
3532 return storage.save(); 3690 return storage.save();
3533 3691
3534} 3692}
3535 3693
3536void CalendarView::eventUpdated(Incidence *) 3694void CalendarView::eventUpdated(Incidence *)
3537{ 3695{
3538 setModified(); 3696 setModified();
3539 // Don't call updateView here. The code, which has caused the update of the 3697 // Don't call updateView here. The code, which has caused the update of the
3540 // event is responsible for updating the view. 3698 // event is responsible for updating the view.
3541 // updateView(); 3699 // updateView();
3542} 3700}
3543 3701
3544void CalendarView::adaptNavigationUnits() 3702void CalendarView::adaptNavigationUnits()
3545{ 3703{
3546 if (mViewManager->currentView()->isEventView()) { 3704 if (mViewManager->currentView()->isEventView()) {
3547 int days = mViewManager->currentView()->currentDateCount(); 3705 int days = mViewManager->currentView()->currentDateCount();
3548 if (days == 1) { 3706 if (days == 1) {
3549 emit changeNavStringPrev(i18n("&Previous Day")); 3707 emit changeNavStringPrev(i18n("&Previous Day"));
3550 emit changeNavStringNext(i18n("&Next Day")); 3708 emit changeNavStringNext(i18n("&Next Day"));
3551 } else { 3709 } else {
3552 emit changeNavStringPrev(i18n("&Previous Week")); 3710 emit changeNavStringPrev(i18n("&Previous Week"));
3553 emit changeNavStringNext(i18n("&Next Week")); 3711 emit changeNavStringNext(i18n("&Next Week"));
3554 } 3712 }
3555 } 3713 }
3556} 3714}
3557 3715
3558void CalendarView::processMainViewSelection( Incidence *incidence ) 3716void CalendarView::processMainViewSelection( Incidence *incidence )
3559{ 3717{
3560 if ( incidence ) mTodoList->clearSelection(); 3718 if ( incidence ) mTodoList->clearSelection();
3561 processIncidenceSelection( incidence ); 3719 processIncidenceSelection( incidence );
3562} 3720}
3563 3721
3564void CalendarView::processTodoListSelection( Incidence *incidence ) 3722void CalendarView::processTodoListSelection( Incidence *incidence )
3565{ 3723{
3566 if ( incidence && mViewManager->currentView() ) { 3724 if ( incidence && mViewManager->currentView() ) {
3567 mViewManager->currentView()->clearSelection(); 3725 mViewManager->currentView()->clearSelection();
3568 } 3726 }
3569 processIncidenceSelection( incidence ); 3727 processIncidenceSelection( incidence );
3570} 3728}
3571 3729
3572void CalendarView::processIncidenceSelection( Incidence *incidence ) 3730void CalendarView::processIncidenceSelection( Incidence *incidence )
3573{ 3731{
3574 if ( incidence == mSelectedIncidence ) return; 3732 if ( incidence == mSelectedIncidence ) return;
3575 3733
3576 mSelectedIncidence = incidence; 3734 mSelectedIncidence = incidence;
3577 3735
3578 emit incidenceSelected( mSelectedIncidence ); 3736 emit incidenceSelected( mSelectedIncidence );
3579 3737
3580 if ( incidence && incidence->type() == "Event" ) { 3738 if ( incidence && incidence->type() == "Event" ) {
3581 Event *event = static_cast<Event *>( incidence ); 3739 Event *event = static_cast<Event *>( incidence );
3582 if ( event->organizer() == KOPrefs::instance()->email() ) { 3740 if ( event->organizer() == KOPrefs::instance()->email() ) {
3583 emit organizerEventsSelected( true ); 3741 emit organizerEventsSelected( true );
3584 } else { 3742 } else {
3585 emit organizerEventsSelected(false); 3743 emit organizerEventsSelected(false);
3586 } 3744 }
3587 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3745 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3588 KOPrefs::instance()->email() ) ) { 3746 KOPrefs::instance()->email() ) ) {
3589 emit groupEventsSelected( true ); 3747 emit groupEventsSelected( true );
3590 } else { 3748 } else {
3591 emit groupEventsSelected(false); 3749 emit groupEventsSelected(false);
3592 } 3750 }
3593 return; 3751 return;
3594 } else { 3752 } else {
3595 if ( incidence && incidence->type() == "Todo" ) { 3753 if ( incidence && incidence->type() == "Todo" ) {
3596 emit todoSelected( true ); 3754 emit todoSelected( true );
3597 Todo *event = static_cast<Todo *>( incidence ); 3755 Todo *event = static_cast<Todo *>( incidence );
3598 if ( event->organizer() == KOPrefs::instance()->email() ) { 3756 if ( event->organizer() == KOPrefs::instance()->email() ) {
3599 emit organizerEventsSelected( true ); 3757 emit organizerEventsSelected( true );
3600 } else { 3758 } else {
3601 emit organizerEventsSelected(false); 3759 emit organizerEventsSelected(false);
3602 } 3760 }
3603 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3761 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3604 KOPrefs::instance()->email() ) ) { 3762 KOPrefs::instance()->email() ) ) {
3605 emit groupEventsSelected( true ); 3763 emit groupEventsSelected( true );
3606 } else { 3764 } else {
3607 emit groupEventsSelected(false); 3765 emit groupEventsSelected(false);
3608 } 3766 }
3609 return; 3767 return;
3610 } else { 3768 } else {
3611 emit todoSelected( false ); 3769 emit todoSelected( false );
3612 emit organizerEventsSelected(false); 3770 emit organizerEventsSelected(false);
3613 emit groupEventsSelected(false); 3771 emit groupEventsSelected(false);
3614 } 3772 }
3615 return; 3773 return;
3616 } 3774 }
3617 3775
3618 /* if ( incidence && incidence->type() == "Todo" ) { 3776 /* if ( incidence && incidence->type() == "Todo" ) {
3619 emit todoSelected( true ); 3777 emit todoSelected( true );
3620 } else { 3778 } else {
3621 emit todoSelected( false ); 3779 emit todoSelected( false );
3622 }*/ 3780 }*/
3623} 3781}
3624 3782
3625 3783
3626void CalendarView::checkClipboard() 3784void CalendarView::checkClipboard()
3627{ 3785{
3628#ifndef KORG_NODND 3786#ifndef KORG_NODND
3629 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3787 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3630 emit pasteEnabled(true); 3788 emit pasteEnabled(true);
3631 } else { 3789 } else {
3632 emit pasteEnabled(false); 3790 emit pasteEnabled(false);
3633 } 3791 }
3634#endif 3792#endif
3635} 3793}
3636 3794
3637void CalendarView::showDates(const DateList &selectedDates) 3795void CalendarView::showDates(const DateList &selectedDates)
3638{ 3796{
3639 // kdDebug() << "CalendarView::selectDates()" << endl; 3797 // kdDebug() << "CalendarView::selectDates()" << endl;
3640 3798
3641 3799
3642 if ( !mBlockShowDates ) { 3800 if ( !mBlockShowDates ) {
3643 if ( mViewManager->currentView() ) { 3801 if ( mViewManager->currentView() ) {
3644 updateView( selectedDates.first(), selectedDates.last() ); 3802 updateView( selectedDates.first(), selectedDates.last() );
3645 } else { 3803 } else {
3646 mViewManager->showAgendaView(); 3804 mViewManager->showAgendaView();
3647 } 3805 }
3648 } 3806 }
3649 3807
3650 QDate date = selectedDates.first(); 3808 QDate date = selectedDates.first();
3651 if ( ! date.isValid() ) { 3809 if ( ! date.isValid() ) {
3652 topLevelWidget()->setCaption(""); 3810 topLevelWidget()->setCaption("");
3653 return; 3811 return;
3654 } 3812 }
3655 3813
3656 QString selDates; 3814 QString selDates;
3657 selDates = KGlobal::locale()->formatDate( date, true); 3815 selDates = KGlobal::locale()->formatDate( date, true);
3658 if (selectedDates.first() < selectedDates.last() ) 3816 if (selectedDates.first() < selectedDates.last() )
3659 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3817 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3660 else { 3818 else {
3661 QString addString; 3819 QString addString;
3662 if ( date == QDateTime::currentDateTime().date() ) 3820 if ( date == QDateTime::currentDateTime().date() )
3663 addString = i18n("Today"); 3821 addString = i18n("Today");
3664 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3822 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3665 addString = i18n("Tomorrow"); 3823 addString = i18n("Tomorrow");
3666 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3824 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3667 addString = i18n("Yesterday"); 3825 addString = i18n("Yesterday");
3668 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3826 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3669 addString = i18n("Day before yesterday"); 3827 addString = i18n("Day before yesterday");
3670 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3828 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3671 addString = i18n("Day after tomorrow"); 3829 addString = i18n("Day after tomorrow");
3672 if ( !addString.isEmpty() ) { 3830 if ( !addString.isEmpty() ) {
3673 topLevelWidget()->setCaption( addString+", " + selDates ); 3831 topLevelWidget()->setCaption( addString+", " + selDates );
3674 return; 3832 return;
3675 } 3833 }
3676 } 3834 }
3677 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3835 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3678 3836
3679} 3837}
3680 3838
3681QPtrList<CalFilter> CalendarView::filters() 3839QPtrList<CalFilter> CalendarView::filters()
3682{ 3840{
3683 return mFilters; 3841 return mFilters;
3684 3842
3685} 3843}
3686void CalendarView::editFilters() 3844void CalendarView::editFilters()
3687{ 3845{
3688 // kdDebug() << "CalendarView::editFilters()" << endl; 3846 // kdDebug() << "CalendarView::editFilters()" << endl;
3689 3847
3690 CalFilter *filter = mFilters.first(); 3848 CalFilter *filter = mFilters.first();
3691 while(filter) { 3849 while(filter) {
3692 kdDebug() << " Filter: " << filter->name() << endl; 3850 kdDebug() << " Filter: " << filter->name() << endl;
3693 filter = mFilters.next(); 3851 filter = mFilters.next();
3694 } 3852 }
3695 3853
3696 mDialogManager->showFilterEditDialog(&mFilters); 3854 mDialogManager->showFilterEditDialog(&mFilters);
3697} 3855}
3698void CalendarView::toggleFilter() 3856void CalendarView::toggleFilter()
3699{ 3857{
3700 showFilter(! mFilterView->isVisible()); 3858 showFilter(! mFilterView->isVisible());
3701} 3859}
3702 3860
3703KOFilterView *CalendarView::filterView() 3861KOFilterView *CalendarView::filterView()
3704{ 3862{
3705 return mFilterView; 3863 return mFilterView;
3706} 3864}
3707void CalendarView::selectFilter( int fil ) 3865void CalendarView::selectFilter( int fil )
3708{ 3866{
3709 mFilterView->setSelectedFilter( fil ); 3867 mFilterView->setSelectedFilter( fil );
3710} 3868}
3711void CalendarView::showFilter(bool visible) 3869void CalendarView::showFilter(bool visible)
3712{ 3870{
3713 if (visible) mFilterView->show(); 3871 if (visible) mFilterView->show();
3714 else mFilterView->hide(); 3872 else mFilterView->hide();
3715} 3873}
3716void CalendarView::toggleFilerEnabled( ) 3874void CalendarView::toggleFilerEnabled( )
3717{ 3875{
3718 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3876 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3719 if ( !mFilterView->filtersEnabled() ) 3877 if ( !mFilterView->filtersEnabled() )
3720 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3878 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3721 3879
3722} 3880}
3723void CalendarView::updateFilter() 3881void CalendarView::updateFilter()
3724{ 3882{
3725 CalFilter *filter = mFilterView->selectedFilter(); 3883 CalFilter *filter = mFilterView->selectedFilter();
3726 if (filter) { 3884 if (filter) {
3727 QString mess; 3885 QString mess;
3728 if (mFilterView->filtersEnabled()) { 3886 if (mFilterView->filtersEnabled()) {
3729 mess = i18n("Filter selected: ")+filter->name(); 3887 mess = i18n("Filter selected: ")+filter->name();
3730 filter->setEnabled(true); 3888 filter->setEnabled(true);
3731 } 3889 }
3732 else filter->setEnabled(false); 3890 else filter->setEnabled(false);
3733 mCalendar->setFilter(filter); 3891 mCalendar->setFilter(filter);
3734 updateView(); 3892 updateView();
3735 if ( !mess.isEmpty() ) 3893 if ( !mess.isEmpty() )
3736 topLevelWidget()->setCaption( mess ); 3894 topLevelWidget()->setCaption( mess );
3737 3895
3738 } 3896 }
3739} 3897}
3740 3898
3741void CalendarView::filterEdited() 3899void CalendarView::filterEdited()
3742{ 3900{
3743 mFilterView->updateFilters(); 3901 mFilterView->updateFilters();
3744 updateFilter(); 3902 updateFilter();
3745 writeSettings(); 3903 writeSettings();
3746} 3904}
3747 3905
3748 3906
3749void CalendarView::takeOverEvent() 3907void CalendarView::takeOverEvent()
3750{ 3908{
3751 Incidence *incidence = currentSelection(); 3909 Incidence *incidence = currentSelection();
3752 3910
3753 if (!incidence) return; 3911 if (!incidence) return;
3754 3912
3755 incidence->setOrganizer(KOPrefs::instance()->email()); 3913 incidence->setOrganizer(KOPrefs::instance()->email());
3756 incidence->recreate(); 3914 incidence->recreate();
3757 incidence->setReadOnly(false); 3915 incidence->setReadOnly(false);
3758 3916
3759 updateView(); 3917 updateView();
3760} 3918}
3761 3919
3762void CalendarView::takeOverCalendar() 3920void CalendarView::takeOverCalendar()
3763{ 3921{
3764 // TODO: Create Calendar::allIncidences() function and use it here 3922 // TODO: Create Calendar::allIncidences() function and use it here
3765 3923
3766 QPtrList<Event> events = mCalendar->events(); 3924 QPtrList<Event> events = mCalendar->events();
3767 for(uint i=0; i<events.count(); ++i) { 3925 for(uint i=0; i<events.count(); ++i) {
3768 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3926 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3769 events.at(i)->recreate(); 3927 events.at(i)->recreate();
3770 events.at(i)->setReadOnly(false); 3928 events.at(i)->setReadOnly(false);
3771 } 3929 }
3772 3930
3773 QPtrList<Todo> todos = mCalendar->todos(); 3931 QPtrList<Todo> todos = mCalendar->todos();
3774 for(uint i=0; i<todos.count(); ++i) { 3932 for(uint i=0; i<todos.count(); ++i) {
3775 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3933 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3776 todos.at(i)->recreate(); 3934 todos.at(i)->recreate();
3777 todos.at(i)->setReadOnly(false); 3935 todos.at(i)->setReadOnly(false);
3778 } 3936 }
3779 3937
3780 QPtrList<Journal> journals = mCalendar->journals(); 3938 QPtrList<Journal> journals = mCalendar->journals();
3781 for(uint i=0; i<journals.count(); ++i) { 3939 for(uint i=0; i<journals.count(); ++i) {
3782 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3940 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3783 journals.at(i)->recreate(); 3941 journals.at(i)->recreate();
3784 journals.at(i)->setReadOnly(false); 3942 journals.at(i)->setReadOnly(false);
3785 } 3943 }
3786 3944
3787 updateView(); 3945 updateView();
3788} 3946}
3789 3947
3790void CalendarView::showIntro() 3948void CalendarView::showIntro()
3791{ 3949{
3792 kdDebug() << "To be implemented." << endl; 3950 kdDebug() << "To be implemented." << endl;
3793} 3951}
3794 3952
3795QWidgetStack *CalendarView::viewStack() 3953QWidgetStack *CalendarView::viewStack()
3796{ 3954{
3797 return mRightFrame; 3955 return mRightFrame;
3798} 3956}
3799 3957
3800QWidget *CalendarView::leftFrame() 3958QWidget *CalendarView::leftFrame()
3801{ 3959{
3802 return ( QWidget *)mLeftFrame; 3960 return ( QWidget *)mLeftFrame;
3803} 3961}
3804 3962
3805DateNavigator *CalendarView::dateNavigator() 3963DateNavigator *CalendarView::dateNavigator()
3806{ 3964{
3807 return mNavigator; 3965 return mNavigator;
3808} 3966}
3809 3967
3810KDateNavigator* CalendarView::dateNavigatorWidget() 3968KDateNavigator* CalendarView::dateNavigatorWidget()
3811{ 3969{
3812 return mDateNavigator->navigatorView(); 3970 return mDateNavigator->navigatorView();
3813} 3971}
3814void CalendarView::toggleDateNavigatorWidget() 3972void CalendarView::toggleDateNavigatorWidget()
3815{ 3973{
3816 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3974 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3817 3975
3818 if (!KOPrefs::instance()->mShowDateNavigator ) 3976 if (!KOPrefs::instance()->mShowDateNavigator )
3819 mDateNavigator->hide(); 3977 mDateNavigator->hide();
3820 else 3978 else
3821 mDateNavigator->show(); 3979 mDateNavigator->show();
3822} 3980}
3823void CalendarView::addView(KOrg::BaseView *view) 3981void CalendarView::addView(KOrg::BaseView *view)
3824{ 3982{
3825 mViewManager->addView(view); 3983 mViewManager->addView(view);
3826} 3984}
3827 3985
3828void CalendarView::showView(KOrg::BaseView *view) 3986void CalendarView::showView(KOrg::BaseView *view)
3829{ 3987{
3830 mViewManager->showView(view, mLeftFrame->isVisible()); 3988 mViewManager->showView(view, mLeftFrame->isVisible());
3831} 3989}
3832 3990
3833Incidence *CalendarView::currentSelection() 3991Incidence *CalendarView::currentSelection()
3834{ 3992{
3835 return mViewManager->currentSelection(); 3993 return mViewManager->currentSelection();
3836} 3994}
3837void CalendarView::toggleAllDaySize() 3995void CalendarView::toggleAllDaySize()
3838{ 3996{
3839 /* 3997 /*
3840 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3998 if ( KOPrefs::instance()->mAllDaySize > 47 )
3841 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3999 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3842 else 4000 else
3843 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4001 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3844 */ 4002 */
3845 viewManager()->agendaView()->toggleAllDay(); 4003 viewManager()->agendaView()->toggleAllDay();
3846} 4004}
3847void CalendarView::toggleExpand() 4005void CalendarView::toggleExpand()
3848{ 4006{
3849 // if ( mLeftFrame->isHidden() ) { 4007 // if ( mLeftFrame->isHidden() ) {
3850 // mLeftFrame->show(); 4008 // mLeftFrame->show();
3851 // emit calendarViewExpanded( false ); 4009 // emit calendarViewExpanded( false );
3852 // } else { 4010 // } else {
3853 // mLeftFrame->hide(); 4011 // mLeftFrame->hide();
3854 // emit calendarViewExpanded( true ); 4012 // emit calendarViewExpanded( true );
3855 // } 4013 // }
3856 //qDebug(" CalendarView::toggleExpand()"); 4014 //qDebug(" CalendarView::toggleExpand()");
3857 globalFlagBlockAgenda = 1; 4015 globalFlagBlockAgenda = 1;
3858 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4016 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3859 globalFlagBlockAgenda = 5; 4017 globalFlagBlockAgenda = 5;
3860 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4018 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3861 //mViewManager->showView( 0, true ); 4019 //mViewManager->showView( 0, true );
3862} 4020}
3863 4021
3864void CalendarView::calendarModified( bool modified, Calendar * ) 4022void CalendarView::calendarModified( bool modified, Calendar * )
3865{ 4023{
3866 setModified( modified ); 4024 setModified( modified );
3867} 4025}
3868 4026
3869Todo *CalendarView::selectedTodo() 4027Todo *CalendarView::selectedTodo()
3870{ 4028{
3871 Incidence *incidence = currentSelection(); 4029 Incidence *incidence = currentSelection();
3872 if ( incidence && incidence->type() == "Todo" ) { 4030 if ( incidence && incidence->type() == "Todo" ) {
3873 return static_cast<Todo *>( incidence ); 4031 return static_cast<Todo *>( incidence );
3874 } 4032 }
3875 4033
3876 incidence = mTodoList->selectedIncidences().first(); 4034 incidence = mTodoList->selectedIncidences().first();
3877 if ( incidence && incidence->type() == "Todo" ) { 4035 if ( incidence && incidence->type() == "Todo" ) {
3878 return static_cast<Todo *>( incidence ); 4036 return static_cast<Todo *>( incidence );
3879 } 4037 }
3880 4038
3881 return 0; 4039 return 0;
3882} 4040}
3883 4041
3884void CalendarView::dialogClosing(Incidence *in) 4042void CalendarView::dialogClosing(Incidence *in)
3885{ 4043{
3886 // mDialogList.remove(in); 4044 // mDialogList.remove(in);
3887} 4045}
3888 4046
3889void CalendarView::showIncidence() 4047void CalendarView::showIncidence()
3890{ 4048{
3891 mViewerCallerIsSearchDialog = false; 4049 mViewerCallerIsSearchDialog = false;
3892 Incidence *incidence = currentSelection(); 4050 Incidence *incidence = currentSelection();
3893 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4051 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3894 if ( incidence ) { 4052 if ( incidence ) {
3895 ShowIncidenceVisitor v; 4053 ShowIncidenceVisitor v;
3896 v.act( incidence, this ); 4054 v.act( incidence, this );
3897 } 4055 }
3898} 4056}
3899void CalendarView::editIncidenceDescription() 4057void CalendarView::editIncidenceDescription()
3900{ 4058{
3901 mFlagEditDescription = true; 4059 mFlagEditDescription = true;
3902 editIncidence(); 4060 editIncidence();
3903 mFlagEditDescription = false; 4061 mFlagEditDescription = false;
3904} 4062}
3905void CalendarView::editIncidence() 4063void CalendarView::editIncidence()
3906{ 4064{
3907 // qDebug("editIncidence() "); 4065 // qDebug("editIncidence() ");
3908 Incidence *incidence = currentSelection(); 4066 Incidence *incidence = currentSelection();
3909 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4067 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3910 if ( incidence ) { 4068 if ( incidence ) {
3911 EditIncidenceVisitor v; 4069 EditIncidenceVisitor v;
3912 v.act( incidence, this ); 4070 v.act( incidence, this );
3913 } 4071 }
3914} 4072}
3915 4073
3916void CalendarView::deleteIncidence() 4074void CalendarView::deleteIncidence()
3917{ 4075{
3918 Incidence *incidence = currentSelection(); 4076 Incidence *incidence = currentSelection();
3919 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4077 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3920 if ( incidence ) { 4078 if ( incidence ) {
3921 deleteIncidence(incidence); 4079 deleteIncidence(incidence);
3922 } 4080 }
3923} 4081}
3924 4082void CalendarView::showIncidence(QString uid)
4083{
4084 Incidence *inc = mCalendar->incidence( uid );
4085 if ( inc )
4086 showIncidence( inc );
4087}
3925void CalendarView::showIncidence(Incidence *incidence) 4088void CalendarView::showIncidence(Incidence *incidence)
3926{ 4089{
3927 mViewerCallerIsSearchDialog = false; 4090 mViewerCallerIsSearchDialog = false;
3928 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4091 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
3929 if ( sender() && mDialogManager->getSearchDialog() ) { 4092 if ( sender() && mDialogManager->getSearchDialog() ) {
3930 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4093 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
3931 mViewerCallerIsSearchDialog = true; 4094 mViewerCallerIsSearchDialog = true;
3932 } 4095 }
3933 } 4096 }
3934 if ( incidence ) { 4097 if ( incidence ) {
3935 ShowIncidenceVisitor v; 4098 ShowIncidenceVisitor v;
3936 v.act( incidence, this ); 4099 v.act( incidence, this );
3937 } 4100 }
3938} 4101}
3939 4102
3940void CalendarView::editIncidence(Incidence *incidence) 4103void CalendarView::editIncidence(Incidence *incidence)
3941{ 4104{
3942 if ( incidence ) { 4105 if ( incidence ) {
3943 4106
3944 EditIncidenceVisitor v; 4107 EditIncidenceVisitor v;
3945 v.act( incidence, this ); 4108 v.act( incidence, this );
3946 4109
3947 } 4110 }
3948} 4111}
3949 4112
3950void CalendarView::deleteIncidence(Incidence *incidence) 4113void CalendarView::deleteIncidence(Incidence *incidence)
3951{ 4114{
3952 //qDebug(" CalendarView::deleteIncidence "); 4115 //qDebug(" CalendarView::deleteIncidence ");
3953 if ( incidence ) { 4116 if ( incidence ) {
3954 DeleteIncidenceVisitor v; 4117 DeleteIncidenceVisitor v;
3955 v.act( incidence, this ); 4118 v.act( incidence, this );
3956 } 4119 }
3957} 4120}
3958 4121
3959 4122
3960void CalendarView::lookForOutgoingMessages() 4123void CalendarView::lookForOutgoingMessages()
3961{ 4124{
3962 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4125 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3963 ogd->loadMessages(); 4126 ogd->loadMessages();
3964} 4127}
3965 4128
3966void CalendarView::lookForIncomingMessages() 4129void CalendarView::lookForIncomingMessages()
3967{ 4130{
3968 IncomingDialog *icd = mDialogManager->incomingDialog(); 4131 IncomingDialog *icd = mDialogManager->incomingDialog();
3969 icd->retrieve(); 4132 icd->retrieve();
3970} 4133}
3971 4134
3972bool CalendarView::removeCompletedSubTodos( Todo* t ) 4135bool CalendarView::removeCompletedSubTodos( Todo* t )
3973{ 4136{
3974 bool deleteTodo = true; 4137 bool deleteTodo = true;
3975 QPtrList<Incidence> subTodos; 4138 QPtrList<Incidence> subTodos;
3976 Incidence *aTodo; 4139 Incidence *aTodo;
3977 subTodos = t->relations(); 4140 subTodos = t->relations();
3978 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4141 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3979 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4142 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3980 deleteTodo = false; 4143 deleteTodo = false;
3981 } 4144 }
3982 if ( deleteTodo ) { 4145 if ( deleteTodo ) {
3983 if ( t->isCompleted() && !t->doesRecur()) { 4146 if ( t->isCompleted() && !t->doesRecur()) {
3984 checkExternalId( t ); 4147 checkExternalId( t );
3985 mCalendar->deleteTodo( t ); 4148 mCalendar->deleteTodo( t );
3986 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4149 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3987 } 4150 }
3988 else 4151 else
3989 deleteTodo = false; 4152 deleteTodo = false;
3990 } 4153 }
3991 return deleteTodo; 4154 return deleteTodo;
3992 4155
3993} 4156}
3994void CalendarView::purgeCompleted() 4157void CalendarView::purgeCompleted()
3995{ 4158{
3996 int result = KMessageBox::warningContinueCancel(this, 4159 int result = KMessageBox::warningContinueCancel(this,
3997 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4160 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
3998 4161
3999 if (result == KMessageBox::Continue) { 4162 if (result == KMessageBox::Continue) {
4000 4163
4001 QPtrList<Todo> todoCal; 4164 QPtrList<Todo> todoCal;
4002 QPtrList<Todo> rootTodos; 4165 QPtrList<Todo> rootTodos;
4003 //QPtrList<Incidence> rel; 4166 //QPtrList<Incidence> rel;
4004 Todo *aTodo;//, *rTodo; 4167 Todo *aTodo;//, *rTodo;
4005 Incidence *rIncidence; 4168 Incidence *rIncidence;
4006 bool childDelete = false; 4169 bool childDelete = false;
4007 bool deletedOne = true; 4170 bool deletedOne = true;
4008 todoCal = calendar()->todos(); 4171 todoCal = calendar()->todos();
4009 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4172 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4010 if ( !aTodo->relatedTo() ) 4173 if ( !aTodo->relatedTo() )
4011 rootTodos.append( aTodo ); 4174 rootTodos.append( aTodo );
4012 } 4175 }
4013 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4176 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4014 removeCompletedSubTodos( aTodo ); 4177 removeCompletedSubTodos( aTodo );
4015 } 4178 }
4016 4179
4017 updateView(); 4180 updateView();
4018 } 4181 }
4019} 4182}
4020 4183
4021void CalendarView::slotCalendarChanged() 4184void CalendarView::slotCalendarChanged()
4022{ 4185{
4023 ; 4186 ;
4024} 4187}
4025 4188
4026void CalendarView::keyPressEvent ( QKeyEvent *e) 4189void CalendarView::keyPressEvent ( QKeyEvent *e)
4027{ 4190{
4028 //qDebug(" alendarView::keyPressEvent "); 4191 //qDebug(" alendarView::keyPressEvent ");
4029 e->ignore(); 4192 e->ignore();
4030} 4193}
4031 4194
4032 4195
4033bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4196bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4034{ 4197{
4035 // mSyncManager = manager; 4198 // mSyncManager = manager;
4036 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4199 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4037 qDebug("KO: SyncKDE request detected!"); 4200 qDebug("KO: SyncKDE request detected!");
4038 } 4201 }
4039 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4202 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4040 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4203 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4041 return syncCalendar( filename, mode ); 4204 return syncCalendar( filename, mode );
4042} 4205}
4043bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4206bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4044{ 4207{
4045 //mSyncManager = manager; 4208 //mSyncManager = manager;
4046 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4209 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4047 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4210 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4048 if ( resource == "sharp" ) 4211 if ( resource == "sharp" )
4049 syncExternal( 0 ); 4212 syncExternal( 0 );
4050 if ( resource == "phone" ) 4213 if ( resource == "phone" )
4051 syncExternal( 1 ); 4214 syncExternal( 1 );
4052 // pending setmodified 4215 // pending setmodified
4053 return true; 4216 return true;
4054} 4217}
4055void CalendarView::setSyncManager(KSyncManager* manager) 4218void CalendarView::setSyncManager(KSyncManager* manager)
4056{ 4219{
4057 mSyncManager = manager; 4220 mSyncManager = manager;
4058} 4221}
4059 4222
4060void CalendarView::removeSyncInfo( QString syncProfile) 4223void CalendarView::removeSyncInfo( QString syncProfile)
4061{ 4224{
4062 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4225 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4063 mCalendar->removeSyncInfo( syncProfile ); 4226 mCalendar->removeSyncInfo( syncProfile );
4064 4227
4065} 4228}
4066 4229
4067void CalendarView::undo_delete() 4230void CalendarView::undo_delete()
4068{ 4231{
4069 //qDebug("undo_delete() "); 4232 //qDebug("undo_delete() ");
4070 Incidence* undo = mCalendar->undoIncidence(); 4233 Incidence* undo = mCalendar->undoIncidence();
4071 if ( !undo ) { 4234 if ( !undo ) {
4072 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4235 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4073 i18n("KO/Pi")); 4236 i18n("KO/Pi"));
4074 return; 4237 return;
4075 } 4238 }
4076 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4239 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4077 i18n("\nAre you sure you want\nto restore this?"), 4240 i18n("\nAre you sure you want\nto restore this?"),
4078 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4241 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4079 mCalendar->undoDeleteIncidence(); 4242 mCalendar->undoDeleteIncidence();
4080 updateView(); 4243 updateView();
4081 } 4244 }
4082} 4245}
4083 4246
4084void CalendarView::slotViewerClosed() 4247void CalendarView::slotViewerClosed()
4085{ 4248{
4086 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4249 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4087} 4250}
4088 4251
4089void CalendarView::resetFocus() 4252void CalendarView::resetFocus()
4090{ 4253{
4091 if ( mViewerCallerIsSearchDialog ) { 4254 if ( mViewerCallerIsSearchDialog ) {
4092 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4255 if ( mDialogManager->getSearchDialog()->isVisible() ){
4093 mDialogManager->getSearchDialog()->raise(); 4256 mDialogManager->getSearchDialog()->raise();
4094 mDialogManager->getSearchDialog()->setActiveWindow(); 4257 mDialogManager->getSearchDialog()->setActiveWindow();
4095 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4258 mDialogManager->getSearchDialog()->listview()->resetFocus();
4096 } else 4259 } else
4097 mViewerCallerIsSearchDialog = false; 4260 mViewerCallerIsSearchDialog = false;
4098 } 4261 }
4099 if ( !mViewerCallerIsSearchDialog ) { 4262 if ( !mViewerCallerIsSearchDialog ) {
4100 //mViewManager->currentView()->setFocus(); 4263 //mViewManager->currentView()->setFocus();
4101 //qDebug("sssssssssssssssset focus "); 4264 //qDebug("sssssssssssssssset focus ");
4102 topLevelWidget()->raise(); 4265 topLevelWidget()->raise();
4103 setActiveWindow(); 4266 setActiveWindow();
4104 //setFocus(); 4267 //setFocus();
4105 } 4268 }
4106 mViewerCallerIsSearchDialog = false; 4269 mViewerCallerIsSearchDialog = false;
4107} 4270}
4108 4271
4109void CalendarView::showNextAlarms() 4272void CalendarView::showNextAlarms()
4110{ 4273{
4111 QString message; 4274 QString message;
4112 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4275 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4113 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4276 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4114 QString sum = mCalendar->nextSummary(); 4277 QString sum = mCalendar->nextSummary();
4115 QDateTime nextA = mNextAlarmDateTime; 4278 QDateTime nextA = mNextAlarmDateTime;
4116 QDateTime cur = QDateTime::currentDateTime(); 4279 QDateTime cur = QDateTime::currentDateTime();
4117 int secs = cur.secsTo( nextA ); 4280 int secs = cur.secsTo( nextA );
4118 int min = secs /60; 4281 int min = secs /60;
4119 int hours = min /60; 4282 int hours = min /60;
4120 min = min % 60; 4283 min = min % 60;
4121 int days = hours /24; 4284 int days = hours /24;
4122 hours = hours % 24; 4285 hours = hours % 24;
4123 4286
4124 //message = i18n("The next alarm is in:\n"); 4287 //message = i18n("The next alarm is in:\n");
4125 if ( days > 1 ) 4288 if ( days > 1 )
4126 message += i18n("%1 days\n").arg( days ); 4289 message += i18n("%1 days\n").arg( days );
4127 else if ( days == 1 ) 4290 else if ( days == 1 )
4128 message += i18n("1 day\n"); 4291 message += i18n("1 day\n");
4129 if ( hours > 1 ) 4292 if ( hours > 1 )
4130 message += i18n("%1 hours\n").arg( hours ); 4293 message += i18n("%1 hours\n").arg( hours );
4131 else if ( hours == 1 ) 4294 else if ( hours == 1 )
4132 message += i18n("1 hour\n"); 4295 message += i18n("1 hour\n");
4133 if ( min > 1 ) 4296 if ( min > 1 )
4134 message += i18n("%1 minutes\n").arg( min ); 4297 message += i18n("%1 minutes\n").arg( min );
4135 else if ( min == 1 ) 4298 else if ( min == 1 )
4136 message += i18n("1 minute\n"); 4299 message += i18n("1 minute\n");
4137 if ( message.isEmpty() ) 4300 if ( message.isEmpty() )
4138 message = i18n("The next alarm is in\nless than one minute!"); 4301 message = i18n("The next alarm is in\nless than one minute!");
4139 else 4302 else
4140 message = i18n("The next alarm is in:\n") + message; 4303 message = i18n("The next alarm is in:\n") + message;
4141 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4304 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4142 } else { 4305 } else {
4143 message = i18n("There is no next alarm."); 4306 message = i18n("There is no next alarm.");
4144 4307
4145 } 4308 }
4146#ifdef DESKTOP_VERSION 4309#ifdef DESKTOP_VERSION
4147 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4310 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4148 message += i18n("\nThe internal alarm notification is disabled!\n"); 4311 message += i18n("\nThe internal alarm notification is disabled!\n");
4149 message += i18n("Enable it in the settings menu, TAB alarm."); 4312 message += i18n("Enable it in the settings menu, TAB alarm.");
4150 } 4313 }
4151 4314
4152#endif 4315#endif
4153 KMessageBox::information( this, message); 4316 KMessageBox::information( this, message);
4154} 4317}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 05a34b4..1eca905 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,620 +1,640 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h> 42#include <KDGanttMinimizeSplitter.h>
43 43
44#include <korganizer/calendarviewbase.h> 44#include <korganizer/calendarviewbase.h>
45 45
46#include <ksyncmanager.h> 46#include <ksyncmanager.h>
47 47
48class QWidgetStack; 48class QWidgetStack;
49class QSplitter; 49class QSplitter;
50 50
51class CalPrinter; 51class CalPrinter;
52class KOFilterView; 52class KOFilterView;
53class KOViewManager; 53class KOViewManager;
54class KODialogManager; 54class KODialogManager;
55class KOTodoView; 55class KOTodoView;
56class KDateNavigator; 56class KDateNavigator;
57class DateNavigatorContainer; 57class DateNavigatorContainer;
58class DateNavigator; 58class DateNavigator;
59class KOIncidenceEditor; 59class KOIncidenceEditor;
60class KDatePicker; 60class KDatePicker;
61class ResourceView; 61class ResourceView;
62class KOEventEditor; 62class KOEventEditor;
63class KOTodoEditor ; 63class KOTodoEditor ;
64class KOEventViewerDialog; 64class KOEventViewerDialog;
65class KOBeamPrefs; 65class KOBeamPrefs;
66class KSyncProfile; 66class KSyncProfile;
67class AlarmDialog; 67class AlarmDialog;
68class KCal::Attendee; 68class KCal::Attendee;
69 69
70namespace KCal { class FileStorage; } 70namespace KCal { class FileStorage; }
71 71
72using namespace KCal; 72using namespace KCal;
73 73
74/** 74/**
75 This is the main calendar widget. It provides the different vies on t he 75 This is the main calendar widget. It provides the different vies on t he
76 calendar data as well as the date navigator. It also handles synchronisation 76 calendar data as well as the date navigator. It also handles synchronisation
77 of the different views and controls the different dialogs like preferences, 77 of the different views and controls the different dialogs like preferences,
78 event editor, search dialog etc. 78 event editor, search dialog etc.
79 79
80 @short main calendar view widget 80 @short main calendar view widget
81 @author Cornelius Schumacher 81 @author Cornelius Schumacher
82*/ 82*/
83
84#include <qtextbrowser.h>
85#include <qtextcodec.h>
86
87class MissedAlarmTextBrowser : public QTextBrowser {
88 Q_OBJECT
89 public:
90 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
91 void setSource(const QString & n);
92
93 private:
94 Incidence * getNextInc(QDateTime start );
95 QPtrList<Incidence> mAlarms;
96 signals:
97 void showIncidence( QString uid);
98};
99
100
83class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 101class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
84{ 102{
85 Q_OBJECT 103 Q_OBJECT
86 public: 104 public:
87 /** 105 /**
88 Constructs a new calendar view widget. 106 Constructs a new calendar view widget.
89 107
90 @param calendar calendar document 108 @param calendar calendar document
91 @param parent parent window 109 @param parent parent window
92 @param name Qt internal widget object name 110 @param name Qt internal widget object name
93 */ 111 */
94 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 112 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
95 const char *name = 0 ); 113 const char *name = 0 );
96 CalendarView( Calendar *calendar, QWidget *parent = 0, 114 CalendarView( Calendar *calendar, QWidget *parent = 0,
97 const char *name = 0 ); 115 const char *name = 0 );
98 virtual ~CalendarView(); 116 virtual ~CalendarView();
99 117
100 Calendar *calendar() { return mCalendar; } 118 Calendar *calendar() { return mCalendar; }
101 119
102 KOViewManager *viewManager(); 120 KOViewManager *viewManager();
103 KODialogManager *dialogManager(); 121 KODialogManager *dialogManager();
104 122
105 QDate startDate(); 123 QDate startDate();
106 QDate endDate(); 124 QDate endDate();
107 125
108 QWidgetStack *viewStack(); 126 QWidgetStack *viewStack();
109 QWidget *leftFrame(); 127 QWidget *leftFrame();
110 128
111 DateNavigator *dateNavigator(); 129 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 130 KDateNavigator *dateNavigatorWidget();
113 131
114 void addView(KOrg::BaseView *); 132 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 133 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 134 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 135 Incidence *currentSelection();
118 136
119 signals: 137 signals:
120 void save (); 138 void save ();
121 void saveStopTimer (); 139 void saveStopTimer ();
122 void tempDisableBR(bool); 140 void tempDisableBR(bool);
123 /** This todo has been modified */ 141 /** This todo has been modified */
124 void todoModified(Todo *, int); 142 void todoModified(Todo *, int);
125 143
126 /** when change is made to options dialog, the topwidget will catch this 144 /** when change is made to options dialog, the topwidget will catch this
127 * and emit this signal which notifies all widgets which have registered 145 * and emit this signal which notifies all widgets which have registered
128 * for notification to update their settings. */ 146 * for notification to update their settings. */
129 void configChanged(); 147 void configChanged();
130 /** emitted when the topwidget is closing down, so that any attached 148 /** emitted when the topwidget is closing down, so that any attached
131 child windows can also close. */ 149 child windows can also close. */
132 void closingDown(); 150 void closingDown();
133 /** emitted right before we die */ 151 /** emitted right before we die */
134 void closed(QWidget *); 152 void closed(QWidget *);
135 153
136 /** Emitted when state of modified flag changes */ 154 /** Emitted when state of modified flag changes */
137 void modifiedChanged(bool); 155 void modifiedChanged(bool);
138 void signalmodified(); 156 void signalmodified();
139 157
140 /** Emitted when state of read-only flag changes */ 158 /** Emitted when state of read-only flag changes */
141 void readOnlyChanged(bool); 159 void readOnlyChanged(bool);
142 160
143 /** Emitted when the unit of navigation changes */ 161 /** Emitted when the unit of navigation changes */
144 void changeNavStringPrev(const QString &); 162 void changeNavStringPrev(const QString &);
145 void changeNavStringNext(const QString &); 163 void changeNavStringNext(const QString &);
146 164
147 /** Emitted when state of events selection has changed and user is organizer*/ 165 /** Emitted when state of events selection has changed and user is organizer*/
148 void organizerEventsSelected(bool); 166 void organizerEventsSelected(bool);
149 /** Emitted when state of events selection has changed and user is attendee*/ 167 /** Emitted when state of events selection has changed and user is attendee*/
150 void groupEventsSelected(bool); 168 void groupEventsSelected(bool);
151 /** 169 /**
152 Emitted when an incidence gets selected. If the selection is cleared the 170 Emitted when an incidence gets selected. If the selection is cleared the
153 signal is emitted with 0 as argument. 171 signal is emitted with 0 as argument.
154 */ 172 */
155 void incidenceSelected( Incidence * ); 173 void incidenceSelected( Incidence * );
156 /** Emitted, when a todoitem is selected or deselected. */ 174 /** Emitted, when a todoitem is selected or deselected. */
157 void todoSelected( bool ); 175 void todoSelected( bool );
158 176
159 /** 177 /**
160 Emitted, when clipboard content changes. Parameter indicates if paste 178 Emitted, when clipboard content changes. Parameter indicates if paste
161 is possible or not. 179 is possible or not.
162 */ 180 */
163 void pasteEnabled(bool); 181 void pasteEnabled(bool);
164 182
165 /** Emitted, when the number of incoming messages has changed. */ 183 /** Emitted, when the number of incoming messages has changed. */
166 void numIncomingChanged(int); 184 void numIncomingChanged(int);
167 185
168 /** Emitted, when the number of outgoing messages has changed. */ 186 /** Emitted, when the number of outgoing messages has changed. */
169 void numOutgoingChanged(int); 187 void numOutgoingChanged(int);
170 188
171 /** Send status message, which can e.g. be displayed in the status bar. */ 189 /** Send status message, which can e.g. be displayed in the status bar. */
172 void statusMessage(const QString &); 190 void statusMessage(const QString &);
173 191
174 void calendarViewExpanded( bool ); 192 void calendarViewExpanded( bool );
175 void updateSearchDialog(); 193 void updateSearchDialog();
176 194
177 195
178 public slots: 196 public slots:
197 void checkAlarms();
179 void slotprintSelInc(); 198 void slotprintSelInc();
180 void showNextAlarms(); 199 void showNextAlarms();
181 void showOpenError(); 200 void showOpenError();
182 void watchSavedFile(); 201 void watchSavedFile();
183 void recheckTimerAlarm(); 202 void recheckTimerAlarm();
184 void checkNextTimerAlarm(); 203 void checkNextTimerAlarm();
185 void addAlarm(const QDateTime &qdt, const QString &noti ); 204 void addAlarm(const QDateTime &qdt, const QString &noti );
186 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 205 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
187 void removeAlarm(const QDateTime &qdt, const QString &noti ); 206 void removeAlarm(const QDateTime &qdt, const QString &noti );
188 207
189 /** options dialog made a changed to the configuration. we catch this 208 /** options dialog made a changed to the configuration. we catch this
190 * and notify all widgets which need to update their configuration. */ 209 * and notify all widgets which need to update their configuration. */
191 void updateConfig(); 210 void updateConfig();
192 211
193 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 212 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
194 const QStringList& anniversaryList, const QStringList& realNameList, 213 const QStringList& anniversaryList, const QStringList& realNameList,
195 const QStringList& emailList, const QStringList& assembledNameList, 214 const QStringList& emailList, const QStringList& assembledNameList,
196 const QStringList& uidList); 215 const QStringList& uidList);
197 216
198 /** 217 /**
199 Load calendar from file \a filename. If \a merge is true, load 218 Load calendar from file \a filename. If \a merge is true, load
200 calendar into existing one, if it is false, clear calendar, before 219 calendar into existing one, if it is false, clear calendar, before
201 loading. Return true, if calendar could be successfully loaded. 220 loading. Return true, if calendar could be successfully loaded.
202 */ 221 */
203 bool openCalendar(QString filename, bool merge=false); 222 bool openCalendar(QString filename, bool merge=false);
204 bool syncCalendar(QString filename,int mode = 0 ); 223 bool syncCalendar(QString filename,int mode = 0 );
205 224
206 /** 225 /**
207 Save calendar data to file. Return true if calendar could be 226 Save calendar data to file. Return true if calendar could be
208 successfully saved. 227 successfully saved.
209 */ 228 */
210 bool saveCalendar(QString filename); 229 bool saveCalendar(QString filename);
211 230
212 /** 231 /**
213 Close calendar. Clear calendar data and reset views to display an empty 232 Close calendar. Clear calendar data and reset views to display an empty
214 calendar. 233 calendar.
215 */ 234 */
216 void closeCalendar(); 235 void closeCalendar();
217 236
218 /** Archive old events of calendar */ 237 /** Archive old events of calendar */
219 void archiveCalendar(); 238 void archiveCalendar();
220 239
221 void showIncidence(); 240 void showIncidence();
222 void editIncidence(); 241 void editIncidence();
223 void editIncidenceDescription(); 242 void editIncidenceDescription();
224 void deleteIncidence(); 243 void deleteIncidence();
225 void cloneIncidence(); 244 void cloneIncidence();
226 void moveIncidence(); 245 void moveIncidence();
227 void beamIncidence(); 246 void beamIncidence();
228 void toggleCancelIncidence(); 247 void toggleCancelIncidence();
229 248
230 /** create an editeventwin with supplied date/time, and if bool is true, 249 /** create an editeventwin with supplied date/time, and if bool is true,
231 * make the event take all day. */ 250 * make the event take all day. */
232 void newEvent(QDateTime, QDateTime, bool allDay ); 251 void newEvent(QDateTime, QDateTime, bool allDay );
233 void newEvent(QDateTime, QDateTime); 252 void newEvent(QDateTime, QDateTime);
234 void newEvent(QDateTime fh); 253 void newEvent(QDateTime fh);
235 void newEvent(QDate dt); 254 void newEvent(QDate dt);
236 /** create new event without having a date hint. Takes current date as 255 /** create new event without having a date hint. Takes current date as
237 default hint. */ 256 default hint. */
238 void newEvent(); 257 void newEvent();
239 void newFloatingEvent(); 258 void newFloatingEvent();
240 259
241 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 260 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
242 void showIncidence(Incidence *); 261 void showIncidence(Incidence *);
262 void showIncidence(QString uid);
243 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 263 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
244 void editIncidence(Incidence *); 264 void editIncidence(Incidence *);
245 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 265 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
246 void deleteIncidence(Incidence *); 266 void deleteIncidence(Incidence *);
247 void cloneIncidence(Incidence *); 267 void cloneIncidence(Incidence *);
248 void cancelIncidence(Incidence *); 268 void cancelIncidence(Incidence *);
249 /** Create an editor for the supplied event. */ 269 /** Create an editor for the supplied event. */
250 void editEvent(Event *); 270 void editEvent(Event *);
251 /** Delete the supplied event. */ 271 /** Delete the supplied event. */
252 void deleteEvent(Event *); 272 void deleteEvent(Event *);
253 /** Delete the event with the given unique ID. Returns false, if event wasn't 273 /** Delete the event with the given unique ID. Returns false, if event wasn't
254 found. */ 274 found. */
255 bool deleteEvent(const QString &uid); 275 bool deleteEvent(const QString &uid);
256 /** Create a read-only viewer dialog for the supplied event. */ 276 /** Create a read-only viewer dialog for the supplied event. */
257 void showEvent(Event *); 277 void showEvent(Event *);
258 278
259 void editJournal(Journal *); 279 void editJournal(Journal *);
260 void showJournal(Journal *); 280 void showJournal(Journal *);
261 void deleteJournal(Journal *); 281 void deleteJournal(Journal *);
262 /** Create an editor dialog for a todo */ 282 /** Create an editor dialog for a todo */
263 void editTodo(Todo *); 283 void editTodo(Todo *);
264 /** Create a read-only viewer dialog for the supplied todo */ 284 /** Create a read-only viewer dialog for the supplied todo */
265 void showTodo(Todo *); 285 void showTodo(Todo *);
266 /** create new todo */ 286 /** create new todo */
267 void newTodo(); 287 void newTodo();
268 void newTodoDateTime(QDateTime, bool allday); 288 void newTodoDateTime(QDateTime, bool allday);
269 /** create new todo with a parent todo */ 289 /** create new todo with a parent todo */
270 void newSubTodo(); 290 void newSubTodo();
271 /** create new todo with a parent todo */ 291 /** create new todo with a parent todo */
272 void newSubTodo(Todo *); 292 void newSubTodo(Todo *);
273 /** Delete todo */ 293 /** Delete todo */
274 void deleteTodo(Todo *); 294 void deleteTodo(Todo *);
275 295
276 296
277 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 297 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
278 * emitted as result. */ 298 * emitted as result. */
279 void checkClipboard(); 299 void checkClipboard();
280 300
281 /** using the KConfig associated with the kapp variable, read in the 301 /** using the KConfig associated with the kapp variable, read in the
282 * settings from the config file. 302 * settings from the config file.
283 */ 303 */
284 void readSettings(); 304 void readSettings();
285 305
286 /** write current state to config file. */ 306 /** write current state to config file. */
287 void writeSettings(); 307 void writeSettings();
288 308
289 /** read settings for calendar filters */ 309 /** read settings for calendar filters */
290 void readFilterSettings(KConfig *config); 310 void readFilterSettings(KConfig *config);
291 311
292 /** write settings for calendar filters */ 312 /** write settings for calendar filters */
293 void writeFilterSettings(KConfig *config); 313 void writeFilterSettings(KConfig *config);
294 314
295 /** passes on the message that an event has changed to the currently 315 /** passes on the message that an event has changed to the currently
296 * activated view so that it can make appropriate display changes. */ 316 * activated view so that it can make appropriate display changes. */
297 void changeEventDisplay(Event *, int); 317 void changeEventDisplay(Event *, int);
298 void changeIncidenceDisplay(Incidence *, int); 318 void changeIncidenceDisplay(Incidence *, int);
299 void changeTodoDisplay(Todo *, int); 319 void changeTodoDisplay(Todo *, int);
300 320
301 void eventAdded(Event *); 321 void eventAdded(Event *);
302 void eventChanged(Event *); 322 void eventChanged(Event *);
303 void eventToBeDeleted(Event *); 323 void eventToBeDeleted(Event *);
304 void eventDeleted(); 324 void eventDeleted();
305 325
306 void todoAdded(Todo *); 326 void todoAdded(Todo *);
307 void todoChanged(Todo *); 327 void todoChanged(Todo *);
308 void todoToBeDeleted(Todo *); 328 void todoToBeDeleted(Todo *);
309 void todoDeleted(); 329 void todoDeleted();
310 330
311 void updateView(const QDate &start, const QDate &end); 331 void updateView(const QDate &start, const QDate &end);
312 void updateView(); 332 void updateView();
313 333
314 /** Full update of visible todo views */ 334 /** Full update of visible todo views */
315 void updateTodoViews(); 335 void updateTodoViews();
316 336
317 void updateUnmanagedViews(); 337 void updateUnmanagedViews();
318 338
319 /** cut the current appointment to the clipboard */ 339 /** cut the current appointment to the clipboard */
320 void edit_cut(); 340 void edit_cut();
321 341
322 /** copy the current appointment(s) to the clipboard */ 342 /** copy the current appointment(s) to the clipboard */
323 void edit_copy(); 343 void edit_copy();
324 344
325 /** paste the current vobject(s) in the clipboard buffer into calendar */ 345 /** paste the current vobject(s) in the clipboard buffer into calendar */
326 void edit_paste(); 346 void edit_paste();
327 347
328 /** edit viewing and configuration options. */ 348 /** edit viewing and configuration options. */
329 void edit_options(); 349 void edit_options();
330 /** 350 /**
331 Functions for printing, previewing a print, and setting up printing 351 Functions for printing, previewing a print, and setting up printing
332 parameters. 352 parameters.
333 */ 353 */
334 void print(); 354 void print();
335 void printSetup(); 355 void printSetup();
336 void printPreview(); 356 void printPreview();
337 357
338 /** Export as iCalendar file */ 358 /** Export as iCalendar file */
339 void exportICalendar(); 359 void exportICalendar();
340 360
341 /** Export as vCalendar file */ 361 /** Export as vCalendar file */
342 bool exportVCalendar( QString fn); 362 bool exportVCalendar( QString fn);
343 363
344 /** pop up a dialog to show an existing appointment. */ 364 /** pop up a dialog to show an existing appointment. */
345 void appointment_show(); 365 void appointment_show();
346 /** 366 /**
347 * pop up an Appointment Dialog to edit an existing appointment.Get 367 * pop up an Appointment Dialog to edit an existing appointment.Get
348 * information on the appointment from the list of unique IDs that is 368 * information on the appointment from the list of unique IDs that is
349 * currently in the View, called currIds. 369 * currently in the View, called currIds.
350 */ 370 */
351 void appointment_edit(); 371 void appointment_edit();
352 /** 372 /**
353 * pop up dialog confirming deletion of currently selected event in the 373 * pop up dialog confirming deletion of currently selected event in the
354 * View. 374 * View.
355 */ 375 */
356 void appointment_delete(); 376 void appointment_delete();
357 377
358 /** mails the currently selected event to a particular user as a vCalendar 378 /** mails the currently selected event to a particular user as a vCalendar
359 attachment. */ 379 attachment. */
360 void action_mail(); 380 void action_mail();
361 381
362 /* frees a subtodo from it's relation */ 382 /* frees a subtodo from it's relation */
363 void todo_unsub( Todo * ); 383 void todo_unsub( Todo * );
364 void todo_resub( Todo * parent, Todo * sub ); 384 void todo_resub( Todo * parent, Todo * sub );
365 385
366 /** Take ownership of selected event. */ 386 /** Take ownership of selected event. */
367 void takeOverEvent(); 387 void takeOverEvent();
368 388
369 /** Take ownership of all events in calendar. */ 389 /** Take ownership of all events in calendar. */
370 void takeOverCalendar(); 390 void takeOverCalendar();
371 391
372 /** query whether or not the calendar is "dirty". */ 392 /** query whether or not the calendar is "dirty". */
373 bool isModified(); 393 bool isModified();
374 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 394 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
375 void setModified(bool modified=true); 395 void setModified(bool modified=true);
376 396
377 /** query if the calendar is read-only. */ 397 /** query if the calendar is read-only. */
378 bool isReadOnly(); 398 bool isReadOnly();
379 /** set state of calendar to read-only */ 399 /** set state of calendar to read-only */
380 void setReadOnly(bool readOnly=true); 400 void setReadOnly(bool readOnly=true);
381 401
382 void eventUpdated(Incidence *); 402 void eventUpdated(Incidence *);
383 403
384 /* iTIP scheduling actions */ 404 /* iTIP scheduling actions */
385 void schedule_publish(Incidence *incidence = 0); 405 void schedule_publish(Incidence *incidence = 0);
386 void schedule_request(Incidence *incidence = 0); 406 void schedule_request(Incidence *incidence = 0);
387 void schedule_refresh(Incidence *incidence = 0); 407 void schedule_refresh(Incidence *incidence = 0);
388 void schedule_cancel(Incidence *incidence = 0); 408 void schedule_cancel(Incidence *incidence = 0);
389 void schedule_add(Incidence *incidence = 0); 409 void schedule_add(Incidence *incidence = 0);
390 void schedule_reply(Incidence *incidence = 0); 410 void schedule_reply(Incidence *incidence = 0);
391 void schedule_counter(Incidence *incidence = 0); 411 void schedule_counter(Incidence *incidence = 0);
392 void schedule_declinecounter(Incidence *incidence = 0); 412 void schedule_declinecounter(Incidence *incidence = 0);
393 void schedule_publish_freebusy(int daysToPublish = 30); 413 void schedule_publish_freebusy(int daysToPublish = 30);
394 414
395 void openAddressbook(); 415 void openAddressbook();
396 416
397 void editFilters(); 417 void editFilters();
398 void toggleFilerEnabled(); 418 void toggleFilerEnabled();
399 QPtrList<CalFilter> filters(); 419 QPtrList<CalFilter> filters();
400 void toggleFilter(); 420 void toggleFilter();
401 void showFilter(bool visible); 421 void showFilter(bool visible);
402 void updateFilter(); 422 void updateFilter();
403 void filterEdited(); 423 void filterEdited();
404 void selectFilter( int ); 424 void selectFilter( int );
405 KOFilterView *filterView(); 425 KOFilterView *filterView();
406 426
407 void showIntro(); 427 void showIntro();
408 428
409 /** Move the curdatepient view date to today */ 429 /** Move the curdatepient view date to today */
410 void goToday(); 430 void goToday();
411 431
412 /** Move to the next date(s) in the current view */ 432 /** Move to the next date(s) in the current view */
413 void goNext(); 433 void goNext();
414 434
415 /** Move to the previous date(s) in the current view */ 435 /** Move to the previous date(s) in the current view */
416 void goPrevious(); 436 void goPrevious();
417 /** Move to the next date(s) in the current view */ 437 /** Move to the next date(s) in the current view */
418 void goNextMonth(); 438 void goNextMonth();
419 439
420 /** Move to the previous date(s) in the current view */ 440 /** Move to the previous date(s) in the current view */
421 void goPreviousMonth(); 441 void goPreviousMonth();
422 442
423 void toggleExpand(); 443 void toggleExpand();
424 void toggleDateNavigatorWidget(); 444 void toggleDateNavigatorWidget();
425 void toggleAllDaySize(); 445 void toggleAllDaySize();
426 void dialogClosing(Incidence *); 446 void dialogClosing(Incidence *);
427 447
428 /** Look for new messages in the inbox */ 448 /** Look for new messages in the inbox */
429 void lookForIncomingMessages(); 449 void lookForIncomingMessages();
430 /** Look for new messages in the outbox */ 450 /** Look for new messages in the outbox */
431 void lookForOutgoingMessages(); 451 void lookForOutgoingMessages();
432 452
433 void processMainViewSelection( Incidence * ); 453 void processMainViewSelection( Incidence * );
434 void processTodoListSelection( Incidence * ); 454 void processTodoListSelection( Incidence * );
435 455
436 void processIncidenceSelection( Incidence * ); 456 void processIncidenceSelection( Incidence * );
437 457
438 void purgeCompleted(); 458 void purgeCompleted();
439 bool removeCompletedSubTodos( Todo* ); 459 bool removeCompletedSubTodos( Todo* );
440 void slotCalendarChanged(); 460 void slotCalendarChanged();
441 bool importBday(); 461 bool importBday();
442 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 462 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
443 bool importQtopia( const QString &categoriesFile, 463 bool importQtopia( const QString &categoriesFile,
444 const QString &datebookFile, 464 const QString &datebookFile,
445 const QString &tasklistFile ); 465 const QString &tasklistFile );
446 void syncExternal( int mode ); 466 void syncExternal( int mode );
447 void slotSelectPickerDate( QDate ) ; 467 void slotSelectPickerDate( QDate ) ;
448 void showDatePicker() ; 468 void showDatePicker() ;
449 void showDatePickerPopup() ; 469 void showDatePickerPopup() ;
450 void moveIncidence(Incidence *) ; 470 void moveIncidence(Incidence *) ;
451 void beamIncidence(Incidence *) ; 471 void beamIncidence(Incidence *) ;
452 void beamCalendar() ; 472 void beamCalendar() ;
453 void beamFilteredCalendar() ; 473 void beamFilteredCalendar() ;
454 void beamIncidenceList(QPtrList<Incidence>) ; 474 void beamIncidenceList(QPtrList<Incidence>) ;
455 void manageCategories(); 475 void manageCategories();
456 int addCategories(); 476 int addCategories();
457 void removeCategories(); 477 void removeCategories();
458 void setSyncDevice( QString ); 478 void setSyncDevice( QString );
459 void setSyncName( QString ); 479 void setSyncName( QString );
460 void showDay( QDate ); 480 void showDay( QDate );
461 void undo_delete(); 481 void undo_delete();
462 protected slots: 482 protected slots:
463 void resetFocus(); 483 void resetFocus();
464 void slotViewerClosed(); 484 void slotViewerClosed();
465 void timerAlarm(); 485 void timerAlarm();
466 void suspendAlarm(); 486 void suspendAlarm();
467 void beamDone( Ir *ir ); 487 void beamDone( Ir *ir );
468 /** Select a view or adapt the current view to display the specified dates. */ 488 /** Select a view or adapt the current view to display the specified dates. */
469 void showDates( const KCal::DateList & ); 489 void showDates( const KCal::DateList & );
470 void selectWeekNum ( int ); 490 void selectWeekNum ( int );
471 491
472 public: 492 public:
473 // show a standard warning 493 // show a standard warning
474 // returns KMsgBox::yesNoCancel() 494 // returns KMsgBox::yesNoCancel()
475 int msgCalModified(); 495 int msgCalModified();
476 virtual bool sync(KSyncManager* manager, QString filename, int mode); 496 virtual bool sync(KSyncManager* manager, QString filename, int mode);
477 497
478 virtual bool syncExternal(KSyncManager* manager, QString resource); 498 virtual bool syncExternal(KSyncManager* manager, QString resource);
479 virtual void removeSyncInfo( QString syncProfile); 499 virtual void removeSyncInfo( QString syncProfile);
480 void setSyncManager(KSyncManager* manager); 500 void setSyncManager(KSyncManager* manager);
481 void setLoadedFileVersion(QDateTime); 501 void setLoadedFileVersion(QDateTime);
482 bool checkFileVersion(QString fn); 502 bool checkFileVersion(QString fn);
483 bool checkFileChanged(QString fn); 503 bool checkFileChanged(QString fn);
484 Event* getLastSyncEvent(); 504 Event* getLastSyncEvent();
485 /** Adapt navigation units correpsonding to step size of navigation of the 505 /** Adapt navigation units correpsonding to step size of navigation of the
486 * current view. 506 * current view.
487 */ 507 */
488 void adaptNavigationUnits(); 508 void adaptNavigationUnits();
489 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 509 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
490 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 510 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
491 //Attendee* getYourAttendee(Event *event); 511 //Attendee* getYourAttendee(Event *event);
492 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 512 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
493 protected: 513 protected:
494 void schedule(Scheduler::Method, Incidence *incidence = 0); 514 void schedule(Scheduler::Method, Incidence *incidence = 0);
495 515
496 // returns KMsgBox::OKCandel() 516 // returns KMsgBox::OKCandel()
497 int msgItemDelete(const QString name); 517 int msgItemDelete(const QString name);
498 void showEventEditor(); 518 void showEventEditor();
499 void showTodoEditor(); 519 void showTodoEditor();
500 void writeLocale(); 520 void writeLocale();
501 Todo *selectedTodo(); 521 Todo *selectedTodo();
502 522
503 private: 523 private:
504 QDateTime mNextAlarmDateTime; 524 QDateTime mNextAlarmDateTime;
505 bool mViewerCallerIsSearchDialog; 525 bool mViewerCallerIsSearchDialog;
506 bool mBlockShowDates; 526 bool mBlockShowDates;
507 KSyncManager* mSyncManager; 527 KSyncManager* mSyncManager;
508 AlarmDialog * mAlarmDialog; 528 AlarmDialog * mAlarmDialog;
509 QString mAlarmNotification; 529 QString mAlarmNotification;
510 QString mSuspendAlarmNotification; 530 QString mSuspendAlarmNotification;
511 QTimer* mSuspendTimer; 531 QTimer* mSuspendTimer;
512 QTimer* mAlarmTimer; 532 QTimer* mAlarmTimer;
513 QTimer* mRecheckAlarmTimer; 533 QTimer* mRecheckAlarmTimer;
514 void computeAlarm( QString ); 534 void computeAlarm( QString );
515 void startAlarm( QString, QString ); 535 void startAlarm( QString, QString );
516 void setSyncEventsReadOnly(); 536 void setSyncEventsReadOnly();
517 537
518 QDateTime loadedFileVersion; 538 QDateTime loadedFileVersion;
519 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 539 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
520 void checkExternalId( Incidence * inc ); 540 void checkExternalId( Incidence * inc );
521 int mGlobalSyncMode; 541 int mGlobalSyncMode;
522 QString mCurrentSyncDevice; 542 QString mCurrentSyncDevice;
523 QString mCurrentSyncName; 543 QString mCurrentSyncName;
524 KOBeamPrefs* beamDialog; 544 KOBeamPrefs* beamDialog;
525 void init(); 545 void init();
526 int mDatePickerMode; 546 int mDatePickerMode;
527 bool mFlagEditDescription; 547 bool mFlagEditDescription;
528 QDateTime mLastCalendarSync; 548 QDateTime mLastCalendarSync;
529 void createPrinter(); 549 void createPrinter();
530 550
531 void calendarModified( bool, Calendar * ); 551 void calendarModified( bool, Calendar * );
532 552
533 CalPrinter *mCalPrinter; 553 CalPrinter *mCalPrinter;
534 554
535 QSplitter *mPanner; 555 QSplitter *mPanner;
536 QSplitter *mLeftSplitter; 556 QSplitter *mLeftSplitter;
537 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 557 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
538 QWidgetStack *mRightFrame; 558 QWidgetStack *mRightFrame;
539 559
540 KDatePicker* mDatePicker; 560 KDatePicker* mDatePicker;
541 QVBox* mDateFrame; 561 QVBox* mDateFrame;
542 562
543 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 563 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
544 564
545 KOFilterView *mFilterView; 565 KOFilterView *mFilterView;
546 566
547 ResourceView *mResourceView; 567 ResourceView *mResourceView;
548 568
549 // calendar object for this viewing instance 569 // calendar object for this viewing instance
550 Calendar *mCalendar; 570 Calendar *mCalendar;
551 571
552 CalendarResourceManager *mResourceManager; 572 CalendarResourceManager *mResourceManager;
553 573
554 FileStorage *mStorage; 574 FileStorage *mStorage;
555 575
556 DateNavigator *mNavigator; 576 DateNavigator *mNavigator;
557 577
558 KOViewManager *mViewManager; 578 KOViewManager *mViewManager;
559 KODialogManager *mDialogManager; 579 KODialogManager *mDialogManager;
560 580
561 // Calendar filters 581 // Calendar filters
562 QPtrList<CalFilter> mFilters; 582 QPtrList<CalFilter> mFilters;
563 583
564 // various housekeeping variables. 584 // various housekeeping variables.
565 bool mModified; // flag indicating if calendar is modified 585 bool mModified; // flag indicating if calendar is modified
566 bool mReadOnly; // flag indicating if calendar is read-only 586 bool mReadOnly; // flag indicating if calendar is read-only
567 QDate mSaveSingleDate; 587 QDate mSaveSingleDate;
568 588
569 Incidence *mSelectedIncidence; 589 Incidence *mSelectedIncidence;
570 Incidence *mMoveIncidence; 590 Incidence *mMoveIncidence;
571 QDate mMoveIncidenceOldDate; 591 QDate mMoveIncidenceOldDate;
572 KOTodoView *mTodoList; 592 KOTodoView *mTodoList;
573 KOEventEditor * mEventEditor; 593 KOEventEditor * mEventEditor;
574 KOTodoEditor * mTodoEditor; 594 KOTodoEditor * mTodoEditor;
575 KOEventViewerDialog * mEventViewerDialog; 595 KOEventViewerDialog * mEventViewerDialog;
576 void keyPressEvent ( QKeyEvent *e) ; 596 void keyPressEvent ( QKeyEvent *e) ;
577 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 597 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
578}; 598};
579 599
580 600
581class CalendarViewVisitor : public Incidence::Visitor 601class CalendarViewVisitor : public Incidence::Visitor
582{ 602{
583 public: 603 public:
584 CalendarViewVisitor() : mView( 0 ) {} 604 CalendarViewVisitor() : mView( 0 ) {}
585 605
586 bool act( Incidence *incidence, CalendarView *view ) 606 bool act( Incidence *incidence, CalendarView *view )
587 { 607 {
588 mView = view; 608 mView = view;
589 return incidence->accept( *this ); 609 return incidence->accept( *this );
590 } 610 }
591 611
592 protected: 612 protected:
593 CalendarView *mView; 613 CalendarView *mView;
594}; 614};
595 615
596class ShowIncidenceVisitor : public CalendarViewVisitor 616class ShowIncidenceVisitor : public CalendarViewVisitor
597{ 617{
598 protected: 618 protected:
599 bool visit( Event *event ) { mView->showEvent( event ); return true; } 619 bool visit( Event *event ) { mView->showEvent( event ); return true; }
600 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 620 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
601 bool visit( Journal * j ) { mView->showJournal( j );return true; } 621 bool visit( Journal * j ) { mView->showJournal( j );return true; }
602}; 622};
603 623
604class EditIncidenceVisitor : public CalendarViewVisitor 624class EditIncidenceVisitor : public CalendarViewVisitor
605{ 625{
606 protected: 626 protected:
607 bool visit( Event *event ) { mView->editEvent( event ); return true; } 627 bool visit( Event *event ) { mView->editEvent( event ); return true; }
608 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 628 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
609 bool visit( Journal *j ) { mView->editJournal( j); return true; } 629 bool visit( Journal *j ) { mView->editJournal( j); return true; }
610}; 630};
611 631
612class DeleteIncidenceVisitor : public CalendarViewVisitor 632class DeleteIncidenceVisitor : public CalendarViewVisitor
613{ 633{
614 protected: 634 protected:
615 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 635 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
616 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 636 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
617 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 637 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
618}; 638};
619 639
620#endif 640#endif
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8fe9999..5aaf360 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,1249 +1,1251 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28 28
29#include <qinputdialog.h> 29#include <qinputdialog.h>
30 30
31#include <qvbox.h> 31#include <qvbox.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include "koprefs.h" 33#include "koprefs.h"
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kmessagebox.h> 37#include <kmessagebox.h>
38 38
39#include <libkcal/icaldrag.h> 39#include <libkcal/icaldrag.h>
40#include <libkcal/vcaldrag.h> 40#include <libkcal/vcaldrag.h>
41#include <libkcal/calfilter.h> 41#include <libkcal/calfilter.h>
42#include <libkcal/dndfactory.h> 42#include <libkcal/dndfactory.h>
43#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
44#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
45#include <kresources/resourceselectdialog.h> 45#include <kresources/resourceselectdialog.h>
46#include <libkcal/kincidenceformatter.h> 46#include <libkcal/kincidenceformatter.h>
47#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
48#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
49#else 49#else
50#include <qapplication.h> 50#include <qapplication.h>
51#endif 51#endif
52#ifndef KORG_NOPRINTER 52#ifndef KORG_NOPRINTER
53#include "calprinter.h" 53#include "calprinter.h"
54#endif 54#endif
55#include "docprefs.h" 55#include "docprefs.h"
56 56
57#include "kotodoview.h" 57#include "kotodoview.h"
58using namespace KOrg; 58using namespace KOrg;
59 59
60 60
61class KOTodoViewWhatsThis :public QWhatsThis 61class KOTodoViewWhatsThis :public QWhatsThis
62{ 62{
63public: 63public:
64 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 64 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
65 65
66protected: 66protected:
67 virtual QString text( const QPoint& p) 67 virtual QString text( const QPoint& p)
68 { 68 {
69 return _view->getWhatsThisText(p) ; 69 return _view->getWhatsThisText(p) ;
70 } 70 }
71private: 71private:
72 QWidget* _wid; 72 QWidget* _wid;
73 KOTodoView * _view; 73 KOTodoView * _view;
74}; 74};
75 75
76KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 76KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
77 const char *name) : 77 const char *name) :
78 KListView(parent,name) 78 KListView(parent,name)
79{ 79{
80 mName = QString ( name ); 80 mName = QString ( name );
81 mCalendar = calendar; 81 mCalendar = calendar;
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mOldCurrent = 0; 85 mOldCurrent = 0;
86 mMousePressed = false; 86 mMousePressed = false;
87 87
88 setAcceptDrops(true); 88 setAcceptDrops(true);
89 viewport()->setAcceptDrops(true); 89 viewport()->setAcceptDrops(true);
90 int size = 16; 90 int size = 16;
91 if (qApp->desktop()->width() < 300 ) 91 if (qApp->desktop()->width() < 300 )
92 size = 12; 92 size = 12;
93 setTreeStepSize( size + 6 ); 93 setTreeStepSize( size + 6 );
94 94
95} 95}
96 96
97void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 97void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
98{ 98{
99#ifndef KORG_NODND 99#ifndef KORG_NODND
100// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 100// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
101 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 101 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
102 !QTextDrag::canDecode( e ) ) { 102 !QTextDrag::canDecode( e ) ) {
103 e->ignore(); 103 e->ignore();
104 return; 104 return;
105 } 105 }
106 106
107 mOldCurrent = currentItem(); 107 mOldCurrent = currentItem();
108#endif 108#endif
109} 109}
110 110
111 111
112void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 112void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
113{ 113{
114#ifndef KORG_NODND 114#ifndef KORG_NODND
115// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 115// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
116 116
117 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 117 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
118 !QTextDrag::canDecode( e ) ) { 118 !QTextDrag::canDecode( e ) ) {
119 e->ignore(); 119 e->ignore();
120 return; 120 return;
121 } 121 }
122 122
123 e->accept(); 123 e->accept();
124#endif 124#endif
125} 125}
126 126
127void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 127void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
128{ 128{
129#ifndef KORG_NODND 129#ifndef KORG_NODND
130// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 130// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
131 131
132 setCurrentItem(mOldCurrent); 132 setCurrentItem(mOldCurrent);
133 setSelected(mOldCurrent,true); 133 setSelected(mOldCurrent,true);
134#endif 134#endif
135} 135}
136 136
137void KOTodoListView::contentsDropEvent(QDropEvent *e) 137void KOTodoListView::contentsDropEvent(QDropEvent *e)
138{ 138{
139#ifndef KORG_NODND 139#ifndef KORG_NODND
140// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 140// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
141 141
142 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 142 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
143 !QTextDrag::canDecode( e ) ) { 143 !QTextDrag::canDecode( e ) ) {
144 e->ignore(); 144 e->ignore();
145 return; 145 return;
146 } 146 }
147 147
148 DndFactory factory( mCalendar ); 148 DndFactory factory( mCalendar );
149 Todo *todo = factory.createDropTodo(e); 149 Todo *todo = factory.createDropTodo(e);
150 150
151 if (todo) { 151 if (todo) {
152 e->acceptAction(); 152 e->acceptAction();
153 153
154 KOTodoViewItem *destination = 154 KOTodoViewItem *destination =
155 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 155 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
156 Todo *destinationEvent = 0; 156 Todo *destinationEvent = 0;
157 if (destination) destinationEvent = destination->todo(); 157 if (destination) destinationEvent = destination->todo();
158 158
159 Todo *existingTodo = mCalendar->todo(todo->uid()); 159 Todo *existingTodo = mCalendar->todo(todo->uid());
160 160
161 if(existingTodo) { 161 if(existingTodo) {
162 Incidence *to = destinationEvent; 162 Incidence *to = destinationEvent;
163 while(to) { 163 while(to) {
164 if (to->uid() == todo->uid()) { 164 if (to->uid() == todo->uid()) {
165 KMessageBox::sorry(this, 165 KMessageBox::sorry(this,
166 i18n("Cannot move Todo to itself\nor a child of itself"), 166 i18n("Cannot move Todo to itself\nor a child of itself"),
167 i18n("Drop Todo")); 167 i18n("Drop Todo"));
168 delete todo; 168 delete todo;
169 return; 169 return;
170 } 170 }
171 to = to->relatedTo(); 171 to = to->relatedTo();
172 } 172 }
173 internalDrop = true; 173 internalDrop = true;
174 if ( destinationEvent ) 174 if ( destinationEvent )
175 reparentTodoSignal( destinationEvent, existingTodo ); 175 reparentTodoSignal( destinationEvent, existingTodo );
176 else 176 else
177 unparentTodoSignal(existingTodo); 177 unparentTodoSignal(existingTodo);
178 delete todo; 178 delete todo;
179 } else { 179 } else {
180 mCalendar->addTodo(todo); 180 mCalendar->addTodo(todo);
181 emit todoDropped(todo, KOGlobals::EVENTADDED); 181 emit todoDropped(todo, KOGlobals::EVENTADDED);
182 if ( destinationEvent ) 182 if ( destinationEvent )
183 reparentTodoSignal( destinationEvent, todo ); 183 reparentTodoSignal( destinationEvent, todo );
184 } 184 }
185 } 185 }
186 else { 186 else {
187 QString text; 187 QString text;
188 if (QTextDrag::decode(e,text)) { 188 if (QTextDrag::decode(e,text)) {
189 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 189 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
190 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 190 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
191 qDebug("Dropped : " + text); 191 qDebug("Dropped : " + text);
192 QStringList emails = QStringList::split(",",text); 192 QStringList emails = QStringList::split(",",text);
193 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 193 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
194 int pos = (*it).find("<"); 194 int pos = (*it).find("<");
195 QString name = (*it).left(pos); 195 QString name = (*it).left(pos);
196 QString email = (*it).mid(pos); 196 QString email = (*it).mid(pos);
197 if (!email.isEmpty() && todoi) { 197 if (!email.isEmpty() && todoi) {
198 todoi->todo()->addAttendee(new Attendee(name,email)); 198 todoi->todo()->addAttendee(new Attendee(name,email));
199 } 199 }
200 } 200 }
201 } 201 }
202 else { 202 else {
203 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 203 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
204 e->ignore(); 204 e->ignore();
205 } 205 }
206 } 206 }
207#endif 207#endif
208} 208}
209void KOTodoListView::wheelEvent (QWheelEvent *e) 209void KOTodoListView::wheelEvent (QWheelEvent *e)
210{ 210{
211 QListView::wheelEvent (e); 211 QListView::wheelEvent (e);
212} 212}
213 213
214void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 214void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
215{ 215{
216 216
217 QPoint p(contentsToViewport(e->pos())); 217 QPoint p(contentsToViewport(e->pos()));
218 QListViewItem *i = itemAt(p); 218 QListViewItem *i = itemAt(p);
219 bool rootClicked = true; 219 bool rootClicked = true;
220 if (i) { 220 if (i) {
221 // if the user clicked into the root decoration of the item, don't 221 // if the user clicked into the root decoration of the item, don't
222 // try to start a drag! 222 // try to start a drag!
223 int X = p.x(); 223 int X = p.x();
224 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 224 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
225 if (X > header()->sectionPos(0) + 225 if (X > header()->sectionPos(0) +
226 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 226 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
227 itemMargin() +i->height()|| 227 itemMargin() +i->height()||
228 X < header()->sectionPos(0)) { 228 X < header()->sectionPos(0)) {
229 rootClicked = false; 229 rootClicked = false;
230 } 230 }
231 } else { 231 } else {
232 rootClicked = false; 232 rootClicked = false;
233 } 233 }
234#ifndef KORG_NODND 234#ifndef KORG_NODND
235 mMousePressed = false; 235 mMousePressed = false;
236 if (! rootClicked && !( e->button() == RightButton) ) { 236 if (! rootClicked && !( e->button() == RightButton) ) {
237 mPressPos = e->pos(); 237 mPressPos = e->pos();
238 mMousePressed = true; 238 mMousePressed = true;
239 } else { 239 } else {
240 mMousePressed = false; 240 mMousePressed = false;
241 } 241 }
242#endif 242#endif
243 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 243 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
244#ifndef DESKTOP_VERSION 244#ifndef DESKTOP_VERSION
245 if (!( e->button() == RightButton && rootClicked) ) 245 if (!( e->button() == RightButton && rootClicked) )
246 QListView::contentsMousePressEvent(e); 246 QListView::contentsMousePressEvent(e);
247#else 247#else
248 QListView::contentsMousePressEvent(e); 248 QListView::contentsMousePressEvent(e);
249#endif 249#endif
250} 250}
251void KOTodoListView::paintEvent(QPaintEvent* e) 251void KOTodoListView::paintEvent(QPaintEvent* e)
252{ 252{
253 emit paintNeeded(); 253 emit paintNeeded();
254 QListView::paintEvent( e); 254 QListView::paintEvent( e);
255} 255}
256void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 256void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
257{ 257{
258 258
259#ifndef KORG_NODND 259#ifndef KORG_NODND
260 //QListView::contentsMouseMoveEvent(e); 260 //QListView::contentsMouseMoveEvent(e);
261 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 261 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
262 QApplication::startDragDistance()*3) { 262 QApplication::startDragDistance()*3) {
263 mMousePressed = false; 263 mMousePressed = false;
264 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 264 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
265 if (item) { 265 if (item) {
266 DndFactory factory( mCalendar ); 266 DndFactory factory( mCalendar );
267 ICalDrag *vd = factory.createDrag( 267 ICalDrag *vd = factory.createDrag(
268 ((KOTodoViewItem *)item)->todo(),viewport()); 268 ((KOTodoViewItem *)item)->todo(),viewport());
269 internalDrop = false; 269 internalDrop = false;
270 // we cannot do any senseful here, because the DnD is still broken in Qt 270 // we cannot do any senseful here, because the DnD is still broken in Qt
271 if (vd->drag()) { 271 if (vd->drag()) {
272 if ( !internalDrop ) { 272 if ( !internalDrop ) {
273 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 273 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
274 qDebug("Dnd: External move: Delete drag source "); 274 qDebug("Dnd: External move: Delete drag source ");
275 } else 275 } else
276 qDebug("Dnd: Internal move "); 276 qDebug("Dnd: Internal move ");
277 277
278 } else { 278 } else {
279 if ( !internalDrop ) { 279 if ( !internalDrop ) {
280 qDebug("Dnd: External Copy"); 280 qDebug("Dnd: External Copy");
281 } else 281 } else
282 qDebug("DnD: Internal copy: Copy pending"); 282 qDebug("DnD: Internal copy: Copy pending");
283 } 283 }
284 } 284 }
285 } 285 }
286#endif 286#endif
287} 287}
288void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) 288void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
289{ 289{
290 if ( !e->isAutoRepeat() ) { 290 if ( !e->isAutoRepeat() ) {
291 mFlagKeyPressed = false; 291 mFlagKeyPressed = false;
292 } 292 }
293} 293}
294 294
295 295
296void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 296void KOTodoListView::keyPressEvent ( QKeyEvent * e )
297{ 297{
298 qApp->processEvents(); 298 qApp->processEvents();
299 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 299 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
300 e->ignore(); 300 e->ignore();
301 // qDebug(" ignore %d",e->isAutoRepeat() ); 301 // qDebug(" ignore %d",e->isAutoRepeat() );
302 return; 302 return;
303 } 303 }
304 if (! e->isAutoRepeat() ) 304 if (! e->isAutoRepeat() )
305 mFlagKeyPressed = true; 305 mFlagKeyPressed = true;
306 QListViewItem* cn; 306 QListViewItem* cn;
307 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 307 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
308 cn = currentItem(); 308 cn = currentItem();
309 if ( cn ) { 309 if ( cn ) {
310 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 310 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
311 if ( ci ){ 311 if ( ci ){
312 if ( e->state() == ShiftButton ) 312 if ( e->state() == ShiftButton )
313 ci->setOn( false ); 313 ci->setOn( false );
314 else 314 else
315 ci->setOn( true ); 315 ci->setOn( true );
316 cn = cn->itemBelow(); 316 cn = cn->itemBelow();
317 if ( cn ) { 317 if ( cn ) {
318 setCurrentItem ( cn ); 318 setCurrentItem ( cn );
319 ensureItemVisible ( cn ); 319 ensureItemVisible ( cn );
320 } 320 }
321 321
322 } 322 }
323 } 323 }
324 324
325 return; 325 return;
326 } 326 }
327 327
328 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 328 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
329 switch ( e->key() ) { 329 switch ( e->key() ) {
330 case Qt::Key_Down: 330 case Qt::Key_Down:
331 case Qt::Key_Up: 331 case Qt::Key_Up:
332 QListView::keyPressEvent ( e ); 332 QListView::keyPressEvent ( e );
333 break; 333 break;
334 case Qt::Key_Left: 334 case Qt::Key_Left:
335 case Qt::Key_Right: 335 case Qt::Key_Right:
336 QListView::keyPressEvent ( e ); 336 QListView::keyPressEvent ( e );
337 e->accept(); 337 e->accept();
338 return; 338 return;
339 break; 339 break;
340 default: 340 default:
341 e->ignore(); 341 e->ignore();
342 break; 342 break;
343 } 343 }
344 return; 344 return;
345 } 345 }
346 e->ignore(); 346 e->ignore();
347} 347}
348void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 348void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
349{ 349{
350 QListView::contentsMouseReleaseEvent(e); 350 QListView::contentsMouseReleaseEvent(e);
351 mMousePressed = false; 351 mMousePressed = false;
352} 352}
353 353
354void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 354void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
355{ 355{
356 if (!e) return; 356 if (!e) return;
357 357
358 QPoint vp = contentsToViewport(e->pos()); 358 QPoint vp = contentsToViewport(e->pos());
359 359
360 QListViewItem *item = itemAt(vp); 360 QListViewItem *item = itemAt(vp);
361 361
362 emit double_Clicked(item); 362 emit double_Clicked(item);
363 if (!item) return; 363 if (!item) return;
364 364
365 emit doubleClicked(item,vp,0); 365 emit doubleClicked(item,vp,0);
366} 366}
367 367
368///////////////////////////////////////////////////////////////////////////// 368/////////////////////////////////////////////////////////////////////////////
369 369
370KOQuickTodo::KOQuickTodo(QWidget *parent) : 370KOQuickTodo::KOQuickTodo(QWidget *parent) :
371 QLineEdit(parent) 371 QLineEdit(parent)
372{ 372{
373 setText(i18n("Click to add a new Todo")); 373 setText(i18n("Click to add a new Todo"));
374} 374}
375 375
376void KOQuickTodo::focusInEvent(QFocusEvent *ev) 376void KOQuickTodo::focusInEvent(QFocusEvent *ev)
377{ 377{
378 if ( text()==i18n("Click to add a new Todo") ) 378 if ( text()==i18n("Click to add a new Todo") )
379 setText(""); 379 setText("");
380 QLineEdit::focusInEvent(ev); 380 QLineEdit::focusInEvent(ev);
381} 381}
382 382
383void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 383void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
384{ 384{
385 setText(i18n("Click to add a new Todo")); 385 setText(i18n("Click to add a new Todo"));
386 QLineEdit::focusOutEvent(ev); 386 QLineEdit::focusOutEvent(ev);
387} 387}
388 388
389///////////////////////////////////////////////////////////////////////////// 389/////////////////////////////////////////////////////////////////////////////
390 390
391KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 391KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
392 KOrg::BaseView(calendar,parent,name) 392 KOrg::BaseView(calendar,parent,name)
393{ 393{
394 mPendingUpdateBeforeRepaint = false; 394 mPendingUpdateBeforeRepaint = false;
395 isFlatDisplay = false; 395 isFlatDisplay = false;
396 mNavigator = 0; 396 mNavigator = 0;
397 QBoxLayout *topLayout = new QVBoxLayout(this); 397 QBoxLayout *topLayout = new QVBoxLayout(this);
398 mName = QString ( name ); 398 mName = QString ( name );
399 mBlockUpdate = false; 399 mBlockUpdate = false;
400 mQuickAdd = new KOQuickTodo(this); 400 mQuickAdd = new KOQuickTodo(this);
401 topLayout->addWidget(mQuickAdd); 401 topLayout->addWidget(mQuickAdd);
402 402
403 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 403 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
404 404
405 mTodoListView = new KOTodoListView(calendar,this, name ); 405 mTodoListView = new KOTodoListView(calendar,this, name );
406 topLayout->addWidget(mTodoListView); 406 topLayout->addWidget(mTodoListView);
407 //mTodoListView->header()->setMaximumHeight(30); 407 //mTodoListView->header()->setMaximumHeight(30);
408 mTodoListView->setRootIsDecorated(true); 408 mTodoListView->setRootIsDecorated(true);
409 mTodoListView->setAllColumnsShowFocus(true); 409 mTodoListView->setAllColumnsShowFocus(true);
410 410
411 mTodoListView->setShowSortIndicator(true); 411 mTodoListView->setShowSortIndicator(true);
412 412
413 mTodoListView->addColumn(i18n("Todo")); 413 mTodoListView->addColumn(i18n("Todo"));
414 mTodoListView->addColumn(i18n("Prio")); 414 mTodoListView->addColumn(i18n("Prio"));
415 mTodoListView->setColumnAlignment(1,AlignHCenter); 415 mTodoListView->setColumnAlignment(1,AlignHCenter);
416 mTodoListView->addColumn(i18n("Complete")); 416 mTodoListView->addColumn(i18n("Complete"));
417 mTodoListView->setColumnAlignment(2,AlignCenter); 417 mTodoListView->setColumnAlignment(2,AlignCenter);
418 418
419 mTodoListView->addColumn(i18n("Due Date")); 419 mTodoListView->addColumn(i18n("Due Date"));
420 mTodoListView->setColumnAlignment(3,AlignLeft); 420 mTodoListView->setColumnAlignment(3,AlignLeft);
421 mTodoListView->addColumn(i18n("Due Time")); 421 mTodoListView->addColumn(i18n("Due Time"));
422 mTodoListView->setColumnAlignment(4,AlignHCenter); 422 mTodoListView->setColumnAlignment(4,AlignHCenter);
423 423
424 mTodoListView->addColumn(i18n("Start Date")); 424 mTodoListView->addColumn(i18n("Start Date"));
425 mTodoListView->setColumnAlignment(5,AlignLeft); 425 mTodoListView->setColumnAlignment(5,AlignLeft);
426 mTodoListView->addColumn(i18n("Start Time")); 426 mTodoListView->addColumn(i18n("Start Time"));
427 mTodoListView->setColumnAlignment(6,AlignHCenter); 427 mTodoListView->setColumnAlignment(6,AlignHCenter);
428 428
429 mTodoListView->addColumn(i18n("Cancelled")); 429 mTodoListView->addColumn(i18n("Cancelled"));
430 mTodoListView->addColumn(i18n("Categories")); 430 mTodoListView->addColumn(i18n("Categories"));
431#if 0 431#if 0
432 mTodoListView->addColumn(i18n("Sort Id")); 432 mTodoListView->addColumn(i18n("Sort Id"));
433 mTodoListView->setColumnAlignment(4,AlignHCenter); 433 mTodoListView->setColumnAlignment(4,AlignHCenter);
434#endif 434#endif
435 435
436 mTodoListView->setMinimumHeight( 60 ); 436 mTodoListView->setMinimumHeight( 60 );
437 mTodoListView->setItemsRenameable( true ); 437 mTodoListView->setItemsRenameable( true );
438 mTodoListView->setRenameable( 0 ); 438 mTodoListView->setRenameable( 0 );
439 mTodoListView->setColumnWidth( 0, 120 ); 439 mTodoListView->setColumnWidth( 0, 120 );
440 mTodoListView->setColumnWidthMode(0, QListView::Manual); 440 mTodoListView->setColumnWidthMode(0, QListView::Manual);
441 mTodoListView->setColumnWidthMode(1, QListView::Manual); 441 mTodoListView->setColumnWidthMode(1, QListView::Manual);
442 mTodoListView->setColumnWidthMode(2, QListView::Manual); 442 mTodoListView->setColumnWidthMode(2, QListView::Manual);
443 mTodoListView->setColumnWidthMode(3, QListView::Manual); 443 mTodoListView->setColumnWidthMode(3, QListView::Manual);
444 mTodoListView->setColumnWidthMode(4, QListView::Manual); 444 mTodoListView->setColumnWidthMode(4, QListView::Manual);
445 mTodoListView->setColumnWidthMode(5, QListView::Manual); 445 mTodoListView->setColumnWidthMode(5, QListView::Manual);
446 mTodoListView->setColumnWidthMode(6, QListView::Manual); 446 mTodoListView->setColumnWidthMode(6, QListView::Manual);
447 mTodoListView->setColumnWidthMode(7, QListView::Manual); 447 mTodoListView->setColumnWidthMode(7, QListView::Manual);
448 mTodoListView->setColumnWidthMode(8, QListView::Manual); 448 mTodoListView->setColumnWidthMode(8, QListView::Manual);
449 449
450 450
451 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 451 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
452 452
453 mPriorityPopupMenu = new QPopupMenu(this); 453 mPriorityPopupMenu = new QPopupMenu(this);
454 for (int i = 1; i <= 5; i++) { 454 for (int i = 1; i <= 5; i++) {
455 QString label = QString ("%1").arg (i); 455 QString label = QString ("%1").arg (i);
456 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 456 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
457 } 457 }
458 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 458 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
459 459
460 mPercentageCompletedPopupMenu = new QPopupMenu(this); 460 mPercentageCompletedPopupMenu = new QPopupMenu(this);
461 for (int i = 0; i <= 100; i+=20) { 461 for (int i = 0; i <= 100; i+=20) {
462 QString label = QString ("%1 %").arg (i); 462 QString label = QString ("%1 %").arg (i);
463 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 463 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
464 } 464 }
465 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 465 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
466 466
467 467
468 468
469 mItemPopupMenu = new QPopupMenu(this); 469 mItemPopupMenu = new QPopupMenu(this);
470 mItemPopupMenu->insertItem(i18n("Show..."), this, 470 mItemPopupMenu->insertItem(i18n("Show..."), this,
471 SLOT (showTodo())); 471 SLOT (showTodo()));
472 mItemPopupMenu->insertItem(i18n("Edit..."), this, 472 mItemPopupMenu->insertItem(i18n("Edit..."), this,
473 SLOT (editTodo())); 473 SLOT (editTodo()));
474 mItemPopupMenu->insertItem( i18n("Delete"), this, 474 mItemPopupMenu->insertItem( i18n("Delete"), this,
475 SLOT (deleteTodo())); 475 SLOT (deleteTodo()));
476 mItemPopupMenu->insertItem( i18n("Clone..."), this, 476 mItemPopupMenu->insertItem( i18n("Clone..."), this,
477 SLOT (cloneTodo())); 477 SLOT (cloneTodo()));
478 mItemPopupMenu->insertItem( i18n("Move..."), this, 478 mItemPopupMenu->insertItem( i18n("Move..."), this,
479 SLOT (moveTodo())); 479 SLOT (moveTodo()));
480#ifndef DESKTOP_VERSION
480 mItemPopupMenu->insertItem( i18n("Beam..."), this, 481 mItemPopupMenu->insertItem( i18n("Beam..."), this,
481 SLOT (beamTodo())); 482 SLOT (beamTodo()));
483#endif
482 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 484 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
483 SLOT (cancelTodo())); 485 SLOT (cancelTodo()));
484 mItemPopupMenu->insertSeparator(); 486 mItemPopupMenu->insertSeparator();
485 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 487 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
486 SLOT (toggleRunningItem())); 488 SLOT (toggleRunningItem()));
487 mItemPopupMenu->insertSeparator(); 489 mItemPopupMenu->insertSeparator();
488 /* 490 /*
489 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 491 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
490 SLOT (newTodo())); 492 SLOT (newTodo()));
491 */ 493 */
492 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 494 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
493 SLOT (newSubTodo())); 495 SLOT (newSubTodo()));
494 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 496 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
495 SLOT (unparentTodo()),0,21); 497 SLOT (unparentTodo()),0,21);
496 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 498 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
497 SLOT (reparentTodo()),0,22); 499 SLOT (reparentTodo()),0,22);
498 mItemPopupMenu->insertSeparator(); 500 mItemPopupMenu->insertSeparator();
499#if 0 501#if 0
500 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 502 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
501 this, SLOT( purgeCompleted() ) ); 503 this, SLOT( purgeCompleted() ) );
502 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 504 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
503 this, SLOT( toggleCompleted() ),0, 33 ); 505 this, SLOT( toggleCompleted() ),0, 33 );
504 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 506 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
505 this, SLOT( toggleQuickTodo() ),0, 34 ); 507 this, SLOT( toggleQuickTodo() ),0, 34 );
506 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 508 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
507 this, SLOT( toggleRunning() ),0, 35 ); 509 this, SLOT( toggleRunning() ),0, 35 );
508 510
509#endif 511#endif
510 mPopupMenu = new QPopupMenu(this); 512 mPopupMenu = new QPopupMenu(this);
511 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 513 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
512 SLOT (newTodo()),0,1); 514 SLOT (newTodo()),0,1);
513 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 515 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
514 this, SLOT(purgeCompleted()),0,2); 516 this, SLOT(purgeCompleted()),0,2);
515 mPopupMenu->insertItem(i18n("Show Completed"), 517 mPopupMenu->insertItem(i18n("Show Completed"),
516 this, SLOT( toggleCompleted() ),0,3 ); 518 this, SLOT( toggleCompleted() ),0,3 );
517 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 519 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
518 this, SLOT( toggleRunning() ),0,5 ); 520 this, SLOT( toggleRunning() ),0,5 );
519 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 521 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
520 this, SLOT( setAllOpen() ),0,6 ); 522 this, SLOT( setAllOpen() ),0,6 );
521 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 523 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
522 this, SLOT( setAllClose() ),0,7 ); 524 this, SLOT( setAllClose() ),0,7 );
523 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 525 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
524 this, SLOT( setAllFlat() ),0,8 ); 526 this, SLOT( setAllFlat() ),0,8 );
525 mPopupMenu->insertSeparator(); 527 mPopupMenu->insertSeparator();
526 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 528 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
527 this, SLOT( toggleQuickTodo() ),0,4 ); 529 this, SLOT( toggleQuickTodo() ),0,4 );
528 mDocPrefs = new DocPrefs( name ); 530 mDocPrefs = new DocPrefs( name );
529 531
530 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 532 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
531 mPopupMenu->setCheckable( true ); 533 mPopupMenu->setCheckable( true );
532 mItemPopupMenu->setCheckable( true ); 534 mItemPopupMenu->setCheckable( true );
533 535
534 536
535 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 537 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
536 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 538 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
537 539
538 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 540 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
539 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 541 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
540 542
541 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 543 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
542 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 544 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
543 545
544 546
545 // Double clicking conflicts with opening/closing the subtree 547 // Double clicking conflicts with opening/closing the subtree
546 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 548 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
547 SLOT( editItem( QListViewItem *) ) ); 549 SLOT( editItem( QListViewItem *) ) );
548 /* 550 /*
549 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 551 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
550 const QPoint &,int ) ), 552 const QPoint &,int ) ),
551 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 553 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
552 */ 554 */
553 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 555 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
554 const QPoint &,int ) ), 556 const QPoint &,int ) ),
555 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 557 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
556 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 558 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
557 SLOT( itemClicked( QListViewItem * ) ) ); 559 SLOT( itemClicked( QListViewItem * ) ) );
558 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 560 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
559 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 561 SLOT( itemDoubleClicked( QListViewItem * ) ) );
560 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 562 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
561 SLOT( updateView() ) ); 563 SLOT( updateView() ) );
562 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 564 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
563 SLOT( todoModified(Todo *, int) ) ); 565 SLOT( todoModified(Todo *, int) ) );
564 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 566 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
565 SLOT( itemStateChanged( QListViewItem * ) ) ); 567 SLOT( itemStateChanged( QListViewItem * ) ) );
566 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 568 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
567 SLOT( itemStateChanged( QListViewItem * ) ) ); 569 SLOT( itemStateChanged( QListViewItem * ) ) );
568 connect( mTodoListView, SIGNAL( paintNeeded() ), 570 connect( mTodoListView, SIGNAL( paintNeeded() ),
569 SLOT( paintNeeded()) ); 571 SLOT( paintNeeded()) );
570 572
571#if 0 573#if 0
572 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 574 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
573 SLOT(selectionChanged(QListViewItem *))); 575 SLOT(selectionChanged(QListViewItem *)));
574 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 576 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
575 SLOT(selectionChanged(QListViewItem *))); 577 SLOT(selectionChanged(QListViewItem *)));
576 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 578 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
577 SLOT(selectionChanged(QListViewItem *))); 579 SLOT(selectionChanged(QListViewItem *)));
578#endif 580#endif
579 581
580 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 582 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
581 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 583 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
582 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 584 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
583 585
584 connect( mTodoListView, SIGNAL(selectionChanged() ), 586 connect( mTodoListView, SIGNAL(selectionChanged() ),
585 SLOT( processSelectionChange() ) ); 587 SLOT( processSelectionChange() ) );
586 connect( mQuickAdd, SIGNAL( returnPressed () ), 588 connect( mQuickAdd, SIGNAL( returnPressed () ),
587 SLOT( addQuickTodo() ) ); 589 SLOT( addQuickTodo() ) );
588 590
589} 591}
590 592
591KOTodoView::~KOTodoView() 593KOTodoView::~KOTodoView()
592{ 594{
593 595
594#if QT_VERSION >= 0x030000 596#if QT_VERSION >= 0x030000
595 597
596#else 598#else
597 delete mKOTodoViewWhatsThis; 599 delete mKOTodoViewWhatsThis;
598#endif 600#endif
599 601
600 delete mDocPrefs; 602 delete mDocPrefs;
601} 603}
602QString KOTodoView::getWhatsThisText(QPoint p) 604QString KOTodoView::getWhatsThisText(QPoint p)
603{ 605{
604 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 606 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
605 if ( item ) 607 if ( item )
606 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 608 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
607 KOPrefs::instance()->mWTshowDetails, 609 KOPrefs::instance()->mWTshowDetails,
608 KOPrefs::instance()->mWTshowCreated, 610 KOPrefs::instance()->mWTshowCreated,
609 KOPrefs::instance()->mWTshowChanged); 611 KOPrefs::instance()->mWTshowChanged);
610 return i18n("That is the todo view" ); 612 return i18n("That is the todo view" );
611 613
612} 614}
613 615
614void KOTodoView::jumpToDate () 616void KOTodoView::jumpToDate ()
615{ 617{
616 // if (mActiveItem) { 618 // if (mActiveItem) {
617// mActiveItem->todo()); 619// mActiveItem->todo());
618// if ( mActiveItem->todo()->hasDueDate() ) 620// if ( mActiveItem->todo()->hasDueDate() )
619// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 621// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
620} 622}
621void KOTodoView::paintNeeded() 623void KOTodoView::paintNeeded()
622{ 624{
623 if ( mPendingUpdateBeforeRepaint ) { 625 if ( mPendingUpdateBeforeRepaint ) {
624 updateView(); 626 updateView();
625 mPendingUpdateBeforeRepaint = false; 627 mPendingUpdateBeforeRepaint = false;
626 } 628 }
627} 629}
628void KOTodoView::paintEvent(QPaintEvent * pevent) 630void KOTodoView::paintEvent(QPaintEvent * pevent)
629{ 631{
630 if ( mPendingUpdateBeforeRepaint ) { 632 if ( mPendingUpdateBeforeRepaint ) {
631 updateView(); 633 updateView();
632 mPendingUpdateBeforeRepaint = false; 634 mPendingUpdateBeforeRepaint = false;
633 } 635 }
634 KOrg::BaseView::paintEvent( pevent); 636 KOrg::BaseView::paintEvent( pevent);
635} 637}
636 638
637void KOTodoView::updateView() 639void KOTodoView::updateView()
638{ 640{
639 pendingSubtodo = 0; 641 pendingSubtodo = 0;
640 if ( mBlockUpdate ) { 642 if ( mBlockUpdate ) {
641 return; 643 return;
642 } 644 }
643 if ( !isVisible() ) { 645 if ( !isVisible() ) {
644 mPendingUpdateBeforeRepaint = true; 646 mPendingUpdateBeforeRepaint = true;
645 return; 647 return;
646 } 648 }
647 storeCurrentItem(); 649 storeCurrentItem();
648 //qDebug("KOTodoView::updateView() %x", this); 650 //qDebug("KOTodoView::updateView() %x", this);
649 if ( isFlatDisplay ) { 651 if ( isFlatDisplay ) {
650 displayAllFlat(); 652 displayAllFlat();
651 resetCurrentItem(); 653 resetCurrentItem();
652 return; 654 return;
653 } 655 }
654 //qDebug("update "); 656 //qDebug("update ");
655// kdDebug() << "KOTodoView::updateView()" << endl; 657// kdDebug() << "KOTodoView::updateView()" << endl;
656 QFont fo = KOPrefs::instance()->mTodoViewFont; 658 QFont fo = KOPrefs::instance()->mTodoViewFont;
657 659
658 660
659 mTodoListView->clear(); 661 mTodoListView->clear();
660 if ( mName == "todolistsmall" ) { 662 if ( mName == "todolistsmall" ) {
661 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 663 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
662 int ps = fo.pointSize() -2; 664 int ps = fo.pointSize() -2;
663 if ( ps > 12 ) 665 if ( ps > 12 )
664 ps -= 2; 666 ps -= 2;
665 fo.setPointSize( ps ); 667 fo.setPointSize( ps );
666 } 668 }
667 } 669 }
668 670
669 mTodoListView->setFont( fo ); 671 mTodoListView->setFont( fo );
670 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 672 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
671 //mTodoListView->header()->setMaximumHeight(fm.height()); 673 //mTodoListView->header()->setMaximumHeight(fm.height());
672 QPtrList<Todo> todoList = calendar()->todos(); 674 QPtrList<Todo> todoList = calendar()->todos();
673 675
674/* 676/*
675 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 677 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
676 Event *t; 678 Event *t;
677 for(t = todoList.first(); t; t = todoList.next()) { 679 for(t = todoList.first(); t; t = todoList.next()) {
678 kdDebug() << " " << t->getSummary() << endl; 680 kdDebug() << " " << t->getSummary() << endl;
679 681
680 if (t->getRelatedTo()) { 682 if (t->getRelatedTo()) {
681 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 683 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
682 } 684 }
683 685
684 QPtrList<Event> l = t->getRelations(); 686 QPtrList<Event> l = t->getRelations();
685 Event *c; 687 Event *c;
686 for(c=l.first();c;c=l.next()) { 688 for(c=l.first();c;c=l.next()) {
687 kdDebug() << " - relation: " << c->getSummary() << endl; 689 kdDebug() << " - relation: " << c->getSummary() << endl;
688 } 690 }
689 } 691 }
690*/ 692*/
691 693
692 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 694 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
693 // specific order of events. That means that we have to generate parent items 695 // specific order of events. That means that we have to generate parent items
694 // recursively for proper hierarchical display of Todos. 696 // recursively for proper hierarchical display of Todos.
695 mTodoMap.clear(); 697 mTodoMap.clear();
696 Todo *todo; 698 Todo *todo;
697 todo = todoList.first();// todo; todo = todoList.next()) { 699 todo = todoList.first();// todo; todo = todoList.next()) {
698 while ( todo ) { 700 while ( todo ) {
699 bool next = true; 701 bool next = true;
700 // qDebug("todo %s ", todo->summary().latin1()); 702 // qDebug("todo %s ", todo->summary().latin1());
701 Incidence *incidence = todo->relatedTo(); 703 Incidence *incidence = todo->relatedTo();
702 while ( incidence ) { 704 while ( incidence ) {
703 if ( incidence->type() == "Todo") { 705 if ( incidence->type() == "Todo") {
704 //qDebug("related %s ",incidence->summary().latin1() ); 706 //qDebug("related %s ",incidence->summary().latin1() );
705 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 707 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
706 //qDebug("related not found "); 708 //qDebug("related not found ");
707 todoList.remove( ); 709 todoList.remove( );
708 todo = todoList.current(); 710 todo = todoList.current();
709 next = false; 711 next = false;
710 incidence = 0; 712 incidence = 0;
711 713
712 } else { 714 } else {
713 //qDebug("related found "); 715 //qDebug("related found ");
714 incidence = incidence->relatedTo(); 716 incidence = incidence->relatedTo();
715 } 717 }
716 } else 718 } else
717 incidence = 0; 719 incidence = 0;
718 } 720 }
719 if ( next ) 721 if ( next )
720 todo = todoList.next(); 722 todo = todoList.next();
721 } 723 }
722 724
723 for(todo = todoList.first(); todo; todo = todoList.next()) { 725 for(todo = todoList.first(); todo; todo = todoList.next()) {
724 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 726 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
725 { 727 {
726 insertTodoItem(todo); 728 insertTodoItem(todo);
727 } 729 }
728 } 730 }
729 // Restore opened/closed state 731 // Restore opened/closed state
730 mTodoListView->blockSignals( true ); 732 mTodoListView->blockSignals( true );
731 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 733 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
732 mTodoListView->blockSignals( false ); 734 mTodoListView->blockSignals( false );
733 resetCurrentItem(); 735 resetCurrentItem();
734 processSelectionChange(); 736 processSelectionChange();
735} 737}
736 738
737void KOTodoView::storeCurrentItem() 739void KOTodoView::storeCurrentItem()
738{ 740{
739 mCurItem = 0; 741 mCurItem = 0;
740 mCurItemRootParent = 0; 742 mCurItemRootParent = 0;
741 mCurItemParent = 0; 743 mCurItemParent = 0;
742 mCurItemAbove = 0; 744 mCurItemAbove = 0;
743 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 745 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
744 if (mActiveItem) { 746 if (mActiveItem) {
745 mCurItem = mActiveItem->todo(); 747 mCurItem = mActiveItem->todo();
746 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 748 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
747 if ( activeItemAbove ) 749 if ( activeItemAbove )
748 mCurItemAbove = activeItemAbove->todo(); 750 mCurItemAbove = activeItemAbove->todo();
749 mCurItemRootParent = mCurItem; 751 mCurItemRootParent = mCurItem;
750 mCurItemParent = mCurItemRootParent->relatedTo(); 752 mCurItemParent = mCurItemRootParent->relatedTo();
751 while ( mCurItemRootParent->relatedTo() != 0 ) 753 while ( mCurItemRootParent->relatedTo() != 0 )
752 mCurItemRootParent = mCurItemRootParent->relatedTo(); 754 mCurItemRootParent = mCurItemRootParent->relatedTo();
753 } 755 }
754 mActiveItem = 0; 756 mActiveItem = 0;
755} 757}
756 758
757void KOTodoView::resetCurrentItem() 759void KOTodoView::resetCurrentItem()
758{ 760{
759 mTodoListView->setFocus(); 761 mTodoListView->setFocus();
760 KOTodoViewItem* foundItem = 0; 762 KOTodoViewItem* foundItem = 0;
761 KOTodoViewItem* foundItemRoot = 0; 763 KOTodoViewItem* foundItemRoot = 0;
762 KOTodoViewItem* foundItemParent = 0; 764 KOTodoViewItem* foundItemParent = 0;
763 KOTodoViewItem* foundItemAbove = 0; 765 KOTodoViewItem* foundItemAbove = 0;
764 if ( mTodoListView->firstChild () ) { 766 if ( mTodoListView->firstChild () ) {
765 if ( mCurItem ) { 767 if ( mCurItem ) {
766 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 768 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
767 while ( item ) { 769 while ( item ) {
768 if ( item->todo() == mCurItem ) { 770 if ( item->todo() == mCurItem ) {
769 foundItem = item; 771 foundItem = item;
770 break; 772 break;
771 } else if ( item->todo() == mCurItemAbove ) { 773 } else if ( item->todo() == mCurItemAbove ) {
772 foundItemAbove = item; 774 foundItemAbove = item;
773 775
774 } 776 }
775 if ( item->todo() == mCurItemRootParent ) { 777 if ( item->todo() == mCurItemRootParent ) {
776 foundItemRoot = item; 778 foundItemRoot = item;
777 } 779 }
778 if ( item->todo() == mCurItemParent ) { 780 if ( item->todo() == mCurItemParent ) {
779 foundItemParent = item; 781 foundItemParent = item;
780 } 782 }
781 item = (KOTodoViewItem*)item->itemBelow(); 783 item = (KOTodoViewItem*)item->itemBelow();
782 } 784 }
783 if ( ! foundItem ) { 785 if ( ! foundItem ) {
784 if ( foundItemParent ) { 786 if ( foundItemParent ) {
785 foundItem = foundItemParent; 787 foundItem = foundItemParent;
786 } else { 788 } else {
787 if ( foundItemRoot ) 789 if ( foundItemRoot )
788 foundItem = foundItemRoot; 790 foundItem = foundItemRoot;
789 else 791 else
790 foundItem = foundItemAbove; 792 foundItem = foundItemAbove;
791 } 793 }
792 } 794 }
793 } 795 }
794 if ( foundItem ) { 796 if ( foundItem ) {
795 mTodoListView->setCurrentItem( foundItem ); 797 mTodoListView->setCurrentItem( foundItem );
796 mTodoListView->ensureItemVisible( foundItem ); 798 mTodoListView->ensureItemVisible( foundItem );
797 } else { 799 } else {
798 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 800 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
799 } 801 }
800 } 802 }
801 mTodoListView->setFocus(); 803 mTodoListView->setFocus();
802} 804}
803//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 805//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
804bool KOTodoView::checkTodo( Todo * todo ) 806bool KOTodoView::checkTodo( Todo * todo )
805{ 807{
806 808
807 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 809 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
808 return false; 810 return false;
809 if ( !todo->isCompleted() ) { 811 if ( !todo->isCompleted() ) {
810 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 812 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
811 return true; 813 return true;
812 } 814 }
813 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 815 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
814 if ( todo->hasStartDate() ) 816 if ( todo->hasStartDate() )
815 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 817 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
816 return false; 818 return false;
817 if ( todo->hasDueDate() ) 819 if ( todo->hasDueDate() )
818 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 820 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
819 return false; 821 return false;
820 } 822 }
821 return true; 823 return true;
822} 824}
823 825
824void KOTodoView::restoreItemState( QListViewItem *item ) 826void KOTodoView::restoreItemState( QListViewItem *item )
825{ 827{
826 pendingSubtodo = 0; 828 pendingSubtodo = 0;
827 while( item ) { 829 while( item ) {
828 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 830 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
829 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 831 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
830 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 832 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
831 item = item->nextSibling(); 833 item = item->nextSibling();
832 } 834 }
833} 835}
834 836
835 837
836QMap<Todo *,KOTodoViewItem *>::ConstIterator 838QMap<Todo *,KOTodoViewItem *>::ConstIterator
837 KOTodoView::insertTodoItem(Todo *todo) 839 KOTodoView::insertTodoItem(Todo *todo)
838{ 840{
839 841
840// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 842// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
841 // TODO: Check, if dynmaic cast is necessary 843 // TODO: Check, if dynmaic cast is necessary
842 844
843 pendingSubtodo = 0; 845 pendingSubtodo = 0;
844 Incidence *incidence = todo->relatedTo(); 846 Incidence *incidence = todo->relatedTo();
845 if (incidence && incidence->type() == "Todo") { 847 if (incidence && incidence->type() == "Todo") {
846 Todo *relatedTodo = static_cast<Todo *>(incidence); 848 Todo *relatedTodo = static_cast<Todo *>(incidence);
847 849
848// kdDebug() << " has Related" << endl; 850// kdDebug() << " has Related" << endl;
849 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 851 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
850 itemIterator = mTodoMap.find(relatedTodo); 852 itemIterator = mTodoMap.find(relatedTodo);
851 if (itemIterator == mTodoMap.end()) { 853 if (itemIterator == mTodoMap.end()) {
852// kdDebug() << " related not yet in list" << endl; 854// kdDebug() << " related not yet in list" << endl;
853 itemIterator = insertTodoItem (relatedTodo); 855 itemIterator = insertTodoItem (relatedTodo);
854 } 856 }
855 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 857 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
856 // and one into the map. Sure finding is more easy but why? -zecke 858 // and one into the map. Sure finding is more easy but why? -zecke
857 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 859 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
858 return mTodoMap.insert(todo,todoItem); 860 return mTodoMap.insert(todo,todoItem);
859 } else { 861 } else {
860// kdDebug() << " no Related" << endl; 862// kdDebug() << " no Related" << endl;
861 // see above -zecke 863 // see above -zecke
862 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 864 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
863 return mTodoMap.insert(todo,todoItem); 865 return mTodoMap.insert(todo,todoItem);
864 } 866 }
865} 867}
866 868
867 869
868void KOTodoView::updateConfig() 870void KOTodoView::updateConfig()
869{ 871{
870 updateView(); 872 updateView();
871 mTodoListView->repaintContents(); 873 mTodoListView->repaintContents();
872} 874}
873 875
874QPtrList<Incidence> KOTodoView::selectedIncidences() 876QPtrList<Incidence> KOTodoView::selectedIncidences()
875{ 877{
876 QPtrList<Incidence> selected; 878 QPtrList<Incidence> selected;
877 879
878 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 880 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
879// if (!item) item = mActiveItem; 881// if (!item) item = mActiveItem;
880 if (item) selected.append(item->todo()); 882 if (item) selected.append(item->todo());
881 883
882 return selected; 884 return selected;
883} 885}
884 886
885QPtrList<Todo> KOTodoView::selectedTodos() 887QPtrList<Todo> KOTodoView::selectedTodos()
886{ 888{
887 QPtrList<Todo> selected; 889 QPtrList<Todo> selected;
888 890
889 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 891 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
890// if (!item) item = mActiveItem; 892// if (!item) item = mActiveItem;
891 if (item) selected.append(item->todo()); 893 if (item) selected.append(item->todo());
892 894
893 return selected; 895 return selected;
894} 896}
895 897
896void KOTodoView::changeEventDisplay(Event *, int) 898void KOTodoView::changeEventDisplay(Event *, int)
897{ 899{
898 updateView(); 900 updateView();
899} 901}
900 902
901void KOTodoView::showDates(const QDate &, const QDate &) 903void KOTodoView::showDates(const QDate &, const QDate &)
902{ 904{
903} 905}
904 906
905void KOTodoView::showEvents(QPtrList<Event>) 907void KOTodoView::showEvents(QPtrList<Event>)
906{ 908{
907 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 909 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
908} 910}
909 911
910void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 912void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
911 const QDate &td) 913 const QDate &td)
912{ 914{
913#ifndef KORG_NOPRINTER 915#ifndef KORG_NOPRINTER
914 calPrinter->preview(CalPrinter::Todolist, fd, td); 916 calPrinter->preview(CalPrinter::Todolist, fd, td);
915#endif 917#endif
916} 918}
917 919
918void KOTodoView::editItem(QListViewItem *item ) 920void KOTodoView::editItem(QListViewItem *item )
919{ 921{
920 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 922 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
921} 923}
922 924
923void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 925void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
924{ 926{
925 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 927 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
926} 928}
927 929
928void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 930void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
929{ 931{
930 pendingSubtodo = 0; 932 pendingSubtodo = 0;
931 mActiveItem = (KOTodoViewItem *)item; 933 mActiveItem = (KOTodoViewItem *)item;
932 if (item) { 934 if (item) {
933 switch (column){ 935 switch (column){
934 case 1: 936 case 1:
935 mPriorityPopupMenu->popup(QCursor::pos ()); break; 937 mPriorityPopupMenu->popup(QCursor::pos ()); break;
936 case 2: 938 case 2:
937 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 939 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
938 case 3: 940 case 3:
939 moveTodo(); 941 moveTodo();
940 break; 942 break;
941 case 8: 943 case 8:
942 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 944 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
943 default: 945 default:
944 mItemPopupMenu->popup(QCursor::pos()); 946 mItemPopupMenu->popup(QCursor::pos());
945 } 947 }
946 } else mPopupMenu->popup(QCursor::pos()); 948 } else mPopupMenu->popup(QCursor::pos());
947} 949}
948void KOTodoView::newTodo() 950void KOTodoView::newTodo()
949{ 951{
950 emit newTodoSignal(); 952 emit newTodoSignal();
951} 953}
952 954
953void KOTodoView::newSubTodo() 955void KOTodoView::newSubTodo()
954{ 956{
955 if (mActiveItem) { 957 if (mActiveItem) {
956 emit newSubTodoSignal(mActiveItem->todo()); 958 emit newSubTodoSignal(mActiveItem->todo());
957 } 959 }
958} 960}
959void KOTodoView::unparentTodo() 961void KOTodoView::unparentTodo()
960{ 962{
961 if (mActiveItem) { 963 if (mActiveItem) {
962 emit unparentTodoSignal(mActiveItem->todo()); 964 emit unparentTodoSignal(mActiveItem->todo());
963 } 965 }
964} 966}
965 967
966void KOTodoView::reparentTodo() 968void KOTodoView::reparentTodo()
967{ 969{
968 if (mActiveItem) { 970 if (mActiveItem) {
969 topLevelWidget()->setCaption(i18n("Click on new parent item")); 971 topLevelWidget()->setCaption(i18n("Click on new parent item"));
970 pendingSubtodo = mActiveItem; 972 pendingSubtodo = mActiveItem;
971 } 973 }
972} 974}
973void KOTodoView::editTodo() 975void KOTodoView::editTodo()
974{ 976{
975 if (mActiveItem) { 977 if (mActiveItem) {
976 emit editTodoSignal(mActiveItem->todo()); 978 emit editTodoSignal(mActiveItem->todo());
977 } 979 }
978} 980}
979void KOTodoView::cloneTodo() 981void KOTodoView::cloneTodo()
980{ 982{
981 if (mActiveItem) { 983 if (mActiveItem) {
982 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 984 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
983 } 985 }
984} 986}
985void KOTodoView::cancelTodo() 987void KOTodoView::cancelTodo()
986{ 988{
987 if (mActiveItem) { 989 if (mActiveItem) {
988 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 990 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
989 } 991 }
990} 992}
991void KOTodoView::moveTodo() 993void KOTodoView::moveTodo()
992{ 994{
993 if (mActiveItem) { 995 if (mActiveItem) {
994 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 996 emit moveTodoSignal((Incidence*)mActiveItem->todo());
995 } 997 }
996} 998}
997void KOTodoView::beamTodo() 999void KOTodoView::beamTodo()
998{ 1000{
999 if (mActiveItem) { 1001 if (mActiveItem) {
1000 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 1002 emit beamTodoSignal((Incidence*)mActiveItem->todo());
1001 } 1003 }
1002} 1004}
1003 1005
1004 1006
1005void KOTodoView::showTodo() 1007void KOTodoView::showTodo()
1006{ 1008{
1007 if (mActiveItem) { 1009 if (mActiveItem) {
1008 emit showTodoSignal(mActiveItem->todo()); 1010 emit showTodoSignal(mActiveItem->todo());
1009 } 1011 }
1010} 1012}
1011 1013
1012void KOTodoView::deleteTodo() 1014void KOTodoView::deleteTodo()
1013{ 1015{
1014 if (mActiveItem) { 1016 if (mActiveItem) {
1015 emit deleteTodoSignal(mActiveItem->todo()); 1017 emit deleteTodoSignal(mActiveItem->todo());
1016 } 1018 }
1017} 1019}
1018 1020
1019void KOTodoView::setNewPriority(int index) 1021void KOTodoView::setNewPriority(int index)
1020{ 1022{
1021 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1023 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1022 mActiveItem->todo()->setPriority(mPriority[index]); 1024 mActiveItem->todo()->setPriority(mPriority[index]);
1023 mActiveItem->construct(); 1025 mActiveItem->construct();
1024 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1026 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1025 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1027 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1026 } 1028 }
1027} 1029}
1028 1030
1029void KOTodoView::setNewPercentage(int index) 1031void KOTodoView::setNewPercentage(int index)
1030{ 1032{
1031 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1033 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1032 1034
1033 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1035 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1034 mActiveItem->setOn( true ); 1036 mActiveItem->setOn( true );
1035 return; 1037 return;
1036 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1038 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1037 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1039 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1038 if ( par && par->isOn() ) 1040 if ( par && par->isOn() )
1039 par->setOn( false ); 1041 par->setOn( false );
1040 } 1042 }
1041 if (mPercentage[index] == 100) { 1043 if (mPercentage[index] == 100) {
1042 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1044 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1043 } else { 1045 } else {
1044 mActiveItem->todo()->setCompleted(false); 1046 mActiveItem->todo()->setCompleted(false);
1045 } 1047 }
1046 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1048 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1047 mActiveItem->construct(); 1049 mActiveItem->construct();
1048 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1050 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1049 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1051 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1050 } 1052 }
1051} 1053}
1052 1054
1053 1055
1054QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 1056QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1055{ 1057{
1056 QPopupMenu* tempMenu = new QPopupMenu (this); 1058 QPopupMenu* tempMenu = new QPopupMenu (this);
1057 QStringList checkedCategories = todoItem->todo()->categories (); 1059 QStringList checkedCategories = todoItem->todo()->categories ();
1058 1060
1059 tempMenu->setCheckable (true); 1061 tempMenu->setCheckable (true);
1060 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1062 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1061 it != KOPrefs::instance()->mCustomCategories.end (); 1063 it != KOPrefs::instance()->mCustomCategories.end ();
1062 ++it) { 1064 ++it) {
1063 int index = tempMenu->insertItem (*it); 1065 int index = tempMenu->insertItem (*it);
1064 mCategory[index] = *it; 1066 mCategory[index] = *it;
1065 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1067 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1066 } 1068 }
1067 1069
1068 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1070 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1069 return tempMenu; 1071 return tempMenu;
1070 1072
1071 1073
1072} 1074}
1073void KOTodoView::changedCategories(int index) 1075void KOTodoView::changedCategories(int index)
1074{ 1076{
1075 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1077 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1076 QStringList categories = mActiveItem->todo()->categories (); 1078 QStringList categories = mActiveItem->todo()->categories ();
1077 QString colcat = categories.first(); 1079 QString colcat = categories.first();
1078 if (categories.find (mCategory[index]) != categories.end ()) 1080 if (categories.find (mCategory[index]) != categories.end ())
1079 categories.remove (mCategory[index]); 1081 categories.remove (mCategory[index]);
1080 else 1082 else
1081 categories.insert (categories.end(), mCategory[index]); 1083 categories.insert (categories.end(), mCategory[index]);
1082 categories.sort (); 1084 categories.sort ();
1083 if ( !colcat.isEmpty() ) { 1085 if ( !colcat.isEmpty() ) {
1084 if ( categories.find ( colcat ) != categories.end () ) { 1086 if ( categories.find ( colcat ) != categories.end () ) {
1085 categories.remove( colcat ); 1087 categories.remove( colcat );
1086 categories.prepend( colcat ); 1088 categories.prepend( colcat );
1087 } 1089 }
1088 } 1090 }
1089 mActiveItem->todo()->setCategories (categories); 1091 mActiveItem->todo()->setCategories (categories);
1090 mActiveItem->construct(); 1092 mActiveItem->construct();
1091 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1093 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1092 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1094 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1093 } 1095 }
1094} 1096}
1095void KOTodoView::itemDoubleClicked(QListViewItem *item) 1097void KOTodoView::itemDoubleClicked(QListViewItem *item)
1096{ 1098{
1097 if ( pendingSubtodo != 0 ) { 1099 if ( pendingSubtodo != 0 ) {
1098 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1100 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1099 } 1101 }
1100 pendingSubtodo = 0; 1102 pendingSubtodo = 0;
1101 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1103 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1102 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1104 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1103 //qDebug("ROW %d ", row); 1105 //qDebug("ROW %d ", row);
1104 if (!item) { 1106 if (!item) {
1105 newTodo(); 1107 newTodo();
1106 return; 1108 return;
1107 } else { 1109 } else {
1108 if ( row == 2 || row == 1 ) { 1110 if ( row == 2 || row == 1 ) {
1109 mActiveItem = (KOTodoViewItem *) item; 1111 mActiveItem = (KOTodoViewItem *) item;
1110 newSubTodo(); 1112 newSubTodo();
1111 return; 1113 return;
1112 } 1114 }
1113 if ( row == 5 || row == 6 ) { 1115 if ( row == 5 || row == 6 ) {
1114 mActiveItem = (KOTodoViewItem *) item; 1116 mActiveItem = (KOTodoViewItem *) item;
1115 toggleRunningItem(); 1117 toggleRunningItem();
1116 return; 1118 return;
1117 } 1119 }
1118 } 1120 }
1119 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1121 if ( KOPrefs::instance()->mEditOnDoubleClick )
1120 editItem( item ); 1122 editItem( item );
1121 else 1123 else
1122 showItem( item , QPoint(), 0 ); 1124 showItem( item , QPoint(), 0 );
1123} 1125}
1124void KOTodoView::toggleRunningItem() 1126void KOTodoView::toggleRunningItem()
1125{ 1127{
1126 // qDebug("KOTodoView::toggleRunning() "); 1128 // qDebug("KOTodoView::toggleRunning() ");
1127 if ( ! mActiveItem ) 1129 if ( ! mActiveItem )
1128 return; 1130 return;
1129 Todo * t = mActiveItem->todo(); 1131 Todo * t = mActiveItem->todo();
1130 if ( t->isRunning() ) { 1132 if ( t->isRunning() ) {
1131#if 0 1133#if 0
1132 int result = KMessageBox::warningContinueCancel(this, 1134 int result = KMessageBox::warningContinueCancel(this,
1133 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); 1135 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true);
1134#endif 1136#endif
1135 1137
1136 int result = KMessageBox::warningYesNoCancel(this, 1138 int result = KMessageBox::warningYesNoCancel(this,
1137 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); 1139 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note"));
1138 if (result == KMessageBox::Cancel) return; 1140 if (result == KMessageBox::Cancel) return;
1139 if ( result == KMessageBox::No ) { 1141 if ( result == KMessageBox::No ) {
1140 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); 1142 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") );
1141 t->setRunningFalse( comment ); 1143 t->setRunningFalse( comment );
1142 } else { 1144 } else {
1143 t->setRunning( false ); 1145 t->setRunning( false );
1144 } 1146 }
1145 mActiveItem->construct(); 1147 mActiveItem->construct();
1146 } else { 1148 } else {
1147 int result = KMessageBox::warningContinueCancel(this, 1149 int result = KMessageBox::warningContinueCancel(this,
1148 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); 1150 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true);
1149 if (result != KMessageBox::Continue) return; 1151 if (result != KMessageBox::Continue) return;
1150 t->setRunning( true ); 1152 t->setRunning( true );
1151 mActiveItem->construct(); 1153 mActiveItem->construct();
1152 } 1154 }
1153} 1155}
1154 1156
1155void KOTodoView::itemClicked(QListViewItem *item) 1157void KOTodoView::itemClicked(QListViewItem *item)
1156{ 1158{
1157 //qDebug("KOTodoView::itemClicked %d", item); 1159 //qDebug("KOTodoView::itemClicked %d", item);
1158 if (!item) { 1160 if (!item) {
1159 if ( pendingSubtodo != 0 ) { 1161 if ( pendingSubtodo != 0 ) {
1160 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1162 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1161 } 1163 }
1162 pendingSubtodo = 0; 1164 pendingSubtodo = 0;
1163 return; 1165 return;
1164 } 1166 }
1165 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1167 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1166 if ( pendingSubtodo != 0 ) { 1168 if ( pendingSubtodo != 0 ) {
1167 bool allowReparent = true; 1169 bool allowReparent = true;
1168 QListViewItem *par = item; 1170 QListViewItem *par = item;
1169 while ( par ) { 1171 while ( par ) {
1170 if ( par == pendingSubtodo ) { 1172 if ( par == pendingSubtodo ) {
1171 allowReparent = false; 1173 allowReparent = false;
1172 break; 1174 break;
1173 } 1175 }
1174 par = par->parent(); 1176 par = par->parent();
1175 } 1177 }
1176 if ( !allowReparent ) { 1178 if ( !allowReparent ) {
1177 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1179 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1178 pendingSubtodo = 0; 1180 pendingSubtodo = 0;
1179 } else { 1181 } else {
1180 Todo* newParent = todoItem->todo(); 1182 Todo* newParent = todoItem->todo();
1181 Todo* newSub = pendingSubtodo->todo(); 1183 Todo* newSub = pendingSubtodo->todo();
1182 pendingSubtodo = 0; 1184 pendingSubtodo = 0;
1183 emit reparentTodoSignal( newParent,newSub ); 1185 emit reparentTodoSignal( newParent,newSub );
1184 return; 1186 return;
1185 } 1187 }
1186 } 1188 }
1187 1189
1188} 1190}
1189 1191
1190void KOTodoView::setDocumentId( const QString &id ) 1192void KOTodoView::setDocumentId( const QString &id )
1191{ 1193{
1192 1194
1193 mDocPrefs->setDoc( id ); 1195 mDocPrefs->setDoc( id );
1194} 1196}
1195 1197
1196void KOTodoView::itemStateChanged( QListViewItem *item ) 1198void KOTodoView::itemStateChanged( QListViewItem *item )
1197{ 1199{
1198 if (!item) return; 1200 if (!item) return;
1199 1201
1200 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1202 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1201 1203
1202// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1204// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1203 1205
1204 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1206 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1205} 1207}
1206 1208
1207void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1209void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1208{ 1210{
1209 mTodoListView->saveLayout(config,group); 1211 mTodoListView->saveLayout(config,group);
1210} 1212}
1211 1213
1212void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1214void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1213{ 1215{
1214 mTodoListView->restoreLayout(config,group); 1216 mTodoListView->restoreLayout(config,group);
1215} 1217}
1216 1218
1217void KOTodoView::processSelectionChange() 1219void KOTodoView::processSelectionChange()
1218{ 1220{
1219// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1221// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1220 1222
1221 KOTodoViewItem *item = 1223 KOTodoViewItem *item =
1222 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1224 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1223 1225
1224 if ( !item ) { 1226 if ( !item ) {
1225 emit incidenceSelected( 0 ); 1227 emit incidenceSelected( 0 );
1226 } else { 1228 } else {
1227 emit incidenceSelected( item->todo() ); 1229 emit incidenceSelected( item->todo() );
1228 } 1230 }
1229} 1231}
1230 1232
1231void KOTodoView::modified(bool b) 1233void KOTodoView::modified(bool b)
1232{ 1234{
1233 emit isModified(b); 1235 emit isModified(b);
1234} 1236}
1235void KOTodoView::setTodoModified( Todo* todo ) 1237void KOTodoView::setTodoModified( Todo* todo )
1236{ 1238{
1237 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1239 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1238} 1240}
1239void KOTodoView::clearSelection() 1241void KOTodoView::clearSelection()
1240{ 1242{
1241 mTodoListView->selectAll( false ); 1243 mTodoListView->selectAll( false );
1242} 1244}
1243void KOTodoView::setAllOpen() 1245void KOTodoView::setAllOpen()
1244{ 1246{
1245 if ( isFlatDisplay ) { 1247 if ( isFlatDisplay ) {
1246 isFlatDisplay = false; 1248 isFlatDisplay = false;
1247 mPopupMenu->setItemChecked( 8,false ); 1249 mPopupMenu->setItemChecked( 8,false );
1248 updateView(); 1250 updateView();
1249 } else { 1251 } else {
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 94d7293..1320231 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1567 +1,1571 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64#include <kglobalsettings.h> 64#include <kglobalsettings.h>
65 65
66using namespace KCal; 66using namespace KCal;
67#ifndef _WIN32_ 67#ifndef _WIN32_
68#include <unistd.h> 68#include <unistd.h>
69#else 69#else
70#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 71#include "koimportoldialog.h"
72#endif 72#endif
73#endif 73#endif
74#include "mainwindow.h" 74#include "mainwindow.h"
75 75
76 76
77class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
78{ 78{
79 public: 79 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
82 { 82 {
83 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
87 QLabel *lab; 87 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 90 QHBox* temphb;
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132int globalFlagBlockStartup; 132int globalFlagBlockStartup;
133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
134 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
135{ 135{
136 136
137 mClosed = false; 137 mClosed = false;
138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
139 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
140 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
141 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
142 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
143 mBlockAtStartup = true; 143 mBlockAtStartup = true;
144 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 p->mCurrentDisplayedView = 0; 148 p->mCurrentDisplayedView = 0;
149 if ( p->mHourSize > 22 ) 149 if ( p->mHourSize > 22 )
150 p->mHourSize = 22; 150 p->mHourSize = 22;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 169
170#ifdef DESKTOP_VERSION 170#ifdef DESKTOP_VERSION
171 if ( KOPrefs::instance()->mShowIconFilter ) 171 if ( KOPrefs::instance()->mShowIconFilter )
172#else 172#else
173 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 173 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
174#endif 174#endif
175 175
176{ 176{
177 if ( p->mToolBarHorF ) { 177 if ( p->mToolBarHorF ) {
178 if ( p->mToolBarUpF ) 178 if ( p->mToolBarUpF )
179 tbd = Bottom; 179 tbd = Bottom;
180 else 180 else
181 tbd = Top; 181 tbd = Top;
182 } 182 }
183 else { 183 else {
184 if ( p->mToolBarUpF ) 184 if ( p->mToolBarUpF )
185 tbd = Right; 185 tbd = Right;
186 else 186 else
187 tbd = Left; 187 tbd = Left;
188 } 188 }
189 filterToolBar = new QPEToolBar ( this ); 189 filterToolBar = new QPEToolBar ( this );
190 filterMenubar = new QMenuBar( 0 ); 190 filterMenubar = new QMenuBar( 0 );
191 QFontMetrics fm ( filterMenubar->font() ); 191 QFontMetrics fm ( filterMenubar->font() );
192 192
193 filterPopupMenu = new QPopupMenu( this ); 193 filterPopupMenu = new QPopupMenu( this );
194 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 194 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
195 QString addTest = "A"; 195 QString addTest = "A";
196 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 196 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
197#ifdef DESKTOP_VERSION 197#ifdef DESKTOP_VERSION
198 addTest = "AAABBBCCCx"; 198 addTest = "AAABBBCCCx";
199#else 199#else
200 addTest = "AAx"; 200 addTest = "AAx";
201#endif 201#endif
202 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 202 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
203 addToolBar (filterToolBar , tbd ); 203 addToolBar (filterToolBar , tbd );
204 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 204 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
205 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 205 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
206 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 206 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
207 filterToolBar->hide(); 207 filterToolBar->hide();
208 } else { 208 } else {
209 filterToolBar = 0; 209 filterToolBar = 0;
210 filterMenubar = 0; 210 filterMenubar = 0;
211 filterPopupMenu = 0; 211 filterPopupMenu = 0;
212 } 212 }
213 if ( p->mShowIconOnetoolbar ) { 213 if ( p->mShowIconOnetoolbar ) {
214 viewToolBar = iconToolBar ; 214 viewToolBar = iconToolBar ;
215 navigatorToolBar = iconToolBar ; 215 navigatorToolBar = iconToolBar ;
216 } else { 216 } else {
217#ifndef DESKTOP_VERSION 217#ifndef DESKTOP_VERSION
218 setToolBarsMovable( false ); 218 setToolBarsMovable( false );
219#endif 219#endif
220 if ( p->mToolBarHorV ) { 220 if ( p->mToolBarHorV ) {
221 if ( p->mToolBarUpV ) 221 if ( p->mToolBarUpV )
222 tbd = Bottom; 222 tbd = Bottom;
223 else 223 else
224 tbd = Top; 224 tbd = Top;
225 } 225 }
226 else { 226 else {
227 if ( p->mToolBarUpV ) 227 if ( p->mToolBarUpV )
228 tbd = Right; 228 tbd = Right;
229 else 229 else
230 tbd = Left; 230 tbd = Left;
231 } 231 }
232 viewToolBar = new QPEToolBar( this ); 232 viewToolBar = new QPEToolBar( this );
233 addToolBar (viewToolBar , tbd ); 233 addToolBar (viewToolBar , tbd );
234 if ( p->mToolBarHorN ) { 234 if ( p->mToolBarHorN ) {
235 if ( p->mToolBarUpN ) 235 if ( p->mToolBarUpN )
236 tbd = Bottom; 236 tbd = Bottom;
237 else 237 else
238 tbd = Top; 238 tbd = Top;
239 } 239 }
240 else { 240 else {
241 if ( p->mToolBarUpN ) 241 if ( p->mToolBarUpN )
242 tbd = Right; 242 tbd = Right;
243 else 243 else
244 tbd = Left; 244 tbd = Left;
245 } 245 }
246 navigatorToolBar = new QPEToolBar( this ); 246 navigatorToolBar = new QPEToolBar( this );
247 addToolBar (navigatorToolBar , tbd ); 247 addToolBar (navigatorToolBar , tbd );
248 } 248 }
249 249
250 250
251 251
252 mCalendarModifiedFlag = false; 252 mCalendarModifiedFlag = false;
253 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 253 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
254 splash->setAlignment ( AlignCenter ); 254 splash->setAlignment ( AlignCenter );
255 setCentralWidget( splash ); 255 setCentralWidget( splash );
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 showMaximized(); 257 showMaximized();
258#endif 258#endif
259 259
260 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 260 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
261 setDefaultPreferences(); 261 setDefaultPreferences();
262 mCalendar = new CalendarLocal(); 262 mCalendar = new CalendarLocal();
263 mView = new CalendarView( mCalendar, this,"mCalendar " ); 263 mView = new CalendarView( mCalendar, this,"mCalendar " );
264 mView->hide(); 264 mView->hide();
265 //mView->resize(splash->size() ); 265 //mView->resize(splash->size() );
266 initActions(); 266 initActions();
267 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 267 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
268 mSyncManager->setBlockSave(false); 268 mSyncManager->setBlockSave(false);
269 mView->setSyncManager(mSyncManager); 269 mView->setSyncManager(mSyncManager);
270#ifndef DESKTOP_VERSION 270#ifndef DESKTOP_VERSION
271 iconToolBar->show(); 271 iconToolBar->show();
272 qApp->processEvents(); 272 qApp->processEvents();
273#endif 273#endif
274 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 274 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
275 int vh = height() ; 275 int vh = height() ;
276 int vw = width(); 276 int vw = width();
277 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 277 //qDebug("Toolbar hei %d ",iconToolBar->height() );
278 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 278 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
279 vh -= iconToolBar->height(); 279 vh -= iconToolBar->height();
280 } else { 280 } else {
281 vw -= iconToolBar->height(); 281 vw -= iconToolBar->height();
282 } 282 }
283 //mView->setMaximumSize( splash->size() ); 283 //mView->setMaximumSize( splash->size() );
284 //mView->resize( splash->size() ); 284 //mView->resize( splash->size() );
285 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 285 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
286 mView->readSettings(); 286 mView->readSettings();
287 bool newFile = false; 287 bool newFile = false;
288 if( !QFile::exists( defaultFileName() ) ) { 288 if( !QFile::exists( defaultFileName() ) ) {
289 QFileInfo finfo ( defaultFileName() ); 289 QFileInfo finfo ( defaultFileName() );
290 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 290 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
291 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 291 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
292 finfo.setFile( oldFile ); 292 finfo.setFile( oldFile );
293 if (finfo.exists() ) { 293 if (finfo.exists() ) {
294 KMessageBox::information( this, message); 294 KMessageBox::information( this, message);
295 mView->openCalendar( oldFile ); 295 mView->openCalendar( oldFile );
296 qApp->processEvents(); 296 qApp->processEvents();
297 } else { 297 } else {
298 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 298 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
299 finfo.setFile( oldFile ); 299 finfo.setFile( oldFile );
300 if (finfo.exists() ) { 300 if (finfo.exists() ) {
301 KMessageBox::information( this, message); 301 KMessageBox::information( this, message);
302 mView->openCalendar( oldFile ); 302 mView->openCalendar( oldFile );
303 qApp->processEvents(); 303 qApp->processEvents();
304 } 304 }
305 } 305 }
306 mView->saveCalendar( defaultFileName() ); 306 mView->saveCalendar( defaultFileName() );
307 newFile = true; 307 newFile = true;
308 } 308 }
309 309
310 QTime neededSaveTime = QDateTime::currentDateTime().time(); 310 QTime neededSaveTime = QDateTime::currentDateTime().time();
311 mView->openCalendar( defaultFileName() ); 311 mView->openCalendar( defaultFileName() );
312 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 312 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
313 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 313 qDebug("KO: Calendar loading time: %d ms",msNeeded );
314 314
315 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 315 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
316 KOPrefs::instance()->setAllDefaults(); 316 KOPrefs::instance()->setAllDefaults();
317 int count = mView->addCategories(); 317 int count = mView->addCategories();
318 } 318 }
319 processIncidenceSelection( 0 ); 319 processIncidenceSelection( 0 );
320 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 320 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
321 SLOT( processIncidenceSelection( Incidence * ) ) ); 321 SLOT( processIncidenceSelection( Incidence * ) ) );
322 connect( mView, SIGNAL( modifiedChanged( bool ) ), 322 connect( mView, SIGNAL( modifiedChanged( bool ) ),
323 SLOT( slotModifiedChanged( bool ) ) ); 323 SLOT( slotModifiedChanged( bool ) ) );
324 324
325 325
326 connect( mView, SIGNAL( tempDisableBR(bool) ), 326 connect( mView, SIGNAL( tempDisableBR(bool) ),
327 SLOT( disableBR(bool) ) ); 327 SLOT( disableBR(bool) ) );
328 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 328 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
329 mView->setModified( false ); 329 mView->setModified( false );
330 mBlockAtStartup = false; 330 mBlockAtStartup = false;
331 mView->setModified( false ); 331 mView->setModified( false );
332 setCentralWidget( mView ); 332 setCentralWidget( mView );
333 globalFlagBlockStartup = 0; 333 globalFlagBlockStartup = 0;
334 mView->show(); 334 mView->show();
335 delete splash; 335 delete splash;
336 if ( newFile ) 336 if ( newFile )
337 mView->updateConfig(); 337 mView->updateConfig();
338 // qApp->processEvents(); 338 // qApp->processEvents();
339 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 339 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
340 //fillSyncMenu(); 340 //fillSyncMenu();
341 341
342 342
343 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 343 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
344 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 344 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
345 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 345 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
346 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 346 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
347 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 347 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
348 mSyncManager->setDefaultFileName( sentSyncFile()); 348 mSyncManager->setDefaultFileName( sentSyncFile());
349 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 349 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
350 mSyncManager->fillSyncMenu(); 350 mSyncManager->fillSyncMenu();
351 351
352 352
353 353
354 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 354 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
355 if ( showWarning ) { 355 if ( showWarning ) {
356 KMessageBox::information( this, 356 KMessageBox::information( this,
357 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 357 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
358 qApp->processEvents(); 358 qApp->processEvents();
359 mView->dialogManager()->showSyncOptions(); 359 mView->dialogManager()->showSyncOptions();
360 } 360 }
361 361
362 //US listen for result adressed from Ka/Pi 362 //US listen for result adressed from Ka/Pi
363#ifndef DESKTOP_VERSION 363#ifndef DESKTOP_VERSION
364 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 364 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
365#endif 365#endif
366#ifndef DESKTOP_VERSION 366#ifndef DESKTOP_VERSION
367 infrared = 0; 367 infrared = 0;
368#endif 368#endif
369 updateFilterToolbar(); 369 updateFilterToolbar();
370 updateWeek( mView->startDate() ); 370 updateWeek( mView->startDate() );
371 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 371 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
372 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 372 SLOT( updateWeekNum( const KCal::DateList & ) ) );
373 mBRdisabled = false; 373 mBRdisabled = false;
374 //toggleBeamReceive(); 374 //toggleBeamReceive();
375
376 QTimer::singleShot( 1000, mView, SLOT ( checkAlarms() ));
375} 377}
376MainWindow::~MainWindow() 378MainWindow::~MainWindow()
377{ 379{
378 //qDebug("MainWindow::~MainWindow() "); 380 //qDebug("MainWindow::~MainWindow() ");
379 //save toolbar location 381 //save toolbar location
380 delete mCalendar; 382 delete mCalendar;
381 delete mSyncManager; 383 delete mSyncManager;
382#ifndef DESKTOP_VERSION 384#ifndef DESKTOP_VERSION
383 if ( infrared ) 385 if ( infrared )
384 delete infrared; 386 delete infrared;
385#endif 387#endif
386 388
387 389
388} 390}
389 391
390void MainWindow::disableBR(bool b) 392void MainWindow::disableBR(bool b)
391{ 393{
392#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
393 if ( b ) { 395 if ( b ) {
394 if ( infrared ) { 396 if ( infrared ) {
395 toggleBeamReceive(); 397 toggleBeamReceive();
396 mBRdisabled = true; 398 mBRdisabled = true;
397 } 399 }
398 mBRdisabled = true; 400 mBRdisabled = true;
399 } else { 401 } else {
400 if ( mBRdisabled ) { 402 if ( mBRdisabled ) {
401 mBRdisabled = false; 403 mBRdisabled = false;
402 //makes no sense,because other cal ap is probably running 404 //makes no sense,because other cal ap is probably running
403 // toggleBeamReceive(); 405 // toggleBeamReceive();
404 } 406 }
405 } 407 }
406#endif 408#endif
407 409
408} 410}
409bool MainWindow::beamReceiveEnabled() 411bool MainWindow::beamReceiveEnabled()
410{ 412{
411#ifndef DESKTOP_VERSION 413#ifndef DESKTOP_VERSION
412 return ( infrared != 0 ); 414 return ( infrared != 0 );
413#endif 415#endif
414 return false; 416 return false;
415} 417}
416 418
417void MainWindow::toggleBeamReceive() 419void MainWindow::toggleBeamReceive()
418{ 420{
419 if ( mBRdisabled ) 421 if ( mBRdisabled )
420 return; 422 return;
421#ifndef DESKTOP_VERSION 423#ifndef DESKTOP_VERSION
422 if ( infrared ) { 424 if ( infrared ) {
423 qDebug("KO: Disable BeamReceive "); 425 qDebug("KO: Disable BeamReceive ");
424 delete infrared; 426 delete infrared;
425 infrared = 0; 427 infrared = 0;
426 brAction->setOn(false); 428 brAction->setOn(false);
427 return; 429 return;
428 } 430 }
429 qDebug("KO: Enable BeamReceive "); 431 qDebug("KO: Enable BeamReceive ");
430 brAction->setOn(true); 432 brAction->setOn(true);
431 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 433 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
432 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 434 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
433#endif 435#endif
434} 436}
435void MainWindow::showMaximized () 437void MainWindow::showMaximized ()
436{ 438{
437#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
438 if ( ! globalFlagBlockStartup ) 440 if ( ! globalFlagBlockStartup )
439 if ( mClosed ) 441 if ( mClosed )
440 mView->goToday(); 442 mView->goToday();
441#endif 443#endif
442 QWidget::showMaximized () ; 444 QWidget::showMaximized () ;
443 mClosed = false; 445 mClosed = false;
444} 446}
445void MainWindow::closeEvent( QCloseEvent* ce ) 447void MainWindow::closeEvent( QCloseEvent* ce )
446{ 448{
447 449
448 450
449 451
450 if ( ! KOPrefs::instance()->mAskForQuit ) { 452 if ( ! KOPrefs::instance()->mAskForQuit ) {
451 saveOnClose(); 453 saveOnClose();
452 mClosed = true; 454 mClosed = true;
453 ce->accept(); 455 ce->accept();
454 return; 456 return;
455 457
456 } 458 }
457 459
458 switch( QMessageBox::information( this, "KO/Pi", 460 switch( QMessageBox::information( this, "KO/Pi",
459 i18n("Do you really want\nto close KO/Pi?"), 461 i18n("Do you really want\nto close KO/Pi?"),
460 i18n("Close"), i18n("No"), 462 i18n("Close"), i18n("No"),
461 0, 0 ) ) { 463 0, 0 ) ) {
462 case 0: 464 case 0:
463 saveOnClose(); 465 saveOnClose();
464 mClosed = true; 466 mClosed = true;
465 ce->accept(); 467 ce->accept();
466 break; 468 break;
467 case 1: 469 case 1:
468 ce->ignore(); 470 ce->ignore();
469 break; 471 break;
470 case 2: 472 case 2:
471 473
472 default: 474 default:
473 break; 475 break;
474 } 476 }
475 477
476 478
477} 479}
478 480
479void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 481void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
480{ 482{
481 QDataStream stream( data, IO_ReadOnly ); 483 QDataStream stream( data, IO_ReadOnly );
482 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 484 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
483 //QString datamess; 485 //QString datamess;
484 //qDebug("message "); 486 //qDebug("message ");
485 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 487 qDebug("KO: QCOP message received: %s ", cmsg.data() );
486 488
487 if ( cmsg == "setDocument(QString)" ) { 489 if ( cmsg == "setDocument(QString)" ) {
488 QDataStream stream( data, IO_ReadOnly ); 490 QDataStream stream( data, IO_ReadOnly );
489 QString fileName; 491 QString fileName;
490 stream >> fileName; 492 stream >> fileName;
491 //qDebug("filename %s ", fileName.latin1()); 493 //qDebug("filename %s ", fileName.latin1());
492 showMaximized(); 494 showMaximized();
493 raise(); 495 raise();
494 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 496 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
495 mSyncManager->slotSyncMenu( 1002 ); 497 mSyncManager->slotSyncMenu( 1002 );
496 return; 498 return;
497 } 499 }
498 500
499 if ( cmsg == "-writeFile" ) { 501 if ( cmsg == "-writeFile" ) {
500 // I made from the "-writeFile" an "-writeAlarm" 502 // I made from the "-writeFile" an "-writeAlarm"
501 mView->viewManager()->showWhatsNextView(); 503 mView->viewManager()->showWhatsNextView();
502 mCalendar->checkAlarmForIncidence( 0, true); 504 mCalendar->checkAlarmForIncidence( 0, true);
503 showMaximized(); 505 showMaximized();
504 raise(); 506 raise();
505 return; 507 return;
506 508
507 } 509 }
508 if ( cmsg == "-writeFileSilent" ) { 510 if ( cmsg == "-writeFileSilent" ) {
509 // I made from the "-writeFile" an "-writeAlarm" 511 // I made from the "-writeFile" an "-writeAlarm"
510 // mView->viewManager()->showWhatsNextView(); 512 // mView->viewManager()->showWhatsNextView();
511 mCalendar->checkAlarmForIncidence( 0, true); 513 mCalendar->checkAlarmForIncidence( 0, true);
512 //showMaximized(); 514 //showMaximized();
513 //raise(); 515 //raise();
514 hide(); 516 hide();
515 return; 517 return;
516 } 518 }
517 if ( cmsg == "-newCountdown" ) { 519 if ( cmsg == "-newCountdown" ) {
518 qDebug("newCountdown "); 520 qDebug("newCountdown ");
519 521
520 } 522 }
521 QString msg ; 523 QString msg ;
522 QString allmsg = cmsg; 524 QString allmsg = cmsg;
523 while ( allmsg.length() > 0 ) { 525 while ( allmsg.length() > 0 ) {
524 int nextC = allmsg.find( "-", 1 ); 526 int nextC = allmsg.find( "-", 1 );
525 if ( nextC == -1 ) { 527 if ( nextC == -1 ) {
526 msg = allmsg; 528 msg = allmsg;
527 allmsg = ""; 529 allmsg = "";
528 } else{ 530 } else{
529 msg = allmsg.left( nextC ); 531 msg = allmsg.left( nextC );
530 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 532 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
531 } 533 }
532 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 534 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
533 if ( msg == "-newEvent" ) { 535 if ( msg == "-newEvent" ) {
534 mView->newEvent(); 536 mView->newEvent();
535 } 537 }
536 if ( msg == "-newTodo" ) { 538 if ( msg == "-newTodo" ) {
537 mView->newTodo(); 539 mView->newTodo();
538 540
539 } 541 }
540 if ( msg == "-showWN" ) { 542 if ( msg == "-showWN" ) {
541 mView->viewManager()->showWhatsNextView(); 543 mView->viewManager()->showWhatsNextView();
542 } 544 }
543 if ( msg == "-showTodo" ) { 545 if ( msg == "-showTodo" ) {
544 mView->viewManager()->showTodoView(); 546 mView->viewManager()->showTodoView();
545 } 547 }
546 if ( msg == "-showList" ) { 548 if ( msg == "-showList" ) {
547 mView->viewManager()->showListView(); 549 mView->viewManager()->showListView();
548 } 550 }
549 else if ( msg == "-showDay" ) { 551 else if ( msg == "-showDay" ) {
550 mView->viewManager()->showDayView(); 552 mView->viewManager()->showDayView();
551 } 553 }
552 else if ( msg == "-showWWeek" ) { 554 else if ( msg == "-showWWeek" ) {
553 mView->viewManager()->showWorkWeekView(); 555 mView->viewManager()->showWorkWeekView();
554 } 556 }
555 else if ( msg == "-ringSync" ) { 557 else if ( msg == "-ringSync" ) {
556 mSyncManager->multiSync( false ); 558 mSyncManager->multiSync( false );
557 } 559 }
558 else if ( msg == "-showWeek" ) { 560 else if ( msg == "-showWeek" ) {
559 mView->viewManager()->showWeekView(); 561 mView->viewManager()->showWeekView();
560 } 562 }
561 else if ( msg == "-showTodo" ) { 563 else if ( msg == "-showTodo" ) {
562 mView->viewManager()->showTodoView(); 564 mView->viewManager()->showTodoView();
563 } 565 }
564 else if ( msg == "-showJournal" ) { 566 else if ( msg == "-showJournal" ) {
565 mView->dateNavigator()->selectDates( 1 ); 567 mView->dateNavigator()->selectDates( 1 );
566 mView->dateNavigator()->selectToday(); 568 mView->dateNavigator()->selectToday();
567 mView->viewManager()->showJournalView(); 569 mView->viewManager()->showJournalView();
568 } 570 }
569 else if ( msg == "-showKO" ) { 571 else if ( msg == "-showKO" ) {
570 mView->viewManager()->showNextXView(); 572 mView->viewManager()->showNextXView();
571 } 573 }
572 else if ( msg == "-showWNext" ) { 574 else if ( msg == "-showWNext" ) {
573 mView->viewManager()->showWhatsNextView(); 575 mView->viewManager()->showWhatsNextView();
574 } 576 }
575 else if ( msg == "nextView()" ) { 577 else if ( msg == "nextView()" ) {
576 mView->viewManager()->showNextView(); 578 mView->viewManager()->showNextView();
577 } 579 }
578 else if ( msg == "-showNextXView" ) { 580 else if ( msg == "-showNextXView" ) {
579 mView->viewManager()->showNextXView(); 581 mView->viewManager()->showNextXView();
580 } 582 }
581 583
582 584
583 } 585 }
584 586
585 showMaximized(); 587 showMaximized();
586 raise(); 588 raise();
587} 589}
588 590
589QPixmap MainWindow::loadPixmap( QString name ) 591QPixmap MainWindow::loadPixmap( QString name )
590{ 592{
591 return SmallIcon( name ); 593 return SmallIcon( name );
592 594
593} 595}
594void MainWindow::setUsesBigPixmaps ( bool b ) 596void MainWindow::setUsesBigPixmaps ( bool b )
595{ 597{
596 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 598 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
597 if ( b ) 599 if ( b )
598 qDebug("KO: BigPixmaps are not supported "); 600 qDebug("KO: BigPixmaps are not supported ");
599} 601}
600void MainWindow::initActions() 602void MainWindow::initActions()
601{ 603{
602 //KOPrefs::instance()->mShowFullMenu 604 //KOPrefs::instance()->mShowFullMenu
603 iconToolBar->clear(); 605 iconToolBar->clear();
604 KOPrefs *p = KOPrefs::instance(); 606 KOPrefs *p = KOPrefs::instance();
605 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 607 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
606 608
607 QPopupMenu *viewMenu = new QPopupMenu( this ); 609 QPopupMenu *viewMenu = new QPopupMenu( this );
608 QPopupMenu *actionMenu = new QPopupMenu( this ); 610 QPopupMenu *actionMenu = new QPopupMenu( this );
609 QPopupMenu *importMenu = new QPopupMenu( this ); 611 QPopupMenu *importMenu = new QPopupMenu( this );
610 QPopupMenu *importMenu_X = new QPopupMenu( this ); 612 QPopupMenu *importMenu_X = new QPopupMenu( this );
611 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 613 QPopupMenu *exportMenu_X = new QPopupMenu( this );
612 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 614 QPopupMenu *beamMenu_X = new QPopupMenu( this );
613 selectFilterMenu = new QPopupMenu( this ); 615 selectFilterMenu = new QPopupMenu( this );
614 selectFilterMenu->setCheckable( true ); 616 selectFilterMenu->setCheckable( true );
615 syncMenu = new QPopupMenu( this ); 617 syncMenu = new QPopupMenu( this );
616 configureAgendaMenu = new QPopupMenu( this ); 618 configureAgendaMenu = new QPopupMenu( this );
617 configureToolBarMenu = new QPopupMenu( this ); 619 configureToolBarMenu = new QPopupMenu( this );
618 QPopupMenu *helpMenu = new QPopupMenu( this ); 620 QPopupMenu *helpMenu = new QPopupMenu( this );
619 QIconSet icon; 621 QIconSet icon;
620 int pixWid = 22, pixHei = 22; 622 int pixWid = 22, pixHei = 22;
621 QString pathString = ""; 623 QString pathString = "";
622 if ( !p->mToolBarMiniIcons ) { 624 if ( !p->mToolBarMiniIcons ) {
623 if ( QApplication::desktop()->width() < 480 ) { 625 if ( QApplication::desktop()->width() < 480 ) {
624 pathString += "icons16/"; 626 pathString += "icons16/";
625 pixWid = 18; pixHei = 16; 627 pixWid = 18; pixHei = 16;
626 } 628 }
627 } else { 629 } else {
628 pathString += "iconsmini/"; 630 pathString += "iconsmini/";
629 pixWid = 18; pixHei = 16; 631 pixWid = 18; pixHei = 16;
630 } 632 }
631 if ( KOPrefs::instance()->mShowFullMenu ) { 633 if ( KOPrefs::instance()->mShowFullMenu ) {
632 QMenuBar *menuBar1; 634 QMenuBar *menuBar1;
633 menuBar1 = menuBar(); 635 menuBar1 = menuBar();
634 menuBar1->insertItem( i18n("File"), importMenu ); 636 menuBar1->insertItem( i18n("File"), importMenu );
635 menuBar1->insertItem( i18n("View"), viewMenu ); 637 menuBar1->insertItem( i18n("View"), viewMenu );
636 menuBar1->insertItem( i18n("Actions"), actionMenu ); 638 menuBar1->insertItem( i18n("Actions"), actionMenu );
637#ifdef DESKTOP_VERSION 639#ifdef DESKTOP_VERSION
638 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 640 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
639 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 641 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
640#else 642#else
641 menuBar1->insertItem( i18n("Sync"), syncMenu ); 643 menuBar1->insertItem( i18n("Sync"), syncMenu );
642 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 644 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
643#endif 645#endif
644 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 646 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
645 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 647 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
646 menuBar1->insertItem( i18n("Help"), helpMenu ); 648 menuBar1->insertItem( i18n("Help"), helpMenu );
647 } else { 649 } else {
648 QPEMenuBar *menuBar1; 650 QPEMenuBar *menuBar1;
649 menuBar1 = new QPEMenuBar( iconToolBar ); 651 menuBar1 = new QPEMenuBar( iconToolBar );
650 QPopupMenu *menuBar = new QPopupMenu( this ); 652 QPopupMenu *menuBar = new QPopupMenu( this );
651 icon = loadPixmap( pathString + "z_menu" ); 653 icon = loadPixmap( pathString + "z_menu" );
652 menuBar1->insertItem( icon.pixmap(), menuBar); 654 menuBar1->insertItem( icon.pixmap(), menuBar);
653 //menuBar1->insertItem( i18n("ME"), menuBar); 655 //menuBar1->insertItem( i18n("ME"), menuBar);
654 menuBar->insertItem( i18n("File"), importMenu ); 656 menuBar->insertItem( i18n("File"), importMenu );
655 menuBar->insertItem( i18n("View"), viewMenu ); 657 menuBar->insertItem( i18n("View"), viewMenu );
656 menuBar->insertItem( i18n("Actions"), actionMenu ); 658 menuBar->insertItem( i18n("Actions"), actionMenu );
657 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 659 menuBar->insertItem( i18n("Synchronize"), syncMenu );
658 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 660 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
659 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 661 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
660 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 662 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
661 menuBar->insertItem( i18n("Help"), helpMenu ); 663 menuBar->insertItem( i18n("Help"), helpMenu );
662 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 664 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
663 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 665 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
664 } 666 }
665 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 667 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
666 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 668 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
667 669
668 670
669 mWeekBgColor = iconToolBar->backgroundColor(); 671 mWeekBgColor = iconToolBar->backgroundColor();
670 mWeekPixmap.resize( pixWid , pixHei ); 672 mWeekPixmap.resize( pixWid , pixHei );
671 mWeekPixmap.fill( mWeekBgColor ); 673 mWeekPixmap.fill( mWeekBgColor );
672 icon = mWeekPixmap; 674 icon = mWeekPixmap;
673 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 675 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
674 if ( p-> mShowIconWeekNum ) 676 if ( p-> mShowIconWeekNum )
675 mWeekAction->addTo( iconToolBar ); 677 mWeekAction->addTo( iconToolBar );
676 mWeekFont = font(); 678 mWeekFont = font();
677 679
678 int fontPoint = mWeekFont.pointSize(); 680 int fontPoint = mWeekFont.pointSize();
679 QFontMetrics f( mWeekFont ); 681 QFontMetrics f( mWeekFont );
680 int fontWid = f.width( "30" ); 682 int fontWid = f.width( "30" );
681 while ( fontWid > pixWid ) { 683 while ( fontWid > pixWid ) {
682 --fontPoint; 684 --fontPoint;
683 mWeekFont.setPointSize( fontPoint ); 685 mWeekFont.setPointSize( fontPoint );
684 QFontMetrics f( mWeekFont ); 686 QFontMetrics f( mWeekFont );
685 fontWid = f.width( "30" ); 687 fontWid = f.width( "30" );
686 //qDebug("dec-- "); 688 //qDebug("dec-- ");
687 } 689 }
688 690
689 connect( mWeekAction, SIGNAL( activated() ), 691 connect( mWeekAction, SIGNAL( activated() ),
690 this, SLOT( weekAction() ) ); 692 this, SLOT( weekAction() ) );
691 693
692 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 694 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
693 if ( p->mShowIconFilterview ) { 695 if ( p->mShowIconFilterview ) {
694 icon = loadPixmap( pathString + "filter" ); 696 icon = loadPixmap( pathString + "filter" );
695 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 697 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
696 connect( actionFilterMenuTB, SIGNAL( activated() ), 698 connect( actionFilterMenuTB, SIGNAL( activated() ),
697 this, SLOT( fillFilterMenuTB() ) ); 699 this, SLOT( fillFilterMenuTB() ) );
698 actionFilterMenuTB->addTo( iconToolBar ); 700 actionFilterMenuTB->addTo( iconToolBar );
699 selectFilterMenuTB = new QPopupMenu( this ); 701 selectFilterMenuTB = new QPopupMenu( this );
700 selectFilterMenuTB->setCheckable( true ); 702 selectFilterMenuTB->setCheckable( true );
701 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 703 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
702 } 704 }
703 705
704 //#endif 706 //#endif
705 // ****************** 707 // ******************
706 QAction *action; 708 QAction *action;
707 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 709 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
708 configureToolBarMenu->setCheckable( true ); 710 configureToolBarMenu->setCheckable( true );
709 711
710 712
711 configureAgendaMenu->setCheckable( true ); 713 configureAgendaMenu->setCheckable( true );
712 int iii ; 714 int iii ;
713 for ( iii = 1;iii<= 10 ;++iii ){ 715 for ( iii = 1;iii<= 10 ;++iii ){
714 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 716 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
715 } 717 }
716 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 718 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
717 719
718 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 720 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
719 this, SLOT( showConfigureAgenda( ) ) ); 721 this, SLOT( showConfigureAgenda( ) ) );
720 722
721 icon = loadPixmap( pathString + "configure" ); 723 icon = loadPixmap( pathString + "configure" );
722 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 724 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
723 action->addTo( actionMenu ); 725 action->addTo( actionMenu );
724 connect( action, SIGNAL( activated() ), 726 connect( action, SIGNAL( activated() ),
725 mView, SLOT( edit_options() ) ); 727 mView, SLOT( edit_options() ) );
726 actionMenu->insertSeparator(); 728 actionMenu->insertSeparator();
727 729
728 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 730 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
729 action->addTo( actionMenu ); 731 action->addTo( actionMenu );
730 connect( action, SIGNAL( activated() ), 732 connect( action, SIGNAL( activated() ),
731 mView, SLOT( undo_delete() ) ); 733 mView, SLOT( undo_delete() ) );
732 actionMenu->insertSeparator(); 734 actionMenu->insertSeparator();
733 735
734 icon = loadPixmap( pathString + "newevent" ); 736 icon = loadPixmap( pathString + "newevent" );
735 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 737 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
736 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 738 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
737 configureToolBarMenu->insertSeparator(); 739 configureToolBarMenu->insertSeparator();
738 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 740 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
739 configureToolBarMenu->insertSeparator(); 741 configureToolBarMenu->insertSeparator();
740 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 742 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
741 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 743 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
742 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 744 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
743 ne_action->addTo( actionMenu ); 745 ne_action->addTo( actionMenu );
744 connect( ne_action, SIGNAL( activated() ), 746 connect( ne_action, SIGNAL( activated() ),
745 mView, SLOT( newEvent() ) ); 747 mView, SLOT( newEvent() ) );
746 icon = loadPixmap( pathString + "newtodo" ); 748 icon = loadPixmap( pathString + "newtodo" );
747 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 749 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
748 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 750 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
749 nt_action->addTo( actionMenu ); 751 nt_action->addTo( actionMenu );
750 connect( nt_action, SIGNAL( activated() ), 752 connect( nt_action, SIGNAL( activated() ),
751 mView, SLOT( newTodo() ) ); 753 mView, SLOT( newTodo() ) );
752 754
753 icon = loadPixmap( pathString + "today" ); 755 icon = loadPixmap( pathString + "today" );
754 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 756 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
755 today_action->addTo( viewMenu ); 757 today_action->addTo( viewMenu );
756 connect( today_action, SIGNAL( activated() ), 758 connect( today_action, SIGNAL( activated() ),
757 mView, SLOT( goToday() ) ); 759 mView, SLOT( goToday() ) );
758 viewMenu->insertSeparator(); 760 viewMenu->insertSeparator();
759 761
760 // *********************** 762 // ***********************
761 if ( KOPrefs::instance()->mVerticalScreen ) { 763 if ( KOPrefs::instance()->mVerticalScreen ) {
762 icon = SmallIcon( "1updownarrow" ); 764 icon = SmallIcon( "1updownarrow" );
763 } else { 765 } else {
764 icon = SmallIcon("1leftrightarrow" ); 766 icon = SmallIcon("1leftrightarrow" );
765 } 767 }
766 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 768 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
767 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 769 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
768 FSaction->addTo( viewMenu ); 770 FSaction->addTo( viewMenu );
769 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 771 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
770 772
771 icon = loadPixmap( pathString + "navi" ); 773 icon = loadPixmap( pathString + "navi" );
772 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 774 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
773 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 775 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
774 action->addTo( viewMenu ); 776 action->addTo( viewMenu );
775 connect( action, SIGNAL( activated() ), 777 connect( action, SIGNAL( activated() ),
776 mView, SLOT( toggleDateNavigatorWidget() ) ); 778 mView, SLOT( toggleDateNavigatorWidget() ) );
777 mToggleNav = action ; 779 mToggleNav = action ;
778 icon = loadPixmap( pathString + "filter" ); 780 icon = loadPixmap( pathString + "filter" );
779 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 781 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
780 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 782 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
781 action->addTo( viewMenu ); 783 action->addTo( viewMenu );
782 connect( action, SIGNAL( activated() ), 784 connect( action, SIGNAL( activated() ),
783 mView, SLOT( toggleFilter() ) ); 785 mView, SLOT( toggleFilter() ) );
784 mToggleFilter = action; 786 mToggleFilter = action;
785 icon = loadPixmap( pathString + "allday" ); 787 icon = loadPixmap( pathString + "allday" );
786 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 788 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
787 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 789 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
788 action->addTo( viewMenu ); 790 action->addTo( viewMenu );
789 connect( action, SIGNAL( activated() ), 791 connect( action, SIGNAL( activated() ),
790 mView, SLOT( toggleAllDaySize() ) ); 792 mView, SLOT( toggleAllDaySize() ) );
791 mToggleAllday = action; 793 mToggleAllday = action;
792 794
793 795
794 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 796 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
795 mToggleNav, SLOT( setEnabled ( bool ) ) ); 797 mToggleNav, SLOT( setEnabled ( bool ) ) );
796 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 798 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
797 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 799 mToggleFilter, SLOT( setEnabled ( bool ) ) );
798 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 800 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
799 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 801 mToggleAllday, SLOT( setEnabled ( bool ) ) );
802 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
803 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
800 804
801 viewMenu->insertSeparator(); 805 viewMenu->insertSeparator();
802 icon = loadPixmap( pathString + "picker" ); 806 icon = loadPixmap( pathString + "picker" );
803 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 807 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
804 action->addTo( viewMenu ); 808 action->addTo( viewMenu );
805 connect( action, SIGNAL( activated() ), 809 connect( action, SIGNAL( activated() ),
806 mView, SLOT( showDatePicker() ) ); 810 mView, SLOT( showDatePicker() ) );
807 action->addTo( iconToolBar ); 811 action->addTo( iconToolBar );
808 viewMenu->insertSeparator(); 812 viewMenu->insertSeparator();
809 813
810 if ( p-> mShowIconToggleFull ) 814 if ( p-> mShowIconToggleFull )
811 FSaction->addTo( iconToolBar ); 815 FSaction->addTo( iconToolBar );
812 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 816 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
813 817
814 //******************** 818 //********************
815 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 819 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
816 820
817 821
818 icon = loadPixmap( pathString + "whatsnext" ); 822 icon = loadPixmap( pathString + "whatsnext" );
819 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 823 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
820 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 824 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
821 whatsnext_action->addTo( viewMenu ); 825 whatsnext_action->addTo( viewMenu );
822 connect( whatsnext_action, SIGNAL( activated() ), 826 connect( whatsnext_action, SIGNAL( activated() ),
823 mView->viewManager(), SLOT( showWhatsNextView() ) ); 827 mView->viewManager(), SLOT( showWhatsNextView() ) );
824 828
825 icon = loadPixmap( pathString + "xdays" ); 829 icon = loadPixmap( pathString + "xdays" );
826 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 830 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
827 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 831 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
828 xdays_action->addTo( viewMenu ); 832 xdays_action->addTo( viewMenu );
829 connect( xdays_action, SIGNAL( activated() ), 833 connect( xdays_action, SIGNAL( activated() ),
830 mView->viewManager(), SLOT( showNextXView() ) ); 834 mView->viewManager(), SLOT( showNextXView() ) );
831 835
832 836
833 icon = loadPixmap( pathString + "journal" ); 837 icon = loadPixmap( pathString + "journal" );
834 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 838 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
835 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 839 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
836 viewjournal_action->addTo( viewMenu ); 840 viewjournal_action->addTo( viewMenu );
837 connect( viewjournal_action, SIGNAL( activated() ), 841 connect( viewjournal_action, SIGNAL( activated() ),
838 mView->viewManager(), SLOT( showJournalView() ) ); 842 mView->viewManager(), SLOT( showJournalView() ) );
839 843
840 844
841 icon = loadPixmap( pathString + "day" ); 845 icon = loadPixmap( pathString + "day" );
842 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 846 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
843 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 847 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
844 day1_action->addTo( viewMenu ); 848 day1_action->addTo( viewMenu );
845 // action->addTo( toolBar ); 849 // action->addTo( toolBar );
846 connect( day1_action, SIGNAL( activated() ), 850 connect( day1_action, SIGNAL( activated() ),
847 mView->viewManager(), SLOT( showDayView() ) ); 851 mView->viewManager(), SLOT( showDayView() ) );
848 852
849 icon = loadPixmap( pathString + "workweek" ); 853 icon = loadPixmap( pathString + "workweek" );
850 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 854 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
851 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 855 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
852 day5_action->addTo( viewMenu ); 856 day5_action->addTo( viewMenu );
853 connect( day5_action, SIGNAL( activated() ), 857 connect( day5_action, SIGNAL( activated() ),
854 mView->viewManager(), SLOT( showWorkWeekView() ) ); 858 mView->viewManager(), SLOT( showWorkWeekView() ) );
855 859
856 icon = loadPixmap( pathString + "week" ); 860 icon = loadPixmap( pathString + "week" );
857 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 861 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
858 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 862 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
859 day7_action->addTo( viewMenu ); 863 day7_action->addTo( viewMenu );
860 connect( day7_action, SIGNAL( activated() ), 864 connect( day7_action, SIGNAL( activated() ),
861 mView->viewManager(), SLOT( showWeekView() ) ); 865 mView->viewManager(), SLOT( showWeekView() ) );
862 866
863 icon = loadPixmap( pathString + "workweek2" ); 867 icon = loadPixmap( pathString + "workweek2" );
864 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 868 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
865 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 869 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
866 day6_action->addTo( viewMenu ); 870 day6_action->addTo( viewMenu );
867 connect( day6_action, SIGNAL( activated() ), 871 connect( day6_action, SIGNAL( activated() ),
868 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 872 mView->viewManager(), SLOT( showMonthViewWeek() ) );
869 873
870 icon = loadPixmap( pathString + "month" ); 874 icon = loadPixmap( pathString + "month" );
871 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 875 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
872 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 876 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
873 month_action->addTo( viewMenu ); 877 month_action->addTo( viewMenu );
874 connect( month_action, SIGNAL( activated() ), 878 connect( month_action, SIGNAL( activated() ),
875 mView->viewManager(), SLOT( showMonthView() ) ); 879 mView->viewManager(), SLOT( showMonthView() ) );
876 880
877 icon = loadPixmap( pathString + "list" ); 881 icon = loadPixmap( pathString + "list" );
878 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 882 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
879 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 883 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
880 showlist_action->addTo( viewMenu ); 884 showlist_action->addTo( viewMenu );
881 connect( showlist_action, SIGNAL( activated() ), 885 connect( showlist_action, SIGNAL( activated() ),
882 mView->viewManager(), SLOT( showListView() ) ); 886 mView->viewManager(), SLOT( showListView() ) );
883 887
884 icon = loadPixmap( pathString + "todo" ); 888 icon = loadPixmap( pathString + "todo" );
885 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 889 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
886 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 890 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
887 todoview_action->addTo( viewMenu ); 891 todoview_action->addTo( viewMenu );
888 connect( todoview_action, SIGNAL( activated() ), 892 connect( todoview_action, SIGNAL( activated() ),
889 mView->viewManager(), SLOT( showTodoView() ) ); 893 mView->viewManager(), SLOT( showTodoView() ) );
890 894
891 895
892 896
893#if 0 897#if 0
894 action = new QAction( "view_timespan", "Time Span", 0, this ); 898 action = new QAction( "view_timespan", "Time Span", 0, this );
895 action->addTo( viewMenu ); 899 action->addTo( viewMenu );
896 connect( action, SIGNAL( activated() ), 900 connect( action, SIGNAL( activated() ),
897 mView->viewManager(), SLOT( showTimeSpanView() ) ); 901 mView->viewManager(), SLOT( showTimeSpanView() ) );
898#endif 902#endif
899 903
900 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 904 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
901 this ); 905 this );
902 mNewSubTodoAction->addTo( actionMenu ); 906 mNewSubTodoAction->addTo( actionMenu );
903 connect( mNewSubTodoAction, SIGNAL( activated() ), 907 connect( mNewSubTodoAction, SIGNAL( activated() ),
904 mView, SLOT( newSubTodo() ) ); 908 mView, SLOT( newSubTodo() ) );
905 909
906 actionMenu->insertSeparator(); 910 actionMenu->insertSeparator();
907 911
908 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 912 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
909 mShowAction->addTo( actionMenu ); 913 mShowAction->addTo( actionMenu );
910 connect( mShowAction, SIGNAL( activated() ), 914 connect( mShowAction, SIGNAL( activated() ),
911 mView, SLOT( showIncidence() ) ); 915 mView, SLOT( showIncidence() ) );
912 916
913 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 917 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
914 mEditAction->addTo( actionMenu ); 918 mEditAction->addTo( actionMenu );
915 connect( mEditAction, SIGNAL( activated() ), 919 connect( mEditAction, SIGNAL( activated() ),
916 mView, SLOT( editIncidence() ) ); 920 mView, SLOT( editIncidence() ) );
917 921
918 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 922 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
919 mDeleteAction->addTo( actionMenu ); 923 mDeleteAction->addTo( actionMenu );
920 connect( mDeleteAction, SIGNAL( activated() ), 924 connect( mDeleteAction, SIGNAL( activated() ),
921 mView, SLOT( deleteIncidence() ) ); 925 mView, SLOT( deleteIncidence() ) );
922 926
923 927
924 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 928 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
925 mCloneAction->addTo( actionMenu ); 929 mCloneAction->addTo( actionMenu );
926 connect( mCloneAction, SIGNAL( activated() ), 930 connect( mCloneAction, SIGNAL( activated() ),
927 mView, SLOT( cloneIncidence() ) ); 931 mView, SLOT( cloneIncidence() ) );
928 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 932 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
929 mMoveAction->addTo( actionMenu ); 933 mMoveAction->addTo( actionMenu );
930 connect( mMoveAction, SIGNAL( activated() ), 934 connect( mMoveAction, SIGNAL( activated() ),
931 mView, SLOT( moveIncidence() ) ); 935 mView, SLOT( moveIncidence() ) );
932 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 936 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
933 mBeamAction->addTo( actionMenu ); 937 mBeamAction->addTo( actionMenu );
934 connect( mBeamAction, SIGNAL( activated() ), 938 connect( mBeamAction, SIGNAL( activated() ),
935 mView, SLOT( beamIncidence() ) ); 939 mView, SLOT( beamIncidence() ) );
936 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 940 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
937 mCancelAction->addTo( actionMenu ); 941 mCancelAction->addTo( actionMenu );
938 connect( mCancelAction, SIGNAL( activated() ), 942 connect( mCancelAction, SIGNAL( activated() ),
939 mView, SLOT( toggleCancelIncidence() ) ); 943 mView, SLOT( toggleCancelIncidence() ) );
940 944
941 actionMenu->insertSeparator(); 945 actionMenu->insertSeparator();
942 946
943 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 947 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
944 this ); 948 this );
945 action->addTo( actionMenu ); 949 action->addTo( actionMenu );
946 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 950 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
947 951
948 icon = loadPixmap( pathString + "search" ); 952 icon = loadPixmap( pathString + "search" );
949 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 953 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
950 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 954 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
951 search_action->addTo( actionMenu ); 955 search_action->addTo( actionMenu );
952 connect( search_action, SIGNAL( activated() ), 956 connect( search_action, SIGNAL( activated() ),
953 mView->dialogManager(), SLOT( showSearchDialog() ) ); 957 mView->dialogManager(), SLOT( showSearchDialog() ) );
954 958
955 959
956 960
957 if ( KOPrefs::instance()->mShowFullMenu ) { 961 if ( KOPrefs::instance()->mShowFullMenu ) {
958 actionMenu->insertSeparator(); 962 actionMenu->insertSeparator();
959 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 963 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
960 964
961 } 965 }
962 // actionMenu->insertSeparator(); 966 // actionMenu->insertSeparator();
963 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 967 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
964 this ); 968 this );
965 action->addTo( importMenu_X ); 969 action->addTo( importMenu_X );
966 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 970 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
967 action = new QAction( "import_quick", i18n("Import last file"), 0, 971 action = new QAction( "import_quick", i18n("Import last file"), 0,
968 this ); 972 this );
969 action->addTo( importMenu_X ); 973 action->addTo( importMenu_X );
970 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 974 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
971 importMenu_X->insertSeparator(); 975 importMenu_X->insertSeparator();
972 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 976 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
973 this ); 977 this );
974 action->addTo( importMenu_X ); 978 action->addTo( importMenu_X );
975 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 979 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
976 //#ifndef DESKTOP_VERSION 980 //#ifndef DESKTOP_VERSION
977 importMenu_X->insertSeparator(); 981 importMenu_X->insertSeparator();
978 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 982 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
979 this ); 983 this );
980 action->addTo( importMenu_X ); 984 action->addTo( importMenu_X );
981 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 985 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
982 //#else 986 //#else
983#ifdef _OL_IMPORT_ 987#ifdef _OL_IMPORT_
984 importMenu_X->insertSeparator(); 988 importMenu_X->insertSeparator();
985 action = new QAction( "import_ol", i18n("Import from OL"), 0, 989 action = new QAction( "import_ol", i18n("Import from OL"), 0,
986 this ); 990 this );
987 action->addTo( importMenu_X ); 991 action->addTo( importMenu_X );
988 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 992 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
989#endif 993#endif
990 //#endif 994 //#endif
991 995
992 //importMenu->insertSeparator(); 996 //importMenu->insertSeparator();
993 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 997 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
994 this ); 998 this );
995 action->addTo( importMenu ); 999 action->addTo( importMenu );
996 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1000 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
997 1001
998 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 1002 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
999 this ); 1003 this );
1000 action->addTo( importMenu ); 1004 action->addTo( importMenu );
1001 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1005 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1002 importMenu->insertSeparator(); 1006 importMenu->insertSeparator();
1003 importMenu->insertItem( i18n("Import"), importMenu_X ); 1007 importMenu->insertItem( i18n("Import"), importMenu_X );
1004 //importMenu->insertSeparator(); 1008 //importMenu->insertSeparator();
1005 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1009 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1006 this ); 1010 this );
1007 action->addTo( exportMenu_X ); 1011 action->addTo( exportMenu_X );
1008 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1012 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1009 1013
1010 1014
1011 //LR 1015 //LR
1012 QPopupMenu *ex2phone = new QPopupMenu( this ); 1016 QPopupMenu *ex2phone = new QPopupMenu( this );
1013 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1017 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1014 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1018 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1015 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1019 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1016 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1020 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1017 1021
1018 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1022 importMenu->insertItem( i18n("Export"), exportMenu_X );
1019#ifndef DESKTOP_VERSION 1023#ifndef DESKTOP_VERSION
1020 //importMenu->insertSeparator(); 1024 //importMenu->insertSeparator();
1021 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1025 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1022 this ); 1026 this );
1023 brAction->addTo( beamMenu_X ); 1027 brAction->addTo( beamMenu_X );
1024 brAction->setToggleAction (true ) ; 1028 brAction->setToggleAction (true ) ;
1025 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1029 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1026 1030
1027 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1031 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1028 this ); 1032 this );
1029 action->addTo( beamMenu_X ); 1033 action->addTo( beamMenu_X );
1030 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1034 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1031 1035
1032 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1036 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1033 this ); 1037 this );
1034 action->addTo( beamMenu_X ); 1038 action->addTo( beamMenu_X );
1035 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1039 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1036 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1040 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1037#else 1041#else
1038 //importMenu->insertSeparator(); 1042 //importMenu->insertSeparator();
1039 icon = loadPixmap( pathString + "print" ); 1043 icon = loadPixmap( pathString + "print" );
1040 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1044 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1041 action->addTo( beamMenu_X ); 1045 action->addTo( beamMenu_X );
1042 connect( action, SIGNAL( activated() ), 1046 connect( action, SIGNAL( activated() ),
1043 this, SLOT( printCal() ) ); 1047 this, SLOT( printCal() ) );
1044 1048
1045 icon = loadPixmap( pathString + "print" ); 1049 icon = loadPixmap( pathString + "print" );
1046 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1050 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1047 action->addTo( beamMenu_X ); 1051 action->addTo( beamMenu_X );
1048 connect( action, SIGNAL( activated() ), 1052 connect( action, SIGNAL( activated() ),
1049 this, SLOT( printSel() ) ); 1053 this, SLOT( printSel() ) );
1050 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1054 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1051 action->addTo( beamMenu_X ); 1055 action->addTo( beamMenu_X );
1052 connect( action, SIGNAL( activated() ), 1056 connect( action, SIGNAL( activated() ),
1053 mView->viewManager(), SLOT( slotprintWNV() ) ); 1057 mView->viewManager(), SLOT( slotprintWNV() ) );
1054 1058
1055 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1059 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1056 action->addTo( beamMenu_X ); 1060 action->addTo( beamMenu_X );
1057 connect( action, SIGNAL( activated() ), 1061 connect( action, SIGNAL( activated() ),
1058 mView, SLOT( slotprintSelInc() ) ); 1062 mView, SLOT( slotprintSelInc() ) );
1059 1063
1060 1064
1061 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1065 importMenu->insertItem( i18n("Print"), beamMenu_X );
1062#endif 1066#endif
1063 importMenu->insertSeparator(); 1067 importMenu->insertSeparator();
1064 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1068 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1065 this ); 1069 this );
1066 action->addTo( importMenu ); 1070 action->addTo( importMenu );
1067 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1071 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1068 importMenu->insertSeparator(); 1072 importMenu->insertSeparator();
1069 action = new QAction( "beam all", i18n("Save"), 0, 1073 action = new QAction( "beam all", i18n("Save"), 0,
1070 this ); 1074 this );
1071 action->addTo( importMenu ); 1075 action->addTo( importMenu );
1072 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1076 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1073 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1077 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1074 this ); 1078 this );
1075 action->addTo( importMenu ); 1079 action->addTo( importMenu );
1076 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1080 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1077 1081
1078 //menuBar->insertItem( "Configure",configureMenu ); 1082 //menuBar->insertItem( "Configure",configureMenu );
1079 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1083 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1080 icon = loadPixmap( "korganizer/korganizer" ); 1084 icon = loadPixmap( "korganizer/korganizer" );
1081 1085
1082 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1086 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1083 action->addTo( helpMenu ); 1087 action->addTo( helpMenu );
1084 connect( action, SIGNAL( activated() ), 1088 connect( action, SIGNAL( activated() ),
1085 SLOT( whatsNew() ) ); 1089 SLOT( whatsNew() ) );
1086 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1090 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1087 action->addTo( helpMenu ); 1091 action->addTo( helpMenu );
1088 connect( action, SIGNAL( activated() ), 1092 connect( action, SIGNAL( activated() ),
1089 SLOT( features() ) ); 1093 SLOT( features() ) );
1090 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1094 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1091 action->addTo( helpMenu ); 1095 action->addTo( helpMenu );
1092 connect( action, SIGNAL( activated() ), 1096 connect( action, SIGNAL( activated() ),
1093 SLOT( keyBindings() ) ); 1097 SLOT( keyBindings() ) );
1094 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1098 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1095 action->addTo( helpMenu ); 1099 action->addTo( helpMenu );
1096 connect( action, SIGNAL( activated() ), 1100 connect( action, SIGNAL( activated() ),
1097 SLOT( storagehowto() ) ); 1101 SLOT( storagehowto() ) );
1098 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1102 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1099 action->addTo( helpMenu ); 1103 action->addTo( helpMenu );
1100 connect( action, SIGNAL( activated() ), 1104 connect( action, SIGNAL( activated() ),
1101 SLOT( timetrackinghowto() ) ); 1105 SLOT( timetrackinghowto() ) );
1102 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1106 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1103 action->addTo( helpMenu ); 1107 action->addTo( helpMenu );
1104 connect( action, SIGNAL( activated() ), 1108 connect( action, SIGNAL( activated() ),
1105 SLOT( synchowto() ) ); 1109 SLOT( synchowto() ) );
1106 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1110 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1107 action->addTo( helpMenu ); 1111 action->addTo( helpMenu );
1108 connect( action, SIGNAL( activated() ), 1112 connect( action, SIGNAL( activated() ),
1109 SLOT( kdesynchowto() ) ); 1113 SLOT( kdesynchowto() ) );
1110 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1114 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1111 action->addTo( helpMenu ); 1115 action->addTo( helpMenu );
1112 connect( action, SIGNAL( activated() ), 1116 connect( action, SIGNAL( activated() ),
1113 SLOT( multisynchowto() ) ); 1117 SLOT( multisynchowto() ) );
1114 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1118 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1115 action->addTo( helpMenu ); 1119 action->addTo( helpMenu );
1116 connect( action, SIGNAL( activated() ), 1120 connect( action, SIGNAL( activated() ),
1117 SLOT( aboutAutoSaving() ) ); 1121 SLOT( aboutAutoSaving() ) );
1118 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1122 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1119 action->addTo( helpMenu ); 1123 action->addTo( helpMenu );
1120 connect( action, SIGNAL( activated() ), 1124 connect( action, SIGNAL( activated() ),
1121 SLOT( aboutKnownBugs() ) ); 1125 SLOT( aboutKnownBugs() ) );
1122 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1126 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1123 action->addTo( helpMenu ); 1127 action->addTo( helpMenu );
1124 connect( action, SIGNAL( activated() ), 1128 connect( action, SIGNAL( activated() ),
1125 SLOT( usertrans() ) ); 1129 SLOT( usertrans() ) );
1126 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1130 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1127 action->addTo( helpMenu ); 1131 action->addTo( helpMenu );
1128 connect( action, SIGNAL( activated() ), 1132 connect( action, SIGNAL( activated() ),
1129 SLOT( faq() ) ); 1133 SLOT( faq() ) );
1130 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1134 action = new QAction( "licence", i18n("Licence..."), 0, this );
1131 action->addTo( helpMenu ); 1135 action->addTo( helpMenu );
1132 connect( action, SIGNAL( activated() ), 1136 connect( action, SIGNAL( activated() ),
1133 SLOT( licence() ) ); 1137 SLOT( licence() ) );
1134 action = new QAction( "about", i18n("About..."), 0, this ); 1138 action = new QAction( "about", i18n("About..."), 0, this );
1135 action->addTo( helpMenu ); 1139 action->addTo( helpMenu );
1136 connect( action, SIGNAL( activated() ), 1140 connect( action, SIGNAL( activated() ),
1137 SLOT( about() ) ); 1141 SLOT( about() ) );
1138 //menuBar->insertSeparator(); 1142 //menuBar->insertSeparator();
1139 1143
1140 // ****************************************************** 1144 // ******************************************************
1141 // menubar icons 1145 // menubar icons
1142 1146
1143 1147
1144 1148
1145 //menuBar->insertItem( iconToolBar ); 1149 //menuBar->insertItem( iconToolBar );
1146 //xdays_action 1150 //xdays_action
1147 if (p-> mShowIconNewEvent) 1151 if (p-> mShowIconNewEvent)
1148 ne_action->addTo( iconToolBar ); 1152 ne_action->addTo( iconToolBar );
1149 if (p->mShowIconNewTodo ) 1153 if (p->mShowIconNewTodo )
1150 nt_action->addTo( iconToolBar ); 1154 nt_action->addTo( iconToolBar );
1151 if (p-> mShowIconSearch) 1155 if (p-> mShowIconSearch)
1152 search_action->addTo( iconToolBar ); 1156 search_action->addTo( iconToolBar );
1153 if (p-> mShowIconWhatsThis) 1157 if (p-> mShowIconWhatsThis)
1154 QWhatsThis::whatsThisButton ( iconToolBar ); 1158 QWhatsThis::whatsThisButton ( iconToolBar );
1155 if (p-> mShowIconNext) 1159 if (p-> mShowIconNext)
1156 whatsnext_action->addTo( viewToolBar ); 1160 whatsnext_action->addTo( viewToolBar );
1157 if (p-> mShowIconNextDays) 1161 if (p-> mShowIconNextDays)
1158 xdays_action->addTo( viewToolBar ); 1162 xdays_action->addTo( viewToolBar );
1159 if (p-> mShowIconJournal) 1163 if (p-> mShowIconJournal)
1160 viewjournal_action->addTo( viewToolBar ); 1164 viewjournal_action->addTo( viewToolBar );
1161 if (p-> mShowIconDay1) 1165 if (p-> mShowIconDay1)
1162 day1_action->addTo( viewToolBar ); 1166 day1_action->addTo( viewToolBar );
1163 if (p-> mShowIconDay5) 1167 if (p-> mShowIconDay5)
1164 day5_action->addTo( viewToolBar ); 1168 day5_action->addTo( viewToolBar );
1165 if (p-> mShowIconDay7) 1169 if (p-> mShowIconDay7)
1166 day7_action->addTo( viewToolBar ); 1170 day7_action->addTo( viewToolBar );
1167 if (p-> mShowIconDay6) 1171 if (p-> mShowIconDay6)
1168 day6_action->addTo( viewToolBar ); 1172 day6_action->addTo( viewToolBar );
1169 if (p-> mShowIconMonth) 1173 if (p-> mShowIconMonth)
1170 month_action->addTo( viewToolBar ); 1174 month_action->addTo( viewToolBar );
1171 if (p-> mShowIconList) 1175 if (p-> mShowIconList)
1172 showlist_action->addTo( viewToolBar ); 1176 showlist_action->addTo( viewToolBar );
1173 if (p-> mShowIconTodoview) 1177 if (p-> mShowIconTodoview)
1174 todoview_action->addTo( viewToolBar ); 1178 todoview_action->addTo( viewToolBar );
1175 1179
1176 icon = loadPixmap( pathString + "2leftarrowB" ); 1180 icon = loadPixmap( pathString + "2leftarrowB" );
1177 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1181 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1178 if (p-> mShowIconBackFast) { 1182 if (p-> mShowIconBackFast) {
1179 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1183 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1180 connect( action, SIGNAL( activated() ), 1184 connect( action, SIGNAL( activated() ),
1181 mView, SLOT( goPreviousMonth() ) ); 1185 mView, SLOT( goPreviousMonth() ) );
1182 action->addTo( navigatorToolBar ); 1186 action->addTo( navigatorToolBar );
1183 } 1187 }
1184 icon = loadPixmap( pathString + "1leftarrowB" ); 1188 icon = loadPixmap( pathString + "1leftarrowB" );
1185 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1189 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1186 if (p-> mShowIconBack) { 1190 if (p-> mShowIconBack) {
1187 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1191 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1188 connect( action, SIGNAL( activated() ), 1192 connect( action, SIGNAL( activated() ),
1189 mView, SLOT( goPrevious() ) ); 1193 mView, SLOT( goPrevious() ) );
1190 action->addTo( navigatorToolBar ); 1194 action->addTo( navigatorToolBar );
1191 } 1195 }
1192 icon = loadPixmap( pathString + "today" ); 1196 icon = loadPixmap( pathString + "today" );
1193 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1197 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1194 if (p-> mShowIconToday) 1198 if (p-> mShowIconToday)
1195 today_action->addTo( navigatorToolBar ); 1199 today_action->addTo( navigatorToolBar );
1196 icon = loadPixmap( pathString + "1rightarrowB" ); 1200 icon = loadPixmap( pathString + "1rightarrowB" );
1197 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1201 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1198 if (p-> mShowIconForward) { 1202 if (p-> mShowIconForward) {
1199 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1203 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1200 connect( action, SIGNAL( activated() ), 1204 connect( action, SIGNAL( activated() ),
1201 mView, SLOT( goNext() ) ); 1205 mView, SLOT( goNext() ) );
1202 action->addTo( navigatorToolBar ); 1206 action->addTo( navigatorToolBar );
1203 } 1207 }
1204 icon = loadPixmap( pathString + "2rightarrowB" ); 1208 icon = loadPixmap( pathString + "2rightarrowB" );
1205 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1209 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1206 if (p-> mShowIconForwardFast) { 1210 if (p-> mShowIconForwardFast) {
1207 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1211 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1208 connect( action, SIGNAL( activated() ), 1212 connect( action, SIGNAL( activated() ),
1209 mView, SLOT( goNextMonth() ) ); 1213 mView, SLOT( goNextMonth() ) );
1210 action->addTo( navigatorToolBar ); 1214 action->addTo( navigatorToolBar );
1211 } 1215 }
1212 1216
1213 1217
1214 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1218 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1215 1219
1216 1220
1217 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1221 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1218 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1222 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1219 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1223 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1220 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1224 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1221 1225
1222 if (p-> mShowIconNewEvent) 1226 if (p-> mShowIconNewEvent)
1223 configureToolBarMenu->setItemChecked( 10, true ); 1227 configureToolBarMenu->setItemChecked( 10, true );
1224 if (p->mShowIconNewTodo ) 1228 if (p->mShowIconNewTodo )
1225 configureToolBarMenu->setItemChecked( 20, true ); 1229 configureToolBarMenu->setItemChecked( 20, true );
1226 if (p-> mShowIconSearch) 1230 if (p-> mShowIconSearch)
1227 configureToolBarMenu->setItemChecked( 120, true ); 1231 configureToolBarMenu->setItemChecked( 120, true );
1228 if (p-> mShowIconList) 1232 if (p-> mShowIconList)
1229 configureToolBarMenu->setItemChecked( 30, true ); 1233 configureToolBarMenu->setItemChecked( 30, true );
1230 if (p-> mShowIconDay1) 1234 if (p-> mShowIconDay1)
1231 configureToolBarMenu->setItemChecked( 40, true ); 1235 configureToolBarMenu->setItemChecked( 40, true );
1232 if (p-> mShowIconDay5) 1236 if (p-> mShowIconDay5)
1233 configureToolBarMenu->setItemChecked( 50, true ); 1237 configureToolBarMenu->setItemChecked( 50, true );
1234 if (p-> mShowIconDay6) 1238 if (p-> mShowIconDay6)
1235 configureToolBarMenu->setItemChecked( 75, true ); 1239 configureToolBarMenu->setItemChecked( 75, true );
1236 if (p-> mShowIconDay7) 1240 if (p-> mShowIconDay7)
1237 configureToolBarMenu->setItemChecked( 60, true ); 1241 configureToolBarMenu->setItemChecked( 60, true );
1238 if (p-> mShowIconMonth) 1242 if (p-> mShowIconMonth)
1239 configureToolBarMenu->setItemChecked( 70, true ); 1243 configureToolBarMenu->setItemChecked( 70, true );
1240 if (p-> mShowIconTodoview) 1244 if (p-> mShowIconTodoview)
1241 configureToolBarMenu->setItemChecked( 80, true ); 1245 configureToolBarMenu->setItemChecked( 80, true );
1242 if (p-> mShowIconBackFast) 1246 if (p-> mShowIconBackFast)
1243 configureToolBarMenu->setItemChecked( 200, true ); 1247 configureToolBarMenu->setItemChecked( 200, true );
1244 if (p-> mShowIconBack) 1248 if (p-> mShowIconBack)
1245 configureToolBarMenu->setItemChecked( 210, true ); 1249 configureToolBarMenu->setItemChecked( 210, true );
1246 if (p-> mShowIconToday) 1250 if (p-> mShowIconToday)
1247 configureToolBarMenu->setItemChecked( 130, true ); 1251 configureToolBarMenu->setItemChecked( 130, true );
1248 if (p-> mShowIconForward) 1252 if (p-> mShowIconForward)
1249 configureToolBarMenu->setItemChecked( 220, true ); 1253 configureToolBarMenu->setItemChecked( 220, true );
1250 if (p-> mShowIconForwardFast) 1254 if (p-> mShowIconForwardFast)
1251 configureToolBarMenu->setItemChecked( 230, true ); 1255 configureToolBarMenu->setItemChecked( 230, true );
1252 if (p-> mShowIconNextDays) 1256 if (p-> mShowIconNextDays)
1253 configureToolBarMenu->setItemChecked( 100, true ); 1257 configureToolBarMenu->setItemChecked( 100, true );
1254 if (p-> mShowIconNext) 1258 if (p-> mShowIconNext)
1255 configureToolBarMenu->setItemChecked( 110, true ); 1259 configureToolBarMenu->setItemChecked( 110, true );
1256 if (p-> mShowIconJournal) 1260 if (p-> mShowIconJournal)
1257 configureToolBarMenu->setItemChecked( 90, true ); 1261 configureToolBarMenu->setItemChecked( 90, true );
1258 if (p-> mShowIconWhatsThis) 1262 if (p-> mShowIconWhatsThis)
1259 configureToolBarMenu->setItemChecked( 300, true ); 1263 configureToolBarMenu->setItemChecked( 300, true );
1260 if (p-> mShowIconWeekNum) 1264 if (p-> mShowIconWeekNum)
1261 configureToolBarMenu->setItemChecked( 400, true ); 1265 configureToolBarMenu->setItemChecked( 400, true );
1262 if (!p-> mShowIconStretch) { 1266 if (!p-> mShowIconStretch) {
1263 QLabel* dummy = new QLabel( iconToolBar ); 1267 QLabel* dummy = new QLabel( iconToolBar );
1264 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1268 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1265 dummy->setMinimumWidth( 0 ); 1269 dummy->setMinimumWidth( 0 );
1266 iconToolBar->setStretchableWidget ( dummy ) ; 1270 iconToolBar->setStretchableWidget ( dummy ) ;
1267 } 1271 }
1268 else { 1272 else {
1269 iconToolBar->setHorizontalStretchable (true ); 1273 iconToolBar->setHorizontalStretchable (true );
1270 viewToolBar->setHorizontalStretchable (true ); 1274 viewToolBar->setHorizontalStretchable (true );
1271 navigatorToolBar->setHorizontalStretchable (true ); 1275 navigatorToolBar->setHorizontalStretchable (true );
1272 iconToolBar->setVerticalStretchable (true ); 1276 iconToolBar->setVerticalStretchable (true );
1273 viewToolBar->setVerticalStretchable (true ); 1277 viewToolBar->setVerticalStretchable (true );
1274 navigatorToolBar->setVerticalStretchable (true ); 1278 navigatorToolBar->setVerticalStretchable (true );
1275 configureToolBarMenu->setItemChecked( 5, true ); 1279 configureToolBarMenu->setItemChecked( 5, true );
1276 } 1280 }
1277 if (p-> mShowIconFilter) 1281 if (p-> mShowIconFilter)
1278 configureToolBarMenu->setItemChecked( 7, true ); 1282 configureToolBarMenu->setItemChecked( 7, true );
1279 if (p-> mShowIconOnetoolbar) 1283 if (p-> mShowIconOnetoolbar)
1280 configureToolBarMenu->setItemChecked( 6, true ); 1284 configureToolBarMenu->setItemChecked( 6, true );
1281 1285
1282 1286
1283 if ( filterMenubar ) { 1287 if ( filterMenubar ) {
1284 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1288 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1285 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1289 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1286 } 1290 }
1287 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1291 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1288 configureAgenda( p->mHourSize ); 1292 configureAgenda( p->mHourSize );
1289 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1293 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1290} 1294}
1291 1295
1292void MainWindow::exportToPhone( int mode ) 1296void MainWindow::exportToPhone( int mode )
1293{ 1297{
1294 1298
1295 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1299 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1296 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1300 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1297 KOex2phonePrefs ex2phone; 1301 KOex2phonePrefs ex2phone;
1298 1302
1299 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1303 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1300 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1304 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1301 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1305 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1302 if ( mode == 1 ) 1306 if ( mode == 1 )
1303 ex2phone.setCaption(i18n("Export complete calendar")); 1307 ex2phone.setCaption(i18n("Export complete calendar"));
1304 if ( mode == 2 ) 1308 if ( mode == 2 )
1305 ex2phone.setCaption(i18n("Export filtered calendar")); 1309 ex2phone.setCaption(i18n("Export filtered calendar"));
1306 1310
1307 if ( !ex2phone.exec() ) { 1311 if ( !ex2phone.exec() ) {
1308 return; 1312 return;
1309 } 1313 }
1310 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1314 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1311 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1315 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1312 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1316 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1313 1317
1314 int inFuture = 0; 1318 int inFuture = 0;
1315 if ( ex2phone.mWriteBackFuture->isChecked() ) 1319 if ( ex2phone.mWriteBackFuture->isChecked() )
1316 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1320 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1317 QPtrList<Incidence> delSel; 1321 QPtrList<Incidence> delSel;
1318 if ( mode == 1 ) 1322 if ( mode == 1 )
1319 delSel = mCalendar->rawIncidences(); 1323 delSel = mCalendar->rawIncidences();
1320 if ( mode == 2 ) 1324 if ( mode == 2 )
1321 delSel = mCalendar->incidences(); 1325 delSel = mCalendar->incidences();
1322 CalendarLocal* cal = new CalendarLocal(); 1326 CalendarLocal* cal = new CalendarLocal();
1323 cal->setLocalTime(); 1327 cal->setLocalTime();
1324 Incidence *incidence = delSel.first(); 1328 Incidence *incidence = delSel.first();
1325 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1329 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1326 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1330 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1327 while ( incidence ) { 1331 while ( incidence ) {
1328 if ( incidence->type() != "Journal" ) { 1332 if ( incidence->type() != "Journal" ) {
1329 bool add = true; 1333 bool add = true;
1330 if ( inFuture ) { 1334 if ( inFuture ) {
1331 QDateTime dt; 1335 QDateTime dt;
1332 if ( incidence->type() == "Todo" ) { 1336 if ( incidence->type() == "Todo" ) {
1333 Todo * t = (Todo*)incidence; 1337 Todo * t = (Todo*)incidence;
1334 if ( t->hasDueDate() ) 1338 if ( t->hasDueDate() )
1335 dt = t->dtDue(); 1339 dt = t->dtDue();
1336 else 1340 else
1337 dt = cur.addSecs( 62 ); 1341 dt = cur.addSecs( 62 );
1338 } 1342 }
1339 else { 1343 else {
1340 bool ok; 1344 bool ok;
1341 dt = incidence->getNextOccurence( cur, &ok ); 1345 dt = incidence->getNextOccurence( cur, &ok );
1342 if ( !ok ) 1346 if ( !ok )
1343 dt = cur.addSecs( -62 ); 1347 dt = cur.addSecs( -62 );
1344 } 1348 }
1345 if ( dt < cur || dt > end ) { 1349 if ( dt < cur || dt > end ) {
1346 add = false; 1350 add = false;
1347 } 1351 }
1348 } 1352 }
1349 if ( add ) { 1353 if ( add ) {
1350 Incidence *in = incidence->clone(); 1354 Incidence *in = incidence->clone();
1351 cal->addIncidence( in ); 1355 cal->addIncidence( in );
1352 } 1356 }
1353 } 1357 }
1354 incidence = delSel.next(); 1358 incidence = delSel.next();
1355 } 1359 }
1356 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1360 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1357 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1361 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1358 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1362 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1359 1363
1360 setCaption( i18n("Writing to phone...")); 1364 setCaption( i18n("Writing to phone..."));
1361 if ( PhoneFormat::writeToPhone( cal ) ) 1365 if ( PhoneFormat::writeToPhone( cal ) )
1362 setCaption( i18n("Export to phone successful!")); 1366 setCaption( i18n("Export to phone successful!"));
1363 else 1367 else
1364 setCaption( i18n("Error exporting to phone!")); 1368 setCaption( i18n("Error exporting to phone!"));
1365 delete cal; 1369 delete cal;
1366} 1370}
1367 1371
1368 1372
1369void MainWindow::setDefaultPreferences() 1373void MainWindow::setDefaultPreferences()
1370{ 1374{
1371 KOPrefs *p = KOPrefs::instance(); 1375 KOPrefs *p = KOPrefs::instance();
1372 1376
1373 p->mCompactDialogs = true; 1377 p->mCompactDialogs = true;
1374 p->mConfirm = true; 1378 p->mConfirm = true;
1375 // p->mEnableQuickTodo = false; 1379 // p->mEnableQuickTodo = false;
1376 1380
1377} 1381}
1378 1382
1379QString MainWindow::resourcePath() 1383QString MainWindow::resourcePath()
1380{ 1384{
1381 return KGlobal::iconLoader()->iconPath(); 1385 return KGlobal::iconLoader()->iconPath();
1382} 1386}
1383 1387
1384void MainWindow::displayText( QString text ,QString cap ) 1388void MainWindow::displayText( QString text ,QString cap )
1385{ 1389{
1386 QDialog dia( this, "name", true ); ; 1390 QDialog dia( this, "name", true ); ;
1387 dia.setCaption( cap ); 1391 dia.setCaption( cap );
1388 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1392 QVBoxLayout* lay = new QVBoxLayout( &dia );
1389 lay->setSpacing( 3 ); 1393 lay->setSpacing( 3 );
1390 lay->setMargin( 3 ); 1394 lay->setMargin( 3 );
1391 QTextBrowser tb ( &dia ); 1395 QTextBrowser tb ( &dia );
1392 lay->addWidget( &tb ); 1396 lay->addWidget( &tb );
1393 tb.setText( text ); 1397 tb.setText( text );
1394#ifdef DESKTOP_VERSION 1398#ifdef DESKTOP_VERSION
1395 dia.resize( 640, 480); 1399 dia.resize( 640, 480);
1396#else 1400#else
1397 dia.showMaximized(); 1401 dia.showMaximized();
1398#endif 1402#endif
1399 dia.exec(); 1403 dia.exec();
1400} 1404}
1401 1405
1402void MainWindow::features() 1406void MainWindow::features()
1403{ 1407{
1404 1408
1405 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1409 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1406} 1410}
1407 1411
1408void MainWindow::usertrans() 1412void MainWindow::usertrans()
1409{ 1413{
1410 1414
1411 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1415 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1412} 1416}
1413 1417
1414void MainWindow::storagehowto() 1418void MainWindow::storagehowto()
1415{ 1419{
1416 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1420 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1417} 1421}
1418void MainWindow::timetrackinghowto() 1422void MainWindow::timetrackinghowto()
1419{ 1423{
1420 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1424 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1421} 1425}
1422void MainWindow::kdesynchowto() 1426void MainWindow::kdesynchowto()
1423{ 1427{
1424 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1428 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1425} 1429}
1426void MainWindow::multisynchowto() 1430void MainWindow::multisynchowto()
1427{ 1431{
1428 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1432 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1429} 1433}
1430void MainWindow::synchowto() 1434void MainWindow::synchowto()
1431{ 1435{
1432 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1436 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1433} 1437}
1434void MainWindow::faq() 1438void MainWindow::faq()
1435{ 1439{
1436 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1440 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1437 1441
1438} 1442}
1439void MainWindow::whatsNew() 1443void MainWindow::whatsNew()
1440{ 1444{
1441 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1445 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1442 1446
1443} 1447}
1444void MainWindow::licence() 1448void MainWindow::licence()
1445{ 1449{
1446 KApplication::showLicence(); 1450 KApplication::showLicence();
1447 1451
1448} 1452}
1449void MainWindow::about() 1453void MainWindow::about()
1450{ 1454{
1451 QString version; 1455 QString version;
1452#include <../version> 1456#include <../version>
1453 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1457 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1454 i18n("KOrganizer/Platform-independent\n") + 1458 i18n("KOrganizer/Platform-independent\n") +
1455 "(KO/Pi) " + version + " - " + 1459 "(KO/Pi) " + version + " - " +
1456 1460
1457#ifdef DESKTOP_VERSION 1461#ifdef DESKTOP_VERSION
1458 i18n("Desktop Edition\n") + 1462 i18n("Desktop Edition\n") +
1459#else 1463#else
1460 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1464 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1461#endif 1465#endif
1462 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!") ); 1466 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!") );
1463} 1467}
1464void MainWindow::keyBindings() 1468void MainWindow::keyBindings()
1465{ 1469{
1466 QString cap = i18n("KO/Pi Keys + Colors"); 1470 QString cap = i18n("KO/Pi Keys + Colors");
1467 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1471 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1468 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1472 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1469 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1473 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1470 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1474 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1471 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1475 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1472 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1476 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1473 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1477 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1474 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1478 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1475 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1479 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1476 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1480 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1477 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1481 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1478 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1482 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1479 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1483 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1480 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1484 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1481 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1485 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1482 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1486 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1483 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1487 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1484 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1488 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1485 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1489 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1486 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1490 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1487 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1491 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1488 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1492 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1489 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1493 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1490 i18n("<p><h3>In agenda view:</h3></p>\n") + 1494 i18n("<p><h3>In agenda view:</h3></p>\n") +
1491 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1495 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1492 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1496 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1493 i18n("<p><h3>In todo view:</h3></p>\n") + 1497 i18n("<p><h3>In todo view:</h3></p>\n") +
1494 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1498 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1495 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1499 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1496 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1500 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1497 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1501 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1498 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1502 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1499 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1503 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1500 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1504 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1501 i18n("<p><h3>In list view:</h3></p>\n") + 1505 i18n("<p><h3>In list view:</h3></p>\n") +
1502 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1506 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1503 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1507 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1504 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1508 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1505 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1509 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1506 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1510 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1507 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1511 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1508 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1512 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1509 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1513 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1510 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1514 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1511 i18n("<p><b>E</b>: Edit item</p>\n") + 1515 i18n("<p><b>E</b>: Edit item</p>\n") +
1512 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1516 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1513 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1517 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1514 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1518 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1515 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1519 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1516 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1520 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1517 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1521 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1518 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1522 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1519 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1523 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1520 i18n("<p><b>White</b>: Item readonly</p>\n"); 1524 i18n("<p><b>White</b>: Item readonly</p>\n");
1521 displayText( text, cap); 1525 displayText( text, cap);
1522} 1526}
1523void MainWindow::aboutAutoSaving() 1527void MainWindow::aboutAutoSaving()
1524{ 1528{
1525 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"); 1529 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");
1526 1530
1527 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1531 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1528 1532
1529} 1533}
1530void MainWindow::aboutKnownBugs() 1534void MainWindow::aboutKnownBugs()
1531{ 1535{
1532 QMessageBox* msg; 1536 QMessageBox* msg;
1533 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1537 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1534 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")+ 1538 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")+
1535 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1539 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1536 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1540 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1537 i18n("\nor report them in the bugtracker on\n") + 1541 i18n("\nor report them in the bugtracker on\n") +
1538 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1542 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1539 QMessageBox::NoIcon, 1543 QMessageBox::NoIcon,
1540 QMessageBox::Ok, 1544 QMessageBox::Ok,
1541 QMessageBox::NoButton, 1545 QMessageBox::NoButton,
1542 QMessageBox::NoButton); 1546 QMessageBox::NoButton);
1543 msg->exec(); 1547 msg->exec();
1544 delete msg; 1548 delete msg;
1545 1549
1546} 1550}
1547 1551
1548QString MainWindow::defaultFileName() 1552QString MainWindow::defaultFileName()
1549{ 1553{
1550 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1554 return locateLocal( "data", "korganizer/mycalendar.ics" );
1551} 1555}
1552QString MainWindow::syncFileName() 1556QString MainWindow::syncFileName()
1553{ 1557{
1554#ifdef DESKTOP_VERSION 1558#ifdef DESKTOP_VERSION
1555 return locateLocal( "tmp", "synccalendar.ics" ); 1559 return locateLocal( "tmp", "synccalendar.ics" );
1556#else 1560#else
1557 return QString( "/tmp/synccalendar.ics" ); 1561 return QString( "/tmp/synccalendar.ics" );
1558#endif 1562#endif
1559} 1563}
1560#include "koglobals.h" 1564#include "koglobals.h"
1561#include <kcalendarsystem.h> 1565#include <kcalendarsystem.h>
1562void MainWindow::updateWeek(QDate seda) 1566void MainWindow::updateWeek(QDate seda)
1563{ 1567{
1564 int weekNum = KGlobal::locale()->weekNum ( seda ); 1568 int weekNum = KGlobal::locale()->weekNum ( seda );
1565 mWeekPixmap.fill( mWeekBgColor ); 1569 mWeekPixmap.fill( mWeekBgColor );
1566 QPainter p ( &mWeekPixmap ); 1570 QPainter p ( &mWeekPixmap );
1567 p.setFont( mWeekFont ); 1571 p.setFont( mWeekFont );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e75df70..bc76c0b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -1,730 +1,730 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 1998 Preston Brown 4 Copyright (c) 1998 Preston Brown
5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26 26
27#include <kdebug.h> 27#include <kdebug.h>
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#include <klocale.h> 30#include <klocale.h>
31 31
32#include "vcaldrag.h" 32#include "vcaldrag.h"
33#include "vcalformat.h" 33#include "vcalformat.h"
34#include "icalformat.h" 34#include "icalformat.h"
35#include "exceptions.h" 35#include "exceptions.h"
36#include "incidence.h" 36#include "incidence.h"
37#include "journal.h" 37#include "journal.h"
38#include "filestorage.h" 38#include "filestorage.h"
39#include "calfilter.h" 39#include "calfilter.h"
40 40
41#include "calendarlocal.h" 41#include "calendarlocal.h"
42 42
43// #ifndef DESKTOP_VERSION 43// #ifndef DESKTOP_VERSION
44// #include <qtopia/alarmserver.h> 44// #include <qtopia/alarmserver.h>
45// #endif 45// #endif
46using namespace KCal; 46using namespace KCal;
47 47
48CalendarLocal::CalendarLocal() 48CalendarLocal::CalendarLocal()
49 : Calendar() 49 : Calendar()
50{ 50{
51 init(); 51 init();
52} 52}
53 53
54CalendarLocal::CalendarLocal(const QString &timeZoneId) 54CalendarLocal::CalendarLocal(const QString &timeZoneId)
55 : Calendar(timeZoneId) 55 : Calendar(timeZoneId)
56{ 56{
57 init(); 57 init();
58} 58}
59 59
60void CalendarLocal::init() 60void CalendarLocal::init()
61{ 61{
62 mNextAlarmIncidence = 0; 62 mNextAlarmIncidence = 0;
63} 63}
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 close(); 68 close();
69} 69}
70 70
71bool CalendarLocal::load( const QString &fileName ) 71bool CalendarLocal::load( const QString &fileName )
72{ 72{
73 FileStorage storage( this, fileName ); 73 FileStorage storage( this, fileName );
74 return storage.load(); 74 return storage.load();
75} 75}
76 76
77bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 77bool CalendarLocal::save( const QString &fileName, CalFormat *format )
78{ 78{
79 FileStorage storage( this, fileName, format ); 79 FileStorage storage( this, fileName, format );
80 return storage.save(); 80 return storage.save();
81} 81}
82 82
83void CalendarLocal::close() 83void CalendarLocal::close()
84{ 84{
85 85
86 Todo * i; 86 Todo * i;
87 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 87 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
88 88
89 mEventList.setAutoDelete( true ); 89 mEventList.setAutoDelete( true );
90 mTodoList.setAutoDelete( true ); 90 mTodoList.setAutoDelete( true );
91 mJournalList.setAutoDelete( false ); 91 mJournalList.setAutoDelete( false );
92 92
93 mEventList.clear(); 93 mEventList.clear();
94 mTodoList.clear(); 94 mTodoList.clear();
95 mJournalList.clear(); 95 mJournalList.clear();
96 96
97 mEventList.setAutoDelete( false ); 97 mEventList.setAutoDelete( false );
98 mTodoList.setAutoDelete( false ); 98 mTodoList.setAutoDelete( false );
99 mJournalList.setAutoDelete( false ); 99 mJournalList.setAutoDelete( false );
100 100
101 setModified( false ); 101 setModified( false );
102} 102}
103 103
104bool CalendarLocal::addAnniversaryNoDup( Event *event ) 104bool CalendarLocal::addAnniversaryNoDup( Event *event )
105{ 105{
106 QString cat; 106 QString cat;
107 bool isBirthday = true; 107 bool isBirthday = true;
108 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 108 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
109 isBirthday = false; 109 isBirthday = false;
110 cat = i18n( "Anniversary" ); 110 cat = i18n( "Anniversary" );
111 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 111 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
112 isBirthday = true; 112 isBirthday = true;
113 cat = i18n( "Birthday" ); 113 cat = i18n( "Birthday" );
114 } else { 114 } else {
115 qDebug("addAnniversaryNoDup called without fitting category! "); 115 qDebug("addAnniversaryNoDup called without fitting category! ");
116 return false; 116 return false;
117 } 117 }
118 Event * eve; 118 Event * eve;
119 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 119 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
120 if ( !(eve->categories().contains( cat ) )) 120 if ( !(eve->categories().contains( cat ) ))
121 continue; 121 continue;
122 // now we have an event with fitting category 122 // now we have an event with fitting category
123 if ( eve->dtStart().date() != event->dtStart().date() ) 123 if ( eve->dtStart().date() != event->dtStart().date() )
124 continue; 124 continue;
125 // now we have an event with fitting category+date 125 // now we have an event with fitting category+date
126 if ( eve->summary() != event->summary() ) 126 if ( eve->summary() != event->summary() )
127 continue; 127 continue;
128 // now we have an event with fitting category+date+summary 128 // now we have an event with fitting category+date+summary
129 return false; 129 return false;
130 } 130 }
131 return addEvent( event ); 131 return addEvent( event );
132 132
133} 133}
134bool CalendarLocal::addEventNoDup( Event *event ) 134bool CalendarLocal::addEventNoDup( Event *event )
135{ 135{
136 Event * eve; 136 Event * eve;
137 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 137 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
138 if ( *eve == *event ) { 138 if ( *eve == *event ) {
139 //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); 139 //qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
140 return false; 140 return false;
141 } 141 }
142 } 142 }
143 return addEvent( event ); 143 return addEvent( event );
144} 144}
145 145
146bool CalendarLocal::addEvent( Event *event ) 146bool CalendarLocal::addEvent( Event *event )
147{ 147{
148 insertEvent( event ); 148 insertEvent( event );
149 149
150 event->registerObserver( this ); 150 event->registerObserver( this );
151 151
152 setModified( true ); 152 setModified( true );
153 153
154 return true; 154 return true;
155} 155}
156 156
157void CalendarLocal::deleteEvent( Event *event ) 157void CalendarLocal::deleteEvent( Event *event )
158{ 158{
159 if ( mUndoIncidence ) delete mUndoIncidence; 159 if ( mUndoIncidence ) delete mUndoIncidence;
160 mUndoIncidence = event->clone(); 160 mUndoIncidence = event->clone();
161 if ( mEventList.removeRef( event ) ) { 161 if ( mEventList.removeRef( event ) ) {
162 setModified( true ); 162 setModified( true );
163 } 163 }
164} 164}
165 165
166 166
167Event *CalendarLocal::event( const QString &uid ) 167Event *CalendarLocal::event( const QString &uid )
168{ 168{
169 169
170 Event *event; 170 Event *event;
171 171
172 for ( event = mEventList.first(); event; event = mEventList.next() ) { 172 for ( event = mEventList.first(); event; event = mEventList.next() ) {
173 if ( event->uid() == uid ) { 173 if ( event->uid() == uid ) {
174 return event; 174 return event;
175 } 175 }
176 } 176 }
177 177
178 return 0; 178 return 0;
179} 179}
180bool CalendarLocal::addTodoNoDup( Todo *todo ) 180bool CalendarLocal::addTodoNoDup( Todo *todo )
181{ 181{
182 Todo * eve; 182 Todo * eve;
183 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { 183 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) {
184 if ( *eve == *todo ) { 184 if ( *eve == *todo ) {
185 //qDebug("duplicate todo found! not inserted! "); 185 //qDebug("duplicate todo found! not inserted! ");
186 return false; 186 return false;
187 } 187 }
188 } 188 }
189 return addTodo( todo ); 189 return addTodo( todo );
190} 190}
191bool CalendarLocal::addTodo( Todo *todo ) 191bool CalendarLocal::addTodo( Todo *todo )
192{ 192{
193 mTodoList.append( todo ); 193 mTodoList.append( todo );
194 194
195 todo->registerObserver( this ); 195 todo->registerObserver( this );
196 196
197 // Set up subtask relations 197 // Set up subtask relations
198 setupRelations( todo ); 198 setupRelations( todo );
199 199
200 setModified( true ); 200 setModified( true );
201 201
202 return true; 202 return true;
203} 203}
204 204
205void CalendarLocal::deleteTodo( Todo *todo ) 205void CalendarLocal::deleteTodo( Todo *todo )
206{ 206{
207 // Handle orphaned children 207 // Handle orphaned children
208 if ( mUndoIncidence ) delete mUndoIncidence; 208 if ( mUndoIncidence ) delete mUndoIncidence;
209 removeRelations( todo ); 209 removeRelations( todo );
210 mUndoIncidence = todo->clone(); 210 mUndoIncidence = todo->clone();
211 211
212 if ( mTodoList.removeRef( todo ) ) { 212 if ( mTodoList.removeRef( todo ) ) {
213 setModified( true ); 213 setModified( true );
214 } 214 }
215} 215}
216 216
217QPtrList<Todo> CalendarLocal::rawTodos() 217QPtrList<Todo> CalendarLocal::rawTodos()
218{ 218{
219 return mTodoList; 219 return mTodoList;
220} 220}
221Todo *CalendarLocal::todo( QString syncProf, QString id ) 221Todo *CalendarLocal::todo( QString syncProf, QString id )
222{ 222{
223 Todo *todo; 223 Todo *todo;
224 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 224 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
225 if ( todo->getID( syncProf ) == id ) return todo; 225 if ( todo->getID( syncProf ) == id ) return todo;
226 } 226 }
227 227
228 return 0; 228 return 0;
229} 229}
230void CalendarLocal::removeSyncInfo( QString syncProfile) 230void CalendarLocal::removeSyncInfo( QString syncProfile)
231{ 231{
232 QPtrList<Incidence> all = rawIncidences() ; 232 QPtrList<Incidence> all = rawIncidences() ;
233 Incidence *inc; 233 Incidence *inc;
234 for ( inc = all.first(); inc; inc = all.next() ) { 234 for ( inc = all.first(); inc; inc = all.next() ) {
235 inc->removeID( syncProfile ); 235 inc->removeID( syncProfile );
236 } 236 }
237 if ( syncProfile.isEmpty() ) { 237 if ( syncProfile.isEmpty() ) {
238 QPtrList<Event> el; 238 QPtrList<Event> el;
239 Event *todo; 239 Event *todo;
240 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 240 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
241 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 241 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
242 el.append( todo ); 242 el.append( todo );
243 } 243 }
244 for ( todo = el.first(); todo; todo = el.next() ) { 244 for ( todo = el.first(); todo; todo = el.next() ) {
245 deleteIncidence ( todo ); 245 deleteIncidence ( todo );
246 } 246 }
247 } else { 247 } else {
248 Event *lse = event( "last-syncEvent-"+ syncProfile); 248 Event *lse = event( "last-syncEvent-"+ syncProfile);
249 if ( lse ) 249 if ( lse )
250 deleteIncidence ( lse ); 250 deleteIncidence ( lse );
251 } 251 }
252} 252}
253QPtrList<Event> CalendarLocal::getExternLastSyncEvents() 253QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
254{ 254{
255 QPtrList<Event> el; 255 QPtrList<Event> el;
256 Event *todo; 256 Event *todo;
257 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 257 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
258 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 258 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
259 if ( todo->summary().left(3) == "E: " ) 259 if ( todo->summary().left(3) == "E: " )
260 el.append( todo ); 260 el.append( todo );
261 } 261 }
262 262
263 return el; 263 return el;
264 264
265} 265}
266Event *CalendarLocal::event( QString syncProf, QString id ) 266Event *CalendarLocal::event( QString syncProf, QString id )
267{ 267{
268 Event *todo; 268 Event *todo;
269 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 269 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
270 if ( todo->getID( syncProf ) == id ) return todo; 270 if ( todo->getID( syncProf ) == id ) return todo;
271 } 271 }
272 272
273 return 0; 273 return 0;
274} 274}
275Todo *CalendarLocal::todo( const QString &uid ) 275Todo *CalendarLocal::todo( const QString &uid )
276{ 276{
277 Todo *todo; 277 Todo *todo;
278 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 278 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
279 if ( todo->uid() == uid ) return todo; 279 if ( todo->uid() == uid ) return todo;
280 } 280 }
281 281
282 return 0; 282 return 0;
283} 283}
284QString CalendarLocal::nextSummary() const 284QString CalendarLocal::nextSummary() const
285{ 285{
286 return mNextSummary; 286 return mNextSummary;
287} 287}
288QDateTime CalendarLocal::nextAlarmEventDateTime() const 288QDateTime CalendarLocal::nextAlarmEventDateTime() const
289{ 289{
290 return mNextAlarmEventDateTime; 290 return mNextAlarmEventDateTime;
291} 291}
292void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) 292void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
293{ 293{
294 //mNextAlarmIncidence 294 //mNextAlarmIncidence
295 //mNextAlarmDateTime 295 //mNextAlarmDateTime
296 //return mNextSummary; 296 //return mNextSummary;
297 //return mNextAlarmEventDateTime; 297 //return mNextAlarmEventDateTime;
298 bool newNextAlarm = false; 298 bool newNextAlarm = false;
299 bool computeNextAlarm = false; 299 bool computeNextAlarm = false;
300 bool ok; 300 bool ok;
301 int offset; 301 int offset;
302 QDateTime nextA; 302 QDateTime nextA;
303 // QString nextSum; 303 // QString nextSum;
304 //QDateTime nextEvent; 304 //QDateTime nextEvent;
305 if ( mNextAlarmIncidence == 0 || incidence == 0 ) { 305 if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
306 computeNextAlarm = true; 306 computeNextAlarm = true;
307 } else { 307 } else {
308 if ( ! deleted ) { 308 if ( ! deleted ) {
309 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 309 nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
310 if ( ok ) { 310 if ( ok ) {
311 if ( nextA < mNextAlarmDateTime ) { 311 if ( nextA < mNextAlarmDateTime ) {
312 deRegisterAlarm(); 312 deRegisterAlarm();
313 mNextAlarmDateTime = nextA; 313 mNextAlarmDateTime = nextA;
314 mNextSummary = incidence->summary(); 314 mNextSummary = incidence->summary();
315 mNextAlarmEventDateTime = nextA.addSecs(offset ) ; 315 mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
316 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 316 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
317 newNextAlarm = true; 317 newNextAlarm = true;
318 mNextAlarmIncidence = incidence; 318 mNextAlarmIncidence = incidence;
319 } else { 319 } else {
320 if ( incidence == mNextAlarmIncidence ) { 320 if ( incidence == mNextAlarmIncidence ) {
321 computeNextAlarm = true; 321 computeNextAlarm = true;
322 } 322 }
323 } 323 }
324 } else { 324 } else {
325 if ( mNextAlarmIncidence == incidence ) { 325 if ( mNextAlarmIncidence == incidence ) {
326 computeNextAlarm = true; 326 computeNextAlarm = true;
327 } 327 }
328 } 328 }
329 } else { // deleted 329 } else { // deleted
330 if ( incidence == mNextAlarmIncidence ) { 330 if ( incidence == mNextAlarmIncidence ) {
331 computeNextAlarm = true; 331 computeNextAlarm = true;
332 } 332 }
333 } 333 }
334 } 334 }
335 if ( computeNextAlarm ) { 335 if ( computeNextAlarm ) {
336 deRegisterAlarm(); 336 deRegisterAlarm();
337 nextA = nextAlarm( 1000 ); 337 nextA = nextAlarm( 1000 );
338 if (! mNextAlarmIncidence ) { 338 if (! mNextAlarmIncidence ) {
339 return; 339 return;
340 } 340 }
341 newNextAlarm = true; 341 newNextAlarm = true;
342 } 342 }
343 if ( newNextAlarm ) 343 if ( newNextAlarm )
344 registerAlarm(); 344 registerAlarm();
345} 345}
346QString CalendarLocal:: getAlarmNotification() 346QString CalendarLocal:: getAlarmNotification()
347{ 347{
348 QString ret; 348 QString ret;
349 // this should not happen 349 // this should not happen
350 if (! mNextAlarmIncidence ) 350 if (! mNextAlarmIncidence )
351 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; 351 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
352 Alarm* alarm = mNextAlarmIncidence->alarms().first(); 352 Alarm* alarm = mNextAlarmIncidence->alarms().first();
353 if ( alarm->type() == Alarm::Procedure ) { 353 if ( alarm->type() == Alarm::Procedure ) {
354 ret = "proc_alarm" + alarm->programFile()+"+++"; 354 ret = "proc_alarm" + alarm->programFile()+"+++";
355 } else { 355 } else {
356 ret = "audio_alarm" +alarm->audioFile() +"+++"; 356 ret = "audio_alarm" +alarm->audioFile() +"+++";
357 } 357 }
358 ret += "cal_alarm"+ mNextSummary.left( 25 ); 358 ret += "cal_alarm"+ mNextSummary.left( 25 );
359 if ( mNextSummary.length() > 25 ) 359 if ( mNextSummary.length() > 25 )
360 ret += "\n" + mNextSummary.mid(25, 25 ); 360 ret += "\n" + mNextSummary.mid(25, 25 );
361 ret+= "\n"+mNextAlarmEventDateTimeString; 361 ret+= "\n"+mNextAlarmEventDateTimeString;
362 return ret; 362 return ret;
363} 363}
364void CalendarLocal::registerAlarm() 364void CalendarLocal::registerAlarm()
365{ 365{
366 mLastAlarmNotificationString = getAlarmNotification(); 366 mLastAlarmNotificationString = getAlarmNotification();
367 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); 367 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
368 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 368 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
369// #ifndef DESKTOP_VERSION 369// #ifndef DESKTOP_VERSION
370// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); 370// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
371// #endif 371// #endif
372} 372}
373void CalendarLocal::deRegisterAlarm() 373void CalendarLocal::deRegisterAlarm()
374{ 374{
375 if ( mLastAlarmNotificationString.isNull() ) 375 if ( mLastAlarmNotificationString.isNull() )
376 return; 376 return;
377 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); 377 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
378 378
379 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 379 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
380 mNextAlarmEventDateTime = QDateTime(); 380 mNextAlarmEventDateTime = QDateTime();
381// #ifndef DESKTOP_VERSION 381// #ifndef DESKTOP_VERSION
382// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); 382// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
383// #endif 383// #endif
384} 384}
385 385
386QPtrList<Todo> CalendarLocal::todos( const QDate &date ) 386QPtrList<Todo> CalendarLocal::todos( const QDate &date )
387{ 387{
388 QPtrList<Todo> todos; 388 QPtrList<Todo> todos;
389 389
390 Todo *todo; 390 Todo *todo;
391 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 391 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
392 if ( todo->hasDueDate() && todo->dtDue().date() == date ) { 392 if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
393 todos.append( todo ); 393 todos.append( todo );
394 } 394 }
395 } 395 }
396 396
397 filter()->apply( &todos ); 397 filter()->apply( &todos );
398 return todos; 398 return todos;
399} 399}
400void CalendarLocal::reInitAlarmSettings() 400void CalendarLocal::reInitAlarmSettings()
401{ 401{
402 if ( !mNextAlarmIncidence ) { 402 if ( !mNextAlarmIncidence ) {
403 nextAlarm( 1000 ); 403 nextAlarm( 1000 );
404 } 404 }
405 deRegisterAlarm(); 405 deRegisterAlarm();
406 mNextAlarmIncidence = 0; 406 mNextAlarmIncidence = 0;
407 checkAlarmForIncidence( 0, false ); 407 checkAlarmForIncidence( 0, false );
408 408
409} 409}
410 410
411 411
412 412
413QDateTime CalendarLocal::nextAlarm( int daysTo ) 413QDateTime CalendarLocal::nextAlarm( int daysTo )
414{ 414{
415 QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); 415 QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo );
416 QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); 416 QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
417 QDateTime next; 417 QDateTime next;
418 Event *e; 418 Event *e;
419 bool ok; 419 bool ok;
420 bool found = false; 420 bool found = false;
421 int offset; 421 int offset;
422 mNextAlarmIncidence = 0; 422 mNextAlarmIncidence = 0;
423 for( e = mEventList.first(); e; e = mEventList.next() ) { 423 for( e = mEventList.first(); e; e = mEventList.next() ) {
424 next = e->getNextAlarmDateTime(& ok, &offset ) ; 424 next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
425 if ( ok ) { 425 if ( ok ) {
426 if ( next < nextA ) { 426 if ( next < nextA ) {
427 nextA = next; 427 nextA = next;
428 found = true; 428 found = true;
429 mNextSummary = e->summary(); 429 mNextSummary = e->summary();
430 mNextAlarmEventDateTime = next.addSecs(offset ) ; 430 mNextAlarmEventDateTime = next.addSecs(offset ) ;
431 mNextAlarmIncidence = (Incidence *) e; 431 mNextAlarmIncidence = (Incidence *) e;
432 } 432 }
433 } 433 }
434 } 434 }
435 Todo *t; 435 Todo *t;
436 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 436 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
437 next = t->getNextAlarmDateTime(& ok, &offset ) ; 437 next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
438 if ( ok ) { 438 if ( ok ) {
439 if ( next < nextA ) { 439 if ( next < nextA ) {
440 nextA = next; 440 nextA = next;
441 found = true; 441 found = true;
442 mNextSummary = t->summary(); 442 mNextSummary = t->summary();
443 mNextAlarmEventDateTime = next.addSecs(offset ); 443 mNextAlarmEventDateTime = next.addSecs(offset );
444 mNextAlarmIncidence = (Incidence *) t; 444 mNextAlarmIncidence = (Incidence *) t;
445 } 445 }
446 } 446 }
447 } 447 }
448 if ( mNextAlarmIncidence ) { 448 if ( mNextAlarmIncidence ) {
449 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 449 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
450 mNextAlarmDateTime = nextA; 450 mNextAlarmDateTime = nextA;
451 } 451 }
452 return nextA; 452 return nextA;
453} 453}
454Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) 454Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
455{ 455{
456 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); 456 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
457} 457}
458 458
459Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) 459Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
460{ 460{
461 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " 461 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - "
462 << to.toString() << ")\n"; 462 << to.toString() << ")\n";
463 463
464 Alarm::List alarms; 464 Alarm::List alarms;
465 465
466 Event *e; 466 Event *e;
467 467
468 for( e = mEventList.first(); e; e = mEventList.next() ) { 468 for( e = mEventList.first(); e; e = mEventList.next() ) {
469 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); 469 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
470 else appendAlarms( alarms, e, from, to ); 470 else appendAlarms( alarms, e, from, to );
471 } 471 }
472 472
473 Todo *t; 473 Todo *t;
474 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 474 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
475 appendAlarms( alarms, t, from, to ); 475 appendAlarms( alarms, t, from, to );
476 } 476 }
477 477
478 return alarms; 478 return alarms;
479} 479}
480 480
481void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, 481void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
482 const QDateTime &from, const QDateTime &to ) 482 const QDateTime &from, const QDateTime &to )
483{ 483{
484 QPtrList<Alarm> alarmList = incidence->alarms(); 484 QPtrList<Alarm> alarmList = incidence->alarms();
485 Alarm *alarm; 485 Alarm *alarm;
486 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 486 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
487// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() 487// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
488// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; 488// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
489 if ( alarm->enabled() ) { 489 if ( alarm->enabled() ) {
490 if ( alarm->time() >= from && alarm->time() <= to ) { 490 if ( alarm->time() >= from && alarm->time() <= to ) {
491 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() 491 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary()
492 << "': " << alarm->time().toString() << endl; 492 << "': " << alarm->time().toString() << endl;
493 alarms.append( alarm ); 493 alarms.append( alarm );
494 } 494 }
495 } 495 }
496 } 496 }
497} 497}
498 498
499void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, 499void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms,
500 Incidence *incidence, 500 Incidence *incidence,
501 const QDateTime &from, 501 const QDateTime &from,
502 const QDateTime &to ) 502 const QDateTime &to )
503{ 503{
504 504
505 QPtrList<Alarm> alarmList = incidence->alarms(); 505 QPtrList<Alarm> alarmList = incidence->alarms();
506 Alarm *alarm; 506 Alarm *alarm;
507 QDateTime qdt; 507 QDateTime qdt;
508 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 508 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
509 if (incidence->recursOn(from.date())) { 509 if (incidence->recursOn(from.date())) {
510 qdt.setTime(alarm->time().time()); 510 qdt.setTime(alarm->time().time());
511 qdt.setDate(from.date()); 511 qdt.setDate(from.date());
512 } 512 }
513 else qdt = alarm->time(); 513 else qdt = alarm->time();
514 // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); 514 // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1());
515 if ( alarm->enabled() ) { 515 if ( alarm->enabled() ) {
516 if ( qdt >= from && qdt <= to ) { 516 if ( qdt >= from && qdt <= to ) {
517 alarms.append( alarm ); 517 alarms.append( alarm );
518 } 518 }
519 } 519 }
520 } 520 }
521} 521}
522 522
523 523
524/****************************** PROTECTED METHODS ****************************/ 524/****************************** PROTECTED METHODS ****************************/
525 525
526// after changes are made to an event, this should be called. 526// after changes are made to an event, this should be called.
527void CalendarLocal::update( IncidenceBase *incidence ) 527void CalendarLocal::update( IncidenceBase *incidence )
528{ 528{
529 incidence->setSyncStatus( Event::SYNCMOD ); 529 incidence->setSyncStatus( Event::SYNCMOD );
530 incidence->setLastModified( QDateTime::currentDateTime() ); 530 incidence->setLastModified( QDateTime::currentDateTime() );
531 // we should probably update the revision number here, 531 // we should probably update the revision number here,
532 // or internally in the Event itself when certain things change. 532 // or internally in the Event itself when certain things change.
533 // need to verify with ical documentation. 533 // need to verify with ical documentation.
534 534
535 setModified( true ); 535 setModified( true );
536} 536}
537 537
538void CalendarLocal::insertEvent( Event *event ) 538void CalendarLocal::insertEvent( Event *event )
539{ 539{
540 if ( mEventList.findRef( event ) < 0 ) mEventList.append( event ); 540 if ( mEventList.findRef( event ) < 0 ) mEventList.append( event );
541} 541}
542 542
543 543
544QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) 544QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
545{ 545{
546 QPtrList<Event> eventList; 546 QPtrList<Event> eventList;
547 547
548 Event *event; 548 Event *event;
549 for( event = mEventList.first(); event; event = mEventList.next() ) { 549 for( event = mEventList.first(); event; event = mEventList.next() ) {
550 if ( event->doesRecur() ) { 550 if ( event->doesRecur() ) {
551 if ( event->isMultiDay() ) { 551 if ( event->isMultiDay() ) {
552 int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); 552 int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() );
553 int i; 553 int i;
554 for ( i = 0; i <= extraDays; i++ ) { 554 for ( i = 0; i <= extraDays; i++ ) {
555 if ( event->recursOn( qd.addDays( -i ) ) ) { 555 if ( event->recursOn( qd.addDays( -i ) ) ) {
556 eventList.append( event ); 556 eventList.append( event );
557 break; 557 break;
558 } 558 }
559 } 559 }
560 } else { 560 } else {
561 if ( event->recursOn( qd ) ) 561 if ( event->recursOn( qd ) )
562 eventList.append( event ); 562 eventList.append( event );
563 } 563 }
564 } else { 564 } else {
565 if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { 565 if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) {
566 eventList.append( event ); 566 eventList.append( event );
567 } 567 }
568 } 568 }
569 } 569 }
570 570
571 if ( !sorted ) { 571 if ( !sorted ) {
572 return eventList; 572 return eventList;
573 } 573 }
574 574
575 // kdDebug(5800) << "Sorting events for date\n" << endl; 575 // kdDebug(5800) << "Sorting events for date\n" << endl;
576 // now, we have to sort it based on dtStart.time() 576 // now, we have to sort it based on dtStart.time()
577 QPtrList<Event> eventListSorted; 577 QPtrList<Event> eventListSorted;
578 Event *sortEvent; 578 Event *sortEvent;
579 for ( event = eventList.first(); event; event = eventList.next() ) { 579 for ( event = eventList.first(); event; event = eventList.next() ) {
580 sortEvent = eventListSorted.first(); 580 sortEvent = eventListSorted.first();
581 int i = 0; 581 int i = 0;
582 while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) 582 while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() )
583 { 583 {
584 i++; 584 i++;
585 sortEvent = eventListSorted.next(); 585 sortEvent = eventListSorted.next();
586 } 586 }
587 eventListSorted.insert( i, event ); 587 eventListSorted.insert( i, event );
588 } 588 }
589 return eventListSorted; 589 return eventListSorted;
590} 590}
591 591
592 592
593QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, 593QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
594 bool inclusive ) 594 bool inclusive )
595{ 595{
596 Event *event = 0; 596 Event *event = 0;
597 597
598 QPtrList<Event> eventList; 598 QPtrList<Event> eventList;
599 599
600 // Get non-recurring events 600 // Get non-recurring events
601 for( event = mEventList.first(); event; event = mEventList.next() ) { 601 for( event = mEventList.first(); event; event = mEventList.next() ) {
602 if ( event->doesRecur() ) { 602 if ( event->doesRecur() ) {
603 QDate rStart = event->dtStart().date(); 603 QDate rStart = event->dtStart().date();
604 bool found = false; 604 bool found = false;
605 if ( inclusive ) { 605 if ( inclusive ) {
606 if ( rStart >= start && rStart <= end ) { 606 if ( rStart >= start && rStart <= end ) {
607 // Start date of event is in range. Now check for end date. 607 // Start date of event is in range. Now check for end date.
608 // if duration is negative, event recurs forever, so do not include it. 608 // if duration is negative, event recurs forever, so do not include it.
609 if ( event->recurrence()->duration() == 0 ) { // End date set 609 if ( event->recurrence()->duration() == 0 ) { // End date set
610 QDate rEnd = event->recurrence()->endDate(); 610 QDate rEnd = event->recurrence()->endDate();
611 if ( rEnd >= start && rEnd <= end ) { // End date within range 611 if ( rEnd >= start && rEnd <= end ) { // End date within range
612 found = true; 612 found = true;
613 } 613 }
614 } else if ( event->recurrence()->duration() > 0 ) { // Duration set 614 } else if ( event->recurrence()->duration() > 0 ) { // Duration set
615 // TODO: Calculate end date from duration. Should be done in Event 615 // TODO: Calculate end date from duration. Should be done in Event
616 // For now exclude all events with a duration. 616 // For now exclude all events with a duration.
617 } 617 }
618 } 618 }
619 } else { 619 } else {
620 bool founOne; 620 bool founOne;
621 QDate next = event->getNextOccurence( start, &founOne ).date(); 621 QDate next = event->getNextOccurence( start, &founOne ).date();
622 if ( founOne ) { 622 if ( founOne ) {
623 if ( next <= end ) { 623 if ( next <= end ) {
624 found = true; 624 found = true;
625 } 625 }
626 } 626 }
627 627
628 /* 628 /*
629 // crap !!! 629 // crap !!!
630 if ( rStart <= end ) { // Start date not after range 630 if ( rStart <= end ) { // Start date not after range
631 if ( rStart >= start ) { // Start date within range 631 if ( rStart >= start ) { // Start date within range
632 found = true; 632 found = true;
633 } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever 633 } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever
634 found = true; 634 found = true;
635 } else if ( event->recurrence()->duration() == 0 ) { // End date set 635 } else if ( event->recurrence()->duration() == 0 ) { // End date set
636 QDate rEnd = event->recurrence()->endDate(); 636 QDate rEnd = event->recurrence()->endDate();
637 if ( rEnd >= start && rEnd <= end ) { // End date within range 637 if ( rEnd >= start && rEnd <= end ) { // End date within range
638 found = true; 638 found = true;
639 } 639 }
640 } else { // Duration set 640 } else { // Duration set
641 // TODO: Calculate end date from duration. Should be done in Event 641 // TODO: Calculate end date from duration. Should be done in Event
642 // For now include all events with a duration. 642 // For now include all events with a duration.
643 found = true; 643 found = true;
644 } 644 }
645 } 645 }
646 */ 646 */
647 647
648 } 648 }
649 649
650 if ( found ) eventList.append( event ); 650 if ( found ) eventList.append( event );
651 } else { 651 } else {
652 QDate s = event->dtStart().date(); 652 QDate s = event->dtStart().date();
653 QDate e = event->dtEnd().date(); 653 QDate e = event->dtEnd().date();
654 654
655 if ( inclusive ) { 655 if ( inclusive ) {
656 if ( s >= start && e <= end ) { 656 if ( s >= start && e <= end ) {
657 eventList.append( event ); 657 eventList.append( event );
658 } 658 }
659 } else { 659 } else {
660 if ( ( s >= start && s <= end ) || ( e >= start && e <= end ) ) { 660 if ( ( s >= start && s <= end ) || ( e >= start && e <= end ) ) {
661 eventList.append( event ); 661 eventList.append( event );
662 } 662 }
663 } 663 }
664 } 664 }
665 } 665 }
666 666
667 return eventList; 667 return eventList;
668} 668}
669 669
670QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) 670QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
671{ 671{
672 return rawEventsForDate( qdt.date() ); 672 return rawEventsForDate( qdt.date() );
673} 673}
674 674
675QPtrList<Event> CalendarLocal::rawEvents() 675QPtrList<Event> CalendarLocal::rawEvents()
676{ 676{
677 return mEventList; 677 return mEventList;
678} 678}
679 679
680bool CalendarLocal::addJournal(Journal *journal) 680bool CalendarLocal::addJournal(Journal *journal)
681{ 681{
682 if ( journal->dtStart().isValid()) 682 if ( journal->dtStart().isValid())
683 kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; 683 kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl;
684 else 684 else
685 kdDebug(5800) << "Adding Journal without a DTSTART" << endl; 685 kdDebug(5800) << "Adding Journal without a DTSTART" << endl;
686 686
687 mJournalList.append(journal); 687 mJournalList.append(journal);
688 688
689 journal->registerObserver( this ); 689 journal->registerObserver( this );
690 690
691 setModified( true ); 691 setModified( true );
692 692
693 return true; 693 return true;
694} 694}
695 695
696void CalendarLocal::deleteJournal( Journal *journal ) 696void CalendarLocal::deleteJournal( Journal *journal )
697{ 697{
698 if ( mUndoIncidence ) delete mUndoIncidence; 698 if ( mUndoIncidence ) delete mUndoIncidence;
699 mUndoIncidence = journal->clone(); 699 mUndoIncidence = journal->clone();
700 mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); 700 mUndoIncidence->setSummary( mUndoIncidence->description().left(25));
701 if ( mJournalList.removeRef(journal) ) { 701 if ( mJournalList.removeRef(journal) ) {
702 setModified( true ); 702 setModified( true );
703 } 703 }
704} 704}
705 705
706Journal *CalendarLocal::journal( const QDate &date ) 706Journal *CalendarLocal::journal( const QDate &date )
707{ 707{
708// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; 708// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl;
709 709
710 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 710 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
711 if ( it->dtStart().date() == date ) 711 if ( it->dtStart().date() == date )
712 return it; 712 return it;
713 713
714 return 0; 714 return 0;
715} 715}
716 716
717Journal *CalendarLocal::journal( const QString &uid ) 717Journal *CalendarLocal::journal( const QString &uid )
718{ 718{
719 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 719 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
720 if ( it->uid() == uid ) 720 if ( it->uid() == uid )
721 return it; 721 return it;
722 722
723 return 0; 723 return 0;
724} 724}
725 725
726QPtrList<Journal> CalendarLocal::journals() 726QPtrList<Journal> CalendarLocal::journals()
727{ 727{
728 return mJournalList; 728 return mJournalList;
729} 729}
730 730
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index de8dceb..9b99855 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -1,221 +1,221 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "event.h" 25#include "event.h"
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29Event::Event() : 29Event::Event() :
30 mHasEndDate( false ), mTransparency( Opaque ) 30 mHasEndDate( false ), mTransparency( Opaque )
31{ 31{
32} 32}
33 33
34Event::Event(const Event &e) : Incidence(e) 34Event::Event(const Event &e) : Incidence(e)
35{ 35{
36 mDtEnd = e.mDtEnd; 36 mDtEnd = e.mDtEnd;
37 mHasEndDate = e.mHasEndDate; 37 mHasEndDate = e.mHasEndDate;
38 mTransparency = e.mTransparency; 38 mTransparency = e.mTransparency;
39} 39}
40 40
41Event::~Event() 41Event::~Event()
42{ 42{
43} 43}
44 44
45Incidence *Event::clone() 45Incidence *Event::clone()
46{ 46{
47 return new Event(*this); 47 return new Event(*this);
48} 48}
49 49
50bool KCal::operator==( const Event& e1, const Event& e2 ) 50bool KCal::operator==( const Event& e1, const Event& e2 )
51{ 51{
52 return operator==( (const Incidence&)e1, (const Incidence&)e2 ) && 52 return operator==( (const Incidence&)e1, (const Incidence&)e2 ) &&
53 e1.dtEnd() == e2.dtEnd() && 53 e1.dtEnd() == e2.dtEnd() &&
54 e1.hasEndDate() == e2.hasEndDate() && 54 e1.hasEndDate() == e2.hasEndDate() &&
55 e1.transparency() == e2.transparency(); 55 e1.transparency() == e2.transparency();
56} 56}
57 57
58 58
59bool Event::contains ( Event* from ) 59bool Event::contains ( Event* from )
60{ 60{
61 61
62 if ( !from->summary().isEmpty() ) 62 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() )) 63 if ( !summary().startsWith( from->summary() ))
64 return false; 64 return false;
65 if ( from->dtStart().isValid() ) 65 if ( from->dtStart().isValid() )
66 if (dtStart() != from->dtStart() ) 66 if (dtStart() != from->dtStart() )
67 return false; 67 return false;
68 if ( from->dtEnd().isValid() ) 68 if ( from->dtEnd().isValid() )
69 if ( dtEnd() != from->dtEnd() ) 69 if ( dtEnd() != from->dtEnd() )
70 return false; 70 return false;
71 if ( !from->location().isEmpty() ) 71 if ( !from->location().isEmpty() )
72 if ( !location().startsWith( from->location() ) ) 72 if ( !location().startsWith( from->location() ) )
73 return false; 73 return false;
74 if ( !from->description().isEmpty() ) 74 if ( !from->description().isEmpty() )
75 if ( !description().startsWith( from->description() )) 75 if ( !description().startsWith( from->description() ))
76 return false; 76 return false;
77 if ( from->alarms().count() ) { 77 if ( from->alarms().count() ) {
78 Alarm *a = from->alarms().first(); 78 Alarm *a = from->alarms().first();
79 if ( a->enabled() ){ 79 if ( a->enabled() ){
80 if ( !alarms().count() ) 80 if ( !alarms().count() )
81 return false; 81 return false;
82 Alarm *b = alarms().first(); 82 Alarm *b = alarms().first();
83 if( ! b->enabled() ) 83 if( ! b->enabled() )
84 return false; 84 return false;
85 if ( ! (a->offset() == b->offset() )) 85 if ( ! (a->offset() == b->offset() ))
86 return false; 86 return false;
87 } 87 }
88 } 88 }
89 QStringList cat = categories(); 89 QStringList cat = categories();
90 QStringList catFrom = from->categories(); 90 QStringList catFrom = from->categories();
91 QString nCat; 91 QString nCat;
92 unsigned int iii; 92 unsigned int iii;
93 for ( iii = 0; iii < catFrom.count();++iii ) { 93 for ( iii = 0; iii < catFrom.count();++iii ) {
94 nCat = catFrom[iii]; 94 nCat = catFrom[iii];
95 if ( !nCat.isEmpty() ) 95 if ( !nCat.isEmpty() )
96 if ( !cat.contains( nCat )) { 96 if ( !cat.contains( nCat )) {
97 return false; 97 return false;
98 } 98 }
99 } 99 }
100 if ( from->doesRecur() ) 100 if ( from->doesRecur() )
101 if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) ) 101 if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) )
102 return false; 102 return false;
103 return true; 103 return true;
104} 104}
105 105
106void Event::setDtEnd(const QDateTime &dtEnd) 106void Event::setDtEnd(const QDateTime &dtEnd)
107{ 107{
108 if (mReadOnly) return; 108 if (mReadOnly) return;
109 109
110 mDtEnd = getEvenTime( dtEnd ); 110 mDtEnd = getEvenTime( dtEnd );
111 111
112 setHasEndDate(true); 112 setHasEndDate(true);
113 setHasDuration(false); 113 setHasDuration(false);
114 114
115 updated(); 115 updated();
116} 116}
117 117
118QDateTime Event::dtEnd() const 118QDateTime Event::dtEnd() const
119{ 119{
120 if (hasEndDate()) return mDtEnd; 120 if (hasEndDate()) return mDtEnd;
121 if (hasDuration()) return dtStart().addSecs(duration()); 121 if (hasDuration()) return dtStart().addSecs(duration());
122 122
123 return dtStart(); 123 return dtStart();
124} 124}
125 125
126QString Event::dtEndTimeStr() const 126QString Event::dtEndTimeStr() const
127{ 127{
128 return KGlobal::locale()->formatTime(mDtEnd.time()); 128 return KGlobal::locale()->formatTime(mDtEnd.time());
129} 129}
130 130
131QString Event::dtEndDateStr(bool shortfmt) const 131QString Event::dtEndDateStr(bool shortfmt) const
132{ 132{
133 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); 133 return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt);
134} 134}
135 135
136QString Event::dtEndStr(bool shortfmt) const 136QString Event::dtEndStr(bool shortfmt) const
137{ 137{
138 return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); 138 return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt);
139} 139}
140 140
141void Event::setHasEndDate(bool b) 141void Event::setHasEndDate(bool b)
142{ 142{
143 mHasEndDate = b; 143 mHasEndDate = b;
144} 144}
145 145
146bool Event::hasEndDate() const 146bool Event::hasEndDate() const
147{ 147{
148 return mHasEndDate; 148 return mHasEndDate;
149} 149}
150 150
151bool Event::isMultiDay() const 151bool Event::isMultiDay() const
152{ 152{
153 bool multi = !(dtStart().date() == dtEnd().date()); 153 bool multi = !(dtStart().date() == dtEnd().date());
154 return multi; 154 return multi;
155} 155}
156 156
157void Event::setTransparency(Event::Transparency transparency) 157void Event::setTransparency(Event::Transparency transparency)
158{ 158{
159 if (mReadOnly) return; 159 if (mReadOnly) return;
160 mTransparency = transparency; 160 mTransparency = transparency;
161 updated(); 161 updated();
162} 162}
163 163
164Event::Transparency Event::transparency() const 164Event::Transparency Event::transparency() const
165{ 165{
166 return mTransparency; 166 return mTransparency;
167} 167}
168 168
169void Event::setDuration(int seconds) 169void Event::setDuration(int seconds)
170{ 170{
171 setHasEndDate(false); 171 setHasEndDate(false);
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const 174QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
175{ 175{
176 176
177 bool yes; 177 bool yes;
178 QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes ); 178 QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
179 if ( ! yes || cancelled() ) { 179 if ( ! yes || cancelled() ) {
180 *ok = false; 180 *ok = false;
181 return QDateTime (); 181 return QDateTime ();
182 } 182 }
183 183
184 bool enabled = false; 184 bool enabled = false;
185 Alarm* alarm; 185 Alarm* alarm;
186 int off = 0; 186 int off = 0;
187 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 187 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
188 // if ( QDateTime::currentDateTime() > incidenceStart ){ 188 // if ( QDateTime::currentDateTime() > incidenceStart ){
189// *ok = false; 189// *ok = false;
190// return incidenceStart; 190// return incidenceStart;
191// } 191// }
192 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 192 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
193 if (alarm->enabled()) { 193 if (alarm->enabled()) {
194 if ( alarm->hasTime () ) { 194 if ( alarm->hasTime () ) {
195 if ( alarm->time() < alarmStart ) { 195 if ( alarm->time() < alarmStart ) {
196 alarmStart = alarm->time(); 196 alarmStart = alarm->time();
197 enabled = true; 197 enabled = true;
198 off = alarmStart.secsTo( incidenceStart ); 198 off = alarmStart.secsTo( incidenceStart );
199 } 199 }
200 200
201 } else { 201 } else {
202 int secs = alarm->startOffset().asSeconds(); 202 int secs = alarm->startOffset().asSeconds();
203 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 203 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
204 alarmStart = incidenceStart.addSecs( secs ); 204 alarmStart = incidenceStart.addSecs( secs );
205 enabled = true; 205 enabled = true;
206 off = -secs; 206 off = -secs;
207 } 207 }
208 } 208 }
209 } 209 }
210 } 210 }
211 if ( enabled ) { 211 if ( enabled ) {
212 if ( alarmStart > QDateTime::currentDateTime() ) { 212 if ( alarmStart > start_dt ) {
213 *ok = true; 213 *ok = true;
214 * offset = off; 214 * offset = off;
215 return alarmStart; 215 return alarmStart;
216 } 216 }
217 } 217 }
218 *ok = false; 218 *ok = false;
219 return QDateTime (); 219 return QDateTime ();
220 220
221} 221}
diff --git a/libkcal/event.h b/libkcal/event.h
index 3bc8adc..8729956 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -1,90 +1,90 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#ifndef EVENT_H 21#ifndef EVENT_H
22#define EVENT_H 22#define EVENT_H
23// 23//
24// Event component, representing a VEVENT object 24// Event component, representing a VEVENT object
25// 25//
26 26
27#include "incidence.h" 27#include "incidence.h"
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides an Event in the sense of RFC2445. 31 This class provides an Event in the sense of RFC2445.
32*/ 32*/
33class Event : public Incidence 33class Event : public Incidence
34{ 34{
35 public: 35 public:
36 enum Transparency { Opaque, Transparent }; 36 enum Transparency { Opaque, Transparent };
37 typedef ListBase<Event> List; 37 typedef ListBase<Event> List;
38 Event(); 38 Event();
39 Event(const Event &); 39 Event(const Event &);
40 ~Event(); 40 ~Event();
41 41
42 QCString type() const { return "Event"; } 42 QCString type() const { return "Event"; }
43 43
44 Incidence *clone(); 44 Incidence *clone();
45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
46 46
47 /** for setting an event's ending date/time with a QDateTime. */ 47 /** for setting an event's ending date/time with a QDateTime. */
48 void setDtEnd(const QDateTime &dtEnd); 48 void setDtEnd(const QDateTime &dtEnd);
49 /** Return the event's ending date/time as a QDateTime. */ 49 /** Return the event's ending date/time as a QDateTime. */
50 virtual QDateTime dtEnd() const; 50 virtual QDateTime dtEnd() const;
51 /** returns an event's end time as a string formatted according to the 51 /** returns an event's end time as a string formatted according to the
52 users locale settings */ 52 users locale settings */
53 QString dtEndTimeStr() const; 53 QString dtEndTimeStr() const;
54 /** returns an event's end date as a string formatted according to the 54 /** returns an event's end date as a string formatted according to the
55 users locale settings */ 55 users locale settings */
56 QString dtEndDateStr(bool shortfmt=true) const; 56 QString dtEndDateStr(bool shortfmt=true) const;
57 /** returns an event's end date and time as a string formatted according 57 /** returns an event's end date and time as a string formatted according
58 to the users locale settings */ 58 to the users locale settings */
59 QString dtEndStr(bool shortfmt=true) const; 59 QString dtEndStr(bool shortfmt=true) const;
60 void setHasEndDate(bool); 60 void setHasEndDate(bool);
61 /** Return whether the event has an end date/time. */ 61 /** Return whether the event has an end date/time. */
62 bool hasEndDate() const; 62 bool hasEndDate() const;
63 63
64 /** Return true if the event spans multiple days, otherwise return false. */ 64 /** Return true if the event spans multiple days, otherwise return false. */
65 bool isMultiDay() const; 65 bool isMultiDay() const;
66 66
67 /** set the event's time transparency level. */ 67 /** set the event's time transparency level. */
68 void setTransparency(Transparency transparency); 68 void setTransparency(Transparency transparency);
69 /** get the event's time transparency level. */ 69 /** get the event's time transparency level. */
70 Transparency transparency() const; 70 Transparency transparency() const;
71 71
72 void setDuration(int seconds); 72 void setDuration(int seconds);
73 73
74 bool contains ( Event*); 74 bool contains ( Event*);
75 75
76 private: 76 private:
77 bool accept(Visitor &v) { return v.visit(this); } 77 bool accept(Visitor &v) { return v.visit(this); }
78 78
79 QDateTime mDtEnd; 79 QDateTime mDtEnd;
80 bool mHasEndDate; 80 bool mHasEndDate;
81 Transparency mTransparency; 81 Transparency mTransparency;
82}; 82};
83 83
84bool operator==( const Event&, const Event& ); 84bool operator==( const Event&, const Event& );
85 85
86 86
87} 87}
88 88
89 89
90#endif 90#endif
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -1,317 +1,317 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef INCIDENCE_H 20#ifndef INCIDENCE_H
21#define INCIDENCE_H 21#define INCIDENCE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29 29
30#include "recurrence.h" 30#include "recurrence.h"
31#include "alarm.h" 31#include "alarm.h"
32#include "attachment.h" 32#include "attachment.h"
33#include "listbase.h" 33#include "listbase.h"
34#include "incidencebase.h" 34#include "incidencebase.h"
35 35
36namespace KCal { 36namespace KCal {
37 37
38class Event; 38class Event;
39class Todo; 39class Todo;
40class Journal; 40class Journal;
41 41
42/** 42/**
43 This class provides the base class common to all calendar components. 43 This class provides the base class common to all calendar components.
44*/ 44*/
45class Incidence : public IncidenceBase 45class Incidence : public IncidenceBase
46{ 46{
47 public: 47 public:
48 /** 48 /**
49 This class provides the interface for a visitor of calendar components. It 49 This class provides the interface for a visitor of calendar components. It
50 serves as base class for concrete visitors, which implement certain actions on 50 serves as base class for concrete visitors, which implement certain actions on
51 calendar components. It allows to add functions, which operate on the concrete 51 calendar components. It allows to add functions, which operate on the concrete
52 types of calendar components, without changing the calendar component classes. 52 types of calendar components, without changing the calendar component classes.
53 */ 53 */
54 class Visitor 54 class Visitor
55 { 55 {
56 public: 56 public:
57 /** Destruct Incidence::Visitor */ 57 /** Destruct Incidence::Visitor */
58 virtual ~Visitor() {} 58 virtual ~Visitor() {}
59 59
60 /** 60 /**
61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 61 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
62 on an Event object. 62 on an Event object.
63 */ 63 */
64 virtual bool visit(Event *) { return false; } 64 virtual bool visit(Event *) { return false; }
65 /** 65 /**
66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 66 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
67 on an Todo object. 67 on an Todo object.
68 */ 68 */
69 virtual bool visit(Todo *) { return false; } 69 virtual bool visit(Todo *) { return false; }
70 /** 70 /**
71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions 71 Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
72 on an Journal object. 72 on an Journal object.
73 */ 73 */
74 virtual bool visit(Journal *) { return false; } 74 virtual bool visit(Journal *) { return false; }
75 75
76 protected: 76 protected:
77 /** Constructor is protected to prevent direct creation of visitor base class. */ 77 /** Constructor is protected to prevent direct creation of visitor base class. */
78 Visitor() {} 78 Visitor() {}
79 }; 79 };
80 80
81 /** 81 /**
82 This class implements a visitor for adding an Incidence to a resource 82 This class implements a visitor for adding an Incidence to a resource
83 supporting addEvent(), addTodo() and addJournal() calls. 83 supporting addEvent(), addTodo() and addJournal() calls.
84 */ 84 */
85 template<class T> 85 template<class T>
86 class AddVisitor : public Visitor 86 class AddVisitor : public Visitor
87 { 87 {
88 public: 88 public:
89 AddVisitor( T *r ) : mResource( r ) {} 89 AddVisitor( T *r ) : mResource( r ) {}
90 bool visit( Event *e ) { return mResource->addEvent( e ); } 90 bool visit( Event *e ) { return mResource->addEvent( e ); }
91 bool visit( Todo *t ) { return mResource->addTodo( t ); } 91 bool visit( Todo *t ) { return mResource->addTodo( t ); }
92 bool visit( Journal *j ) { return mResource->addJournal( j ); } 92 bool visit( Journal *j ) { return mResource->addJournal( j ); }
93 93
94 private: 94 private:
95 T *mResource; 95 T *mResource;
96 }; 96 };
97 97
98 /** enumeration for describing an event's secrecy. */ 98 /** enumeration for describing an event's secrecy. */
99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; 99 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
100 typedef ListBase<Incidence> List; 100 typedef ListBase<Incidence> List;
101 Incidence(); 101 Incidence();
102 Incidence(const Incidence &); 102 Incidence(const Incidence &);
103 ~Incidence(); 103 ~Incidence();
104 104
105 /** 105 /**
106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to 106 Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
107 provide this implementation: 107 provide this implementation:
108 <pre> 108 <pre>
109 bool accept(Visitor &v) { return v.visit(this); } 109 bool accept(Visitor &v) { return v.visit(this); }
110 </pre> 110 </pre>
111 */ 111 */
112 virtual bool accept(Visitor &) { return false; } 112 virtual bool accept(Visitor &) { return false; }
113 113
114 virtual Incidence *clone() = 0; 114 virtual Incidence *clone() = 0;
115 virtual void cloneRelations( Incidence * ); 115 virtual void cloneRelations( Incidence * );
116 116
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
118 void setReadOnly( bool ); 118 void setReadOnly( bool );
119 119
120 /** 120 /**
121 Recreate event. The event is made a new unique event, but already stored 121 Recreate event. The event is made a new unique event, but already stored
122 event information is preserved. Sets uniquie id, creation date, last 122 event information is preserved. Sets uniquie id, creation date, last
123 modification date and revision number. 123 modification date and revision number.
124 */ 124 */
125 void recreate(); 125 void recreate();
126 Incidence* recreateCloneException(QDate); 126 Incidence* recreateCloneException(QDate);
127 127
128 /** set creation date */ 128 /** set creation date */
129 void setCreated(QDateTime); 129 void setCreated(QDateTime);
130 /** return time and date of creation. */ 130 /** return time and date of creation. */
131 QDateTime created() const; 131 QDateTime created() const;
132 132
133 /** set the number of revisions this event has seen */ 133 /** set the number of revisions this event has seen */
134 void setRevision(int rev); 134 void setRevision(int rev);
135 /** return the number of revisions this event has seen */ 135 /** return the number of revisions this event has seen */
136 int revision() const; 136 int revision() const;
137 137
138 /** Set starting date/time. */ 138 /** Set starting date/time. */
139 virtual void setDtStart(const QDateTime &dtStart); 139 virtual void setDtStart(const QDateTime &dtStart);
140 /** Return the incidence's ending date/time as a QDateTime. */ 140 /** Return the incidence's ending date/time as a QDateTime. */
141 virtual QDateTime dtEnd() const { return QDateTime(); } 141 virtual QDateTime dtEnd() const { return QDateTime(); }
142 142
143 /** sets the event's lengthy description. */ 143 /** sets the event's lengthy description. */
144 void setDescription(const QString &description); 144 void setDescription(const QString &description);
145 /** returns a reference to the event's description. */ 145 /** returns a reference to the event's description. */
146 QString description() const; 146 QString description() const;
147 147
148 /** sets the event's short summary. */ 148 /** sets the event's short summary. */
149 void setSummary(const QString &summary); 149 void setSummary(const QString &summary);
150 /** returns a reference to the event's summary. */ 150 /** returns a reference to the event's summary. */
151 QString summary() const; 151 QString summary() const;
152 152
153 /** set event's applicable categories */ 153 /** set event's applicable categories */
154 void setCategories(const QStringList &categories, bool setForRelations = false); 154 void setCategories(const QStringList &categories, bool setForRelations = false);
155 void addCategories(const QStringList &categories, bool addToRelations = false); 155 void addCategories(const QStringList &categories, bool addToRelations = false);
156 /** set event's categories based on a comma delimited string */ 156 /** set event's categories based on a comma delimited string */
157 void setCategories(const QString &catStr); 157 void setCategories(const QString &catStr);
158 /** return categories in a list */ 158 /** return categories in a list */
159 QStringList categories() const; 159 QStringList categories() const;
160 /** return categories as a comma separated string */ 160 /** return categories as a comma separated string */
161 QString categoriesStr(); 161 QString categoriesStr();
162 QString categoriesStrWithSpace(); 162 QString categoriesStrWithSpace();
163 163
164 /** point at some other event to which the event relates. This function should 164 /** point at some other event to which the event relates. This function should
165 * only be used when constructing a calendar before the related Event 165 * only be used when constructing a calendar before the related Event
166 * exists. */ 166 * exists. */
167 void setRelatedToUid(const QString &); 167 void setRelatedToUid(const QString &);
168 /** what event does this one relate to? This function should 168 /** what event does this one relate to? This function should
169 * only be used when constructing a calendar before the related Event 169 * only be used when constructing a calendar before the related Event
170 * exists. */ 170 * exists. */
171 QString relatedToUid() const; 171 QString relatedToUid() const;
172 /** point at some other event to which the event relates */ 172 /** point at some other event to which the event relates */
173 void setRelatedTo(Incidence *relatedTo); 173 void setRelatedTo(Incidence *relatedTo);
174 /** what event does this one relate to? */ 174 /** what event does this one relate to? */
175 Incidence *relatedTo() const; 175 Incidence *relatedTo() const;
176 /** All events that are related to this event */ 176 /** All events that are related to this event */
177 QPtrList<Incidence> relations() const; 177 QPtrList<Incidence> relations() const;
178 /** Add an event which is related to this event */ 178 /** Add an event which is related to this event */
179 void addRelation(Incidence *); 179 void addRelation(Incidence *);
180 /** Remove event that is related to this event */ 180 /** Remove event that is related to this event */
181 void removeRelation(Incidence *); 181 void removeRelation(Incidence *);
182 182
183 /** returns the list of dates which are exceptions to the recurrence rule */ 183 /** returns the list of dates which are exceptions to the recurrence rule */
184 DateList exDates() const; 184 DateList exDates() const;
185 /** sets the list of dates which are exceptions to the recurrence rule */ 185 /** sets the list of dates which are exceptions to the recurrence rule */
186 void setExDates(const DateList &_exDates); 186 void setExDates(const DateList &_exDates);
187 void setExDates(const char *dates); 187 void setExDates(const char *dates);
188 /** Add a date to the list of exceptions of the recurrence rule. */ 188 /** Add a date to the list of exceptions of the recurrence rule. */
189 void addExDate(const QDate &date); 189 void addExDate(const QDate &date);
190 190
191 /** returns true if there is an exception for this date in the recurrence 191 /** returns true if there is an exception for this date in the recurrence
192 rule set, or false otherwise. */ 192 rule set, or false otherwise. */
193 bool isException(const QDate &qd) const; 193 bool isException(const QDate &qd) const;
194 194
195 /** add attachment to this event */ 195 /** add attachment to this event */
196 void addAttachment(Attachment *attachment); 196 void addAttachment(Attachment *attachment);
197 /** remove and delete a specific attachment */ 197 /** remove and delete a specific attachment */
198 void deleteAttachment(Attachment *attachment); 198 void deleteAttachment(Attachment *attachment);
199 /** remove and delete all attachments with this mime type */ 199 /** remove and delete all attachments with this mime type */
200 void deleteAttachments(const QString& mime); 200 void deleteAttachments(const QString& mime);
201 /** return list of all associated attachments */ 201 /** return list of all associated attachments */
202 QPtrList<Attachment> attachments() const; 202 QPtrList<Attachment> attachments() const;
203 /** find a list of attachments with this mime type */ 203 /** find a list of attachments with this mime type */
204 QPtrList<Attachment> attachments(const QString& mime) const; 204 QPtrList<Attachment> attachments(const QString& mime) const;
205 205
206 /** sets the event's status the value specified. See the enumeration 206 /** sets the event's status the value specified. See the enumeration
207 * above for possible values. */ 207 * above for possible values. */
208 void setSecrecy(int); 208 void setSecrecy(int);
209 /** return the event's secrecy. */ 209 /** return the event's secrecy. */
210 int secrecy() const; 210 int secrecy() const;
211 /** return the event's secrecy in string format. */ 211 /** return the event's secrecy in string format. */
212 QString secrecyStr() const; 212 QString secrecyStr() const;
213 /** return list of all availbale secrecy classes */ 213 /** return list of all availbale secrecy classes */
214 static QStringList secrecyList(); 214 static QStringList secrecyList();
215 /** return human-readable name of secrecy class */ 215 /** return human-readable name of secrecy class */
216 static QString secrecyName(int); 216 static QString secrecyName(int);
217 217
218 /** returns TRUE if the date specified is one on which the event will 218 /** returns TRUE if the date specified is one on which the event will
219 * recur. */ 219 * recur. */
220 bool recursOn(const QDate &qd) const; 220 bool recursOn(const QDate &qd) const;
221 221
222 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): 222 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
223 223
224 /** set resources used, such as Office, Car, etc. */ 224 /** set resources used, such as Office, Car, etc. */
225 void setResources(const QStringList &resources); 225 void setResources(const QStringList &resources);
226 /** return list of current resources */ 226 /** return list of current resources */
227 QStringList resources() const; 227 QStringList resources() const;
228 228
229 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ 229 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
230 void setPriority(int priority); 230 void setPriority(int priority);
231 /** get the event's priority */ 231 /** get the event's priority */
232 int priority() const; 232 int priority() const;
233 233
234 /** All alarms that are associated with this incidence */ 234 /** All alarms that are associated with this incidence */
235 QPtrList<Alarm> alarms() const; 235 QPtrList<Alarm> alarms() const;
236 /** Create a new alarm which is associated with this incidence */ 236 /** Create a new alarm which is associated with this incidence */
237 Alarm* newAlarm(); 237 Alarm* newAlarm();
238 /** Add an alarm which is associated with this incidence */ 238 /** Add an alarm which is associated with this incidence */
239 void addAlarm(Alarm*); 239 void addAlarm(Alarm*);
240 /** Remove an alarm that is associated with this incidence */ 240 /** Remove an alarm that is associated with this incidence */
241 void removeAlarm(Alarm*); 241 void removeAlarm(Alarm*);
242 /** Remove all alarms that are associated with this incidence */ 242 /** Remove all alarms that are associated with this incidence */
243 void clearAlarms(); 243 void clearAlarms();
244 /** return whether any alarm associated with this incidence is enabled */ 244 /** return whether any alarm associated with this incidence is enabled */
245 bool isAlarmEnabled() const; 245 bool isAlarmEnabled() const;
246 246
247 /** 247 /**
248 Return the recurrence rule associated with this incidence. If there is 248 Return the recurrence rule associated with this incidence. If there is
249 none, returns an appropriate (non-0) object. 249 none, returns an appropriate (non-0) object.
250 */ 250 */
251 Recurrence *recurrence() const; 251 Recurrence *recurrence() const;
252 void setRecurrence(Recurrence * r); 252 void setRecurrence(Recurrence * r);
253 /** 253 /**
254 Forward to Recurrence::doesRecur(). 254 Forward to Recurrence::doesRecur().
255 */ 255 */
256 ushort doesRecur() const; 256 ushort doesRecur() const;
257 257
258 /** set the event's/todo's location. Do _not_ use it with journal */ 258 /** set the event's/todo's location. Do _not_ use it with journal */
259 void setLocation(const QString &location); 259 void setLocation(const QString &location);
260 /** return the event's/todo's location. Do _not_ use it with journal */ 260 /** return the event's/todo's location. Do _not_ use it with journal */
261 QString location() const; 261 QString location() const;
262 /** returns TRUE or FALSE depending on whether the todo has a start date */ 262 /** returns TRUE or FALSE depending on whether the todo has a start date */
263 bool hasStartDate() const; 263 bool hasStartDate() const;
264 /** sets the event's hasStartDate value. */ 264 /** sets the event's hasStartDate value. */
265 void setHasStartDate(bool f); 265 void setHasStartDate(bool f);
266 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; 266 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
267 bool cancelled() const; 267 bool cancelled() const;
268 void setCancelled( bool b ); 268 void setCancelled( bool b );
269 269
270 bool hasRecurrenceID() const; 270 bool hasRecurrenceID() const;
271 void setHasRecurrenceID( bool b ); 271 void setHasRecurrenceID( bool b );
272 272
273 void setRecurrenceID(QDateTime); 273 void setRecurrenceID(QDateTime);
274 QDateTime recurrenceID () const; 274 QDateTime recurrenceID () const;
275 QDateTime dtStart() const; 275 QDateTime dtStart() const;
276 bool isHoliday() const; 276 bool isHoliday() const;
277 bool isBirthday() const; 277 bool isBirthday() const;
278 bool isAnniversary() const; 278 bool isAnniversary() const;
279 279
280 280
281protected: 281protected:
282 QPtrList<Alarm> mAlarms; 282 QPtrList<Alarm> mAlarms;
283 QPtrList<Incidence> mRelations; 283 QPtrList<Incidence> mRelations;
284 QDateTime mRecurrenceID; 284 QDateTime mRecurrenceID;
285 bool mHasRecurrenceID; 285 bool mHasRecurrenceID;
286 private: 286 private:
287 void checkCategories(); 287 void checkCategories();
288 bool mHoliday, mBirthday, mAnniversary; 288 bool mHoliday, mBirthday, mAnniversary;
289 int mRevision; 289 int mRevision;
290 bool mCancelled; 290 bool mCancelled;
291 291
292 // base components of jounal, event and todo 292 // base components of jounal, event and todo
293 QDateTime mCreated; 293 QDateTime mCreated;
294 QString mDescription; 294 QString mDescription;
295 QString mSummary; 295 QString mSummary;
296 QStringList mCategories; 296 QStringList mCategories;
297 Incidence *mRelatedTo; 297 Incidence *mRelatedTo;
298 QString mRelatedToUid; 298 QString mRelatedToUid;
299 DateList mExDates; 299 DateList mExDates;
300 QPtrList<Attachment> mAttachments; 300 QPtrList<Attachment> mAttachments;
301 QStringList mResources; 301 QStringList mResources;
302 bool mHasStartDate; // if todo has associated start date 302 bool mHasStartDate; // if todo has associated start date
303 303
304 int mSecrecy; 304 int mSecrecy;
305 int mPriority; // 1 = highest, 2 = less, etc. 305 int mPriority; // 1 = highest, 2 = less, etc.
306 306
307 //QPtrList<Alarm> mAlarms; 307 //QPtrList<Alarm> mAlarms;
308 Recurrence *mRecurrence; 308 Recurrence *mRecurrence;
309 309
310 QString mLocation; 310 QString mLocation;
311}; 311};
312 312
313bool operator==( const Incidence&, const Incidence& ); 313bool operator==( const Incidence&, const Incidence& );
314 314
315} 315}
316 316
317#endif 317#endif
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 351fb32..859161f 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -1,49 +1,49 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include "journal.h" 21#include "journal.h"
22 22
23using namespace KCal; 23using namespace KCal;
24 24
25Journal::Journal() 25Journal::Journal()
26{ 26{
27} 27}
28 28
29Journal::~Journal() 29Journal::~Journal()
30{ 30{
31} 31}
32 32
33Incidence *Journal::clone() 33Incidence *Journal::clone()
34{ 34{
35 return new Journal(*this); 35 return new Journal(*this);
36} 36}
37 37
38 38
39bool KCal::operator==( const Journal& j1, const Journal& j2 ) 39bool KCal::operator==( const Journal& j1, const Journal& j2 )
40{ 40{
41 return operator==( (const Incidence&)j1, (const Incidence&)j2 ); 41 return operator==( (const Incidence&)j1, (const Incidence&)j2 );
42} 42}
43 43
44 44
45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset ) const 45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
46{ 46{
47 *ok = false; 47 *ok = false;
48 return QDateTime (); 48 return QDateTime ();
49} 49}
diff --git a/libkcal/journal.h b/libkcal/journal.h
index cb90c7a..2c1d7ea 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -1,50 +1,50 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef JOURNAL_H 20#ifndef JOURNAL_H
21#define JOURNAL_H 21#define JOURNAL_H
22// 22//
23// Journal component, representing a VJOURNAL object 23// Journal component, representing a VJOURNAL object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides a Journal in the sense of RFC2445. 31 This class provides a Journal in the sense of RFC2445.
32*/ 32*/
33class Journal : public Incidence 33class Journal : public Incidence
34{ 34{
35 public: 35 public:
36 Journal(); 36 Journal();
37 ~Journal(); 37 ~Journal();
38 38
39 QCString type() const { return "Journal"; } 39 QCString type() const { return "Journal"; }
40 40
41 Incidence *clone(); 41 Incidence *clone();
42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
43private: 43private:
44 bool accept(Visitor &v) { return v.visit(this); } 44 bool accept(Visitor &v) { return v.visit(this); }
45}; 45};
46 46
47 bool operator==( const Journal&, const Journal& ); 47 bool operator==( const Journal&, const Journal& );
48} 48}
49 49
50#endif 50#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index d7431c7..473247a 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -1,577 +1,577 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <kglobalsettings.h> 22#include <kglobalsettings.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kdebug.h> 24#include <kdebug.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27 27
28#include "calendarlocal.h" 28#include "calendarlocal.h"
29#include "icalformat.h" 29#include "icalformat.h"
30#include "todo.h" 30#include "todo.h"
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34Todo::Todo(): QObject(), Incidence() 34Todo::Todo(): QObject(), Incidence()
35{ 35{
36// mStatus = TENTATIVE; 36// mStatus = TENTATIVE;
37 37
38 mHasDueDate = false; 38 mHasDueDate = false;
39 setHasStartDate( false ); 39 setHasStartDate( false );
40 mCompleted = getEvenTime(QDateTime::currentDateTime()); 40 mCompleted = getEvenTime(QDateTime::currentDateTime());
41 mHasCompletedDate = false; 41 mHasCompletedDate = false;
42 mPercentComplete = 0; 42 mPercentComplete = 0;
43 mRunning = false; 43 mRunning = false;
44 mRunSaveTimer = 0; 44 mRunSaveTimer = 0;
45} 45}
46 46
47Todo::Todo(const Todo &t) : QObject(),Incidence(t) 47Todo::Todo(const Todo &t) : QObject(),Incidence(t)
48{ 48{
49 mDtDue = t.mDtDue; 49 mDtDue = t.mDtDue;
50 mHasDueDate = t.mHasDueDate; 50 mHasDueDate = t.mHasDueDate;
51 mCompleted = t.mCompleted; 51 mCompleted = t.mCompleted;
52 mHasCompletedDate = t.mHasCompletedDate; 52 mHasCompletedDate = t.mHasCompletedDate;
53 mPercentComplete = t.mPercentComplete; 53 mPercentComplete = t.mPercentComplete;
54 mRunning = false; 54 mRunning = false;
55 mRunSaveTimer = 0; 55 mRunSaveTimer = 0;
56} 56}
57 57
58Todo::~Todo() 58Todo::~Todo()
59{ 59{
60 setRunning( false ); 60 setRunning( false );
61 //qDebug("Todo::~Todo() "); 61 //qDebug("Todo::~Todo() ");
62} 62}
63 63
64void Todo::setRunningFalse( QString s ) 64void Todo::setRunningFalse( QString s )
65{ 65{
66 if ( ! mRunning ) 66 if ( ! mRunning )
67 return; 67 return;
68 mRunning = false; 68 mRunning = false;
69 mRunSaveTimer->stop(); 69 mRunSaveTimer->stop();
70 saveRunningInfoToFile( s ); 70 saveRunningInfoToFile( s );
71} 71}
72void Todo::setRunning( bool run ) 72void Todo::setRunning( bool run )
73{ 73{
74 if ( run == mRunning ) 74 if ( run == mRunning )
75 return; 75 return;
76 //qDebug("Todo::setRunning %d ", run); 76 //qDebug("Todo::setRunning %d ", run);
77 if ( !mRunSaveTimer ) { 77 if ( !mRunSaveTimer ) {
78 mRunSaveTimer = new QTimer ( this ); 78 mRunSaveTimer = new QTimer ( this );
79 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); 79 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
80 } 80 }
81 mRunning = run; 81 mRunning = run;
82 if ( mRunning ) { 82 if ( mRunning ) {
83 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min 83 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
84 mRunStart = QDateTime::currentDateTime(); 84 mRunStart = QDateTime::currentDateTime();
85 } else { 85 } else {
86 mRunSaveTimer->stop(); 86 mRunSaveTimer->stop();
87 saveRunningInfoToFile(); 87 saveRunningInfoToFile();
88 } 88 }
89} 89}
90 90
91void Todo::saveRunningInfoToFile( QString comment ) 91void Todo::saveRunningInfoToFile( QString comment )
92{ 92{
93 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 93 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
94 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { 94 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) {
95 qDebug("Running time < 30 seconds. Skipped. "); 95 qDebug("Running time < 30 seconds. Skipped. ");
96 return; 96 return;
97 } 97 }
98 QString dir = KGlobalSettings::timeTrackerDir(); 98 QString dir = KGlobalSettings::timeTrackerDir();
99 //qDebug("%s ", dir.latin1()); 99 //qDebug("%s ", dir.latin1());
100 QString file = "%1%2%3-%4%5%6-"; 100 QString file = "%1%2%3-%4%5%6-";
101 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 101 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
102 file.replace ( QRegExp (" "), "0" ); 102 file.replace ( QRegExp (" "), "0" );
103 file += uid(); 103 file += uid();
104 //qDebug("File %s ",file.latin1() ); 104 //qDebug("File %s ",file.latin1() );
105 CalendarLocal cal; 105 CalendarLocal cal;
106 cal.setLocalTime(); 106 cal.setLocalTime();
107 Todo * to = (Todo*) clone(); 107 Todo * to = (Todo*) clone();
108 to->setFloats( false ); 108 to->setFloats( false );
109 to->setDtStart( mRunStart ); 109 to->setDtStart( mRunStart );
110 to->setHasStartDate( true ); 110 to->setHasStartDate( true );
111 to->setDtDue( QDateTime::currentDateTime() ); 111 to->setDtDue( QDateTime::currentDateTime() );
112 to->setHasDueDate( true ); 112 to->setHasDueDate( true );
113 to->setUid( file ); 113 to->setUid( file );
114 if ( !comment.isEmpty() ) { 114 if ( !comment.isEmpty() ) {
115 QString des = to->description(); 115 QString des = to->description();
116 if ( des.isEmpty () ) 116 if ( des.isEmpty () )
117 to->setDescription( "TT-Note: " + comment ); 117 to->setDescription( "TT-Note: " + comment );
118 else 118 else
119 to->setDescription( "TT-Note: " + comment +"\n" + des ); 119 to->setDescription( "TT-Note: " + comment +"\n" + des );
120 } 120 }
121 cal.addIncidence( to ); 121 cal.addIncidence( to );
122 ICalFormat format; 122 ICalFormat format;
123 file = dir +"/" +file +".ics"; 123 file = dir +"/" +file +".ics";
124 format.save( &cal, file ); 124 format.save( &cal, file );
125 saveParents(); 125 saveParents();
126 126
127} 127}
128void Todo::saveParents() 128void Todo::saveParents()
129{ 129{
130 if (!relatedTo() ) 130 if (!relatedTo() )
131 return; 131 return;
132 Incidence * inc = relatedTo(); 132 Incidence * inc = relatedTo();
133 if ( inc->type() != "Todo" ) 133 if ( inc->type() != "Todo" )
134 return; 134 return;
135 Todo* to = (Todo*)inc; 135 Todo* to = (Todo*)inc;
136 bool saveTodo = false; 136 bool saveTodo = false;
137 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 137 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
138 QFileInfo fi ( file ); 138 QFileInfo fi ( file );
139 if ( fi.exists() ) { 139 if ( fi.exists() ) {
140 if ( fi.lastModified () < to->lastModified ()) 140 if ( fi.lastModified () < to->lastModified ())
141 saveTodo = true; 141 saveTodo = true;
142 } else { 142 } else {
143 saveTodo = true; 143 saveTodo = true;
144 } 144 }
145 if ( saveTodo ) { 145 if ( saveTodo ) {
146 CalendarLocal cal; 146 CalendarLocal cal;
147 cal.setLocalTime(); 147 cal.setLocalTime();
148 Todo * par = (Todo *) to->clone(); 148 Todo * par = (Todo *) to->clone();
149 cal.addIncidence( par ); 149 cal.addIncidence( par );
150 ICalFormat format; 150 ICalFormat format;
151 format.save( &cal, file ); 151 format.save( &cal, file );
152 } 152 }
153 to->saveParents(); 153 to->saveParents();
154} 154}
155 155
156int Todo::runTime() 156int Todo::runTime()
157{ 157{
158 if ( !mRunning ) 158 if ( !mRunning )
159 return 0; 159 return 0;
160 return mRunStart.secsTo( QDateTime::currentDateTime() ); 160 return mRunStart.secsTo( QDateTime::currentDateTime() );
161} 161}
162bool Todo::hasRunningSub() 162bool Todo::hasRunningSub()
163{ 163{
164 if ( mRunning ) 164 if ( mRunning )
165 return true; 165 return true;
166 Incidence *aTodo; 166 Incidence *aTodo;
167 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 167 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
168 if ( ((Todo*)aTodo)->hasRunningSub() ) 168 if ( ((Todo*)aTodo)->hasRunningSub() )
169 return true; 169 return true;
170 } 170 }
171 return false; 171 return false;
172} 172}
173Incidence *Todo::clone() 173Incidence *Todo::clone()
174{ 174{
175 return new Todo(*this); 175 return new Todo(*this);
176} 176}
177 177
178bool Todo::contains ( Todo* from ) 178bool Todo::contains ( Todo* from )
179{ 179{
180 180
181 if ( !from->summary().isEmpty() ) 181 if ( !from->summary().isEmpty() )
182 if ( !summary().startsWith( from->summary() )) 182 if ( !summary().startsWith( from->summary() ))
183 return false; 183 return false;
184 if ( from->hasStartDate() ) { 184 if ( from->hasStartDate() ) {
185 if ( !hasStartDate() ) 185 if ( !hasStartDate() )
186 return false; 186 return false;
187 if ( from->dtStart() != dtStart()) 187 if ( from->dtStart() != dtStart())
188 return false; 188 return false;
189 } 189 }
190 if ( from->hasDueDate() ){ 190 if ( from->hasDueDate() ){
191 if ( !hasDueDate() ) 191 if ( !hasDueDate() )
192 return false; 192 return false;
193 if ( from->dtDue() != dtDue()) 193 if ( from->dtDue() != dtDue())
194 return false; 194 return false;
195 } 195 }
196 if ( !from->location().isEmpty() ) 196 if ( !from->location().isEmpty() )
197 if ( !location().startsWith( from->location() ) ) 197 if ( !location().startsWith( from->location() ) )
198 return false; 198 return false;
199 if ( !from->description().isEmpty() ) 199 if ( !from->description().isEmpty() )
200 if ( !description().startsWith( from->description() )) 200 if ( !description().startsWith( from->description() ))
201 return false; 201 return false;
202 if ( from->alarms().count() ) { 202 if ( from->alarms().count() ) {
203 Alarm *a = from->alarms().first(); 203 Alarm *a = from->alarms().first();
204 if ( a->enabled() ){ 204 if ( a->enabled() ){
205 if ( !alarms().count() ) 205 if ( !alarms().count() )
206 return false; 206 return false;
207 Alarm *b = alarms().first(); 207 Alarm *b = alarms().first();
208 if( ! b->enabled() ) 208 if( ! b->enabled() )
209 return false; 209 return false;
210 if ( ! (a->offset() == b->offset() )) 210 if ( ! (a->offset() == b->offset() ))
211 return false; 211 return false;
212 } 212 }
213 } 213 }
214 214
215 QStringList cat = categories(); 215 QStringList cat = categories();
216 QStringList catFrom = from->categories(); 216 QStringList catFrom = from->categories();
217 QString nCat; 217 QString nCat;
218 unsigned int iii; 218 unsigned int iii;
219 for ( iii = 0; iii < catFrom.count();++iii ) { 219 for ( iii = 0; iii < catFrom.count();++iii ) {
220 nCat = catFrom[iii]; 220 nCat = catFrom[iii];
221 if ( !nCat.isEmpty() ) 221 if ( !nCat.isEmpty() )
222 if ( !cat.contains( nCat )) { 222 if ( !cat.contains( nCat )) {
223 return false; 223 return false;
224 } 224 }
225 } 225 }
226 if ( from->isCompleted() ) { 226 if ( from->isCompleted() ) {
227 if ( !isCompleted() ) 227 if ( !isCompleted() )
228 return false; 228 return false;
229 } 229 }
230 if( priority() != from->priority() ) 230 if( priority() != from->priority() )
231 return false; 231 return false;
232 232
233 233
234 return true; 234 return true;
235 235
236} 236}
237bool KCal::operator==( const Todo& t1, const Todo& t2 ) 237bool KCal::operator==( const Todo& t1, const Todo& t2 )
238{ 238{
239 239
240 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 240 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
241 if ( ! ret ) 241 if ( ! ret )
242 return false; 242 return false;
243 if ( t1.hasDueDate() == t2.hasDueDate() ) { 243 if ( t1.hasDueDate() == t2.hasDueDate() ) {
244 if ( t1.hasDueDate() ) { 244 if ( t1.hasDueDate() ) {
245 if ( t1.doesFloat() == t2.doesFloat() ) { 245 if ( t1.doesFloat() == t2.doesFloat() ) {
246 if ( t1.doesFloat() ) { 246 if ( t1.doesFloat() ) {
247 if ( t1.dtDue().date() != t2.dtDue().date() ) 247 if ( t1.dtDue().date() != t2.dtDue().date() )
248 return false; 248 return false;
249 } else 249 } else
250 if ( t1.dtDue() != t2.dtDue() ) 250 if ( t1.dtDue() != t2.dtDue() )
251 return false; 251 return false;
252 } else 252 } else
253 return false;// float != 253 return false;// float !=
254 } 254 }
255 255
256 } else 256 } else
257 return false; 257 return false;
258 if ( t1.percentComplete() != t2.percentComplete() ) 258 if ( t1.percentComplete() != t2.percentComplete() )
259 return false; 259 return false;
260 if ( t1.isCompleted() ) { 260 if ( t1.isCompleted() ) {
261 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 261 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
262 if ( t1.hasCompletedDate() ) { 262 if ( t1.hasCompletedDate() ) {
263 if ( t1.completed() != t2.completed() ) 263 if ( t1.completed() != t2.completed() )
264 return false; 264 return false;
265 } 265 }
266 266
267 } else 267 } else
268 return false; 268 return false;
269 } 269 }
270 return true; 270 return true;
271 271
272} 272}
273 273
274void Todo::setDtDue(const QDateTime &dtDue) 274void Todo::setDtDue(const QDateTime &dtDue)
275{ 275{
276 //int diffsecs = mDtDue.secsTo(dtDue); 276 //int diffsecs = mDtDue.secsTo(dtDue);
277 277
278 /*if (mReadOnly) return; 278 /*if (mReadOnly) return;
279 const QPtrList<Alarm>& alarms = alarms(); 279 const QPtrList<Alarm>& alarms = alarms();
280 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { 280 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) {
281 if (alarm->enabled()) { 281 if (alarm->enabled()) {
282 alarm->setTime(alarm->time().addSecs(diffsecs)); 282 alarm->setTime(alarm->time().addSecs(diffsecs));
283 } 283 }
284 }*/ 284 }*/
285 mDtDue = getEvenTime(dtDue); 285 mDtDue = getEvenTime(dtDue);
286 286
287 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; 287 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl;
288 288
289 /*const QPtrList<Alarm>& alarms = alarms(); 289 /*const QPtrList<Alarm>& alarms = alarms();
290 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) 290 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next())
291 alarm->setAlarmStart(mDtDue);*/ 291 alarm->setAlarmStart(mDtDue);*/
292 updated(); 292 updated();
293} 293}
294 294
295QDateTime Todo::dtDue() const 295QDateTime Todo::dtDue() const
296{ 296{
297 return mDtDue; 297 return mDtDue;
298} 298}
299 299
300QString Todo::dtDueTimeStr() const 300QString Todo::dtDueTimeStr() const
301{ 301{
302 return KGlobal::locale()->formatTime(mDtDue.time()); 302 return KGlobal::locale()->formatTime(mDtDue.time());
303} 303}
304 304
305QString Todo::dtDueDateStr(bool shortfmt) const 305QString Todo::dtDueDateStr(bool shortfmt) const
306{ 306{
307 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); 307 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt);
308} 308}
309 309
310QString Todo::dtDueStr(bool shortfmt) const 310QString Todo::dtDueStr(bool shortfmt) const
311{ 311{
312 if ( doesFloat() ) 312 if ( doesFloat() )
313 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); 313 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt);
314 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); 314 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt);
315} 315}
316// retval 0 : no found 316// retval 0 : no found
317// 1 : due for date found 317// 1 : due for date found
318// 2 : overdue for date found 318// 2 : overdue for date found
319int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) 319int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos )
320{ 320{
321 int retval = 0; 321 int retval = 0;
322 if ( isCompleted() ) 322 if ( isCompleted() )
323 return 0; 323 return 0;
324 if ( hasDueDate() ) { 324 if ( hasDueDate() ) {
325 if ( dtDue().date() < date ) 325 if ( dtDue().date() < date )
326 return 2; 326 return 2;
327 // we do not return, because we may find an overdue sub todo 327 // we do not return, because we may find an overdue sub todo
328 if ( dtDue().date() == date ) 328 if ( dtDue().date() == date )
329 retval = 1; 329 retval = 1;
330 } 330 }
331 if ( checkSubtodos ) { 331 if ( checkSubtodos ) {
332 Incidence *aTodo; 332 Incidence *aTodo;
333 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 333 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
334 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); 334 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos );
335 if ( ret == 2 ) 335 if ( ret == 2 )
336 return 2; 336 return 2;
337 if ( ret == 1) 337 if ( ret == 1)
338 retval = 1; 338 retval = 1;
339 } 339 }
340 } 340 }
341 return retval; 341 return retval;
342} 342}
343int Todo::hasDueSubTodo( bool checkSubtodos ) //= true 343int Todo::hasDueSubTodo( bool checkSubtodos ) //= true
344{ 344{
345 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); 345 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos );
346} 346}
347bool Todo::hasDueDate() const 347bool Todo::hasDueDate() const
348{ 348{
349 return mHasDueDate; 349 return mHasDueDate;
350} 350}
351 351
352void Todo::setHasDueDate(bool f) 352void Todo::setHasDueDate(bool f)
353{ 353{
354 if (mReadOnly) return; 354 if (mReadOnly) return;
355 mHasDueDate = f; 355 mHasDueDate = f;
356 updated(); 356 updated();
357} 357}
358 358
359 359
360#if 0 360#if 0
361void Todo::setStatus(const QString &statStr) 361void Todo::setStatus(const QString &statStr)
362{ 362{
363 if (mReadOnly) return; 363 if (mReadOnly) return;
364 QString ss(statStr.upper()); 364 QString ss(statStr.upper());
365 365
366 if (ss == "X-ACTION") 366 if (ss == "X-ACTION")
367 mStatus = NEEDS_ACTION; 367 mStatus = NEEDS_ACTION;
368 else if (ss == "NEEDS ACTION") 368 else if (ss == "NEEDS ACTION")
369 mStatus = NEEDS_ACTION; 369 mStatus = NEEDS_ACTION;
370 else if (ss == "ACCEPTED") 370 else if (ss == "ACCEPTED")
371 mStatus = ACCEPTED; 371 mStatus = ACCEPTED;
372 else if (ss == "SENT") 372 else if (ss == "SENT")
373 mStatus = SENT; 373 mStatus = SENT;
374 else if (ss == "TENTATIVE") 374 else if (ss == "TENTATIVE")
375 mStatus = TENTATIVE; 375 mStatus = TENTATIVE;
376 else if (ss == "CONFIRMED") 376 else if (ss == "CONFIRMED")
377 mStatus = CONFIRMED; 377 mStatus = CONFIRMED;
378 else if (ss == "DECLINED") 378 else if (ss == "DECLINED")
379 mStatus = DECLINED; 379 mStatus = DECLINED;
380 else if (ss == "COMPLETED") 380 else if (ss == "COMPLETED")
381 mStatus = COMPLETED; 381 mStatus = COMPLETED;
382 else if (ss == "DELEGATED") 382 else if (ss == "DELEGATED")
383 mStatus = DELEGATED; 383 mStatus = DELEGATED;
384 384
385 updated(); 385 updated();
386} 386}
387 387
388void Todo::setStatus(int status) 388void Todo::setStatus(int status)
389{ 389{
390 if (mReadOnly) return; 390 if (mReadOnly) return;
391 mStatus = status; 391 mStatus = status;
392 updated(); 392 updated();
393} 393}
394 394
395int Todo::status() const 395int Todo::status() const
396{ 396{
397 return mStatus; 397 return mStatus;
398} 398}
399 399
400QString Todo::statusStr() const 400QString Todo::statusStr() const
401{ 401{
402 switch(mStatus) { 402 switch(mStatus) {
403 case NEEDS_ACTION: 403 case NEEDS_ACTION:
404 return QString("NEEDS ACTION"); 404 return QString("NEEDS ACTION");
405 break; 405 break;
406 case ACCEPTED: 406 case ACCEPTED:
407 return QString("ACCEPTED"); 407 return QString("ACCEPTED");
408 break; 408 break;
409 case SENT: 409 case SENT:
410 return QString("SENT"); 410 return QString("SENT");
411 break; 411 break;
412 case TENTATIVE: 412 case TENTATIVE:
413 return QString("TENTATIVE"); 413 return QString("TENTATIVE");
414 break; 414 break;
415 case CONFIRMED: 415 case CONFIRMED:
416 return QString("CONFIRMED"); 416 return QString("CONFIRMED");
417 break; 417 break;
418 case DECLINED: 418 case DECLINED:
419 return QString("DECLINED"); 419 return QString("DECLINED");
420 break; 420 break;
421 case COMPLETED: 421 case COMPLETED:
422 return QString("COMPLETED"); 422 return QString("COMPLETED");
423 break; 423 break;
424 case DELEGATED: 424 case DELEGATED:
425 return QString("DELEGATED"); 425 return QString("DELEGATED");
426 break; 426 break;
427 } 427 }
428 return QString(""); 428 return QString("");
429} 429}
430#endif 430#endif
431 431
432bool Todo::isCompleted() const 432bool Todo::isCompleted() const
433{ 433{
434 if (mPercentComplete == 100) { 434 if (mPercentComplete == 100) {
435 return true; 435 return true;
436 } 436 }
437 else return false; 437 else return false;
438} 438}
439 439
440void Todo::setCompleted(bool completed) 440void Todo::setCompleted(bool completed)
441{ 441{
442 if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) { 442 if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) {
443 if ( !setRecurDates() ) 443 if ( !setRecurDates() )
444 completed = false; 444 completed = false;
445 } 445 }
446 if (completed) mPercentComplete = 100; 446 if (completed) mPercentComplete = 100;
447 else { 447 else {
448 mPercentComplete = 0; 448 mPercentComplete = 0;
449 mHasCompletedDate = false; 449 mHasCompletedDate = false;
450 } 450 }
451 updated(); 451 updated();
452} 452}
453 453
454QDateTime Todo::completed() const 454QDateTime Todo::completed() const
455{ 455{
456 return mCompleted; 456 return mCompleted;
457} 457}
458 458
459QString Todo::completedStr( bool shortF ) const 459QString Todo::completedStr( bool shortF ) const
460{ 460{
461 return KGlobal::locale()->formatDateTime(mCompleted, shortF); 461 return KGlobal::locale()->formatDateTime(mCompleted, shortF);
462} 462}
463 463
464void Todo::setCompleted(const QDateTime &completed) 464void Todo::setCompleted(const QDateTime &completed)
465{ 465{
466 //qDebug("Todo::setCompleted "); 466 //qDebug("Todo::setCompleted ");
467 if ( mHasCompletedDate ) { 467 if ( mHasCompletedDate ) {
468 // qDebug("has completed data - return "); 468 // qDebug("has completed data - return ");
469 return; 469 return;
470 } 470 }
471 mHasCompletedDate = true; 471 mHasCompletedDate = true;
472 mPercentComplete = 100; 472 mPercentComplete = 100;
473 mCompleted = getEvenTime(completed); 473 mCompleted = getEvenTime(completed);
474 updated(); 474 updated();
475} 475}
476 476
477bool Todo::hasCompletedDate() const 477bool Todo::hasCompletedDate() const
478{ 478{
479 return mHasCompletedDate; 479 return mHasCompletedDate;
480} 480}
481 481
482int Todo::percentComplete() const 482int Todo::percentComplete() const
483{ 483{
484 return mPercentComplete; 484 return mPercentComplete;
485} 485}
486bool Todo::setRecurDates() 486bool Todo::setRecurDates()
487{ 487{
488 if ( !mHasRecurrenceID ) 488 if ( !mHasRecurrenceID )
489 return true; 489 return true;
490 int secs = mDtStart.secsTo( dtDue() ); 490 int secs = mDtStart.secsTo( dtDue() );
491 bool ok; 491 bool ok;
492 qDebug("T:setRecurDates() "); 492 qDebug("T:setRecurDates() ");
493 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 493 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
494 QDateTime next = getNextOccurence( mRecurrenceID, &ok ); 494 QDateTime next = getNextOccurence( mRecurrenceID, &ok );
495 if ( ok ) { 495 if ( ok ) {
496 mRecurrenceID = next; 496 mRecurrenceID = next;
497 mDtStart = next; 497 mDtStart = next;
498 setDtDue( next.addSecs( secs ) ); 498 setDtDue( next.addSecs( secs ) );
499 if ( QDateTime::currentDateTime() > next) 499 if ( QDateTime::currentDateTime() > next)
500 return false; 500 return false;
501 } else { 501 } else {
502 setHasRecurrenceID( false ); 502 setHasRecurrenceID( false );
503 recurrence()->unsetRecurs(); 503 recurrence()->unsetRecurs();
504 } 504 }
505 return true; 505 return true;
506} 506}
507void Todo::setPercentComplete(int v) 507void Todo::setPercentComplete(int v)
508{ 508{
509 if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { 509 if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) {
510 if ( !setRecurDates() ) 510 if ( !setRecurDates() )
511 v = 0; 511 v = 0;
512 } 512 }
513 mPercentComplete = v; 513 mPercentComplete = v;
514 if ( v != 100 ) 514 if ( v != 100 )
515 mHasCompletedDate = false; 515 mHasCompletedDate = false;
516 updated(); 516 updated();
517} 517}
518QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 518QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
519{ 519{
520 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 520 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
521 *ok = false; 521 *ok = false;
522 return QDateTime (); 522 return QDateTime ();
523 } 523 }
524 QDateTime incidenceStart; 524 QDateTime incidenceStart;
525 incidenceStart = dtDue(); 525 incidenceStart = dtDue();
526 bool enabled = false; 526 bool enabled = false;
527 Alarm* alarm; 527 Alarm* alarm;
528 int off = 0; 528 int off = 0;
529 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 529 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
530 // if ( QDateTime::currentDateTime() > incidenceStart ){ 530 // if ( QDateTime::currentDateTime() > incidenceStart ){
531// *ok = false; 531// *ok = false;
532// return incidenceStart; 532// return incidenceStart;
533// } 533// }
534 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 534 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
535 if (alarm->enabled()) { 535 if (alarm->enabled()) {
536 if ( alarm->hasTime () ) { 536 if ( alarm->hasTime () ) {
537 if ( alarm->time() < alarmStart ) { 537 if ( alarm->time() < alarmStart ) {
538 alarmStart = alarm->time(); 538 alarmStart = alarm->time();
539 enabled = true; 539 enabled = true;
540 off = alarmStart.secsTo( incidenceStart ); 540 off = alarmStart.secsTo( incidenceStart );
541 } 541 }
542 542
543 } else { 543 } else {
544 int secs = alarm->startOffset().asSeconds(); 544 int secs = alarm->startOffset().asSeconds();
545 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 545 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
546 alarmStart = incidenceStart.addSecs( secs ); 546 alarmStart = incidenceStart.addSecs( secs );
547 enabled = true; 547 enabled = true;
548 off = -secs; 548 off = -secs;
549 } 549 }
550 } 550 }
551 } 551 }
552 } 552 }
553 if ( enabled ) { 553 if ( enabled ) {
554 if ( alarmStart > QDateTime::currentDateTime() ) { 554 if ( alarmStart > start_dt ) {
555 *ok = true; 555 *ok = true;
556 * offset = off; 556 * offset = off;
557 return alarmStart; 557 return alarmStart;
558 } 558 }
559 } 559 }
560 *ok = false; 560 *ok = false;
561 return QDateTime (); 561 return QDateTime ();
562 562
563} 563}
564 564
565void Todo::checkSetCompletedFalse() 565void Todo::checkSetCompletedFalse()
566{ 566{
567 if ( !hasRecurrenceID() ) { 567 if ( !hasRecurrenceID() ) {
568 qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); 568 qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
569 } 569 }
570 // qDebug("Todo::checkSetCompletedFalse()"); 570 // qDebug("Todo::checkSetCompletedFalse()");
571 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 571 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
572 if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) { 572 if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) {
573 qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 573 qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
574 setCompleted( false ); 574 setCompleted( false );
575 qDebug("Todo::checkSetCompletedFalse "); 575 qDebug("Todo::checkSetCompletedFalse ");
576 } 576 }
577} 577}
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a5354ce..ab8fdf1 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -1,150 +1,150 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef TODO_H 20#ifndef TODO_H
21#define TODO_H 21#define TODO_H
22// 22//
23// Todo component, representing a VTODO object 23// Todo component, representing a VTODO object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28#include <qtimer.h> 28#include <qtimer.h>
29 29
30namespace KCal { 30namespace KCal {
31 31
32/** 32/**
33 This class provides a Todo in the sense of RFC2445. 33 This class provides a Todo in the sense of RFC2445.
34*/ 34*/
35 class Todo : public QObject,public Incidence 35 class Todo : public QObject,public Incidence
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 Todo(); 39 Todo();
40 Todo(const Todo &); 40 Todo(const Todo &);
41 ~Todo(); 41 ~Todo();
42 typedef ListBase<Todo> List; 42 typedef ListBase<Todo> List;
43 QCString type() const { return "Todo"; } 43 QCString type() const { return "Todo"; }
44 44
45 /** Return an exact copy of this todo. */ 45 /** Return an exact copy of this todo. */
46 Incidence *clone(); 46 Incidence *clone();
47 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 47 QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
48 48
49 /** for setting the todo's due date/time with a QDateTime. */ 49 /** for setting the todo's due date/time with a QDateTime. */
50 void setDtDue(const QDateTime &dtDue); 50 void setDtDue(const QDateTime &dtDue);
51 /** returns an event's Due date/time as a QDateTime. */ 51 /** returns an event's Due date/time as a QDateTime. */
52 QDateTime dtDue() const; 52 QDateTime dtDue() const;
53 /** returns an event's due time as a string formatted according to the 53 /** returns an event's due time as a string formatted according to the
54 users locale settings */ 54 users locale settings */
55 QString dtDueTimeStr() const; 55 QString dtDueTimeStr() const;
56 /** returns an event's due date as a string formatted according to the 56 /** returns an event's due date as a string formatted according to the
57 users locale settings */ 57 users locale settings */
58 QString dtDueDateStr(bool shortfmt=true) const; 58 QString dtDueDateStr(bool shortfmt=true) const;
59 /** returns an event's due date and time as a string formatted according 59 /** returns an event's due date and time as a string formatted according
60 to the users locale settings */ 60 to the users locale settings */
61 QString dtDueStr(bool shortfmt=true) const; 61 QString dtDueStr(bool shortfmt=true) const;
62 62
63 /** returns TRUE or FALSE depending on whether the todo has a due date */ 63 /** returns TRUE or FALSE depending on whether the todo has a due date */
64 bool hasDueDate() const; 64 bool hasDueDate() const;
65 /** sets the event's hasDueDate value. */ 65 /** sets the event's hasDueDate value. */
66 void setHasDueDate(bool f); 66 void setHasDueDate(bool f);
67 67
68 /* 68 /*
69 Looks for a subtodo (including itself ) which is not complete and is 69 Looks for a subtodo (including itself ) which is not complete and is
70 - overdue, or 70 - overdue, or
71 - due today. 71 - due today.
72 It returns 0 for nothing found, 72 It returns 0 for nothing found,
73 1 for found a todo which is due today and no overdue found 73 1 for found a todo which is due today and no overdue found
74 2 for found a overdue todo 74 2 for found a overdue todo
75 */ 75 */
76 int hasDueSubTodo( bool checkSubtodos = true ); 76 int hasDueSubTodo( bool checkSubtodos = true );
77 /* same as above, but a specific date can be specified*/ 77 /* same as above, but a specific date can be specified*/
78 int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); 78 int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos );
79 79
80 80
81 /** sets the event's status to the string specified. The string 81 /** sets the event's status to the string specified. The string
82 * must be a recognized value for the status field, i.e. a string 82 * must be a recognized value for the status field, i.e. a string
83 * equivalent of the possible status enumerations previously described. */ 83 * equivalent of the possible status enumerations previously described. */
84// void setStatus(const QString &statStr); 84// void setStatus(const QString &statStr);
85 /** sets the event's status to the value specified. See the enumeration 85 /** sets the event's status to the value specified. See the enumeration
86 * above for possible values. */ 86 * above for possible values. */
87// void setStatus(int); 87// void setStatus(int);
88 /** return the event's status. */ 88 /** return the event's status. */
89// int status() const; 89// int status() const;
90 /** return the event's status in string format. */ 90 /** return the event's status in string format. */
91// QString statusStr() const; 91// QString statusStr() const;
92 92
93 /** return, if this todo is completed */ 93 /** return, if this todo is completed */
94 bool isCompleted() const; 94 bool isCompleted() const;
95 /** set completed state of this todo */ 95 /** set completed state of this todo */
96 void setCompleted(bool); 96 void setCompleted(bool);
97 97
98 /** 98 /**
99 Return how many percent of the task are completed. Returns a value 99 Return how many percent of the task are completed. Returns a value
100 between 0 and 100. 100 between 0 and 100.
101 */ 101 */
102 int percentComplete() const; 102 int percentComplete() const;
103 /** 103 /**
104 Set how many percent of the task are completed. Valid values are in the 104 Set how many percent of the task are completed. Valid values are in the
105 range from 0 to 100. 105 range from 0 to 100.
106 */ 106 */
107 void setPercentComplete(int); 107 void setPercentComplete(int);
108 108
109 /** return date and time when todo was completed */ 109 /** return date and time when todo was completed */
110 QDateTime completed() const; 110 QDateTime completed() const;
111 QString completedStr(bool shortF = true) const; 111 QString completedStr(bool shortF = true) const;
112 /** set date and time of completion */ 112 /** set date and time of completion */
113 void setCompleted(const QDateTime &completed); 113 void setCompleted(const QDateTime &completed);
114 114
115 /** Return true, if todo has a date associated with completion */ 115 /** Return true, if todo has a date associated with completion */
116 bool hasCompletedDate() const; 116 bool hasCompletedDate() const;
117 bool contains ( Todo*); 117 bool contains ( Todo*);
118 void checkSetCompletedFalse(); 118 void checkSetCompletedFalse();
119 bool setRecurDates(); 119 bool setRecurDates();
120 bool isRunning() {return mRunning;} 120 bool isRunning() {return mRunning;}
121 bool hasRunningSub(); 121 bool hasRunningSub();
122 void setRunning( bool ); 122 void setRunning( bool );
123 void setRunningFalse( QString ); 123 void setRunningFalse( QString );
124 int runTime(); 124 int runTime();
125 QDateTime runStart () const { return mRunStart;} 125 QDateTime runStart () const { return mRunStart;}
126 public slots: 126 public slots:
127 void saveRunningInfoToFile( QString st = QString::null ); 127 void saveRunningInfoToFile( QString st = QString::null );
128 void saveParents(); 128 void saveParents();
129 private: 129 private:
130 bool mRunning; 130 bool mRunning;
131 QTimer * mRunSaveTimer; 131 QTimer * mRunSaveTimer;
132 QDateTime mRunStart; 132 QDateTime mRunStart;
133 bool accept(Visitor &v) { return v.visit(this); } 133 bool accept(Visitor &v) { return v.visit(this); }
134 134
135 QDateTime mDtDue; // due date of todo 135 QDateTime mDtDue; // due date of todo
136 136
137 bool mHasDueDate; // if todo has associated due date 137 bool mHasDueDate; // if todo has associated due date
138 138
139// int mStatus; // confirmed/delegated/tentative/etc 139// int mStatus; // confirmed/delegated/tentative/etc
140 140
141 QDateTime mCompleted; 141 QDateTime mCompleted;
142 bool mHasCompletedDate; 142 bool mHasCompletedDate;
143 143
144 int mPercentComplete; 144 int mPercentComplete;
145}; 145};
146 146
147 bool operator==( const Todo&, const Todo& ); 147 bool operator==( const Todo&, const Todo& );
148} 148}
149 149
150#endif 150#endif