summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-12-05 11:14:32 (UTC)
committer zautrix <zautrix>2004-12-05 11:14:32 (UTC)
commit196365e533c6fd1a8f47aa9579763ef5afcebcda (patch) (unidiff)
tree3784f0be50b790d9386db1e4ebd29d44317db026
parente4e75984b6cb581d87d436cb6c5140eb57dbdc51 (diff)
downloadkdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.zip
kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.tar.gz
kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.tar.bz2
layout bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt10
-rw-r--r--kaddressbook/views/contactlistview.cpp2
-rw-r--r--kaddressbook/xxportselectdialog.cpp8
-rw-r--r--korganizer/calendarview.cpp14
-rw-r--r--korganizer/koeditordetails.cpp7
-rw-r--r--korganizer/mainwindow.cpp5
6 files changed, 36 insertions, 10 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index b5ad650..08efcf6 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -1,552 +1,562 @@
1{ "file","Datei" }, 1{ "file","Datei" },
2{ "Choose one file","Wähle eine Datei" }, 2{ "Choose one file","Wähle eine Datei" },
3{ "dir","Verzeichnis" }, 3{ "dir","Verzeichnis" },
4{ "Choose a directory with may files","Wähle Verzeichnis" }, 4{ "Choose a directory with may files","Wähle Verzeichnis" },
5{ "ldap","ldap" }, 5{ "ldap","ldap" },
6{ "No description available","Keine Beschreibung verfügbar" }, 6{ "No description available","Keine Beschreibung verfügbar" },
7{ "Library files for "%1" not found in paths","Bibliothek für "%1" nicht gefunden" }, 7{ "Library files for "%1" not found in paths","Bibliothek für "%1" nicht gefunden" },
8{ "qtopia","qtopia" }, 8{ "qtopia","qtopia" },
9{ "Qtopia PIM Addressbook.","Qtopia PIM Adressbuch." }, 9{ "Qtopia PIM Addressbook.","Qtopia PIM Adressbuch." },
10{ "vCard","vCard" }, 10{ "vCard","vCard" },
11{ "vCard Format","vCard Format" }, 11{ "vCard Format","vCard Format" },
12{ "microkabcformat_binary","microkabcformat_binary" }, 12{ "microkabcformat_binary","microkabcformat_binary" },
13{ "Binary","Binary" }, 13{ "Binary","Binary" },
14{ "No description available.","Keine Beschreibung verfügbar." }, 14{ "No description available.","Keine Beschreibung verfügbar." },
15{ "Department","Abteilung" }, 15{ "Department","Abteilung" },
16{ "Profession","Beruf" }, 16{ "Profession","Beruf" },
17{ "Assistant's Name","Name d.Assistenten" }, 17{ "Assistant's Name","Name d.Assistenten" },
18{ "Manager's Name","Name d.Manager's" }, 18{ "Manager's Name","Name d.Manager's" },
19{ "Spouse's Name","Name d.Ehegatten" }, 19{ "Spouse's Name","Name d.Ehegatten" },
20{ "Office","Büro" }, 20{ "Office","Büro" },
21{ "IM Address","IM Adresse" }, 21{ "IM Address","IM Adresse" },
22{ "Anniversary","Jahrestag" }, 22{ "Anniversary","Jahrestag" },
23{ "Gender","Geschlecht" }, 23{ "Gender","Geschlecht" },
24{ "Children","Kinder" }, 24{ "Children","Kinder" },
25{ "FreeBusyUrl","FreeBusyUrl" }, 25{ "FreeBusyUrl","FreeBusyUrl" },
26{ "ExternalID","ExternalID" }, 26{ "ExternalID","ExternalID" },
27{ "Resource loaded: '%1'","Resource geladen: '%1'" }, 27{ "Resource loaded: '%1'","Resource geladen: '%1'" },
28{ "Select View","Ansicht wählen" }, 28{ "Select View","Ansicht wählen" },
29{ "Modify View...","Ansicht ändern..." }, 29{ "Modify View...","Ansicht ändern..." },
30{ "Add View...","Ansicht hinzufügen..." }, 30{ "Add View...","Ansicht hinzufügen..." },
31{ "Delete View","Ansicht löschen" }, 31{ "Delete View","Ansicht löschen" },
32{ "Refresh View","Ansicht aktualisieren" }, 32{ "Refresh View","Ansicht aktualisieren" },
33{ "Edit &Filters...","Bearbeite &Filter..." }, 33{ "Edit &Filters...","Bearbeite &Filter..." },
34{ "Select Filter","Filter wählen" }, 34{ "Select Filter","Filter wählen" },
35{ "Style:","Stil:" }, 35{ "Style:","Stil:" },
36{ "HTML table style.","HTML tabellen stil." }, 36{ "HTML table style.","HTML tabellen stil." },
37{ "Default Table View","Standard Tabellen Ansicht" }, 37{ "Default Table View","Standard Tabellen Ansicht" },
38{ "Show Extension Bar","Zeige Extension Bar" }, 38{ "Show Extension Bar","Zeige Extension Bar" },
39{ "None","Kein" }, 39{ "None","Kein" },
40{ "Name...","Name..." }, 40{ "Name...","Name..." },
41{ "Role:","Funktion:" }, 41{ "Role:","Funktion:" },
42{ "Organization:","Firma:" }, 42{ "Organization:","Firma:" },
43{ "Formatted name:","Formatt. Name:" }, 43{ "Formatted name:","Formatt. Name:" },
44{ "Edit Phone Numbers...","Bearbeite Telefonnummern..." }, 44{ "Edit Phone Numbers...","Bearbeite Telefonnummern..." },
45{ "Categories","Kategorien" }, 45{ "Categories","Kategorien" },
46{ "Public","Öffentlich" }, 46{ "Public","Öffentlich" },
47{ "Private","Privat" }, 47{ "Private","Privat" },
48{ "Confidential","Vertraulich" }, 48{ "Confidential","Vertraulich" },
49{ "&General","Allgemein" }, 49{ "&General","Allgemein" },
50{ "&Edit Addresses...","B&earbeite Adressen..." }, 50{ "&Edit Addresses...","B&earbeite Adressen..." },
51{ "Edit Email Addresses...","Bearbeite E-Mail Adressen..." }, 51{ "Edit Email Addresses...","Bearbeite E-Mail Adressen..." },
52{ "Email:","Email:" }, 52{ "Email:","Email:" },
53{ "URL:","URL:" }, 53{ "URL:","URL:" },
54{ "&IM address:","&IM address:" }, 54{ "&IM address:","&IM address:" },
55{ "&Address","&Adresse" }, 55{ "&Address","&Adresse" },
56{ "Department:","Abteilung:" }, 56{ "Department:","Abteilung:" },
57{ "Office:","Büro:" }, 57{ "Office:","Büro:" },
58{ "Profession:","Beruf:" }, 58{ "Profession:","Beruf:" },
59{ "Manager's name:","N.d.Manager's:" }, 59{ "Manager's name:","N.d.Manager's:" },
60{ "Assistant's name:","N.d.Assistenten:" }, 60{ "Assistant's name:","N.d.Assistenten:" },
61{ "Nick name:","Spitzname:" }, 61{ "Nick name:","Spitzname:" },
62{ "Spouse's name:","N.d.Ehegatten:" }, 62{ "Spouse's name:","N.d.Ehegatten:" },
63{ "Children's names:","N.d.Kinder:" }, 63{ "Children's names:","N.d.Kinder:" },
64{ "Birthday:","Geburtstag:" }, 64{ "Birthday:","Geburtstag:" },
65{ " Local Time","Ortszeit" }, 65{ " Local Time","Ortszeit" },
66{ "Mon","Mo" }, 66{ "Mon","Mo" },
67{ "Tue","Di" }, 67{ "Tue","Di" },
68{ "Wed","Mi" }, 68{ "Wed","Mi" },
69{ "Thu","Do" }, 69{ "Thu","Do" },
70{ "Fri","Fr" }, 70{ "Fri","Fr" },
71{ "Sat","Sa" }, 71{ "Sat","Sa" },
72{ "Sun","So" }, 72{ "Sun","So" },
73{ "January","Januar" }, 73{ "January","Januar" },
74{ "February","Februar" }, 74{ "February","Februar" },
75{ "March","März" }, 75{ "March","März" },
76{ "April","April" }, 76{ "April","April" },
77{ "May","Mai" }, 77{ "May","Mai" },
78{ "June","Juni" }, 78{ "June","Juni" },
79{ "July","July" }, 79{ "July","July" },
80{ "August","August" }, 80{ "August","August" },
81{ "September","September" }, 81{ "September","September" },
82{ "October","October" }, 82{ "October","October" },
83{ "November","November" }, 83{ "November","November" },
84{ "December","Dezember" }, 84{ "December","Dezember" },
85{ "tomorrow","Morgen" }, 85{ "tomorrow","Morgen" },
86{ "today","Heute" }, 86{ "today","Heute" },
87{ "yesterday","Gestern" }, 87{ "yesterday","Gestern" },
88{ "Monday","Montag" }, 88{ "Monday","Montag" },
89{ "Tuesday","Dienstag" }, 89{ "Tuesday","Dienstag" },
90{ "Wednesday","Mittwoch" }, 90{ "Wednesday","Mittwoch" },
91{ "Thursday","Donnerstag" }, 91{ "Thursday","Donnerstag" },
92{ "Friday","Freitag" }, 92{ "Friday","Freitag" },
93{ "Saturday","Samstag" }, 93{ "Saturday","Samstag" },
94{ "Sunday","Sonntag" }, 94{ "Sunday","Sonntag" },
95{ "Anniversary:","Jahrestag:" }, 95{ "Anniversary:","Jahrestag:" },
96{ "Gender:","Geschlecht:" }, 96{ "Gender:","Geschlecht:" },
97{ "ALIEN (gender undefined)","ALIEN (Geschlecht unbekannt)" }, 97{ "ALIEN (gender undefined)","ALIEN (Geschlecht unbekannt)" },
98{ "female","weiblich" }, 98{ "female","weiblich" },
99{ "male","männlich" }, 99{ "male","männlich" },
100{ "&Details","&Details" }, 100{ "&Details","&Details" },
101{ "Note:","Notiz:" }, 101{ "Note:","Notiz:" },
102{ "&Notes","&Notizen" }, 102{ "&Notes","&Notizen" },
103{ "Use geo data","Benutze geo Daten" }, 103{ "Use geo data","Benutze geo Daten" },
104{ "Latitude:","Breitengrad:" }, 104{ "Latitude:","Breitengrad:" },
105{ "Longitude:","Längengrad:" }, 105{ "Longitude:","Längengrad:" },
106{ "Edit Geo Data...","Edit geo Daten..." }, 106{ "Edit Geo Data...","Edit geo Daten..." },
107{ "Keys:","Schlüssel:" }, 107{ "Keys:","Schlüssel:" },
108{ "Add","Hinzufügen" }, 108{ "Add","Hinzufügen" },
109{ "Remove","Entfernen" }, 109{ "Remove","Entfernen" },
110{ "Export","Exportiere" }, 110{ "Export","Exportiere" },
111{ "&Misc","Verschiedenes" }, 111{ "&Misc","Verschiedenes" },
112{ "Photo","Foto" }, 112{ "Photo","Foto" },
113{ "Store as URL","Speichere als URL" }, 113{ "Store as URL","Speichere als URL" },
114{ "Logo","Logo" }, 114{ "Logo","Logo" },
115{ "&Images","B&ilder" }, 115{ "&Images","B&ilder" },
116{ "Home","Privat" }, 116{ "Home","Privat" },
117{ "Work","Geschäft" }, 117{ "Work","Geschäft" },
118{ "Mobile","Handy" }, 118{ "Mobile","Handy" },
119{ "Fax","Fax" }, 119{ "Fax","Fax" },
120{ "Contact Editor","Bearbeite Kontakt" }, 120{ "Contact Editor","Bearbeite Kontakt" },
121{ "&Mail...","&Mail..." }, 121{ "&Mail...","&Mail..." },
122{ "&Print...","Drucken..." }, 122{ "&Print...","Drucken..." },
123{ "&Save","&Speichern" }, 123{ "&Save","&Speichern" },
124{ "&New Contact...","&Neuer Kontakt..." }, 124{ "&New Contact...","&Neuer Kontakt..." },
125{ "Mail &vCard...","Mail &vCard..." }, 125{ "Mail &vCard...","Mail &vCard..." },
126{ "Selected to phone","Auswahl zum Telefon" }, 126{ "Selected to phone","Auswahl zum Telefon" },
127{ "Beam selected v&Card(s)","Beame ausgewählte v&Card(s)" }, 127{ "Beam selected v&Card(s)","Beame ausgewählte v&Card(s)" },
128{ "&Beam personal vCard","Beame persönliche vCard" }, 128{ "&Beam personal vCard","Beame persönliche vCard" },
129{ "&Edit Contact...","Bearbeite Kontakt..." }, 129{ "&Edit Contact...","Bearbeite Kontakt..." },
130{ "&Exit","B&eenden" }, 130{ "&Exit","B&eenden" },
131{ "&Copy","Kopieren" }, 131{ "&Copy","Kopieren" },
132{ "Cu&t","Ausschneiden" }, 132{ "Cu&t","Ausschneiden" },
133{ "&Paste","Einfügen" }, 133{ "&Paste","Einfügen" },
134{ "Select &All","Alles auswählen" }, 134{ "Select &All","Alles auswählen" },
135{ "&Undo","Rückgängig machen" }, 135{ "&Undo","Rückgängig machen" },
136{ "Re&do","Wiederherstellen" }, 136{ "Re&do","Wiederherstellen" },
137{ "&Delete Contact","Lösche Kontakt" }, 137{ "&Delete Contact","Lösche Kontakt" },
138{ "Configure &Resources...","Konfiguriere &Resourcen..." }, 138{ "Configure &Resources...","Konfiguriere &Resourcen..." },
139{ "&Configure %1...","Konfiguriere %1..." }, 139{ "&Configure %1...","Konfiguriere %1..." },
140{ "Configure S&hortcuts...","Konfiguriere S&hortcuts..." }, 140{ "Configure S&hortcuts...","Konfiguriere S&hortcuts..." },
141{ "Show Jump Bar","Zeige Jump Bar" }, 141{ "Show Jump Bar","Zeige Jump Bar" },
142{ "Show Details","Zeige Details" }, 142{ "Show Details","Zeige Details" },
143{ "Beam receive enabled","Beam (IR) Empfang AN" }, 143{ "Beam receive enabled","Beam (IR) Empfang AN" },
144{ "Set Who Am I","Setze "wer bin ich"" }, 144{ "Set Who Am I","Setze "wer bin ich"" },
145{ "Set Categories","Wähle Kategorien" }, 145{ "Set Categories","Wähle Kategorien" },
146{ "Edit Categories","Editiere Kategorien" }, 146{ "Edit Categories","Editiere Kategorien" },
147{ "Remove "voice"...","Entferne "voice"..." }, 147{ "Remove "voice"...","Entferne "voice"..." },
148{ "Import from Outlook...","Importiere aus Outlook..." }, 148{ "Import from Outlook...","Importiere aus Outlook..." },
149{ "Licence","Lizenz" }, 149{ "Licence","Lizenz" },
150{ "Faq","Fragen + Antworten" }, 150{ "Faq","Fragen + Antworten" },
151{ "What's New?","Was ist neu?" }, 151{ "What's New?","Was ist neu?" },
152{ "Sync HowTo","Sync Anleitung" }, 152{ "Sync HowTo","Sync Anleitung" },
153{ "&About KAddressBook","Über KAdressBuch" }, 153{ "&About KAddressBook","Über KAdressBuch" },
154{ "Select Incremental Search Field","Selektiere Such Feld" }, 154{ "Select Incremental Search Field","Selektiere Such Feld" },
155{ "Synchronize","Synchronisieren" }, 155{ "Synchronize","Synchronisieren" },
156{ "Configure...","Konfigurieren..." }, 156{ "Configure...","Konfigurieren..." },
157{ "Enable Pi-Sync","Aktiviere Pi-Sync" }, 157{ "Enable Pi-Sync","Aktiviere Pi-Sync" },
158{ "Multiple sync","Mehrfach Sync" }, 158{ "Multiple sync","Mehrfach Sync" },
159{ "Import CSV List...","Importiere CSV-Datei..." }, 159{ "Import CSV List...","Importiere CSV-Datei..." },
160{ "Export CSV List...","Exportiere CSV-Datei..." }, 160{ "Export CSV List...","Exportiere CSV-Datei..." },
161{ "Import KDE 2 Addressbook...","Importiere KDE 2 Adressbuch..." }, 161{ "Import KDE 2 Addressbook...","Importiere KDE 2 Adressbuch..." },
162{ "Import vCard...","Importiere vCard..." }, 162{ "Import vCard...","Importiere vCard..." },
163{ "Export vCard 3.0...","Exportiere vCard 3.0..." }, 163{ "Export vCard 3.0...","Exportiere vCard 3.0..." },
164{ "Import Qtopia...","Importiere Qtopia..." }, 164{ "Import Qtopia...","Importiere Qtopia..." },
165{ "Export Qtopia...","Exportiere Qtopia..." }, 165{ "Export Qtopia...","Exportiere Qtopia..." },
166{ "Edit Contact","Bearbeite Kontakt" }, 166{ "Edit Contact","Bearbeite Kontakt" },
167{ "Ok","Ok" }, 167{ "Ok","Ok" },
168{ "Apply","Anwenden" }, 168{ "Apply","Anwenden" },
169{ "Cancel","Abbrechen" }, 169{ "Cancel","Abbrechen" },
170{ "KAddressbook/Pi","KAdressbuch/Pi" }, 170{ "KAddressbook/Pi","KAdressbuch/Pi" },
171{ "No Filter","Kein Filter" }, 171{ "No Filter","Kein Filter" },
172{ "Given Name","Vorname" }, 172{ "Given Name","Vorname" },
173{ "Family Name","Nachname" }, 173{ "Family Name","Nachname" },
174{ "Email Address","E-Mail Adresse" }, 174{ "Email Address","E-Mail Adresse" },
175{ "All Fields","Alle Felder" }, 175{ "All Fields","Alle Felder" },
176{ "Question","Frage" }, 176{ "Question","Frage" },
177{ "After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as "other".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?","After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as "other".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?" }, 177{ "After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as "other".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?","After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as "other".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?" },
178{ "No","Nein" }, 178{ "No","Nein" },
179{ "Yes","Ja" }, 179{ "Yes","Ja" },
180{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile" }, 180{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile" },
181{ "Local device name:","Name dieses Gerätes:" }, 181{ "Local device name:","Name dieses Gerätes:" },
182{ "New profile","Neues Profil" }, 182{ "New profile","Neues Profil" },
183{ "Clone profile","Klone Profil" }, 183{ "Clone profile","Klone Profil" },
184{ "Delete profile","Lösche Profil" }, 184{ "Delete profile","Lösche Profil" },
185{ "Profile:","Profil:" }, 185{ "Profile:","Profil:" },
186{ "Ask for every entry on conflict","Frage bei Konflikten nach"}, 186{ "Ask for every entry on conflict","Frage bei Konflikten nach"},
187{ "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" }, 187{ "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" },
188{ "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" }, 188{ "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" },
189{ "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" }, 189{ "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" },
190{ "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" }, 190{ "Include in multiple sync","Beziehe Profil in mehrfach Sync mit ein" },
191{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" }, 191{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" },
192{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" }, 192{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" },
193{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" }, 193{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" },
194{ "Write back file","Schreibe Datei zurück" }, 194{ "Write back file","Schreibe Datei zurück" },
195{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" }, 195{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" },
196{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" }, 196{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" },
197{ "Local device name:","Name dieses Gerätes:" }, 197{ "Local device name:","Name dieses Gerätes:" },
198{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" }, 198{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" },
199{ "Sync preferences","Synchronisations Einstellungen" }, 199{ "Sync preferences","Synchronisations Einstellungen" },
200{ "Profile kind","Profil Art" }, 200{ "Profile kind","Profil Art" },
201{ "Local file","Lokale Datei" }, 201{ "Local file","Lokale Datei" },
202{ "Local file:","Lokale Datei:" }, 202{ "Local file:","Lokale Datei:" },
203{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" }, 203{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" },
204{ "Fill in default values for:","Setze Beispiel Werte ein für:" }, 204{ "Fill in default values for:","Setze Beispiel Werte ein für:" },
205{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" }, 205{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" },
206{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"}, 206{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"},
207{ "Device","Gerät:" }, 207{ "Device","Gerät:" },
208{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" }, 208{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" },
209{ "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" }, 209{ "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" },
210{ "Synchronization successful","Synchronisation erfolgreich" }, 210{ "Synchronization successful","Synchronisation erfolgreich" },
211{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." }, 211{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." },
212{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" }, 212{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" },
213{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" }, 213{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" },
214{ "Enter password","Passwort eingeben" }, 214{ "Enter password","Passwort eingeben" },
215{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" }, 215{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" },
216{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." }, 216{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." },
217{ "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" }, 217{ "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" },
218{ "Writing back file result: ","Resultat des Dateizurückschreibens: " }, 218{ "Writing back file result: ","Resultat des Dateizurückschreibens: " },
219{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" }, 219{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" },
220{ "Used %1 Client","Benutzter %1 Client" }, 220{ "Used %1 Client","Benutzter %1 Client" },
221{ "No email client installed","Kein Email Klient installiert" }, 221{ "No email client installed","Kein Email Klient installiert" },
222{ "Userdefined email client","Benutzerdef. Email Klient" }, 222{ "Userdefined email client","Benutzerdef. Email Klient" },
223{ "OM/Pi email client","OM/Pi Email Klient" }, 223{ "OM/Pi email client","OM/Pi Email Klient" },
224{ "Include in multiple ","Beziehe in multiple " }, 224{ "Include in multiple ","Beziehe in multiple " },
225{ "calendar ","Kalender " }, 225{ "calendar ","Kalender " },
226{ "addressbook ","Adressbuch " }, 226{ "addressbook ","Adressbuch " },
227{ "pwmanager","PWmanager" }, 227{ "pwmanager","PWmanager" },
228{ " sync"," Sync ein" }, 228{ " sync"," Sync ein" },
229{ "Write back synced data","Schreibe gesyncte Daten zurück" }, 229{ "Write back synced data","Schreibe gesyncte Daten zurück" },
230{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" }, 230{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" },
231{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" }, 231{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" },
232{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " }, 232{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " },
233{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" }, 233{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" },
234{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" }, 234{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" },
235{ "Help...","Hilfe..." }, 235{ "Help...","Hilfe..." },
236{ "Local file Cal:","Lokale Datei Kal:" }, 236{ "Local file Cal:","Lokale Datei Kal:" },
237{ "Local file ABook:","Lokale Datei ABuch:" }, 237{ "Local file ABook:","Lokale Datei ABuch:" },
238{ "Local file PWMgr:","Lokale Datei PWMgr:" }, 238{ "Local file PWMgr:","Lokale Datei PWMgr:" },
239{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" }, 239{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" },
240{ "Calendar:","Kalender:" }, 240{ "Calendar:","Kalender:" },
241{ "AddressBook:","AdressBuch:" }, 241{ "AddressBook:","AdressBuch:" },
242{ "PWManager:","PWManager:" }, 242{ "PWManager:","PWManager:" },
243{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" }, 243{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" },
244{ "ssh/scp","ssh/scp" }, 244{ "ssh/scp","ssh/scp" },
245{ "ftp","ftp" }, 245{ "ftp","ftp" },
246{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" }, 246{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" },
247{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" }, 247{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" },
248{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" }, 248{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" },
249{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, 249{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" },
250{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, 250{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" },
251{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, 251{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" },
252{ "KDE-Pim sync config","KDE-Pim sync Konfig" }, 252{ "KDE-Pim sync config","KDE-Pim sync Konfig" },
253{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, 253{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" },
254{ "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" }, 254{ "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" },
255{ "Port number (Default: %1)","Port Nummer (Default: %1)" }, 255{ "Port number (Default: %1)","Port Nummer (Default: %1)" },
256{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, 256{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" },
257{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, 257{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" },
258{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, 258{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" },
259{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, 259{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" },
260{ "Disable Pi-Sync","Schalte Pi-Sync aus" }, 260{ "Disable Pi-Sync","Schalte Pi-Sync aus" },
261{ "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!" }, 261{ "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!" },
262{ "KDE-Pim Sync","KDE-Pim Sync" }, 262{ "KDE-Pim Sync","KDE-Pim Sync" },
263{ "Multiple profiles","Multi-Sync Profile" }, 263{ "Multiple profiles","Multi-Sync Profile" },
264{ "Device: ","Gerät: " }, 264{ "Device: ","Gerät: " },
265{ "Multiple sync started.","Multi-Sync gestartet." }, 265{ "Multiple sync started.","Multi-Sync gestartet." },
266{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, 266{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" },
267{ "KDE-Pim sync config","KDE-Pim Sync Konfig" }, 267{ "KDE-Pim sync config","KDE-Pim Sync Konfig" },
268{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein, z.B.:\n" }, 268{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein, z.B.:\n" },
269{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Modell\nautomatisch\erkannt\nwerden kann)\nOder füge Model Name ein:\n" }, 269{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Modell\nautomatisch\erkannt\nwerden kann)\nOder füge Model Name ein:\n" },
270{ "KO/Pi config error","KO/Pi Konfig. Fehler" }, 270{ "KO/Pi config error","KO/Pi Konfig. Fehler" },
271{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" }, 271{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" },
272{ "Edit Address Book Filters","Editiere Addressbuch Filter" }, 272{ "Edit Address Book Filters","Editiere Addressbuch Filter" },
273{ "&Add...","Hinzufügen..." }, 273{ "&Add...","Hinzufügen..." },
274{ "&Edit...","B&earbeiten..." }, 274{ "&Edit...","B&earbeiten..." },
275{ "&Remove","Entfe&rne" }, 275{ "&Remove","Entfe&rne" },
276{ "Modify View: ","Ansicht ändern: " }, 276{ "Modify View: ","Ansicht ändern: " },
277{ "Fields","Felder" }, 277{ "Fields","Felder" },
278{ "Select Fields to Display","Wähle anzuzeigende Felder" }, 278{ "Select Fields to Display","Wähle anzuzeigende Felder" },
279{ "All","Alles" }, 279{ "All","Alles" },
280{ "Frequent","Frequent" }, 280{ "Frequent","Frequent" },
281{ "Address","Adresse" }, 281{ "Address","Adresse" },
282{ "Email","E-Mail" }, 282{ "Email","E-Mail" },
283{ "Personal","Persönl." }, 283{ "Personal","Persönl." },
284{ "Organization","Organisation" }, 284{ "Organization","Organisation" },
285{ "Custom","Benutzerdefiniert" }, 285{ "Custom","Benutzerdefiniert" },
286{ "&Selected\nfields:","&Selectierte\nFelder:" }, 286{ "&Selected\nfields:","&Selectierte\nFelder:" },
287{ "Formatted Name","Format. Name" }, 287{ "Formatted Name","Format. Name" },
288{ "Additional Names","Mittelname" }, 288{ "Additional Names","Mittelname" },
289{ "Honorific Prefixes","Namen Prefix" }, 289{ "Honorific Prefixes","Namen Prefix" },
290{ "Honorific Suffixes","Namen Suffix" }, 290{ "Honorific Suffixes","Namen Suffix" },
291{ "Nick Name","Sptitzname" }, 291{ "Nick Name","Sptitzname" },
292{ "Birthday","Geburtstag" }, 292{ "Birthday","Geburtstag" },
293{ "Home Address Street","Privat Adresse Strasse" }, 293{ "Home Address Street","Privat Adresse Strasse" },
294{ "Home Address Locality","Privat Adresse Stadt" }, 294{ "Home Address Locality","Privat Adresse Stadt" },
295{ "Home Address Region","Privat Adresse Bundesland" }, 295{ "Home Address Region","Privat Adresse Bundesland" },
296{ "Home Address Postal Code","Privat Adresse PLZ" }, 296{ "Home Address Postal Code","Privat Adresse PLZ" },
297{ "Home Address Country","Privat Adresse Land" }, 297{ "Home Address Country","Privat Adresse Land" },
298{ "Home Address Label","Privat Adresse Label" }, 298{ "Home Address Label","Privat Adresse Label" },
299{ "Business Address Street","Büro Adresse Strasse" }, 299{ "Business Address Street","Büro Adresse Strasse" },
300{ "Business Address Locality","Büro Adresse Stadt" }, 300{ "Business Address Locality","Büro Adresse Stadt" },
301{ "Business Address Region","Büro Adresse Bundesland" }, 301{ "Business Address Region","Büro Adresse Bundesland" },
302{ "Business Address Postal Code","Büro Adresse PLZ" }, 302{ "Business Address Postal Code","Büro Adresse PLZ" },
303{ "Business Address Country","Büro Adresse Land" }, 303{ "Business Address Country","Büro Adresse Land" },
304{ "Business Address Label","Büro Adresse Label" }, 304{ "Business Address Label","Büro Adresse Label" },
305{ "Home Phone","Privat Telefon" }, 305{ "Home Phone","Privat Telefon" },
306{ "Business Phone","Büro Telefon" }, 306{ "Business Phone","Büro Telefon" },
307{ "Mobile Phone","Handy" }, 307{ "Mobile Phone","Handy" },
308{ "Home Fax","Privat Fax" }, 308{ "Home Fax","Privat Fax" },
309{ "Business Fax","Büro Fax" }, 309{ "Business Fax","Büro Fax" },
310{ "Car Phone","Autotelefon" }, 310{ "Car Phone","Autotelefon" },
311{ "ISDN","ISDN" }, 311{ "ISDN","ISDN" },
312{ "Pager","Pager" }, 312{ "Pager","Pager" },
313{ "Mail Client","Mail Client" }, 313{ "Mail Client","Mail Client" },
314{ "Title","Titel" }, 314{ "Title","Titel" },
315{ "Role","Rolle" }, 315{ "Role","Rolle" },
316{ "Note","Notiz" }, 316{ "Note","Notiz" },
317{ "URL","URL" }, 317{ "URL","URL" },
318{ "Resource","Resource" }, 318{ "Resource","Resource" },
319{ "SIP","SIP" }, 319{ "SIP","SIP" },
320{ "Default Filter","Default Filter" }, 320{ "Default Filter","Default Filter" },
321{ "The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime.","#The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime." }, 321{ "The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime.","#The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime." },
322{ "No default filter","Kein default Filter" }, 322{ "No default filter","Kein default Filter" },
323{ "Use last active filter","Nutze letzen aktiven Filter" }, 323{ "Use last active filter","Nutze letzen aktiven Filter" },
324{ "Use filter:","Nutze Filter:" }, 324{ "Use filter:","Nutze Filter:" },
325{ "Look & Feel","Look & Feel" }, 325{ "Look & Feel","Look & Feel" },
326{ "Row Separator","Reihen Separator" }, 326{ "Row Separator","Reihen Separator" },
327{ "Alternating backgrounds","Abwechselnder Hintergrund" }, 327{ "Alternating backgrounds","Abwechselnder Hintergrund" },
328{ "Single line","Einzelne Zeile" }, 328{ "Single line","Einzelne Zeile" },
329{ "Enable background image:","Hintergrundbild:" }, 329{ "Enable background image:","Hintergrundbild:" },
330{ "Enable contact tooltips","Contact Tooltips" }, 330{ "Enable contact tooltips","Contact Tooltips" },
331{ "&Enable custom Colors","Benutzerdef. Farben" }, 331{ "&Enable custom Colors","Benutzerdef. Farben" },
332{ "&Colors","Farben" }, 332{ "&Colors","Farben" },
333{ "If custom colors are enabled, you may choose the colors for the view below. Otherwise colors from your current KDE color scheme are used.","#If custom colors are enabled, you may choose the colors for the view below. Otherwise colors from your current KDE color scheme are used." }, 333{ "If custom colors are enabled, you may choose the colors for the view below. Otherwise colors from your current KDE color scheme are used.","#If custom colors are enabled, you may choose the colors for the view below. Otherwise colors from your current KDE color scheme are used." },
334{ "Double click or press RETURN on a item to select a color for the related strings in the view.","#Double click or press RETURN on a item to select a color for the related strings in the view." }, 334{ "Double click or press RETURN on a item to select a color for the related strings in the view.","#Double click or press RETURN on a item to select a color for the related strings in the view." },
335{ "&Enable custom fonts","B&enutzerdefinierte Schriften" }, 335{ "&Enable custom fonts","B&enutzerdefinierte Schriften" },
336{ "&Text font:","Textschriftart:" }, 336{ "&Text font:","Textschriftart:" },
337{ "&Header font:","Titelschriftart:" }, 337{ "&Header font:","Titelschriftart:" },
338{ "If custom fonts are enabled, you may choose which fonts to use for this view below. Otherwise the default KDE font will be used, in bold style for the header and normal style for the data.","#If custom fonts are enabled, you may choose which fonts to use for this view below. Otherwise the default KDE font will be used, in bold style for the header and normal style for the data." }, 338{ "If custom fonts are enabled, you may choose which fonts to use for this view below. Otherwise the default KDE font will be used, in bold style for the header and normal style for the data.","#If custom fonts are enabled, you may choose which fonts to use for this view below. Otherwise the default KDE font will be used, in bold style for the header and normal style for the data." },
339{ "&Fonts","Schri&ften" }, 339{ "&Fonts","Schri&ften" },
340{ "Background Color","Hintergrundfarbe" }, 340{ "Background Color","Hintergrundfarbe" },
341{ "Text Color","Textfarbe" }, 341{ "Text Color","Textfarbe" },
342{ "Header Background Color","Titel Hintergrundfarbe" }, 342{ "Header Background Color","Titel Hintergrundfarbe" },
343{ "Header Text Color","Titel Farbe" }, 343{ "Header Text Color","Titel Farbe" },
344{ "Highlight Color","Auswahlfarbe" }, 344{ "Highlight Color","Auswahlfarbe" },
345{ "Highlighted Text Color","Auswahltextfarbe" }, 345{ "Highlighted Text Color","Auswahltextfarbe" },
346{ "Alternating Background Color","Abwechselnder Hintergrundfarbe" }, 346{ "Alternating Background Color","Abwechselnder Hintergrundfarbe" },
347{ "Postal","Post" }, 347{ "Postal","Post" },
348{ "Dr.","Dr." }, 348{ "Dr.","Dr." },
349{ "Miss","Frl." }, 349{ "Miss","Frl." },
350{ "Mr.","Herr" }, 350{ "Mr.","Herr" },
351{ "Mrs.","Frau" }, 351{ "Mrs.","Frau" },
352{ "Ms.","Fr." }, 352{ "Ms.","Fr." },
353{ "Prof.","Prof." }, 353{ "Prof.","Prof." },
354{ "I","I" }, 354{ "I","I" },
355{ "II","II" }, 355{ "II","II" },
356{ "III","III" }, 356{ "III","III" },
357{ "Jr.","Jr." }, 357{ "Jr.","Jr." },
358{ "Sr.","Sr." }, 358{ "Sr.","Sr." },
359{ "Name:","Name:" }, 359{ "Name:","Name:" },
360{ "Documents","Dokumente" }, 360{ "Documents","Dokumente" },
361{ "Files","Dateien" }, 361{ "Files","Dateien" },
362{ "All Files","Alle Dateien" }, 362{ "All Files","Alle Dateien" },
363{ "Name","Name" }, 363{ "Name","Name" },
364{ "Size","Größe" }, 364{ "Size","Größe" },
365{ "Date","Datum" }, 365{ "Date","Datum" },
366{ "Mime Type","Mime Typ" }, 366{ "Mime Type","Mime Typ" },
367{ "Geo Data Input","Geo Dateneingabe" }, 367{ "Geo Data Input","Geo Dateneingabe" },
368{ "Sexagesimal","Sexagesimal" }, 368{ "Sexagesimal","Sexagesimal" },
369{ "North","Nord" }, 369{ "North","Nord" },
370{ "South","Süd" }, 370{ "South","Süd" },
371{ "East","Ost" }, 371{ "East","Ost" },
372{ "West","West" }, 372{ "West","West" },
373{ "Undefined","Unbestimmt" }, 373{ "Undefined","Unbestimmt" },
374{ "Edit Address","Bearbeite Adresse" }, 374{ "Edit Address","Bearbeite Adresse" },
375{ "Street:","Strasse:" }, 375{ "Street:","Strasse:" },
376{ "Post office box:","Postfach:" }, 376{ "Post office box:","Postfach:" },
377{ "Locality:","Stadt:" }, 377{ "Locality:","Stadt:" },
378{ "Region:","Region:" }, 378{ "Region:","Region:" },
379{ "Postal code:","PLZ:" }, 379{ "Postal code:","PLZ:" },
380{ "Country:","Staat:" }, 380{ "Country:","Staat:" },
381{ "This is the preferred address","Dies ist die bevorzugte Adresse" }, 381{ "This is the preferred address","Dies ist die bevorzugte Adresse" },
382{ "New...","Neu..." }, 382{ "New...","Neu..." },
383{ "Change Type","Ändere Art" }, 383{ "Change Type","Ändere Art" },
384{ "Edit Address Type","Ändere Address Art" }, 384{ "Edit Address Type","Ändere Address Art" },
385{ "Address Types","Address Art" }, 385{ "Address Types","Address Art" },
386{ "Domestic","Inland" }, 386{ "Domestic","Inland" },
387{ "International","International" }, 387{ "International","International" },
388{ "Parcel","Paket" }, 388{ "Parcel","Paket" },
389{ "Edit Contact Name","Ändere Kontakt Name" }, 389{ "Edit Contact Name","Ändere Kontakt Name" },
390{ "Honorific prefixes:","Namensprefixes:" }, 390{ "Honorific prefixes:","Namensprefixes:" },
391{ "Given name:","Vorname:" }, 391{ "Given name:","Vorname:" },
392{ "Additional names:","Mittelnamen:" }, 392{ "Additional names:","Mittelnamen:" },
393{ "Family names:","Nachname:" }, 393{ "Family names:","Nachname:" },
394{ "Honorific suffixes:","Namenssuffixe:" }, 394{ "Honorific suffixes:","Namenssuffixe:" },
395{ "Parse name automatically","Setze Namen automatisch" }, 395{ "Parse name automatically","Setze Namen automatisch" },
396{ "Edit Phone Numbers","Bearbeite Telefonnummern" }, 396{ "Edit Phone Numbers","Bearbeite Telefonnummern" },
397{ "Number","Nummer" }, 397{ "Number","Nummer" },
398{ "Type","Typ" }, 398{ "Type","Typ" },
399{ "Edit Phone Number","Bearbeite Telefonnummer" }, 399{ "Edit Phone Number","Bearbeite Telefonnummer" },
400{ "Number:","Nummer:" }, 400{ "Number:","Nummer:" },
401{ "This is the preferred phone number","Dies ist die bevorzugte Telefonnummer" }, 401{ "This is the preferred phone number","Dies ist die bevorzugte Telefonnummer" },
402{ "Types","Typen" }, 402{ "Types","Typen" },
403{ "Messenger","Messenger" }, 403{ "Messenger","Messenger" },
404{ "Other","Anderes" }, 404{ "Other","Anderes" },
405{ "Video","Video" }, 405{ "Video","Video" },
406{ "Mailbox","Mailbox" }, 406{ "Mailbox","Mailbox" },
407{ "Modem","Modem" }, 407{ "Modem","Modem" },
408{ "Car","Auto" }, 408{ "Car","Auto" },
409{ "PCS","PCS" }, 409{ "PCS","PCS" },
410{ "Category","Kategorie" }, 410{ "Category","Kategorie" },
411{ "Select Categories","Wähle Kategorien" }, 411{ "Select Categories","Wähle Kategorien" },
412{ " &Deselect All "," &Deselektiere alle " }, 412{ " &Deselect All "," &Deselektiere alle " },
413{ " &Edit Categories "," B&earbeite Kategorien " }, 413{ " &Edit Categories "," B&earbeite Kategorien " },
414{ "&OK","&OK" }, 414{ "&OK","&OK" },
415{ "&Cancel","Abbre&chen" }, 415{ "&Cancel","Abbre&chen" },
416{ "Configure","Konfiguriere" }, 416{ "Configure","Konfiguriere" },
417{ "Default","Voreinstellungen" }, 417{ "Default","Voreinstellungen" },
418{ "Addressbook","Adressbuch" }, 418{ "Addressbook","Adressbuch" },
419{ "Details view font","Schriftart Detailansicht" }, 419{ "Details view font","Schriftart Detailansicht" },
420{ "phone:123","phone:123" }, 420{ "phone:123","phone:123" },
421{ "Search only after <return> key pressed","Suche nur nach <return> Taste" }, 421{ "Search only after <return> key pressed","Suche nur nach <return> Taste" },
422{ "Honor KDE single click","Benutze KDE Einzelklick" }, 422{ "Honor KDE single click","Benutze KDE Einzelklick" },
423{ "Automatic name parsing for new addressees","Automa. Name Parsen für neue Einträge" }, 423{ "Automatic name parsing for new addressees","Automa. Name Parsen für neue Einträge" },
424{ "Display List and Details at once (restart)","Zeige Liste und Details zusammen(neustart)" }, 424{ "Display List and Details at once (restart)","Zeige Liste und Details zusammen(neustart)" },
425{ "Ask for quit when closing Ka/Pi","Vor Beenden von Ka/Pi nachfragen" }, 425{ "Ask for quit when closing Ka/Pi","Vor Beenden von Ka/Pi nachfragen" },
426{ "General","Algemein" }, 426{ "General","Algemein" },
427{ "Extensions (restart)","Extensions (restart)" }, 427{ "Extensions (restart)","Extensions (restart)" },
428{ "Description","Beschreibungen" }, 428{ "Description","Beschreibungen" },
429{ "Extensions","Extensions" }, 429{ "Extensions","Extensions" },
430{ "Prefixes","Prefixe" }, 430{ "Prefixes","Prefixe" },
431{ "Inclusions","Inclusions" }, 431{ "Inclusions","Inclusions" },
432{ "Suffixes","Suffixe" }, 432{ "Suffixes","Suffixe" },
433{ "Default formatted name:","Default format. Name:" }, 433{ "Default formatted name:","Default format. Name:" },
434{ "Empty","Leer" }, 434{ "Empty","Leer" },
435{ "Simple Name","Einfacher Name" }, 435{ "Simple Name","Einfacher Name" },
436{ "Full Name","Voller Name" }, 436{ "Full Name","Voller Name" },
437{ "Reverse Name","Namen umdrehen" }, 437{ "Reverse Name","Namen umdrehen" },
438{ "Contact","Kontakt" }, 438{ "Contact","Kontakt" },
439{ "Global","Allgemein" }, 439{ "Global","Allgemein" },
440{ "Phone","Telefon" }, 440{ "Phone","Telefon" },
441{ "SMS","SMS" }, 441{ "SMS","SMS" },
442{ "Language:(needs restart)","Sprache:(Neustart)" }, 442{ "Language:(needs restart)","Sprache:(Neustart)" },
443{ "English","English" }, 443{ "English","English" },
444{ "German","Deutsch" }, 444{ "German","Deutsch" },
445{ "French","Französisch" }, 445{ "French","Französisch" },
446{ "Italian","Italienisch" }, 446{ "Italian","Italienisch" },
447{ "User defined (usertranslation.txt)","Benutzerdef. (usertranslation.txt)" }, 447{ "User defined (usertranslation.txt)","Benutzerdef. (usertranslation.txt)" },
448{ "Time Format(nr):","Zeit Format(nr):" }, 448{ "Time Format(nr):","Zeit Format(nr):" },
449{ "24:00","24:00" }, 449{ "24:00","24:00" },
450{ "12:00am","12:00am" }, 450{ "12:00am","12:00am" },
451{ "Week starts on Sunday","Woche beginnt Sonntags" }, 451{ "Week starts on Sunday","Woche beginnt Sonntags" },
452{ "Locale","Locale" }, 452{ "Locale","Locale" },
453{ "Date Format:","Datums Format:" }, 453{ "Date Format:","Datums Format:" },
454{ "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" }, 454{ "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" },
455{ "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" }, 455{ "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" },
456{ "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" }, 456{ "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" },
457{ "User defined","Benutzerdefiniert" }, 457{ "User defined","Benutzerdefiniert" },
458{ "User long date:","Format langes Datum:" }, 458{ "User long date:","Format langes Datum:" },
459{ "User short date:","Format kurzes Datum:" }, 459{ "User short date:","Format kurzes Datum:" },
460{ "Daylight start:","Sommerzeit Beginn:" }, 460{ "Daylight start:","Sommerzeit Beginn:" },
461{ "Daylight end:","Sommerzeit Ende:" }, 461{ "Daylight end:","Sommerzeit Ende:" },
462{ "Actual start and end is the\nsunday before this date.","Tatsächlicher Beginn/Ende ist der\nSonntag vor diesem Datum!" }, 462{ "Actual start and end is the\nsunday before this date.","Tatsächlicher Beginn/Ende ist der\nSonntag vor diesem Datum!" },
463{ "Monday 19 April 2004: %A %d %B %Y","Monday 19 April 2004: %A %d %B %Y" }, 463{ "Monday 19 April 2004: %A %d %B %Y","Monday 19 April 2004: %A %d %B %Y" },
464{ "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" }, 464{ "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" },
465{ "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" }, 465{ "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" },
466{ "Date Format","Datums Format" }, 466{ "Date Format","Datums Format" },
467{ "Timezone:","Zeitzone:" }, 467{ "Timezone:","Zeitzone:" },
468{ "The year in the date is ignored.","Das Jahr vom Datum wird ignoriert." }, 468{ "The year in the date is ignored.","Das Jahr vom Datum wird ignoriert." },
469{ "Timezone has daylight saving","Zeitzone hat Sommerzeit" }, 469{ "Timezone has daylight saving","Zeitzone hat Sommerzeit" },
470{ "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" }, 470{ "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" },
471{ "Used Mail Client","Benutzter Mail Client" }, 471{ "Used Mail Client","Benutzter Mail Client" },
472{ "Channel:","Channel:" }, 472{ "Channel:","Channel:" },
473{ "Message:","Message:" }, 473{ "Message:","Message:" },
474{ "Parameters:","Parameter:" }, 474{ "Parameters:","Parameter:" },
475{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" }, 475{ "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" },
476{ "extra Message:","extra Message:" }, 476{ "extra Message:","extra Message:" },
477{ "extra Parameters:","extra Parameter:" }, 477{ "extra Parameters:","extra Parameter:" },
478{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" }, 478{ "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" },
479{ "External Apps.","Externe Appl." }, 479{ "External Apps.","Externe Appl." },
480{ "Used %1 Client","Benutzer %1 Client" }, 480{ "Used %1 Client","Benutzer %1 Client" },
481{ "No email client installed","Keine Email Client installiert" }, 481{ "No email client installed","Keine Email Client installiert" },
482{ "Userdefined email client","Benutzerdef. Email Client" }, 482{ "Userdefined email client","Benutzerdef. Email Client" },
483{ "OM/Pi email client","OM/Pi Email Client" }, 483{ "OM/Pi email client","OM/Pi Email Client" },
484{ "Close KA/Pi?","Schließe KA/Pi?" }, 484{ "Close KA/Pi?","Schließe KA/Pi?" },
485{ "\nChanges will be saved!","\nÄnderungen werden gespeichert!" }, 485{ "\nChanges will be saved!","\nÄnderungen werden gespeichert!" },
486{ "Yes!","Ja!" }, 486{ "Yes!","Ja!" },
487{ "There was an error while attempting to save\n the address book. Please check that some \nother application is not using it. ","#There was an error while attempting to save\n the address book. Please check that some \nother application is not using it. " }, 487{ "There was an error while attempting to save\n the address book. Please check that some \nother application is not using it. ","#There was an error while attempting to save\n the address book. Please check that some \nother application is not using it. " },
488{ "Saving addressbook ... ","Speichere Adressbuch ... " }, 488{ "Saving addressbook ... ","Speichere Adressbuch ... " },
489{ "Addressbook saved!","Adressbuch gespeichert!" }, 489{ "Addressbook saved!","Adressbuch gespeichert!" },
490{ "Default Table View","Default Tabellenansicht" }, 490{ "Default Table View","Default Tabellenansicht" },
491{ "Merge and Remove","Zusammenfügen/entfernen" }, 491{ "Merge and Remove","Zusammenfügen/entfernen" },
492{ "Merge","Zusammenfügen" }, 492{ "Merge","Zusammenfügen" },
493{ "Merge Contacts Editor","Contact-Zusammenfüge-Editor" }, 493{ "Merge Contacts Editor","Contact-Zusammenfüge-Editor" },
494{ "New List...","Neue Liste..." }, 494{ "New List...","Neue Liste..." },
495{ "Rename List...","Ändere Namen..." }, 495{ "Rename List...","Ändere Namen..." },
496{ "Remove List","Lösche Liste" }, 496{ "Remove List","Lösche Liste" },
497{ "Add Contact","Kontakt hinzu" }, 497{ "Add Contact","Kontakt hinzu" },
498{ "Change Email...","Ändere Email..." }, 498{ "Change Email...","Ändere Email..." },
499{ "Remove Contact","Entferne Kontakt" }, 499{ "Remove Contact","Entferne Kontakt" },
500{ "Use Preferred","Nutze Preferred" }, 500{ "Use Preferred","Nutze Preferred" },
501{ "Distribution List Editor","Distribution List Editor" }, 501{ "Distribution List Editor","Distribution List Editor" },
502{ "Choose which contacts to export","Wähle Kontakte zum Exportieren" }, 502{ "Choose which contacts to export","Wähle Kontakte zum Exportieren" },
503{ "Which contacts do you want to export?","Welche Kontakte sollen exportiert werden?" }, 503{ "Which contacts do you want to export?","Welche Kontakte sollen exportiert werden?" },
504{ "Contact Selection","Kontaktauswahl" }, 504{ "Contact Selection","Kontaktauswahl" },
505{ "&All","&Alle" }, 505{ "&All","&Alle" },
506{ "Export the entire address book","Exportiere das komplette Addressbuch" }, 506{ "Export the entire address book","Exportiere das komplette Addressbuch" },
507{ "&Selected","Au&sgewählte" }, 507{ "&Selected","Au&sgewählte" },
508{ "Only export contacts selected in KAddressBook.\nThis option is disabled if no contacts are selected.","###Only export contacts selected in KAddressBook.\nThis option is disabled if no contacts are selected." }, 508{ "Only export contacts selected in KAddressBook.\nThis option is disabled if no contacts are selected.","###Only export contacts selected in KAddressBook.\nThis option is disabled if no contacts are selected." },
509{ "By matching &filter","Zutreffender &Filter" }, 509{ "By matching &filter","Zutreffender &Filter" },
510{ "Only export contacts matching the selected filter.\nThis option is disabled if you haven't defined any filters","###Only export contacts matching the selected filter.\nThis option is disabled if you haven't defined any filters" }, 510{ "Only export contacts matching the selected filter.\nThis option is disabled if you haven't defined any filters","###Only export contacts matching the selected filter.\nThis option is disabled if you haven't defined any filters" },
511{ "By Cate&gories","Kategorien" }, 511{ "By Cate&gories","Kategorien" },
512{ "Only export contacts who are members of a category that is checked on the list to the left.\nThis option is disabled if you have no categories.","###Only export contacts who are members of a category that is checked on the list to the left.\nThis option is disabled if you have no categories." }, 512{ "Only export contacts who are members of a category that is checked on the list to the left.\nThis option is disabled if you have no categories.","###Only export contacts who are members of a category that is checked on the list to the left.\nThis option is disabled if you have no categories." },
513{ "Select a filter to decide which contacts to export.","Wähle Filter zum Export aus." }, 513{ "Select a filter to decide which contacts to export.","Wähle Filter zum Export aus." },
514{ "Check the categories whose members you want to export.","Wähle die Kategorien zum Export aus." }, 514{ "Check the categories whose members you want to export.","Wähle die Kategorien zum Export aus." },
515{ "Sorting","Sortieren" }, 515{ "Sorting","Sortieren" },
516{ "Criterion:","Merkmal:" }, 516{ "Criterion:","Merkmal:" },
517{ "Order:","Reihenfolge:" }, 517{ "Order:","Reihenfolge:" },
518{ "Ascending","Aufsteigend" }, 518{ "Ascending","Aufsteigend" },
519{ "Descending","Absteigend" }, 519{ "Descending","Absteigend" },
520{ "Save file","Datei speichern" }, 520{ "Save file","Datei speichern" },
521{ "Error","Fehler" }, 521{ "Error","Fehler" },
522{ "Unable to export contacts.","Exportieren der Kontakte geht nicht." }, 522{ "Unable to export contacts.","Exportieren der Kontakte geht nicht." },
523{ "\nNo unsaved changes detected!\nNothing will be saved!","\nKeine ungespeicherten\nÄnderungen erkannt!\nNichts wird gespeichert!" }, 523{ "\nNo unsaved changes detected!\nNothing will be saved!","\nKeine ungespeicherten\nÄnderungen erkannt!\nNichts wird gespeichert!" },
524{ "Manage new categories...","Verwalte neue Kategorien..." }, 524{ "Manage new categories...","Verwalte neue Kategorien..." },
525{ "&File","Datei" }, 525{ "&File","Datei" },
526{ "&Edit","Bearbeite" }, 526{ "&Edit","Bearbeite" },
527{ "&View","Ansichten" }, 527{ "&View","Ansichten" },
528{ "&Settings","Konfiguration" }, 528{ "&Settings","Konfiguration" },
529{ "&Change selected","Ändere Selekt." }, 529{ "&Change selected","Ändere Selekt." },
530{ "&Help","Hilfe" }, 530{ "&Help","Hilfe" },
531{ "Remove sync info","Entferne Sync Info" }, 531{ "Remove sync info","Entferne Sync Info" },
532{ "For all profiles","Für alle Profile" }, 532{ "For all profiles","Für alle Profile" },
533{ "&Change","Ändere" }, 533{ "&Change","Ändere" },
534{ "Import xml (Qtopia)...","Importiere xml (Qtopia)..." }, 534{ "Import xml (Qtopia)...","Importiere xml (Qtopia)..." },
535{ "Export xml (Qtopia)...","Exportiere xml (Qtopia)..." }, 535{ "Export xml (Qtopia)...","Exportiere xml (Qtopia)..." },
536{ "Export to phone","Exportiere aufs Handy..." }, 536{ "Export to phone","Exportiere aufs Handy..." },
537{ "Which contacts do you want to select?","Welche Kontakte möchten Sie wählen?" }, 537{ "Which contacts do you want to select?","Welche Kontakte möchten Sie wählen?" },
538{ "&Modify","Ändere" }, 538{ "&Modify","Ändere" },
539{ "Choose which contacts to select","Bitte Kontakte auswählen!" }, 539{ "Choose which contacts to select","Bitte Kontakte auswählen!" },
540{ "After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n ","Nach dem Importieren/Laden/Syncen\nkann es neue Kategorien in den \nKontakten geben, die nicht\nin der Kategorieliste enthalten sind.\nBitte wählen Sie, was passieren soll:\n " }, 540{ "After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n ","Nach dem Importieren/Laden/Syncen\nkann es neue Kategorien in den \nKontakten geben, die nicht\nin der Kategorieliste enthalten sind.\nBitte wählen Sie, was passieren soll:\n " },
541{ "Manage new Categories","Verwalte neue Kategorien" }, 541{ "Manage new Categories","Verwalte neue Kategorien" },
542{ "Add to category list","Füge zur Kategorieliste hinzu" }, 542{ "Add to category list","Füge zur Kategorieliste hinzu" },
543{ "Remove from addressees","Entferne von den Kontakten" }, 543{ "Remove from addressees","Entferne von den Kontakten" },
544{ "New categories not in list:","Kategorien, die nicht in der Liste sind:" }, 544{ "New categories not in list:","Kategorien, die nicht in der Liste sind:" },
545{ "A&dd","Hinzufügen" }, 545{ "A&dd","Hinzufügen" },
546{ "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." },
547{ "NOTE: This will remove all old\ncontact data on phone!","ACHTUNG: Das löscht alle alten\nKontakt Daten auf dem Handy!" },
548{ "Export to mobile phone!","Exportiere auf das Handy!" },
549{ "Export to phone options","Export ans Handy Optionen" },
550{ "Writing to phone...","Sende Daten ans Handy..." },
551{ " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" },
552{ "Retry","Nochmal versuchen" },
553{ "KDE/Pim phone access","KDE/Pim Handy Zugriff" },
554{ "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" },
555{ "Error exporting to phone!","Fehler beim Export auf das Handy!" },
546{ "","" }, 556{ "","" },
547{ "","" }, 557{ "","" },
548{ "","" }, 558{ "","" },
549{ "","" }, 559{ "","" },
550{ "","" }, 560{ "","" },
551{ "","" }, 561{ "","" },
552{ "","" }, \ No newline at end of file 562{ "","" }, \ No newline at end of file
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index ad43970..23b091c 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -1,373 +1,373 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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 <qheader.h> 24#include <qheader.h>
25#include <qiconset.h> 25#include <qiconset.h>
26#include <qimage.h> 26#include <qimage.h>
27#include <qdragobject.h> 27#include <qdragobject.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qbrush.h> 30#include <qbrush.h>
31#include <qevent.h> 31#include <qevent.h>
32 32
33#include <klocale.h> 33#include <klocale.h>
34#include <kglobalsettings.h> 34#include <kglobalsettings.h>
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <kconfig.h> 37#include <kconfig.h>
38#include <kapplication.h> 38#include <kapplication.h>
39#include <kurl.h> 39#include <kurl.h>
40 40
41#include "kaddressbooktableview.h" 41#include "kaddressbooktableview.h"
42 42
43#include "contactlistview.h" 43#include "contactlistview.h"
44 44
45///////////////////////////////// 45/////////////////////////////////
46// DynamicTip Methods 46// DynamicTip Methods
47 47
48DynamicTip::DynamicTip( ContactListView *parent) 48DynamicTip::DynamicTip( ContactListView *parent)
49 : QToolTip( parent ) 49 : QToolTip( parent )
50{ 50{
51} 51}
52 52
53void DynamicTip::maybeTip( const QPoint &pos ) 53void DynamicTip::maybeTip( const QPoint &pos )
54{ 54{
55 static bool ishidden = true; 55 static bool ishidden = true;
56 if (!parentWidget()->inherits( "ContactListView" )) 56 if (!parentWidget()->inherits( "ContactListView" ))
57 return; 57 return;
58 58
59 ContactListView *plv = (ContactListView*)parentWidget(); 59 ContactListView *plv = (ContactListView*)parentWidget();
60 if (!plv->tooltips()) 60 if (!plv->tooltips())
61 return; 61 return;
62 62
63 QPoint posVp = plv->viewport()->pos(); 63 QPoint posVp = plv->viewport()->pos();
64 64
65 QListViewItem *lvi = plv->itemAt( pos - posVp ); 65 QListViewItem *lvi = plv->itemAt( pos - posVp );
66 if (!lvi) 66 if (!lvi)
67 return; 67 return;
68 68
69#ifndef KAB_EMBEDDED 69#ifndef KAB_EMBEDDED
70 ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); 70 ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi);
71#else //KAB_EMBEDDED 71#else //KAB_EMBEDDED
72 ContactListViewItem *plvi = (ContactListViewItem*)(lvi); 72 ContactListViewItem *plvi = (ContactListViewItem*)(lvi);
73#endif //KAB_EMBEDDED 73#endif //KAB_EMBEDDED
74 74
75 if (!plvi) 75 if (!plvi)
76 return; 76 return;
77 77
78 if (ishidden) { 78 if (ishidden) {
79 QString s; 79 QString s;
80 QRect r = plv->itemRect( lvi ); 80 QRect r = plv->itemRect( lvi );
81 r.moveBy( posVp.x(), posVp.y() ); 81 r.moveBy( posVp.x(), posVp.y() );
82 82
83 //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width() 83 //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width()
84 // << "," << r.height() << endl; 84 // << "," << r.height() << endl;
85 85
86 KABC::Addressee a = plvi->addressee(); 86 KABC::Addressee a = plvi->addressee();
87 if (a.isEmpty()) 87 if (a.isEmpty())
88 return; 88 return;
89 89
90 s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel()) 90 s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel())
91 .arg(a.formattedName()); 91 .arg(a.formattedName());
92 92
93 s += '\n'; 93 s += '\n';
94 s += i18n("label: value", "%1: %2").arg(a.organizationLabel()) 94 s += i18n("label: value", "%1: %2").arg(a.organizationLabel())
95 .arg(a.organization()); 95 .arg(a.organization());
96 96
97 QString notes = a.note().stripWhiteSpace(); 97 QString notes = a.note().stripWhiteSpace();
98 if ( !notes.isEmpty() ) { 98 if ( !notes.isEmpty() ) {
99 notes += '\n'; 99 notes += '\n';
100 s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); 100 s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel());
101 QFontMetrics fm( font() ); 101 QFontMetrics fm( font() );
102 102
103 // Begin word wrap code based on QMultiLineEdit code 103 // Begin word wrap code based on QMultiLineEdit code
104 int i = 0; 104 int i = 0;
105 bool doBreak = false; 105 bool doBreak = false;
106 int linew = 0; 106 int linew = 0;
107 int lastSpace = -1; 107 int lastSpace = -1;
108 int a = 0; 108 int a = 0;
109 int lastw = 0; 109 int lastw = 0;
110 110
111 while ( i < int(notes.length()) ) { 111 while ( i < int(notes.length()) ) {
112 doBreak = FALSE; 112 doBreak = FALSE;
113 if ( notes[i] != '\n' ) 113 if ( notes[i] != '\n' )
114 linew += fm.width( notes[i] ); 114 linew += fm.width( notes[i] );
115 115
116 if ( lastSpace >= a && notes[i] != '\n' ) 116 if ( lastSpace >= a && notes[i] != '\n' )
117 if (linew >= parentWidget()->width()) { 117 if (linew >= parentWidget()->width()) {
118 doBreak = TRUE; 118 doBreak = TRUE;
119 if ( lastSpace > a ) { 119 if ( lastSpace > a ) {
120 i = lastSpace; 120 i = lastSpace;
121 linew = lastw; 121 linew = lastw;
122 } 122 }
123 else 123 else
124 i = QMAX( a, i-1 ); 124 i = QMAX( a, i-1 );
125 } 125 }
126 126
127 if ( notes[i] == '\n' || doBreak ) { 127 if ( notes[i] == '\n' || doBreak ) {
128 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; 128 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n";
129 129
130 a = i + 1; 130 a = i + 1;
131 lastSpace = a; 131 lastSpace = a;
132 linew = 0; 132 linew = 0;
133 } 133 }
134 134
135 if ( notes[i].isSpace() ) { 135 if ( notes[i].isSpace() ) {
136 lastSpace = i; 136 lastSpace = i;
137 lastw = linew; 137 lastw = linew;
138 } 138 }
139 139
140 if ( lastSpace <= a ) { 140 if ( lastSpace <= a ) {
141 lastw = linew; 141 lastw = linew;
142 } 142 }
143 143
144 ++i; 144 ++i;
145 } 145 }
146 } 146 }
147 147
148 tip( r, s ); 148 tip( r, s );
149 } 149 }
150 else 150 else
151 hide(); 151 hide();
152 ishidden = !ishidden; 152 ishidden = !ishidden;
153 153
154} 154}
155 155
156/////////////////////////// 156///////////////////////////
157// ContactListViewItem Methods 157// ContactListViewItem Methods
158 158
159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, 159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
160 ContactListView *parent, 160 ContactListView *parent,
161 KABC::AddressBook *doc, 161 KABC::AddressBook *doc,
162 const KABC::Field::List &fields ) 162 const KABC::Field::List &fields )
163 : KListViewItem(parent), mAddressee(a), mFields( fields ), 163 : KListViewItem(parent), mAddressee(a), mFields( fields ),
164 parentListView( parent ), mDocument(doc) 164 parentListView( parent ), mDocument(doc)
165{ 165{
166 refresh(); 166 refresh();
167} 167}
168 168
169QString ContactListViewItem::key(int column, bool ascending) const 169QString ContactListViewItem::key(int column, bool ascending) const
170{ 170{
171#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
172 int lan = KGlobal::locale()->language(); 172 int lan = KGlobal::locale()->language();
173 //qDebug("language %d ", lan); 173 //qDebug("language %d ", lan);
174 if ( lan == 1 ) { //GERMAN 174 if ( lan == 1 ) { //GERMAN
175 QString ret = QListViewItem::key(column, ascending).lower().utf8(); 175 QString ret = QListViewItem::key(column, ascending).lower().utf8();
176 int start = -1; 176 int start = -1;
177 while ( (start = ret.find( 'ä', start+1)) > 0 ) { 177 while ( (start = ret.find( 'ä', start+1)) > 0 ) {
178 ret.at(start-1) = 'a'; 178 ret.at(start-1) = 'a';
179 } 179 }
180 start = -1; 180 start = -1;
181 while ( (start = ret.find( 'ö', start+1)) > 0 ) { 181 while ( (start = ret.find( 'ö', start+1)) > 0 ) {
182 ret.at(start-1) = 'o'; 182 ret.at(start-1) = 'o';
183 } 183 }
184 start = -1; 184 start = -1;
185 while ( (start = ret.find( 'ü', start+1)) > 0 ) { 185 while ( (start = ret.find( 'ü', start+1)) > 0 ) {
186 ret.at(start-1) = 'o'; 186 ret.at(start-1) = 'o';
187 } 187 }
188 start = -1; 188 start = -1;
189 while ( (start = ret.find( 'ß', start+1)) > 0 ) { 189 while ( (start = ret.find( 'ß', start+1)) > 0 ) {
190 ret.at(start-1) = 's'; 190 ret.at(start-1) = 's';
191 } 191 }
192 qDebug("conv string %s ", ret.latin1()); 192 //qDebug("conv string %s ", ret.latin1());
193 193
194 return ret; 194 return ret;
195 195
196 } 196 }
197 else 197 else
198#endif 198#endif
199 return QListViewItem::key(column, ascending).lower(); 199 return QListViewItem::key(column, ascending).lower();
200} 200}
201 201
202void ContactListViewItem::paintCell(QPainter * p, 202void ContactListViewItem::paintCell(QPainter * p,
203 const QColorGroup & cg, 203 const QColorGroup & cg,
204 int column, 204 int column,
205 int width, 205 int width,
206 int align) 206 int align)
207{ 207{
208 KListViewItem::paintCell(p, cg, column, width, align); 208 KListViewItem::paintCell(p, cg, column, width, align);
209 209
210 if ( !p ) 210 if ( !p )
211 return; 211 return;
212 212
213 if (parentListView->singleLine()) { 213 if (parentListView->singleLine()) {
214 p->setPen( parentListView->alternateColor() ); 214 p->setPen( parentListView->alternateColor() );
215 p->drawLine( 0, height() - 1, width, height() - 1 ); 215 p->drawLine( 0, height() - 1, width, height() - 1 );
216 } 216 }
217} 217}
218 218
219 219
220ContactListView *ContactListViewItem::parent() 220ContactListView *ContactListViewItem::parent()
221{ 221{
222 return parentListView; 222 return parentListView;
223} 223}
224 224
225 225
226void ContactListViewItem::refresh() 226void ContactListViewItem::refresh()
227{ 227{
228 // Update our addressee, since it may have changed else were 228 // Update our addressee, since it may have changed else were
229 mAddressee = mDocument->findByUid(mAddressee.uid()); 229 mAddressee = mDocument->findByUid(mAddressee.uid());
230 if (mAddressee.isEmpty()) 230 if (mAddressee.isEmpty())
231 return; 231 return;
232 232
233 int i = 0; 233 int i = 0;
234 KABC::Field::List::ConstIterator it; 234 KABC::Field::List::ConstIterator it;
235 for( it = mFields.begin(); it != mFields.end(); ++it ) { 235 for( it = mFields.begin(); it != mFields.end(); ++it ) {
236 setText( i++, (*it)->value( mAddressee ) ); 236 setText( i++, (*it)->value( mAddressee ) );
237 } 237 }
238} 238}
239 239
240/////////////////////////////// 240///////////////////////////////
241// ContactListView 241// ContactListView
242 242
243ContactListView::ContactListView(KAddressBookTableView *view, 243ContactListView::ContactListView(KAddressBookTableView *view,
244 KABC::AddressBook* /* doc */, 244 KABC::AddressBook* /* doc */,
245 QWidget *parent, 245 QWidget *parent,
246 const char *name ) 246 const char *name )
247 : KListView( parent, name ), 247 : KListView( parent, name ),
248 pabWidget( view ), 248 pabWidget( view ),
249 oldColumn( 0 ) 249 oldColumn( 0 )
250{ 250{
251 mABackground = true; 251 mABackground = true;
252 mSingleLine = false; 252 mSingleLine = false;
253 mToolTips = true; 253 mToolTips = true;
254#ifndef KAB_EMBEDDED 254#ifndef KAB_EMBEDDED
255 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 255 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
256#else //KAB_EMBEDDED 256#else //KAB_EMBEDDED
257 mAlternateColor = QColor(240, 240, 240); 257 mAlternateColor = QColor(240, 240, 240);
258#endif //KAB_EMBEDDED 258#endif //KAB_EMBEDDED
259 259
260 setAlternateBackgroundEnabled(mABackground); 260 setAlternateBackgroundEnabled(mABackground);
261 setAcceptDrops( true ); 261 setAcceptDrops( true );
262 viewport()->setAcceptDrops( true ); 262 viewport()->setAcceptDrops( true );
263 setAllColumnsShowFocus( true ); 263 setAllColumnsShowFocus( true );
264 setShowSortIndicator(true); 264 setShowSortIndicator(true);
265 265
266 setSelectionModeExt( KListView::Extended ); 266 setSelectionModeExt( KListView::Extended );
267 setDropVisualizer(false); 267 setDropVisualizer(false);
268 // setFrameStyle(QFrame::NoFrame); 268 // setFrameStyle(QFrame::NoFrame);
269 //setLineWidth ( 0 ); 269 //setLineWidth ( 0 );
270 //setMidLineWidth ( 0 ); 270 //setMidLineWidth ( 0 );
271 //setMargin ( 0 ); 271 //setMargin ( 0 );
272#ifndef KAB_EMBEDDED 272#ifndef KAB_EMBEDDED
273 connect(this, SIGNAL(dropped(QDropEvent*)), 273 connect(this, SIGNAL(dropped(QDropEvent*)),
274 this, SLOT(itemDropped(QDropEvent*))); 274 this, SLOT(itemDropped(QDropEvent*)));
275#endif //KAB_EMBEDDED 275#endif //KAB_EMBEDDED
276 276
277 277
278 new DynamicTip( this ); 278 new DynamicTip( this );
279} 279}
280 280
281void ContactListView::setAlternateColor(const QColor &m_AlternateColor) 281void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
282{ 282{
283 mAlternateColor = m_AlternateColor; 283 mAlternateColor = m_AlternateColor;
284} 284}
285 285
286void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) 286void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
287{ 287{
288 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); 288 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
289 289
290 // Get the brush, which will have the background pixmap if there is one. 290 // Get the brush, which will have the background pixmap if there is one.
291 if (b.pixmap()) 291 if (b.pixmap())
292 { 292 {
293 p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), 293 p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(),
294 *(b.pixmap()), 294 *(b.pixmap()),
295 rect.left() + contentsX(), 295 rect.left() + contentsX(),
296 rect.top() + contentsY() ); 296 rect.top() + contentsY() );
297 } 297 }
298 298
299 else 299 else
300 { 300 {
301 // Do a normal paint 301 // Do a normal paint
302 KListView::paintEmptyArea(p, rect); 302 KListView::paintEmptyArea(p, rect);
303 } 303 }
304} 304}
305 305
306void ContactListView::contentsMousePressEvent(QMouseEvent* e) 306void ContactListView::contentsMousePressEvent(QMouseEvent* e)
307{ 307{
308 presspos = e->pos(); 308 presspos = e->pos();
309 KListView::contentsMousePressEvent(e); 309 KListView::contentsMousePressEvent(e);
310} 310}
311 311
312 312
313// To initiate a drag operation 313// To initiate a drag operation
314void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) 314void ContactListView::contentsMouseMoveEvent( QMouseEvent *e )
315{ 315{
316 if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { 316 if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) {
317 emit startAddresseeDrag(); 317 emit startAddresseeDrag();
318 } 318 }
319 else 319 else
320 KListView::contentsMouseMoveEvent( e ); 320 KListView::contentsMouseMoveEvent( e );
321} 321}
322 322
323bool ContactListView::acceptDrag(QDropEvent *e) const 323bool ContactListView::acceptDrag(QDropEvent *e) const
324{ 324{
325#ifndef KAB_EMBEDDED 325#ifndef KAB_EMBEDDED
326 return QTextDrag::canDecode(e); 326 return QTextDrag::canDecode(e);
327#else //KAB_EMBEDDED 327#else //KAB_EMBEDDED
328qDebug("ContactListView::acceptDrag has to be fixed"); 328qDebug("ContactListView::acceptDrag has to be fixed");
329 return false; 329 return false;
330#endif //KAB_EMBEDDED 330#endif //KAB_EMBEDDED
331} 331}
332 332
333void ContactListView::itemDropped(QDropEvent *e) 333void ContactListView::itemDropped(QDropEvent *e)
334{ 334{
335 contentsDropEvent(e); 335 contentsDropEvent(e);
336} 336}
337 337
338void ContactListView::contentsDropEvent( QDropEvent *e ) 338void ContactListView::contentsDropEvent( QDropEvent *e )
339{ 339{
340 emit addresseeDropped(e); 340 emit addresseeDropped(e);
341} 341}
342 342
343void ContactListView::setAlternateBackgroundEnabled(bool enabled) 343void ContactListView::setAlternateBackgroundEnabled(bool enabled)
344{ 344{
345 mABackground = enabled; 345 mABackground = enabled;
346 346
347 if (mABackground) 347 if (mABackground)
348 { 348 {
349 setAlternateBackground(mAlternateColor); 349 setAlternateBackground(mAlternateColor);
350 } 350 }
351 else 351 else
352 { 352 {
353 setAlternateBackground(QColor()); 353 setAlternateBackground(QColor());
354 } 354 }
355} 355}
356 356
357void ContactListView::setBackgroundPixmap(const QString &filename) 357void ContactListView::setBackgroundPixmap(const QString &filename)
358{ 358{
359 if (filename.isEmpty()) 359 if (filename.isEmpty())
360 { 360 {
361 unsetPalette(); 361 unsetPalette();
362 } 362 }
363 else 363 else
364 { 364 {
365 qDebug("ContactListView::setBackgroundPixmap has to be verified"); 365 qDebug("ContactListView::setBackgroundPixmap has to be verified");
366//US setPaletteBackgroundPixmap(QPixmap(filename)); 366//US setPaletteBackgroundPixmap(QPixmap(filename));
367 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename)); 367 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename));
368 } 368 }
369 369
370} 370}
371#ifndef KAB_EMBEDDED 371#ifndef KAB_EMBEDDED
372#include "contactlistview.moc" 372#include "contactlistview.moc"
373#endif //KAB_EMBEDDED 373#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index ab95d5f..6282453 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -1,288 +1,294 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 Tobias Koenig <tokoe@kde.org> 4 Tobias Koenig <tokoe@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 24
25/* 25/*
26Enhanced Version of the file for platform independent KDE tools. 26Enhanced Version of the file for platform independent KDE tools.
27Copyright (c) 2004 Ulf Schenk 27Copyright (c) 2004 Ulf Schenk
28 28
29$Id$ 29$Id$
30*/ 30*/
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <kcombobox.h> 34#include <kcombobox.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37 37
38#include <qapplication.h>
38#include <qbuttongroup.h> 39#include <qbuttongroup.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qheader.h> 41#include <qheader.h>
41#include <qlabel.h> 42#include <qlabel.h>
42#include <qlayout.h> 43#include <qlayout.h>
43#include <qlistview.h> 44#include <qlistview.h>
44#include <qpushbutton.h> 45#include <qpushbutton.h>
45#include <qradiobutton.h> 46#include <qradiobutton.h>
46#include <qstringlist.h> 47#include <qstringlist.h>
47#include <qwhatsthis.h> 48#include <qwhatsthis.h>
48 49
49#include "kabcore.h" 50#include "kabcore.h"
50#include "kabprefs.h" 51#include "kabprefs.h"
51 52
52#include "xxportselectdialog.h" 53#include "xxportselectdialog.h"
53 54
54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, 55XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
55 QWidget* parent, const char* name ) 56 QWidget* parent, const char* name )
56 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, 57 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel,
57 Ok, parent, name, true, true ), mCore( core ), 58 Ok, parent, name, true, true ), mCore( core ),
58 mUseSorting( sort ) 59 mUseSorting( sort )
59{ 60{
60 initGUI(); 61 initGUI();
61 62
62 connect( mFiltersCombo, SIGNAL( activated( int ) ), 63 connect( mFiltersCombo, SIGNAL( activated( int ) ),
63 SLOT( filterChanged( int ) ) ); 64 SLOT( filterChanged( int ) ) );
64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), 65 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
65 SLOT( categoryClicked( QListViewItem* ) ) ); 66 SLOT( categoryClicked( QListViewItem* ) ) );
66 67
67 // setup filters 68 // setup filters
68#ifndef KAB_EMBEDDED 69#ifndef KAB_EMBEDDED
69 mFilters = Filter::restore( kapp->config(), "Filter" ); 70 mFilters = Filter::restore( kapp->config(), "Filter" );
70 Filter::List::iterator filterIt; 71 Filter::List::iterator filterIt;
71#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
72 mFilters = Filter::restore( KGlobal::config(), "Filter" ); 73 mFilters = Filter::restore( KGlobal::config(), "Filter" );
73 Filter::List::Iterator filterIt; 74 Filter::List::Iterator filterIt;
74#endif //KAB_EMBEDDED 75#endif //KAB_EMBEDDED
75 QStringList filters; 76 QStringList filters;
76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 77 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
77 filters.append( (*filterIt).name() ); 78 filters.append( (*filterIt).name() );
78 79
79 mFiltersCombo->insertStringList( filters ); 80 mFiltersCombo->insertStringList( filters );
80 mUseFilters->setEnabled( filters.count() > 0 ); 81 mUseFilters->setEnabled( filters.count() > 0 );
81 82
82 // setup categories 83 // setup categories
83 QStringList categories = KABPrefs::instance()->mCustomCategories; 84 QStringList categories = KABPrefs::instance()->mCustomCategories;
84 QStringList::Iterator it; 85 QStringList::Iterator it;
85 for ( it = categories.begin(); it != categories.end(); ++it ) 86 for ( it = categories.begin(); it != categories.end(); ++it )
86 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); 87 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox );
87 mUseCategories->setEnabled( categories.count() > 0 ); 88 mUseCategories->setEnabled( categories.count() > 0 );
88 89
89 int count = mCore->selectedUIDs().count(); 90 int count = mCore->selectedUIDs().count();
90 mUseSelection->setEnabled( count != 0 ); 91 mUseSelection->setEnabled( count != 0 );
91 mUseSelection->setChecked( count > 1 ); 92 mUseSelection->setChecked( count > 1 );
92 93
93 mSortTypeCombo->insertItem( i18n( "Ascending" ) ); 94 mSortTypeCombo->insertItem( i18n( "Ascending" ) );
94 mSortTypeCombo->insertItem( i18n( "Descending" ) ); 95 mSortTypeCombo->insertItem( i18n( "Descending" ) );
95 96
96 mFields = mCore->addressBook()->fields( KABC::Field::All ); 97 mFields = mCore->addressBook()->fields( KABC::Field::All );
97 KABC::Field::List::Iterator fieldIt; 98 KABC::Field::List::Iterator fieldIt;
98 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) 99 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt )
99 mFieldCombo->insertItem( (*fieldIt)->label() ); 100 mFieldCombo->insertItem( (*fieldIt)->label() );
100} 101}
101 102
102QStringList XXPortSelectDialog::uids() 103QStringList XXPortSelectDialog::uids()
103{ 104{
104 QStringList uidlist; 105 QStringList uidlist;
105 KABC::AddresseeList list = contacts(); 106 KABC::AddresseeList list = contacts();
106 KABC::Addressee::List::Iterator it; 107 KABC::Addressee::List::Iterator it;
107 for ( it = list.begin(); it != list.end(); ++it ) 108 for ( it = list.begin(); it != list.end(); ++it )
108 uidlist.append((*it).uid()); 109 uidlist.append((*it).uid());
109 return uidlist; 110 return uidlist;
110} 111}
111KABC::AddresseeList XXPortSelectDialog::contacts() 112KABC::AddresseeList XXPortSelectDialog::contacts()
112{ 113{
113 QStringList selection = mCore->selectedUIDs(); 114 QStringList selection = mCore->selectedUIDs();
114 115
115 KABC::AddresseeList list; 116 KABC::AddresseeList list;
116 if ( mUseSelection->isChecked() ) { 117 if ( mUseSelection->isChecked() ) {
117 QStringList::Iterator it; 118 QStringList::Iterator it;
118 for ( it = selection.begin(); it != selection.end(); ++it ) { 119 for ( it = selection.begin(); it != selection.end(); ++it ) {
119 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 120 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
120 if ( !addr.isEmpty() ) 121 if ( !addr.isEmpty() )
121 list.append( addr ); 122 list.append( addr );
122 } 123 }
123 } else if ( mUseFilters->isChecked() ) { 124 } else if ( mUseFilters->isChecked() ) {
124 // find contacts that can pass selected filter 125 // find contacts that can pass selected filter
125 Filter::List::Iterator filterIt; 126 Filter::List::Iterator filterIt;
126 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 127 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
127 if ( (*filterIt).name() == mFiltersCombo->currentText() ) 128 if ( (*filterIt).name() == mFiltersCombo->currentText() )
128 break; 129 break;
129 130
130 KABC::AddressBook::Iterator it; 131 KABC::AddressBook::Iterator it;
131 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 132 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
132 if ( (*filterIt).filterAddressee( *it ) ) 133 if ( (*filterIt).filterAddressee( *it ) )
133 list.append( *it ); 134 list.append( *it );
134 } 135 }
135 } else if ( mUseCategories->isChecked() ) { 136 } else if ( mUseCategories->isChecked() ) {
136 QStringList categorieList = categories(); 137 QStringList categorieList = categories();
137 KABC::AddressBook::Iterator it; 138 KABC::AddressBook::Iterator it;
138 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 139 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
139 QStringList tmp( (*it).categories() ); 140 QStringList tmp( (*it).categories() );
140 QStringList::Iterator tmpIt; 141 QStringList::Iterator tmpIt;
141 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) 142 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
142 if ( categorieList.contains( *tmpIt ) ) { 143 if ( categorieList.contains( *tmpIt ) ) {
143 list.append( *it ); 144 list.append( *it );
144 break; 145 break;
145 } 146 }
146 } 147 }
147 } else { 148 } else {
148 // create a string list of all entries: 149 // create a string list of all entries:
149 KABC::AddressBook::Iterator it; 150 KABC::AddressBook::Iterator it;
150 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) 151 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
151 list.append( *it ); 152 list.append( *it );
152 } 153 }
153 154
154 if ( mUseSorting ) { 155 if ( mUseSorting ) {
155 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); 156 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 );
156 uint pos = mFieldCombo->currentItem(); 157 uint pos = mFieldCombo->currentItem();
157 if ( pos < mFields.count() ) 158 if ( pos < mFields.count() )
158 list.sortByField( mFields[ pos ] ); 159 list.sortByField( mFields[ pos ] );
159 } 160 }
160 161
161 return list; 162 return list;
162} 163}
163 164
164QStringList XXPortSelectDialog::categories() const 165QStringList XXPortSelectDialog::categories() const
165{ 166{
166 QStringList list; 167 QStringList list;
167 168
168 QListViewItemIterator it( mCategoriesView ); 169 QListViewItemIterator it( mCategoriesView );
169 for ( ; it.current(); ++it ) { 170 for ( ; it.current(); ++it ) {
170 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); 171 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current());
171 if ( qcli->isOn() ) 172 if ( qcli->isOn() )
172 list.append( it.current()->text( 0 ) ); 173 list.append( it.current()->text( 0 ) );
173 } 174 }
174 175
175 return list; 176 return list;
176} 177}
177 178
178void XXPortSelectDialog::filterChanged( int ) 179void XXPortSelectDialog::filterChanged( int )
179{ 180{
180 mUseFilters->setChecked( true ); 181 mUseFilters->setChecked( true );
181} 182}
182 183
183void XXPortSelectDialog::categoryClicked( QListViewItem *i ) 184void XXPortSelectDialog::categoryClicked( QListViewItem *i )
184{ 185{
185 QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); 186 QCheckListItem *qcli = static_cast<QCheckListItem*>( i );
186 if ( qcli->isOn() ) 187 if ( qcli->isOn() )
187 mUseCategories->setChecked( true ); 188 mUseCategories->setChecked( true );
188} 189}
189 190
190void XXPortSelectDialog::slotHelp() 191void XXPortSelectDialog::slotHelp()
191{ 192{
192#ifndef KAB_EMBEDDED 193#ifndef KAB_EMBEDDED
193 kapp->invokeHelp( "import-and-export" ); 194 kapp->invokeHelp( "import-and-export" );
194#else //KAB_EMBEDDED 195#else //KAB_EMBEDDED
195 qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); 196 qDebug("XXPortSelectDialog::slotHelp is not implemented yet");
196#endif //KAB_EMBEDDED 197#endif //KAB_EMBEDDED
197 198
198} 199}
199 200
200void XXPortSelectDialog::initGUI() 201void XXPortSelectDialog::initGUI()
201{ 202{
202 QFrame *page = plainPage(); 203 QFrame *page = plainPage();
203 204
204 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), 205 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(),
205 KDialog::spacingHint() ); 206 KDialog::spacingHint() );
206 207
207 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); 208 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page );
208 topLayout->addWidget( label ); 209 topLayout->addWidget( label );
209 210
210 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); 211 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
211 mButtonGroup->setColumnLayout( 0, Qt::Vertical ); 212 mButtonGroup->setColumnLayout( 0, Qt::Vertical );
212 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); 213 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
213 mButtonGroup->layout()->setMargin( KDialog::marginHint() ); 214 mButtonGroup->layout()->setMargin( KDialog::marginHint() );
214 215
215 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); 216 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
216 groupLayout->setAlignment( Qt::AlignTop ); 217 groupLayout->setAlignment( Qt::AlignTop );
217 218
218 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); 219 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
219 mUseWholeBook->setChecked( true ); 220 mUseWholeBook->setChecked( true );
220 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); 221 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
221 groupLayout->addWidget( mUseWholeBook, 0, 0 ); 222 groupLayout->addWidget( mUseWholeBook, 0, 0 );
222 223
223 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); 224 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
224 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" 225 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
225 "This option is disabled if no contacts are selected." ) ); 226 "This option is disabled if no contacts are selected." ) );
226 groupLayout->addWidget( mUseSelection, 1, 0 ); 227 groupLayout->addWidget( mUseSelection, 1, 0 );
227 228
228 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); 229 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
229 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" 230 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
230 "This option is disabled if you haven't defined any filters" ) ); 231 "This option is disabled if you haven't defined any filters" ) );
231 groupLayout->addWidget( mUseFilters, 2, 0 ); 232 groupLayout->addWidget( mUseFilters, 2, 0 );
232 233
233 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); 234 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
234 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" 235 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
235 "This option is disabled if you have no categories." ) ); 236 "This option is disabled if you have no categories." ) );
236 groupLayout->addWidget( mUseCategories, 3, 0 ); 237 groupLayout->addWidget( mUseCategories, 3, 0 );
237 238
238 mFiltersCombo = new QComboBox( false, mButtonGroup ); 239 mFiltersCombo = new QComboBox( false, mButtonGroup );
239 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); 240 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
240 groupLayout->addWidget( mFiltersCombo, 2, 1 ); 241 groupLayout->addWidget( mFiltersCombo, 2, 1 );
241 242
242 mCategoriesView = new QListView( mButtonGroup ); 243 mCategoriesView = new QListView( mButtonGroup );
243 mCategoriesView->addColumn( "" ); 244 mCategoriesView->addColumn( "" );
244 mCategoriesView->header()->hide(); 245 mCategoriesView->header()->hide();
245 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); 246 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
246 groupLayout->addWidget( mCategoriesView, 3, 1 ); 247 groupLayout->addWidget( mCategoriesView, 3, 1 );
247 248
249 // if (QApplication::desktop()->height() == 480 )
250 // mCategoriesView->setMaximumHeight( 240 );
248 topLayout->addWidget( mButtonGroup ); 251 topLayout->addWidget( mButtonGroup );
249 252
250 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); 253 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
251 sortingGroup->setColumnLayout( 0, Qt::Vertical ); 254 sortingGroup->setColumnLayout( 0, Qt::Vertical );
252 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, 255 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
253 KDialog::spacingHint() ); 256 KDialog::spacingHint() );
254 sortLayout->setAlignment( Qt::AlignTop ); 257 sortLayout->setAlignment( Qt::AlignTop );
255 258
256 label = new QLabel( i18n( "Criterion:" ), sortingGroup ); 259 label = new QLabel( i18n( "Criterion:" ), sortingGroup );
257 sortLayout->addWidget( label, 0, 0 ); 260 sortLayout->addWidget( label, 0, 0 );
258 261
259#ifndef KAB_EMBEDDED 262#ifndef KAB_EMBEDDED
260 mFieldCombo = new KComboBox( false, sortingGroup ); 263 mFieldCombo = new KComboBox( false, sortingGroup );
261#else //KAB_EMBEDDED 264#else //KAB_EMBEDDED
262 //US Combobox is not editable anyway 265 //US Combobox is not editable anyway
263 mFieldCombo = new KComboBox( sortingGroup ); 266 mFieldCombo = new KComboBox( sortingGroup );
264#endif //KAB_EMBEDDED 267#endif //KAB_EMBEDDED
265 sortLayout->addWidget( mFieldCombo, 0, 1 ); 268 sortLayout->addWidget( mFieldCombo, 0, 1 );
266 269
267 label = new QLabel( i18n( "Order:" ), sortingGroup ); 270 label = new QLabel( i18n( "Order:" ), sortingGroup );
268 sortLayout->addWidget( label, 1, 0 ); 271 sortLayout->addWidget( label, 1, 0 );
269 272
270#ifndef KAB_EMBEDDED 273#ifndef KAB_EMBEDDED
271 mSortTypeCombo = new KComboBox( false, sortingGroup ); 274 mSortTypeCombo = new KComboBox( false, sortingGroup );
272#else //KAB_EMBEDDED 275#else //KAB_EMBEDDED
273 //US Combobox is not editable anyway 276 //US Combobox is not editable anyway
274 mSortTypeCombo = new KComboBox( sortingGroup ); 277 mSortTypeCombo = new KComboBox( sortingGroup );
275#endif //KAB_EMBEDDED 278#endif //KAB_EMBEDDED
276 sortLayout->addWidget( mSortTypeCombo, 1, 1 ); 279 sortLayout->addWidget( mSortTypeCombo, 1, 1 );
277 280
278 topLayout->addWidget( sortingGroup ); 281 topLayout->addWidget( sortingGroup );
279 282
280 if ( !mUseSorting ) 283 if ( !mUseSorting )
281 sortingGroup->hide(); 284 sortingGroup->hide();
285#ifndef DESKTOP_VERSION
286 hideButtons();
287#endif
282} 288}
283 289
284#ifndef KAB_EMBEDDED 290#ifndef KAB_EMBEDDED
285#include "xxportselectdialog.moc" 291#include "xxportselectdialog.moc"
286#endif //KAB_EMBEDDED 292#endif //KAB_EMBEDDED
287 293
288 294
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 47cd488..543897a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,3795 +1,3801 @@
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 (preston.brown@yale.edu) 8 Preston Brown (preston.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 "statusdialog.h" 110#include "statusdialog.h"
111#include "kdatenavigator.h" 111#include "kdatenavigator.h"
112#include "kotodoview.h" 112#include "kotodoview.h"
113#include "datenavigator.h" 113#include "datenavigator.h"
114#include "resourceview.h" 114#include "resourceview.h"
115#include "navigatorbar.h" 115#include "navigatorbar.h"
116#include "searchdialog.h" 116#include "searchdialog.h"
117#include "mainwindow.h" 117#include "mainwindow.h"
118 118
119#include "calendarview.h" 119#include "calendarview.h"
120#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
121#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
122#endif 122#endif
123#ifndef _WIN32_ 123#ifndef _WIN32_
124#include <stdlib.h> 124#include <stdlib.h>
125#include <stdio.h> 125#include <stdio.h>
126#include <unistd.h> 126#include <unistd.h>
127#else 127#else
128#include <qprocess.h> 128#include <qprocess.h>
129#endif 129#endif
130 130
131#ifdef DESKTOP_VERSION 131#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 132#include <kabc/stdaddressbook.h>
133#endif 133#endif
134using namespace KOrg; 134using namespace KOrg;
135using namespace KCal; 135using namespace KCal;
136extern int globalFlagBlockAgenda; 136extern int globalFlagBlockAgenda;
137extern int globalFlagBlockStartup; 137extern int globalFlagBlockStartup;
138 138
139 139
140 140
141class KOBeamPrefs : public QDialog 141class KOBeamPrefs : public QDialog
142{ 142{
143 public: 143 public:
144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
145 QDialog( parent, name, true ) 145 QDialog( parent, name, true )
146 { 146 {
147 setCaption( i18n("Beam Options") ); 147 setCaption( i18n("Beam Options") );
148 QVBoxLayout* lay = new QVBoxLayout( this ); 148 QVBoxLayout* lay = new QVBoxLayout( this );
149 lay->setSpacing( 3 ); 149 lay->setSpacing( 3 );
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 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 ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 beamDialog = new KOBeamPrefs(); 236 beamDialog = new KOBeamPrefs();
237 mDatePickerMode = 0; 237 mDatePickerMode = 0;
238 mCurrentSyncDevice = ""; 238 mCurrentSyncDevice = "";
239 writeLocale(); 239 writeLocale();
240 mViewManager = new KOViewManager( this ); 240 mViewManager = new KOViewManager( this );
241 mDialogManager = new KODialogManager( this ); 241 mDialogManager = new KODialogManager( this );
242 mEventViewerDialog = 0; 242 mEventViewerDialog = 0;
243 mModified = false; 243 mModified = false;
244 mReadOnly = false; 244 mReadOnly = false;
245 mSelectedIncidence = 0; 245 mSelectedIncidence = 0;
246 mCalPrinter = 0; 246 mCalPrinter = 0;
247 mFilters.setAutoDelete(true); 247 mFilters.setAutoDelete(true);
248 248
249 mCalendar->registerObserver( this ); 249 mCalendar->registerObserver( this );
250 // TODO: Make sure that view is updated, when calendar is changed. 250 // TODO: Make sure that view is updated, when calendar is changed.
251 251
252 mStorage = new FileStorage( mCalendar ); 252 mStorage = new FileStorage( mCalendar );
253 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 253 mNavigator = new DateNavigator( this, "datevav", mViewManager );
254 254
255 QBoxLayout *topLayout = (QBoxLayout*)layout(); 255 QBoxLayout *topLayout = (QBoxLayout*)layout();
256#ifndef KORG_NOSPLITTER 256#ifndef KORG_NOSPLITTER
257 // create the main layout frames. 257 // create the main layout frames.
258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
259 topLayout->addWidget(mPanner); 259 topLayout->addWidget(mPanner);
260 260
261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
262 "CalendarView::LeftFrame"); 262 "CalendarView::LeftFrame");
263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
264 264
265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
266 "CalendarView::DateNavigator", QDate::currentDate() ); 266 "CalendarView::DateNavigator", QDate::currentDate() );
267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
270 270
271#ifdef KORG_NORESOURCEVIEW 271#ifdef KORG_NORESOURCEVIEW
272 mResourceView = 0; 272 mResourceView = 0;
273#else 273#else
274 if ( mResourceManager ) { 274 if ( mResourceManager ) {
275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
276 mResourceView->updateView(); 276 mResourceView->updateView();
277 connect( mResourceView, SIGNAL( resourcesChanged() ), 277 connect( mResourceView, SIGNAL( resourcesChanged() ),
278 SLOT( updateView() ) ); 278 SLOT( updateView() ) );
279 } else { 279 } else {
280 mResourceView = 0; 280 mResourceView = 0;
281 } 281 }
282#endif 282#endif
283 QWidget *rightBox = new QWidget( mPanner ); 283 QWidget *rightBox = new QWidget( mPanner );
284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
285 285
286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
287 rightLayout->addWidget( mNavigatorBar ); 287 rightLayout->addWidget( mNavigatorBar );
288 288
289 mRightFrame = new QWidgetStack( rightBox ); 289 mRightFrame = new QWidgetStack( rightBox );
290 rightLayout->addWidget( mRightFrame, 1 ); 290 rightLayout->addWidget( mRightFrame, 1 );
291 291
292 mLeftFrame = mLeftSplitter; 292 mLeftFrame = mLeftSplitter;
293#else 293#else
294 QWidget *mainBox = new QWidget( this ); 294 QWidget *mainBox = new QWidget( this );
295 QWidget *leftFrame = new QWidget( mainBox ); 295 QWidget *leftFrame = new QWidget( mainBox );
296 296
297 QBoxLayout * mainBoxLayout; 297 QBoxLayout * mainBoxLayout;
298 QBoxLayout * leftFrameLayout; 298 QBoxLayout * leftFrameLayout;
299 if ( KOPrefs::instance()->mVerticalScreen ) { 299 if ( KOPrefs::instance()->mVerticalScreen ) {
300 mainBoxLayout = new QVBoxLayout(mainBox); 300 mainBoxLayout = new QVBoxLayout(mainBox);
301 leftFrameLayout = new QHBoxLayout(leftFrame ); 301 leftFrameLayout = new QHBoxLayout(leftFrame );
302 } else { 302 } else {
303 mainBoxLayout = new QHBoxLayout(mainBox); 303 mainBoxLayout = new QHBoxLayout(mainBox);
304 leftFrameLayout = new QVBoxLayout(leftFrame ); 304 leftFrameLayout = new QVBoxLayout(leftFrame );
305 } 305 }
306 topLayout->addWidget( mainBox ); 306 topLayout->addWidget( mainBox );
307 mainBoxLayout->addWidget (leftFrame); 307 mainBoxLayout->addWidget (leftFrame);
308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
309 "CalendarView::DateNavigator", QDate::currentDate()); 309 "CalendarView::DateNavigator", QDate::currentDate());
310 // mDateNavigator->blockSignals( true ); 310 // mDateNavigator->blockSignals( true );
311 leftFrameLayout->addWidget( mDateNavigator ); 311 leftFrameLayout->addWidget( mDateNavigator );
312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
314 314
315 if ( QApplication::desktop()->width() < 480 ) { 315 if ( QApplication::desktop()->width() < 480 ) {
316 leftFrameLayout->addWidget(mFilterView); 316 leftFrameLayout->addWidget(mFilterView);
317 leftFrameLayout->addWidget(mTodoList, 2 ); 317 leftFrameLayout->addWidget(mTodoList, 2 );
318 318
319 } else { 319 } else {
320 leftFrameLayout->addWidget(mTodoList,2 ); 320 leftFrameLayout->addWidget(mTodoList,2 );
321 leftFrameLayout->addWidget(mFilterView ); 321 leftFrameLayout->addWidget(mFilterView );
322 } 322 }
323 mFilterView->hide(); 323 mFilterView->hide();
324 QWidget *rightBox = new QWidget( mainBox ); 324 QWidget *rightBox = new QWidget( mainBox );
325 mainBoxLayout->addWidget ( rightBox, 10 ); 325 mainBoxLayout->addWidget ( rightBox, 10 );
326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
328 mRightFrame = new QWidgetStack( rightBox ); 328 mRightFrame = new QWidgetStack( rightBox );
329 rightLayout->addWidget( mNavigatorBar ); 329 rightLayout->addWidget( mNavigatorBar );
330 rightLayout->addWidget( mRightFrame, 10 ); 330 rightLayout->addWidget( mRightFrame, 10 );
331 331
332 mLeftFrame = leftFrame; 332 mLeftFrame = leftFrame;
333 if ( KOPrefs::instance()->mVerticalScreen ) { 333 if ( KOPrefs::instance()->mVerticalScreen ) {
334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
336 } else { 336 } else {
337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
339 } 339 }
340 340
341 //qDebug("Calendarview Size %d %d ", width(), height()); 341 //qDebug("Calendarview Size %d %d ", width(), height());
342#endif 342#endif
343 343
344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
345 SLOT( showDates( const KCal::DateList & ) ) ); 345 SLOT( showDates( const KCal::DateList & ) ) );
346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
348 348
349 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 349 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
350 mNavigator, SLOT( selectPreviousYear() ) ); 350 mNavigator, SLOT( selectPreviousYear() ) );
351 connect( mNavigatorBar, SIGNAL( goNextYear() ), 351 connect( mNavigatorBar, SIGNAL( goNextYear() ),
352 mNavigator, SLOT( selectNextYear() ) ); 352 mNavigator, SLOT( selectNextYear() ) );
353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
354 mNavigator, SLOT( selectPreviousMonth() ) ); 354 mNavigator, SLOT( selectPreviousMonth() ) );
355 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 355 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
356 mNavigator, SLOT( selectNextMonth() ) ); 356 mNavigator, SLOT( selectNextMonth() ) );
357 357
358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
360 360
361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
362 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 362 mNavigator, SLOT( selectWeek( const QDate & ) ) );
363 363
364 connect( mDateNavigator, SIGNAL( goPrevYear() ), 364 connect( mDateNavigator, SIGNAL( goPrevYear() ),
365 mNavigator, SLOT( selectPreviousYear() ) ); 365 mNavigator, SLOT( selectPreviousYear() ) );
366 connect( mDateNavigator, SIGNAL( goNextYear() ), 366 connect( mDateNavigator, SIGNAL( goNextYear() ),
367 mNavigator, SLOT( selectNextYear() ) ); 367 mNavigator, SLOT( selectNextYear() ) );
368 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 368 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
369 mNavigator, SLOT( selectPreviousMonth() ) ); 369 mNavigator, SLOT( selectPreviousMonth() ) );
370 connect( mDateNavigator, SIGNAL( goNextMonth() ), 370 connect( mDateNavigator, SIGNAL( goNextMonth() ),
371 mNavigator, SLOT( selectNextMonth() ) ); 371 mNavigator, SLOT( selectNextMonth() ) );
372 372
373 connect( mDateNavigator, SIGNAL( goPrevious() ), 373 connect( mDateNavigator, SIGNAL( goPrevious() ),
374 mNavigator, SLOT( selectPrevious() ) ); 374 mNavigator, SLOT( selectPrevious() ) );
375 connect( mDateNavigator, SIGNAL( goNext() ), 375 connect( mDateNavigator, SIGNAL( goNext() ),
376 mNavigator, SLOT( selectNext() ) ); 376 mNavigator, SLOT( selectNext() ) );
377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
378 mNavigator, SLOT( slotMonthSelect( int ) ) ); 378 mNavigator, SLOT( slotMonthSelect( int ) ) );
379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
380 mNavigator, SLOT( slotMonthSelect( int ) ) ); 380 mNavigator, SLOT( slotMonthSelect( int ) ) );
381 381
382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
384 384
385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
386 SLOT( eventAdded( Event *) ) ); 386 SLOT( eventAdded( Event *) ) );
387 387
388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
389 389
390 connect( this, SIGNAL( configChanged() ), 390 connect( this, SIGNAL( configChanged() ),
391 mDateNavigator, SLOT( updateConfig() ) ); 391 mDateNavigator, SLOT( updateConfig() ) );
392 392
393 connect( mTodoList, SIGNAL( newTodoSignal() ), 393 connect( mTodoList, SIGNAL( newTodoSignal() ),
394 SLOT( newTodo() ) ); 394 SLOT( newTodo() ) );
395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
396 SLOT( newSubTodo( Todo * ) ) ); 396 SLOT( newSubTodo( Todo * ) ) );
397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
398 SLOT( editTodo( Todo * ) ) ); 398 SLOT( editTodo( Todo * ) ) );
399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
400 SLOT( showTodo( Todo *) ) ); 400 SLOT( showTodo( Todo *) ) );
401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
402 SLOT( deleteTodo( Todo *) ) ); 402 SLOT( deleteTodo( Todo *) ) );
403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
405 SLOT( purgeCompleted() ) ); 405 SLOT( purgeCompleted() ) );
406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
407 SIGNAL( todoModified( Todo *, int ) ) ); 407 SIGNAL( todoModified( Todo *, int ) ) );
408 408
409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
410 this, SLOT ( cloneIncidence( Incidence * ) ) ); 410 this, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
412 this, SLOT (cancelIncidence( Incidence * ) ) ); 412 this, SLOT (cancelIncidence( Incidence * ) ) );
413 413
414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
415 this, SLOT ( moveIncidence( Incidence * ) ) ); 415 this, SLOT ( moveIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
417 this, SLOT ( beamIncidence( Incidence * ) ) ); 417 this, SLOT ( beamIncidence( Incidence * ) ) );
418 418
419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
420 this, SLOT ( todo_unsub( Todo * ) ) ); 420 this, SLOT ( todo_unsub( Todo * ) ) );
421 421
422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
423 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 423 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
425 SLOT( updateTodo( Todo *, int ) ) ); 425 SLOT( updateTodo( Todo *, int ) ) );
426 connect( this, SIGNAL( todoModified( Todo *, int )), this, 426 connect( this, SIGNAL( todoModified( Todo *, int )), this,
427 SLOT( changeTodoDisplay( Todo *, int ) ) ); 427 SLOT( changeTodoDisplay( Todo *, int ) ) );
428 428
429 429
430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
434 434
435 435
436 436
437 437
438 438
439 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 439 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
440 SLOT(checkClipboard())); 440 SLOT(checkClipboard()));
441 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 441 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
442 SLOT( processTodoListSelection( Incidence * ) ) ); 442 SLOT( processTodoListSelection( Incidence * ) ) );
443 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 443 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
444 444
445 // kdDebug() << "CalendarView::CalendarView() done" << endl; 445 // kdDebug() << "CalendarView::CalendarView() done" << endl;
446 446
447 mDateFrame = new QVBox(0,0,WType_Popup); 447 mDateFrame = new QVBox(0,0,WType_Popup);
448 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 448 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
449 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 449 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
450 mDateFrame->setLineWidth(3); 450 mDateFrame->setLineWidth(3);
451 mDateFrame->hide(); 451 mDateFrame->hide();
452 mDateFrame->setCaption( i18n( "Pick a date to display")); 452 mDateFrame->setCaption( i18n( "Pick a date to display"));
453 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 453 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
454 454
455 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 455 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
456 456
457 mEventEditor = mDialogManager->getEventEditor(); 457 mEventEditor = mDialogManager->getEventEditor();
458 mTodoEditor = mDialogManager->getTodoEditor(); 458 mTodoEditor = mDialogManager->getTodoEditor();
459 459
460 mFlagEditDescription = false; 460 mFlagEditDescription = false;
461 461
462 mSuspendTimer = new QTimer( this ); 462 mSuspendTimer = new QTimer( this );
463 mAlarmTimer = new QTimer( this ); 463 mAlarmTimer = new QTimer( this );
464 mRecheckAlarmTimer = new QTimer( this ); 464 mRecheckAlarmTimer = new QTimer( this );
465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
468 mAlarmDialog = new AlarmDialog( this ); 468 mAlarmDialog = new AlarmDialog( this );
469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
470 mAlarmDialog->setServerNotification( false ); 470 mAlarmDialog->setServerNotification( false );
471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
472 472
473 473
474#ifndef DESKTOP_VERSION 474#ifndef DESKTOP_VERSION
475//US listen for arriving address resultsets 475//US listen for arriving address resultsets
476 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 476 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
477 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 477 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
478#endif 478#endif
479 479
480} 480}
481 481
482 482
483CalendarView::~CalendarView() 483CalendarView::~CalendarView()
484{ 484{
485 // kdDebug() << "~CalendarView()" << endl; 485 // kdDebug() << "~CalendarView()" << endl;
486 //qDebug("CalendarView::~CalendarView() "); 486 //qDebug("CalendarView::~CalendarView() ");
487 delete mDialogManager; 487 delete mDialogManager;
488 delete mViewManager; 488 delete mViewManager;
489 delete mStorage; 489 delete mStorage;
490 delete mDateFrame ; 490 delete mDateFrame ;
491 delete beamDialog; 491 delete beamDialog;
492 //kdDebug() << "~CalendarView() done" << endl; 492 //kdDebug() << "~CalendarView() done" << endl;
493} 493}
494void CalendarView::timerAlarm() 494void CalendarView::timerAlarm()
495{ 495{
496 //qDebug("CalendarView::timerAlarm() "); 496 //qDebug("CalendarView::timerAlarm() ");
497 computeAlarm(mAlarmNotification ); 497 computeAlarm(mAlarmNotification );
498} 498}
499 499
500void CalendarView::suspendAlarm() 500void CalendarView::suspendAlarm()
501{ 501{
502 //qDebug(" CalendarView::suspendAlarm() "); 502 //qDebug(" CalendarView::suspendAlarm() ");
503 computeAlarm(mSuspendAlarmNotification ); 503 computeAlarm(mSuspendAlarmNotification );
504 504
505} 505}
506 506
507void CalendarView::startAlarm( QString mess , QString filename) 507void CalendarView::startAlarm( QString mess , QString filename)
508{ 508{
509 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 509 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
510 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 510 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
511 511
512} 512}
513 513
514void CalendarView::checkNextTimerAlarm() 514void CalendarView::checkNextTimerAlarm()
515{ 515{
516 mCalendar->checkAlarmForIncidence( 0, true ); 516 mCalendar->checkAlarmForIncidence( 0, true );
517} 517}
518 518
519void CalendarView::computeAlarm( QString msg ) 519void CalendarView::computeAlarm( QString msg )
520{ 520{
521 521
522 QString mess = msg; 522 QString mess = msg;
523 QString mAlarmMessage = mess.mid( 9 ); 523 QString mAlarmMessage = mess.mid( 9 );
524 QString filename = MainWindow::resourcePath(); 524 QString filename = MainWindow::resourcePath();
525 filename += "koalarm.wav"; 525 filename += "koalarm.wav";
526 QString tempfilename; 526 QString tempfilename;
527 if ( mess.left( 13 ) == "suspend_alarm") { 527 if ( mess.left( 13 ) == "suspend_alarm") {
528 bool error = false; 528 bool error = false;
529 int len = mess.mid( 13 ).find("+++"); 529 int len = mess.mid( 13 ).find("+++");
530 if ( len < 2 ) 530 if ( len < 2 )
531 error = true; 531 error = true;
532 else { 532 else {
533 tempfilename = mess.mid( 13, len ); 533 tempfilename = mess.mid( 13, len );
534 if ( !QFile::exists( tempfilename ) ) 534 if ( !QFile::exists( tempfilename ) )
535 error = true; 535 error = true;
536 } 536 }
537 if ( ! error ) { 537 if ( ! error ) {
538 filename = tempfilename; 538 filename = tempfilename;
539 } 539 }
540 mAlarmMessage = mess.mid( 13+len+3 ); 540 mAlarmMessage = mess.mid( 13+len+3 );
541 //qDebug("suspend file %s ",tempfilename.latin1() ); 541 //qDebug("suspend file %s ",tempfilename.latin1() );
542 startAlarm( mAlarmMessage, filename); 542 startAlarm( mAlarmMessage, filename);
543 return; 543 return;
544 } 544 }
545 if ( mess.left( 11 ) == "timer_alarm") { 545 if ( mess.left( 11 ) == "timer_alarm") {
546 //mTimerTime = 0; 546 //mTimerTime = 0;
547 startAlarm( mess.mid( 11 ), filename ); 547 startAlarm( mess.mid( 11 ), filename );
548 return; 548 return;
549 } 549 }
550 if ( mess.left( 10 ) == "proc_alarm") { 550 if ( mess.left( 10 ) == "proc_alarm") {
551 bool error = false; 551 bool error = false;
552 int len = mess.mid( 10 ).find("+++"); 552 int len = mess.mid( 10 ).find("+++");
553 if ( len < 2 ) 553 if ( len < 2 )
554 error = true; 554 error = true;
555 else { 555 else {
556 tempfilename = mess.mid( 10, len ); 556 tempfilename = mess.mid( 10, len );
557 if ( !QFile::exists( tempfilename ) ) 557 if ( !QFile::exists( tempfilename ) )
558 error = true; 558 error = true;
559 } 559 }
560 if ( error ) { 560 if ( error ) {
561 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 561 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
562 mAlarmMessage += mess.mid( 10+len+3+9 ); 562 mAlarmMessage += mess.mid( 10+len+3+9 );
563 } else { 563 } else {
564 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 564 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
565 //qDebug("-----system command %s ",tempfilename.latin1() ); 565 //qDebug("-----system command %s ",tempfilename.latin1() );
566#ifndef _WIN32_ 566#ifndef _WIN32_
567 if ( vfork () == 0 ) { 567 if ( vfork () == 0 ) {
568 execl ( tempfilename.latin1(), 0 ); 568 execl ( tempfilename.latin1(), 0 );
569 return; 569 return;
570 } 570 }
571#else 571#else
572 QProcess* p = new QProcess(); 572 QProcess* p = new QProcess();
573 p->addArgument( tempfilename.latin1() ); 573 p->addArgument( tempfilename.latin1() );
574 p->start(); 574 p->start();
575 return; 575 return;
576#endif 576#endif
577 577
578 return; 578 return;
579 } 579 }
580 580
581 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 581 //qDebug("+++++++system command %s ",tempfilename.latin1() );
582 } 582 }
583 if ( mess.left( 11 ) == "audio_alarm") { 583 if ( mess.left( 11 ) == "audio_alarm") {
584 bool error = false; 584 bool error = false;
585 int len = mess.mid( 11 ).find("+++"); 585 int len = mess.mid( 11 ).find("+++");
586 if ( len < 2 ) 586 if ( len < 2 )
587 error = true; 587 error = true;
588 else { 588 else {
589 tempfilename = mess.mid( 11, len ); 589 tempfilename = mess.mid( 11, len );
590 if ( !QFile::exists( tempfilename ) ) 590 if ( !QFile::exists( tempfilename ) )
591 error = true; 591 error = true;
592 } 592 }
593 if ( ! error ) { 593 if ( ! error ) {
594 filename = tempfilename; 594 filename = tempfilename;
595 } 595 }
596 mAlarmMessage = mess.mid( 11+len+3+9 ); 596 mAlarmMessage = mess.mid( 11+len+3+9 );
597 //qDebug("audio file command %s ",tempfilename.latin1() ); 597 //qDebug("audio file command %s ",tempfilename.latin1() );
598 } 598 }
599 if ( mess.left( 9 ) == "cal_alarm") { 599 if ( mess.left( 9 ) == "cal_alarm") {
600 mAlarmMessage = mess.mid( 9 ) ; 600 mAlarmMessage = mess.mid( 9 ) ;
601 } 601 }
602 602
603 startAlarm( mAlarmMessage, filename ); 603 startAlarm( mAlarmMessage, filename );
604 604
605 605
606} 606}
607 607
608void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 608void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
609{ 609{
610 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 610 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
611 611
612 mSuspendAlarmNotification = noti; 612 mSuspendAlarmNotification = noti;
613 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 613 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
614 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 614 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
615 mSuspendTimer->start( ms , true ); 615 mSuspendTimer->start( ms , true );
616 616
617} 617}
618 618
619void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 619void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
620{ 620{
621 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 621 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
622 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 622 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
623#ifndef DESKTOP_VERSION 623#ifndef DESKTOP_VERSION
624 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 624 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
625#endif 625#endif
626 return; 626 return;
627 } 627 }
628 int maxSec; 628 int maxSec;
629 //maxSec = 5; //testing only 629 //maxSec = 5; //testing only
630 maxSec = 86400+3600; // one day+1hour 630 maxSec = 86400+3600; // one day+1hour
631 mAlarmNotification = noti; 631 mAlarmNotification = noti;
632 int sec = QDateTime::currentDateTime().secsTo( qdt ); 632 int sec = QDateTime::currentDateTime().secsTo( qdt );
633 if ( sec > maxSec ) { 633 if ( sec > maxSec ) {
634 mRecheckAlarmTimer->start( maxSec * 1000 ); 634 mRecheckAlarmTimer->start( maxSec * 1000 );
635 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 635 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
636 return; 636 return;
637 } else { 637 } else {
638 mRecheckAlarmTimer->stop(); 638 mRecheckAlarmTimer->stop();
639 } 639 }
640 //qDebug("Alarm timer started with secs: %d ", sec); 640 //qDebug("Alarm timer started with secs: %d ", sec);
641 mAlarmTimer->start( sec *1000 , true ); 641 mAlarmTimer->start( sec *1000 , true );
642 642
643} 643}
644// called by mRecheckAlarmTimer to get next alarm 644// called by mRecheckAlarmTimer to get next alarm
645// we need this, because a QTimer has only a max range of 25 days 645// we need this, because a QTimer has only a max range of 25 days
646void CalendarView::recheckTimerAlarm() 646void CalendarView::recheckTimerAlarm()
647{ 647{
648 mAlarmTimer->stop(); 648 mAlarmTimer->stop();
649 mRecheckAlarmTimer->stop(); 649 mRecheckAlarmTimer->stop();
650 mCalendar->checkAlarmForIncidence( 0, true ); 650 mCalendar->checkAlarmForIncidence( 0, true );
651} 651}
652void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 652void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
653{ 653{
654 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 654 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
655 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 655 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
656#ifndef DESKTOP_VERSION 656#ifndef DESKTOP_VERSION
657 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 657 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
658#endif 658#endif
659 return; 659 return;
660 } 660 }
661 mAlarmTimer->stop(); 661 mAlarmTimer->stop();
662} 662}
663void CalendarView::selectWeekNum ( int num ) 663void CalendarView::selectWeekNum ( int num )
664{ 664{
665 dateNavigator()->selectWeek( num ); 665 dateNavigator()->selectWeek( num );
666 mViewManager->showWeekView(); 666 mViewManager->showWeekView();
667} 667}
668KOViewManager *CalendarView::viewManager() 668KOViewManager *CalendarView::viewManager()
669{ 669{
670 return mViewManager; 670 return mViewManager;
671} 671}
672 672
673KODialogManager *CalendarView::dialogManager() 673KODialogManager *CalendarView::dialogManager()
674{ 674{
675 return mDialogManager; 675 return mDialogManager;
676} 676}
677 677
678QDate CalendarView::startDate() 678QDate CalendarView::startDate()
679{ 679{
680 DateList dates = mNavigator->selectedDates(); 680 DateList dates = mNavigator->selectedDates();
681 681
682 return dates.first(); 682 return dates.first();
683} 683}
684 684
685QDate CalendarView::endDate() 685QDate CalendarView::endDate()
686{ 686{
687 DateList dates = mNavigator->selectedDates(); 687 DateList dates = mNavigator->selectedDates();
688 688
689 return dates.last(); 689 return dates.last();
690} 690}
691 691
692 692
693void CalendarView::createPrinter() 693void CalendarView::createPrinter()
694{ 694{
695#ifndef KORG_NOPRINTER 695#ifndef KORG_NOPRINTER
696 if (!mCalPrinter) { 696 if (!mCalPrinter) {
697 mCalPrinter = new CalPrinter(this, mCalendar); 697 mCalPrinter = new CalPrinter(this, mCalendar);
698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
699 } 699 }
700#endif 700#endif
701} 701}
702 702
703 703
704//KOPrefs::instance()->mWriteBackFile 704//KOPrefs::instance()->mWriteBackFile
705//KOPrefs::instance()->mWriteBackExistingOnly 705//KOPrefs::instance()->mWriteBackExistingOnly
706 706
707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
713 713
714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
715{ 715{
716 716
717 // 0 equal 717 // 0 equal
718 // 1 take local 718 // 1 take local
719 // 2 take remote 719 // 2 take remote
720 // 3 cancel 720 // 3 cancel
721 QDateTime lastSync = mLastCalendarSync; 721 QDateTime lastSync = mLastCalendarSync;
722 QDateTime localMod = local->lastModified(); 722 QDateTime localMod = local->lastModified();
723 QDateTime remoteMod = remote->lastModified(); 723 QDateTime remoteMod = remote->lastModified();
724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
725 bool remCh, locCh; 725 bool remCh, locCh;
726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
727 //if ( remCh ) 727 //if ( remCh )
728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
729 locCh = ( localMod > mLastCalendarSync ); 729 locCh = ( localMod > mLastCalendarSync );
730 if ( !remCh && ! locCh ) { 730 if ( !remCh && ! locCh ) {
731 //qDebug("both not changed "); 731 //qDebug("both not changed ");
732 lastSync = localMod.addDays(1); 732 lastSync = localMod.addDays(1);
733 if ( mode <= SYNC_PREF_ASK ) 733 if ( mode <= SYNC_PREF_ASK )
734 return 0; 734 return 0;
735 } else { 735 } else {
736 if ( locCh ) { 736 if ( locCh ) {
737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
738 lastSync = localMod.addDays( -1 ); 738 lastSync = localMod.addDays( -1 );
739 if ( !remCh ) 739 if ( !remCh )
740 remoteMod = ( lastSync.addDays( -1 ) ); 740 remoteMod = ( lastSync.addDays( -1 ) );
741 } else { 741 } else {
742 //qDebug(" not loc changed "); 742 //qDebug(" not loc changed ");
743 lastSync = localMod.addDays( 1 ); 743 lastSync = localMod.addDays( 1 );
744 if ( remCh ) 744 if ( remCh )
745 remoteMod =( lastSync.addDays( 1 ) ); 745 remoteMod =( lastSync.addDays( 1 ) );
746 746
747 } 747 }
748 } 748 }
749 full = true; 749 full = true;
750 if ( mode < SYNC_PREF_ASK ) 750 if ( mode < SYNC_PREF_ASK )
751 mode = SYNC_PREF_ASK; 751 mode = SYNC_PREF_ASK;
752 } else { 752 } else {
753 if ( localMod == remoteMod ) 753 if ( localMod == remoteMod )
754 // if ( local->revision() == remote->revision() ) 754 // if ( local->revision() == remote->revision() )
755 return 0; 755 return 0;
756 756
757 } 757 }
758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
759 759
760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
762 //full = true; //debug only 762 //full = true; //debug only
763 if ( full ) { 763 if ( full ) {
764 bool equ = false; 764 bool equ = false;
765 if ( local->type() == "Event" ) { 765 if ( local->type() == "Event" ) {
766 equ = (*((Event*) local) == *((Event*) remote)); 766 equ = (*((Event*) local) == *((Event*) remote));
767 } 767 }
768 else if ( local->type() =="Todo" ) 768 else if ( local->type() =="Todo" )
769 equ = (*((Todo*) local) == (*(Todo*) remote)); 769 equ = (*((Todo*) local) == (*(Todo*) remote));
770 else if ( local->type() =="Journal" ) 770 else if ( local->type() =="Journal" )
771 equ = (*((Journal*) local) == *((Journal*) remote)); 771 equ = (*((Journal*) local) == *((Journal*) remote));
772 if ( equ ) { 772 if ( equ ) {
773 //qDebug("equal "); 773 //qDebug("equal ");
774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
776 } 776 }
777 if ( mode < SYNC_PREF_FORCE_LOCAL ) 777 if ( mode < SYNC_PREF_FORCE_LOCAL )
778 return 0; 778 return 0;
779 779
780 }//else //debug only 780 }//else //debug only
781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
782 } 782 }
783 int result; 783 int result;
784 bool localIsNew; 784 bool localIsNew;
785 //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() ); 785 //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() );
786 786
787 if ( full && mode < SYNC_PREF_NEWEST ) 787 if ( full && mode < SYNC_PREF_NEWEST )
788 mode = SYNC_PREF_ASK; 788 mode = SYNC_PREF_ASK;
789 789
790 switch( mode ) { 790 switch( mode ) {
791 case SYNC_PREF_LOCAL: 791 case SYNC_PREF_LOCAL:
792 if ( lastSync > remoteMod ) 792 if ( lastSync > remoteMod )
793 return 1; 793 return 1;
794 if ( lastSync > localMod ) 794 if ( lastSync > localMod )
795 return 2; 795 return 2;
796 return 1; 796 return 1;
797 break; 797 break;
798 case SYNC_PREF_REMOTE: 798 case SYNC_PREF_REMOTE:
799 if ( lastSync > remoteMod ) 799 if ( lastSync > remoteMod )
800 return 1; 800 return 1;
801 if ( lastSync > localMod ) 801 if ( lastSync > localMod )
802 return 2; 802 return 2;
803 return 2; 803 return 2;
804 break; 804 break;
805 case SYNC_PREF_NEWEST: 805 case SYNC_PREF_NEWEST:
806 if ( localMod > remoteMod ) 806 if ( localMod > remoteMod )
807 return 1; 807 return 1;
808 else 808 else
809 return 2; 809 return 2;
810 break; 810 break;
811 case SYNC_PREF_ASK: 811 case SYNC_PREF_ASK:
812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
813 if ( lastSync > remoteMod ) 813 if ( lastSync > remoteMod )
814 return 1; 814 return 1;
815 if ( lastSync > localMod ) 815 if ( lastSync > localMod )
816 return 2; 816 return 2;
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
818 localIsNew = localMod >= remoteMod; 818 localIsNew = localMod >= remoteMod;
819 if ( localIsNew ) 819 if ( localIsNew )
820 getEventViewerDialog()->setColorMode( 1 ); 820 getEventViewerDialog()->setColorMode( 1 );
821 else 821 else
822 getEventViewerDialog()->setColorMode( 2 ); 822 getEventViewerDialog()->setColorMode( 2 );
823 getEventViewerDialog()->setIncidence(local); 823 getEventViewerDialog()->setIncidence(local);
824 if ( localIsNew ) 824 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 2 ); 825 getEventViewerDialog()->setColorMode( 2 );
826 else 826 else
827 getEventViewerDialog()->setColorMode( 1 ); 827 getEventViewerDialog()->setColorMode( 1 );
828 getEventViewerDialog()->addIncidence(remote); 828 getEventViewerDialog()->addIncidence(remote);
829 getEventViewerDialog()->setColorMode( 0 ); 829 getEventViewerDialog()->setColorMode( 0 );
830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
832 getEventViewerDialog()->showMe(); 832 getEventViewerDialog()->showMe();
833 result = getEventViewerDialog()->executeS( localIsNew ); 833 result = getEventViewerDialog()->executeS( localIsNew );
834 return result; 834 return result;
835 835
836 break; 836 break;
837 case SYNC_PREF_FORCE_LOCAL: 837 case SYNC_PREF_FORCE_LOCAL:
838 return 1; 838 return 1;
839 break; 839 break;
840 case SYNC_PREF_FORCE_REMOTE: 840 case SYNC_PREF_FORCE_REMOTE:
841 return 2; 841 return 2;
842 break; 842 break;
843 843
844 default: 844 default:
845 // SYNC_PREF_TAKE_BOTH not implemented 845 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 846 break;
847 } 847 }
848 return 0; 848 return 0;
849} 849}
850Event* CalendarView::getLastSyncEvent() 850Event* CalendarView::getLastSyncEvent()
851{ 851{
852 Event* lse; 852 Event* lse;
853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
855 if (!lse) { 855 if (!lse) {
856 lse = new Event(); 856 lse = new Event();
857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
858 QString sum = ""; 858 QString sum = "";
859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
860 sum = "E: "; 860 sum = "E: ";
861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
862 lse->setDtStart( mLastCalendarSync ); 862 lse->setDtStart( mLastCalendarSync );
863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
864 lse->setCategories( i18n("SyncEvent") ); 864 lse->setCategories( i18n("SyncEvent") );
865 lse->setReadOnly( true ); 865 lse->setReadOnly( true );
866 mCalendar->addEvent( lse ); 866 mCalendar->addEvent( lse );
867 } 867 }
868 868
869 return lse; 869 return lse;
870 870
871} 871}
872 872
873// we check, if the to delete event has a id for a profile 873// we check, if the to delete event has a id for a profile
874// if yes, we set this id in the profile to delete 874// if yes, we set this id in the profile to delete
875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
876{ 876{
877 if ( lastSync.count() == 0 ) { 877 if ( lastSync.count() == 0 ) {
878 //qDebug(" lastSync.count() == 0"); 878 //qDebug(" lastSync.count() == 0");
879 return; 879 return;
880 } 880 }
881 if ( toDelete->type() == "Journal" ) 881 if ( toDelete->type() == "Journal" )
882 return; 882 return;
883 883
884 Event* eve = lastSync.first(); 884 Event* eve = lastSync.first();
885 885
886 while ( eve ) { 886 while ( eve ) {
887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
888 if ( !id.isEmpty() ) { 888 if ( !id.isEmpty() ) {
889 QString des = eve->description(); 889 QString des = eve->description();
890 QString pref = "e"; 890 QString pref = "e";
891 if ( toDelete->type() == "Todo" ) 891 if ( toDelete->type() == "Todo" )
892 pref = "t"; 892 pref = "t";
893 des += pref+ id + ","; 893 des += pref+ id + ",";
894 eve->setReadOnly( false ); 894 eve->setReadOnly( false );
895 eve->setDescription( des ); 895 eve->setDescription( des );
896 //qDebug("setdes %s ", des.latin1()); 896 //qDebug("setdes %s ", des.latin1());
897 eve->setReadOnly( true ); 897 eve->setReadOnly( true );
898 } 898 }
899 eve = lastSync.next(); 899 eve = lastSync.next();
900 } 900 }
901 901
902} 902}
903void CalendarView::checkExternalId( Incidence * inc ) 903void CalendarView::checkExternalId( Incidence * inc )
904{ 904{
905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
906 checkExternSyncEvent( lastSync, inc ); 906 checkExternSyncEvent( lastSync, inc );
907 907
908} 908}
909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
910{ 910{
911 bool syncOK = true; 911 bool syncOK = true;
912 int addedEvent = 0; 912 int addedEvent = 0;
913 int addedEventR = 0; 913 int addedEventR = 0;
914 int deletedEventR = 0; 914 int deletedEventR = 0;
915 int deletedEventL = 0; 915 int deletedEventL = 0;
916 int changedLocal = 0; 916 int changedLocal = 0;
917 int changedRemote = 0; 917 int changedRemote = 0;
918 //QPtrList<Event> el = local->rawEvents(); 918 //QPtrList<Event> el = local->rawEvents();
919 Event* eventR; 919 Event* eventR;
920 QString uid; 920 QString uid;
921 int take; 921 int take;
922 Event* eventL; 922 Event* eventL;
923 Event* eventRSync; 923 Event* eventRSync;
924 Event* eventLSync; 924 Event* eventLSync;
925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
927 bool fullDateRange = false; 927 bool fullDateRange = false;
928 local->resetTempSyncStat(); 928 local->resetTempSyncStat();
929 mLastCalendarSync = QDateTime::currentDateTime(); 929 mLastCalendarSync = QDateTime::currentDateTime();
930 if ( mSyncManager->syncWithDesktop() ) { 930 if ( mSyncManager->syncWithDesktop() ) {
931 remote->resetPilotStat(1); 931 remote->resetPilotStat(1);
932 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 932 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
933 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 933 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
934 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 934 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
935 } else { 935 } else {
936 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 936 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
937 } 937 }
938 } 938 }
939 QDateTime modifiedCalendar = mLastCalendarSync; 939 QDateTime modifiedCalendar = mLastCalendarSync;
940 eventLSync = getLastSyncEvent(); 940 eventLSync = getLastSyncEvent();
941 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 941 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
942 if ( eventR ) { 942 if ( eventR ) {
943 eventRSync = (Event*) eventR->clone(); 943 eventRSync = (Event*) eventR->clone();
944 remote->deleteEvent(eventR ); 944 remote->deleteEvent(eventR );
945 945
946 } else { 946 } else {
947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
948 eventRSync = (Event*)eventLSync->clone(); 948 eventRSync = (Event*)eventLSync->clone();
949 } else { 949 } else {
950 fullDateRange = true; 950 fullDateRange = true;
951 eventRSync = new Event(); 951 eventRSync = new Event();
952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
954 eventRSync->setDtStart( mLastCalendarSync ); 954 eventRSync->setDtStart( mLastCalendarSync );
955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
956 eventRSync->setCategories( i18n("SyncEvent") ); 956 eventRSync->setCategories( i18n("SyncEvent") );
957 } 957 }
958 } 958 }
959 if ( eventLSync->dtStart() == mLastCalendarSync ) 959 if ( eventLSync->dtStart() == mLastCalendarSync )
960 fullDateRange = true; 960 fullDateRange = true;
961 961
962 if ( ! fullDateRange ) { 962 if ( ! fullDateRange ) {
963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
964 964
965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
967 fullDateRange = true; 967 fullDateRange = true;
968 } 968 }
969 } 969 }
970 if ( mSyncManager->syncWithDesktop() ) { 970 if ( mSyncManager->syncWithDesktop() ) {
971 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 971 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
972 } 972 }
973 if ( fullDateRange ) 973 if ( fullDateRange )
974 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 974 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
975 else 975 else
976 mLastCalendarSync = eventLSync->dtStart(); 976 mLastCalendarSync = eventLSync->dtStart();
977 // for resyncing if own file has changed 977 // for resyncing if own file has changed
978 if ( mCurrentSyncDevice == "deleteaftersync" ) { 978 if ( mCurrentSyncDevice == "deleteaftersync" ) {
979 mLastCalendarSync = loadedFileVersion; 979 mLastCalendarSync = loadedFileVersion;
980 //qDebug("setting mLastCalendarSync "); 980 //qDebug("setting mLastCalendarSync ");
981 } 981 }
982 //qDebug("*************************** "); 982 //qDebug("*************************** ");
983 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 983 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
984 QPtrList<Incidence> er = remote->rawIncidences(); 984 QPtrList<Incidence> er = remote->rawIncidences();
985 Incidence* inR = er.first(); 985 Incidence* inR = er.first();
986 Incidence* inL; 986 Incidence* inL;
987 QProgressBar bar( er.count(),0 ); 987 QProgressBar bar( er.count(),0 );
988 bar.setCaption (i18n("Syncing - close to abort!") ); 988 bar.setCaption (i18n("Syncing - close to abort!") );
989 989
990 int w = 300; 990 int w = 300;
991 if ( QApplication::desktop()->width() < 320 ) 991 if ( QApplication::desktop()->width() < 320 )
992 w = 220; 992 w = 220;
993 int h = bar.sizeHint().height() ; 993 int h = bar.sizeHint().height() ;
994 int dw = QApplication::desktop()->width(); 994 int dw = QApplication::desktop()->width();
995 int dh = QApplication::desktop()->height(); 995 int dh = QApplication::desktop()->height();
996 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 996 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
997 bar.show(); 997 bar.show();
998 int modulo = (er.count()/10)+1; 998 int modulo = (er.count()/10)+1;
999 int incCounter = 0; 999 int incCounter = 0;
1000 while ( inR ) { 1000 while ( inR ) {
1001 if ( ! bar.isVisible() ) 1001 if ( ! bar.isVisible() )
1002 return false; 1002 return false;
1003 if ( incCounter % modulo == 0 ) 1003 if ( incCounter % modulo == 0 )
1004 bar.setProgress( incCounter ); 1004 bar.setProgress( incCounter );
1005 ++incCounter; 1005 ++incCounter;
1006 uid = inR->uid(); 1006 uid = inR->uid();
1007 bool skipIncidence = false; 1007 bool skipIncidence = false;
1008 if ( uid.left(15) == QString("last-syncEvent-") ) 1008 if ( uid.left(15) == QString("last-syncEvent-") )
1009 skipIncidence = true; 1009 skipIncidence = true;
1010 QString idS; 1010 QString idS;
1011 qApp->processEvents(); 1011 qApp->processEvents();
1012 if ( !skipIncidence ) { 1012 if ( !skipIncidence ) {
1013 inL = local->incidence( uid ); 1013 inL = local->incidence( uid );
1014 if ( inL ) { // maybe conflict - same uid in both calendars 1014 if ( inL ) { // maybe conflict - same uid in both calendars
1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1016 //qDebug("take %d %s ", take, inL->summary().latin1()); 1016 //qDebug("take %d %s ", take, inL->summary().latin1());
1017 if ( take == 3 ) 1017 if ( take == 3 )
1018 return false; 1018 return false;
1019 if ( take == 1 ) {// take local ********************** 1019 if ( take == 1 ) {// take local **********************
1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1020 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1021 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1022 else 1022 else
1023 idS = inR->IDStr(); 1023 idS = inR->IDStr();
1024 remote->deleteIncidence( inR ); 1024 remote->deleteIncidence( inR );
1025 inR = inL->clone(); 1025 inR = inL->clone();
1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1026 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1027 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1028 inR->setIDStr( idS ); 1028 inR->setIDStr( idS );
1029 remote->addIncidence( inR ); 1029 remote->addIncidence( inR );
1030 if ( mSyncManager->syncWithDesktop() ) 1030 if ( mSyncManager->syncWithDesktop() )
1031 inR->setPilotId( 2 ); 1031 inR->setPilotId( 2 );
1032 ++changedRemote; 1032 ++changedRemote;
1033 } else {// take remote ********************** 1033 } else {// take remote **********************
1034 idS = inL->IDStr(); 1034 idS = inL->IDStr();
1035 int pid = inL->pilotId(); 1035 int pid = inL->pilotId();
1036 local->deleteIncidence( inL ); 1036 local->deleteIncidence( inL );
1037 inL = inR->clone(); 1037 inL = inR->clone();
1038 if ( mSyncManager->syncWithDesktop() ) 1038 if ( mSyncManager->syncWithDesktop() )
1039 inL->setPilotId( pid ); 1039 inL->setPilotId( pid );
1040 inL->setIDStr( idS ); 1040 inL->setIDStr( idS );
1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1041 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1042 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1043 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1044 } 1044 }
1045 local->addIncidence( inL ); 1045 local->addIncidence( inL );
1046 ++changedLocal; 1046 ++changedLocal;
1047 } 1047 }
1048 } 1048 }
1049 } else { // no conflict ********** add or delete remote 1049 } else { // no conflict ********** add or delete remote
1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1051 QString des = eventLSync->description(); 1051 QString des = eventLSync->description();
1052 QString pref = "e"; 1052 QString pref = "e";
1053 if ( inR->type() == "Todo" ) 1053 if ( inR->type() == "Todo" )
1054 pref = "t"; 1054 pref = "t";
1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1055 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1056 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1057 //remote->deleteIncidence( inR ); 1057 //remote->deleteIncidence( inR );
1058 ++deletedEventR; 1058 ++deletedEventR;
1059 } else { 1059 } else {
1060 inR->setLastModified( modifiedCalendar ); 1060 inR->setLastModified( modifiedCalendar );
1061 inL = inR->clone(); 1061 inL = inR->clone();
1062 inL->setIDStr( ":" ); 1062 inL->setIDStr( ":" );
1063 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1063 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1064 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1064 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1065 local->addIncidence( inL ); 1065 local->addIncidence( inL );
1066 ++addedEvent; 1066 ++addedEvent;
1067 } 1067 }
1068 } else { 1068 } else {
1069 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1069 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1070 inR->setLastModified( modifiedCalendar ); 1070 inR->setLastModified( modifiedCalendar );
1071 inL = inR->clone(); 1071 inL = inR->clone();
1072 inL->setIDStr( ":" ); 1072 inL->setIDStr( ":" );
1073 local->addIncidence( inL ); 1073 local->addIncidence( inL );
1074 ++addedEvent; 1074 ++addedEvent;
1075 } else { 1075 } else {
1076 checkExternSyncEvent(eventRSyncSharp, inR); 1076 checkExternSyncEvent(eventRSyncSharp, inR);
1077 remote->deleteIncidence( inR ); 1077 remote->deleteIncidence( inR );
1078 ++deletedEventR; 1078 ++deletedEventR;
1079 } 1079 }
1080 } 1080 }
1081 } 1081 }
1082 } 1082 }
1083 inR = er.next(); 1083 inR = er.next();
1084 } 1084 }
1085 QPtrList<Incidence> el = local->rawIncidences(); 1085 QPtrList<Incidence> el = local->rawIncidences();
1086 inL = el.first(); 1086 inL = el.first();
1087 modulo = (el.count()/10)+1; 1087 modulo = (el.count()/10)+1;
1088 bar.setCaption (i18n("Add / remove events") ); 1088 bar.setCaption (i18n("Add / remove events") );
1089 bar.setTotalSteps ( el.count() ) ; 1089 bar.setTotalSteps ( el.count() ) ;
1090 bar.show(); 1090 bar.show();
1091 incCounter = 0; 1091 incCounter = 0;
1092 1092
1093 while ( inL ) { 1093 while ( inL ) {
1094 1094
1095 qApp->processEvents(); 1095 qApp->processEvents();
1096 if ( ! bar.isVisible() ) 1096 if ( ! bar.isVisible() )
1097 return false; 1097 return false;
1098 if ( incCounter % modulo == 0 ) 1098 if ( incCounter % modulo == 0 )
1099 bar.setProgress( incCounter ); 1099 bar.setProgress( incCounter );
1100 ++incCounter; 1100 ++incCounter;
1101 uid = inL->uid(); 1101 uid = inL->uid();
1102 bool skipIncidence = false; 1102 bool skipIncidence = false;
1103 if ( uid.left(15) == QString("last-syncEvent-") ) 1103 if ( uid.left(15) == QString("last-syncEvent-") )
1104 skipIncidence = true; 1104 skipIncidence = true;
1105 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1105 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1106 skipIncidence = true; 1106 skipIncidence = true;
1107 if ( !skipIncidence ) { 1107 if ( !skipIncidence ) {
1108 inR = remote->incidence( uid ); 1108 inR = remote->incidence( uid );
1109 if ( ! inR ) { // no conflict ********** add or delete local 1109 if ( ! inR ) { // no conflict ********** add or delete local
1110 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1110 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1111 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1111 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1112 checkExternSyncEvent(eventLSyncSharp, inL); 1112 checkExternSyncEvent(eventLSyncSharp, inL);
1113 local->deleteIncidence( inL ); 1113 local->deleteIncidence( inL );
1114 ++deletedEventL; 1114 ++deletedEventL;
1115 } else { 1115 } else {
1116 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1116 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1117 inL->removeID(mCurrentSyncDevice ); 1117 inL->removeID(mCurrentSyncDevice );
1118 ++addedEventR; 1118 ++addedEventR;
1119 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1119 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1120 inL->setLastModified( modifiedCalendar ); 1120 inL->setLastModified( modifiedCalendar );
1121 inR = inL->clone(); 1121 inR = inL->clone();
1122 inR->setIDStr( ":" ); 1122 inR->setIDStr( ":" );
1123 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1123 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1124 remote->addIncidence( inR ); 1124 remote->addIncidence( inR );
1125 } 1125 }
1126 } 1126 }
1127 } else { 1127 } else {
1128 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1128 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1129 checkExternSyncEvent(eventLSyncSharp, inL); 1129 checkExternSyncEvent(eventLSyncSharp, inL);
1130 local->deleteIncidence( inL ); 1130 local->deleteIncidence( inL );
1131 ++deletedEventL; 1131 ++deletedEventL;
1132 } else { 1132 } else {
1133 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1133 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1134 ++addedEventR; 1134 ++addedEventR;
1135 inL->setLastModified( modifiedCalendar ); 1135 inL->setLastModified( modifiedCalendar );
1136 inR = inL->clone(); 1136 inR = inL->clone();
1137 inR->setIDStr( ":" ); 1137 inR->setIDStr( ":" );
1138 remote->addIncidence( inR ); 1138 remote->addIncidence( inR );
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
1142 } 1142 }
1143 } 1143 }
1144 inL = el.next(); 1144 inL = el.next();
1145 } 1145 }
1146 int delFut = 0; 1146 int delFut = 0;
1147 int remRem = 0; 1147 int remRem = 0;
1148 if ( mSyncManager->mWriteBackInFuture ) { 1148 if ( mSyncManager->mWriteBackInFuture ) {
1149 er = remote->rawIncidences(); 1149 er = remote->rawIncidences();
1150 remRem = er.count(); 1150 remRem = er.count();
1151 inR = er.first(); 1151 inR = er.first();
1152 QDateTime dt; 1152 QDateTime dt;
1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1154 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1154 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1155 while ( inR ) { 1155 while ( inR ) {
1156 if ( inR->type() == "Todo" ) { 1156 if ( inR->type() == "Todo" ) {
1157 Todo * t = (Todo*)inR; 1157 Todo * t = (Todo*)inR;
1158 if ( t->hasDueDate() ) 1158 if ( t->hasDueDate() )
1159 dt = t->dtDue(); 1159 dt = t->dtDue();
1160 else 1160 else
1161 dt = cur.addSecs( 62 ); 1161 dt = cur.addSecs( 62 );
1162 } 1162 }
1163 else if (inR->type() == "Event" ) { 1163 else if (inR->type() == "Event" ) {
1164 bool ok; 1164 bool ok;
1165 dt = inR->getNextOccurence( cur, &ok ); 1165 dt = inR->getNextOccurence( cur, &ok );
1166 if ( !ok ) 1166 if ( !ok )
1167 dt = cur.addSecs( -62 ); 1167 dt = cur.addSecs( -62 );
1168 } 1168 }
1169 else 1169 else
1170 dt = inR->dtStart(); 1170 dt = inR->dtStart();
1171 if ( dt < cur || dt > end ) { 1171 if ( dt < cur || dt > end ) {
1172 remote->deleteIncidence( inR ); 1172 remote->deleteIncidence( inR );
1173 ++delFut; 1173 ++delFut;
1174 } 1174 }
1175 inR = er.next(); 1175 inR = er.next();
1176 } 1176 }
1177 } 1177 }
1178 bar.hide(); 1178 bar.hide();
1179 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1179 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1180 eventLSync->setReadOnly( false ); 1180 eventLSync->setReadOnly( false );
1181 eventLSync->setDtStart( mLastCalendarSync ); 1181 eventLSync->setDtStart( mLastCalendarSync );
1182 eventRSync->setDtStart( mLastCalendarSync ); 1182 eventRSync->setDtStart( mLastCalendarSync );
1183 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1183 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1184 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1184 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1185 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1185 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1186 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1186 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1187 eventLSync->setReadOnly( true ); 1187 eventLSync->setReadOnly( true );
1188 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); 1188 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
1189 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1189 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1190 remote->addEvent( eventRSync ); 1190 remote->addEvent( eventRSync );
1191 else 1191 else
1192 delete eventRSync; 1192 delete eventRSync;
1193 QString mes; 1193 QString mes;
1194 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1194 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1195 QString delmess; 1195 QString delmess;
1196 if ( delFut ) { 1196 if ( delFut ) {
1197 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1197 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1198 mes += delmess; 1198 mes += delmess;
1199 } 1199 }
1200 mes = i18n("Local calendar changed!\n") +mes; 1200 mes = i18n("Local calendar changed!\n") +mes;
1201 mCalendar->checkAlarmForIncidence( 0, true ); 1201 mCalendar->checkAlarmForIncidence( 0, true );
1202 qDebug( mes ); 1202 qDebug( mes );
1203 if ( mSyncManager->mShowSyncSummary ) { 1203 if ( mSyncManager->mShowSyncSummary ) {
1204 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1204 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1205 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1205 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1206 qDebug("cancelled "); 1206 qDebug("cancelled ");
1207 return false; 1207 return false;
1208 } 1208 }
1209 } 1209 }
1210 return syncOK; 1210 return syncOK;
1211} 1211}
1212 1212
1213void CalendarView::setSyncDevice( QString s ) 1213void CalendarView::setSyncDevice( QString s )
1214{ 1214{
1215 mCurrentSyncDevice= s; 1215 mCurrentSyncDevice= s;
1216} 1216}
1217void CalendarView::setSyncName( QString s ) 1217void CalendarView::setSyncName( QString s )
1218{ 1218{
1219 mCurrentSyncName= s; 1219 mCurrentSyncName= s;
1220} 1220}
1221bool CalendarView::syncCalendar(QString filename, int mode) 1221bool CalendarView::syncCalendar(QString filename, int mode)
1222{ 1222{
1223 //qDebug("syncCalendar %s ", filename.latin1()); 1223 //qDebug("syncCalendar %s ", filename.latin1());
1224 mGlobalSyncMode = SYNC_MODE_NORMAL; 1224 mGlobalSyncMode = SYNC_MODE_NORMAL;
1225 CalendarLocal* calendar = new CalendarLocal(); 1225 CalendarLocal* calendar = new CalendarLocal();
1226 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1226 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1227 FileStorage* storage = new FileStorage( calendar ); 1227 FileStorage* storage = new FileStorage( calendar );
1228 bool syncOK = false; 1228 bool syncOK = false;
1229 storage->setFileName( filename ); 1229 storage->setFileName( filename );
1230 // qDebug("loading ... "); 1230 // qDebug("loading ... ");
1231 if ( storage->load() ) { 1231 if ( storage->load() ) {
1232 getEventViewerDialog()->setSyncMode( true ); 1232 getEventViewerDialog()->setSyncMode( true );
1233 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1233 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1234 getEventViewerDialog()->setSyncMode( false ); 1234 getEventViewerDialog()->setSyncMode( false );
1235 if ( syncOK ) { 1235 if ( syncOK ) {
1236 if ( mSyncManager->mWriteBackFile ) 1236 if ( mSyncManager->mWriteBackFile )
1237 { 1237 {
1238 storage->setSaveFormat( new ICalFormat() ); 1238 storage->setSaveFormat( new ICalFormat() );
1239 storage->save(); 1239 storage->save();
1240 } 1240 }
1241 } 1241 }
1242 setModified( true ); 1242 setModified( true );
1243 } 1243 }
1244 delete storage; 1244 delete storage;
1245 delete calendar; 1245 delete calendar;
1246 if ( syncOK ) 1246 if ( syncOK )
1247 updateView(); 1247 updateView();
1248 return syncOK; 1248 return syncOK;
1249} 1249}
1250 1250
1251void CalendarView::syncExternal( int mode ) 1251void CalendarView::syncExternal( int mode )
1252{ 1252{
1253 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1253 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1254 1254
1255 qApp->processEvents(); 1255 qApp->processEvents();
1256 CalendarLocal* calendar = new CalendarLocal(); 1256 CalendarLocal* calendar = new CalendarLocal();
1257 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1257 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1258 bool syncOK = false; 1258 bool syncOK = false;
1259 bool loadSuccess = false; 1259 bool loadSuccess = false;
1260 PhoneFormat* phoneFormat = 0; 1260 PhoneFormat* phoneFormat = 0;
1261 emit tempDisableBR(true); 1261 emit tempDisableBR(true);
1262#ifndef DESKTOP_VERSION 1262#ifndef DESKTOP_VERSION
1263 SharpFormat* sharpFormat = 0; 1263 SharpFormat* sharpFormat = 0;
1264 if ( mode == 0 ) { // sharp 1264 if ( mode == 0 ) { // sharp
1265 sharpFormat = new SharpFormat () ; 1265 sharpFormat = new SharpFormat () ;
1266 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1266 loadSuccess = sharpFormat->load( calendar, mCalendar );
1267 1267
1268 } else 1268 } else
1269#endif 1269#endif
1270 if ( mode == 1 ) { // phone 1270 if ( mode == 1 ) { // phone
1271 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1271 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1272 mSyncManager->mPhoneDevice, 1272 mSyncManager->mPhoneDevice,
1273 mSyncManager->mPhoneConnection, 1273 mSyncManager->mPhoneConnection,
1274 mSyncManager->mPhoneModel); 1274 mSyncManager->mPhoneModel);
1275 loadSuccess = phoneFormat->load( calendar,mCalendar); 1275 loadSuccess = phoneFormat->load( calendar,mCalendar);
1276 1276
1277 } else { 1277 } else {
1278 emit tempDisableBR(false); 1278 emit tempDisableBR(false);
1279 return; 1279 return;
1280 } 1280 }
1281 if ( loadSuccess ) { 1281 if ( loadSuccess ) {
1282 getEventViewerDialog()->setSyncMode( true ); 1282 getEventViewerDialog()->setSyncMode( true );
1283 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1283 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1284 getEventViewerDialog()->setSyncMode( false ); 1284 getEventViewerDialog()->setSyncMode( false );
1285 qApp->processEvents(); 1285 qApp->processEvents();
1286 if ( syncOK ) { 1286 if ( syncOK ) {
1287 if ( mSyncManager->mWriteBackFile ) 1287 if ( mSyncManager->mWriteBackFile )
1288 { 1288 {
1289 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1289 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1290 Incidence* inc = iL.first(); 1290 Incidence* inc = iL.first();
1291 if ( phoneFormat ) { 1291 if ( phoneFormat ) {
1292 while ( inc ) { 1292 while ( inc ) {
1293 inc->removeID(mCurrentSyncDevice); 1293 inc->removeID(mCurrentSyncDevice);
1294 inc = iL.next(); 1294 inc = iL.next();
1295 } 1295 }
1296 } 1296 }
1297#ifndef DESKTOP_VERSION 1297#ifndef DESKTOP_VERSION
1298 if ( sharpFormat ) 1298 if ( sharpFormat )
1299 sharpFormat->save(calendar); 1299 sharpFormat->save(calendar);
1300#endif 1300#endif
1301 if ( phoneFormat ) 1301 if ( phoneFormat )
1302 phoneFormat->save(calendar); 1302 phoneFormat->save(calendar);
1303 iL = calendar->rawIncidences(); 1303 iL = calendar->rawIncidences();
1304 inc = iL.first(); 1304 inc = iL.first();
1305 Incidence* loc; 1305 Incidence* loc;
1306 while ( inc ) { 1306 while ( inc ) {
1307 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1307 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1308 loc = mCalendar->incidence(inc->uid() ); 1308 loc = mCalendar->incidence(inc->uid() );
1309 if ( loc ) { 1309 if ( loc ) {
1310 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1310 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1311 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1311 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1312 } 1312 }
1313 } 1313 }
1314 inc = iL.next(); 1314 inc = iL.next();
1315 } 1315 }
1316 Incidence* lse = getLastSyncEvent(); 1316 Incidence* lse = getLastSyncEvent();
1317 if ( lse ) { 1317 if ( lse ) {
1318 lse->setReadOnly( false ); 1318 lse->setReadOnly( false );
1319 lse->setDescription( "" ); 1319 lse->setDescription( "" );
1320 lse->setReadOnly( true ); 1320 lse->setReadOnly( true );
1321 } 1321 }
1322 } 1322 }
1323 } else { 1323 } else {
1324 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1324 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1325 } 1325 }
1326 setModified( true ); 1326 setModified( true );
1327 } else { 1327 } else {
1328 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1328 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1329 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1329 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1330 question, i18n("Ok")) ; 1330 question, i18n("Ok")) ;
1331 1331
1332 } 1332 }
1333 delete calendar; 1333 delete calendar;
1334 updateView(); 1334 updateView();
1335 emit tempDisableBR(false); 1335 emit tempDisableBR(false);
1336 return ;//syncOK; 1336 return ;//syncOK;
1337 1337
1338} 1338}
1339 1339
1340bool CalendarView::importBday() 1340bool CalendarView::importBday()
1341{ 1341{
1342#ifndef KORG_NOKABC 1342#ifndef KORG_NOKABC
1343 1343
1344#ifdef DESKTOP_VERSION 1344#ifdef DESKTOP_VERSION
1345 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1345 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1346 KABC::AddressBook::Iterator it; 1346 KABC::AddressBook::Iterator it;
1347 int count = 0; 1347 int count = 0;
1348 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1348 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1349 ++count; 1349 ++count;
1350 } 1350 }
1351 QProgressBar bar(count,0 ); 1351 QProgressBar bar(count,0 );
1352 int w = 300; 1352 int w = 300;
1353 if ( QApplication::desktop()->width() < 320 ) 1353 if ( QApplication::desktop()->width() < 320 )
1354 w = 220; 1354 w = 220;
1355 int h = bar.sizeHint().height() ; 1355 int h = bar.sizeHint().height() ;
1356 int dw = QApplication::desktop()->width(); 1356 int dw = QApplication::desktop()->width();
1357 int dh = QApplication::desktop()->height(); 1357 int dh = QApplication::desktop()->height();
1358 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1358 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1359 bar.show(); 1359 bar.show();
1360 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1360 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1361 qApp->processEvents(); 1361 qApp->processEvents();
1362 count = 0; 1362 count = 0;
1363 int addCount = 0; 1363 int addCount = 0;
1364 KCal::Attendee* a = 0; 1364 KCal::Attendee* a = 0;
1365 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1365 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1366 if ( ! bar.isVisible() ) 1366 if ( ! bar.isVisible() )
1367 return false; 1367 return false;
1368 bar.setProgress( count++ ); 1368 bar.setProgress( count++ );
1369 qApp->processEvents(); 1369 qApp->processEvents();
1370 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1370 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1371 if ( (*it).birthday().date().isValid() ){ 1371 if ( (*it).birthday().date().isValid() ){
1372 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1372 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1373 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1373 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1374 ++addCount; 1374 ++addCount;
1375 } 1375 }
1376 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1376 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1377 if ( anni.isValid() ){ 1377 if ( anni.isValid() ){
1378 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1378 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1379 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1379 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1380 ++addCount; 1380 ++addCount;
1381 } 1381 }
1382 } 1382 }
1383 updateView(); 1383 updateView();
1384 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1384 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1385#else //DESKTOP_VERSION 1385#else //DESKTOP_VERSION
1386 1386
1387 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1387 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1388 // the result should now arrive through method insertBirthdays 1388 // the result should now arrive through method insertBirthdays
1389 1389
1390#endif //DESKTOP_VERSION 1390#endif //DESKTOP_VERSION
1391 1391
1392#endif //KORG_NOKABC 1392#endif //KORG_NOKABC
1393 1393
1394 1394
1395 return true; 1395 return true;
1396} 1396}
1397 1397
1398// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1398// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1399void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1399void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1400 const QStringList& anniversaryList, const QStringList& realNameList, 1400 const QStringList& anniversaryList, const QStringList& realNameList,
1401 const QStringList& emailList, const QStringList& assembledNameList, 1401 const QStringList& emailList, const QStringList& assembledNameList,
1402 const QStringList& uidList) 1402 const QStringList& uidList)
1403{ 1403{
1404 qDebug("CalendarView::insertBirthdays"); 1404 qDebug("CalendarView::insertBirthdays");
1405 if (uid == this->name()) 1405 if (uid == this->name())
1406 { 1406 {
1407 int count = birthdayList.count(); 1407 int count = birthdayList.count();
1408 int addCount = 0; 1408 int addCount = 0;
1409 KCal::Attendee* a = 0; 1409 KCal::Attendee* a = 0;
1410 1410
1411 qDebug("CalView 1 %i", count); 1411 qDebug("CalView 1 %i", count);
1412 1412
1413 QProgressBar bar(count,0 ); 1413 QProgressBar bar(count,0 );
1414 int w = 300; 1414 int w = 300;
1415 if ( QApplication::desktop()->width() < 320 ) 1415 if ( QApplication::desktop()->width() < 320 )
1416 w = 220; 1416 w = 220;
1417 int h = bar.sizeHint().height() ; 1417 int h = bar.sizeHint().height() ;
1418 int dw = QApplication::desktop()->width(); 1418 int dw = QApplication::desktop()->width();
1419 int dh = QApplication::desktop()->height(); 1419 int dh = QApplication::desktop()->height();
1420 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1420 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1421 bar.show(); 1421 bar.show();
1422 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1422 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1423 qApp->processEvents(); 1423 qApp->processEvents();
1424 1424
1425 QDate birthday; 1425 QDate birthday;
1426 QDate anniversary; 1426 QDate anniversary;
1427 QString realName; 1427 QString realName;
1428 QString email; 1428 QString email;
1429 QString assembledName; 1429 QString assembledName;
1430 QString uid; 1430 QString uid;
1431 bool ok = true; 1431 bool ok = true;
1432 for ( int i = 0; i < count; i++) 1432 for ( int i = 0; i < count; i++)
1433 { 1433 {
1434 if ( ! bar.isVisible() ) 1434 if ( ! bar.isVisible() )
1435 return; 1435 return;
1436 bar.setProgress( i ); 1436 bar.setProgress( i );
1437 qApp->processEvents(); 1437 qApp->processEvents();
1438 1438
1439 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1439 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1440 if (!ok) { 1440 if (!ok) {
1441 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1441 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1442 } 1442 }
1443 1443
1444 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1444 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1445 if (!ok) { 1445 if (!ok) {
1446 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1446 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1447 } 1447 }
1448 realName = realNameList[i]; 1448 realName = realNameList[i];
1449 email = emailList[i]; 1449 email = emailList[i];
1450 assembledName = assembledNameList[i]; 1450 assembledName = assembledNameList[i];
1451 uid = uidList[i]; 1451 uid = uidList[i];
1452 //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() ); 1452 //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() );
1453 1453
1454 if ( birthday.isValid() ){ 1454 if ( birthday.isValid() ){
1455 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1455 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1456 KCal::Attendee::ReqParticipant,uid) ; 1456 KCal::Attendee::ReqParticipant,uid) ;
1457 if ( addAnniversary( birthday, assembledName, a, true ) ) 1457 if ( addAnniversary( birthday, assembledName, a, true ) )
1458 ++addCount; 1458 ++addCount;
1459 } 1459 }
1460 1460
1461 if ( anniversary.isValid() ){ 1461 if ( anniversary.isValid() ){
1462 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1462 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1463 KCal::Attendee::ReqParticipant,uid) ; 1463 KCal::Attendee::ReqParticipant,uid) ;
1464 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1464 if ( addAnniversary( anniversary, assembledName, a, false ) )
1465 ++addCount; 1465 ++addCount;
1466 } 1466 }
1467 } 1467 }
1468 1468
1469 updateView(); 1469 updateView();
1470 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1470 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1471 1471
1472 } 1472 }
1473 1473
1474} 1474}
1475 1475
1476 1476
1477 1477
1478bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1478bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1479{ 1479{
1480 //qDebug("addAnni "); 1480 //qDebug("addAnni ");
1481 Event * ev = new Event(); 1481 Event * ev = new Event();
1482 if ( a ) { 1482 if ( a ) {
1483 ev->addAttendee( a ); 1483 ev->addAttendee( a );
1484 } 1484 }
1485 QString kind; 1485 QString kind;
1486 if ( birthday ) 1486 if ( birthday )
1487 kind = i18n( "Birthday" ); 1487 kind = i18n( "Birthday" );
1488 else 1488 else
1489 kind = i18n( "Anniversary" ); 1489 kind = i18n( "Anniversary" );
1490 ev->setSummary( name + " - " + kind ); 1490 ev->setSummary( name + " - " + kind );
1491 ev->setOrganizer(a->email()); 1491 ev->setOrganizer(a->email());
1492 ev->setCategories( kind ); 1492 ev->setCategories( kind );
1493 ev->setDtStart( QDateTime(date) ); 1493 ev->setDtStart( QDateTime(date) );
1494 ev->setDtEnd( QDateTime(date) ); 1494 ev->setDtEnd( QDateTime(date) );
1495 ev->setFloats( true ); 1495 ev->setFloats( true );
1496 Recurrence * rec = ev->recurrence(); 1496 Recurrence * rec = ev->recurrence();
1497 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1497 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1498 rec->addYearlyNum( date.month() ); 1498 rec->addYearlyNum( date.month() );
1499 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1499 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1500 delete ev; 1500 delete ev;
1501 return false; 1501 return false;
1502 } 1502 }
1503 return true; 1503 return true;
1504 1504
1505} 1505}
1506bool CalendarView::importQtopia( const QString &categories, 1506bool CalendarView::importQtopia( const QString &categories,
1507 const QString &datebook, 1507 const QString &datebook,
1508 const QString &todolist ) 1508 const QString &todolist )
1509{ 1509{
1510 1510
1511 QtopiaFormat qtopiaFormat; 1511 QtopiaFormat qtopiaFormat;
1512 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1512 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1513 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1513 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1514 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1514 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1515 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1515 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1516 1516
1517 updateView(); 1517 updateView();
1518 return true; 1518 return true;
1519 1519
1520#if 0 1520#if 0
1521 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1521 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1522 mCurrentSyncDevice = "qtopia-XML"; 1522 mCurrentSyncDevice = "qtopia-XML";
1523 if ( mSyncManager->mAskForPreferences ) 1523 if ( mSyncManager->mAskForPreferences )
1524 edit_sync_options(); 1524 edit_sync_options();
1525 qApp->processEvents(); 1525 qApp->processEvents();
1526 CalendarLocal* calendar = new CalendarLocal(); 1526 CalendarLocal* calendar = new CalendarLocal();
1527 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1527 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1528 bool syncOK = false; 1528 bool syncOK = false;
1529 QtopiaFormat qtopiaFormat; 1529 QtopiaFormat qtopiaFormat;
1530 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1530 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1531 bool loadOk = true; 1531 bool loadOk = true;
1532 if ( !categories.isEmpty() ) 1532 if ( !categories.isEmpty() )
1533 loadOk = qtopiaFormat.load( calendar, categories ); 1533 loadOk = qtopiaFormat.load( calendar, categories );
1534 if ( loadOk && !datebook.isEmpty() ) 1534 if ( loadOk && !datebook.isEmpty() )
1535 loadOk = qtopiaFormat.load( calendar, datebook ); 1535 loadOk = qtopiaFormat.load( calendar, datebook );
1536 if ( loadOk && !todolist.isEmpty() ) 1536 if ( loadOk && !todolist.isEmpty() )
1537 loadOk = qtopiaFormat.load( calendar, todolist ); 1537 loadOk = qtopiaFormat.load( calendar, todolist );
1538 1538
1539 if ( loadOk ) { 1539 if ( loadOk ) {
1540 getEventViewerDialog()->setSyncMode( true ); 1540 getEventViewerDialog()->setSyncMode( true );
1541 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1541 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1542 getEventViewerDialog()->setSyncMode( false ); 1542 getEventViewerDialog()->setSyncMode( false );
1543 qApp->processEvents(); 1543 qApp->processEvents();
1544 if ( syncOK ) { 1544 if ( syncOK ) {
1545 if ( mSyncManager->mWriteBackFile ) 1545 if ( mSyncManager->mWriteBackFile )
1546 { 1546 {
1547 // write back XML file 1547 // write back XML file
1548 1548
1549 } 1549 }
1550 setModified( true ); 1550 setModified( true );
1551 } 1551 }
1552 } else { 1552 } else {
1553 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1553 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1554 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1554 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1555 question, i18n("Ok")) ; 1555 question, i18n("Ok")) ;
1556 } 1556 }
1557 delete calendar; 1557 delete calendar;
1558 updateView(); 1558 updateView();
1559 return syncOK; 1559 return syncOK;
1560 1560
1561 1561
1562#endif 1562#endif
1563 1563
1564} 1564}
1565 1565
1566void CalendarView::setSyncEventsReadOnly() 1566void CalendarView::setSyncEventsReadOnly()
1567{ 1567{
1568 Event * ev; 1568 Event * ev;
1569 QPtrList<Event> eL = mCalendar->rawEvents(); 1569 QPtrList<Event> eL = mCalendar->rawEvents();
1570 ev = eL.first(); 1570 ev = eL.first();
1571 while ( ev ) { 1571 while ( ev ) {
1572 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1572 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1573 ev->setReadOnly( true ); 1573 ev->setReadOnly( true );
1574 ev = eL.next(); 1574 ev = eL.next();
1575 } 1575 }
1576} 1576}
1577bool CalendarView::openCalendar(QString filename, bool merge) 1577bool CalendarView::openCalendar(QString filename, bool merge)
1578{ 1578{
1579 1579
1580 if (filename.isEmpty()) { 1580 if (filename.isEmpty()) {
1581 return false; 1581 return false;
1582 } 1582 }
1583 1583
1584 if (!QFile::exists(filename)) { 1584 if (!QFile::exists(filename)) {
1585 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1585 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1586 return false; 1586 return false;
1587 } 1587 }
1588 1588
1589 globalFlagBlockAgenda = 1; 1589 globalFlagBlockAgenda = 1;
1590 if (!merge) mCalendar->close(); 1590 if (!merge) mCalendar->close();
1591 1591
1592 mStorage->setFileName( filename ); 1592 mStorage->setFileName( filename );
1593 1593
1594 if ( mStorage->load() ) { 1594 if ( mStorage->load() ) {
1595 if ( merge ) ;//setModified( true ); 1595 if ( merge ) ;//setModified( true );
1596 else { 1596 else {
1597 //setModified( true ); 1597 //setModified( true );
1598 mViewManager->setDocumentId( filename ); 1598 mViewManager->setDocumentId( filename );
1599 mDialogManager->setDocumentId( filename ); 1599 mDialogManager->setDocumentId( filename );
1600 mTodoList->setDocumentId( filename ); 1600 mTodoList->setDocumentId( filename );
1601 } 1601 }
1602 globalFlagBlockAgenda = 2; 1602 globalFlagBlockAgenda = 2;
1603 // if ( getLastSyncEvent() ) 1603 // if ( getLastSyncEvent() )
1604 // getLastSyncEvent()->setReadOnly( true ); 1604 // getLastSyncEvent()->setReadOnly( true );
1605 mCalendar->reInitAlarmSettings(); 1605 mCalendar->reInitAlarmSettings();
1606 setSyncEventsReadOnly(); 1606 setSyncEventsReadOnly();
1607 updateUnmanagedViews(); 1607 updateUnmanagedViews();
1608 updateView(); 1608 updateView();
1609 if ( filename != MainWindow::defaultFileName() ) { 1609 if ( filename != MainWindow::defaultFileName() ) {
1610 saveCalendar( MainWindow::defaultFileName() ); 1610 saveCalendar( MainWindow::defaultFileName() );
1611 } else { 1611 } else {
1612 QFileInfo finf ( MainWindow::defaultFileName()); 1612 QFileInfo finf ( MainWindow::defaultFileName());
1613 if ( finf.exists() ) { 1613 if ( finf.exists() ) {
1614 setLoadedFileVersion( finf.lastModified () ); 1614 setLoadedFileVersion( finf.lastModified () );
1615 } 1615 }
1616 } 1616 }
1617 return true; 1617 return true;
1618 } else { 1618 } else {
1619 // while failing to load, the calendar object could 1619 // while failing to load, the calendar object could
1620 // have become partially populated. Clear it out. 1620 // have become partially populated. Clear it out.
1621 if ( !merge ) { 1621 if ( !merge ) {
1622 mCalendar->close(); 1622 mCalendar->close();
1623 mViewManager->setDocumentId( filename ); 1623 mViewManager->setDocumentId( filename );
1624 mDialogManager->setDocumentId( filename ); 1624 mDialogManager->setDocumentId( filename );
1625 mTodoList->setDocumentId( filename ); 1625 mTodoList->setDocumentId( filename );
1626 } 1626 }
1627 1627
1628 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1628 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1629 1629
1630 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1630 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1631 globalFlagBlockAgenda = 2; 1631 globalFlagBlockAgenda = 2;
1632 mCalendar->reInitAlarmSettings(); 1632 mCalendar->reInitAlarmSettings();
1633 setSyncEventsReadOnly(); 1633 setSyncEventsReadOnly();
1634 updateUnmanagedViews(); 1634 updateUnmanagedViews();
1635 updateView(); 1635 updateView();
1636 } 1636 }
1637 return false; 1637 return false;
1638} 1638}
1639void CalendarView::showOpenError() 1639void CalendarView::showOpenError()
1640{ 1640{
1641 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1641 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1642} 1642}
1643void CalendarView::setLoadedFileVersion(QDateTime dt) 1643void CalendarView::setLoadedFileVersion(QDateTime dt)
1644{ 1644{
1645 loadedFileVersion = dt; 1645 loadedFileVersion = dt;
1646} 1646}
1647bool CalendarView::checkFileChanged(QString fn) 1647bool CalendarView::checkFileChanged(QString fn)
1648{ 1648{
1649 QFileInfo finf ( fn ); 1649 QFileInfo finf ( fn );
1650 if ( !finf.exists() ) 1650 if ( !finf.exists() )
1651 return true; 1651 return true;
1652 QDateTime dt = finf.lastModified (); 1652 QDateTime dt = finf.lastModified ();
1653 if ( dt <= loadedFileVersion ) 1653 if ( dt <= loadedFileVersion )
1654 return false; 1654 return false;
1655 return true; 1655 return true;
1656 1656
1657} 1657}
1658void CalendarView::watchSavedFile() 1658void CalendarView::watchSavedFile()
1659{ 1659{
1660 QFileInfo finf ( MainWindow::defaultFileName()); 1660 QFileInfo finf ( MainWindow::defaultFileName());
1661 if ( !finf.exists() ) 1661 if ( !finf.exists() )
1662 return; 1662 return;
1663 QDateTime dt = finf.lastModified (); 1663 QDateTime dt = finf.lastModified ();
1664 if ( dt < loadedFileVersion ) { 1664 if ( dt < loadedFileVersion ) {
1665 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1665 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1666 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1666 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1667 return; 1667 return;
1668 } 1668 }
1669 loadedFileVersion = dt; 1669 loadedFileVersion = dt;
1670} 1670}
1671 1671
1672bool CalendarView::checkFileVersion(QString fn) 1672bool CalendarView::checkFileVersion(QString fn)
1673{ 1673{
1674 QFileInfo finf ( fn ); 1674 QFileInfo finf ( fn );
1675 if ( !finf.exists() ) 1675 if ( !finf.exists() )
1676 return true; 1676 return true;
1677 QDateTime dt = finf.lastModified (); 1677 QDateTime dt = finf.lastModified ();
1678 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1678 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1679 //qDebug("file on disk version %s",dt.toString().latin1()); 1679 //qDebug("file on disk version %s",dt.toString().latin1());
1680 if ( dt <= loadedFileVersion ) 1680 if ( dt <= loadedFileVersion )
1681 return true; 1681 return true;
1682 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)) , 1682 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)) ,
1683 i18n("KO/Pi Warning"),i18n("Overwrite"), 1683 i18n("KO/Pi Warning"),i18n("Overwrite"),
1684 i18n("Sync+save")); 1684 i18n("Sync+save"));
1685 1685
1686 if ( km == KMessageBox::Cancel ) 1686 if ( km == KMessageBox::Cancel )
1687 return false; 1687 return false;
1688 if ( km == KMessageBox::Yes ) 1688 if ( km == KMessageBox::Yes )
1689 return true; 1689 return true;
1690 1690
1691 setSyncDevice("deleteaftersync" ); 1691 setSyncDevice("deleteaftersync" );
1692 mSyncManager->mAskForPreferences = true; 1692 mSyncManager->mAskForPreferences = true;
1693 mSyncManager->mSyncAlgoPrefs = 3; 1693 mSyncManager->mSyncAlgoPrefs = 3;
1694 mSyncManager->mWriteBackFile = false; 1694 mSyncManager->mWriteBackFile = false;
1695 mSyncManager->mWriteBackExistingOnly = false; 1695 mSyncManager->mWriteBackExistingOnly = false;
1696 mSyncManager->mShowSyncSummary = false; 1696 mSyncManager->mShowSyncSummary = false;
1697 syncCalendar( fn, 3 ); 1697 syncCalendar( fn, 3 );
1698 Event * e = getLastSyncEvent(); 1698 Event * e = getLastSyncEvent();
1699 mCalendar->deleteEvent ( e ); 1699 mCalendar->deleteEvent ( e );
1700 updateView(); 1700 updateView();
1701 return true; 1701 return true;
1702} 1702}
1703 1703
1704bool CalendarView::saveCalendar( QString filename ) 1704bool CalendarView::saveCalendar( QString filename )
1705{ 1705{
1706 1706
1707 // Store back all unsaved data into calendar object 1707 // Store back all unsaved data into calendar object
1708 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1708 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1709 if ( mViewManager->currentView() ) 1709 if ( mViewManager->currentView() )
1710 mViewManager->currentView()->flushView(); 1710 mViewManager->currentView()->flushView();
1711 1711
1712 1712
1713 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1713 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1714 mStorage->setSaveFormat( new ICalFormat() ); 1714 mStorage->setSaveFormat( new ICalFormat() );
1715 mStorage->setFileName( filename ); 1715 mStorage->setFileName( filename );
1716 bool success; 1716 bool success;
1717 success = mStorage->save(); 1717 success = mStorage->save();
1718 if ( !success ) { 1718 if ( !success ) {
1719 return false; 1719 return false;
1720 } 1720 }
1721 if ( filename == MainWindow::defaultFileName() ) { 1721 if ( filename == MainWindow::defaultFileName() ) {
1722 setLoadedFileVersion( lfv ); 1722 setLoadedFileVersion( lfv );
1723 watchSavedFile(); 1723 watchSavedFile();
1724 } 1724 }
1725 return true; 1725 return true;
1726} 1726}
1727 1727
1728void CalendarView::closeCalendar() 1728void CalendarView::closeCalendar()
1729{ 1729{
1730 1730
1731 // child windows no longer valid 1731 // child windows no longer valid
1732 emit closingDown(); 1732 emit closingDown();
1733 1733
1734 mCalendar->close(); 1734 mCalendar->close();
1735 setModified(false); 1735 setModified(false);
1736 updateView(); 1736 updateView();
1737} 1737}
1738 1738
1739void CalendarView::archiveCalendar() 1739void CalendarView::archiveCalendar()
1740{ 1740{
1741 mDialogManager->showArchiveDialog(); 1741 mDialogManager->showArchiveDialog();
1742} 1742}
1743 1743
1744 1744
1745void CalendarView::readSettings() 1745void CalendarView::readSettings()
1746{ 1746{
1747 1747
1748 1748
1749 // mViewManager->showAgendaView(); 1749 // mViewManager->showAgendaView();
1750 QString str; 1750 QString str;
1751 //qDebug("CalendarView::readSettings() "); 1751 //qDebug("CalendarView::readSettings() ");
1752 // read settings from the KConfig, supplying reasonable 1752 // read settings from the KConfig, supplying reasonable
1753 // defaults where none are to be found 1753 // defaults where none are to be found
1754 KConfig *config = KOGlobals::config(); 1754 KConfig *config = KOGlobals::config();
1755#ifndef KORG_NOSPLITTER 1755#ifndef KORG_NOSPLITTER
1756 config->setGroup("KOrganizer Geometry"); 1756 config->setGroup("KOrganizer Geometry");
1757 1757
1758 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1758 QValueList<int> sizes = config->readIntListEntry("Separator1");
1759 if (sizes.count() != 2) { 1759 if (sizes.count() != 2) {
1760 sizes << mDateNavigator->minimumSizeHint().width(); 1760 sizes << mDateNavigator->minimumSizeHint().width();
1761 sizes << 300; 1761 sizes << 300;
1762 } 1762 }
1763 mPanner->setSizes(sizes); 1763 mPanner->setSizes(sizes);
1764 1764
1765 sizes = config->readIntListEntry("Separator2"); 1765 sizes = config->readIntListEntry("Separator2");
1766 if ( ( mResourceView && sizes.count() == 4 ) || 1766 if ( ( mResourceView && sizes.count() == 4 ) ||
1767 ( !mResourceView && sizes.count() == 3 ) ) { 1767 ( !mResourceView && sizes.count() == 3 ) ) {
1768 mLeftSplitter->setSizes(sizes); 1768 mLeftSplitter->setSizes(sizes);
1769 } 1769 }
1770#endif 1770#endif
1771 globalFlagBlockAgenda = 1; 1771 globalFlagBlockAgenda = 1;
1772 mViewManager->showAgendaView(); 1772 mViewManager->showAgendaView();
1773 //mViewManager->readSettings( config ); 1773 //mViewManager->readSettings( config );
1774 mTodoList->restoreLayout(config,QString("Todo Layout")); 1774 mTodoList->restoreLayout(config,QString("Todo Layout"));
1775 readFilterSettings(config); 1775 readFilterSettings(config);
1776 config->setGroup( "Views" ); 1776 config->setGroup( "Views" );
1777 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1777 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1778 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1778 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1779 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1779 else if ( dateCount == 7 ) mNavigator->selectWeek();
1780 else mNavigator->selectDates( dateCount ); 1780 else mNavigator->selectDates( dateCount );
1781 // mViewManager->readSettings( config ); 1781 // mViewManager->readSettings( config );
1782 updateConfig(); 1782 updateConfig();
1783 globalFlagBlockAgenda = 2; 1783 globalFlagBlockAgenda = 2;
1784 mViewManager->readSettings( config ); 1784 mViewManager->readSettings( config );
1785#ifdef DESKTOP_VERSION 1785#ifdef DESKTOP_VERSION
1786 config->setGroup("WidgetLayout"); 1786 config->setGroup("WidgetLayout");
1787 QStringList list; 1787 QStringList list;
1788 list = config->readListEntry("MainLayout"); 1788 list = config->readListEntry("MainLayout");
1789 int x,y,w,h; 1789 int x,y,w,h;
1790 if ( ! list.isEmpty() ) { 1790 if ( ! list.isEmpty() ) {
1791 x = list[0].toInt(); 1791 x = list[0].toInt();
1792 y = list[1].toInt(); 1792 y = list[1].toInt();
1793 w = list[2].toInt(); 1793 w = list[2].toInt();
1794 h = list[3].toInt(); 1794 h = list[3].toInt();
1795 topLevelWidget()->setGeometry(x,y,w,h); 1795 topLevelWidget()->setGeometry(x,y,w,h);
1796 1796
1797 } else { 1797 } else {
1798 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1798 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1799 } 1799 }
1800 list = config->readListEntry("EditEventLayout"); 1800 list = config->readListEntry("EditEventLayout");
1801 if ( ! list.isEmpty() ) { 1801 if ( ! list.isEmpty() ) {
1802 x = list[0].toInt(); 1802 x = list[0].toInt();
1803 y = list[1].toInt(); 1803 y = list[1].toInt();
1804 w = list[2].toInt(); 1804 w = list[2].toInt();
1805 h = list[3].toInt(); 1805 h = list[3].toInt();
1806 mEventEditor->setGeometry(x,y,w,h); 1806 mEventEditor->setGeometry(x,y,w,h);
1807 1807
1808 } 1808 }
1809 list = config->readListEntry("EditTodoLayout"); 1809 list = config->readListEntry("EditTodoLayout");
1810 if ( ! list.isEmpty() ) { 1810 if ( ! list.isEmpty() ) {
1811 x = list[0].toInt(); 1811 x = list[0].toInt();
1812 y = list[1].toInt(); 1812 y = list[1].toInt();
1813 w = list[2].toInt(); 1813 w = list[2].toInt();
1814 h = list[3].toInt(); 1814 h = list[3].toInt();
1815 mTodoEditor->setGeometry(x,y,w,h); 1815 mTodoEditor->setGeometry(x,y,w,h);
1816 1816
1817 } 1817 }
1818 list = config->readListEntry("ViewerLayout"); 1818 list = config->readListEntry("ViewerLayout");
1819 if ( ! list.isEmpty() ) { 1819 if ( ! list.isEmpty() ) {
1820 x = list[0].toInt(); 1820 x = list[0].toInt();
1821 y = list[1].toInt(); 1821 y = list[1].toInt();
1822 w = list[2].toInt(); 1822 w = list[2].toInt();
1823 h = list[3].toInt(); 1823 h = list[3].toInt();
1824 getEventViewerDialog()->setGeometry(x,y,w,h); 1824 getEventViewerDialog()->setGeometry(x,y,w,h);
1825 } 1825 }
1826#endif 1826#endif
1827 1827
1828} 1828}
1829 1829
1830 1830
1831void CalendarView::writeSettings() 1831void CalendarView::writeSettings()
1832{ 1832{
1833 // kdDebug() << "CalendarView::writeSettings" << endl; 1833 // kdDebug() << "CalendarView::writeSettings" << endl;
1834 1834
1835 KConfig *config = KOGlobals::config(); 1835 KConfig *config = KOGlobals::config();
1836 1836
1837#ifndef KORG_NOSPLITTER 1837#ifndef KORG_NOSPLITTER
1838 config->setGroup("KOrganizer Geometry"); 1838 config->setGroup("KOrganizer Geometry");
1839 1839
1840 QValueList<int> list = mPanner->sizes(); 1840 QValueList<int> list = mPanner->sizes();
1841 config->writeEntry("Separator1",list); 1841 config->writeEntry("Separator1",list);
1842 1842
1843 list = mLeftSplitter->sizes(); 1843 list = mLeftSplitter->sizes();
1844 config->writeEntry("Separator2",list); 1844 config->writeEntry("Separator2",list);
1845#endif 1845#endif
1846 1846
1847 mViewManager->writeSettings( config ); 1847 mViewManager->writeSettings( config );
1848 mTodoList->saveLayout(config,QString("Todo Layout")); 1848 mTodoList->saveLayout(config,QString("Todo Layout"));
1849 mDialogManager->writeSettings( config ); 1849 mDialogManager->writeSettings( config );
1850 //KOPrefs::instance()->usrWriteConfig(); 1850 //KOPrefs::instance()->usrWriteConfig();
1851 KOPrefs::instance()->writeConfig(); 1851 KOPrefs::instance()->writeConfig();
1852 1852
1853 writeFilterSettings(config); 1853 writeFilterSettings(config);
1854 1854
1855 config->setGroup( "Views" ); 1855 config->setGroup( "Views" );
1856 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1856 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1857 1857
1858#ifdef DESKTOP_VERSION 1858#ifdef DESKTOP_VERSION
1859 config->setGroup("WidgetLayout"); 1859 config->setGroup("WidgetLayout");
1860 QStringList list ;//= config->readListEntry("MainLayout"); 1860 QStringList list ;//= config->readListEntry("MainLayout");
1861 int x,y,w,h; 1861 int x,y,w,h;
1862 QWidget* wid; 1862 QWidget* wid;
1863 wid = topLevelWidget(); 1863 wid = topLevelWidget();
1864 x = wid->geometry().x(); 1864 x = wid->geometry().x();
1865 y = wid->geometry().y(); 1865 y = wid->geometry().y();
1866 w = wid->width(); 1866 w = wid->width();
1867 h = wid->height(); 1867 h = wid->height();
1868 list.clear(); 1868 list.clear();
1869 list << QString::number( x ); 1869 list << QString::number( x );
1870 list << QString::number( y ); 1870 list << QString::number( y );
1871 list << QString::number( w ); 1871 list << QString::number( w );
1872 list << QString::number( h ); 1872 list << QString::number( h );
1873 config->writeEntry("MainLayout",list ); 1873 config->writeEntry("MainLayout",list );
1874 1874
1875 wid = mEventEditor; 1875 wid = mEventEditor;
1876 x = wid->geometry().x(); 1876 x = wid->geometry().x();
1877 y = wid->geometry().y(); 1877 y = wid->geometry().y();
1878 w = wid->width(); 1878 w = wid->width();
1879 h = wid->height(); 1879 h = wid->height();
1880 list.clear(); 1880 list.clear();
1881 list << QString::number( x ); 1881 list << QString::number( x );
1882 list << QString::number( y ); 1882 list << QString::number( y );
1883 list << QString::number( w ); 1883 list << QString::number( w );
1884 list << QString::number( h ); 1884 list << QString::number( h );
1885 config->writeEntry("EditEventLayout",list ); 1885 config->writeEntry("EditEventLayout",list );
1886 1886
1887 wid = mTodoEditor; 1887 wid = mTodoEditor;
1888 x = wid->geometry().x(); 1888 x = wid->geometry().x();
1889 y = wid->geometry().y(); 1889 y = wid->geometry().y();
1890 w = wid->width(); 1890 w = wid->width();
1891 h = wid->height(); 1891 h = wid->height();
1892 list.clear(); 1892 list.clear();
1893 list << QString::number( x ); 1893 list << QString::number( x );
1894 list << QString::number( y ); 1894 list << QString::number( y );
1895 list << QString::number( w ); 1895 list << QString::number( w );
1896 list << QString::number( h ); 1896 list << QString::number( h );
1897 config->writeEntry("EditTodoLayout",list ); 1897 config->writeEntry("EditTodoLayout",list );
1898 wid = getEventViewerDialog(); 1898 wid = getEventViewerDialog();
1899 x = wid->geometry().x(); 1899 x = wid->geometry().x();
1900 y = wid->geometry().y(); 1900 y = wid->geometry().y();
1901 w = wid->width(); 1901 w = wid->width();
1902 h = wid->height(); 1902 h = wid->height();
1903 list.clear(); 1903 list.clear();
1904 list << QString::number( x ); 1904 list << QString::number( x );
1905 list << QString::number( y ); 1905 list << QString::number( y );
1906 list << QString::number( w ); 1906 list << QString::number( w );
1907 list << QString::number( h ); 1907 list << QString::number( h );
1908 config->writeEntry("ViewerLayout",list ); 1908 config->writeEntry("ViewerLayout",list );
1909 wid = mDialogManager->getSearchDialog(); 1909 wid = mDialogManager->getSearchDialog();
1910 if ( wid ) { 1910 if ( wid ) {
1911 x = wid->geometry().x(); 1911 x = wid->geometry().x();
1912 y = wid->geometry().y(); 1912 y = wid->geometry().y();
1913 w = wid->width(); 1913 w = wid->width();
1914 h = wid->height(); 1914 h = wid->height();
1915 list.clear(); 1915 list.clear();
1916 list << QString::number( x ); 1916 list << QString::number( x );
1917 list << QString::number( y ); 1917 list << QString::number( y );
1918 list << QString::number( w ); 1918 list << QString::number( w );
1919 list << QString::number( h ); 1919 list << QString::number( h );
1920 config->writeEntry("SearchLayout",list ); 1920 config->writeEntry("SearchLayout",list );
1921 } 1921 }
1922#endif 1922#endif
1923 1923
1924 1924
1925 config->sync(); 1925 config->sync();
1926} 1926}
1927 1927
1928void CalendarView::readFilterSettings(KConfig *config) 1928void CalendarView::readFilterSettings(KConfig *config)
1929{ 1929{
1930 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1930 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1931 1931
1932 mFilters.clear(); 1932 mFilters.clear();
1933 1933
1934 config->setGroup("General"); 1934 config->setGroup("General");
1935 QStringList filterList = config->readListEntry("CalendarFilters"); 1935 QStringList filterList = config->readListEntry("CalendarFilters");
1936 1936
1937 QStringList::ConstIterator it = filterList.begin(); 1937 QStringList::ConstIterator it = filterList.begin();
1938 QStringList::ConstIterator end = filterList.end(); 1938 QStringList::ConstIterator end = filterList.end();
1939 while(it != end) { 1939 while(it != end) {
1940 // kdDebug() << " filter: " << (*it) << endl; 1940 // kdDebug() << " filter: " << (*it) << endl;
1941 1941
1942 CalFilter *filter; 1942 CalFilter *filter;
1943 filter = new CalFilter(*it); 1943 filter = new CalFilter(*it);
1944 config->setGroup("Filter_" + (*it)); 1944 config->setGroup("Filter_" + (*it));
1945 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1945 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1946 filter->setCriteria(config->readNumEntry("Criteria",0)); 1946 filter->setCriteria(config->readNumEntry("Criteria",0));
1947 filter->setCategoryList(config->readListEntry("CategoryList")); 1947 filter->setCategoryList(config->readListEntry("CategoryList"));
1948 mFilters.append(filter); 1948 mFilters.append(filter);
1949 1949
1950 ++it; 1950 ++it;
1951 } 1951 }
1952 1952
1953 if (mFilters.count() == 0) { 1953 if (mFilters.count() == 0) {
1954 CalFilter *filter = new CalFilter(i18n("Default")); 1954 CalFilter *filter = new CalFilter(i18n("Default"));
1955 mFilters.append(filter); 1955 mFilters.append(filter);
1956 } 1956 }
1957 mFilterView->updateFilters(); 1957 mFilterView->updateFilters();
1958 config->setGroup("FilterView"); 1958 config->setGroup("FilterView");
1959 1959
1960 mFilterView->blockSignals(true); 1960 mFilterView->blockSignals(true);
1961 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1961 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1962 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1962 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1963 mFilterView->blockSignals(false); 1963 mFilterView->blockSignals(false);
1964 // We do it manually to avoid it being done twice by the above calls 1964 // We do it manually to avoid it being done twice by the above calls
1965 updateFilter(); 1965 updateFilter();
1966} 1966}
1967 1967
1968void CalendarView::writeFilterSettings(KConfig *config) 1968void CalendarView::writeFilterSettings(KConfig *config)
1969{ 1969{
1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1971 1971
1972 QStringList filterList; 1972 QStringList filterList;
1973 1973
1974 CalFilter *filter = mFilters.first(); 1974 CalFilter *filter = mFilters.first();
1975 while(filter) { 1975 while(filter) {
1976 // kdDebug() << " fn: " << filter->name() << endl; 1976 // kdDebug() << " fn: " << filter->name() << endl;
1977 filterList << filter->name(); 1977 filterList << filter->name();
1978 config->setGroup("Filter_" + filter->name()); 1978 config->setGroup("Filter_" + filter->name());
1979 config->writeEntry("Criteria",filter->criteria()); 1979 config->writeEntry("Criteria",filter->criteria());
1980 config->writeEntry("CategoryList",filter->categoryList()); 1980 config->writeEntry("CategoryList",filter->categoryList());
1981 filter = mFilters.next(); 1981 filter = mFilters.next();
1982 } 1982 }
1983 config->setGroup("General"); 1983 config->setGroup("General");
1984 config->writeEntry("CalendarFilters",filterList); 1984 config->writeEntry("CalendarFilters",filterList);
1985 1985
1986 config->setGroup("FilterView"); 1986 config->setGroup("FilterView");
1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1989} 1989}
1990 1990
1991 1991
1992void CalendarView::goToday() 1992void CalendarView::goToday()
1993{ 1993{
1994 if ( mViewManager->currentView()->isMonthView() ) 1994 if ( mViewManager->currentView()->isMonthView() )
1995 mNavigator->selectTodayMonth(); 1995 mNavigator->selectTodayMonth();
1996 else 1996 else
1997 mNavigator->selectToday(); 1997 mNavigator->selectToday();
1998} 1998}
1999 1999
2000void CalendarView::goNext() 2000void CalendarView::goNext()
2001{ 2001{
2002 mNavigator->selectNext(); 2002 mNavigator->selectNext();
2003} 2003}
2004 2004
2005void CalendarView::goPrevious() 2005void CalendarView::goPrevious()
2006{ 2006{
2007 mNavigator->selectPrevious(); 2007 mNavigator->selectPrevious();
2008} 2008}
2009void CalendarView::goNextMonth() 2009void CalendarView::goNextMonth()
2010{ 2010{
2011 mNavigator->selectNextMonth(); 2011 mNavigator->selectNextMonth();
2012} 2012}
2013 2013
2014void CalendarView::goPreviousMonth() 2014void CalendarView::goPreviousMonth()
2015{ 2015{
2016 mNavigator->selectPreviousMonth(); 2016 mNavigator->selectPreviousMonth();
2017} 2017}
2018void CalendarView::writeLocale() 2018void CalendarView::writeLocale()
2019{ 2019{
2020 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2020 //KPimGlobalPrefs::instance()->setGlobalConfig();
2021#if 0 2021#if 0
2022 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2022 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2023 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2023 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2024 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2024 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2025 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2025 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2026 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2026 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2027 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2027 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2028 dummy = KOPrefs::instance()->mUserDateFormatShort; 2028 dummy = KOPrefs::instance()->mUserDateFormatShort;
2029 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2029 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2030 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2030 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2031 KOPrefs::instance()->mDaylightsavingStart, 2031 KOPrefs::instance()->mDaylightsavingStart,
2032 KOPrefs::instance()->mDaylightsavingEnd ); 2032 KOPrefs::instance()->mDaylightsavingEnd );
2033 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2033 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2034#endif 2034#endif
2035} 2035}
2036void CalendarView::updateConfig() 2036void CalendarView::updateConfig()
2037{ 2037{
2038 writeLocale(); 2038 writeLocale();
2039 if ( KOPrefs::instance()->mUseAppColors ) 2039 if ( KOPrefs::instance()->mUseAppColors )
2040 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2040 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2041 emit configChanged(); 2041 emit configChanged();
2042 mTodoList->updateConfig(); 2042 mTodoList->updateConfig();
2043 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2043 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2044 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2044 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2045 // To make the "fill window" configurations work 2045 // To make the "fill window" configurations work
2046 //mViewManager->raiseCurrentView(); 2046 //mViewManager->raiseCurrentView();
2047} 2047}
2048 2048
2049 2049
2050void CalendarView::eventChanged(Event *event) 2050void CalendarView::eventChanged(Event *event)
2051{ 2051{
2052 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2052 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2053 //updateUnmanagedViews(); 2053 //updateUnmanagedViews();
2054} 2054}
2055 2055
2056void CalendarView::eventAdded(Event *event) 2056void CalendarView::eventAdded(Event *event)
2057{ 2057{
2058 changeEventDisplay(event,KOGlobals::EVENTADDED); 2058 changeEventDisplay(event,KOGlobals::EVENTADDED);
2059} 2059}
2060 2060
2061void CalendarView::eventToBeDeleted(Event *) 2061void CalendarView::eventToBeDeleted(Event *)
2062{ 2062{
2063 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2063 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2064} 2064}
2065 2065
2066void CalendarView::eventDeleted() 2066void CalendarView::eventDeleted()
2067{ 2067{
2068 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2068 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2069} 2069}
2070void CalendarView::changeTodoDisplay(Todo *which, int action) 2070void CalendarView::changeTodoDisplay(Todo *which, int action)
2071{ 2071{
2072 changeIncidenceDisplay((Incidence *)which, action); 2072 changeIncidenceDisplay((Incidence *)which, action);
2073 mDateNavigator->updateView(); //LR 2073 mDateNavigator->updateView(); //LR
2074 //mDialogManager->updateSearchDialog(); 2074 //mDialogManager->updateSearchDialog();
2075 2075
2076 if (which) { 2076 if (which) {
2077 mViewManager->updateWNview(); 2077 mViewManager->updateWNview();
2078 //mTodoList->updateView(); 2078 //mTodoList->updateView();
2079 } 2079 }
2080 2080
2081} 2081}
2082 2082
2083void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2083void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2084{ 2084{
2085 updateUnmanagedViews(); 2085 updateUnmanagedViews();
2086 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2086 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2087 if ( action == KOGlobals::EVENTDELETED ) { //delete 2087 if ( action == KOGlobals::EVENTDELETED ) { //delete
2088 mCalendar->checkAlarmForIncidence( 0, true ); 2088 mCalendar->checkAlarmForIncidence( 0, true );
2089 if ( mEventViewerDialog ) 2089 if ( mEventViewerDialog )
2090 mEventViewerDialog->hide(); 2090 mEventViewerDialog->hide();
2091 } 2091 }
2092 else 2092 else
2093 mCalendar->checkAlarmForIncidence( which , false ); 2093 mCalendar->checkAlarmForIncidence( which , false );
2094} 2094}
2095 2095
2096// most of the changeEventDisplays() right now just call the view's 2096// most of the changeEventDisplays() right now just call the view's
2097// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2097// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2098void CalendarView::changeEventDisplay(Event *which, int action) 2098void CalendarView::changeEventDisplay(Event *which, int action)
2099{ 2099{
2100 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2100 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2101 changeIncidenceDisplay((Incidence *)which, action); 2101 changeIncidenceDisplay((Incidence *)which, action);
2102 mDateNavigator->updateView(); 2102 mDateNavigator->updateView();
2103 //mDialogManager->updateSearchDialog(); 2103 //mDialogManager->updateSearchDialog();
2104 2104
2105 if (which) { 2105 if (which) {
2106 // If there is an event view visible update the display 2106 // If there is an event view visible update the display
2107 mViewManager->currentView()->changeEventDisplay(which,action); 2107 mViewManager->currentView()->changeEventDisplay(which,action);
2108 // TODO: check, if update needed 2108 // TODO: check, if update needed
2109 // if (which->getTodoStatus()) { 2109 // if (which->getTodoStatus()) {
2110 mTodoList->updateView(); 2110 mTodoList->updateView();
2111 // } 2111 // }
2112 } else { 2112 } else {
2113 mViewManager->currentView()->updateView(); 2113 mViewManager->currentView()->updateView();
2114 } 2114 }
2115} 2115}
2116 2116
2117 2117
2118void CalendarView::updateTodoViews() 2118void CalendarView::updateTodoViews()
2119{ 2119{
2120 2120
2121 mTodoList->updateView(); 2121 mTodoList->updateView();
2122 mViewManager->currentView()->updateView(); 2122 mViewManager->currentView()->updateView();
2123 2123
2124} 2124}
2125 2125
2126 2126
2127void CalendarView::updateView(const QDate &start, const QDate &end) 2127void CalendarView::updateView(const QDate &start, const QDate &end)
2128{ 2128{
2129 mTodoList->updateView(); 2129 mTodoList->updateView();
2130 mViewManager->updateView(start, end); 2130 mViewManager->updateView(start, end);
2131 //mDateNavigator->updateView(); 2131 //mDateNavigator->updateView();
2132} 2132}
2133 2133
2134void CalendarView::updateView() 2134void CalendarView::updateView()
2135{ 2135{
2136 DateList tmpList = mNavigator->selectedDates(); 2136 DateList tmpList = mNavigator->selectedDates();
2137 2137
2138 // We assume that the navigator only selects consecutive days. 2138 // We assume that the navigator only selects consecutive days.
2139 updateView( tmpList.first(), tmpList.last() ); 2139 updateView( tmpList.first(), tmpList.last() );
2140} 2140}
2141 2141
2142void CalendarView::updateUnmanagedViews() 2142void CalendarView::updateUnmanagedViews()
2143{ 2143{
2144 mDateNavigator->updateDayMatrix(); 2144 mDateNavigator->updateDayMatrix();
2145} 2145}
2146 2146
2147int CalendarView::msgItemDelete() 2147int CalendarView::msgItemDelete()
2148{ 2148{
2149 return KMessageBox::warningContinueCancel(this, 2149 return KMessageBox::warningContinueCancel(this,
2150 i18n("This item will be\npermanently deleted."), 2150 i18n("This item will be\npermanently deleted."),
2151 i18n("KO/Pi Confirmation"),i18n("Delete")); 2151 i18n("KO/Pi Confirmation"),i18n("Delete"));
2152} 2152}
2153 2153
2154 2154
2155void CalendarView::edit_cut() 2155void CalendarView::edit_cut()
2156{ 2156{
2157 Event *anEvent=0; 2157 Event *anEvent=0;
2158 2158
2159 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2159 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2160 2160
2161 if (mViewManager->currentView()->isEventView()) { 2161 if (mViewManager->currentView()->isEventView()) {
2162 if ( incidence && incidence->type() == "Event" ) { 2162 if ( incidence && incidence->type() == "Event" ) {
2163 anEvent = static_cast<Event *>(incidence); 2163 anEvent = static_cast<Event *>(incidence);
2164 } 2164 }
2165 } 2165 }
2166 2166
2167 if (!anEvent) { 2167 if (!anEvent) {
2168 KNotifyClient::beep(); 2168 KNotifyClient::beep();
2169 return; 2169 return;
2170 } 2170 }
2171 DndFactory factory( mCalendar ); 2171 DndFactory factory( mCalendar );
2172 factory.cutEvent(anEvent); 2172 factory.cutEvent(anEvent);
2173 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2173 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2174} 2174}
2175 2175
2176void CalendarView::edit_copy() 2176void CalendarView::edit_copy()
2177{ 2177{
2178 Event *anEvent=0; 2178 Event *anEvent=0;
2179 2179
2180 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2180 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2181 2181
2182 if (mViewManager->currentView()->isEventView()) { 2182 if (mViewManager->currentView()->isEventView()) {
2183 if ( incidence && incidence->type() == "Event" ) { 2183 if ( incidence && incidence->type() == "Event" ) {
2184 anEvent = static_cast<Event *>(incidence); 2184 anEvent = static_cast<Event *>(incidence);
2185 } 2185 }
2186 } 2186 }
2187 2187
2188 if (!anEvent) { 2188 if (!anEvent) {
2189 KNotifyClient::beep(); 2189 KNotifyClient::beep();
2190 return; 2190 return;
2191 } 2191 }
2192 DndFactory factory( mCalendar ); 2192 DndFactory factory( mCalendar );
2193 factory.copyEvent(anEvent); 2193 factory.copyEvent(anEvent);
2194} 2194}
2195 2195
2196void CalendarView::edit_paste() 2196void CalendarView::edit_paste()
2197{ 2197{
2198 QDate date = mNavigator->selectedDates().first(); 2198 QDate date = mNavigator->selectedDates().first();
2199 2199
2200 DndFactory factory( mCalendar ); 2200 DndFactory factory( mCalendar );
2201 Event *pastedEvent = factory.pasteEvent( date ); 2201 Event *pastedEvent = factory.pasteEvent( date );
2202 2202
2203 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2203 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2204} 2204}
2205 2205
2206void CalendarView::edit_options() 2206void CalendarView::edit_options()
2207{ 2207{
2208 mDialogManager->showOptionsDialog(); 2208 mDialogManager->showOptionsDialog();
2209 //writeSettings(); 2209 //writeSettings();
2210} 2210}
2211 2211
2212void CalendarView::slotSelectPickerDate( QDate d) 2212void CalendarView::slotSelectPickerDate( QDate d)
2213{ 2213{
2214 mDateFrame->hide(); 2214 mDateFrame->hide();
2215 if ( mDatePickerMode == 1 ) { 2215 if ( mDatePickerMode == 1 ) {
2216 mNavigator->slotDaySelect( d ); 2216 mNavigator->slotDaySelect( d );
2217 } else if ( mDatePickerMode == 2 ) { 2217 } else if ( mDatePickerMode == 2 ) {
2218 if ( mMoveIncidence->type() == "Todo" ) { 2218 if ( mMoveIncidence->type() == "Todo" ) {
2219 Todo * to = (Todo *) mMoveIncidence; 2219 Todo * to = (Todo *) mMoveIncidence;
2220 QTime tim; 2220 QTime tim;
2221 if ( to->hasDueDate() ) 2221 if ( to->hasDueDate() )
2222 tim = to->dtDue().time(); 2222 tim = to->dtDue().time();
2223 else { 2223 else {
2224 tim = QTime ( 0,0,0 ); 2224 tim = QTime ( 0,0,0 );
2225 to->setFloats( true ); 2225 to->setFloats( true );
2226 to->setHasDueDate( true ); 2226 to->setHasDueDate( true );
2227 } 2227 }
2228 QDateTime dt ( d,tim ); 2228 QDateTime dt ( d,tim );
2229 to->setDtDue( dt ); 2229 to->setDtDue( dt );
2230 todoChanged( to ); 2230 todoChanged( to );
2231 } else { 2231 } else {
2232 QTime tim = mMoveIncidence->dtStart().time(); 2232 QTime tim = mMoveIncidence->dtStart().time();
2233 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2233 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2234 QDateTime dt ( d,tim ); 2234 QDateTime dt ( d,tim );
2235 mMoveIncidence->setDtStart( dt ); 2235 mMoveIncidence->setDtStart( dt );
2236 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2236 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2237 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2237 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2238 } 2238 }
2239 2239
2240 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2240 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2241 } 2241 }
2242} 2242}
2243 2243
2244void CalendarView::removeCategories() 2244void CalendarView::removeCategories()
2245{ 2245{
2246 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2246 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2247 QStringList catList = KOPrefs::instance()->mCustomCategories; 2247 QStringList catList = KOPrefs::instance()->mCustomCategories;
2248 QStringList catIncList; 2248 QStringList catIncList;
2249 QStringList newCatList; 2249 QStringList newCatList;
2250 Incidence* inc = incList.first(); 2250 Incidence* inc = incList.first();
2251 int i; 2251 int i;
2252 int count = 0; 2252 int count = 0;
2253 while ( inc ) { 2253 while ( inc ) {
2254 newCatList.clear(); 2254 newCatList.clear();
2255 catIncList = inc->categories() ; 2255 catIncList = inc->categories() ;
2256 for( i = 0; i< catIncList.count(); ++i ) { 2256 for( i = 0; i< catIncList.count(); ++i ) {
2257 if ( catList.contains (catIncList[i])) 2257 if ( catList.contains (catIncList[i]))
2258 newCatList.append( catIncList[i] ); 2258 newCatList.append( catIncList[i] );
2259 } 2259 }
2260 newCatList.sort(); 2260 newCatList.sort();
2261 inc->setCategories( newCatList.join(",") ); 2261 inc->setCategories( newCatList.join(",") );
2262 inc = incList.next(); 2262 inc = incList.next();
2263 } 2263 }
2264} 2264}
2265 2265
2266int CalendarView::addCategories() 2266int CalendarView::addCategories()
2267{ 2267{
2268 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2268 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2269 QStringList catList = KOPrefs::instance()->mCustomCategories; 2269 QStringList catList = KOPrefs::instance()->mCustomCategories;
2270 QStringList catIncList; 2270 QStringList catIncList;
2271 Incidence* inc = incList.first(); 2271 Incidence* inc = incList.first();
2272 int i; 2272 int i;
2273 int count = 0; 2273 int count = 0;
2274 while ( inc ) { 2274 while ( inc ) {
2275 catIncList = inc->categories() ; 2275 catIncList = inc->categories() ;
2276 for( i = 0; i< catIncList.count(); ++i ) { 2276 for( i = 0; i< catIncList.count(); ++i ) {
2277 if ( !catList.contains (catIncList[i])) { 2277 if ( !catList.contains (catIncList[i])) {
2278 catList.append( catIncList[i] ); 2278 catList.append( catIncList[i] );
2279 //qDebug("add cat %s ", catIncList[i].latin1()); 2279 //qDebug("add cat %s ", catIncList[i].latin1());
2280 ++count; 2280 ++count;
2281 } 2281 }
2282 } 2282 }
2283 inc = incList.next(); 2283 inc = incList.next();
2284 } 2284 }
2285 catList.sort(); 2285 catList.sort();
2286 KOPrefs::instance()->mCustomCategories = catList; 2286 KOPrefs::instance()->mCustomCategories = catList;
2287 return count; 2287 return count;
2288} 2288}
2289 2289
2290void CalendarView::manageCategories() 2290void CalendarView::manageCategories()
2291{ 2291{
2292 KOCatPrefs* cp = new KOCatPrefs(); 2292 KOCatPrefs* cp = new KOCatPrefs();
2293 cp->show(); 2293 cp->show();
2294 int w =cp->sizeHint().width() ; 2294 int w =cp->sizeHint().width() ;
2295 int h = cp->sizeHint().height() ; 2295 int h = cp->sizeHint().height() ;
2296 int dw = QApplication::desktop()->width(); 2296 int dw = QApplication::desktop()->width();
2297 int dh = QApplication::desktop()->height(); 2297 int dh = QApplication::desktop()->height();
2298 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2298 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2299 if ( !cp->exec() ) { 2299 if ( !cp->exec() ) {
2300 delete cp; 2300 delete cp;
2301 return; 2301 return;
2302 } 2302 }
2303 int count = 0; 2303 int count = 0;
2304 if ( cp->addCat() ) { 2304 if ( cp->addCat() ) {
2305 count = addCategories(); 2305 count = addCategories();
2306 if ( count ) { 2306 if ( count ) {
2307 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2307 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2308 writeSettings(); 2308 writeSettings();
2309 } else 2309 } else
2310 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2310 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2311 } else { 2311 } else {
2312 removeCategories(); 2312 removeCategories();
2313 updateView(); 2313 updateView();
2314 } 2314 }
2315 delete cp; 2315 delete cp;
2316} 2316}
2317 2317
2318void CalendarView::beamIncidence(Incidence * Inc) 2318void CalendarView::beamIncidence(Incidence * Inc)
2319{ 2319{
2320 QPtrList<Incidence> delSel ; 2320 QPtrList<Incidence> delSel ;
2321 delSel.append(Inc); 2321 delSel.append(Inc);
2322 beamIncidenceList( delSel ); 2322 beamIncidenceList( delSel );
2323} 2323}
2324void CalendarView::beamCalendar() 2324void CalendarView::beamCalendar()
2325{ 2325{
2326 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2326 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2327 //qDebug("beamCalendar() "); 2327 //qDebug("beamCalendar() ");
2328 beamIncidenceList( delSel ); 2328 beamIncidenceList( delSel );
2329} 2329}
2330void CalendarView::beamFilteredCalendar() 2330void CalendarView::beamFilteredCalendar()
2331{ 2331{
2332 QPtrList<Incidence> delSel = mCalendar->incidences(); 2332 QPtrList<Incidence> delSel = mCalendar->incidences();
2333 //qDebug("beamFilteredCalendar() "); 2333 //qDebug("beamFilteredCalendar() ");
2334 beamIncidenceList( delSel ); 2334 beamIncidenceList( delSel );
2335} 2335}
2336void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2336void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2337{ 2337{
2338 if ( beamDialog->exec () == QDialog::Rejected ) 2338 if ( beamDialog->exec () == QDialog::Rejected )
2339 return; 2339 return;
2340#ifdef DESKTOP_VERSION 2340#ifdef DESKTOP_VERSION
2341 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2341 QString fn = locateLocal( "tmp", "kopibeamfile" );
2342#else 2342#else
2343 QString fn = "/tmp/kopibeamfile"; 2343 QString fn = "/tmp/kopibeamfile";
2344#endif 2344#endif
2345 QString mes; 2345 QString mes;
2346 bool createbup = true; 2346 bool createbup = true;
2347 if ( createbup ) { 2347 if ( createbup ) {
2348 QString description = "\n"; 2348 QString description = "\n";
2349 CalendarLocal* cal = new CalendarLocal(); 2349 CalendarLocal* cal = new CalendarLocal();
2350 if ( beamDialog->beamLocal() ) 2350 if ( beamDialog->beamLocal() )
2351 cal->setLocalTime(); 2351 cal->setLocalTime();
2352 else 2352 else
2353 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2353 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2354 Incidence *incidence = delSel.first(); 2354 Incidence *incidence = delSel.first();
2355 bool addText = false; 2355 bool addText = false;
2356 if ( delSel.count() < 10 ) 2356 if ( delSel.count() < 10 )
2357 addText = true; 2357 addText = true;
2358 else { 2358 else {
2359 description.sprintf(i18n(" %d items?"),delSel.count() ); 2359 description.sprintf(i18n(" %d items?"),delSel.count() );
2360 } 2360 }
2361 while ( incidence ) { 2361 while ( incidence ) {
2362 Incidence *in = incidence->clone(); 2362 Incidence *in = incidence->clone();
2363 if ( ! in->summary().isEmpty() ) { 2363 if ( ! in->summary().isEmpty() ) {
2364 in->setDescription(""); 2364 in->setDescription("");
2365 } else { 2365 } else {
2366 in->setSummary( in->description().left(20)); 2366 in->setSummary( in->description().left(20));
2367 in->setDescription(""); 2367 in->setDescription("");
2368 } 2368 }
2369 if ( addText ) 2369 if ( addText )
2370 description += in->summary() + "\n"; 2370 description += in->summary() + "\n";
2371 cal->addIncidence( in ); 2371 cal->addIncidence( in );
2372 incidence = delSel.next(); 2372 incidence = delSel.next();
2373 } 2373 }
2374 if ( beamDialog->beamVcal() ) { 2374 if ( beamDialog->beamVcal() ) {
2375 fn += ".vcs"; 2375 fn += ".vcs";
2376 FileStorage storage( cal, fn, new VCalFormat ); 2376 FileStorage storage( cal, fn, new VCalFormat );
2377 storage.save(); 2377 storage.save();
2378 } else { 2378 } else {
2379 fn += ".ics"; 2379 fn += ".ics";
2380 FileStorage storage( cal, fn, new ICalFormat( ) ); 2380 FileStorage storage( cal, fn, new ICalFormat( ) );
2381 storage.save(); 2381 storage.save();
2382 } 2382 }
2383 delete cal; 2383 delete cal;
2384 mes = i18n("KO/Pi: Ready for beaming"); 2384 mes = i18n("KO/Pi: Ready for beaming");
2385 topLevelWidget()->setCaption(mes); 2385 topLevelWidget()->setCaption(mes);
2386 KApplication::convert2latin1( fn ); 2386 KApplication::convert2latin1( fn );
2387#ifndef DESKTOP_VERSION 2387#ifndef DESKTOP_VERSION
2388 Ir *ir = new Ir( this ); 2388 Ir *ir = new Ir( this );
2389 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2389 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2390 ir->send( fn, description, "text/x-vCalendar" ); 2390 ir->send( fn, description, "text/x-vCalendar" );
2391#endif 2391#endif
2392 } 2392 }
2393} 2393}
2394void CalendarView::beamDone( Ir *ir ) 2394void CalendarView::beamDone( Ir *ir )
2395{ 2395{
2396#ifndef DESKTOP_VERSION 2396#ifndef DESKTOP_VERSION
2397 delete ir; 2397 delete ir;
2398#endif 2398#endif
2399 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2399 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2400 topLevelWidget()->raise(); 2400 topLevelWidget()->raise();
2401} 2401}
2402 2402
2403void CalendarView::moveIncidence(Incidence * inc ) 2403void CalendarView::moveIncidence(Incidence * inc )
2404{ 2404{
2405 if ( !inc ) return; 2405 if ( !inc ) return;
2406 // qDebug("showDatePickerForIncidence( ) "); 2406 // qDebug("showDatePickerForIncidence( ) ");
2407 if ( mDateFrame->isVisible() ) 2407 if ( mDateFrame->isVisible() )
2408 mDateFrame->hide(); 2408 mDateFrame->hide();
2409 else { 2409 else {
2410 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2410 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2411 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2411 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2412 int dw = QApplication::desktop()->width(); 2412 int dw = QApplication::desktop()->width();
2413 int dh = QApplication::desktop()->height(); 2413 int dh = QApplication::desktop()->height();
2414 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2414 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2415 mDateFrame->show(); 2415 mDateFrame->show();
2416 } 2416 }
2417 mDatePickerMode = 2; 2417 mDatePickerMode = 2;
2418 mMoveIncidence = inc ; 2418 mMoveIncidence = inc ;
2419 QDate da; 2419 QDate da;
2420 if ( mMoveIncidence->type() == "Todo" ) { 2420 if ( mMoveIncidence->type() == "Todo" ) {
2421 Todo * to = (Todo *) mMoveIncidence; 2421 Todo * to = (Todo *) mMoveIncidence;
2422 if ( to->hasDueDate() ) 2422 if ( to->hasDueDate() )
2423 da = to->dtDue().date(); 2423 da = to->dtDue().date();
2424 else 2424 else
2425 da = QDate::currentDate(); 2425 da = QDate::currentDate();
2426 } else { 2426 } else {
2427 da = mMoveIncidence->dtStart().date(); 2427 da = mMoveIncidence->dtStart().date();
2428 } 2428 }
2429 mDatePicker->setDate( da ); 2429 mDatePicker->setDate( da );
2430} 2430}
2431void CalendarView::showDatePicker( ) 2431void CalendarView::showDatePicker( )
2432{ 2432{
2433 //qDebug("CalendarView::showDatePicker( ) "); 2433 //qDebug("CalendarView::showDatePicker( ) ");
2434 if ( mDateFrame->isVisible() ) 2434 if ( mDateFrame->isVisible() )
2435 mDateFrame->hide(); 2435 mDateFrame->hide();
2436 else { 2436 else {
2437 int w =mDatePicker->sizeHint().width() ; 2437 int w =mDatePicker->sizeHint().width() ;
2438 int h = mDatePicker->sizeHint().height() ; 2438 int h = mDatePicker->sizeHint().height() ;
2439 int dw = QApplication::desktop()->width(); 2439 int dw = QApplication::desktop()->width();
2440 int dh = QApplication::desktop()->height(); 2440 int dh = QApplication::desktop()->height();
2441 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2441 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2442 mDateFrame->show(); 2442 mDateFrame->show();
2443 } 2443 }
2444 mDatePickerMode = 1; 2444 mDatePickerMode = 1;
2445 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2445 mDatePicker->setDate( mNavigator->selectedDates().first() );
2446} 2446}
2447 2447
2448void CalendarView::showEventEditor() 2448void CalendarView::showEventEditor()
2449{ 2449{
2450#ifdef DESKTOP_VERSION 2450#ifdef DESKTOP_VERSION
2451 mEventEditor->show(); 2451 mEventEditor->show();
2452#else 2452#else
2453 if ( mEventEditor->width() != QApplication::desktop()->width() ) 2453 if ( mEventEditor->width() != QApplication::desktop()->width() ) {
2454 mEventEditor->hide(); 2454 qDebug("CalendarView: recreate mEventEditor ");
2455 delete mEventEditor;
2456 mEventEditor = mDialogManager->getEventEditor();
2457 }
2455 mEventEditor->showMaximized(); 2458 mEventEditor->showMaximized();
2456#endif 2459#endif
2457} 2460}
2458void CalendarView::showTodoEditor() 2461void CalendarView::showTodoEditor()
2459{ 2462{
2460#ifdef DESKTOP_VERSION 2463#ifdef DESKTOP_VERSION
2461 mTodoEditor->show(); 2464 mTodoEditor->show();
2462#else 2465#else
2463 if ( mTodoEditor->width() != QApplication::desktop()->width() ) 2466 if ( mTodoEditor->width() != QApplication::desktop()->width() ) {
2464 mTodoEditor->hide(); 2467 qDebug("CalendarView: recreate mTodoEditor ");
2468 delete mTodoEditor;
2469 mTodoEditor = mDialogManager->getTodoEditor();
2470 }
2465 mTodoEditor->showMaximized(); 2471 mTodoEditor->showMaximized();
2466#endif 2472#endif
2467} 2473}
2468 2474
2469void CalendarView::cloneIncidence() 2475void CalendarView::cloneIncidence()
2470{ 2476{
2471 Incidence *incidence = currentSelection(); 2477 Incidence *incidence = currentSelection();
2472 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2478 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2473 if ( incidence ) { 2479 if ( incidence ) {
2474 cloneIncidence(incidence); 2480 cloneIncidence(incidence);
2475 } 2481 }
2476} 2482}
2477void CalendarView::moveIncidence() 2483void CalendarView::moveIncidence()
2478{ 2484{
2479 Incidence *incidence = currentSelection(); 2485 Incidence *incidence = currentSelection();
2480 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2486 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2481 if ( incidence ) { 2487 if ( incidence ) {
2482 moveIncidence(incidence); 2488 moveIncidence(incidence);
2483 } 2489 }
2484} 2490}
2485void CalendarView::beamIncidence() 2491void CalendarView::beamIncidence()
2486{ 2492{
2487 Incidence *incidence = currentSelection(); 2493 Incidence *incidence = currentSelection();
2488 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2494 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2489 if ( incidence ) { 2495 if ( incidence ) {
2490 beamIncidence(incidence); 2496 beamIncidence(incidence);
2491 } 2497 }
2492} 2498}
2493void CalendarView::toggleCancelIncidence() 2499void CalendarView::toggleCancelIncidence()
2494{ 2500{
2495 Incidence *incidence = currentSelection(); 2501 Incidence *incidence = currentSelection();
2496 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2502 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2497 if ( incidence ) { 2503 if ( incidence ) {
2498 cancelIncidence(incidence); 2504 cancelIncidence(incidence);
2499 } 2505 }
2500} 2506}
2501 2507
2502 2508
2503void CalendarView::cancelIncidence(Incidence * inc ) 2509void CalendarView::cancelIncidence(Incidence * inc )
2504{ 2510{
2505 inc->setCancelled( ! inc->cancelled() ); 2511 inc->setCancelled( ! inc->cancelled() );
2506 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2512 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2507 updateView(); 2513 updateView();
2508} 2514}
2509void CalendarView::cloneIncidence(Incidence * orgInc ) 2515void CalendarView::cloneIncidence(Incidence * orgInc )
2510{ 2516{
2511 Incidence * newInc = orgInc->clone(); 2517 Incidence * newInc = orgInc->clone();
2512 newInc->recreate(); 2518 newInc->recreate();
2513 2519
2514 if ( newInc->type() == "Todo" ) { 2520 if ( newInc->type() == "Todo" ) {
2515 Todo* t = (Todo*) newInc; 2521 Todo* t = (Todo*) newInc;
2516 mTodoEditor->editTodo( t ); 2522 mTodoEditor->editTodo( t );
2517 showTodoEditor(); 2523 showTodoEditor();
2518 if ( mTodoEditor->exec() ) { 2524 if ( mTodoEditor->exec() ) {
2519 mCalendar->addTodo( t ); 2525 mCalendar->addTodo( t );
2520 updateView(); 2526 updateView();
2521 } else { 2527 } else {
2522 delete t; 2528 delete t;
2523 } 2529 }
2524 } 2530 }
2525 else { 2531 else {
2526 Event* e = (Event*) newInc; 2532 Event* e = (Event*) newInc;
2527 mEventEditor->editEvent( e ); 2533 mEventEditor->editEvent( e );
2528 showEventEditor(); 2534 showEventEditor();
2529 if ( mEventEditor->exec() ) { 2535 if ( mEventEditor->exec() ) {
2530 mCalendar->addEvent( e ); 2536 mCalendar->addEvent( e );
2531 updateView(); 2537 updateView();
2532 } else { 2538 } else {
2533 delete e; 2539 delete e;
2534 } 2540 }
2535 } 2541 }
2536} 2542}
2537 2543
2538void CalendarView::newEvent() 2544void CalendarView::newEvent()
2539{ 2545{
2540 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2546 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2541 KOAgendaView *aView = mViewManager->agendaView(); 2547 KOAgendaView *aView = mViewManager->agendaView();
2542 if (aView) { 2548 if (aView) {
2543 if (aView->selectionStart().isValid()) { 2549 if (aView->selectionStart().isValid()) {
2544 if (aView->selectedIsAllDay()) { 2550 if (aView->selectedIsAllDay()) {
2545 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2551 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2546 } else { 2552 } else {
2547 newEvent(aView->selectionStart(),aView->selectionEnd()); 2553 newEvent(aView->selectionStart(),aView->selectionEnd());
2548 } 2554 }
2549 return; 2555 return;
2550 } 2556 }
2551 } 2557 }
2552 2558
2553 QDate date = mNavigator->selectedDates().first(); 2559 QDate date = mNavigator->selectedDates().first();
2554 QDateTime current = QDateTime::currentDateTime(); 2560 QDateTime current = QDateTime::currentDateTime();
2555 if ( date <= current.date() ) { 2561 if ( date <= current.date() ) {
2556 int hour = current.time().hour() +1; 2562 int hour = current.time().hour() +1;
2557 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2563 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2558 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2564 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2559 } else 2565 } else
2560 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2566 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2561 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2567 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2562 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2568 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2563} 2569}
2564 2570
2565void CalendarView::newEvent(QDateTime fh) 2571void CalendarView::newEvent(QDateTime fh)
2566{ 2572{
2567 newEvent(fh, 2573 newEvent(fh,
2568 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2574 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2569} 2575}
2570 2576
2571void CalendarView::newEvent(QDate dt) 2577void CalendarView::newEvent(QDate dt)
2572{ 2578{
2573 newEvent(QDateTime(dt, QTime(0,0,0)), 2579 newEvent(QDateTime(dt, QTime(0,0,0)),
2574 QDateTime(dt, QTime(0,0,0)), true); 2580 QDateTime(dt, QTime(0,0,0)), true);
2575} 2581}
2576 2582
2577void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2583void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2578{ 2584{
2579 2585
2580 mEventEditor->newEvent(fromHint,toHint,allDay); 2586 mEventEditor->newEvent(fromHint,toHint,allDay);
2581 if ( mFilterView->filtersEnabled() ) { 2587 if ( mFilterView->filtersEnabled() ) {
2582 CalFilter *filter = mFilterView->selectedFilter(); 2588 CalFilter *filter = mFilterView->selectedFilter();
2583 if (filter && filter->showCategories()) { 2589 if (filter && filter->showCategories()) {
2584 mEventEditor->setCategories(filter->categoryList().join(",") ); 2590 mEventEditor->setCategories(filter->categoryList().join(",") );
2585 } 2591 }
2586 if ( filter ) 2592 if ( filter )
2587 mEventEditor->setSecrecy( filter->getSecrecy() ); 2593 mEventEditor->setSecrecy( filter->getSecrecy() );
2588 } 2594 }
2589 showEventEditor(); 2595 showEventEditor();
2590} 2596}
2591void CalendarView::todoAdded(Todo * t) 2597void CalendarView::todoAdded(Todo * t)
2592{ 2598{
2593 2599
2594 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2600 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2595 updateTodoViews(); 2601 updateTodoViews();
2596} 2602}
2597void CalendarView::todoChanged(Todo * t) 2603void CalendarView::todoChanged(Todo * t)
2598{ 2604{
2599 emit todoModified( t, 4 ); 2605 emit todoModified( t, 4 );
2600 // updateTodoViews(); 2606 // updateTodoViews();
2601} 2607}
2602void CalendarView::todoToBeDeleted(Todo *) 2608void CalendarView::todoToBeDeleted(Todo *)
2603{ 2609{
2604 //qDebug("todoToBeDeleted(Todo *) "); 2610 //qDebug("todoToBeDeleted(Todo *) ");
2605 updateTodoViews(); 2611 updateTodoViews();
2606} 2612}
2607void CalendarView::todoDeleted() 2613void CalendarView::todoDeleted()
2608{ 2614{
2609 //qDebug(" todoDeleted()"); 2615 //qDebug(" todoDeleted()");
2610 updateTodoViews(); 2616 updateTodoViews();
2611} 2617}
2612 2618
2613 2619
2614 2620
2615void CalendarView::newTodo() 2621void CalendarView::newTodo()
2616{ 2622{
2617 2623
2618 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2624 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2619 if ( mFilterView->filtersEnabled() ) { 2625 if ( mFilterView->filtersEnabled() ) {
2620 CalFilter *filter = mFilterView->selectedFilter(); 2626 CalFilter *filter = mFilterView->selectedFilter();
2621 if (filter && filter->showCategories()) { 2627 if (filter && filter->showCategories()) {
2622 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2628 mTodoEditor->setCategories(filter->categoryList().join(",") );
2623 } 2629 }
2624 if ( filter ) 2630 if ( filter )
2625 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2631 mTodoEditor->setSecrecy( filter->getSecrecy() );
2626 } 2632 }
2627 showTodoEditor(); 2633 showTodoEditor();
2628} 2634}
2629 2635
2630void CalendarView::newSubTodo() 2636void CalendarView::newSubTodo()
2631{ 2637{
2632 Todo *todo = selectedTodo(); 2638 Todo *todo = selectedTodo();
2633 if ( todo ) newSubTodo( todo ); 2639 if ( todo ) newSubTodo( todo );
2634} 2640}
2635 2641
2636void CalendarView::newSubTodo(Todo *parentEvent) 2642void CalendarView::newSubTodo(Todo *parentEvent)
2637{ 2643{
2638 2644
2639 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2645 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2640 showTodoEditor(); 2646 showTodoEditor();
2641} 2647}
2642 2648
2643void CalendarView::newFloatingEvent() 2649void CalendarView::newFloatingEvent()
2644{ 2650{
2645 DateList tmpList = mNavigator->selectedDates(); 2651 DateList tmpList = mNavigator->selectedDates();
2646 QDate date = tmpList.first(); 2652 QDate date = tmpList.first();
2647 2653
2648 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2654 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2649 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2655 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2650} 2656}
2651 2657
2652 2658
2653void CalendarView::editEvent( Event *event ) 2659void CalendarView::editEvent( Event *event )
2654{ 2660{
2655 2661
2656 if ( !event ) return; 2662 if ( !event ) return;
2657 if ( event->isReadOnly() ) { 2663 if ( event->isReadOnly() ) {
2658 showEvent( event ); 2664 showEvent( event );
2659 return; 2665 return;
2660 } 2666 }
2661 mEventEditor->editEvent( event , mFlagEditDescription); 2667 mEventEditor->editEvent( event , mFlagEditDescription);
2662 showEventEditor(); 2668 showEventEditor();
2663} 2669}
2664void CalendarView::editJournal( Journal *jour ) 2670void CalendarView::editJournal( Journal *jour )
2665{ 2671{
2666 if ( !jour ) return; 2672 if ( !jour ) return;
2667 mDialogManager->hideSearchDialog(); 2673 mDialogManager->hideSearchDialog();
2668 mViewManager->showJournalView(); 2674 mViewManager->showJournalView();
2669 mNavigator->slotDaySelect( jour->dtStart().date() ); 2675 mNavigator->slotDaySelect( jour->dtStart().date() );
2670} 2676}
2671void CalendarView::editTodo( Todo *todo ) 2677void CalendarView::editTodo( Todo *todo )
2672{ 2678{
2673 if ( !todo ) return; 2679 if ( !todo ) return;
2674 2680
2675 if ( todo->isReadOnly() ) { 2681 if ( todo->isReadOnly() ) {
2676 showTodo( todo ); 2682 showTodo( todo );
2677 return; 2683 return;
2678 } 2684 }
2679 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2685 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2680 showTodoEditor(); 2686 showTodoEditor();
2681 2687
2682} 2688}
2683 2689
2684KOEventViewerDialog* CalendarView::getEventViewerDialog() 2690KOEventViewerDialog* CalendarView::getEventViewerDialog()
2685{ 2691{
2686 if ( !mEventViewerDialog ) { 2692 if ( !mEventViewerDialog ) {
2687 mEventViewerDialog = new KOEventViewerDialog(this); 2693 mEventViewerDialog = new KOEventViewerDialog(this);
2688 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2694 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2689 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2695 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2690 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2696 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2691 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2697 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2692 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2698 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2693 viewManager(), SLOT( showAgendaView( bool ) ) ); 2699 viewManager(), SLOT( showAgendaView( bool ) ) );
2694 mEventViewerDialog->resize( 640, 480 ); 2700 mEventViewerDialog->resize( 640, 480 );
2695 2701
2696 } 2702 }
2697 return mEventViewerDialog; 2703 return mEventViewerDialog;
2698} 2704}
2699void CalendarView::showEvent(Event *event) 2705void CalendarView::showEvent(Event *event)
2700{ 2706{
2701 getEventViewerDialog()->setEvent(event); 2707 getEventViewerDialog()->setEvent(event);
2702 getEventViewerDialog()->showMe(); 2708 getEventViewerDialog()->showMe();
2703} 2709}
2704 2710
2705void CalendarView::showTodo(Todo *event) 2711void CalendarView::showTodo(Todo *event)
2706{ 2712{
2707 getEventViewerDialog()->setTodo(event); 2713 getEventViewerDialog()->setTodo(event);
2708 getEventViewerDialog()->showMe(); 2714 getEventViewerDialog()->showMe();
2709} 2715}
2710void CalendarView::showJournal( Journal *jour ) 2716void CalendarView::showJournal( Journal *jour )
2711{ 2717{
2712 getEventViewerDialog()->setJournal(jour); 2718 getEventViewerDialog()->setJournal(jour);
2713 getEventViewerDialog()->showMe(); 2719 getEventViewerDialog()->showMe();
2714 2720
2715} 2721}
2716// void CalendarView::todoModified (Todo *event, int changed) 2722// void CalendarView::todoModified (Todo *event, int changed)
2717// { 2723// {
2718// // if (mDialogList.find (event) != mDialogList.end ()) { 2724// // if (mDialogList.find (event) != mDialogList.end ()) {
2719// // kdDebug() << "Todo modified and open" << endl; 2725// // kdDebug() << "Todo modified and open" << endl;
2720// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2726// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2721// // temp->modified (changed); 2727// // temp->modified (changed);
2722 2728
2723// // } 2729// // }
2724 2730
2725// mViewManager->updateView(); 2731// mViewManager->updateView();
2726// } 2732// }
2727 2733
2728void CalendarView::appointment_show() 2734void CalendarView::appointment_show()
2729{ 2735{
2730 Event *anEvent = 0; 2736 Event *anEvent = 0;
2731 2737
2732 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2738 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2733 2739
2734 if (mViewManager->currentView()->isEventView()) { 2740 if (mViewManager->currentView()->isEventView()) {
2735 if ( incidence && incidence->type() == "Event" ) { 2741 if ( incidence && incidence->type() == "Event" ) {
2736 anEvent = static_cast<Event *>(incidence); 2742 anEvent = static_cast<Event *>(incidence);
2737 } 2743 }
2738 } 2744 }
2739 2745
2740 if (!anEvent) { 2746 if (!anEvent) {
2741 KNotifyClient::beep(); 2747 KNotifyClient::beep();
2742 return; 2748 return;
2743 } 2749 }
2744 2750
2745 showEvent(anEvent); 2751 showEvent(anEvent);
2746} 2752}
2747 2753
2748void CalendarView::appointment_edit() 2754void CalendarView::appointment_edit()
2749{ 2755{
2750 Event *anEvent = 0; 2756 Event *anEvent = 0;
2751 2757
2752 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2758 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2753 2759
2754 if (mViewManager->currentView()->isEventView()) { 2760 if (mViewManager->currentView()->isEventView()) {
2755 if ( incidence && incidence->type() == "Event" ) { 2761 if ( incidence && incidence->type() == "Event" ) {
2756 anEvent = static_cast<Event *>(incidence); 2762 anEvent = static_cast<Event *>(incidence);
2757 } 2763 }
2758 } 2764 }
2759 2765
2760 if (!anEvent) { 2766 if (!anEvent) {
2761 KNotifyClient::beep(); 2767 KNotifyClient::beep();
2762 return; 2768 return;
2763 } 2769 }
2764 2770
2765 editEvent(anEvent); 2771 editEvent(anEvent);
2766} 2772}
2767 2773
2768void CalendarView::appointment_delete() 2774void CalendarView::appointment_delete()
2769{ 2775{
2770 Event *anEvent = 0; 2776 Event *anEvent = 0;
2771 2777
2772 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2778 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2773 2779
2774 if (mViewManager->currentView()->isEventView()) { 2780 if (mViewManager->currentView()->isEventView()) {
2775 if ( incidence && incidence->type() == "Event" ) { 2781 if ( incidence && incidence->type() == "Event" ) {
2776 anEvent = static_cast<Event *>(incidence); 2782 anEvent = static_cast<Event *>(incidence);
2777 } 2783 }
2778 } 2784 }
2779 2785
2780 if (!anEvent) { 2786 if (!anEvent) {
2781 KNotifyClient::beep(); 2787 KNotifyClient::beep();
2782 return; 2788 return;
2783 } 2789 }
2784 2790
2785 deleteEvent(anEvent); 2791 deleteEvent(anEvent);
2786} 2792}
2787 2793
2788void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2794void CalendarView::todo_resub( Todo * parent, Todo * sub )
2789{ 2795{
2790 if (!sub) return; 2796 if (!sub) return;
2791 if (!parent) return; 2797 if (!parent) return;
2792 if ( sub->relatedTo() ) 2798 if ( sub->relatedTo() )
2793 sub->relatedTo()->removeRelation(sub); 2799 sub->relatedTo()->removeRelation(sub);
2794 sub->setRelatedTo(parent); 2800 sub->setRelatedTo(parent);
2795 sub->setRelatedToUid(parent->uid()); 2801 sub->setRelatedToUid(parent->uid());
2796 parent->addRelation(sub); 2802 parent->addRelation(sub);
2797 sub->updated(); 2803 sub->updated();
2798 parent->updated(); 2804 parent->updated();
2799 setModified(true); 2805 setModified(true);
2800 updateView(); 2806 updateView();
2801} 2807}
2802void CalendarView::todo_unsub(Todo *anTodo ) 2808void CalendarView::todo_unsub(Todo *anTodo )
2803{ 2809{
2804 // Todo *anTodo = selectedTodo(); 2810 // Todo *anTodo = selectedTodo();
2805 if (!anTodo) return; 2811 if (!anTodo) return;
2806 if (!anTodo->relatedTo()) return; 2812 if (!anTodo->relatedTo()) return;
2807 anTodo->relatedTo()->removeRelation(anTodo); 2813 anTodo->relatedTo()->removeRelation(anTodo);
2808 anTodo->setRelatedTo(0); 2814 anTodo->setRelatedTo(0);
2809 anTodo->updated(); 2815 anTodo->updated();
2810 anTodo->setRelatedToUid(""); 2816 anTodo->setRelatedToUid("");
2811 setModified(true); 2817 setModified(true);
2812 updateView(); 2818 updateView();
2813} 2819}
2814 2820
2815void CalendarView::deleteTodo(Todo *todo) 2821void CalendarView::deleteTodo(Todo *todo)
2816{ 2822{
2817 if (!todo) { 2823 if (!todo) {
2818 KNotifyClient::beep(); 2824 KNotifyClient::beep();
2819 return; 2825 return;
2820 } 2826 }
2821 if (KOPrefs::instance()->mConfirm) { 2827 if (KOPrefs::instance()->mConfirm) {
2822 switch (msgItemDelete()) { 2828 switch (msgItemDelete()) {
2823 case KMessageBox::Continue: // OK 2829 case KMessageBox::Continue: // OK
2824 if (!todo->relations().isEmpty()) { 2830 if (!todo->relations().isEmpty()) {
2825 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2831 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2826 i18n("Delete To-Do")); 2832 i18n("Delete To-Do"));
2827 } else { 2833 } else {
2828 checkExternalId( todo ); 2834 checkExternalId( todo );
2829 calendar()->deleteTodo(todo); 2835 calendar()->deleteTodo(todo);
2830 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2836 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2831 updateView(); 2837 updateView();
2832 } 2838 }
2833 break; 2839 break;
2834 } // switch 2840 } // switch
2835 } else { 2841 } else {
2836 if (!todo->relations().isEmpty()) { 2842 if (!todo->relations().isEmpty()) {
2837 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2843 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2838 i18n("Delete To-Do")); 2844 i18n("Delete To-Do"));
2839 } else { 2845 } else {
2840 checkExternalId( todo ); 2846 checkExternalId( todo );
2841 mCalendar->deleteTodo(todo); 2847 mCalendar->deleteTodo(todo);
2842 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2848 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2843 updateView(); 2849 updateView();
2844 } 2850 }
2845 } 2851 }
2846 emit updateSearchDialog(); 2852 emit updateSearchDialog();
2847} 2853}
2848void CalendarView::deleteJournal(Journal *jour) 2854void CalendarView::deleteJournal(Journal *jour)
2849{ 2855{
2850 if (!jour) { 2856 if (!jour) {
2851 KNotifyClient::beep(); 2857 KNotifyClient::beep();
2852 return; 2858 return;
2853 } 2859 }
2854 if (KOPrefs::instance()->mConfirm) { 2860 if (KOPrefs::instance()->mConfirm) {
2855 switch (msgItemDelete()) { 2861 switch (msgItemDelete()) {
2856 case KMessageBox::Continue: // OK 2862 case KMessageBox::Continue: // OK
2857 calendar()->deleteJournal(jour); 2863 calendar()->deleteJournal(jour);
2858 updateView(); 2864 updateView();
2859 break; 2865 break;
2860 } // switch 2866 } // switch
2861 } else { 2867 } else {
2862 calendar()->deleteJournal(jour);; 2868 calendar()->deleteJournal(jour);;
2863 updateView(); 2869 updateView();
2864 } 2870 }
2865 emit updateSearchDialog(); 2871 emit updateSearchDialog();
2866} 2872}
2867 2873
2868void CalendarView::deleteEvent(Event *anEvent) 2874void CalendarView::deleteEvent(Event *anEvent)
2869{ 2875{
2870 if (!anEvent) { 2876 if (!anEvent) {
2871 KNotifyClient::beep(); 2877 KNotifyClient::beep();
2872 return; 2878 return;
2873 } 2879 }
2874 2880
2875 if (anEvent->recurrence()->doesRecur()) { 2881 if (anEvent->recurrence()->doesRecur()) {
2876 QDate itemDate = mViewManager->currentSelectionDate(); 2882 QDate itemDate = mViewManager->currentSelectionDate();
2877 int km; 2883 int km;
2878 if (!itemDate.isValid()) { 2884 if (!itemDate.isValid()) {
2879 //kdDebug() << "Date Not Valid" << endl; 2885 //kdDebug() << "Date Not Valid" << endl;
2880 if (KOPrefs::instance()->mConfirm) { 2886 if (KOPrefs::instance()->mConfirm) {
2881 km = KMessageBox::warningContinueCancel(this,anEvent->summary() + 2887 km = KMessageBox::warningContinueCancel(this,anEvent->summary() +
2882 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2888 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2883 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2889 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2884 if ( km == KMessageBox::Continue ) 2890 if ( km == KMessageBox::Continue )
2885 km = KMessageBox::No; // No = all below 2891 km = KMessageBox::No; // No = all below
2886 } else 2892 } else
2887 km = KMessageBox::No; 2893 km = KMessageBox::No;
2888 } else { 2894 } else {
2889 km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + 2895 km = KMessageBox::warningYesNoCancel(this,anEvent->summary() +
2890 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2896 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2891 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2897 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2892 i18n("KO/Pi Confirmation"),i18n("Current"), 2898 i18n("KO/Pi Confirmation"),i18n("Current"),
2893 i18n("All")); 2899 i18n("All"));
2894 } 2900 }
2895 switch(km) { 2901 switch(km) {
2896 2902
2897 case KMessageBox::No: // Continue // all 2903 case KMessageBox::No: // Continue // all
2898 //qDebug("KMessageBox::No "); 2904 //qDebug("KMessageBox::No ");
2899 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2905 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2900 schedule(Scheduler::Cancel,anEvent); 2906 schedule(Scheduler::Cancel,anEvent);
2901 2907
2902 checkExternalId( anEvent); 2908 checkExternalId( anEvent);
2903 mCalendar->deleteEvent(anEvent); 2909 mCalendar->deleteEvent(anEvent);
2904 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 2910 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2905 break; 2911 break;
2906 2912
2907 // Disabled because it does not work 2913 // Disabled because it does not work
2908 //#if 0 2914 //#if 0
2909 case KMessageBox::Yes: // just this one 2915 case KMessageBox::Yes: // just this one
2910 //QDate qd = mNavigator->selectedDates().first(); 2916 //QDate qd = mNavigator->selectedDates().first();
2911 //if (!qd.isValid()) { 2917 //if (!qd.isValid()) {
2912 // kdDebug() << "no date selected, or invalid date" << endl; 2918 // kdDebug() << "no date selected, or invalid date" << endl;
2913 // KNotifyClient::beep(); 2919 // KNotifyClient::beep();
2914 // return; 2920 // return;
2915 //} 2921 //}
2916 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 2922 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
2917 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 2923 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
2918 anEvent->addExDate(itemDate); 2924 anEvent->addExDate(itemDate);
2919 int duration = anEvent->recurrence()->duration(); 2925 int duration = anEvent->recurrence()->duration();
2920 if ( duration > 0 ) { 2926 if ( duration > 0 ) {
2921 anEvent->recurrence()->setDuration( duration - 1 ); 2927 anEvent->recurrence()->setDuration( duration - 1 );
2922 } 2928 }
2923 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 2929 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
2924 } 2930 }
2925 break; 2931 break;
2926 //#endif 2932 //#endif
2927 } // switch 2933 } // switch
2928 } else { 2934 } else {
2929 if (KOPrefs::instance()->mConfirm) { 2935 if (KOPrefs::instance()->mConfirm) {
2930 switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + 2936 switch (KMessageBox::warningContinueCancel(this,anEvent->summary() +
2931 i18n("\nAre you sure you want\nto delete this event?"), 2937 i18n("\nAre you sure you want\nto delete this event?"),
2932 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 2938 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
2933 case KMessageBox::Continue: // OK 2939 case KMessageBox::Continue: // OK
2934 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2940 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2935 schedule(Scheduler::Cancel,anEvent); 2941 schedule(Scheduler::Cancel,anEvent);
2936 checkExternalId( anEvent); 2942 checkExternalId( anEvent);
2937 mCalendar->deleteEvent(anEvent); 2943 mCalendar->deleteEvent(anEvent);
2938 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2944 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2939 break; 2945 break;
2940 } // switch 2946 } // switch
2941 } else { 2947 } else {
2942 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2948 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2943 schedule(Scheduler::Cancel,anEvent); 2949 schedule(Scheduler::Cancel,anEvent);
2944 checkExternalId( anEvent); 2950 checkExternalId( anEvent);
2945 mCalendar->deleteEvent(anEvent); 2951 mCalendar->deleteEvent(anEvent);
2946 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2952 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2947 } 2953 }
2948 } // if-else 2954 } // if-else
2949 emit updateSearchDialog(); 2955 emit updateSearchDialog();
2950} 2956}
2951 2957
2952bool CalendarView::deleteEvent(const QString &uid) 2958bool CalendarView::deleteEvent(const QString &uid)
2953{ 2959{
2954 Event *ev = mCalendar->event(uid); 2960 Event *ev = mCalendar->event(uid);
2955 if (ev) { 2961 if (ev) {
2956 deleteEvent(ev); 2962 deleteEvent(ev);
2957 return true; 2963 return true;
2958 } else { 2964 } else {
2959 return false; 2965 return false;
2960 } 2966 }
2961} 2967}
2962 2968
2963/*****************************************************************************/ 2969/*****************************************************************************/
2964 2970
2965void CalendarView::action_mail() 2971void CalendarView::action_mail()
2966{ 2972{
2967#ifndef KORG_NOMAIL 2973#ifndef KORG_NOMAIL
2968 KOMailClient mailClient; 2974 KOMailClient mailClient;
2969 2975
2970 Incidence *incidence = currentSelection(); 2976 Incidence *incidence = currentSelection();
2971 2977
2972 if (!incidence) { 2978 if (!incidence) {
2973 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 2979 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
2974 return; 2980 return;
2975 } 2981 }
2976 if(incidence->attendeeCount() == 0 ) { 2982 if(incidence->attendeeCount() == 0 ) {
2977 KMessageBox::sorry(this, 2983 KMessageBox::sorry(this,
2978 i18n("Can't generate mail:\nNo attendees defined.\n")); 2984 i18n("Can't generate mail:\nNo attendees defined.\n"));
2979 return; 2985 return;
2980 } 2986 }
2981 2987
2982 CalendarLocal cal_tmp; 2988 CalendarLocal cal_tmp;
2983 Event *event = 0; 2989 Event *event = 0;
2984 Event *ev = 0; 2990 Event *ev = 0;
2985 if ( incidence && incidence->type() == "Event" ) { 2991 if ( incidence && incidence->type() == "Event" ) {
2986 event = static_cast<Event *>(incidence); 2992 event = static_cast<Event *>(incidence);
2987 ev = new Event(*event); 2993 ev = new Event(*event);
2988 cal_tmp.addEvent(ev); 2994 cal_tmp.addEvent(ev);
2989 } 2995 }
2990 ICalFormat mForm(); 2996 ICalFormat mForm();
2991 QString attachment = mForm.toString( &cal_tmp ); 2997 QString attachment = mForm.toString( &cal_tmp );
2992 if (ev) delete(ev); 2998 if (ev) delete(ev);
2993 2999
2994 mailClient.mailAttendees(currentSelection(), attachment); 3000 mailClient.mailAttendees(currentSelection(), attachment);
2995 3001
2996#endif 3002#endif
2997 3003
2998#if 0 3004#if 0
2999 Event *anEvent = 0; 3005 Event *anEvent = 0;
3000 if (mViewManager->currentView()->isEventView()) { 3006 if (mViewManager->currentView()->isEventView()) {
3001 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3007 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3002 } 3008 }
3003 3009
3004 if (!anEvent) { 3010 if (!anEvent) {
3005 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3011 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3006 return; 3012 return;
3007 } 3013 }
3008 if(anEvent->attendeeCount() == 0 ) { 3014 if(anEvent->attendeeCount() == 0 ) {
3009 KMessageBox::sorry(this, 3015 KMessageBox::sorry(this,
3010 i18n("Can't generate mail:\nNo attendees defined.\n")); 3016 i18n("Can't generate mail:\nNo attendees defined.\n"));
3011 return; 3017 return;
3012 } 3018 }
3013 3019
3014 mailobject.emailEvent(anEvent); 3020 mailobject.emailEvent(anEvent);
3015#endif 3021#endif
3016} 3022}
3017 3023
3018 3024
3019void CalendarView::schedule_publish(Incidence *incidence) 3025void CalendarView::schedule_publish(Incidence *incidence)
3020{ 3026{
3021 Event *event = 0; 3027 Event *event = 0;
3022 Todo *todo = 0; 3028 Todo *todo = 0;
3023 3029
3024 if (incidence == 0) { 3030 if (incidence == 0) {
3025 incidence = mViewManager->currentView()->selectedIncidences().first(); 3031 incidence = mViewManager->currentView()->selectedIncidences().first();
3026 if (incidence == 0) { 3032 if (incidence == 0) {
3027 incidence = mTodoList->selectedIncidences().first(); 3033 incidence = mTodoList->selectedIncidences().first();
3028 } 3034 }
3029 } 3035 }
3030 if ( incidence && incidence->type() == "Event" ) { 3036 if ( incidence && incidence->type() == "Event" ) {
3031 event = static_cast<Event *>(incidence); 3037 event = static_cast<Event *>(incidence);
3032 } else { 3038 } else {
3033 if ( incidence && incidence->type() == "Todo" ) { 3039 if ( incidence && incidence->type() == "Todo" ) {
3034 todo = static_cast<Todo *>(incidence); 3040 todo = static_cast<Todo *>(incidence);
3035 } 3041 }
3036 } 3042 }
3037 3043
3038 if (!event && !todo) { 3044 if (!event && !todo) {
3039 KMessageBox::sorry(this,i18n("No event selected.")); 3045 KMessageBox::sorry(this,i18n("No event selected."));
3040 return; 3046 return;
3041 } 3047 }
3042 3048
3043 PublishDialog *publishdlg = new PublishDialog(); 3049 PublishDialog *publishdlg = new PublishDialog();
3044 if (incidence->attendeeCount()>0) { 3050 if (incidence->attendeeCount()>0) {
3045 QPtrList<Attendee> attendees = incidence->attendees(); 3051 QPtrList<Attendee> attendees = incidence->attendees();
3046 attendees.first(); 3052 attendees.first();
3047 while ( attendees.current()!=0 ) { 3053 while ( attendees.current()!=0 ) {
3048 publishdlg->addAttendee(attendees.current()); 3054 publishdlg->addAttendee(attendees.current());
3049 attendees.next(); 3055 attendees.next();
3050 } 3056 }
3051 } 3057 }
3052 bool send = true; 3058 bool send = true;
3053 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3059 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3054 if ( publishdlg->exec() != QDialog::Accepted ) 3060 if ( publishdlg->exec() != QDialog::Accepted )
3055 send = false; 3061 send = false;
3056 } 3062 }
3057 if ( send ) { 3063 if ( send ) {
3058 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3064 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3059 if ( event ) { 3065 if ( event ) {
3060 Event *ev = new Event(*event); 3066 Event *ev = new Event(*event);
3061 ev->registerObserver(0); 3067 ev->registerObserver(0);
3062 ev->clearAttendees(); 3068 ev->clearAttendees();
3063 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3069 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3064 delete(ev); 3070 delete(ev);
3065 } 3071 }
3066 } else { 3072 } else {
3067 if ( todo ) { 3073 if ( todo ) {
3068 Todo *ev = new Todo(*todo); 3074 Todo *ev = new Todo(*todo);
3069 ev->registerObserver(0); 3075 ev->registerObserver(0);
3070 ev->clearAttendees(); 3076 ev->clearAttendees();
3071 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3077 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3072 delete(ev); 3078 delete(ev);
3073 } 3079 }
3074 } 3080 }
3075 } 3081 }
3076 } 3082 }
3077 delete publishdlg; 3083 delete publishdlg;
3078} 3084}
3079 3085
3080void CalendarView::schedule_request(Incidence *incidence) 3086void CalendarView::schedule_request(Incidence *incidence)
3081{ 3087{
3082 schedule(Scheduler::Request,incidence); 3088 schedule(Scheduler::Request,incidence);
3083} 3089}
3084 3090
3085void CalendarView::schedule_refresh(Incidence *incidence) 3091void CalendarView::schedule_refresh(Incidence *incidence)
3086{ 3092{
3087 schedule(Scheduler::Refresh,incidence); 3093 schedule(Scheduler::Refresh,incidence);
3088} 3094}
3089 3095
3090void CalendarView::schedule_cancel(Incidence *incidence) 3096void CalendarView::schedule_cancel(Incidence *incidence)
3091{ 3097{
3092 schedule(Scheduler::Cancel,incidence); 3098 schedule(Scheduler::Cancel,incidence);
3093} 3099}
3094 3100
3095void CalendarView::schedule_add(Incidence *incidence) 3101void CalendarView::schedule_add(Incidence *incidence)
3096{ 3102{
3097 schedule(Scheduler::Add,incidence); 3103 schedule(Scheduler::Add,incidence);
3098} 3104}
3099 3105
3100void CalendarView::schedule_reply(Incidence *incidence) 3106void CalendarView::schedule_reply(Incidence *incidence)
3101{ 3107{
3102 schedule(Scheduler::Reply,incidence); 3108 schedule(Scheduler::Reply,incidence);
3103} 3109}
3104 3110
3105void CalendarView::schedule_counter(Incidence *incidence) 3111void CalendarView::schedule_counter(Incidence *incidence)
3106{ 3112{
3107 schedule(Scheduler::Counter,incidence); 3113 schedule(Scheduler::Counter,incidence);
3108} 3114}
3109 3115
3110void CalendarView::schedule_declinecounter(Incidence *incidence) 3116void CalendarView::schedule_declinecounter(Incidence *incidence)
3111{ 3117{
3112 schedule(Scheduler::Declinecounter,incidence); 3118 schedule(Scheduler::Declinecounter,incidence);
3113} 3119}
3114 3120
3115void CalendarView::schedule_publish_freebusy(int daysToPublish) 3121void CalendarView::schedule_publish_freebusy(int daysToPublish)
3116{ 3122{
3117 QDateTime start = QDateTime::currentDateTime(); 3123 QDateTime start = QDateTime::currentDateTime();
3118 QDateTime end = start.addDays(daysToPublish); 3124 QDateTime end = start.addDays(daysToPublish);
3119 3125
3120 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3126 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3121 freebusy->setOrganizer(KOPrefs::instance()->email()); 3127 freebusy->setOrganizer(KOPrefs::instance()->email());
3122 3128
3123 3129
3124 PublishDialog *publishdlg = new PublishDialog(); 3130 PublishDialog *publishdlg = new PublishDialog();
3125 if ( publishdlg->exec() == QDialog::Accepted ) { 3131 if ( publishdlg->exec() == QDialog::Accepted ) {
3126 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3132 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3127 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3133 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3128 delete(freebusy); 3134 delete(freebusy);
3129 } 3135 }
3130 } 3136 }
3131 delete publishdlg; 3137 delete publishdlg;
3132} 3138}
3133 3139
3134void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3140void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3135{ 3141{
3136 Event *event = 0; 3142 Event *event = 0;
3137 Todo *todo = 0; 3143 Todo *todo = 0;
3138 3144
3139 if (incidence == 0) { 3145 if (incidence == 0) {
3140 incidence = mViewManager->currentView()->selectedIncidences().first(); 3146 incidence = mViewManager->currentView()->selectedIncidences().first();
3141 if (incidence == 0) { 3147 if (incidence == 0) {
3142 incidence = mTodoList->selectedIncidences().first(); 3148 incidence = mTodoList->selectedIncidences().first();
3143 } 3149 }
3144 } 3150 }
3145 if ( incidence && incidence->type() == "Event" ) { 3151 if ( incidence && incidence->type() == "Event" ) {
3146 event = static_cast<Event *>(incidence); 3152 event = static_cast<Event *>(incidence);
3147 } 3153 }
3148 if ( incidence && incidence->type() == "Todo" ) { 3154 if ( incidence && incidence->type() == "Todo" ) {
3149 todo = static_cast<Todo *>(incidence); 3155 todo = static_cast<Todo *>(incidence);
3150 } 3156 }
3151 3157
3152 if (!event && !todo) { 3158 if (!event && !todo) {
3153 KMessageBox::sorry(this,i18n("No event selected.")); 3159 KMessageBox::sorry(this,i18n("No event selected."));
3154 return; 3160 return;
3155 } 3161 }
3156 3162
3157 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3163 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3158 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3164 KMessageBox::sorry(this,i18n("The event has no attendees."));
3159 return; 3165 return;
3160 } 3166 }
3161 3167
3162 Event *ev = 0; 3168 Event *ev = 0;
3163 if (event) ev = new Event(*event); 3169 if (event) ev = new Event(*event);
3164 Todo *to = 0; 3170 Todo *to = 0;
3165 if (todo) to = new Todo(*todo); 3171 if (todo) to = new Todo(*todo);
3166 3172
3167 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3173 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3168 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3174 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3169 if (!me) { 3175 if (!me) {
3170 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3176 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3171 return; 3177 return;
3172 } 3178 }
3173 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3179 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3174 StatusDialog *statdlg = new StatusDialog(this); 3180 StatusDialog *statdlg = new StatusDialog(this);
3175 if (!statdlg->exec()==QDialog::Accepted) return; 3181 if (!statdlg->exec()==QDialog::Accepted) return;
3176 me->setStatus( statdlg->status() ); 3182 me->setStatus( statdlg->status() );
3177 delete(statdlg); 3183 delete(statdlg);
3178 } 3184 }
3179 Attendee *menew = new Attendee(*me); 3185 Attendee *menew = new Attendee(*me);
3180 if (ev) { 3186 if (ev) {
3181 ev->clearAttendees(); 3187 ev->clearAttendees();
3182 ev->addAttendee(menew,false); 3188 ev->addAttendee(menew,false);
3183 } else { 3189 } else {
3184 if (to) { 3190 if (to) {
3185 todo->clearAttendees(); 3191 todo->clearAttendees();
3186 todo->addAttendee(menew,false); 3192 todo->addAttendee(menew,false);
3187 } 3193 }
3188 } 3194 }
3189 } 3195 }
3190 3196
3191 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3197 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3192 if (ev) { 3198 if (ev) {
3193 if ( !dlg->addMessage(ev,method) ) delete(ev); 3199 if ( !dlg->addMessage(ev,method) ) delete(ev);
3194 } else { 3200 } else {
3195 if (to) { 3201 if (to) {
3196 if ( !dlg->addMessage(to,method) ) delete(to); 3202 if ( !dlg->addMessage(to,method) ) delete(to);
3197 } 3203 }
3198 } 3204 }
3199} 3205}
3200 3206
3201void CalendarView::openAddressbook() 3207void CalendarView::openAddressbook()
3202{ 3208{
3203 KRun::runCommand("kaddressbook"); 3209 KRun::runCommand("kaddressbook");
3204} 3210}
3205 3211
3206void CalendarView::setModified(bool modified) 3212void CalendarView::setModified(bool modified)
3207{ 3213{
3208 if ( modified ) 3214 if ( modified )
3209 emit signalmodified(); 3215 emit signalmodified();
3210 if (mModified != modified) { 3216 if (mModified != modified) {
3211 mModified = modified; 3217 mModified = modified;
3212 emit modifiedChanged(mModified); 3218 emit modifiedChanged(mModified);
3213 } 3219 }
3214} 3220}
3215 3221
3216bool CalendarView::isReadOnly() 3222bool CalendarView::isReadOnly()
3217{ 3223{
3218 return mReadOnly; 3224 return mReadOnly;
3219} 3225}
3220 3226
3221void CalendarView::setReadOnly(bool readOnly) 3227void CalendarView::setReadOnly(bool readOnly)
3222{ 3228{
3223 if (mReadOnly != readOnly) { 3229 if (mReadOnly != readOnly) {
3224 mReadOnly = readOnly; 3230 mReadOnly = readOnly;
3225 emit readOnlyChanged(mReadOnly); 3231 emit readOnlyChanged(mReadOnly);
3226 } 3232 }
3227} 3233}
3228 3234
3229bool CalendarView::isModified() 3235bool CalendarView::isModified()
3230{ 3236{
3231 return mModified; 3237 return mModified;
3232} 3238}
3233 3239
3234void CalendarView::printSetup() 3240void CalendarView::printSetup()
3235{ 3241{
3236#ifndef KORG_NOPRINTER 3242#ifndef KORG_NOPRINTER
3237 createPrinter(); 3243 createPrinter();
3238 3244
3239 mCalPrinter->setupPrinter(); 3245 mCalPrinter->setupPrinter();
3240#endif 3246#endif
3241} 3247}
3242 3248
3243void CalendarView::print() 3249void CalendarView::print()
3244{ 3250{
3245#ifndef KORG_NOPRINTER 3251#ifndef KORG_NOPRINTER
3246 createPrinter(); 3252 createPrinter();
3247 3253
3248 DateList tmpDateList = mNavigator->selectedDates(); 3254 DateList tmpDateList = mNavigator->selectedDates();
3249 mCalPrinter->print(CalPrinter::Month, 3255 mCalPrinter->print(CalPrinter::Month,
3250 tmpDateList.first(), tmpDateList.last()); 3256 tmpDateList.first(), tmpDateList.last());
3251#endif 3257#endif
3252} 3258}
3253 3259
3254void CalendarView::printPreview() 3260void CalendarView::printPreview()
3255{ 3261{
3256#ifndef KORG_NOPRINTER 3262#ifndef KORG_NOPRINTER
3257 kdDebug() << "CalendarView::printPreview()" << endl; 3263 kdDebug() << "CalendarView::printPreview()" << endl;
3258 3264
3259 createPrinter(); 3265 createPrinter();
3260 3266
3261 DateList tmpDateList = mNavigator->selectedDates(); 3267 DateList tmpDateList = mNavigator->selectedDates();
3262 3268
3263 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3269 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3264 tmpDateList.last()); 3270 tmpDateList.last());
3265#endif 3271#endif
3266} 3272}
3267 3273
3268void CalendarView::exportICalendar() 3274void CalendarView::exportICalendar()
3269{ 3275{
3270 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3276 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3271 3277
3272 // Force correct extension 3278 // Force correct extension
3273 if (filename.right(4) != ".ics") filename += ".ics"; 3279 if (filename.right(4) != ".ics") filename += ".ics";
3274 3280
3275 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3281 FileStorage storage( mCalendar, filename, new ICalFormat() );
3276 storage.save(); 3282 storage.save();
3277} 3283}
3278 3284
3279bool CalendarView::exportVCalendar( QString filename ) 3285bool CalendarView::exportVCalendar( QString filename )
3280{ 3286{
3281 if (mCalendar->journals().count() > 0) { 3287 if (mCalendar->journals().count() > 0) {
3282 int result = KMessageBox::warningContinueCancel(this, 3288 int result = KMessageBox::warningContinueCancel(this,
3283 i18n("The journal entries can not be\nexported to a vCalendar file."), 3289 i18n("The journal entries can not be\nexported to a vCalendar file."),
3284 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3290 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3285 true); 3291 true);
3286 if (result != KMessageBox::Continue) return false; 3292 if (result != KMessageBox::Continue) return false;
3287 } 3293 }
3288 3294
3289 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3295 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3290 3296
3291 // Force correct extension 3297 // Force correct extension
3292 if (filename.right(4) != ".vcs") filename += ".vcs"; 3298 if (filename.right(4) != ".vcs") filename += ".vcs";
3293 3299
3294 FileStorage storage( mCalendar, filename, new VCalFormat ); 3300 FileStorage storage( mCalendar, filename, new VCalFormat );
3295 return storage.save(); 3301 return storage.save();
3296 3302
3297} 3303}
3298 3304
3299void CalendarView::eventUpdated(Incidence *) 3305void CalendarView::eventUpdated(Incidence *)
3300{ 3306{
3301 setModified(); 3307 setModified();
3302 // Don't call updateView here. The code, which has caused the update of the 3308 // Don't call updateView here. The code, which has caused the update of the
3303 // event is responsible for updating the view. 3309 // event is responsible for updating the view.
3304 // updateView(); 3310 // updateView();
3305} 3311}
3306 3312
3307void CalendarView::adaptNavigationUnits() 3313void CalendarView::adaptNavigationUnits()
3308{ 3314{
3309 if (mViewManager->currentView()->isEventView()) { 3315 if (mViewManager->currentView()->isEventView()) {
3310 int days = mViewManager->currentView()->currentDateCount(); 3316 int days = mViewManager->currentView()->currentDateCount();
3311 if (days == 1) { 3317 if (days == 1) {
3312 emit changeNavStringPrev(i18n("&Previous Day")); 3318 emit changeNavStringPrev(i18n("&Previous Day"));
3313 emit changeNavStringNext(i18n("&Next Day")); 3319 emit changeNavStringNext(i18n("&Next Day"));
3314 } else { 3320 } else {
3315 emit changeNavStringPrev(i18n("&Previous Week")); 3321 emit changeNavStringPrev(i18n("&Previous Week"));
3316 emit changeNavStringNext(i18n("&Next Week")); 3322 emit changeNavStringNext(i18n("&Next Week"));
3317 } 3323 }
3318 } 3324 }
3319} 3325}
3320 3326
3321void CalendarView::processMainViewSelection( Incidence *incidence ) 3327void CalendarView::processMainViewSelection( Incidence *incidence )
3322{ 3328{
3323 if ( incidence ) mTodoList->clearSelection(); 3329 if ( incidence ) mTodoList->clearSelection();
3324 processIncidenceSelection( incidence ); 3330 processIncidenceSelection( incidence );
3325} 3331}
3326 3332
3327void CalendarView::processTodoListSelection( Incidence *incidence ) 3333void CalendarView::processTodoListSelection( Incidence *incidence )
3328{ 3334{
3329 if ( incidence && mViewManager->currentView() ) { 3335 if ( incidence && mViewManager->currentView() ) {
3330 mViewManager->currentView()->clearSelection(); 3336 mViewManager->currentView()->clearSelection();
3331 } 3337 }
3332 processIncidenceSelection( incidence ); 3338 processIncidenceSelection( incidence );
3333} 3339}
3334 3340
3335void CalendarView::processIncidenceSelection( Incidence *incidence ) 3341void CalendarView::processIncidenceSelection( Incidence *incidence )
3336{ 3342{
3337 if ( incidence == mSelectedIncidence ) return; 3343 if ( incidence == mSelectedIncidence ) return;
3338 3344
3339 mSelectedIncidence = incidence; 3345 mSelectedIncidence = incidence;
3340 3346
3341 emit incidenceSelected( mSelectedIncidence ); 3347 emit incidenceSelected( mSelectedIncidence );
3342 3348
3343 if ( incidence && incidence->type() == "Event" ) { 3349 if ( incidence && incidence->type() == "Event" ) {
3344 Event *event = static_cast<Event *>( incidence ); 3350 Event *event = static_cast<Event *>( incidence );
3345 if ( event->organizer() == KOPrefs::instance()->email() ) { 3351 if ( event->organizer() == KOPrefs::instance()->email() ) {
3346 emit organizerEventsSelected( true ); 3352 emit organizerEventsSelected( true );
3347 } else { 3353 } else {
3348 emit organizerEventsSelected(false); 3354 emit organizerEventsSelected(false);
3349 } 3355 }
3350 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3356 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3351 KOPrefs::instance()->email() ) ) { 3357 KOPrefs::instance()->email() ) ) {
3352 emit groupEventsSelected( true ); 3358 emit groupEventsSelected( true );
3353 } else { 3359 } else {
3354 emit groupEventsSelected(false); 3360 emit groupEventsSelected(false);
3355 } 3361 }
3356 return; 3362 return;
3357 } else { 3363 } else {
3358 if ( incidence && incidence->type() == "Todo" ) { 3364 if ( incidence && incidence->type() == "Todo" ) {
3359 emit todoSelected( true ); 3365 emit todoSelected( true );
3360 Todo *event = static_cast<Todo *>( incidence ); 3366 Todo *event = static_cast<Todo *>( incidence );
3361 if ( event->organizer() == KOPrefs::instance()->email() ) { 3367 if ( event->organizer() == KOPrefs::instance()->email() ) {
3362 emit organizerEventsSelected( true ); 3368 emit organizerEventsSelected( true );
3363 } else { 3369 } else {
3364 emit organizerEventsSelected(false); 3370 emit organizerEventsSelected(false);
3365 } 3371 }
3366 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3372 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3367 KOPrefs::instance()->email() ) ) { 3373 KOPrefs::instance()->email() ) ) {
3368 emit groupEventsSelected( true ); 3374 emit groupEventsSelected( true );
3369 } else { 3375 } else {
3370 emit groupEventsSelected(false); 3376 emit groupEventsSelected(false);
3371 } 3377 }
3372 return; 3378 return;
3373 } else { 3379 } else {
3374 emit todoSelected( false ); 3380 emit todoSelected( false );
3375 emit organizerEventsSelected(false); 3381 emit organizerEventsSelected(false);
3376 emit groupEventsSelected(false); 3382 emit groupEventsSelected(false);
3377 } 3383 }
3378 return; 3384 return;
3379 } 3385 }
3380 3386
3381 /* if ( incidence && incidence->type() == "Todo" ) { 3387 /* if ( incidence && incidence->type() == "Todo" ) {
3382 emit todoSelected( true ); 3388 emit todoSelected( true );
3383 } else { 3389 } else {
3384 emit todoSelected( false ); 3390 emit todoSelected( false );
3385 }*/ 3391 }*/
3386} 3392}
3387 3393
3388 3394
3389void CalendarView::checkClipboard() 3395void CalendarView::checkClipboard()
3390{ 3396{
3391#ifndef KORG_NODND 3397#ifndef KORG_NODND
3392 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3398 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3393 emit pasteEnabled(true); 3399 emit pasteEnabled(true);
3394 } else { 3400 } else {
3395 emit pasteEnabled(false); 3401 emit pasteEnabled(false);
3396 } 3402 }
3397#endif 3403#endif
3398} 3404}
3399 3405
3400void CalendarView::showDates(const DateList &selectedDates) 3406void CalendarView::showDates(const DateList &selectedDates)
3401{ 3407{
3402 // kdDebug() << "CalendarView::selectDates()" << endl; 3408 // kdDebug() << "CalendarView::selectDates()" << endl;
3403 3409
3404 if ( mViewManager->currentView() ) { 3410 if ( mViewManager->currentView() ) {
3405 updateView( selectedDates.first(), selectedDates.last() ); 3411 updateView( selectedDates.first(), selectedDates.last() );
3406 } else { 3412 } else {
3407 mViewManager->showAgendaView(); 3413 mViewManager->showAgendaView();
3408 } 3414 }
3409 3415
3410 QString selDates; 3416 QString selDates;
3411 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3417 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3412 if (selectedDates.first() < selectedDates.last() ) 3418 if (selectedDates.first() < selectedDates.last() )
3413 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3419 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3414 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3420 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3415 3421
3416} 3422}
3417 3423
3418QPtrList<CalFilter> CalendarView::filters() 3424QPtrList<CalFilter> CalendarView::filters()
3419{ 3425{
3420 return mFilters; 3426 return mFilters;
3421 3427
3422} 3428}
3423void CalendarView::editFilters() 3429void CalendarView::editFilters()
3424{ 3430{
3425 // kdDebug() << "CalendarView::editFilters()" << endl; 3431 // kdDebug() << "CalendarView::editFilters()" << endl;
3426 3432
3427 CalFilter *filter = mFilters.first(); 3433 CalFilter *filter = mFilters.first();
3428 while(filter) { 3434 while(filter) {
3429 kdDebug() << " Filter: " << filter->name() << endl; 3435 kdDebug() << " Filter: " << filter->name() << endl;
3430 filter = mFilters.next(); 3436 filter = mFilters.next();
3431 } 3437 }
3432 3438
3433 mDialogManager->showFilterEditDialog(&mFilters); 3439 mDialogManager->showFilterEditDialog(&mFilters);
3434} 3440}
3435void CalendarView::toggleFilter() 3441void CalendarView::toggleFilter()
3436{ 3442{
3437 showFilter(! mFilterView->isVisible()); 3443 showFilter(! mFilterView->isVisible());
3438} 3444}
3439 3445
3440KOFilterView *CalendarView::filterView() 3446KOFilterView *CalendarView::filterView()
3441{ 3447{
3442 return mFilterView; 3448 return mFilterView;
3443} 3449}
3444void CalendarView::selectFilter( int fil ) 3450void CalendarView::selectFilter( int fil )
3445{ 3451{
3446 mFilterView->setSelectedFilter( fil ); 3452 mFilterView->setSelectedFilter( fil );
3447} 3453}
3448void CalendarView::showFilter(bool visible) 3454void CalendarView::showFilter(bool visible)
3449{ 3455{
3450 if (visible) mFilterView->show(); 3456 if (visible) mFilterView->show();
3451 else mFilterView->hide(); 3457 else mFilterView->hide();
3452} 3458}
3453void CalendarView::toggleFilerEnabled( ) 3459void CalendarView::toggleFilerEnabled( )
3454{ 3460{
3455 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3461 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3456 if ( !mFilterView->filtersEnabled() ) 3462 if ( !mFilterView->filtersEnabled() )
3457 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3463 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3458 3464
3459} 3465}
3460void CalendarView::updateFilter() 3466void CalendarView::updateFilter()
3461{ 3467{
3462 CalFilter *filter = mFilterView->selectedFilter(); 3468 CalFilter *filter = mFilterView->selectedFilter();
3463 if (filter) { 3469 if (filter) {
3464 if (mFilterView->filtersEnabled()) { 3470 if (mFilterView->filtersEnabled()) {
3465 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3471 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3466 filter->setEnabled(true); 3472 filter->setEnabled(true);
3467 } 3473 }
3468 else filter->setEnabled(false); 3474 else filter->setEnabled(false);
3469 mCalendar->setFilter(filter); 3475 mCalendar->setFilter(filter);
3470 updateView(); 3476 updateView();
3471 } 3477 }
3472} 3478}
3473 3479
3474void CalendarView::filterEdited() 3480void CalendarView::filterEdited()
3475{ 3481{
3476 mFilterView->updateFilters(); 3482 mFilterView->updateFilters();
3477 updateFilter(); 3483 updateFilter();
3478 writeSettings(); 3484 writeSettings();
3479} 3485}
3480 3486
3481 3487
3482void CalendarView::takeOverEvent() 3488void CalendarView::takeOverEvent()
3483{ 3489{
3484 Incidence *incidence = currentSelection(); 3490 Incidence *incidence = currentSelection();
3485 3491
3486 if (!incidence) return; 3492 if (!incidence) return;
3487 3493
3488 incidence->setOrganizer(KOPrefs::instance()->email()); 3494 incidence->setOrganizer(KOPrefs::instance()->email());
3489 incidence->recreate(); 3495 incidence->recreate();
3490 incidence->setReadOnly(false); 3496 incidence->setReadOnly(false);
3491 3497
3492 updateView(); 3498 updateView();
3493} 3499}
3494 3500
3495void CalendarView::takeOverCalendar() 3501void CalendarView::takeOverCalendar()
3496{ 3502{
3497 // TODO: Create Calendar::allIncidences() function and use it here 3503 // TODO: Create Calendar::allIncidences() function and use it here
3498 3504
3499 QPtrList<Event> events = mCalendar->events(); 3505 QPtrList<Event> events = mCalendar->events();
3500 for(uint i=0; i<events.count(); ++i) { 3506 for(uint i=0; i<events.count(); ++i) {
3501 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3507 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3502 events.at(i)->recreate(); 3508 events.at(i)->recreate();
3503 events.at(i)->setReadOnly(false); 3509 events.at(i)->setReadOnly(false);
3504 } 3510 }
3505 3511
3506 QPtrList<Todo> todos = mCalendar->todos(); 3512 QPtrList<Todo> todos = mCalendar->todos();
3507 for(uint i=0; i<todos.count(); ++i) { 3513 for(uint i=0; i<todos.count(); ++i) {
3508 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3514 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3509 todos.at(i)->recreate(); 3515 todos.at(i)->recreate();
3510 todos.at(i)->setReadOnly(false); 3516 todos.at(i)->setReadOnly(false);
3511 } 3517 }
3512 3518
3513 QPtrList<Journal> journals = mCalendar->journals(); 3519 QPtrList<Journal> journals = mCalendar->journals();
3514 for(uint i=0; i<journals.count(); ++i) { 3520 for(uint i=0; i<journals.count(); ++i) {
3515 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3521 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3516 journals.at(i)->recreate(); 3522 journals.at(i)->recreate();
3517 journals.at(i)->setReadOnly(false); 3523 journals.at(i)->setReadOnly(false);
3518 } 3524 }
3519 3525
3520 updateView(); 3526 updateView();
3521} 3527}
3522 3528
3523void CalendarView::showIntro() 3529void CalendarView::showIntro()
3524{ 3530{
3525 kdDebug() << "To be implemented." << endl; 3531 kdDebug() << "To be implemented." << endl;
3526} 3532}
3527 3533
3528QWidgetStack *CalendarView::viewStack() 3534QWidgetStack *CalendarView::viewStack()
3529{ 3535{
3530 return mRightFrame; 3536 return mRightFrame;
3531} 3537}
3532 3538
3533QWidget *CalendarView::leftFrame() 3539QWidget *CalendarView::leftFrame()
3534{ 3540{
3535 return mLeftFrame; 3541 return mLeftFrame;
3536} 3542}
3537 3543
3538DateNavigator *CalendarView::dateNavigator() 3544DateNavigator *CalendarView::dateNavigator()
3539{ 3545{
3540 return mNavigator; 3546 return mNavigator;
3541} 3547}
3542 3548
3543KDateNavigator* CalendarView::dateNavigatorWidget() 3549KDateNavigator* CalendarView::dateNavigatorWidget()
3544{ 3550{
3545 return mDateNavigator; 3551 return mDateNavigator;
3546} 3552}
3547void CalendarView::toggleDateNavigatorWidget() 3553void CalendarView::toggleDateNavigatorWidget()
3548{ 3554{
3549 if (mDateNavigator->isVisible()) 3555 if (mDateNavigator->isVisible())
3550 mDateNavigator->hide(); 3556 mDateNavigator->hide();
3551 else 3557 else
3552 mDateNavigator->show(); 3558 mDateNavigator->show();
3553} 3559}
3554void CalendarView::addView(KOrg::BaseView *view) 3560void CalendarView::addView(KOrg::BaseView *view)
3555{ 3561{
3556 mViewManager->addView(view); 3562 mViewManager->addView(view);
3557} 3563}
3558 3564
3559void CalendarView::showView(KOrg::BaseView *view) 3565void CalendarView::showView(KOrg::BaseView *view)
3560{ 3566{
3561 mViewManager->showView(view, mLeftFrame->isVisible()); 3567 mViewManager->showView(view, mLeftFrame->isVisible());
3562} 3568}
3563 3569
3564Incidence *CalendarView::currentSelection() 3570Incidence *CalendarView::currentSelection()
3565{ 3571{
3566 return mViewManager->currentSelection(); 3572 return mViewManager->currentSelection();
3567} 3573}
3568void CalendarView::toggleAllDaySize() 3574void CalendarView::toggleAllDaySize()
3569{ 3575{
3570 /* 3576 /*
3571 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3577 if ( KOPrefs::instance()->mAllDaySize > 47 )
3572 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3578 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3573 else 3579 else
3574 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3580 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3575 */ 3581 */
3576 viewManager()->agendaView()->toggleAllDay(); 3582 viewManager()->agendaView()->toggleAllDay();
3577} 3583}
3578void CalendarView::toggleExpand() 3584void CalendarView::toggleExpand()
3579{ 3585{
3580 // if ( mLeftFrame->isHidden() ) { 3586 // if ( mLeftFrame->isHidden() ) {
3581 // mLeftFrame->show(); 3587 // mLeftFrame->show();
3582 // emit calendarViewExpanded( false ); 3588 // emit calendarViewExpanded( false );
3583 // } else { 3589 // } else {
3584 // mLeftFrame->hide(); 3590 // mLeftFrame->hide();
3585 // emit calendarViewExpanded( true ); 3591 // emit calendarViewExpanded( true );
3586 // } 3592 // }
3587 3593
3588 globalFlagBlockAgenda = 1; 3594 globalFlagBlockAgenda = 1;
3589 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3595 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3590 globalFlagBlockAgenda = 5; 3596 globalFlagBlockAgenda = 5;
3591 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3597 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3592 //mViewManager->showView( 0, true ); 3598 //mViewManager->showView( 0, true );
3593} 3599}
3594 3600
3595void CalendarView::calendarModified( bool modified, Calendar * ) 3601void CalendarView::calendarModified( bool modified, Calendar * )
3596{ 3602{
3597 setModified( modified ); 3603 setModified( modified );
3598} 3604}
3599 3605
3600Todo *CalendarView::selectedTodo() 3606Todo *CalendarView::selectedTodo()
3601{ 3607{
3602 Incidence *incidence = currentSelection(); 3608 Incidence *incidence = currentSelection();
3603 if ( incidence && incidence->type() == "Todo" ) { 3609 if ( incidence && incidence->type() == "Todo" ) {
3604 return static_cast<Todo *>( incidence ); 3610 return static_cast<Todo *>( incidence );
3605 } 3611 }
3606 3612
3607 incidence = mTodoList->selectedIncidences().first(); 3613 incidence = mTodoList->selectedIncidences().first();
3608 if ( incidence && incidence->type() == "Todo" ) { 3614 if ( incidence && incidence->type() == "Todo" ) {
3609 return static_cast<Todo *>( incidence ); 3615 return static_cast<Todo *>( incidence );
3610 } 3616 }
3611 3617
3612 return 0; 3618 return 0;
3613} 3619}
3614 3620
3615void CalendarView::dialogClosing(Incidence *in) 3621void CalendarView::dialogClosing(Incidence *in)
3616{ 3622{
3617 // mDialogList.remove(in); 3623 // mDialogList.remove(in);
3618} 3624}
3619 3625
3620void CalendarView::showIncidence() 3626void CalendarView::showIncidence()
3621{ 3627{
3622 Incidence *incidence = currentSelection(); 3628 Incidence *incidence = currentSelection();
3623 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3629 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3624 if ( incidence ) { 3630 if ( incidence ) {
3625 ShowIncidenceVisitor v; 3631 ShowIncidenceVisitor v;
3626 v.act( incidence, this ); 3632 v.act( incidence, this );
3627 } 3633 }
3628} 3634}
3629void CalendarView::editIncidenceDescription() 3635void CalendarView::editIncidenceDescription()
3630{ 3636{
3631 mFlagEditDescription = true; 3637 mFlagEditDescription = true;
3632 editIncidence(); 3638 editIncidence();
3633 mFlagEditDescription = false; 3639 mFlagEditDescription = false;
3634} 3640}
3635void CalendarView::editIncidence() 3641void CalendarView::editIncidence()
3636{ 3642{
3637 // qDebug("editIncidence() "); 3643 // qDebug("editIncidence() ");
3638 Incidence *incidence = currentSelection(); 3644 Incidence *incidence = currentSelection();
3639 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3645 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3640 if ( incidence ) { 3646 if ( incidence ) {
3641 EditIncidenceVisitor v; 3647 EditIncidenceVisitor v;
3642 v.act( incidence, this ); 3648 v.act( incidence, this );
3643 } 3649 }
3644} 3650}
3645 3651
3646void CalendarView::deleteIncidence() 3652void CalendarView::deleteIncidence()
3647{ 3653{
3648 Incidence *incidence = currentSelection(); 3654 Incidence *incidence = currentSelection();
3649 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3655 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3650 if ( incidence ) { 3656 if ( incidence ) {
3651 deleteIncidence(incidence); 3657 deleteIncidence(incidence);
3652 } 3658 }
3653} 3659}
3654 3660
3655void CalendarView::showIncidence(Incidence *incidence) 3661void CalendarView::showIncidence(Incidence *incidence)
3656{ 3662{
3657 if ( incidence ) { 3663 if ( incidence ) {
3658 ShowIncidenceVisitor v; 3664 ShowIncidenceVisitor v;
3659 v.act( incidence, this ); 3665 v.act( incidence, this );
3660 } 3666 }
3661} 3667}
3662 3668
3663void CalendarView::editIncidence(Incidence *incidence) 3669void CalendarView::editIncidence(Incidence *incidence)
3664{ 3670{
3665 if ( incidence ) { 3671 if ( incidence ) {
3666 3672
3667 EditIncidenceVisitor v; 3673 EditIncidenceVisitor v;
3668 v.act( incidence, this ); 3674 v.act( incidence, this );
3669 3675
3670 } 3676 }
3671} 3677}
3672 3678
3673void CalendarView::deleteIncidence(Incidence *incidence) 3679void CalendarView::deleteIncidence(Incidence *incidence)
3674{ 3680{
3675 //qDebug(" CalendarView::deleteIncidence "); 3681 //qDebug(" CalendarView::deleteIncidence ");
3676 if ( incidence ) { 3682 if ( incidence ) {
3677 DeleteIncidenceVisitor v; 3683 DeleteIncidenceVisitor v;
3678 v.act( incidence, this ); 3684 v.act( incidence, this );
3679 } 3685 }
3680} 3686}
3681 3687
3682 3688
3683void CalendarView::lookForOutgoingMessages() 3689void CalendarView::lookForOutgoingMessages()
3684{ 3690{
3685 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3691 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3686 ogd->loadMessages(); 3692 ogd->loadMessages();
3687} 3693}
3688 3694
3689void CalendarView::lookForIncomingMessages() 3695void CalendarView::lookForIncomingMessages()
3690{ 3696{
3691 IncomingDialog *icd = mDialogManager->incomingDialog(); 3697 IncomingDialog *icd = mDialogManager->incomingDialog();
3692 icd->retrieve(); 3698 icd->retrieve();
3693} 3699}
3694 3700
3695bool CalendarView::removeCompletedSubTodos( Todo* t ) 3701bool CalendarView::removeCompletedSubTodos( Todo* t )
3696{ 3702{
3697 bool deleteTodo = true; 3703 bool deleteTodo = true;
3698 QPtrList<Incidence> subTodos; 3704 QPtrList<Incidence> subTodos;
3699 Incidence *aTodo; 3705 Incidence *aTodo;
3700 subTodos = t->relations(); 3706 subTodos = t->relations();
3701 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3707 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3702 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3708 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3703 deleteTodo = false; 3709 deleteTodo = false;
3704 } 3710 }
3705 if ( deleteTodo ) { 3711 if ( deleteTodo ) {
3706 if ( t->isCompleted() ) { 3712 if ( t->isCompleted() ) {
3707 checkExternalId( t ); 3713 checkExternalId( t );
3708 mCalendar->deleteTodo( t ); 3714 mCalendar->deleteTodo( t );
3709 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3715 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3710 } 3716 }
3711 else 3717 else
3712 deleteTodo = false; 3718 deleteTodo = false;
3713 } 3719 }
3714 return deleteTodo; 3720 return deleteTodo;
3715 3721
3716} 3722}
3717void CalendarView::purgeCompleted() 3723void CalendarView::purgeCompleted()
3718{ 3724{
3719 int result = KMessageBox::warningContinueCancel(this, 3725 int result = KMessageBox::warningContinueCancel(this,
3720 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3726 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3721 3727
3722 if (result == KMessageBox::Continue) { 3728 if (result == KMessageBox::Continue) {
3723 3729
3724 QPtrList<Todo> todoCal; 3730 QPtrList<Todo> todoCal;
3725 QPtrList<Todo> rootTodos; 3731 QPtrList<Todo> rootTodos;
3726 //QPtrList<Incidence> rel; 3732 //QPtrList<Incidence> rel;
3727 Todo *aTodo;//, *rTodo; 3733 Todo *aTodo;//, *rTodo;
3728 Incidence *rIncidence; 3734 Incidence *rIncidence;
3729 bool childDelete = false; 3735 bool childDelete = false;
3730 bool deletedOne = true; 3736 bool deletedOne = true;
3731 todoCal = calendar()->todos(); 3737 todoCal = calendar()->todos();
3732 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3738 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3733 if ( !aTodo->relatedTo() ) 3739 if ( !aTodo->relatedTo() )
3734 rootTodos.append( aTodo ); 3740 rootTodos.append( aTodo );
3735 } 3741 }
3736 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3742 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3737 removeCompletedSubTodos( aTodo ); 3743 removeCompletedSubTodos( aTodo );
3738 } 3744 }
3739 3745
3740 updateView(); 3746 updateView();
3741 } 3747 }
3742} 3748}
3743 3749
3744void CalendarView::slotCalendarChanged() 3750void CalendarView::slotCalendarChanged()
3745{ 3751{
3746 ; 3752 ;
3747} 3753}
3748 3754
3749NavigatorBar *CalendarView::navigatorBar() 3755NavigatorBar *CalendarView::navigatorBar()
3750{ 3756{
3751 return mNavigatorBar; 3757 return mNavigatorBar;
3752} 3758}
3753 3759
3754 3760
3755 3761
3756void CalendarView::keyPressEvent ( QKeyEvent *e) 3762void CalendarView::keyPressEvent ( QKeyEvent *e)
3757{ 3763{
3758 //qDebug(" alendarView::keyPressEvent "); 3764 //qDebug(" alendarView::keyPressEvent ");
3759 e->ignore(); 3765 e->ignore();
3760} 3766}
3761 3767
3762 3768
3763bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3769bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3764{ 3770{
3765 // mSyncManager = manager; 3771 // mSyncManager = manager;
3766 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3772 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3767 qDebug("SyncKDE request detected!"); 3773 qDebug("SyncKDE request detected!");
3768 } 3774 }
3769 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3775 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3770 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3776 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3771 return syncCalendar( filename, mode ); 3777 return syncCalendar( filename, mode );
3772} 3778}
3773bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3779bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3774{ 3780{
3775 //mSyncManager = manager; 3781 //mSyncManager = manager;
3776 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3782 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3777 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3783 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3778 if ( resource == "sharp" ) 3784 if ( resource == "sharp" )
3779 syncExternal( 0 ); 3785 syncExternal( 0 );
3780 if ( resource == "phone" ) 3786 if ( resource == "phone" )
3781 syncExternal( 1 ); 3787 syncExternal( 1 );
3782 // pending setmodified 3788 // pending setmodified
3783 return true; 3789 return true;
3784} 3790}
3785void CalendarView::setSyncManager(KSyncManager* manager) 3791void CalendarView::setSyncManager(KSyncManager* manager)
3786{ 3792{
3787 mSyncManager = manager; 3793 mSyncManager = manager;
3788} 3794}
3789 3795
3790void CalendarView::removeSyncInfo( QString syncProfile) 3796void CalendarView::removeSyncInfo( QString syncProfile)
3791{ 3797{
3792 qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); 3798 qDebug("removeSyncInfo for profile %s ", syncProfile.latin1());
3793 mCalendar->removeSyncInfo( syncProfile ); 3799 mCalendar->removeSyncInfo( syncProfile );
3794 3800
3795} 3801}
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 66f6977..b73d22f 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -1,439 +1,440 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 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 thse hope that it will be useful, 10 This program is distributed in thse 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 <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapp.h> 32#include <qapp.h>
33 33
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 <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#ifndef KORG_NOKABC 39#ifndef KORG_NOKABC
40 40
41#ifdef DESKTOP_VERSION 41#ifdef DESKTOP_VERSION
42#include <kabc/addresseedialog.h> 42#include <kabc/addresseedialog.h>
43#else //DESKTOP_VERSION 43#else //DESKTOP_VERSION
44#include <externalapphandler.h> 44#include <externalapphandler.h>
45#endif //DESKTOP_VERSION 45#endif //DESKTOP_VERSION
46 46
47#endif 47#endif
48 48
49#include <libkcal/incidence.h> 49#include <libkcal/incidence.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52 52
53#include "koeditordetails.h" 53#include "koeditordetails.h"
54 54
55template <> 55template <>
56CustomListViewItem<class Attendee *>::~CustomListViewItem() 56CustomListViewItem<class Attendee *>::~CustomListViewItem()
57{ 57{
58 delete mData; 58 delete mData;
59} 59}
60 60
61template <> 61template <>
62void CustomListViewItem<class Attendee *>::updateItem() 62void CustomListViewItem<class Attendee *>::updateItem()
63{ 63{
64 setText(0,mData->name()); 64 setText(0,mData->name());
65 setText(1,mData->email()); 65 setText(1,mData->email());
66 setText(2,mData->roleStr()); 66 setText(2,mData->roleStr());
67 setText(3,mData->statusStr()); 67 setText(3,mData->statusStr());
68 if (mData->RSVP() && !mData->email().isEmpty()) 68 if (mData->RSVP() && !mData->email().isEmpty())
69 setPixmap(4,SmallIcon("mailappt")); 69 setPixmap(4,SmallIcon("mailappt"));
70 else 70 else
71 setPixmap(4,SmallIcon("nomailappt")); 71 setPixmap(4,SmallIcon("nomailappt"));
72} 72}
73 73
74 74
75KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 75KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
76 : QWidget( parent, name), mDisableItemUpdate( false ) 76 : QWidget( parent, name), mDisableItemUpdate( false )
77{ 77{
78 QGridLayout *topLayout = new QGridLayout(this); 78 QGridLayout *topLayout = new QGridLayout(this);
79 topLayout->setSpacing(spacing); 79 topLayout->setSpacing(spacing);
80 80
81 QString organizer = KOPrefs::instance()->email(); 81 QString organizer = KOPrefs::instance()->email();
82 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 82 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
83 83
84 mListView = new KListView(this,"mListView"); 84 mListView = new KListView(this,"mListView");
85 mListView->addColumn(i18n("Name"),180); 85 mListView->addColumn(i18n("Name"),180);
86 mListView->addColumn(i18n("Email"),180); 86 mListView->addColumn(i18n("Email"),180);
87 mListView->addColumn(i18n("Role"),60); 87 mListView->addColumn(i18n("Role"),60);
88 mListView->addColumn(i18n("Status"),100); 88 mListView->addColumn(i18n("Status"),100);
89 mListView->addColumn(i18n("RSVP"),35); 89 mListView->addColumn(i18n("RSVP"),35);
90 if ( KOPrefs::instance()->mCompactDialogs ) { 90 if ( KOPrefs::instance()->mCompactDialogs ) {
91 //mListView->setFixedHeight(78); 91 //mListView->setFixedHeight(78);
92 } 92 }
93 93
94 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 94 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
95 SLOT(updateAttendeeInput())); 95 SLOT(updateAttendeeInput()));
96 96
97 QLabel *attendeeLabel = new QLabel(this); 97 QLabel *attendeeLabel = new QLabel(this);
98 attendeeLabel->setText(i18n("Name:")); 98 attendeeLabel->setText(i18n("Name:"));
99 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 99 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
100 mNameEdit = new QLineEdit(this); 100 mNameEdit = new QLineEdit(this);
101 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 101 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
102 SLOT(updateAttendeeItem())); 102 SLOT(updateAttendeeItem()));
103 103
104 mUidEdit = new QLineEdit(0); 104 mUidEdit = new QLineEdit(0);
105 mUidEdit->setText(""); 105 mUidEdit->setText("");
106 106
107 QLabel *emailLabel = new QLabel(this); 107 QLabel *emailLabel = new QLabel(this);
108 emailLabel->setText(i18n("Email:")); 108 emailLabel->setText(i18n("Email:"));
109 mEmailEdit = new QLineEdit(this); 109 mEmailEdit = new QLineEdit(this);
110 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 110 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
111 SLOT(updateAttendeeItem())); 111 SLOT(updateAttendeeItem()));
112 112
113 QLabel *attendeeRoleLabel = new QLabel(this); 113 QLabel *attendeeRoleLabel = new QLabel(this);
114 attendeeRoleLabel->setText(i18n("Role:")); 114 attendeeRoleLabel->setText(i18n("Role:"));
115 mRoleCombo = new QComboBox(false,this); 115 mRoleCombo = new QComboBox(false,this);
116 mRoleCombo->insertStringList(Attendee::roleList()); 116 mRoleCombo->insertStringList(Attendee::roleList());
117 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 117 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
118 118
119 QLabel *statusLabel = new QLabel(this); 119 QLabel *statusLabel = new QLabel(this);
120 statusLabel->setText( i18n("Status:") ); 120 statusLabel->setText( i18n("Status:") );
121 121
122 mStatusCombo = new QComboBox(false,this); 122 mStatusCombo = new QComboBox(false,this);
123 mStatusCombo->insertStringList(Attendee::statusList()); 123 mStatusCombo->insertStringList(Attendee::statusList());
124 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 124 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
125 125
126 mRsvpButton = new QCheckBox(this); 126 mRsvpButton = new QCheckBox(this);
127 mRsvpButton->setText(i18n("Request response")); 127 mRsvpButton->setText(i18n("Request response"));
128 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 128 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
129 QWidget *buttonBox = new QWidget(this); 129 QWidget *buttonBox = new QWidget(this);
130 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 130 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
131 131
132 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 132 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
133 buttonLayout->addWidget(newButton); 133 buttonLayout->addWidget(newButton);
134 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 134 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
135 135
136 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 136 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
137 buttonLayout->addWidget(mRemoveButton); 137 buttonLayout->addWidget(mRemoveButton);
138 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 138 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
139 139
140 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 140 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
141 // buttonLayout->addWidget(mAddressBookButton); 141 // buttonLayout->addWidget(mAddressBookButton);
142 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 142 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
143 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 143 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
144 144
145 if (qApp->desktop()->width() < 300 ) { 145 if (qApp->desktop()->width() < 640 ) {
146 if ( qApp->desktop()->width() < 300 )
146 mListView->setFixedHeight(80); 147 mListView->setFixedHeight(80);
147 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); 148 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3);
148 topLayout->addMultiCellWidget(mListView,1,1,0,3); 149 topLayout->addMultiCellWidget(mListView,1,1,0,3);
149 topLayout->addWidget(attendeeLabel,3,0); 150 topLayout->addWidget(attendeeLabel,3,0);
150 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); 151 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2);
151 topLayout->addWidget(emailLabel,4,0); 152 topLayout->addWidget(emailLabel,4,0);
152 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); 153 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2);
153 topLayout->addWidget(attendeeRoleLabel,5,0); 154 topLayout->addWidget(attendeeRoleLabel,5,0);
154 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 155 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3);
155 topLayout->addWidget(statusLabel,6,0); 156 topLayout->addWidget(statusLabel,6,0);
156 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,2); 157 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3);
157 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); 158 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3);
158 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 159 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
159 topLayout->addMultiCellWidget(buttonBox,3,4,3,3); 160 topLayout->addMultiCellWidget(buttonBox,3,4,3,3);
160 topLayout->setRowStretch(1,2); 161 topLayout->setRowStretch(1,2);
161 topLayout->setColStretch(0,0); 162 topLayout->setColStretch(0,0);
162 topLayout->setColStretch(1,2); 163 topLayout->setColStretch(1,2);
163 topLayout->setColStretch(2,1); 164 topLayout->setColStretch(2,1);
164 topLayout->setColStretch(3,1); 165 topLayout->setColStretch(3,1);
165 166
166 } else { 167 } else {
167 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 168 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
168 topLayout->addMultiCellWidget(mListView,1,1,0,5); 169 topLayout->addMultiCellWidget(mListView,1,1,0,5);
169 topLayout->addWidget(attendeeLabel,3,0); 170 topLayout->addWidget(attendeeLabel,3,0);
170 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); 171 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
171 topLayout->addWidget(emailLabel,4,0); 172 topLayout->addWidget(emailLabel,4,0);
172 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); 173 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
173 topLayout->addWidget(attendeeRoleLabel,5,0); 174 topLayout->addWidget(attendeeRoleLabel,5,0);
174 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 175 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
175 topLayout->addWidget(statusLabel,5,3); 176 topLayout->addWidget(statusLabel,5,3);
176 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); 177 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
177 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); 178 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5);
178 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 179 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
179 topLayout->addMultiCellWidget(buttonBox,3,4,5,5); 180 topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
180 topLayout->setRowStretch(1,5); 181 topLayout->setRowStretch(1,5);
181 topLayout->setColStretch(0,0); 182 topLayout->setColStretch(0,0);
182 } 183 }
183// #if 0 184// #if 0
184// topLayout->setColStretch(2,1); 185// topLayout->setColStretch(2,1);
185// topLayout->addWidget(statusLabel,3,3); 186// topLayout->addWidget(statusLabel,3,3);
186// topLayout->addWidget(mStatusCombo,3,4); 187// topLayout->addWidget(mStatusCombo,3,4);
187// #else 188// #else
188// topLayout->addWidget(statusLabel,4,3); 189// topLayout->addWidget(statusLabel,4,3);
189// // topLayout->addWidget(mStatusCombo,4,3); 190// // topLayout->addWidget(mStatusCombo,4,3);
190// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); 191// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5);
191 192
192// #endif 193// #endif
193// // topLayout->setRowStretch(5,1); 194// // topLayout->setRowStretch(5,1);
194// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); 195// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1);
195// topLayout->addMultiCellWidget(buttonBox,2,3,5,5); 196// topLayout->addMultiCellWidget(buttonBox,2,3,5,5);
196// topLayout->setRowStretch(1,5); 197// topLayout->setRowStretch(1,5);
197// topLayout->setColStretch(0,0); 198// topLayout->setColStretch(0,0);
198 199
199#ifdef KORG_NOKABC 200#ifdef KORG_NOKABC
200 mAddressBookButton->hide(); 201 mAddressBookButton->hide();
201#endif 202#endif
202 203
203 updateAttendeeInput(); 204 updateAttendeeInput();
204#ifndef DESKTOP_VERSION 205#ifndef DESKTOP_VERSION
205//US listen for arriving address resultsets 206//US listen for arriving address resultsets
206 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 207 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
207 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 208 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
208#endif 209#endif
209 210
210} 211}
211 212
212KOEditorDetails::~KOEditorDetails() 213KOEditorDetails::~KOEditorDetails()
213{ 214{
214} 215}
215 216
216void KOEditorDetails::removeAttendee() 217void KOEditorDetails::removeAttendee()
217{ 218{
218 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); 219 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem();
219 if (!aItem) return; 220 if (!aItem) return;
220 221
221 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), 222 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(),
222 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), 223 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(),
223 aItem->data()->uid()); 224 aItem->data()->uid());
224 mdelAttendees.append(delA); 225 mdelAttendees.append(delA);
225 226
226 delete aItem; 227 delete aItem;
227 228
228 updateAttendeeInput(); 229 updateAttendeeInput();
229} 230}
230 231
231 232
232void KOEditorDetails::openAddressBook() 233void KOEditorDetails::openAddressBook()
233{ 234{
234#ifndef KORG_NOKABC 235#ifndef KORG_NOKABC
235 236
236#ifdef DESKTOP_VERSION 237#ifdef DESKTOP_VERSION
237 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 238 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
238 uint i=0; 239 uint i=0;
239 for (i=0; i < list.count(); i++) { 240 for (i=0; i < list.count(); i++) {
240 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); 241 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) );
241 } 242 }
242#else 243#else
243 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 244 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
244 // the result should now arrive through method insertAttendees 245 // the result should now arrive through method insertAttendees
245#endif 246#endif
246 247
247 248
248#if 0 249#if 0
249 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 250 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
250 if (!a.isEmpty()) { 251 if (!a.isEmpty()) {
251 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); 252 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) );
252 } 253 }
253#endif 254#endif
254#endif 255#endif
255} 256}
256 257
257 258
258void KOEditorDetails::addNewAttendee() 259void KOEditorDetails::addNewAttendee()
259{ 260{
260#if 0 261#if 0
261 // this is cool. If they didn't enter an email address, 262 // this is cool. If they didn't enter an email address,
262 // try to look it up in the address book and fill it in for them. 263 // try to look it up in the address book and fill it in for them.
263 if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { 264 if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) {
264 KabAPI addrBook; 265 KabAPI addrBook;
265 QString name; 266 QString name;
266 std::list<AddressBook::Entry> entries; 267 std::list<AddressBook::Entry> entries;
267 name = mNameEdit->text(); 268 name = mNameEdit->text();
268 if (addrBook.init() == AddressBook::NoError) { 269 if (addrBook.init() == AddressBook::NoError) {
269 if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { 270 if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) {
270 kdDebug() << "positive match" << endl; 271 kdDebug() << "positive match" << endl;
271 // take first email address 272 // take first email address
272 if (!entries.front().emails.isEmpty() && 273 if (!entries.front().emails.isEmpty() &&
273 entries.front().emails.first().length()>0) 274 entries.front().emails.first().length()>0)
274 mEmailEdit->setText(entries.front().emails.first()); 275 mEmailEdit->setText(entries.front().emails.first());
275 } 276 }
276 } 277 }
277 } 278 }
278#endif 279#endif
279 280
280 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); 281 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)"));
281 insertAttendee(a); 282 insertAttendee(a);
282} 283}
283 284
284//the map includes name/email pairs, that comes from Ka/Pi 285//the map includes name/email pairs, that comes from Ka/Pi
285void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 286void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
286{ 287{
287 if (uid == this->name()) 288 if (uid == this->name())
288 { 289 {
289 for ( int i = 0; i < nameList.count(); i++) 290 for ( int i = 0; i < nameList.count(); i++)
290 { 291 {
291 QString _name = nameList[i]; 292 QString _name = nameList[i];
292 QString _email = emailList[i]; 293 QString _email = emailList[i];
293 QString _uid = uidList[i]; 294 QString _uid = uidList[i];
294 295
295 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); 296 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid);
296 insertAttendee(a); 297 insertAttendee(a);
297 } 298 }
298 } 299 }
299 300
300} 301}
301 302
302void KOEditorDetails::insertAttendee(Attendee *a) 303void KOEditorDetails::insertAttendee(Attendee *a)
303{ 304{
304 AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); 305 AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild();
305 while (first) { 306 while (first) {
306 if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) 307 if ( first->data()->name() == a->name() && first->data()->email() == a->email() )
307 return; 308 return;
308 first = (AttendeeListItem*) first->nextSibling(); 309 first = (AttendeeListItem*) first->nextSibling();
309 } 310 }
310 311
311 AttendeeListItem *item = new AttendeeListItem(a,mListView); 312 AttendeeListItem *item = new AttendeeListItem(a,mListView);
312 mListView->setSelected( item, true ); 313 mListView->setSelected( item, true );
313} 314}
314 315
315void KOEditorDetails::setDefaults() 316void KOEditorDetails::setDefaults()
316{ 317{
317 mRsvpButton->setChecked(true); 318 mRsvpButton->setChecked(true);
318 mListView->clear(); 319 mListView->clear();
319 mdelAttendees.clear(); 320 mdelAttendees.clear();
320 clearAttendeeInput(); 321 clearAttendeeInput();
321 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); 322 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email()));
322 323
323 mNameEdit->setText(""); 324 mNameEdit->setText("");
324 mUidEdit->setText(""); 325 mUidEdit->setText("");
325 mEmailEdit->setText(""); 326 mEmailEdit->setText("");
326 mRoleCombo->setCurrentItem( 0 ); 327 mRoleCombo->setCurrentItem( 0 );
327 mStatusCombo->setCurrentItem( 0 ); 328 mStatusCombo->setCurrentItem( 0 );
328 329
329} 330}
330 331
331void KOEditorDetails::readEvent(Incidence *event) 332void KOEditorDetails::readEvent(Incidence *event)
332{ 333{
333 setDefaults(); 334 setDefaults();
334 //mListView->clear(); 335 //mListView->clear();
335 //mdelAttendees.clear(); 336 //mdelAttendees.clear();
336 QPtrList<Attendee> tmpAList = event->attendees(); 337 QPtrList<Attendee> tmpAList = event->attendees();
337 Attendee *a; 338 Attendee *a;
338 for (a = tmpAList.first(); a; a = tmpAList.next()) 339 for (a = tmpAList.first(); a; a = tmpAList.next())
339 insertAttendee(new Attendee(*a)); 340 insertAttendee(new Attendee(*a));
340 341
341 mListView->setSelected( mListView->firstChild(), true ); 342 mListView->setSelected( mListView->firstChild(), true );
342 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); 343 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer()));
343} 344}
344 345
345void KOEditorDetails::writeEvent(Incidence *event) 346void KOEditorDetails::writeEvent(Incidence *event)
346{ 347{
347 event->clearAttendees(); 348 event->clearAttendees();
348 QListViewItem *item; 349 QListViewItem *item;
349 AttendeeListItem *a; 350 AttendeeListItem *a;
350 for (item = mListView->firstChild(); item; 351 for (item = mListView->firstChild(); item;
351 item = item->nextSibling()) { 352 item = item->nextSibling()) {
352 a = (AttendeeListItem *)item; 353 a = (AttendeeListItem *)item;
353 event->addAttendee(new Attendee(*(a->data()))); 354 event->addAttendee(new Attendee(*(a->data())));
354 } 355 }
355 event->setOrganizer(KOPrefs::instance()->email()); 356 event->setOrganizer(KOPrefs::instance()->email());
356} 357}
357 358
358void KOEditorDetails::cancelAttendeeEvent(Incidence *event) 359void KOEditorDetails::cancelAttendeeEvent(Incidence *event)
359{ 360{
360 event->clearAttendees(); 361 event->clearAttendees();
361 Attendee * att; 362 Attendee * att;
362 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { 363 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) {
363 event->addAttendee(new Attendee(*att)); 364 event->addAttendee(new Attendee(*att));
364 } 365 }
365 mdelAttendees.clear(); 366 mdelAttendees.clear();
366} 367}
367 368
368bool KOEditorDetails::validateInput() 369bool KOEditorDetails::validateInput()
369{ 370{
370 return true; 371 return true;
371} 372}
372 373
373void KOEditorDetails::updateAttendeeInput() 374void KOEditorDetails::updateAttendeeInput()
374{ 375{
375 QListViewItem *item = mListView->selectedItem(); 376 QListViewItem *item = mListView->selectedItem();
376 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 377 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
377 if (aItem) { 378 if (aItem) {
378 fillAttendeeInput( aItem ); 379 fillAttendeeInput( aItem );
379 } else { 380 } else {
380 clearAttendeeInput(); 381 clearAttendeeInput();
381 } 382 }
382} 383}
383 384
384void KOEditorDetails::clearAttendeeInput() 385void KOEditorDetails::clearAttendeeInput()
385{ 386{
386 mNameEdit->setText(""); 387 mNameEdit->setText("");
387 mUidEdit->setText(""); 388 mUidEdit->setText("");
388 mEmailEdit->setText(""); 389 mEmailEdit->setText("");
389 mRoleCombo->setCurrentItem(0); 390 mRoleCombo->setCurrentItem(0);
390 mStatusCombo->setCurrentItem(0); 391 mStatusCombo->setCurrentItem(0);
391 mRsvpButton->setChecked(true); 392 mRsvpButton->setChecked(true);
392 setEnabledAttendeeInput( false ); 393 setEnabledAttendeeInput( false );
393} 394}
394 395
395void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) 396void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
396{ 397{
397 Attendee *a = aItem->data(); 398 Attendee *a = aItem->data();
398 mDisableItemUpdate = true; 399 mDisableItemUpdate = true;
399 mNameEdit->setText(a->name()); 400 mNameEdit->setText(a->name());
400 mUidEdit->setText(a->uid()); 401 mUidEdit->setText(a->uid());
401 mEmailEdit->setText(a->email()); 402 mEmailEdit->setText(a->email());
402 mRoleCombo->setCurrentItem(a->role()); 403 mRoleCombo->setCurrentItem(a->role());
403 mStatusCombo->setCurrentItem(a->status()); 404 mStatusCombo->setCurrentItem(a->status());
404 mRsvpButton->setChecked(a->RSVP()); 405 mRsvpButton->setChecked(a->RSVP());
405 406
406 mDisableItemUpdate = false; 407 mDisableItemUpdate = false;
407 408
408 setEnabledAttendeeInput( true ); 409 setEnabledAttendeeInput( true );
409} 410}
410 411
411void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) 412void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
412{ 413{
413 mNameEdit->setEnabled( enabled ); 414 mNameEdit->setEnabled( enabled );
414 mEmailEdit->setEnabled( enabled ); 415 mEmailEdit->setEnabled( enabled );
415 mRoleCombo->setEnabled( enabled ); 416 mRoleCombo->setEnabled( enabled );
416 mStatusCombo->setEnabled( enabled ); 417 mStatusCombo->setEnabled( enabled );
417 mRsvpButton->setEnabled( enabled ); 418 mRsvpButton->setEnabled( enabled );
418 419
419 mRemoveButton->setEnabled( enabled ); 420 mRemoveButton->setEnabled( enabled );
420} 421}
421 422
422void KOEditorDetails::updateAttendeeItem() 423void KOEditorDetails::updateAttendeeItem()
423{ 424{
424 if (mDisableItemUpdate) return; 425 if (mDisableItemUpdate) return;
425 426
426 QListViewItem *item = mListView->selectedItem(); 427 QListViewItem *item = mListView->selectedItem();
427 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 428 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
428 if ( !aItem ) return; 429 if ( !aItem ) return;
429 430
430 Attendee *a = aItem->data(); 431 Attendee *a = aItem->data();
431 432
432 a->setName( mNameEdit->text() ); 433 a->setName( mNameEdit->text() );
433 a->setUid( mUidEdit->text() ); 434 a->setUid( mUidEdit->text() );
434 a->setEmail( mEmailEdit->text() ); 435 a->setEmail( mEmailEdit->text() );
435 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); 436 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
436 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); 437 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
437 a->setRSVP( mRsvpButton->isChecked() ); 438 a->setRSVP( mRsvpButton->isChecked() );
438 aItem->updateItem(); 439 aItem->updateItem();
439} 440}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 65566b5..46ae6a0 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1907 +1,1910 @@
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 "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#include "koimportoldialog.h" 69#include "koimportoldialog.h"
70#endif 70#endif
71#include "mainwindow.h" 71#include "mainwindow.h"
72 72
73class KOex2phonePrefs : public QDialog 73class KOex2phonePrefs : public QDialog
74{ 74{
75 public: 75 public:
76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
77 QDialog( parent, name, true ) 77 QDialog( parent, name, true )
78 { 78 {
79 setCaption( i18n("Export to phone options") ); 79 setCaption( i18n("Export to phone options") );
80 QVBoxLayout* lay = new QVBoxLayout( this ); 80 QVBoxLayout* lay = new QVBoxLayout( this );
81 lay->setSpacing( 3 ); 81 lay->setSpacing( 3 );
82 lay->setMargin( 3 ); 82 lay->setMargin( 3 );
83 QLabel *lab; 83 QLabel *lab;
84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
85 lab->setAlignment (AlignHCenter ); 85 lab->setAlignment (AlignHCenter );
86 QHBox* temphb; 86 QHBox* temphb;
87 temphb = new QHBox( this ); 87 temphb = new QHBox( this );
88 new QLabel( i18n("I/O device: "), temphb ); 88 new QLabel( i18n("I/O device: "), temphb );
89 mPhoneDevice = new QLineEdit( temphb); 89 mPhoneDevice = new QLineEdit( temphb);
90 lay->addWidget( temphb ); 90 lay->addWidget( temphb );
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("Connection: "), temphb ); 92 new QLabel( i18n("Connection: "), temphb );
93 mPhoneConnection = new QLineEdit( temphb); 93 mPhoneConnection = 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("Model(opt.): "), temphb ); 96 new QLabel( i18n("Model(opt.): "), temphb );
97 mPhoneModel = new QLineEdit( temphb); 97 mPhoneModel = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 100 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 101 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 102 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 103 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 105 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 106 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 108 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116 qApp->processEvents();
117 int dw = QApplication::desktop()->width();
118 int dh = QApplication::desktop()->height();
119 move( (dw-width())/2, (dh - height() )/2 );
117 } 120 }
118 121
119public: 122public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 123 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 124 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 125 QSpinBox* mWriteBackFutureWeeks;
123}; 126};
124 127
125int globalFlagBlockStartup; 128int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 129MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 130 QMainWindow( parent, name )
128{ 131{
129 132
130#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 134 setFont( QFont("Arial"), 14 );
132#endif 135#endif
133 mClosed = false; 136 mClosed = false;
134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
135 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
136 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
137 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
138 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
139 mBlockAtStartup = true; 142 mBlockAtStartup = true;
140 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
141 setCaption("KOrganizer/Pi"); 144 setCaption("KOrganizer/Pi");
142 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
143 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
144 if ( p->mHourSize > 18 ) 147 if ( p->mHourSize > 18 )
145 p->mHourSize = 18; 148 p->mHourSize = 18;
146 QMainWindow::ToolBarDock tbd; 149 QMainWindow::ToolBarDock tbd;
147 if ( p->mToolBarHor ) { 150 if ( p->mToolBarHor ) {
148 if ( p->mToolBarUp ) 151 if ( p->mToolBarUp )
149 tbd = Bottom; 152 tbd = Bottom;
150 else 153 else
151 tbd = Top; 154 tbd = Top;
152 } 155 }
153 else { 156 else {
154 if ( p->mToolBarUp ) 157 if ( p->mToolBarUp )
155 tbd = Right; 158 tbd = Right;
156 else 159 else
157 tbd = Left; 160 tbd = Left;
158 } 161 }
159 if ( KOPrefs::instance()->mUseAppColors ) 162 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 164 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 165 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 166 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 167 mCalendarModifiedFlag = false;
165 168
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 169 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 170 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 171 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 172#ifndef DESKTOP_VERSION
170 showMaximized(); 173 showMaximized();
171#endif 174#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 176 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 177 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 178 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 179 mView->hide();
177 //mView->resize(splash->size() ); 180 //mView->resize(splash->size() );
178 initActions(); 181 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 183 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 184 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 186 iconToolBar->show();
184 qApp->processEvents(); 187 qApp->processEvents();
185#endif 188#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 190 int vh = height() ;
188 int vw = width(); 191 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
192 } else { 195 } else {
193 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
194 } 197 }
195 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 201 mView->readSettings();
199 bool newFile = false; 202 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 206 qDebug("oldfile %s ", oldFile.latin1());
204 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"; 207 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";
205 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 209 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
209 qApp->processEvents(); 212 qApp->processEvents();
210 } else { 213 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 216 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
216 qApp->processEvents(); 219 qApp->processEvents();
217 } 220 }
218 } 221 }
219 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
220 newFile = true; 223 newFile = true;
221 } 224 }
222 225
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 230
228 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
229 KOPrefs::instance()->setCategoryDefaults(); 232 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 233 int count = mView->addCategories();
231 } 234 }
232 processIncidenceSelection( 0 ); 235 processIncidenceSelection( 0 );
233 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
234 SLOT( processIncidenceSelection( Incidence * ) ) ); 237 SLOT( processIncidenceSelection( Incidence * ) ) );
235 connect( mView, SIGNAL( modifiedChanged( bool ) ), 238 connect( mView, SIGNAL( modifiedChanged( bool ) ),
236 SLOT( slotModifiedChanged( bool ) ) ); 239 SLOT( slotModifiedChanged( bool ) ) );
237 240
238 241
239 connect( mView, SIGNAL( tempDisableBR(bool) ), 242 connect( mView, SIGNAL( tempDisableBR(bool) ),
240 SLOT( disableBR(bool) ) ); 243 SLOT( disableBR(bool) ) );
241 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
242 mView->setModified( false ); 245 mView->setModified( false );
243 mBlockAtStartup = false; 246 mBlockAtStartup = false;
244 mView->setModified( false ); 247 mView->setModified( false );
245 setCentralWidget( mView ); 248 setCentralWidget( mView );
246 globalFlagBlockStartup = 0; 249 globalFlagBlockStartup = 0;
247 mView->show(); 250 mView->show();
248 delete splash; 251 delete splash;
249 if ( newFile ) 252 if ( newFile )
250 mView->updateConfig(); 253 mView->updateConfig();
251 // qApp->processEvents(); 254 // qApp->processEvents();
252 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
253 //fillSyncMenu(); 256 //fillSyncMenu();
254 257
255 258
256 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
257 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 260 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
258 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 261 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
259 mSyncManager->setDefaultFileName( defaultFileName()); 262 mSyncManager->setDefaultFileName( defaultFileName());
260 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 263 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
261 mSyncManager->fillSyncMenu(); 264 mSyncManager->fillSyncMenu();
262 265
263 266
264 267
265 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 268 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
266 if ( showWarning ) { 269 if ( showWarning ) {
267 KMessageBox::information( this, 270 KMessageBox::information( this,
268 "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"); 271 "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");
269 qApp->processEvents(); 272 qApp->processEvents();
270 mView->dialogManager()->showSyncOptions(); 273 mView->dialogManager()->showSyncOptions();
271 } 274 }
272 275
273 //US listen for result adressed from Ka/Pi 276 //US listen for result adressed from Ka/Pi
274#ifndef DESKTOP_VERSION 277#ifndef DESKTOP_VERSION
275 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 278 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
276#endif 279#endif
277#ifndef DESKTOP_VERSION 280#ifndef DESKTOP_VERSION
278 infrared = 0; 281 infrared = 0;
279#endif 282#endif
280 283
281 mBRdisabled = false; 284 mBRdisabled = false;
282 //toggleBeamReceive(); 285 //toggleBeamReceive();
283} 286}
284MainWindow::~MainWindow() 287MainWindow::~MainWindow()
285{ 288{
286 //qDebug("MainWindow::~MainWindow() "); 289 //qDebug("MainWindow::~MainWindow() ");
287 //save toolbar location 290 //save toolbar location
288 delete mCalendar; 291 delete mCalendar;
289 delete mSyncManager; 292 delete mSyncManager;
290#ifndef DESKTOP_VERSION 293#ifndef DESKTOP_VERSION
291 if ( infrared ) 294 if ( infrared )
292 delete infrared; 295 delete infrared;
293#endif 296#endif
294 297
295 298
296} 299}
297 300
298void MainWindow::disableBR(bool b) 301void MainWindow::disableBR(bool b)
299{ 302{
300#ifndef DESKTOP_VERSION 303#ifndef DESKTOP_VERSION
301 if ( b ) { 304 if ( b ) {
302 if ( infrared ) { 305 if ( infrared ) {
303 toggleBeamReceive(); 306 toggleBeamReceive();
304 mBRdisabled = true; 307 mBRdisabled = true;
305 } 308 }
306 mBRdisabled = true; 309 mBRdisabled = true;
307 } else { 310 } else {
308 if ( mBRdisabled ) { 311 if ( mBRdisabled ) {
309 mBRdisabled = false; 312 mBRdisabled = false;
310 //makes no sense,because other cal ap is probably running 313 //makes no sense,because other cal ap is probably running
311 // toggleBeamReceive(); 314 // toggleBeamReceive();
312 } 315 }
313 } 316 }
314#endif 317#endif
315 318
316} 319}
317bool MainWindow::beamReceiveEnabled() 320bool MainWindow::beamReceiveEnabled()
318{ 321{
319#ifndef DESKTOP_VERSION 322#ifndef DESKTOP_VERSION
320 return ( infrared != 0 ); 323 return ( infrared != 0 );
321#endif 324#endif
322 return false; 325 return false;
323} 326}
324 327
325void MainWindow::toggleBeamReceive() 328void MainWindow::toggleBeamReceive()
326{ 329{
327 if ( mBRdisabled ) 330 if ( mBRdisabled )
328 return; 331 return;
329#ifndef DESKTOP_VERSION 332#ifndef DESKTOP_VERSION
330 if ( infrared ) { 333 if ( infrared ) {
331 qDebug("disable BeamReceive "); 334 qDebug("disable BeamReceive ");
332 delete infrared; 335 delete infrared;
333 infrared = 0; 336 infrared = 0;
334 brAction->setOn(false); 337 brAction->setOn(false);
335 return; 338 return;
336 } 339 }
337 qDebug("enable BeamReceive "); 340 qDebug("enable BeamReceive ");
338 brAction->setOn(true); 341 brAction->setOn(true);
339 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 342 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
340 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 343 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
341#endif 344#endif
342} 345}
343void MainWindow::showMaximized () 346void MainWindow::showMaximized ()
344{ 347{
345#ifndef DESKTOP_VERSION 348#ifndef DESKTOP_VERSION
346 if ( ! globalFlagBlockStartup ) 349 if ( ! globalFlagBlockStartup )
347 if ( mClosed ) 350 if ( mClosed )
348 mView->goToday(); 351 mView->goToday();
349#endif 352#endif
350 QWidget::showMaximized () ; 353 QWidget::showMaximized () ;
351 mClosed = false; 354 mClosed = false;
352} 355}
353void MainWindow::closeEvent( QCloseEvent* ce ) 356void MainWindow::closeEvent( QCloseEvent* ce )
354{ 357{
355 358
356 359
357 360
358 if ( ! KOPrefs::instance()->mAskForQuit ) { 361 if ( ! KOPrefs::instance()->mAskForQuit ) {
359 saveOnClose(); 362 saveOnClose();
360 mClosed = true; 363 mClosed = true;
361 ce->accept(); 364 ce->accept();
362 return; 365 return;
363 366
364 } 367 }
365 368
366 switch( QMessageBox::information( this, "KO/Pi", 369 switch( QMessageBox::information( this, "KO/Pi",
367 i18n("Do you really want\nto close KO/Pi?"), 370 i18n("Do you really want\nto close KO/Pi?"),
368 i18n("Close"), i18n("No"), 371 i18n("Close"), i18n("No"),
369 0, 0 ) ) { 372 0, 0 ) ) {
370 case 0: 373 case 0:
371 saveOnClose(); 374 saveOnClose();
372 mClosed = true; 375 mClosed = true;
373 ce->accept(); 376 ce->accept();
374 break; 377 break;
375 case 1: 378 case 1:
376 ce->ignore(); 379 ce->ignore();
377 break; 380 break;
378 case 2: 381 case 2:
379 382
380 default: 383 default:
381 break; 384 break;
382 } 385 }
383 386
384 387
385} 388}
386 389
387void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 390void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
388{ 391{
389 QDataStream stream( data, IO_ReadOnly ); 392 QDataStream stream( data, IO_ReadOnly );
390 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 393 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
391 //QString datamess; 394 //QString datamess;
392 //qDebug("message "); 395 //qDebug("message ");
393 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 396 qDebug("KO: QCOP message received: %s ", cmsg.data() );
394 397
395 if ( cmsg == "setDocument(QString)" ) { 398 if ( cmsg == "setDocument(QString)" ) {
396 QDataStream stream( data, IO_ReadOnly ); 399 QDataStream stream( data, IO_ReadOnly );
397 QString fileName; 400 QString fileName;
398 stream >> fileName; 401 stream >> fileName;
399 //qDebug("filename %s ", fileName.latin1()); 402 //qDebug("filename %s ", fileName.latin1());
400 showMaximized(); 403 showMaximized();
401 raise(); 404 raise();
402 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 405 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
403 mSyncManager->slotSyncMenu( 1002 ); 406 mSyncManager->slotSyncMenu( 1002 );
404 return; 407 return;
405 } 408 }
406 409
407 if ( cmsg == "-writeFile" ) { 410 if ( cmsg == "-writeFile" ) {
408 // I made from the "-writeFile" an "-writeAlarm" 411 // I made from the "-writeFile" an "-writeAlarm"
409 mView->viewManager()->showWhatsNextView(); 412 mView->viewManager()->showWhatsNextView();
410 mCalendar->checkAlarmForIncidence( 0, true); 413 mCalendar->checkAlarmForIncidence( 0, true);
411 showMaximized(); 414 showMaximized();
412 raise(); 415 raise();
413 return; 416 return;
414 417
415 } 418 }
416 if ( cmsg == "-writeFileSilent" ) { 419 if ( cmsg == "-writeFileSilent" ) {
417 // I made from the "-writeFile" an "-writeAlarm" 420 // I made from the "-writeFile" an "-writeAlarm"
418 // mView->viewManager()->showWhatsNextView(); 421 // mView->viewManager()->showWhatsNextView();
419 mCalendar->checkAlarmForIncidence( 0, true); 422 mCalendar->checkAlarmForIncidence( 0, true);
420 //showMaximized(); 423 //showMaximized();
421 //raise(); 424 //raise();
422 hide(); 425 hide();
423 return; 426 return;
424 } 427 }
425 if ( cmsg == "-newCountdown" ) { 428 if ( cmsg == "-newCountdown" ) {
426 qDebug("newCountdown "); 429 qDebug("newCountdown ");
427 430
428 } 431 }
429 QString msg ; 432 QString msg ;
430 QString allmsg = cmsg; 433 QString allmsg = cmsg;
431 while ( allmsg.length() > 0 ) { 434 while ( allmsg.length() > 0 ) {
432 int nextC = allmsg.find( "-", 1 ); 435 int nextC = allmsg.find( "-", 1 );
433 if ( nextC == -1 ) { 436 if ( nextC == -1 ) {
434 msg = allmsg; 437 msg = allmsg;
435 allmsg = ""; 438 allmsg = "";
436 } else{ 439 } else{
437 msg = allmsg.left( nextC ); 440 msg = allmsg.left( nextC );
438 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 441 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
439 } 442 }
440 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 443 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
441 if ( msg == "-newEvent" ) { 444 if ( msg == "-newEvent" ) {
442 mView->newEvent(); 445 mView->newEvent();
443 } 446 }
444 if ( msg == "-newTodo" ) { 447 if ( msg == "-newTodo" ) {
445 mView->newTodo(); 448 mView->newTodo();
446 449
447 } 450 }
448 if ( msg == "-showWN" ) { 451 if ( msg == "-showWN" ) {
449 mView->viewManager()->showWhatsNextView(); 452 mView->viewManager()->showWhatsNextView();
450 } 453 }
451 if ( msg == "-showTodo" ) { 454 if ( msg == "-showTodo" ) {
452 mView->viewManager()->showTodoView(); 455 mView->viewManager()->showTodoView();
453 } 456 }
454 if ( msg == "-showList" ) { 457 if ( msg == "-showList" ) {
455 mView->viewManager()->showListView(); 458 mView->viewManager()->showListView();
456 } 459 }
457 else if ( msg == "-showDay" ) { 460 else if ( msg == "-showDay" ) {
458 mView->viewManager()->showDayView(); 461 mView->viewManager()->showDayView();
459 } 462 }
460 else if ( msg == "-showWWeek" ) { 463 else if ( msg == "-showWWeek" ) {
461 mView->viewManager()->showWorkWeekView(); 464 mView->viewManager()->showWorkWeekView();
462 } 465 }
463 else if ( msg == "-ringSync" ) { 466 else if ( msg == "-ringSync" ) {
464 mSyncManager->multiSync( false ); 467 mSyncManager->multiSync( false );
465 } 468 }
466 else if ( msg == "-showWeek" ) { 469 else if ( msg == "-showWeek" ) {
467 mView->viewManager()->showWeekView(); 470 mView->viewManager()->showWeekView();
468 } 471 }
469 else if ( msg == "-showTodo" ) { 472 else if ( msg == "-showTodo" ) {
470 mView->viewManager()->showTodoView(); 473 mView->viewManager()->showTodoView();
471 } 474 }
472 else if ( msg == "-showJournal" ) { 475 else if ( msg == "-showJournal" ) {
473 mView->dateNavigator()->selectDates( 1 ); 476 mView->dateNavigator()->selectDates( 1 );
474 mView->dateNavigator()->selectToday(); 477 mView->dateNavigator()->selectToday();
475 mView->viewManager()->showJournalView(); 478 mView->viewManager()->showJournalView();
476 } 479 }
477 else if ( msg == "-showKO" ) { 480 else if ( msg == "-showKO" ) {
478 mView->viewManager()->showNextXView(); 481 mView->viewManager()->showNextXView();
479 } 482 }
480 else if ( msg == "-showWNext" || msg == "nextView()" ) { 483 else if ( msg == "-showWNext" || msg == "nextView()" ) {
481 mView->viewManager()->showWhatsNextView(); 484 mView->viewManager()->showWhatsNextView();
482 } 485 }
483 else if ( msg == "-showNextXView" ) { 486 else if ( msg == "-showNextXView" ) {
484 mView->viewManager()->showNextXView(); 487 mView->viewManager()->showNextXView();
485 } 488 }
486 489
487 490
488 } 491 }
489 492
490 showMaximized(); 493 showMaximized();
491 raise(); 494 raise();
492} 495}
493 496
494QPixmap MainWindow::loadPixmap( QString name ) 497QPixmap MainWindow::loadPixmap( QString name )
495{ 498{
496 return SmallIcon( name ); 499 return SmallIcon( name );
497 500
498} 501}
499void MainWindow::initActions() 502void MainWindow::initActions()
500{ 503{
501 //KOPrefs::instance()->mShowFullMenu 504 //KOPrefs::instance()->mShowFullMenu
502 iconToolBar->clear(); 505 iconToolBar->clear();
503 KOPrefs *p = KOPrefs::instance(); 506 KOPrefs *p = KOPrefs::instance();
504 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 507 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
505 508
506 QPopupMenu *viewMenu = new QPopupMenu( this ); 509 QPopupMenu *viewMenu = new QPopupMenu( this );
507 QPopupMenu *actionMenu = new QPopupMenu( this ); 510 QPopupMenu *actionMenu = new QPopupMenu( this );
508 QPopupMenu *importMenu = new QPopupMenu( this ); 511 QPopupMenu *importMenu = new QPopupMenu( this );
509 selectFilterMenu = new QPopupMenu( this ); 512 selectFilterMenu = new QPopupMenu( this );
510 selectFilterMenu->setCheckable( true ); 513 selectFilterMenu->setCheckable( true );
511 syncMenu = new QPopupMenu( this ); 514 syncMenu = new QPopupMenu( this );
512 configureAgendaMenu = new QPopupMenu( this ); 515 configureAgendaMenu = new QPopupMenu( this );
513 configureToolBarMenu = new QPopupMenu( this ); 516 configureToolBarMenu = new QPopupMenu( this );
514 QPopupMenu *helpMenu = new QPopupMenu( this ); 517 QPopupMenu *helpMenu = new QPopupMenu( this );
515 if ( KOPrefs::instance()->mShowFullMenu ) { 518 if ( KOPrefs::instance()->mShowFullMenu ) {
516 QMenuBar *menuBar1; 519 QMenuBar *menuBar1;
517 menuBar1 = menuBar(); 520 menuBar1 = menuBar();
518 menuBar1->insertItem( i18n("File"), importMenu ); 521 menuBar1->insertItem( i18n("File"), importMenu );
519 menuBar1->insertItem( i18n("View"), viewMenu ); 522 menuBar1->insertItem( i18n("View"), viewMenu );
520 menuBar1->insertItem( i18n("Actions"), actionMenu ); 523 menuBar1->insertItem( i18n("Actions"), actionMenu );
521 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 524 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
522 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 525 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
523 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 526 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
524 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 527 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
525 menuBar1->insertItem( i18n("Help"), helpMenu ); 528 menuBar1->insertItem( i18n("Help"), helpMenu );
526 } else { 529 } else {
527 QPEMenuBar *menuBar1; 530 QPEMenuBar *menuBar1;
528 menuBar1 = new QPEMenuBar( iconToolBar ); 531 menuBar1 = new QPEMenuBar( iconToolBar );
529 QPopupMenu *menuBar = new QPopupMenu( this ); 532 QPopupMenu *menuBar = new QPopupMenu( this );
530 menuBar1->insertItem( i18n("ME"), menuBar); 533 menuBar1->insertItem( i18n("ME"), menuBar);
531 menuBar->insertItem( i18n("File"), importMenu ); 534 menuBar->insertItem( i18n("File"), importMenu );
532 menuBar->insertItem( i18n("View"), viewMenu ); 535 menuBar->insertItem( i18n("View"), viewMenu );
533 menuBar->insertItem( i18n("Actions"), actionMenu ); 536 menuBar->insertItem( i18n("Actions"), actionMenu );
534 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 537 menuBar->insertItem( i18n("Synchronize"), syncMenu );
535 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 538 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
536 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 539 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
537 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 540 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
538 menuBar->insertItem( i18n("Help"), helpMenu ); 541 menuBar->insertItem( i18n("Help"), helpMenu );
539 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 542 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
540 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 543 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
541 } 544 }
542 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 545 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
543 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 546 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
544 547
545 // ****************** 548 // ******************
546 QAction *action; 549 QAction *action;
547 QIconSet icon; 550 QIconSet icon;
548 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 551 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
549 configureToolBarMenu->setCheckable( true ); 552 configureToolBarMenu->setCheckable( true );
550 553
551 QString pathString = ""; 554 QString pathString = "";
552 if ( !p->mToolBarMiniIcons ) { 555 if ( !p->mToolBarMiniIcons ) {
553 if ( QApplication::desktop()->width() < 480 ) 556 if ( QApplication::desktop()->width() < 480 )
554 pathString += "icons16/"; 557 pathString += "icons16/";
555 } else 558 } else
556 pathString += "iconsmini/"; 559 pathString += "iconsmini/";
557 configureAgendaMenu->setCheckable( true ); 560 configureAgendaMenu->setCheckable( true );
558 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 561 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
559 configureAgendaMenu->insertSeparator(); 562 configureAgendaMenu->insertSeparator();
560 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 563 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
561 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 564 configureAgendaMenu->insertItem(i18n("Small"), 6 );
562 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 565 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
563 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 566 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
564 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 567 configureAgendaMenu->insertItem(i18n("Large"), 12 );
565 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 568 configureAgendaMenu->insertItem(i18n("Big"), 14 );
566 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 569 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
567 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 570 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
568 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 571 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
569 572
570 icon = loadPixmap( pathString + "configure" ); 573 icon = loadPixmap( pathString + "configure" );
571 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 574 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
572 action->addTo( actionMenu ); 575 action->addTo( actionMenu );
573 connect( action, SIGNAL( activated() ), 576 connect( action, SIGNAL( activated() ),
574 mView, SLOT( edit_options() ) ); 577 mView, SLOT( edit_options() ) );
575 actionMenu->insertSeparator(); 578 actionMenu->insertSeparator();
576 icon = loadPixmap( pathString + "newevent" ); 579 icon = loadPixmap( pathString + "newevent" );
577 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 580 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
578 configureToolBarMenu->insertSeparator(); 581 configureToolBarMenu->insertSeparator();
579 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 582 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
580 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 583 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
581 ne_action->addTo( actionMenu ); 584 ne_action->addTo( actionMenu );
582 connect( ne_action, SIGNAL( activated() ), 585 connect( ne_action, SIGNAL( activated() ),
583 mView, SLOT( newEvent() ) ); 586 mView, SLOT( newEvent() ) );
584 icon = loadPixmap( pathString + "newtodo" ); 587 icon = loadPixmap( pathString + "newtodo" );
585 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 588 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
586 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 589 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
587 nt_action->addTo( actionMenu ); 590 nt_action->addTo( actionMenu );
588 connect( nt_action, SIGNAL( activated() ), 591 connect( nt_action, SIGNAL( activated() ),
589 mView, SLOT( newTodo() ) ); 592 mView, SLOT( newTodo() ) );
590 icon = loadPixmap( pathString + "navi" ); 593 icon = loadPixmap( pathString + "navi" );
591 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 594 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
592 action->addTo( viewMenu ); 595 action->addTo( viewMenu );
593 connect( action, SIGNAL( activated() ), 596 connect( action, SIGNAL( activated() ),
594 mView, SLOT( toggleDateNavigatorWidget() ) ); 597 mView, SLOT( toggleDateNavigatorWidget() ) );
595 icon = loadPixmap( pathString + "filter" ); 598 icon = loadPixmap( pathString + "filter" );
596 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 599 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
597 action->addTo( viewMenu ); 600 action->addTo( viewMenu );
598 connect( action, SIGNAL( activated() ), 601 connect( action, SIGNAL( activated() ),
599 mView, SLOT( toggleFilter() ) ); 602 mView, SLOT( toggleFilter() ) );
600 603
601 604
602 viewMenu->insertSeparator(); 605 viewMenu->insertSeparator();
603 icon = loadPixmap( pathString + "picker" ); 606 icon = loadPixmap( pathString + "picker" );
604 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 607 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
605 action->addTo( viewMenu ); 608 action->addTo( viewMenu );
606 connect( action, SIGNAL( activated() ), 609 connect( action, SIGNAL( activated() ),
607 mView, SLOT( showDatePicker() ) ); 610 mView, SLOT( showDatePicker() ) );
608 action->addTo( iconToolBar ); 611 action->addTo( iconToolBar );
609 viewMenu->insertSeparator(); 612 viewMenu->insertSeparator();
610 icon = loadPixmap( pathString + "list" ); 613 icon = loadPixmap( pathString + "list" );
611 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 614 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
612 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 615 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
613 showlist_action->addTo( viewMenu ); 616 showlist_action->addTo( viewMenu );
614 connect( showlist_action, SIGNAL( activated() ), 617 connect( showlist_action, SIGNAL( activated() ),
615 mView->viewManager(), SLOT( showListView() ) ); 618 mView->viewManager(), SLOT( showListView() ) );
616 619
617 620
618 icon = loadPixmap( pathString + "day" ); 621 icon = loadPixmap( pathString + "day" );
619 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 622 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
620 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 623 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
621 day1_action->addTo( viewMenu ); 624 day1_action->addTo( viewMenu );
622 // action->addTo( toolBar ); 625 // action->addTo( toolBar );
623 connect( day1_action, SIGNAL( activated() ), 626 connect( day1_action, SIGNAL( activated() ),
624 mView->viewManager(), SLOT( showDayView() ) ); 627 mView->viewManager(), SLOT( showDayView() ) );
625 628
626 icon = loadPixmap( pathString + "workweek" ); 629 icon = loadPixmap( pathString + "workweek" );
627 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 630 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
628 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 631 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
629 day5_action->addTo( viewMenu ); 632 day5_action->addTo( viewMenu );
630 connect( day5_action, SIGNAL( activated() ), 633 connect( day5_action, SIGNAL( activated() ),
631 mView->viewManager(), SLOT( showWorkWeekView() ) ); 634 mView->viewManager(), SLOT( showWorkWeekView() ) );
632 635
633 icon = loadPixmap( pathString + "week" ); 636 icon = loadPixmap( pathString + "week" );
634 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 637 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
635 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 638 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
636 day7_action->addTo( viewMenu ); 639 day7_action->addTo( viewMenu );
637 connect( day7_action, SIGNAL( activated() ), 640 connect( day7_action, SIGNAL( activated() ),
638 mView->viewManager(), SLOT( showWeekView() ) ); 641 mView->viewManager(), SLOT( showWeekView() ) );
639 642
640 icon = loadPixmap( pathString + "month" ); 643 icon = loadPixmap( pathString + "month" );
641 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 644 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
642 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 645 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
643 month_action->addTo( viewMenu ); 646 month_action->addTo( viewMenu );
644 connect( month_action, SIGNAL( activated() ), 647 connect( month_action, SIGNAL( activated() ),
645 mView->viewManager(), SLOT( showMonthView() ) ); 648 mView->viewManager(), SLOT( showMonthView() ) );
646 649
647 icon = loadPixmap( pathString + "todo" ); 650 icon = loadPixmap( pathString + "todo" );
648 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 651 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
649 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 652 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
650 todoview_action->addTo( viewMenu ); 653 todoview_action->addTo( viewMenu );
651 connect( todoview_action, SIGNAL( activated() ), 654 connect( todoview_action, SIGNAL( activated() ),
652 mView->viewManager(), SLOT( showTodoView() ) ); 655 mView->viewManager(), SLOT( showTodoView() ) );
653 656
654 icon = loadPixmap( pathString + "journal" ); 657 icon = loadPixmap( pathString + "journal" );
655 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 658 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
656 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 659 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
657 viewjournal_action->addTo( viewMenu ); 660 viewjournal_action->addTo( viewMenu );
658 connect( viewjournal_action, SIGNAL( activated() ), 661 connect( viewjournal_action, SIGNAL( activated() ),
659 mView->viewManager(), SLOT( showJournalView() ) ); 662 mView->viewManager(), SLOT( showJournalView() ) );
660 663
661 icon = loadPixmap( pathString + "xdays" ); 664 icon = loadPixmap( pathString + "xdays" );
662 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 665 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
663 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 666 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
664 xdays_action->addTo( viewMenu ); 667 xdays_action->addTo( viewMenu );
665 connect( xdays_action, SIGNAL( activated() ), 668 connect( xdays_action, SIGNAL( activated() ),
666 mView->viewManager(), SLOT( showNextXView() ) ); 669 mView->viewManager(), SLOT( showNextXView() ) );
667 670
668 icon = loadPixmap( pathString + "whatsnext" ); 671 icon = loadPixmap( pathString + "whatsnext" );
669 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 672 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
670 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 673 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
671 whatsnext_action->addTo( viewMenu ); 674 whatsnext_action->addTo( viewMenu );
672 connect( whatsnext_action, SIGNAL( activated() ), 675 connect( whatsnext_action, SIGNAL( activated() ),
673 mView->viewManager(), SLOT( showWhatsNextView() ) ); 676 mView->viewManager(), SLOT( showWhatsNextView() ) );
674 677
675#if 0 678#if 0
676 action = new QAction( "view_timespan", "Time Span", 0, this ); 679 action = new QAction( "view_timespan", "Time Span", 0, this );
677 action->addTo( viewMenu ); 680 action->addTo( viewMenu );
678 connect( action, SIGNAL( activated() ), 681 connect( action, SIGNAL( activated() ),
679 mView->viewManager(), SLOT( showTimeSpanView() ) ); 682 mView->viewManager(), SLOT( showTimeSpanView() ) );
680#endif 683#endif
681 684
682 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 685 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
683 this ); 686 this );
684 mNewSubTodoAction->addTo( actionMenu ); 687 mNewSubTodoAction->addTo( actionMenu );
685 connect( mNewSubTodoAction, SIGNAL( activated() ), 688 connect( mNewSubTodoAction, SIGNAL( activated() ),
686 mView, SLOT( newSubTodo() ) ); 689 mView, SLOT( newSubTodo() ) );
687 690
688 actionMenu->insertSeparator(); 691 actionMenu->insertSeparator();
689 692
690 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 693 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
691 mShowAction->addTo( actionMenu ); 694 mShowAction->addTo( actionMenu );
692 connect( mShowAction, SIGNAL( activated() ), 695 connect( mShowAction, SIGNAL( activated() ),
693 mView, SLOT( showIncidence() ) ); 696 mView, SLOT( showIncidence() ) );
694 697
695 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 698 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
696 mEditAction->addTo( actionMenu ); 699 mEditAction->addTo( actionMenu );
697 connect( mEditAction, SIGNAL( activated() ), 700 connect( mEditAction, SIGNAL( activated() ),
698 mView, SLOT( editIncidence() ) ); 701 mView, SLOT( editIncidence() ) );
699 702
700 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 703 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
701 mDeleteAction->addTo( actionMenu ); 704 mDeleteAction->addTo( actionMenu );
702 connect( mDeleteAction, SIGNAL( activated() ), 705 connect( mDeleteAction, SIGNAL( activated() ),
703 mView, SLOT( deleteIncidence() ) ); 706 mView, SLOT( deleteIncidence() ) );
704 707
705 708
706 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 709 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
707 mCloneAction->addTo( actionMenu ); 710 mCloneAction->addTo( actionMenu );
708 connect( mCloneAction, SIGNAL( activated() ), 711 connect( mCloneAction, SIGNAL( activated() ),
709 mView, SLOT( cloneIncidence() ) ); 712 mView, SLOT( cloneIncidence() ) );
710 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 713 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
711 mMoveAction->addTo( actionMenu ); 714 mMoveAction->addTo( actionMenu );
712 connect( mMoveAction, SIGNAL( activated() ), 715 connect( mMoveAction, SIGNAL( activated() ),
713 mView, SLOT( moveIncidence() ) ); 716 mView, SLOT( moveIncidence() ) );
714 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 717 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
715 mBeamAction->addTo( actionMenu ); 718 mBeamAction->addTo( actionMenu );
716 connect( mBeamAction, SIGNAL( activated() ), 719 connect( mBeamAction, SIGNAL( activated() ),
717 mView, SLOT( beamIncidence() ) ); 720 mView, SLOT( beamIncidence() ) );
718 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 721 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
719 mCancelAction->addTo( actionMenu ); 722 mCancelAction->addTo( actionMenu );
720 connect( mCancelAction, SIGNAL( activated() ), 723 connect( mCancelAction, SIGNAL( activated() ),
721 mView, SLOT( toggleCancelIncidence() ) ); 724 mView, SLOT( toggleCancelIncidence() ) );
722 725
723 actionMenu->insertSeparator(); 726 actionMenu->insertSeparator();
724 727
725 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 728 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
726 this ); 729 this );
727 action->addTo( actionMenu ); 730 action->addTo( actionMenu );
728 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 731 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
729 732
730 icon = loadPixmap( pathString + "search" ); 733 icon = loadPixmap( pathString + "search" );
731 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 734 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
732 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 735 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
733 search_action->addTo( actionMenu ); 736 search_action->addTo( actionMenu );
734 connect( search_action, SIGNAL( activated() ), 737 connect( search_action, SIGNAL( activated() ),
735 mView->dialogManager(), SLOT( showSearchDialog() ) ); 738 mView->dialogManager(), SLOT( showSearchDialog() ) );
736 739
737 icon = loadPixmap( pathString + "today" ); 740 icon = loadPixmap( pathString + "today" );
738 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 741 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
739 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 742 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
740 today_action->addTo( actionMenu ); 743 today_action->addTo( actionMenu );
741 connect( today_action, SIGNAL( activated() ), 744 connect( today_action, SIGNAL( activated() ),
742 mView, SLOT( goToday() ) ); 745 mView, SLOT( goToday() ) );
743 746
744 if ( KOPrefs::instance()->mShowFullMenu ) { 747 if ( KOPrefs::instance()->mShowFullMenu ) {
745 actionMenu->insertSeparator(); 748 actionMenu->insertSeparator();
746 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 749 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
747 750
748 } 751 }
749 // actionMenu->insertSeparator(); 752 // actionMenu->insertSeparator();
750 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 753 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
751 this ); 754 this );
752 action->addTo( importMenu ); 755 action->addTo( importMenu );
753 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 756 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
754 action = new QAction( "import_quick", i18n("Import last file"), 0, 757 action = new QAction( "import_quick", i18n("Import last file"), 0,
755 this ); 758 this );
756 action->addTo( importMenu ); 759 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 760 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
758 importMenu->insertSeparator(); 761 importMenu->insertSeparator();
759 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 762 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
760 this ); 763 this );
761 action->addTo( importMenu ); 764 action->addTo( importMenu );
762 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 765 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
763#ifndef DESKTOP_VERSION 766#ifndef DESKTOP_VERSION
764 importMenu->insertSeparator(); 767 importMenu->insertSeparator();
765 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 768 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
766 this ); 769 this );
767 action->addTo( importMenu ); 770 action->addTo( importMenu );
768 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 771 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
769#else 772#else
770#ifdef _WIN32_ 773#ifdef _WIN32_
771 importMenu->insertSeparator(); 774 importMenu->insertSeparator();
772 action = new QAction( "import_ol", i18n("Import from OL"), 0, 775 action = new QAction( "import_ol", i18n("Import from OL"), 0,
773 this ); 776 this );
774 action->addTo( importMenu ); 777 action->addTo( importMenu );
775 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 778 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
776#endif 779#endif
777#endif 780#endif
778 781
779 importMenu->insertSeparator(); 782 importMenu->insertSeparator();
780 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 783 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
781 this ); 784 this );
782 action->addTo( importMenu ); 785 action->addTo( importMenu );
783 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 786 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
784 787
785 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 788 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
786 this ); 789 this );
787 action->addTo( importMenu ); 790 action->addTo( importMenu );
788 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 791 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
789 792
790 importMenu->insertSeparator(); 793 importMenu->insertSeparator();
791 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 794 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
792 this ); 795 this );
793 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 796 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
794 797
795 798
796 //LR 799 //LR
797 QPopupMenu *ex2phone = new QPopupMenu( this ); 800 QPopupMenu *ex2phone = new QPopupMenu( this );
798 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 801 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
799 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 802 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
800 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 803 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
801 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 804 importMenu->insertItem( i18n("Export to phone"), ex2phone );
802 805
803 importMenu->insertSeparator(); 806 importMenu->insertSeparator();
804 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 807 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
805 this ); 808 this );
806 action->addTo( importMenu ); 809 action->addTo( importMenu );
807 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 810 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
808#ifndef DESKTOP_VERSION 811#ifndef DESKTOP_VERSION
809 importMenu->insertSeparator(); 812 importMenu->insertSeparator();
810 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 813 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
811 this ); 814 this );
812 brAction->addTo( importMenu ); 815 brAction->addTo( importMenu );
813 brAction->setToggleAction (true ) ; 816 brAction->setToggleAction (true ) ;
814 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 817 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
815 818
816 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 819 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
817 this ); 820 this );
818 action->addTo( importMenu ); 821 action->addTo( importMenu );
819 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 822 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
820 823
821 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 824 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
822 this ); 825 this );
823 action->addTo( importMenu ); 826 action->addTo( importMenu );
824 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 827 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
825#else 828#else
826 importMenu->insertSeparator(); 829 importMenu->insertSeparator();
827 icon = loadPixmap( pathString + "print" ); 830 icon = loadPixmap( pathString + "print" );
828 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 831 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
829 action->addTo( importMenu ); 832 action->addTo( importMenu );
830 connect( action, SIGNAL( activated() ), 833 connect( action, SIGNAL( activated() ),
831 this, SLOT( printCal() ) ); 834 this, SLOT( printCal() ) );
832 835
833 icon = loadPixmap( pathString + "print" ); 836 icon = loadPixmap( pathString + "print" );
834 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 837 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
835 action->addTo( importMenu ); 838 action->addTo( importMenu );
836 connect( action, SIGNAL( activated() ), 839 connect( action, SIGNAL( activated() ),
837 this, SLOT( printSel() ) ); 840 this, SLOT( printSel() ) );
838#endif 841#endif
839 importMenu->insertSeparator(); 842 importMenu->insertSeparator();
840 action = new QAction( "beam all", i18n("Save"), 0, 843 action = new QAction( "beam all", i18n("Save"), 0,
841 this ); 844 this );
842 action->addTo( importMenu ); 845 action->addTo( importMenu );
843 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 846 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
844 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 847 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
845 this ); 848 this );
846 action->addTo( importMenu ); 849 action->addTo( importMenu );
847 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 850 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
848 851
849 //menuBar->insertItem( "Configure",configureMenu ); 852 //menuBar->insertItem( "Configure",configureMenu );
850 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 853 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
851 icon = loadPixmap( "korganizer/korganizer" ); 854 icon = loadPixmap( "korganizer/korganizer" );
852 855
853 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 856 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
854 action->addTo( helpMenu ); 857 action->addTo( helpMenu );
855 connect( action, SIGNAL( activated() ), 858 connect( action, SIGNAL( activated() ),
856 SLOT( whatsNew() ) ); 859 SLOT( whatsNew() ) );
857 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 860 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
858 action->addTo( helpMenu ); 861 action->addTo( helpMenu );
859 connect( action, SIGNAL( activated() ), 862 connect( action, SIGNAL( activated() ),
860 SLOT( features() ) ); 863 SLOT( features() ) );
861 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 864 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
862 action->addTo( helpMenu ); 865 action->addTo( helpMenu );
863 connect( action, SIGNAL( activated() ), 866 connect( action, SIGNAL( activated() ),
864 SLOT( keyBindings() ) ); 867 SLOT( keyBindings() ) );
865 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 868 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
866 action->addTo( helpMenu ); 869 action->addTo( helpMenu );
867 connect( action, SIGNAL( activated() ), 870 connect( action, SIGNAL( activated() ),
868 SLOT( synchowto() ) ); 871 SLOT( synchowto() ) );
869 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 872 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
870 action->addTo( helpMenu ); 873 action->addTo( helpMenu );
871 connect( action, SIGNAL( activated() ), 874 connect( action, SIGNAL( activated() ),
872 SLOT( kdesynchowto() ) ); 875 SLOT( kdesynchowto() ) );
873 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 876 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
874 action->addTo( helpMenu ); 877 action->addTo( helpMenu );
875 connect( action, SIGNAL( activated() ), 878 connect( action, SIGNAL( activated() ),
876 SLOT( multisynchowto() ) ); 879 SLOT( multisynchowto() ) );
877 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 880 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
878 action->addTo( helpMenu ); 881 action->addTo( helpMenu );
879 connect( action, SIGNAL( activated() ), 882 connect( action, SIGNAL( activated() ),
880 SLOT( aboutAutoSaving() ) ); 883 SLOT( aboutAutoSaving() ) );
881 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 884 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
882 action->addTo( helpMenu ); 885 action->addTo( helpMenu );
883 connect( action, SIGNAL( activated() ), 886 connect( action, SIGNAL( activated() ),
884 SLOT( aboutKnownBugs() ) ); 887 SLOT( aboutKnownBugs() ) );
885 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 888 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
886 action->addTo( helpMenu ); 889 action->addTo( helpMenu );
887 connect( action, SIGNAL( activated() ), 890 connect( action, SIGNAL( activated() ),
888 SLOT( usertrans() ) ); 891 SLOT( usertrans() ) );
889 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 892 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
890 action->addTo( helpMenu ); 893 action->addTo( helpMenu );
891 connect( action, SIGNAL( activated() ), 894 connect( action, SIGNAL( activated() ),
892 SLOT( faq() ) ); 895 SLOT( faq() ) );
893 action = new QAction( "licence", i18n("Licence..."), 0, this ); 896 action = new QAction( "licence", i18n("Licence..."), 0, this );
894 action->addTo( helpMenu ); 897 action->addTo( helpMenu );
895 connect( action, SIGNAL( activated() ), 898 connect( action, SIGNAL( activated() ),
896 SLOT( licence() ) ); 899 SLOT( licence() ) );
897 action = new QAction( "about", i18n("About..."), 0, this ); 900 action = new QAction( "about", i18n("About..."), 0, this );
898 action->addTo( helpMenu ); 901 action->addTo( helpMenu );
899 connect( action, SIGNAL( activated() ), 902 connect( action, SIGNAL( activated() ),
900 SLOT( about() ) ); 903 SLOT( about() ) );
901 //menuBar->insertSeparator(); 904 //menuBar->insertSeparator();
902 905
903 // ****************************************************** 906 // ******************************************************
904 // menubar icons 907 // menubar icons
905 908
906 909
907 iconToolBar->setHorizontalStretchable (true ); 910 iconToolBar->setHorizontalStretchable (true );
908 //menuBar->insertItem( iconToolBar ); 911 //menuBar->insertItem( iconToolBar );
909 //xdays_action 912 //xdays_action
910 if (p-> mShowIconNewEvent) 913 if (p-> mShowIconNewEvent)
911 ne_action->addTo( iconToolBar ); 914 ne_action->addTo( iconToolBar );
912 if (p->mShowIconNewTodo ) 915 if (p->mShowIconNewTodo )
913 nt_action->addTo( iconToolBar ); 916 nt_action->addTo( iconToolBar );
914 if (p-> mShowIconSearch) 917 if (p-> mShowIconSearch)
915 search_action->addTo( iconToolBar ); 918 search_action->addTo( iconToolBar );
916 if (p-> mShowIconNext) 919 if (p-> mShowIconNext)
917 whatsnext_action->addTo( iconToolBar ); 920 whatsnext_action->addTo( iconToolBar );
918 if (p-> mShowIconNextDays) 921 if (p-> mShowIconNextDays)
919 xdays_action->addTo( iconToolBar ); 922 xdays_action->addTo( iconToolBar );
920 if (p-> mShowIconList) 923 if (p-> mShowIconList)
921 showlist_action->addTo( iconToolBar ); 924 showlist_action->addTo( iconToolBar );
922 if (p-> mShowIconDay1) 925 if (p-> mShowIconDay1)
923 day1_action->addTo( iconToolBar ); 926 day1_action->addTo( iconToolBar );
924 if (p-> mShowIconDay5) 927 if (p-> mShowIconDay5)
925 day5_action->addTo( iconToolBar ); 928 day5_action->addTo( iconToolBar );
926 if (p-> mShowIconDay7) 929 if (p-> mShowIconDay7)
927 day7_action->addTo( iconToolBar ); 930 day7_action->addTo( iconToolBar );
928 if (p-> mShowIconMonth) 931 if (p-> mShowIconMonth)
929 month_action->addTo( iconToolBar ); 932 month_action->addTo( iconToolBar );
930 if (p-> mShowIconTodoview) 933 if (p-> mShowIconTodoview)
931 todoview_action->addTo( iconToolBar ); 934 todoview_action->addTo( iconToolBar );
932 if (p-> mShowIconJournal) 935 if (p-> mShowIconJournal)
933 viewjournal_action->addTo( iconToolBar ); 936 viewjournal_action->addTo( iconToolBar );
934 icon = loadPixmap( pathString + "2leftarrowB" ); 937 icon = loadPixmap( pathString + "2leftarrowB" );
935 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 938 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
936 if (p-> mShowIconBackFast) { 939 if (p-> mShowIconBackFast) {
937 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 940 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
938 connect( action, SIGNAL( activated() ), 941 connect( action, SIGNAL( activated() ),
939 mView, SLOT( goPreviousMonth() ) ); 942 mView, SLOT( goPreviousMonth() ) );
940 action->addTo( iconToolBar ); 943 action->addTo( iconToolBar );
941 } 944 }
942 icon = loadPixmap( pathString + "1leftarrowB" ); 945 icon = loadPixmap( pathString + "1leftarrowB" );
943 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 946 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
944 if (p-> mShowIconBack) { 947 if (p-> mShowIconBack) {
945 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 948 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
946 connect( action, SIGNAL( activated() ), 949 connect( action, SIGNAL( activated() ),
947 mView, SLOT( goPrevious() ) ); 950 mView, SLOT( goPrevious() ) );
948 action->addTo( iconToolBar ); 951 action->addTo( iconToolBar );
949 } 952 }
950 if (p-> mShowIconToday) 953 if (p-> mShowIconToday)
951 today_action->addTo( iconToolBar ); 954 today_action->addTo( iconToolBar );
952 icon = loadPixmap( pathString + "1rightarrowB" ); 955 icon = loadPixmap( pathString + "1rightarrowB" );
953 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 956 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
954 if (p-> mShowIconForward) { 957 if (p-> mShowIconForward) {
955 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 958 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
956 connect( action, SIGNAL( activated() ), 959 connect( action, SIGNAL( activated() ),
957 mView, SLOT( goNext() ) ); 960 mView, SLOT( goNext() ) );
958 action->addTo( iconToolBar ); 961 action->addTo( iconToolBar );
959 } 962 }
960 icon = loadPixmap( pathString + "2rightarrowB" ); 963 icon = loadPixmap( pathString + "2rightarrowB" );
961 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 964 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
962 if (p-> mShowIconForwardFast) { 965 if (p-> mShowIconForwardFast) {
963 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 966 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
964 connect( action, SIGNAL( activated() ), 967 connect( action, SIGNAL( activated() ),
965 mView, SLOT( goNextMonth() ) ); 968 mView, SLOT( goNextMonth() ) );
966 action->addTo( iconToolBar ); 969 action->addTo( iconToolBar );
967 } 970 }
968 971
969 972
970 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 973 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
971 974
972 if (p-> mShowIconNewEvent) 975 if (p-> mShowIconNewEvent)
973 configureToolBarMenu->setItemChecked( 10, true ); 976 configureToolBarMenu->setItemChecked( 10, true );
974 if (p->mShowIconNewTodo ) 977 if (p->mShowIconNewTodo )
975 configureToolBarMenu->setItemChecked( 20, true ); 978 configureToolBarMenu->setItemChecked( 20, true );
976 if (p-> mShowIconSearch) 979 if (p-> mShowIconSearch)
977 configureToolBarMenu->setItemChecked( 120, true ); 980 configureToolBarMenu->setItemChecked( 120, true );
978 if (p-> mShowIconList) 981 if (p-> mShowIconList)
979 configureToolBarMenu->setItemChecked( 30, true ); 982 configureToolBarMenu->setItemChecked( 30, true );
980 if (p-> mShowIconDay1) 983 if (p-> mShowIconDay1)
981 configureToolBarMenu->setItemChecked( 40, true ); 984 configureToolBarMenu->setItemChecked( 40, true );
982 if (p-> mShowIconDay5) 985 if (p-> mShowIconDay5)
983 configureToolBarMenu->setItemChecked( 50, true ); 986 configureToolBarMenu->setItemChecked( 50, true );
984 if (p-> mShowIconDay7) 987 if (p-> mShowIconDay7)
985 configureToolBarMenu->setItemChecked( 60, true ); 988 configureToolBarMenu->setItemChecked( 60, true );
986 if (p-> mShowIconMonth) 989 if (p-> mShowIconMonth)
987 configureToolBarMenu->setItemChecked( 70, true ); 990 configureToolBarMenu->setItemChecked( 70, true );
988 if (p-> mShowIconTodoview) 991 if (p-> mShowIconTodoview)
989 configureToolBarMenu->setItemChecked( 80, true ); 992 configureToolBarMenu->setItemChecked( 80, true );
990 if (p-> mShowIconBackFast) 993 if (p-> mShowIconBackFast)
991 configureToolBarMenu->setItemChecked( 200, true ); 994 configureToolBarMenu->setItemChecked( 200, true );
992 if (p-> mShowIconBack) 995 if (p-> mShowIconBack)
993 configureToolBarMenu->setItemChecked( 210, true ); 996 configureToolBarMenu->setItemChecked( 210, true );
994 if (p-> mShowIconToday) 997 if (p-> mShowIconToday)
995 configureToolBarMenu->setItemChecked( 130, true ); 998 configureToolBarMenu->setItemChecked( 130, true );
996 if (p-> mShowIconForward) 999 if (p-> mShowIconForward)
997 configureToolBarMenu->setItemChecked( 220, true ); 1000 configureToolBarMenu->setItemChecked( 220, true );
998 if (p-> mShowIconForwardFast) 1001 if (p-> mShowIconForwardFast)
999 configureToolBarMenu->setItemChecked( 230, true ); 1002 configureToolBarMenu->setItemChecked( 230, true );
1000 if (p-> mShowIconNextDays) 1003 if (p-> mShowIconNextDays)
1001 configureToolBarMenu->setItemChecked( 100, true ); 1004 configureToolBarMenu->setItemChecked( 100, true );
1002 if (p-> mShowIconNext) 1005 if (p-> mShowIconNext)
1003 configureToolBarMenu->setItemChecked( 110, true ); 1006 configureToolBarMenu->setItemChecked( 110, true );
1004 if (p-> mShowIconJournal) 1007 if (p-> mShowIconJournal)
1005 configureToolBarMenu->setItemChecked( 90, true ); 1008 configureToolBarMenu->setItemChecked( 90, true );
1006 if (p-> mShowIconWhatsThis) 1009 if (p-> mShowIconWhatsThis)
1007 configureToolBarMenu->setItemChecked( 300, true ); 1010 configureToolBarMenu->setItemChecked( 300, true );
1008 1011
1009 QLabel* dummy = new QLabel( iconToolBar ); 1012 QLabel* dummy = new QLabel( iconToolBar );
1010 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1013 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1011 if (!p-> mShowIconStretch) 1014 if (!p-> mShowIconStretch)
1012 iconToolBar->setStretchableWidget ( dummy ) ; 1015 iconToolBar->setStretchableWidget ( dummy ) ;
1013 else 1016 else
1014 configureToolBarMenu->setItemChecked( 5, true ); 1017 configureToolBarMenu->setItemChecked( 5, true );
1015 if (p-> mShowIconWhatsThis) 1018 if (p-> mShowIconWhatsThis)
1016 QWhatsThis::whatsThisButton ( iconToolBar ); 1019 QWhatsThis::whatsThisButton ( iconToolBar );
1017 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1020 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1018 configureAgenda( p->mHourSize ); 1021 configureAgenda( p->mHourSize );
1019 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1022 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1020} 1023}
1021 1024
1022void MainWindow::exportToPhone( int mode ) 1025void MainWindow::exportToPhone( int mode )
1023{ 1026{
1024 1027
1025 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1028 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1026 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1029 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1027 KOex2phonePrefs ex2phone; 1030 KOex2phonePrefs ex2phone;
1028 1031
1029 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1032 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1030 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1033 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1031 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1034 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1032 if ( mode == 1 ) 1035 if ( mode == 1 )
1033 ex2phone.setCaption(i18n("Export complete calendar")); 1036 ex2phone.setCaption(i18n("Export complete calendar"));
1034 if ( mode == 2 ) 1037 if ( mode == 2 )
1035 ex2phone.setCaption(i18n("Export filtered calendar")); 1038 ex2phone.setCaption(i18n("Export filtered calendar"));
1036 1039
1037 if ( !ex2phone.exec() ) { 1040 if ( !ex2phone.exec() ) {
1038 return; 1041 return;
1039 } 1042 }
1040 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1043 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1041 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1044 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1042 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1045 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1043 1046
1044 int inFuture = 0; 1047 int inFuture = 0;
1045 if ( ex2phone.mWriteBackFuture->isChecked() ) 1048 if ( ex2phone.mWriteBackFuture->isChecked() )
1046 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1049 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1047 QPtrList<Incidence> delSel; 1050 QPtrList<Incidence> delSel;
1048 if ( mode == 1 ) 1051 if ( mode == 1 )
1049 delSel = mCalendar->rawIncidences(); 1052 delSel = mCalendar->rawIncidences();
1050 if ( mode == 2 ) 1053 if ( mode == 2 )
1051 delSel = mCalendar->incidences(); 1054 delSel = mCalendar->incidences();
1052 CalendarLocal* cal = new CalendarLocal(); 1055 CalendarLocal* cal = new CalendarLocal();
1053 cal->setLocalTime(); 1056 cal->setLocalTime();
1054 Incidence *incidence = delSel.first(); 1057 Incidence *incidence = delSel.first();
1055 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1058 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1056 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1059 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1057 while ( incidence ) { 1060 while ( incidence ) {
1058 if ( incidence->type() != "Journal" ) { 1061 if ( incidence->type() != "Journal" ) {
1059 bool add = true; 1062 bool add = true;
1060 if ( inFuture ) { 1063 if ( inFuture ) {
1061 QDateTime dt; 1064 QDateTime dt;
1062 if ( incidence->type() == "Todo" ) { 1065 if ( incidence->type() == "Todo" ) {
1063 Todo * t = (Todo*)incidence; 1066 Todo * t = (Todo*)incidence;
1064 if ( t->hasDueDate() ) 1067 if ( t->hasDueDate() )
1065 dt = t->dtDue(); 1068 dt = t->dtDue();
1066 else 1069 else
1067 dt = cur.addSecs( 62 ); 1070 dt = cur.addSecs( 62 );
1068 } 1071 }
1069 else { 1072 else {
1070 bool ok; 1073 bool ok;
1071 dt = incidence->getNextOccurence( cur, &ok ); 1074 dt = incidence->getNextOccurence( cur, &ok );
1072 if ( !ok ) 1075 if ( !ok )
1073 dt = cur.addSecs( -62 ); 1076 dt = cur.addSecs( -62 );
1074 } 1077 }
1075 if ( dt < cur || dt > end ) { 1078 if ( dt < cur || dt > end ) {
1076 add = false; 1079 add = false;
1077 } 1080 }
1078 } 1081 }
1079 if ( add ) { 1082 if ( add ) {
1080 Incidence *in = incidence->clone(); 1083 Incidence *in = incidence->clone();
1081 cal->addIncidence( in ); 1084 cal->addIncidence( in );
1082 } 1085 }
1083 } 1086 }
1084 incidence = delSel.next(); 1087 incidence = delSel.next();
1085 } 1088 }
1086 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1089 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1087 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1090 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1088 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1091 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1089 1092
1090 setCaption( i18n("Writing to phone...")); 1093 setCaption( i18n("Writing to phone..."));
1091 if ( PhoneFormat::writeToPhone( cal ) ) 1094 if ( PhoneFormat::writeToPhone( cal ) )
1092 setCaption( i18n("Export to phone successful!")); 1095 setCaption( i18n("Export to phone successful!"));
1093 else 1096 else
1094 setCaption( i18n("Error exporting to phone!")); 1097 setCaption( i18n("Error exporting to phone!"));
1095 delete cal; 1098 delete cal;
1096} 1099}
1097 1100
1098 1101
1099void MainWindow::setDefaultPreferences() 1102void MainWindow::setDefaultPreferences()
1100{ 1103{
1101 KOPrefs *p = KOPrefs::instance(); 1104 KOPrefs *p = KOPrefs::instance();
1102 1105
1103 p->mCompactDialogs = true; 1106 p->mCompactDialogs = true;
1104 p->mConfirm = true; 1107 p->mConfirm = true;
1105 // p->mEnableQuickTodo = false; 1108 // p->mEnableQuickTodo = false;
1106 1109
1107} 1110}
1108 1111
1109QString MainWindow::resourcePath() 1112QString MainWindow::resourcePath()
1110{ 1113{
1111 return KGlobal::iconLoader()->iconPath(); 1114 return KGlobal::iconLoader()->iconPath();
1112} 1115}
1113 1116
1114void MainWindow::displayText( QString text ,QString cap ) 1117void MainWindow::displayText( QString text ,QString cap )
1115{ 1118{
1116 QDialog dia( this, "name", true ); ; 1119 QDialog dia( this, "name", true ); ;
1117 dia.setCaption( cap ); 1120 dia.setCaption( cap );
1118 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1121 QVBoxLayout* lay = new QVBoxLayout( &dia );
1119 lay->setSpacing( 3 ); 1122 lay->setSpacing( 3 );
1120 lay->setMargin( 3 ); 1123 lay->setMargin( 3 );
1121 QTextBrowser tb ( &dia ); 1124 QTextBrowser tb ( &dia );
1122 lay->addWidget( &tb ); 1125 lay->addWidget( &tb );
1123 tb.setText( text ); 1126 tb.setText( text );
1124#ifdef DESKTOP_VERSION 1127#ifdef DESKTOP_VERSION
1125 dia.resize( 640, 480); 1128 dia.resize( 640, 480);
1126#else 1129#else
1127 dia.showMaximized(); 1130 dia.showMaximized();
1128#endif 1131#endif
1129 dia.exec(); 1132 dia.exec();
1130} 1133}
1131void MainWindow::displayFile( QString fn, QString cap ) 1134void MainWindow::displayFile( QString fn, QString cap )
1132{ 1135{
1133 QString fileName = resourcePath() + fn; 1136 QString fileName = resourcePath() + fn;
1134 QString text; 1137 QString text;
1135 QFile file( fileName ); 1138 QFile file( fileName );
1136 if (!file.open( IO_ReadOnly ) ) { 1139 if (!file.open( IO_ReadOnly ) ) {
1137 return ; 1140 return ;
1138 1141
1139 } 1142 }
1140 QTextStream ts( &file ); 1143 QTextStream ts( &file );
1141 text = ts.read(); 1144 text = ts.read();
1142 file.close(); 1145 file.close();
1143 displayText( text, cap); 1146 displayText( text, cap);
1144} 1147}
1145void MainWindow::features() 1148void MainWindow::features()
1146{ 1149{
1147 1150
1148 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1151 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1149} 1152}
1150 1153
1151void MainWindow::usertrans() 1154void MainWindow::usertrans()
1152{ 1155{
1153 1156
1154 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1157 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1155} 1158}
1156 1159
1157void MainWindow::kdesynchowto() 1160void MainWindow::kdesynchowto()
1158{ 1161{
1159 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1162 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1160} 1163}
1161void MainWindow::multisynchowto() 1164void MainWindow::multisynchowto()
1162{ 1165{
1163 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1166 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1164} 1167}
1165void MainWindow::synchowto() 1168void MainWindow::synchowto()
1166{ 1169{
1167 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1170 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1168} 1171}
1169void MainWindow::faq() 1172void MainWindow::faq()
1170{ 1173{
1171 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1174 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1172 1175
1173} 1176}
1174void MainWindow::whatsNew() 1177void MainWindow::whatsNew()
1175{ 1178{
1176 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1179 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1177 1180
1178} 1181}
1179void MainWindow::licence() 1182void MainWindow::licence()
1180{ 1183{
1181 KApplication::showLicence(); 1184 KApplication::showLicence();
1182 1185
1183} 1186}
1184void MainWindow::about() 1187void MainWindow::about()
1185{ 1188{
1186 QString version; 1189 QString version;
1187#include <../version> 1190#include <../version>
1188 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1191 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1189 i18n("KOrganizer/Platform-independent\n") + 1192 i18n("KOrganizer/Platform-independent\n") +
1190 "(KO/Pi) " + version + " - " + 1193 "(KO/Pi) " + version + " - " +
1191 1194
1192#ifdef DESKTOP_VERSION 1195#ifdef DESKTOP_VERSION
1193 i18n("Desktop Edition\n") + 1196 i18n("Desktop Edition\n") +
1194#else 1197#else
1195 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1198 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1196#endif 1199#endif
1197 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1200 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1198} 1201}
1199void MainWindow::keyBindings() 1202void MainWindow::keyBindings()
1200{ 1203{
1201 QString cap = i18n("Key bindings KOrganizer/Pi"); 1204 QString cap = i18n("Key bindings KOrganizer/Pi");
1202 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1205 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1203 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1206 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1204 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1207 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1205 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1208 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1206 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1209 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1207 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1210 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1208 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1211 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1209 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1212 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1210 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1213 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1211 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1214 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1212 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1215 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1213 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1216 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1214 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1217 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1215 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1218 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1216 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1219 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1217 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1220 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1218 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1221 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1219 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1222 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1220 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1223 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1221 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1224 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1222 i18n("<p><h3>In agenda view:</h3></p>\n") + 1225 i18n("<p><h3>In agenda view:</h3></p>\n") +
1223 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1226 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1224 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1227 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1225 i18n("<p><h3>In todo view:</h3></p>\n") + 1228 i18n("<p><h3>In todo view:</h3></p>\n") +
1226 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1229 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1227 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1230 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1228 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1231 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1229 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1232 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1230 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1233 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1231 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1234 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1232 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1235 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1233 i18n("<p><h3>In list view:</h3></p>\n") + 1236 i18n("<p><h3>In list view:</h3></p>\n") +
1234 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1237 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1235 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1238 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1236 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1239 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1237 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1240 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1238 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1241 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1239 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1242 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1240 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1243 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1241 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1244 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1242 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1245 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1243 i18n("<p><b>E</b>: Edit item</p>\n") + 1246 i18n("<p><b>E</b>: Edit item</p>\n") +
1244 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1247 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1245 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1248 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1246 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1249 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1247 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1250 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1248 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1251 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1249 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1252 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1250 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1253 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1251 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1254 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1252 i18n("<p><b>White</b>: Item readonly</p>\n"); 1255 i18n("<p><b>White</b>: Item readonly</p>\n");
1253 displayText( text, cap); 1256 displayText( text, cap);
1254 1257
1255} 1258}
1256void MainWindow::aboutAutoSaving() 1259void MainWindow::aboutAutoSaving()
1257{ 1260{
1258 QMessageBox* msg; 1261 QMessageBox* msg;
1259 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1262 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1260 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon, 1263 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon,
1261 QMessageBox::Ok, 1264 QMessageBox::Ok,
1262 QMessageBox::NoButton, 1265 QMessageBox::NoButton,
1263 QMessageBox::NoButton); 1266 QMessageBox::NoButton);
1264 msg->exec(); 1267 msg->exec();
1265 delete msg; 1268 delete msg;
1266 1269
1267 1270
1268} 1271}
1269void MainWindow::aboutKnownBugs() 1272void MainWindow::aboutKnownBugs()
1270{ 1273{
1271 QMessageBox* msg; 1274 QMessageBox* msg;
1272 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1275 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1273 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")+ 1276 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")+
1274 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1277 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1275 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1278 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1276 i18n("\nor report them in the bugtracker on\n") + 1279 i18n("\nor report them in the bugtracker on\n") +
1277 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1280 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1278 QMessageBox::NoIcon, 1281 QMessageBox::NoIcon,
1279 QMessageBox::Ok, 1282 QMessageBox::Ok,
1280 QMessageBox::NoButton, 1283 QMessageBox::NoButton,
1281 QMessageBox::NoButton); 1284 QMessageBox::NoButton);
1282 msg->exec(); 1285 msg->exec();
1283 delete msg; 1286 delete msg;
1284 1287
1285} 1288}
1286 1289
1287QString MainWindow::defaultFileName() 1290QString MainWindow::defaultFileName()
1288{ 1291{
1289 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1292 return locateLocal( "data", "korganizer/mycalendar.ics" );
1290} 1293}
1291QString MainWindow::syncFileName() 1294QString MainWindow::syncFileName()
1292{ 1295{
1293#ifdef DESKTOP_VERSION 1296#ifdef DESKTOP_VERSION
1294 return locateLocal( "tmp", "synccalendar.ics" ); 1297 return locateLocal( "tmp", "synccalendar.ics" );
1295#else 1298#else
1296 return QString( "/tmp/synccalendar.ics" ); 1299 return QString( "/tmp/synccalendar.ics" );
1297#endif 1300#endif
1298} 1301}
1299 1302
1300void MainWindow::processIncidenceSelection( Incidence *incidence ) 1303void MainWindow::processIncidenceSelection( Incidence *incidence )
1301{ 1304{
1302 if ( !incidence ) { 1305 if ( !incidence ) {
1303 enableIncidenceActions( false ); 1306 enableIncidenceActions( false );
1304 1307
1305 mNewSubTodoAction->setEnabled( false ); 1308 mNewSubTodoAction->setEnabled( false );
1306 setCaptionToDates(); 1309 setCaptionToDates();
1307 return; 1310 return;
1308 1311
1309 } 1312 }
1310 1313
1311 //KGlobal::locale()->formatDateTime(nextA, true); 1314 //KGlobal::locale()->formatDateTime(nextA, true);
1312 QString startString = ""; 1315 QString startString = "";
1313 if ( incidence->type() != "Todo" ) { 1316 if ( incidence->type() != "Todo" ) {
1314 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1317 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1315 if ( incidence->doesFloat() ) { 1318 if ( incidence->doesFloat() ) {
1316 startString += ": "+incidence->dtStartDateStr( true ); 1319 startString += ": "+incidence->dtStartDateStr( true );
1317 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1320 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1318 1321
1319 } else { 1322 } else {
1320 startString = ": "+incidence->dtStartStr(true); 1323 startString = ": "+incidence->dtStartStr(true);
1321 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1324 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1322 1325
1323 } 1326 }
1324 1327
1325 } else { 1328 } else {
1326 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1329 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1327 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1330 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1328 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1331 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1329 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1332 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1330 } 1333 }
1331 1334
1332 } 1335 }
1333 else 1336 else
1334 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1337 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1335 if ( !incidence->location().isEmpty() ) 1338 if ( !incidence->location().isEmpty() )
1336 startString += " (" +incidence->location()+")"; 1339 startString += " (" +incidence->location()+")";
1337 setCaption( incidence->summary()+startString); 1340 setCaption( incidence->summary()+startString);
1338 1341
1339 enableIncidenceActions( true ); 1342 enableIncidenceActions( true );
1340 1343
1341 if ( incidence->type() == "Event" ) { 1344 if ( incidence->type() == "Event" ) {
1342 mShowAction->setText( i18n("Show Event...") ); 1345 mShowAction->setText( i18n("Show Event...") );
1343 mEditAction->setText( i18n("Edit Event...") ); 1346 mEditAction->setText( i18n("Edit Event...") );
1344 mDeleteAction->setText( i18n("Delete Event...") ); 1347 mDeleteAction->setText( i18n("Delete Event...") );
1345 1348
1346 mNewSubTodoAction->setEnabled( false ); 1349 mNewSubTodoAction->setEnabled( false );
1347 } else if ( incidence->type() == "Todo" ) { 1350 } else if ( incidence->type() == "Todo" ) {
1348 mShowAction->setText( i18n("Show Todo...") ); 1351 mShowAction->setText( i18n("Show Todo...") );
1349 mEditAction->setText( i18n("Edit Todo...") ); 1352 mEditAction->setText( i18n("Edit Todo...") );
1350 mDeleteAction->setText( i18n("Delete Todo...") ); 1353 mDeleteAction->setText( i18n("Delete Todo...") );
1351 1354
1352 mNewSubTodoAction->setEnabled( true ); 1355 mNewSubTodoAction->setEnabled( true );
1353 } else { 1356 } else {
1354 mShowAction->setText( i18n("Show...") ); 1357 mShowAction->setText( i18n("Show...") );
1355 mShowAction->setText( i18n("Edit...") ); 1358 mShowAction->setText( i18n("Edit...") );
1356 mShowAction->setText( i18n("Delete...") ); 1359 mShowAction->setText( i18n("Delete...") );
1357 1360
1358 mNewSubTodoAction->setEnabled( false ); 1361 mNewSubTodoAction->setEnabled( false );
1359 } 1362 }
1360} 1363}
1361 1364
1362void MainWindow::enableIncidenceActions( bool enabled ) 1365void MainWindow::enableIncidenceActions( bool enabled )
1363{ 1366{
1364 mShowAction->setEnabled( enabled ); 1367 mShowAction->setEnabled( enabled );
1365 mEditAction->setEnabled( enabled ); 1368 mEditAction->setEnabled( enabled );
1366 mDeleteAction->setEnabled( enabled ); 1369 mDeleteAction->setEnabled( enabled );
1367 1370
1368 mCloneAction->setEnabled( enabled ); 1371 mCloneAction->setEnabled( enabled );
1369 mMoveAction->setEnabled( enabled ); 1372 mMoveAction->setEnabled( enabled );
1370 mBeamAction->setEnabled( enabled ); 1373 mBeamAction->setEnabled( enabled );
1371 mCancelAction->setEnabled( enabled ); 1374 mCancelAction->setEnabled( enabled );
1372} 1375}
1373 1376
1374void MainWindow::importOL() 1377void MainWindow::importOL()
1375{ 1378{
1376#ifdef _WIN32_ 1379#ifdef _WIN32_
1377 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1380 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1378 id->exec(); 1381 id->exec();
1379 delete id; 1382 delete id;
1380 mView->updateView(); 1383 mView->updateView();
1381#endif 1384#endif
1382} 1385}
1383void MainWindow::importBday() 1386void MainWindow::importBday()
1384{ 1387{
1385 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1388 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1386 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1389 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1387 i18n("Import!"), i18n("Cancel"), 0, 1390 i18n("Import!"), i18n("Cancel"), 0,
1388 0, 1 ); 1391 0, 1 );
1389 if ( result == 0 ) { 1392 if ( result == 0 ) {
1390 mView->importBday(); 1393 mView->importBday();
1391 1394
1392 } 1395 }
1393 1396
1394 1397
1395} 1398}
1396void MainWindow::importQtopia() 1399void MainWindow::importQtopia()
1397{ 1400{
1398#ifndef DESKTOP_VERSION 1401#ifndef DESKTOP_VERSION
1399 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1402 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1400 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1403 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1401 i18n("Import!"), i18n("Cancel"), 0, 1404 i18n("Import!"), i18n("Cancel"), 0,
1402 0, 1 ); 1405 0, 1 );
1403 if ( result == 0 ) { 1406 if ( result == 0 ) {
1404 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1407 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1405 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1408 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1406 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1409 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1407 mView->importQtopia( categories, datebook, todolist ); 1410 mView->importQtopia( categories, datebook, todolist );
1408 } 1411 }
1409#else 1412#else
1410 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1413 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1411 i18n("Not supported \non desktop!\n"), 1414 i18n("Not supported \non desktop!\n"),
1412 i18n("Ok"), i18n("Cancel"), 0, 1415 i18n("Ok"), i18n("Cancel"), 0,
1413 0, 1 ); 1416 0, 1 );
1414 1417
1415#endif 1418#endif
1416} 1419}
1417 1420
1418void MainWindow::saveOnClose() 1421void MainWindow::saveOnClose()
1419{ 1422{
1420 KOPrefs *p = KOPrefs::instance(); 1423 KOPrefs *p = KOPrefs::instance();
1421 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1424 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1422 p->mToolBarUp = iconToolBar->x() > width()/2 || 1425 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1423 iconToolBar->y() > height()/2; 1426 iconToolBar->y() > height()/2;
1424 mView->writeSettings(); 1427 mView->writeSettings();
1425 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1428 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1426 save(); 1429 save();
1427} 1430}
1428void MainWindow::slotModifiedChanged( bool changed ) 1431void MainWindow::slotModifiedChanged( bool changed )
1429{ 1432{
1430 if ( mBlockAtStartup ) 1433 if ( mBlockAtStartup )
1431 return; 1434 return;
1432 int msec; 1435 int msec;
1433 // we store the changes after 1 minute, 1436 // we store the changes after 1 minute,
1434 // and for safety reasons after 10 minutes again 1437 // and for safety reasons after 10 minutes again
1435 if ( !mSyncManager->blockSave() ) 1438 if ( !mSyncManager->blockSave() )
1436 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1439 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1437 else 1440 else
1438 msec = 1000 * 600; 1441 msec = 1000 * 600;
1439 mSaveTimer.start( msec, true ); // 1 minute 1442 mSaveTimer.start( msec, true ); // 1 minute
1440 qDebug("KO: Saving File in %d secs!", msec/1000); 1443 qDebug("KO: Saving File in %d secs!", msec/1000);
1441 mCalendarModifiedFlag = true; 1444 mCalendarModifiedFlag = true;
1442} 1445}
1443void MainWindow::save() 1446void MainWindow::save()
1444{ 1447{
1445 if ( mSyncManager->blockSave() ) 1448 if ( mSyncManager->blockSave() )
1446 return; 1449 return;
1447 mSyncManager->setBlockSave(true); 1450 mSyncManager->setBlockSave(true);
1448 if ( mView->checkFileVersion( defaultFileName()) ) { 1451 if ( mView->checkFileVersion( defaultFileName()) ) {
1449 1452
1450 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1453 QTime neededSaveTime = QDateTime::currentDateTime().time();
1451 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1454 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1452 qDebug("KO: Start saving data to file!"); 1455 qDebug("KO: Start saving data to file!");
1453 mView->saveCalendar( defaultFileName() ); 1456 mView->saveCalendar( defaultFileName() );
1454 1457
1455 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1458 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1456 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1459 qDebug("KO: Needed %d ms for saving.",msNeeded );
1457 QString savemes; 1460 QString savemes;
1458 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1461 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1459 setCaption(savemes); 1462 setCaption(savemes);
1460 } else 1463 } else
1461 setCaption(i18n("Saving cancelled!")); 1464 setCaption(i18n("Saving cancelled!"));
1462 mCalendarModifiedFlag = false; 1465 mCalendarModifiedFlag = false;
1463 mSyncManager->setBlockSave( false ); 1466 mSyncManager->setBlockSave( false );
1464} 1467}
1465 1468
1466void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1469void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1467{ 1470{
1468 if ( !e->isAutoRepeat() ) { 1471 if ( !e->isAutoRepeat() ) {
1469 mFlagKeyPressed = false; 1472 mFlagKeyPressed = false;
1470 } 1473 }
1471} 1474}
1472void MainWindow::keyPressEvent ( QKeyEvent * e ) 1475void MainWindow::keyPressEvent ( QKeyEvent * e )
1473{ 1476{
1474 qApp->processEvents(); 1477 qApp->processEvents();
1475 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1478 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1476 e->ignore(); 1479 e->ignore();
1477 // qDebug(" ignore %d",e->isAutoRepeat() ); 1480 // qDebug(" ignore %d",e->isAutoRepeat() );
1478 return; 1481 return;
1479 } 1482 }
1480 if (! e->isAutoRepeat() ) 1483 if (! e->isAutoRepeat() )
1481 mFlagKeyPressed = true; 1484 mFlagKeyPressed = true;
1482 KOPrefs *p = KOPrefs::instance(); 1485 KOPrefs *p = KOPrefs::instance();
1483 bool showSelectedDates = false; 1486 bool showSelectedDates = false;
1484 int size; 1487 int size;
1485 int pro = 0; 1488 int pro = 0;
1486 //qDebug("MainWindow::keyPressEvent "); 1489 //qDebug("MainWindow::keyPressEvent ");
1487 switch ( e->key() ) { 1490 switch ( e->key() ) {
1488 case Qt::Key_Right: 1491 case Qt::Key_Right:
1489 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1492 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1490 mView->goNextMonth(); 1493 mView->goNextMonth();
1491 else 1494 else
1492 mView->goNext(); 1495 mView->goNext();
1493 showSelectedDates = true; 1496 showSelectedDates = true;
1494 break; 1497 break;
1495 case Qt::Key_Left: 1498 case Qt::Key_Left:
1496 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1499 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1497 mView->goPreviousMonth(); 1500 mView->goPreviousMonth();
1498 else 1501 else
1499 mView->goPrevious(); 1502 mView->goPrevious();
1500 showSelectedDates = true; 1503 showSelectedDates = true;
1501 break; 1504 break;
1502 case Qt::Key_Down: 1505 case Qt::Key_Down:
1503 mView->viewManager()->agendaView()->scrollOneHourDown(); 1506 mView->viewManager()->agendaView()->scrollOneHourDown();
1504 break; 1507 break;
1505 case Qt::Key_Up: 1508 case Qt::Key_Up:
1506 mView->viewManager()->agendaView()->scrollOneHourUp(); 1509 mView->viewManager()->agendaView()->scrollOneHourUp();
1507 break; 1510 break;
1508 case Qt::Key_I: 1511 case Qt::Key_I:
1509 mView->showIncidence(); 1512 mView->showIncidence();
1510 break; 1513 break;
1511 case Qt::Key_Delete: 1514 case Qt::Key_Delete:
1512 case Qt::Key_Backspace: 1515 case Qt::Key_Backspace:
1513 mView->deleteIncidence(); 1516 mView->deleteIncidence();
1514 break; 1517 break;
1515 case Qt::Key_D: 1518 case Qt::Key_D:
1516 mView->viewManager()->showDayView(); 1519 mView->viewManager()->showDayView();
1517 showSelectedDates = true; 1520 showSelectedDates = true;
1518 break; 1521 break;
1519 case Qt::Key_O: 1522 case Qt::Key_O:
1520 mView->toggleFilerEnabled( ); 1523 mView->toggleFilerEnabled( );
1521 break; 1524 break;
1522 case Qt::Key_0: 1525 case Qt::Key_0:
1523 case Qt::Key_1: 1526 case Qt::Key_1:
1524 case Qt::Key_2: 1527 case Qt::Key_2:
1525 case Qt::Key_3: 1528 case Qt::Key_3:
1526 case Qt::Key_4: 1529 case Qt::Key_4:
1527 case Qt::Key_5: 1530 case Qt::Key_5:
1528 case Qt::Key_6: 1531 case Qt::Key_6:
1529 case Qt::Key_7: 1532 case Qt::Key_7:
1530 case Qt::Key_8: 1533 case Qt::Key_8:
1531 case Qt::Key_9: 1534 case Qt::Key_9:
1532 pro = e->key()-48; 1535 pro = e->key()-48;
1533 if ( pro == 0 ) 1536 if ( pro == 0 )
1534 pro = 10; 1537 pro = 10;
1535 if ( e->state() == Qt::ControlButton) 1538 if ( e->state() == Qt::ControlButton)
1536 pro += 10; 1539 pro += 10;
1537 break; 1540 break;
1538 case Qt::Key_M: 1541 case Qt::Key_M:
1539 mView->viewManager()->showMonthView(); 1542 mView->viewManager()->showMonthView();
1540 showSelectedDates = true; 1543 showSelectedDates = true;
1541 break; 1544 break;
1542 case Qt::Key_Insert: 1545 case Qt::Key_Insert:
1543 mView->newEvent(); 1546 mView->newEvent();
1544 break; 1547 break;
1545 case Qt::Key_S : 1548 case Qt::Key_S :
1546 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1549 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1547 mView->newSubTodo(); 1550 mView->newSubTodo();
1548 else 1551 else
1549 mView->dialogManager()->showSearchDialog(); 1552 mView->dialogManager()->showSearchDialog();
1550 break; 1553 break;
1551 case Qt::Key_Y : 1554 case Qt::Key_Y :
1552 case Qt::Key_Z : 1555 case Qt::Key_Z :
1553 mView->viewManager()->showWorkWeekView(); 1556 mView->viewManager()->showWorkWeekView();
1554 showSelectedDates = true; 1557 showSelectedDates = true;
1555 break; 1558 break;
1556 case Qt::Key_U : 1559 case Qt::Key_U :
1557 mView->viewManager()->showWeekView(); 1560 mView->viewManager()->showWeekView();
1558 showSelectedDates = true; 1561 showSelectedDates = true;
1559 break; 1562 break;
1560 case Qt::Key_H : 1563 case Qt::Key_H :
1561 keyBindings(); 1564 keyBindings();
1562 break; 1565 break;
1563 case Qt::Key_W: 1566 case Qt::Key_W:
1564 mView->viewManager()->showWhatsNextView(); 1567 mView->viewManager()->showWhatsNextView();
1565 break; 1568 break;
1566 case Qt::Key_L: 1569 case Qt::Key_L:
1567 mView->viewManager()->showListView(); 1570 mView->viewManager()->showListView();
1568 break; 1571 break;
1569 case Qt::Key_N: 1572 case Qt::Key_N:
1570 mView->viewManager()->showNextXView(); 1573 mView->viewManager()->showNextXView();
1571 showSelectedDates = true; 1574 showSelectedDates = true;
1572 break; 1575 break;
1573 case Qt::Key_V: 1576 case Qt::Key_V:
1574 mView->viewManager()->showTodoView(); 1577 mView->viewManager()->showTodoView();
1575 break; 1578 break;
1576 case Qt::Key_C: 1579 case Qt::Key_C:
1577 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1580 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1578 break; 1581 break;
1579 case Qt::Key_P: 1582 case Qt::Key_P:
1580 mView->showDatePicker( ); 1583 mView->showDatePicker( );
1581 break; 1584 break;
1582 case Qt::Key_F: 1585 case Qt::Key_F:
1583 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1586 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1584 mView->editFilters(); 1587 mView->editFilters();
1585 else 1588 else
1586 mView->toggleFilter(); 1589 mView->toggleFilter();
1587 break; 1590 break;
1588 case Qt::Key_X: 1591 case Qt::Key_X:
1589 mView->toggleDateNavigatorWidget(); 1592 mView->toggleDateNavigatorWidget();
1590 break; 1593 break;
1591 case Qt::Key_Space: 1594 case Qt::Key_Space:
1592 mView->toggleExpand(); 1595 mView->toggleExpand();
1593 break; 1596 break;
1594 case Qt::Key_A: 1597 case Qt::Key_A:
1595 mView->toggleAllDaySize(); 1598 mView->toggleAllDaySize();
1596 break; 1599 break;
1597 case Qt::Key_T: 1600 case Qt::Key_T:
1598 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1601 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1599 mView->newTodo(); 1602 mView->newTodo();
1600 else { 1603 else {
1601 mView->goToday(); 1604 mView->goToday();
1602 showSelectedDates = true; 1605 showSelectedDates = true;
1603 } 1606 }
1604 break; 1607 break;
1605 case Qt::Key_J: 1608 case Qt::Key_J:
1606 mView->viewManager()->showJournalView(); 1609 mView->viewManager()->showJournalView();
1607 break; 1610 break;
1608 case Qt::Key_B: 1611 case Qt::Key_B:
1609 mView->editIncidenceDescription();; 1612 mView->editIncidenceDescription();;
1610 break; 1613 break;
1611 // case Qt::Key_Return: 1614 // case Qt::Key_Return:
1612 case Qt::Key_E: 1615 case Qt::Key_E:
1613 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1616 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1614 mView->newEvent(); 1617 mView->newEvent();
1615 else 1618 else
1616 mView->editIncidence(); 1619 mView->editIncidence();
1617 break; 1620 break;
1618 case Qt::Key_Plus: 1621 case Qt::Key_Plus:
1619 size = p->mHourSize +2; 1622 size = p->mHourSize +2;
1620 if ( size <= 18 ) 1623 if ( size <= 18 )
1621 configureAgenda( size ); 1624 configureAgenda( size );
1622 break; 1625 break;
1623 case Qt::Key_Minus: 1626 case Qt::Key_Minus:
1624 size = p->mHourSize - 2; 1627 size = p->mHourSize - 2;
1625 if ( size >= 4 ) 1628 if ( size >= 4 )
1626 configureAgenda( size ); 1629 configureAgenda( size );
1627 break; 1630 break;
1628 1631
1629 1632
1630 default: 1633 default:
1631 e->ignore(); 1634 e->ignore();
1632 } 1635 }
1633 if ( pro > 0 ) { 1636 if ( pro > 0 ) {
1634 mView->selectFilter( pro-1 ); 1637 mView->selectFilter( pro-1 );
1635 } 1638 }
1636 if ( showSelectedDates ) { 1639 if ( showSelectedDates ) {
1637 ;// setCaptionToDates(); 1640 ;// setCaptionToDates();
1638 } 1641 }
1639 1642
1640} 1643}
1641 1644
1642void MainWindow::fillFilterMenu() 1645void MainWindow::fillFilterMenu()
1643{ 1646{
1644 selectFilterMenu->clear(); 1647 selectFilterMenu->clear();
1645 bool disable = false; 1648 bool disable = false;
1646 if ( mView->filterView()->filtersEnabled() ) { 1649 if ( mView->filterView()->filtersEnabled() ) {
1647 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1650 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1648 } 1651 }
1649 else { 1652 else {
1650 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1653 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1651 disable = true; 1654 disable = true;
1652 } 1655 }
1653 selectFilterMenu->insertSeparator(); 1656 selectFilterMenu->insertSeparator();
1654 QPtrList<CalFilter> fili = mView->filters(); 1657 QPtrList<CalFilter> fili = mView->filters();
1655 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1658 CalFilter *curfilter = mView->filterView()->selectedFilter();
1656 CalFilter *filter = fili.first(); 1659 CalFilter *filter = fili.first();
1657 int iii = 1; 1660 int iii = 1;
1658 while(filter) { 1661 while(filter) {
1659 selectFilterMenu->insertItem( filter->name(), iii ); 1662 selectFilterMenu->insertItem( filter->name(), iii );
1660 if ( filter == curfilter) 1663 if ( filter == curfilter)
1661 selectFilterMenu->setItemChecked( iii, true ); 1664 selectFilterMenu->setItemChecked( iii, true );
1662 if ( disable ) 1665 if ( disable )
1663 selectFilterMenu->setItemEnabled( iii, false ); 1666 selectFilterMenu->setItemEnabled( iii, false );
1664 filter = fili.next(); 1667 filter = fili.next();
1665 ++iii; 1668 ++iii;
1666 } 1669 }
1667} 1670}
1668void MainWindow::selectFilter( int fil ) 1671void MainWindow::selectFilter( int fil )
1669{ 1672{
1670 if ( fil == 0 ) { 1673 if ( fil == 0 ) {
1671 mView->toggleFilerEnabled( ); 1674 mView->toggleFilerEnabled( );
1672 } else { 1675 } else {
1673 mView->selectFilter( fil-1 ); 1676 mView->selectFilter( fil-1 );
1674 } 1677 }
1675} 1678}
1676void MainWindow::configureToolBar( int item ) 1679void MainWindow::configureToolBar( int item )
1677{ 1680{
1678 1681
1679 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1682 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1680 KOPrefs *p = KOPrefs::instance(); 1683 KOPrefs *p = KOPrefs::instance();
1681 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1684 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1682 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1685 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1683 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1686 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1684 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1687 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1685 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1688 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1686 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1689 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1687 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1690 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1688 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1691 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1689 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1692 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1690 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1693 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1691 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1694 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1692 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1695 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1693 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1696 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1694 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1697 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1695 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1698 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1696 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1699 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1697 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1700 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1698 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1701 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1699 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1702 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1700 // initActions(); 1703 // initActions();
1701} 1704}
1702 1705
1703void MainWindow::setCaptionToDates() 1706void MainWindow::setCaptionToDates()
1704{ 1707{
1705 QString selDates; 1708 QString selDates;
1706 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1709 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1707 if (mView->startDate() < mView->endDate() ) 1710 if (mView->startDate() < mView->endDate() )
1708 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1711 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1709 setCaption( i18n("Dates: ") + selDates ); 1712 setCaption( i18n("Dates: ") + selDates );
1710 1713
1711} 1714}
1712// parameter item == 0: reinit 1715// parameter item == 0: reinit
1713void MainWindow::configureAgenda( int item ) 1716void MainWindow::configureAgenda( int item )
1714{ 1717{
1715 1718
1716 KOPrefs *p = KOPrefs::instance(); 1719 KOPrefs *p = KOPrefs::instance();
1717 1720
1718 int i; 1721 int i;
1719 if ( item == 1 ) { 1722 if ( item == 1 ) {
1720 mView->toggleAllDaySize(); 1723 mView->toggleAllDaySize();
1721 return; 1724 return;
1722 } 1725 }
1723 // do not allow 4 for widgets higher than 480 1726 // do not allow 4 for widgets higher than 480
1724 // if ( QApplication::desktop()->height() > 480 ) { 1727 // if ( QApplication::desktop()->height() > 480 ) {
1725// if ( item == 4 ) 1728// if ( item == 4 )
1726// item = 6; 1729// item = 6;
1727// } 1730// }
1728 for ( i = 4; i <= 18; i= i+2 ) 1731 for ( i = 4; i <= 18; i= i+2 )
1729 configureAgendaMenu->setItemChecked( i, false ); 1732 configureAgendaMenu->setItemChecked( i, false );
1730 configureAgendaMenu->setItemChecked( item, true ); 1733 configureAgendaMenu->setItemChecked( item, true );
1731 if ( p->mHourSize == item ) 1734 if ( p->mHourSize == item )
1732 return; 1735 return;
1733 p->mHourSize=item; 1736 p->mHourSize=item;
1734 mView->viewManager()->agendaView()->updateConfig(); 1737 mView->viewManager()->agendaView()->updateConfig();
1735} 1738}
1736 1739
1737void MainWindow::saveCalendar() 1740void MainWindow::saveCalendar()
1738{ 1741{
1739 QString fn = KOPrefs::instance()->mLastSaveFile; 1742 QString fn = KOPrefs::instance()->mLastSaveFile;
1740 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1743 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1741 1744
1742 if ( fn == "" ) 1745 if ( fn == "" )
1743 return; 1746 return;
1744 QFileInfo info; 1747 QFileInfo info;
1745 info.setFile( fn ); 1748 info.setFile( fn );
1746 QString mes; 1749 QString mes;
1747 bool createbup = true; 1750 bool createbup = true;
1748 if ( info. exists() ) { 1751 if ( info. exists() ) {
1749 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1752 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1750 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1753 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1751 i18n("Overwrite!"), i18n("Cancel"), 0, 1754 i18n("Overwrite!"), i18n("Cancel"), 0,
1752 0, 1 ); 1755 0, 1 );
1753 if ( result != 0 ) { 1756 if ( result != 0 ) {
1754 createbup = false; 1757 createbup = false;
1755 } 1758 }
1756 } 1759 }
1757 if ( createbup ) { 1760 if ( createbup ) {
1758 mView->saveCalendar( fn ); 1761 mView->saveCalendar( fn );
1759 mes = i18n("KO/Pi:Saved %1").arg(fn); 1762 mes = i18n("KO/Pi:Saved %1").arg(fn);
1760 KOPrefs::instance()->mLastSaveFile = fn; 1763 KOPrefs::instance()->mLastSaveFile = fn;
1761 setCaption(mes); 1764 setCaption(mes);
1762 } 1765 }
1763} 1766}
1764void MainWindow::loadCalendar() 1767void MainWindow::loadCalendar()
1765{ 1768{
1766 1769
1767 QString fn = KOPrefs::instance()->mLastLoadFile; 1770 QString fn = KOPrefs::instance()->mLastLoadFile;
1768 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1771 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1769 1772
1770 if ( fn == "" ) 1773 if ( fn == "" )
1771 return; 1774 return;
1772 QFileInfo info; 1775 QFileInfo info;
1773 info.setFile( fn ); 1776 info.setFile( fn );
1774 QString mess; 1777 QString mess;
1775 bool loadbup = true; 1778 bool loadbup = true;
1776 if ( info. exists() ) { 1779 if ( info. exists() ) {
1777 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1780 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1778 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1781 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1779 mess, 1782 mess,
1780 i18n("Load!"), i18n("Cancel"), 0, 1783 i18n("Load!"), i18n("Cancel"), 0,
1781 0, 1 ); 1784 0, 1 );
1782 if ( result != 0 ) { 1785 if ( result != 0 ) {
1783 loadbup = false; 1786 loadbup = false;
1784 } 1787 }
1785 } else { 1788 } else {
1786 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1789 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1787 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1790 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1788 0, 1 ); 1791 0, 1 );
1789 1792
1790 return; 1793 return;
1791 } 1794 }
1792 if ( loadbup ) { 1795 if ( loadbup ) {
1793 mView->openCalendar( fn ); 1796 mView->openCalendar( fn );
1794 KOPrefs::instance()->mLastLoadFile = fn; 1797 KOPrefs::instance()->mLastLoadFile = fn;
1795 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1798 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1796 setCaption(mess); 1799 setCaption(mess);
1797 } 1800 }
1798 1801
1799} 1802}
1800void MainWindow::quickImportIcal() 1803void MainWindow::quickImportIcal()
1801{ 1804{
1802 importFile( KOPrefs::instance()->mLastImportFile, false ); 1805 importFile( KOPrefs::instance()->mLastImportFile, false );
1803} 1806}
1804void MainWindow::importFile( QString fn, bool quick ) 1807void MainWindow::importFile( QString fn, bool quick )
1805{ 1808{
1806 QFileInfo info; 1809 QFileInfo info;
1807 info.setFile( fn ); 1810 info.setFile( fn );
1808 QString mess; 1811 QString mess;
1809 bool loadbup = true; 1812 bool loadbup = true;
1810 if ( !info. exists() ) { 1813 if ( !info. exists() ) {
1811 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1814 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1812 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1815 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1813 mess ); 1816 mess );
1814 return; 1817 return;
1815 } 1818 }
1816 int result = 0; 1819 int result = 0;
1817 if ( !quick ) { 1820 if ( !quick ) {
1818 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1821 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1819 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1822 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1820 mess, 1823 mess,
1821 "Import", "Cancel", 0, 1824 "Import", "Cancel", 0,
1822 0, 1 ); 1825 0, 1 );
1823 } 1826 }
1824 if ( result == 0 ) { 1827 if ( result == 0 ) {
1825 if ( mView->openCalendar( fn, true )) { 1828 if ( mView->openCalendar( fn, true )) {
1826 KOPrefs::instance()->mLastImportFile = fn; 1829 KOPrefs::instance()->mLastImportFile = fn;
1827 setCaption(i18n("Imported file successfully")); 1830 setCaption(i18n("Imported file successfully"));
1828 } else { 1831 } else {
1829 setCaption(i18n("Error importing file")); 1832 setCaption(i18n("Error importing file"));
1830 } 1833 }
1831 } 1834 }
1832} 1835}
1833 1836
1834void MainWindow::importIcal() 1837void MainWindow::importIcal()
1835{ 1838{
1836 1839
1837 QString fn =KOPrefs::instance()->mLastImportFile; 1840 QString fn =KOPrefs::instance()->mLastImportFile;
1838 1841
1839 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1842 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1840 if ( fn == "" ) 1843 if ( fn == "" )
1841 return; 1844 return;
1842 importFile( fn, true ); 1845 importFile( fn, true );
1843 1846
1844} 1847}
1845 1848
1846void MainWindow::exportVCalendar() 1849void MainWindow::exportVCalendar()
1847{ 1850{
1848 QString fn = KOPrefs::instance()->mLastVcalFile; 1851 QString fn = KOPrefs::instance()->mLastVcalFile;
1849 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1852 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1850 if ( fn == "" ) 1853 if ( fn == "" )
1851 return; 1854 return;
1852 QFileInfo info; 1855 QFileInfo info;
1853 info.setFile( fn ); 1856 info.setFile( fn );
1854 QString mes; 1857 QString mes;
1855 bool createbup = true; 1858 bool createbup = true;
1856 if ( info. exists() ) { 1859 if ( info. exists() ) {
1857 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1860 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1858 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1861 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1859 i18n("Overwrite!"), i18n("Cancel"), 0, 1862 i18n("Overwrite!"), i18n("Cancel"), 0,
1860 0, 1 ); 1863 0, 1 );
1861 if ( result != 0 ) { 1864 if ( result != 0 ) {
1862 createbup = false; 1865 createbup = false;
1863 } 1866 }
1864 } 1867 }
1865 if ( createbup ) { 1868 if ( createbup ) {
1866 if ( mView->exportVCalendar( fn ) ) { 1869 if ( mView->exportVCalendar( fn ) ) {
1867 KOPrefs::instance()->mLastVcalFile = fn; 1870 KOPrefs::instance()->mLastVcalFile = fn;
1868 if ( fn.length() > 20 ) 1871 if ( fn.length() > 20 )
1869 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1872 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1870 else 1873 else
1871 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1874 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1872 setCaption(mes); 1875 setCaption(mes);
1873 } 1876 }
1874 } 1877 }
1875 1878
1876} 1879}
1877 1880
1878void MainWindow::syncFileRequest() 1881void MainWindow::syncFileRequest()
1879{ 1882{
1880 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1883 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1881 mSyncManager->slotSyncMenu( 999 ); 1884 mSyncManager->slotSyncMenu( 999 );
1882 } 1885 }
1883 save(); 1886 save();
1884} 1887}
1885void MainWindow::getFile( bool success ) 1888void MainWindow::getFile( bool success )
1886{ 1889{
1887 if ( ! success ) { 1890 if ( ! success ) {
1888 setCaption( i18n("Error receiving file. Nothing changed!") ); 1891 setCaption( i18n("Error receiving file. Nothing changed!") );
1889 return; 1892 return;
1890 } 1893 }
1891 mView->openCalendar( defaultFileName() ); 1894 mView->openCalendar( defaultFileName() );
1892 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1895 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1893 mSyncManager->slotSyncMenu( 999 ); 1896 mSyncManager->slotSyncMenu( 999 );
1894 } 1897 }
1895 setCaption( i18n("Pi-Sync successful!") ); 1898 setCaption( i18n("Pi-Sync successful!") );
1896} 1899}
1897 1900
1898void MainWindow::printSel( ) 1901void MainWindow::printSel( )
1899{ 1902{
1900 mView->viewManager()->agendaView()->agenda()->printSelection(); 1903 mView->viewManager()->agendaView()->agenda()->printSelection();
1901} 1904}
1902 1905
1903void MainWindow::printCal() 1906void MainWindow::printCal()
1904{ 1907{
1905 mView->print();//mCp->showDialog(); 1908 mView->print();//mCp->showDialog();
1906} 1909}
1907 1910