summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-11 19:26:02 (UTC)
committer zautrix <zautrix>2005-03-11 19:26:02 (UTC)
commit1166a4797a91cedd5002a3513d5028c5e86016f0 (patch) (unidiff)
tree8e7443bc887a15dcf3852abd36e6e61f2e6bddad
parent71462ba8ef1803787bba6793f1adb85987eb57df (diff)
downloadkdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.zip
kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.gz
kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.bz2
better kopi export
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt5
-rw-r--r--kmicromail/editaccounts.cpp12
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp21
-rw-r--r--korganizer/kolistview.cpp41
-rw-r--r--korganizer/kolistview.h2
5 files changed, 66 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 246ab3d..2084d0d 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1203,104 +1203,107 @@
1203{ "Display all closed","Zeige alle geschlossen" }, 1203{ "Display all closed","Zeige alle geschlossen" },
1204{ "Display all flat","Zeige alle flach" }, 1204{ "Display all flat","Zeige alle flach" },
1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1205{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1206{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1206{ "Default todo done color:","Standard Todo erledigt Farbe" },
1207{ "Select week %1-%2","Wähle Woche %1-%2" }, 1207{ "Select week %1-%2","Wähle Woche %1-%2" },
1208{ "Select Week","Wähle Woche" }, 1208{ "Select Week","Wähle Woche" },
1209{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1209{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1210{ "Set Alarm!","Setze Alarm!" }, 1210{ "Set Alarm!","Setze Alarm!" },
1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1211{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1212{ " and "," und " }, 1212{ " and "," und " },
1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1213{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1214{ "Mail to selected","Mail an Ausgewählte" }, 1214{ "Mail to selected","Mail an Ausgewählte" },
1215{ "Mail to all","Mail an Alle" }, 1215{ "Mail to all","Mail an Alle" },
1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1216{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1217{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1218{ " on"," am" }, 1218{ " on"," am" },
1219{ " completed on "," erledigt am " }, 1219{ " completed on "," erledigt am " },
1220{ "Save as Event template","Speichere als Vorlage" }, 1220{ "Save as Event template","Speichere als Vorlage" },
1221{ "Load Event template","Lade Termin Vorlage" }, 1221{ "Load Event template","Lade Termin Vorlage" },
1222{ "Save as Journal template","Speichere als Journal Vorlage" }, 1222{ "Save as Journal template","Speichere als Journal Vorlage" },
1223{ "Insert Journal template","Füge Journal Vorlage ein" }, 1223{ "Insert Journal template","Füge Journal Vorlage ein" },
1224{ "Sub todos:<br>","Unter Todos:<br>" }, 1224{ "Sub todos:<br>","Unter Todos:<br>" },
1225{ "Parent todo:<br>","Über Todo:<br>" }, 1225{ "Parent todo:<br>","Über Todo:<br>" },
1226{ "Set current as color category","Setze Gewählte als Farbkategorie" }, 1226{ "Set current as color category","Setze Gewählte als Farbkategorie" },
1227{ " completed"," erledigt" }, 1227{ " completed"," erledigt" },
1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" }, 1228{ "(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!","(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi basiert auf KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) und das KDE Team.\nKOrganizer/Pi ist lizensiert unter der GPL.\nKO/Pi kann kompiliert werden für\nLinux, Zaurus-PDA und Windows\nwww.pi-sync.net --- www.korganizer.org\nBesonderen Dank an Michael und Ben\nfür intensives Testen!" },
1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." }, 1229{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." }, 1230{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." }, 1231{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" }, 1232{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." }, 1233{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
1234{ "Error","Fehler" }, 1234{ "Error","Fehler" },
1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." }, 1235{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." }, 1236{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
1237{ "Warning","Warnung" }, 1237{ "Warning","Warnung" },
1238{ "Select week number","Wähle Wochen Nummer" }, 1238{ "Select week number","Wähle Wochen Nummer" },
1239{ "Februar","Februar" }, 1239{ "Februar","Februar" },
1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" }, 1240{ "Click on the week number to\nshow week zoomed","Klicke auf die Wochennummer\num die Woche groß zu zeigen" },
1241{ "W","W" }, 1241{ "W","W" },
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "List week view","Listenwochenansicht" }, 1274{ "List week view","Listenwochenansicht" },
1275{ "List week","Listenwochenansicht" }, 1275{ "List week","Listenwochenansicht" },
1276{ "Next Week","Nächste Woche" }, 1276{ "Next Week","Nächste Woche" },
1277{ "Previous Week","Vorherige Woche" }, 1277{ "Previous Week","Vorherige Woche" },
1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1280{ "Details","Details" }, 1280{ "Details","Details" },
1281{ "Created time","Erstellt Zeit" }, 1281{ "Created time","Erstellt Zeit" },
1282{ "Last modified time","Geändert Zeit" }, 1282{ "Last modified time","Geändert Zeit" },
1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1284{ "View Options","Anzeige Optionen" }, 1284{ "View Options","Anzeige Optionen" },
1285{ "<b>Created: ","<b>Erstellt am: " }, 1285{ "<b>Created: ","<b>Erstellt am: " },
1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1287{ "Journal: ","Journal: " }, 1287{ "Journal: ","Journal: " },
1288{ "yearly","jährlich" }, 1288{ "yearly","jährlich" },
1289{ "(%1) ","%1-" }, 1289{ "(%1) ","%1-" },
1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1293{ "Summary/Loc.","Titel/Ort" }, 1293{ "Summary/Loc.","Titel/Ort" },
1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1295{ "Week Number","Wochennummer" }, 1295{ "Week Number","Wochennummer" },
1296{ "Import","Importiere" }, 1296{ "Import","Importiere" },
1297{ "Export","Exportiere" }, 1297{ "Export","Exportiere" },
1298{ "Beam","Beame" }, 1298{ "Beam","Beame" },
1299{ "Export selected","Exportiere Selektierte" },
1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1302{ "Journal/Details...","Journale/Details..." },
1299{ "","" }, 1303{ "","" },
1300{ "","" }, 1304{ "","" },
1301{ "","" }, 1305{ "","" },
1302{ "","" }, 1306{ "","" },
1303{ "","" }, 1307{ "","" },
1304{ "","" }, 1308{ "","" },
1305{ "","" }, 1309{ "","" },
1306
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 49049f6..2c0f2d8 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -254,378 +254,384 @@ void EditAccounts::slotNewNews()
254{ 254{
255 slotNewAccount( "NNTP" ); 255 slotNewAccount( "NNTP" );
256} 256}
257 257
258void EditAccounts::slotEditNews() 258void EditAccounts::slotEditNews()
259{ 259{
260 if ( !newsList->currentItem() ) 260 if ( !newsList->currentItem() )
261 { 261 {
262 QMessageBox::information( this, i18n( "Error" ), 262 QMessageBox::information( this, i18n( "Error" ),
263 i18n( "<p>Please select an account.</p>" ), 263 i18n( "<p>Please select an account.</p>" ),
264 i18n( "Ok" ) ); 264 i18n( "Ok" ) );
265 return; 265 return;
266 } 266 }
267 267
268 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 268 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
269 slotEditAccount( a ); 269 slotEditAccount( a );
270} 270}
271 271
272void EditAccounts::slotDeleteNews() 272void EditAccounts::slotDeleteNews()
273{ 273{
274 if ( !newsList->currentItem() ) 274 if ( !newsList->currentItem() )
275 { 275 {
276 QMessageBox::information( this, i18n( "Error" ), 276 QMessageBox::information( this, i18n( "Error" ),
277 i18n( "<p>Please select an account.</p>" ), 277 i18n( "<p>Please select an account.</p>" ),
278 i18n( "Ok" ) ); 278 i18n( "Ok" ) );
279 return; 279 return;
280 } 280 }
281 281
282 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 282 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
283 slotDeleteAccount( a ); 283 slotDeleteAccount( a );
284} 284}
285 285
286void EditAccounts::slotAdjustColumns() 286void EditAccounts::slotAdjustColumns()
287{ 287{
288 int currPage = configTab->currentPageIndex(); 288 int currPage = configTab->currentPageIndex();
289 289
290 configTab->showPage( mailTab ); 290 configTab->showPage( mailTab );
291 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 291 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
292 mailList->setColumnWidth( 1, 50 ); 292 mailList->setColumnWidth( 1, 50 );
293 293
294 configTab->showPage( newsTab ); 294 configTab->showPage( newsTab );
295 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 295 newsList->setColumnWidth( 0, newsList->visibleWidth() );
296 296
297 configTab->setCurrentPage( currPage ); 297 configTab->setCurrentPage( currPage );
298} 298}
299 299
300void EditAccounts::accept() 300void EditAccounts::accept()
301{ 301{
302 settings->saveAccounts(); 302 settings->saveAccounts();
303 303
304 QDialog::accept(); 304 QDialog::accept();
305} 305}
306 306
307/** 307/**
308 * SelectMailType 308 * SelectMailType
309 */ 309 */
310 310
311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
312 : SelectMailTypeUI( parent, name, modal, flags ) 312 : SelectMailTypeUI( parent, name, modal, flags )
313{ 313{
314 selected = selection; 314 selected = selection;
315 selected->replace( 0, selected->length(), typeBox->currentText() ); 315 selected->replace( 0, selected->length(), typeBox->currentText() );
316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
317} 317}
318 318
319void SelectMailType::slotSelection( const QString &sel ) 319void SelectMailType::slotSelection( const QString &sel )
320{ 320{
321 selected->replace( 0, selected->length(), sel ); 321 selected->replace( 0, selected->length(), sel );
322} 322}
323 323
324/** 324/**
325 * IMAPconfig 325 * IMAPconfig
326 */ 326 */
327 327
328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
329 : IMAPconfigUI( parent, name, modal, flags ) 329 : IMAPconfigUI( parent, name, modal, flags )
330{ 330{
331 data = account; 331 data = account;
332 332
333 //fillValues(); 333 //fillValues();
334 334
335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
336 ComboBox1->insertItem( "Only if available", 0 ); 336 ComboBox1->insertItem( "Only if available", 0 );
337 ComboBox1->insertItem( "Always, Negotiated", 1 ); 337 ComboBox1->insertItem( "Always, Negotiated", 1 );
338 ComboBox1->insertItem( "Connect on secure port", 2 ); 338 ComboBox1->insertItem( "Connect on secure port", 2 );
339 ComboBox1->insertItem( "Run command instead", 3 ); 339 ComboBox1->insertItem( "Run command instead", 3 );
340 CommandEdit->hide(); 340 CommandEdit->hide();
341 fillValues(); 341 fillValues();
342 // ComboBox1->setCurrentItem( data->ConnectionType() ); 342 // ComboBox1->setCurrentItem( data->ConnectionType() );
343} 343}
344 344
345void IMAPconfig::slotConnectionToggle( int index ) 345void IMAPconfig::slotConnectionToggle( int index )
346{ 346{
347 if ( index == 2 ) 347 if ( index == 2 )
348 { 348 {
349 portLine->setText( IMAP_SSL_PORT ); 349 portLine->setText( IMAP_SSL_PORT );
350 CommandEdit->hide();
350 } 351 }
351 else if ( index == 3 ) 352 else if ( index == 3 )
352 { 353 {
353 portLine->setText( IMAP_PORT ); 354 portLine->setText( IMAP_PORT );
354 CommandEdit->show(); 355 CommandEdit->show();
355 } 356 }
356 else 357 else
357 { 358 {
358 portLine->setText( IMAP_PORT ); 359 portLine->setText( IMAP_PORT );
360 CommandEdit->hide();
359 } 361 }
360} 362}
361 363
362void IMAPconfig::fillValues() 364void IMAPconfig::fillValues()
363{ 365{
364 accountLine->setText( data->getAccountName() ); 366 accountLine->setText( data->getAccountName() );
365 serverLine->setText( data->getServer() ); 367 serverLine->setText( data->getServer() );
366 portLine->setText( data->getPort() ); 368 portLine->setText( data->getPort() );
367 ComboBox1->setCurrentItem( data->ConnectionType() ); 369 ComboBox1->setCurrentItem( data->ConnectionType() );
368 userLine->setText( data->getUser() ); 370 userLine->setText( data->getUser() );
369 passLine->setText( data->getPassword() ); 371 passLine->setText( data->getPassword() );
370 prefixLine->setText(data->getPrefix()); 372 prefixLine->setText(data->getPrefix());
371 localFolder->setText( data->getLocalFolder() ); 373 localFolder->setText( data->getLocalFolder() );
372 int max = data->getMaxMailSize() ; 374 int max = data->getMaxMailSize() ;
373 if ( max ) { 375 if ( max ) {
374 CheckBoxDown->setChecked( true ); 376 CheckBoxDown->setChecked( true );
375 SpinBoxDown->setValue ( max ); 377 SpinBoxDown->setValue ( max );
376 } else { 378 } else {
377 CheckBoxDown->setChecked( false ); 379 CheckBoxDown->setChecked( false );
378 SpinBoxDown->setValue ( 5 ); 380 SpinBoxDown->setValue ( 5 );
379 } 381 }
380 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 382 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
381} 383}
382 384
383void IMAPconfig::accept() 385void IMAPconfig::accept()
384{ 386{
385 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { 387 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
386 QMessageBox::information( this, i18n( "Error" ), 388 QMessageBox::information( this, i18n( "Error" ),
387 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), 389 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
388 i18n( "Ok" ) ); 390 i18n( "Ok" ) );
389 return; 391 return;
390 } 392 }
391 data->setAccountName( accountLine->text() ); 393 data->setAccountName( accountLine->text() );
392 data->setServer( serverLine->text() ); 394 data->setServer( serverLine->text() );
393 data->setPort( portLine->text() ); 395 data->setPort( portLine->text() );
394 data->setConnectionType( ComboBox1->currentItem() ); 396 data->setConnectionType( ComboBox1->currentItem() );
395 data->setUser( userLine->text() ); 397 data->setUser( userLine->text() );
396 data->setPassword( passLine->text() ); 398 data->setPassword( passLine->text() );
397 data->setPrefix(prefixLine->text()); 399 data->setPrefix(prefixLine->text());
398 data->setLocalFolder( localFolder->text() ); 400 data->setLocalFolder( localFolder->text() );
399 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 401 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
400 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 402 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
401 403
402 QDialog::accept(); 404 QDialog::accept();
403} 405}
404 406
405/** 407/**
406 * POP3config 408 * POP3config
407 */ 409 */
408 410
409POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 411POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
410 : POP3configUI( parent, name, modal, flags ) 412 : POP3configUI( parent, name, modal, flags )
411{ 413{
412 data = account; 414 data = account;
413 //fillValues(); 415 //fillValues();
414 416
415 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 417 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
416 ComboBox1->insertItem( "Only if available", 0 ); 418 ComboBox1->insertItem( "Only if available", 0 );
417 ComboBox1->insertItem( "Always, Negotiated", 1 ); 419 ComboBox1->insertItem( "Always, Negotiated", 1 );
418 ComboBox1->insertItem( "Connect on secure port", 2 ); 420 ComboBox1->insertItem( "Connect on secure port", 2 );
419 ComboBox1->insertItem( "Run command instead", 3 ); 421 ComboBox1->insertItem( "Run command instead", 3 );
420 CommandEdit->hide(); 422 CommandEdit->hide();
421 fillValues(); 423 fillValues();
422 //ComboBox1->setCurrentItem( data->ConnectionType() ); 424 //ComboBox1->setCurrentItem( data->ConnectionType() );
423} 425}
424 426
425void POP3config::slotConnectionToggle( int index ) 427void POP3config::slotConnectionToggle( int index )
426{ 428{
427 // 2 is ssl connection 429 // 2 is ssl connection
428 if ( index == 2 ) 430 if ( index == 2 )
429 { 431 {
430 portLine->setText( POP3_SSL_PORT ); 432 portLine->setText( POP3_SSL_PORT );
433 CommandEdit->hide();
431 } 434 }
432 else if ( index == 3 ) 435 else if ( index == 3 )
433 { 436 {
434 portLine->setText( POP3_PORT ); 437 portLine->setText( POP3_PORT );
435 CommandEdit->show(); 438 CommandEdit->show();
436 } 439 }
437 else 440 else
438 { 441 {
439 portLine->setText( POP3_PORT ); 442 portLine->setText( POP3_PORT );
443 CommandEdit->hide();
440 } 444 }
441} 445}
442 446
443void POP3config::fillValues() 447void POP3config::fillValues()
444{ 448{
445 accountLine->setText( data->getAccountName() ); 449 accountLine->setText( data->getAccountName() );
446 serverLine->setText( data->getServer() ); 450 serverLine->setText( data->getServer() );
447 portLine->setText( data->getPort() ); 451 portLine->setText( data->getPort() );
448 ComboBox1->setCurrentItem( data->ConnectionType() ); 452 ComboBox1->setCurrentItem( data->ConnectionType() );
449 userLine->setText( data->getUser() ); 453 userLine->setText( data->getUser() );
450 passLine->setText( data->getPassword() ); 454 passLine->setText( data->getPassword() );
451 localFolder->setText( data->getLocalFolder() ); 455 localFolder->setText( data->getLocalFolder() );
452 int max = data->getMaxMailSize() ; 456 int max = data->getMaxMailSize() ;
453 if ( max ) { 457 if ( max ) {
454 CheckBoxDown->setChecked( true ); 458 CheckBoxDown->setChecked( true );
455 SpinBoxDown->setValue ( max ); 459 SpinBoxDown->setValue ( max );
456 } else { 460 } else {
457 CheckBoxDown->setChecked( false ); 461 CheckBoxDown->setChecked( false );
458 SpinBoxDown->setValue ( 5 ); 462 SpinBoxDown->setValue ( 5 );
459 } 463 }
460 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 464 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
461} 465}
462 466
463void POP3config::accept() 467void POP3config::accept()
464{ 468{
465 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { 469 if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
466 QMessageBox::information( this, i18n( "Error" ), 470 QMessageBox::information( this, i18n( "Error" ),
467 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), 471 i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
468 i18n( "Ok" ) ); 472 i18n( "Ok" ) );
469 return; 473 return;
470 } 474 }
471 data->setAccountName( accountLine->text() ); 475 data->setAccountName( accountLine->text() );
472 data->setServer( serverLine->text() ); 476 data->setServer( serverLine->text() );
473 data->setPort( portLine->text() ); 477 data->setPort( portLine->text() );
474 data->setConnectionType( ComboBox1->currentItem() ); 478 data->setConnectionType( ComboBox1->currentItem() );
475 data->setUser( userLine->text() ); 479 data->setUser( userLine->text() );
476 data->setPassword( passLine->text() ); 480 data->setPassword( passLine->text() );
477 data->setLocalFolder( localFolder->text() ); 481 data->setLocalFolder( localFolder->text() );
478 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 482 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
479 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 483 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
480 484
481 QDialog::accept(); 485 QDialog::accept();
482} 486}
483 487
484/** 488/**
485 * SMTPconfig 489 * SMTPconfig
486 */ 490 */
487 491
488SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 492SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
489 : SMTPconfigUI( parent, name, modal, flags ) 493 : SMTPconfigUI( parent, name, modal, flags )
490{ 494{
491 data = account; 495 data = account;
492 496
493 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 497 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
494 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 498 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
495 499
496 // fillValues(); 500 // fillValues();
497 QIconSet icon; 501 QIconSet icon;
498 //icon = SmallIcon("fileexport"); 502 //icon = SmallIcon("fileexport");
499 icon = SmallIcon("fileopen"); 503 icon = SmallIcon("fileopen");
500 SignaturButton->setText(""); 504 SignaturButton->setText("");
501 SignaturButton->setIconSet (icon ) ; 505 SignaturButton->setIconSet (icon ) ;
502 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; 506 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
503 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 507 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
504 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 508 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
505 ComboBox1->insertItem( "No secure connection, no TLS", 0 ); 509 ComboBox1->insertItem( "No secure connection, no TLS", 0 );
506 ComboBox1->insertItem( "Only if available, try TLS", 1 ); 510 ComboBox1->insertItem( "Only if available, try TLS", 1 );
507 ComboBox1->insertItem( "Always, use TLS", 2 ); 511 ComboBox1->insertItem( "Always, use TLS", 2 );
508 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); 512 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 );
509 ComboBox1->insertItem( "Run command instead", 4 ); 513 ComboBox1->insertItem( "Run command instead", 4 );
510 CommandEdit->hide(); 514 CommandEdit->hide();
511 fillValues(); 515 fillValues();
512 //ComboBox1->setCurrentItem( data->ConnectionType() ); 516 //ComboBox1->setCurrentItem( data->ConnectionType() );
513} 517}
514void SMTPconfig::chooseSig() 518void SMTPconfig::chooseSig()
515{ 519{
516 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); 520 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
517 if ( !lnk.isEmpty() ) { 521 if ( !lnk.isEmpty() ) {
518 SignaturEdit->setText( lnk ); 522 SignaturEdit->setText( lnk );
519 } 523 }
520} 524}
521void SMTPconfig::slotConnectionToggle( int index ) 525void SMTPconfig::slotConnectionToggle( int index )
522{ 526{
523 // 2 is ssl connection 527 // 3 is ssl connection
524 if ( index == 2 ) 528 if ( index == 3 )
525 { 529 {
526 portLine->setText( SMTP_SSL_PORT ); 530 portLine->setText( SMTP_SSL_PORT );
531 CommandEdit->hide();
527 } 532 }
528 else if ( index == 3 ) 533 else if ( index == 4 )
529 { 534 {
530 portLine->setText( SMTP_PORT ); 535 portLine->setText( SMTP_PORT );
531 CommandEdit->show(); 536 CommandEdit->show();
532 } 537 }
533 else 538 else
534 { 539 {
535 portLine->setText( SMTP_PORT ); 540 portLine->setText( SMTP_PORT );
541 CommandEdit->hide();
536 } 542 }
537} 543}
538 544
539void SMTPconfig::fillValues() 545void SMTPconfig::fillValues()
540{ 546{
541 accountLine->setText( data->getAccountName() ); 547 accountLine->setText( data->getAccountName() );
542 serverLine->setText( data->getServer() ); 548 serverLine->setText( data->getServer() );
543 portLine->setText( data->getPort() ); 549 portLine->setText( data->getPort() );
544 ComboBox1->setCurrentItem( data->ConnectionType() ); 550 ComboBox1->setCurrentItem( data->ConnectionType() );
545 loginBox->setChecked( data->getLogin() ); 551 loginBox->setChecked( data->getLogin() );
546 userLine->setText( data->getUser() ); 552 userLine->setText( data->getUser() );
547 passLine->setText( data->getPassword() ); 553 passLine->setText( data->getPassword() );
548 SignaturEdit->setText( data->getSigFile() ); 554 SignaturEdit->setText( data->getSigFile() );
549} 555}
550 556
551void SMTPconfig::accept() 557void SMTPconfig::accept()
552{ 558{
553 data->setAccountName( accountLine->text() ); 559 data->setAccountName( accountLine->text() );
554 data->setServer( serverLine->text() ); 560 data->setServer( serverLine->text() );
555 data->setPort( portLine->text() ); 561 data->setPort( portLine->text() );
556 data->setConnectionType( ComboBox1->currentItem() ); 562 data->setConnectionType( ComboBox1->currentItem() );
557 data->setLogin( loginBox->isChecked() ); 563 data->setLogin( loginBox->isChecked() );
558 data->setUser( userLine->text() ); 564 data->setUser( userLine->text() );
559 data->setPassword( passLine->text() ); 565 data->setPassword( passLine->text() );
560 data->setSigFile( SignaturEdit->text() ); 566 data->setSigFile( SignaturEdit->text() );
561 567
562 QDialog::accept(); 568 QDialog::accept();
563} 569}
564 570
565/** 571/**
566 * NNTPconfig 572 * NNTPconfig
567 */ 573 */
568 574
569NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 575NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
570 : NNTPconfigUI( parent, name, modal, flags ) 576 : NNTPconfigUI( parent, name, modal, flags )
571{ 577{
572 data = account; 578 data = account;
573 579
574 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 580 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
575 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 581 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
576 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 582 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
577 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 583 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
578 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 584 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
579 fillValues(); 585 fillValues();
580 586
581 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 587 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
582} 588}
583 589
584void NNTPconfig::slotShowSub() 590void NNTPconfig::slotShowSub()
585{ 591{
586 save(); 592 save();
587 data->save(); 593 data->save();
588 ListViewGroups->clear(); 594 ListViewGroups->clear();
589 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 595 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
590 QCheckListItem *item; 596 QCheckListItem *item;
591 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 597 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
592 item->setOn( true ); 598 item->setOn( true );
593 } 599 }
594 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); 600 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
595} 601}
596void NNTPconfig::slotShowFilter() 602void NNTPconfig::slotShowFilter()
597{ 603{
598 save(); 604 save();
599 data->save(); 605 data->save();
600 ListViewGroups->clear(); 606 ListViewGroups->clear();
601 int count = 0; 607 int count = 0;
602 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 608 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
603 QCheckListItem *item; 609 QCheckListItem *item;
604 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 610 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
605 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 611 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
606 ++count; 612 ++count;
607 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 613 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
608 item->setOn( true ); 614 item->setOn( true );
609 } 615 }
610 } 616 }
611 } 617 }
612 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); 618 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
613} 619}
614void NNTPconfig::slotGetNG() { 620void NNTPconfig::slotGetNG() {
615 save(); 621 save();
616 data->save(); 622 data->save();
617 topLevelWidget()->setCaption( i18n("Fetching group list...")); 623 topLevelWidget()->setCaption( i18n("Fetching group list..."));
618 qApp->processEvents(); 624 qApp->processEvents();
619 NNTPwrapper* tmp = new NNTPwrapper( data ); 625 NNTPwrapper* tmp = new NNTPwrapper( data );
620 allGroups = tmp->listAllNewsgroups(); 626 allGroups = tmp->listAllNewsgroups();
621 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); 627 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
622 628
623 ListViewGroups->clear(); 629 ListViewGroups->clear();
624 630
625 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 631 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
626 QCheckListItem *item; 632 QCheckListItem *item;
627 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 633 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
628 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 634 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
629 item->setOn( true ); 635 item->setOn( true );
630 636
631 } 637 }
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 872a460..845c71c 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -151,322 +151,337 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
151 if (rcpts) 151 if (rcpts)
152 smtp_address_list_free( rcpts ); 152 smtp_address_list_free( rcpts );
153 return result; 153 return result;
154} 154}
155 155
156void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 156void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
157{ 157{
158 if (data) { 158 if (data) {
159 storeMail(data,size,"Sendfailed"); 159 storeMail(data,size,"Sendfailed");
160 } 160 }
161 if (failuremessage) { 161 if (failuremessage) {
162 QMessageBox::critical(0,i18n("Error sending mail"), 162 QMessageBox::critical(0,i18n("Error sending mail"),
163 failuremessage); 163 failuremessage);
164 } 164 }
165} 165}
166 166
167int SMTPwrapper::start_smtp_tls() 167int SMTPwrapper::start_smtp_tls()
168{ 168{
169 if (!m_smtp) { 169 if (!m_smtp) {
170 return MAILSMTP_ERROR_IN_PROCESSING; 170 return MAILSMTP_ERROR_IN_PROCESSING;
171 } 171 }
172 int err = mailesmtp_starttls(m_smtp); 172 int err = mailesmtp_starttls(m_smtp);
173 if (err != MAILSMTP_NO_ERROR) return err; 173 if (err != MAILSMTP_NO_ERROR) return err;
174 mailstream_low * low; 174 mailstream_low * low;
175 mailstream_low * new_low; 175 mailstream_low * new_low;
176 low = mailstream_get_low(m_smtp->stream); 176 low = mailstream_get_low(m_smtp->stream);
177 if (!low) { 177 if (!low) {
178 return MAILSMTP_ERROR_IN_PROCESSING; 178 return MAILSMTP_ERROR_IN_PROCESSING;
179 } 179 }
180 int fd = mailstream_low_get_fd(low); 180 int fd = mailstream_low_get_fd(low);
181 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 181 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
182 mailstream_low_free(low); 182 mailstream_low_free(low);
183 mailstream_set_low(m_smtp->stream, new_low); 183 mailstream_set_low(m_smtp->stream, new_low);
184 } else { 184 } else {
185 return MAILSMTP_ERROR_IN_PROCESSING; 185 return MAILSMTP_ERROR_IN_PROCESSING;
186 } 186 }
187 return err; 187 return err;
188} 188}
189 189
190void SMTPwrapper::connect_server() 190void SMTPwrapper::connect_server()
191{ 191{
192 QString server, user, pass; 192 QString server, user, pass;
193 bool ssl; 193 bool ssl;
194 uint16_t port; 194 uint16_t port;
195 ssl = false; 195 ssl = false;
196 bool try_tls = false; 196 bool try_tls = false;
197 bool force_tls=false; 197 bool force_tls=false;
198 QString failuretext = ""; 198 QString failuretext = "";
199 199
200 if (m_smtp || !m_SmtpAccount) { 200 if (m_smtp || !m_SmtpAccount) {
201 return; 201 return;
202 } 202 }
203 server = m_SmtpAccount->getServer(); 203 server = m_SmtpAccount->getServer();
204 if ( m_SmtpAccount->ConnectionType() == 3 ) { 204 if ( m_SmtpAccount->ConnectionType() == 3 ) {
205 ssl = true; 205 ssl = true;
206 try_tls = false; 206 try_tls = false;
207 } else if (m_SmtpAccount->ConnectionType() == 2) { 207 } else if (m_SmtpAccount->ConnectionType() == 2) {
208 force_tls = true; 208 force_tls = true;
209 } else if (m_SmtpAccount->ConnectionType() == 1) { 209 } else if (m_SmtpAccount->ConnectionType() == 1) {
210 try_tls = true; 210 try_tls = true;
211 } 211 }
212 int result = 1; 212 int result = 1;
213 port = m_SmtpAccount->getPort().toUInt(); 213 port = m_SmtpAccount->getPort().toUInt();
214 214
215 m_smtp = mailsmtp_new( 20, &progress ); 215 m_smtp = mailsmtp_new( 20, &progress );
216 if ( m_smtp == NULL ) { 216 if ( m_smtp == NULL ) {
217 /* no failure message cause this happens when problems with memory - than we 217 /* no failure message cause this happens when problems with memory - than we
218 we can not display any messagebox */ 218 we can not display any messagebox */
219 return; 219 return;
220 } 220 }
221 221
222 int err = MAILSMTP_NO_ERROR; 222 int err = MAILSMTP_NO_ERROR;
223 ; // odebug << "Servername " << server << " at port " << port << "" << oendl; 223 ; // odebug << "Servername " << server << " at port " << port << "" << oendl;
224 if ( ssl ) { 224 if ( ssl ) {
225 qDebug("smtp: ssl_connect "); 225 qDebug("smtp: ssl_connect ");
226 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); 226 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
227 } else { 227 } else {
228 ; // odebug << "No SSL session" << oendl; 228 ; // odebug << "No SSL session" << oendl;
229 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); 229 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
230 } 230 }
231 if ( err != MAILSMTP_NO_ERROR ) { 231 if ( err != MAILSMTP_NO_ERROR ) {
232 qDebug("Error init SMTP connection" ); 232 qDebug("Error init SMTP connection" );
233 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); 233 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err));
234 result = 0; 234 result = 0;
235 } 235 }
236 236
237 qDebug("SMTP connection inited "); 237 qDebug("SMTP connection inited ");
238 /* switch to tls after init 'cause there it will send the ehlo */ 238 /* switch to tls after init 'cause there it will send the ehlo */
239 if (result) { 239 if (result) {
240 err = mailsmtp_init( m_smtp ); 240 err = mailsmtp_init( m_smtp );
241 if (err != MAILSMTP_NO_ERROR) { 241 if (err != MAILSMTP_NO_ERROR) {
242 result = 0; 242 result = 0;
243 qDebug("Error init SMTP connection "); 243 qDebug("Error init SMTP connection ");
244 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); 244 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err));
245 } 245 }
246 } 246 }
247 if (try_tls) { 247 if (result && try_tls) {
248 qDebug("Smpt: Try tls "); 248 qDebug("Smpt: Try tls ");
249 err = start_smtp_tls(); 249 err = start_smtp_tls();
250 if (err != MAILSMTP_NO_ERROR) { 250 if (err != MAILSMTP_NO_ERROR) {
251 try_tls = false; 251 try_tls = false;
252 qDebug("no tls "); 252 qDebug("no tls ");
253 } else { 253 } else {
254 err = mailesmtp_ehlo(m_smtp); 254 err = mailesmtp_ehlo(m_smtp);
255 if ( err != MAILSMTP_NO_ERROR )
256 result = 0;
255 } 257 }
256 } 258 }
257 //qDebug("mailesmtp_ehlo %d ",err ); 259 //qDebug("mailesmtp_ehlo %d ",err );
258 if (!try_tls && force_tls) { 260 if (!try_tls && force_tls) {
259 result = 0; 261 result = 0;
260 failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err)); 262 failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err));
261 } 263 }
262 264
263 if (result==1 && m_SmtpAccount->getLogin() ) { 265 if (result==1 && m_SmtpAccount->getLogin() ) {
264 ; // odebug << "smtp with auth" << oendl; 266 ; // odebug << "smtp with auth" << oendl;
265 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 267 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
266 // get'em 268 // get'em
267 LoginDialog login( m_SmtpAccount->getUser(), 269 LoginDialog login( m_SmtpAccount->getUser(),
268 m_SmtpAccount->getPassword(), NULL, 0, true ); 270 m_SmtpAccount->getPassword(), NULL, 0, true );
269 login.show(); 271 login.show();
270 if ( QDialog::Accepted == login.exec() ) { 272 if ( QDialog::Accepted == login.exec() ) {
271 // ok 273 // ok
272 user = login.getUser(); 274 user = login.getUser();
273 pass = login.getPassword(); 275 pass = login.getPassword();
274 } else { 276 } else {
275 result = 0; 277 result = 0;
276 failuretext=i18n("Login aborted - \nstoring mail to localfolder"); 278 failuretext=i18n("Login aborted - \nstoring mail to localfolder");
277 } 279 }
278 } else { 280 } else {
279 user = m_SmtpAccount->getUser(); 281 user = m_SmtpAccount->getUser();
280 pass = m_SmtpAccount->getPassword(); 282 pass = m_SmtpAccount->getPassword();
281 } 283 }
282 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; 284 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
283 if (result) { 285 if (result) {
284 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); 286 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() );
285 if ( err == MAILSMTP_NO_ERROR ) { 287 if ( err == MAILSMTP_NO_ERROR ) {
286 qDebug("Smtp authentification ok "); 288 qDebug("Smtp authentification ok ");
287 } else { 289 } else {
288 failuretext = i18n("Authentification failed"); 290 failuretext = i18n("Authentification failed");
289 result = 0; 291 result = 0;
290 } 292 }
291 } 293 }
292 } 294 }
295 if ( result == 0 ) {
296 mailsmtp_free(m_smtp);
297 m_smtp = 0;
298 }
293} 299}
294 300
295void SMTPwrapper::disc_server() 301void SMTPwrapper::disc_server()
296{ 302{
297 if (m_smtp) { 303 if (m_smtp) {
298 mailsmtp_quit( m_smtp ); 304 mailsmtp_quit( m_smtp );
299 mailsmtp_free( m_smtp ); 305 mailsmtp_free( m_smtp );
300 m_smtp = 0; 306 m_smtp = 0;
301 } 307 }
302} 308}
303 309
304int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) 310int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
305{ 311{
306 int err,result; 312 int err,result;
307 QString failuretext = ""; 313 QString failuretext = "";
308 314
309 connect_server(); 315 connect_server();
310 316
311 result = 1; 317 result = 1;
312 if (m_smtp) { 318 if (m_smtp) {
313 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 319 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
314 if ( err != MAILSMTP_NO_ERROR ) { 320 if ( err != MAILSMTP_NO_ERROR ) {
315 qDebug("Error sending mail"); 321 qDebug("Error sending mail");
316 failuretext=i18n("Error sending mail:\n%1").arg(mailsmtpError(err)); 322 failuretext=i18n("Error sending mail:\n%1").arg(mailsmtpError(err));
317 result = 0; 323 result = 0;
318 } 324 }
319 } else { 325 } else {
320 result = 0; 326 result = 0;
321 } 327 }
322 328
323 if (!result) { 329 if (!result) {
324 storeFailedMail(data,size,failuretext); 330 storeFailedMail(data,size,failuretext);
325 } else { 331 } else {
326 ; // odebug << "Mail sent." << oendl; 332 ; // odebug << "Mail sent." << oendl;
327 storeMail(data,size,"Sent"); 333 storeMail(data,size,"Sent");
328 } 334 }
329 return result; 335 return result;
330} 336}
331 337
332bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 338bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
333{ 339{
334 mailmime * mimeMail; 340 mailmime * mimeMail;
335 bool result = true; 341 bool result = true;
336 mimeMail = createMimeMail(mail ); 342 mimeMail = createMimeMail(mail );
337 if ( mimeMail == 0 ) { 343 if ( mimeMail == 0 ) {
338 qDebug("SMTP wrapper:Error creating mail! "); 344 qDebug("SMTP wrapper:Error creating mail! ");
339 return false; 345 return false;
340 } else { 346 } else {
341 sendProgress = new progressMailSend(); 347 sendProgress = new progressMailSend();
342 sendProgress->show(); 348 sendProgress->show();
343 sendProgress->setMaxMails(1); 349 sendProgress->setMaxMails(1);
344 result = smtpSend( mimeMail,later); 350 result = smtpSend( mimeMail,later);
345 ; // odebug << "Clean up done" << oendl; 351 ; // odebug << "Clean up done" << oendl;
346 sendProgress->hide(); 352 sendProgress->hide();
347 delete sendProgress; 353 delete sendProgress;
348 sendProgress = 0; 354 sendProgress = 0;
349 mailmime_free( mimeMail ); 355 mailmime_free( mimeMail );
356 if ( m_smtp ) {
357 mailsmtp_free(m_smtp);
358 m_smtp = 0;
359 }
350 } 360 }
351 return result; 361 return result;
352} 362}
353 363
354int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 364int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
355 size_t curTok = 0; 365 size_t curTok = 0;
356 mailimf_fields *fields = 0; 366 mailimf_fields *fields = 0;
357 mailimf_field*ffrom = 0; 367 mailimf_field*ffrom = 0;
358 clist *rcpts = 0; 368 clist *rcpts = 0;
359 char*from = 0; 369 char*from = 0;
360 int res = 0; 370 int res = 0;
361 371
362 encodedString * data = wrap->fetchRawBody(which); 372 encodedString * data = wrap->fetchRawBody(which);
363 if (!data) 373 if (!data)
364 return 0; 374 return 0;
365 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); 375 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
366 if (err != MAILIMF_NO_ERROR) { 376 if (err != MAILIMF_NO_ERROR) {
367 delete data; 377 delete data;
368 delete wrap; 378 delete wrap;
369 return 0; 379 return 0;
370 } 380 }
371 381
372 rcpts = createRcptList( fields ); 382 rcpts = createRcptList( fields );
373 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 383 ffrom = getField(fields, MAILIMF_FIELD_FROM );
374 from = getFrom(ffrom); 384 from = getFrom(ffrom);
375 385
376 if (rcpts && from) { 386 if (rcpts && from) {
377 res = smtpSend(from,rcpts,data->Content(),data->Length()); 387 res = smtpSend(from,rcpts,data->Content(),data->Length());
378 } 388 }
379 if (fields) { 389 if (fields) {
380 mailimf_fields_free(fields); 390 mailimf_fields_free(fields);
381 fields = 0; 391 fields = 0;
382 } 392 }
383 if (data) { 393 if (data) {
384 delete data; 394 delete data;
385 } 395 }
386 if (from) { 396 if (from) {
387 free(from); 397 free(from);
388 } 398 }
389 if (rcpts) { 399 if (rcpts) {
390 smtp_address_list_free( rcpts ); 400 smtp_address_list_free( rcpts );
391 } 401 }
392 return res; 402 return res;
393} 403}
394 404
395/* this is a special fun */ 405/* this is a special fun */
396bool SMTPwrapper::flushOutbox() { 406bool SMTPwrapper::flushOutbox() {
397 bool returnValue = true; 407 bool returnValue = true;
398 408
399 ; // odebug << "Sending the queue" << oendl; 409 ; // odebug << "Sending the queue" << oendl;
400 if (!m_SmtpAccount) { 410 if (!m_SmtpAccount) {
401 ; // odebug << "No smtp account given" << oendl; 411 ; // odebug << "No smtp account given" << oendl;
402 return false; 412 return false;
403 } 413 }
404 414
405 bool reset_user_value = false; 415 bool reset_user_value = false;
406 QString localfolders = AbstractMail::defaultLocalfolder(); 416 QString localfolders = AbstractMail::defaultLocalfolder();
407 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 417 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
408 if (!wrap) { 418 if (!wrap) {
409 ; // odebug << "memory error" << oendl; 419 ; // odebug << "memory error" << oendl;
410 return false; 420 return false;
411 } 421 }
412 QString oldPw, oldUser; 422 QString oldPw, oldUser;
413 QValueList<RecMailP> mailsToSend; 423 QValueList<RecMailP> mailsToSend;
414 QValueList<RecMailP> mailsToRemove; 424 QValueList<RecMailP> mailsToRemove;
415 QString mbox("Outgoing"); 425 QString mbox("Outgoing");
416 wrap->listMessages(mbox,mailsToSend); 426 wrap->listMessages(mbox,mailsToSend);
417 if (mailsToSend.count()==0) { 427 if (mailsToSend.count()==0) {
418 delete wrap; 428 delete wrap;
419 ; // odebug << "No mails to send" << oendl; 429 ; // odebug << "No mails to send" << oendl;
420 return false; 430 return false;
421 } 431 }
422 432
423 oldPw = m_SmtpAccount->getPassword(); 433 oldPw = m_SmtpAccount->getPassword();
424 oldUser = m_SmtpAccount->getUser(); 434 oldUser = m_SmtpAccount->getUser();
425 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 435 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
426 // get'em 436 // get'em
427 QString user,pass; 437 QString user,pass;
428 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 438 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
429 login.show(); 439 login.show();
430 if ( QDialog::Accepted == login.exec() ) { 440 if ( QDialog::Accepted == login.exec() ) {
431 // ok 441 // ok
432 user = login.getUser().latin1(); 442 user = login.getUser().latin1();
433 pass = login.getPassword().latin1(); 443 pass = login.getPassword().latin1();
434 reset_user_value = true; 444 reset_user_value = true;
435 m_SmtpAccount->setUser(user); 445 m_SmtpAccount->setUser(user);
436 m_SmtpAccount->setPassword(pass); 446 m_SmtpAccount->setPassword(pass);
437 } else { 447 } else {
438 return true; 448 return true;
439 } 449 }
440 } 450 }
441 451
442 452
443 sendProgress = new progressMailSend(); 453 sendProgress = new progressMailSend();
444 sendProgress->show(); 454 sendProgress->show();
445 sendProgress->setMaxMails(mailsToSend.count()); 455 sendProgress->setMaxMails(mailsToSend.count());
446 456
447 while (returnValue && mailsToSend.count()>0) { 457 while (returnValue && mailsToSend.count()>0) {
448 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 458 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
449 QMessageBox::critical(0,i18n("Error sending mail"), 459 QMessageBox::critical(0,i18n("Error sending mail"),
450 i18n("Error sending queued mail.\nBreaking.")); 460 i18n("Error sending queued mail.\nBreaking."));
451 returnValue = false; 461 returnValue = false;
452 } 462 }
453 mailsToRemove.append((*mailsToSend.begin())); 463 mailsToRemove.append((*mailsToSend.begin()));
454 mailsToSend.remove(mailsToSend.begin()); 464 mailsToSend.remove(mailsToSend.begin());
455 sendProgress->setCurrentMails(mailsToRemove.count()); 465 sendProgress->setCurrentMails(mailsToRemove.count());
456 } 466 }
457 if (reset_user_value) { 467 if (reset_user_value) {
458 m_SmtpAccount->setUser(oldUser); 468 m_SmtpAccount->setUser(oldUser);
459 m_SmtpAccount->setPassword(oldPw); 469 m_SmtpAccount->setPassword(oldPw);
460 } 470 }
471
461 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 472 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
462 cfg.setGroup( "Status" ); 473 cfg.setGroup( "Status" );
463 m_queuedMail = mailsToSend.count(); 474 m_queuedMail = mailsToSend.count();
464 cfg.writeEntry( "outgoing", m_queuedMail ); 475 cfg.writeEntry( "outgoing", m_queuedMail );
465 emit queuedMails( m_queuedMail ); 476 emit queuedMails( m_queuedMail );
466 sendProgress->hide(); 477 sendProgress->hide();
467 delete sendProgress; 478 delete sendProgress;
468 sendProgress = 0; 479 sendProgress = 0;
469 wrap->deleteMails(mbox,mailsToRemove); 480 wrap->deleteMails(mbox,mailsToRemove);
470 delete wrap; 481 delete wrap;
482 if ( m_smtp ) {
483 mailsmtp_free(m_smtp);
484 m_smtp = 0;
485 }
471 return returnValue; 486 return returnValue;
472} 487}
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 710a9f9..f235705 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -172,198 +172,200 @@ bool ListItemVisitor::visit(Todo *t)
172 mItem->setText(10,t->categoriesStr()); 172 mItem->setText(10,t->categoriesStr());
173 173
174 QString key; 174 QString key;
175 QDate d; 175 QDate d;
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 177 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 180 mItem->setSortKey(7,key);
181 } 181 }
182 if ( t->hasStartDate() ) { 182 if ( t->hasStartDate() ) {
183 d = t->dtStart().date(); 183 d = t->dtStart().date();
184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
186 mItem->setSortKey(1,key); 186 mItem->setSortKey(1,key);
187 } 187 }
188 return true; 188 return true;
189} 189}
190 190
191bool ListItemVisitor::visit(Journal * j) 191bool ListItemVisitor::visit(Journal * j)
192{ 192{
193 QString des = j->description().left(30); 193 QString des = j->description().left(30);
194 des = des.simplifyWhiteSpace (); 194 des = des.simplifyWhiteSpace ();
195 des.replace (QRegExp ("\\n"),"" ); 195 des.replace (QRegExp ("\\n"),"" );
196 des.replace (QRegExp ("\\r"),"" ); 196 des.replace (QRegExp ("\\r"),"" );
197 mItem->setText(0,i18n("Journal: ")+des.left(25)); 197 mItem->setText(0,i18n("Journal: ")+des.left(25));
198 mItem->setText(1,j->dtStartDateStr()); 198 mItem->setText(1,j->dtStartDateStr());
199 mItem->setText(2,"---"); 199 mItem->setText(2,"---");
200 mItem->setText(3,"---"); 200 mItem->setText(3,"---");
201 mItem->setText(4,"---"); 201 mItem->setText(4,"---");
202 mItem->setText(5,"---"); 202 mItem->setText(5,"---");
203 mItem->setText(6,"---"); 203 mItem->setText(6,"---");
204 mItem->setText(7,j->dtStartDateStr()); 204 mItem->setText(7,j->dtStartDateStr());
205 mItem->setText(8,"---"); 205 mItem->setText(8,"---");
206 mItem->setText(9,"---"); 206 mItem->setText(9,"---");
207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
208 208
209 QString key; 209 QString key;
210 QDate d = j->dtStart().date(); 210 QDate d = j->dtStart().date();
211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
212 mItem->setSortKey(1,key); 212 mItem->setSortKey(1,key);
213 mItem->setSortKey(7,key); 213 mItem->setSortKey(7,key);
214 214
215 return true; 215 return true;
216} 216}
217 217
218KOListView::KOListView(Calendar *calendar, QWidget *parent, 218KOListView::KOListView(Calendar *calendar, QWidget *parent,
219 const char *name) 219 const char *name)
220 : KOEventView(calendar, parent, name) 220 : KOEventView(calendar, parent, name)
221{ 221{
222 mActiveItem = 0; 222 mActiveItem = 0;
223 mListView = new KOListViewListView(this); 223 mListView = new KOListViewListView(this);
224 mListView->addColumn(i18n("Summary")); 224 mListView->addColumn(i18n("Summary"));
225 mListView->addColumn(i18n("Start Date")); 225 mListView->addColumn(i18n("Start Date"));
226 mListView->addColumn(i18n("Start Time")); 226 mListView->addColumn(i18n("Start Time"));
227 mListView->addColumn(i18n("End Date")); 227 mListView->addColumn(i18n("End Date"));
228 mListView->addColumn(i18n("End Time")); 228 mListView->addColumn(i18n("End Time"));
229 mListView->addColumn(i18n("Alarm")); // alarm set? 229 mListView->addColumn(i18n("Alarm")); // alarm set?
230 mListView->addColumn(i18n("Recurs")); // recurs? 230 mListView->addColumn(i18n("Recurs")); // recurs?
231 mListView->addColumn(i18n("Due Date")); 231 mListView->addColumn(i18n("Due Date"));
232 mListView->addColumn(i18n("Due Time")); 232 mListView->addColumn(i18n("Due Time"));
233 mListView->addColumn(i18n("Cancelled")); 233 mListView->addColumn(i18n("Cancelled"));
234 mListView->addColumn(i18n("Categories")); 234 mListView->addColumn(i18n("Categories"));
235 235
236 mListView->setColumnAlignment(0,AlignLeft); 236 mListView->setColumnAlignment(0,AlignLeft);
237 mListView->setColumnAlignment(1,AlignLeft); 237 mListView->setColumnAlignment(1,AlignLeft);
238 mListView->setColumnAlignment(2,AlignHCenter); 238 mListView->setColumnAlignment(2,AlignHCenter);
239 mListView->setColumnAlignment(3,AlignLeft); 239 mListView->setColumnAlignment(3,AlignLeft);
240 mListView->setColumnAlignment(4,AlignHCenter); 240 mListView->setColumnAlignment(4,AlignHCenter);
241 mListView->setColumnAlignment(5,AlignLeft); 241 mListView->setColumnAlignment(5,AlignLeft);
242 mListView->setColumnAlignment(6,AlignLeft); 242 mListView->setColumnAlignment(6,AlignLeft);
243 mListView->setColumnAlignment(7,AlignLeft); 243 mListView->setColumnAlignment(7,AlignLeft);
244 mListView->setColumnAlignment(8,AlignLeft); 244 mListView->setColumnAlignment(8,AlignLeft);
245 mListView->setColumnAlignment(9,AlignLeft); 245 mListView->setColumnAlignment(9,AlignLeft);
246 mListView->setColumnAlignment(10,AlignLeft); 246 mListView->setColumnAlignment(10,AlignLeft);
247 mListView->setColumnWidthMode(10, QListView::Manual); 247 mListView->setColumnWidthMode(10, QListView::Manual);
248 new KOListViewWhatsThis(mListView->viewport(),this); 248 new KOListViewWhatsThis(mListView->viewport(),this);
249 249
250 int iii = 0; 250 int iii = 0;
251 for ( iii = 0; iii< 10 ; ++iii ) 251 for ( iii = 0; iii< 10 ; ++iii )
252 mListView->setColumnWidthMode( iii, QListView::Manual ); 252 mListView->setColumnWidthMode( iii, QListView::Manual );
253 253
254 QBoxLayout *layoutTop = new QVBoxLayout(this); 254 QBoxLayout *layoutTop = new QVBoxLayout(this);
255 layoutTop->addWidget(mListView); 255 layoutTop->addWidget(mListView);
256 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 256 mListView->setFont ( KOPrefs::instance()->mListViewFont );
257 mPopupMenu = eventPopup(); 257 mPopupMenu = eventPopup();
258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
259 i18n("Select all"),this, 259 i18n("Select all"),this,
260 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
262 i18n("Deselect all"),this, 262 i18n("Deselect all"),this,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
265 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
266 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 QPopupMenu * exportPO = new QPopupMenu ( this );
269 i18n("Save selected to file..."),this, 269 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
270 SLOT(saveToFile()),true); 270 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 SLOT(saveToFile()));
272 i18n("Save Journal/Description..."),this, 272 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
273 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveToFileVCS()));
274 exportPO->insertItem( i18n("Journal/Details..."),this,
275 SLOT(saveDescriptionToFile()));
274 // mPopupMenu->insertSeparator(); 276 // mPopupMenu->insertSeparator();
275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
276 i18n("Add Categ. to selected..."),this, 278 i18n("Add Categ. to selected..."),this,
277 SLOT(addCat()),true); 279 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 281 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 282 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 283 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 284 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this, 285 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true); 286 SLOT(setAlarm()),true);
285 287
286 288
287#ifndef DESKTOP_VERSION 289#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator(); 290 mPopupMenu->insertSeparator();
289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 291 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
290 i18n("Beam selected via IR"),this, 292 i18n("Beam selected via IR"),this,
291 SLOT(beamSelected()),true); 293 SLOT(beamSelected()),true);
292#endif 294#endif
293 /* 295 /*
294 mPopupMenu = new QPopupMenu; 296 mPopupMenu = new QPopupMenu;
295 mPopupMenu->insertItem(i18n("Edit Event"), this, 297 mPopupMenu->insertItem(i18n("Edit Event"), this,
296 SLOT (editEvent())); 298 SLOT (editEvent()));
297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 299 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
298 SLOT (deleteEvent())); 300 SLOT (deleteEvent()));
299 mPopupMenu->insertSeparator(); 301 mPopupMenu->insertSeparator();
300 mPopupMenu->insertItem(i18n("Show Dates"), this, 302 mPopupMenu->insertItem(i18n("Show Dates"), this,
301 SLOT(showDates())); 303 SLOT(showDates()));
302 mPopupMenu->insertItem(i18n("Hide Dates"), this, 304 mPopupMenu->insertItem(i18n("Hide Dates"), this,
303 SLOT(hideDates())); 305 SLOT(hideDates()));
304 */ 306 */
305 QObject::connect(mListView,SIGNAL( newEvent()), 307 QObject::connect(mListView,SIGNAL( newEvent()),
306 this,SIGNAL(signalNewEvent())); 308 this,SIGNAL(signalNewEvent()));
307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 309 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
308 this,SLOT(defaultItemAction(QListViewItem *))); 310 this,SLOT(defaultItemAction(QListViewItem *)));
309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 311 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
310 const QPoint &, int )), 312 const QPoint &, int )),
311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 313 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 314 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
313 SLOT(processSelectionChange(QListViewItem *))); 315 SLOT(processSelectionChange(QListViewItem *)));
314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 316 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
315 SIGNAL(showIncidenceSignal(Incidence *)) ); 317 SIGNAL(showIncidenceSignal(Incidence *)) );
316 318
317 readSettings(KOGlobals::config(),"KOListView Layout"); 319 readSettings(KOGlobals::config(),"KOListView Layout");
318} 320}
319 321
320KOListView::~KOListView() 322KOListView::~KOListView()
321{ 323{
322 delete mPopupMenu; 324 delete mPopupMenu;
323} 325}
324QString KOListView::getWhatsThisText(QPoint p) 326QString KOListView::getWhatsThisText(QPoint p)
325{ 327{
326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 328 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
327 if ( item ) 329 if ( item )
328 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 330 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
329 KOPrefs::instance()->mWTshowDetails, 331 KOPrefs::instance()->mWTshowDetails,
330 KOPrefs::instance()->mWTshowCreated, 332 KOPrefs::instance()->mWTshowCreated,
331 KOPrefs::instance()->mWTshowChanged); 333 KOPrefs::instance()->mWTshowChanged);
332 return i18n("That is the list view" ); 334 return i18n("That is the list view" );
333 335
334} 336}
335 337
336void KOListView::updateList() 338void KOListView::updateList()
337{ 339{
338 // qDebug(" KOListView::updateList() "); 340 // qDebug(" KOListView::updateList() ");
339 341
340} 342}
341 343
342void KOListView::addCat( ) 344void KOListView::addCat( )
343{ 345{
344 setCategories( false ); 346 setCategories( false );
345} 347}
346void KOListView::setCat() 348void KOListView::setCat()
347{ 349{
348 setCategories( true ); 350 setCategories( true );
349} 351}
350void KOListView::setAlarm() 352void KOListView::setAlarm()
351{ 353{
352 KOAlarmPrefs kap( this); 354 KOAlarmPrefs kap( this);
353 if ( !kap.exec() ) 355 if ( !kap.exec() )
354 return; 356 return;
355 357
356 358
357 QStringList itemList; 359 QStringList itemList;
358 QPtrList<KOListViewItem> sel ; 360 QPtrList<KOListViewItem> sel ;
359 QListViewItem *qitem = mListView->firstChild (); 361 QListViewItem *qitem = mListView->firstChild ();
360 while ( qitem ) { 362 while ( qitem ) {
361 if ( qitem->isSelected() ) { 363 if ( qitem->isSelected() ) {
362 Incidence* inc = ((KOListViewItem *) qitem)->data(); 364 Incidence* inc = ((KOListViewItem *) qitem)->data();
363 if ( inc->type() != "Journal" ) { 365 if ( inc->type() != "Journal" ) {
364 if ( inc->type() == "Todo" ) { 366 if ( inc->type() == "Todo" ) {
365 if ( ((Todo*)inc)->hasDueDate() ) 367 if ( ((Todo*)inc)->hasDueDate() )
366 sel.append(((KOListViewItem *)qitem)); 368 sel.append(((KOListViewItem *)qitem));
367 } else 369 } else
368 sel.append(((KOListViewItem *)qitem)); 370 sel.append(((KOListViewItem *)qitem));
369 } 371 }
@@ -513,235 +515,258 @@ void KOListView::beamSelected()
513 } 515 }
514} 516}
515void KOListView::beamDone( Ir *ir ) 517void KOListView::beamDone( Ir *ir )
516{ 518{
517#ifndef DESKTOP_VERSION 519#ifndef DESKTOP_VERSION
518 delete ir; 520 delete ir;
519#endif 521#endif
520 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 522 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
521} 523}
522 524
523void KOListView::saveDescriptionToFile() 525void KOListView::saveDescriptionToFile()
524{ 526{
525 527
526 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 528 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
527 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 529 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
528 i18n("Continue"), i18n("Cancel"), 0, 530 i18n("Continue"), i18n("Cancel"), 0,
529 0, 1 ); 531 0, 1 );
530 if ( result != 0 ) { 532 if ( result != 0 ) {
531 return; 533 return;
532 } 534 }
533 int icount = 0; 535 int icount = 0;
534 QPtrList<Incidence> delSel ; 536 QPtrList<Incidence> delSel ;
535 QListViewItem *item = mListView->firstChild (); 537 QListViewItem *item = mListView->firstChild ();
536 while ( item ) { 538 while ( item ) {
537 if ( item->isSelected() ) { 539 if ( item->isSelected() ) {
538 delSel.append(((KOListViewItem *)item)->data()); 540 delSel.append(((KOListViewItem *)item)->data());
539 ++icount; 541 ++icount;
540 } 542 }
541 543
542 item = item->nextSibling(); 544 item = item->nextSibling();
543 } 545 }
544 if ( icount ) { 546 if ( icount ) {
545 QString fn = KOPrefs::instance()->mLastSaveFile; 547 QString fn = KOPrefs::instance()->mLastSaveFile;
546 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 548 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
547 549
548 if ( fn == "" ) 550 if ( fn == "" )
549 return; 551 return;
550 QFileInfo info; 552 QFileInfo info;
551 info.setFile( fn ); 553 info.setFile( fn );
552 QString mes; 554 QString mes;
553 bool createbup = true; 555 bool createbup = true;
554 if ( info. exists() ) { 556 if ( info. exists() ) {
555 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 557 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
556 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 558 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
557 i18n("Overwrite!"), i18n("Cancel"), 0, 559 i18n("Overwrite!"), i18n("Cancel"), 0,
558 0, 1 ); 560 0, 1 );
559 if ( result != 0 ) { 561 if ( result != 0 ) {
560 createbup = false; 562 createbup = false;
561 } 563 }
562 } 564 }
563 if ( createbup ) { 565 if ( createbup ) {
564 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 566 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
565 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 567 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
566 Incidence *incidence = delSel.first(); 568 Incidence *incidence = delSel.first();
567 icount = 0; 569 icount = 0;
568 while ( incidence ) { 570 while ( incidence ) {
569 if ( incidence->type() == "Journal" ) { 571 if ( incidence->type() == "Journal" ) {
570 text += "\n************************************\n"; 572 text += "\n************************************\n";
571 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 573 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
572 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 574 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
573 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 575 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
574 ++icount; 576 ++icount;
575 577
576 } else { 578 } else {
577 if ( !incidence->description().isEmpty() ) { 579 if ( !incidence->description().isEmpty() ) {
578 text += "\n************************************\n"; 580 text += "\n************************************\n";
579 if ( incidence->type() == "Todo" ) 581 if ( incidence->type() == "Todo" )
580 text += i18n("To-Do: "); 582 text += i18n("To-Do: ");
581 text += incidence->summary(); 583 text += incidence->summary();
582 if ( incidence->hasStartDate() ) 584 if ( incidence->hasStartDate() )
583 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 585 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
584 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 586 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
585 if ( !incidence->location().isEmpty() ) 587 if ( !incidence->location().isEmpty() )
586 text += "\n" +i18n("Location: ") + incidence->location(); 588 text += "\n" +i18n("Location: ") + incidence->location();
587 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 589 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
588 ++icount; 590 ++icount;
589 591
590 } 592 }
591 } 593 }
592 incidence = delSel.next(); 594 incidence = delSel.next();
593 } 595 }
594 QFile file( fn ); 596 QFile file( fn );
595 if (!file.open( IO_WriteOnly ) ) { 597 if (!file.open( IO_WriteOnly ) ) {
596 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 598 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
597 return; 599 return;
598 } 600 }
599 QTextStream ts( &file ); 601 QTextStream ts( &file );
600 ts << text; 602 ts << text;
601 file.close(); 603 file.close();
602 //qDebug("%s ", text.latin1()); 604 //qDebug("%s ", text.latin1());
603 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 605 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
604 KOPrefs::instance()->mLastSaveFile = fn; 606 KOPrefs::instance()->mLastSaveFile = fn;
605 topLevelWidget()->setCaption(mes); 607 topLevelWidget()->setCaption(mes);
606 } 608 }
607 } 609 }
608} 610}
611void KOListView::saveToFileVCS()
612{
613 writeToFile( false );
614}
609void KOListView::saveToFile() 615void KOListView::saveToFile()
610{ 616{
617 writeToFile( true );
618}
619void KOListView::writeToFile( bool iCal )
620{
611 621
612 int icount = 0; 622 int icount = 0;
613 QPtrList<Incidence> delSel ; 623 QPtrList<Incidence> delSel ;
614 QListViewItem *item = mListView->firstChild (); 624 QListViewItem *item = mListView->firstChild ();
615 while ( item ) { 625 while ( item ) {
616 if ( item->isSelected() ) { 626 if ( item->isSelected() ) {
617 delSel.append(((KOListViewItem *)item)->data()); 627 delSel.append(((KOListViewItem *)item)->data());
618 ++icount; 628 ++icount;
619 } 629 }
620 630
621 item = item->nextSibling(); 631 item = item->nextSibling();
622 } 632 }
623 if ( icount ) { 633 if ( icount ) {
624 QString fn = KOPrefs::instance()->mLastSaveFile; 634 QString fn = KOPrefs::instance()->mLastSaveFile;
635 QString extension;
636 if ( iCal ) {
637 if ( fn.right( 4 ).lower() == ".vcs" ) {
638 fn = fn.left( fn.length() -3) + "ics";
639 }
640 } else {
641 if ( fn.right( 4 ).lower() == ".ics" ) {
642 fn = fn.left( fn.length() -3) + "vcs";
643 }
644 }
625 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 645 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
626 646
627 if ( fn == "" ) 647 if ( fn == "" )
628 return; 648 return;
629 QFileInfo info; 649 QFileInfo info;
630 info.setFile( fn ); 650 info.setFile( fn );
631 QString mes; 651 QString mes;
632 bool createbup = true; 652 bool createbup = true;
633 if ( info. exists() ) { 653 if ( info. exists() ) {
634 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 654 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
635 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 655 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
636 i18n("Overwrite!"), i18n("Cancel"), 0, 656 i18n("Overwrite!"), i18n("Cancel"), 0,
637 0, 1 ); 657 0, 1 );
638 if ( result != 0 ) { 658 if ( result != 0 ) {
639 createbup = false; 659 createbup = false;
640 } 660 }
641 } 661 }
642 if ( createbup ) { 662 if ( createbup ) {
643 CalendarLocal cal; 663 CalendarLocal cal;
644 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 664 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
645 Incidence *incidence = delSel.first(); 665 Incidence *incidence = delSel.first();
646 while ( incidence ) { 666 while ( incidence ) {
647 cal.addIncidence( incidence->clone() ); 667 cal.addIncidence( incidence->clone() );
648 incidence = delSel.next(); 668 incidence = delSel.next();
649 } 669 }
650 ICalFormat format; 670 if ( iCal ) {
651 format.save( &cal, fn ); 671 ICalFormat format;
672 format.save( &cal, fn );
673 } else {
674 VCalFormat format;
675 format.save( &cal, fn );
676 }
652 mes = i18n("KO/Pi:Saved %1").arg(fn ); 677 mes = i18n("KO/Pi:Saved %1").arg(fn );
653 KOPrefs::instance()->mLastSaveFile = fn; 678 KOPrefs::instance()->mLastSaveFile = fn;
654 topLevelWidget()->setCaption(mes); 679 topLevelWidget()->setCaption(mes);
655 } 680 }
656 } 681 }
657} 682}
658void KOListView::deleteAll() 683void KOListView::deleteAll()
659{ 684{
660 int icount = 0; 685 int icount = 0;
661 QPtrList<Incidence> delSel ; 686 QPtrList<Incidence> delSel ;
662 QListViewItem *item = mListView->firstChild (); 687 QListViewItem *item = mListView->firstChild ();
663 while ( item ) { 688 while ( item ) {
664 if ( item->isSelected() ) { 689 if ( item->isSelected() ) {
665 delSel.append(((KOListViewItem *)item)->data()); 690 delSel.append(((KOListViewItem *)item)->data());
666 ++icount; 691 ++icount;
667 } 692 }
668 693
669 item = item->nextSibling(); 694 item = item->nextSibling();
670 } 695 }
671 if ( icount ) { 696 if ( icount ) {
672 Incidence *incidence = delSel.first(); 697 Incidence *incidence = delSel.first();
673 Incidence *toDelete; 698 Incidence *toDelete;
674 KOPrefs *p = KOPrefs::instance(); 699 KOPrefs *p = KOPrefs::instance();
675 bool confirm = p->mConfirm; 700 bool confirm = p->mConfirm;
676 QString mess; 701 QString mess;
677 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 702 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
678 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 703 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
679 p->mConfirm = false; 704 p->mConfirm = false;
680 int delCounter = 0; 705 int delCounter = 0;
681 QDialog dia ( this, "p-dialog", true ); 706 QDialog dia ( this, "p-dialog", true );
682 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 707 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
683 QVBoxLayout lay( &dia ); 708 QVBoxLayout lay( &dia );
684 lay.setMargin(7); 709 lay.setMargin(7);
685 lay.setSpacing(7); 710 lay.setSpacing(7);
686 lay.addWidget( &lab); 711 lay.addWidget( &lab);
687 QProgressBar bar( icount, &dia ); 712 QProgressBar bar( icount, &dia );
688 lay.addWidget( &bar); 713 lay.addWidget( &bar);
689 int w = 220; 714 int w = 220;
690 int h = 50; 715 int h = 50;
691 int dw = QApplication::desktop()->width(); 716 int dw = QApplication::desktop()->width();
692 int dh = QApplication::desktop()->height(); 717 int dh = QApplication::desktop()->height();
693 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 718 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
694 //dia.resize( 240,50 ); 719 //dia.resize( 240,50 );
695 dia.show(); 720 dia.show();
696 721
697 while ( incidence ) { 722 while ( incidence ) {
698 bar.setProgress( delCounter ); 723 bar.setProgress( delCounter );
699 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 724 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
700 dia.setCaption( mess ); 725 dia.setCaption( mess );
701 qApp->processEvents(); 726 qApp->processEvents();
702 toDelete = (incidence); 727 toDelete = (incidence);
703 incidence = delSel.next(); 728 incidence = delSel.next();
704 emit deleteIncidenceSignal(toDelete ); 729 emit deleteIncidenceSignal(toDelete );
705 if ( dia.result() != 0 ) 730 if ( dia.result() != 0 )
706 break; 731 break;
707 732
708 } 733 }
709 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 734 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
710 topLevelWidget ()->setCaption( mess ); 735 topLevelWidget ()->setCaption( mess );
711 p->mConfirm = confirm; 736 p->mConfirm = confirm;
712 } 737 }
713 } 738 }
714 739
715 740
716} 741}
717int KOListView::maxDatesHint() 742int KOListView::maxDatesHint()
718{ 743{
719 return 0; 744 return 0;
720} 745}
721 746
722int KOListView::currentDateCount() 747int KOListView::currentDateCount()
723{ 748{
724 return 0; 749 return 0;
725} 750}
726 751
727QPtrList<Incidence> KOListView::selectedIncidences() 752QPtrList<Incidence> KOListView::selectedIncidences()
728{ 753{
729 QPtrList<Incidence> eventList; 754 QPtrList<Incidence> eventList;
730 QListViewItem *item = mListView->firstChild (); 755 QListViewItem *item = mListView->firstChild ();
731 while ( item ) { 756 while ( item ) {
732 if ( item->isSelected() ) { 757 if ( item->isSelected() ) {
733 eventList.append(((KOListViewItem *)item)->data()); 758 eventList.append(((KOListViewItem *)item)->data());
734 } 759 }
735 760
736 item = item->nextSibling(); 761 item = item->nextSibling();
737 } 762 }
738 763
739 // // QListViewItem *item = mListView->selectedItem(); 764 // // QListViewItem *item = mListView->selectedItem();
740 //if (item) eventList.append(((KOListViewItem *)item)->data()); 765 //if (item) eventList.append(((KOListViewItem *)item)->data());
741 766
742 return eventList; 767 return eventList;
743} 768}
744 769
745DateList KOListView::selectedDates() 770DateList KOListView::selectedDates()
746{ 771{
747 DateList eventList; 772 DateList eventList;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index c86449d..0d9c525 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -179,126 +179,128 @@ void pickAlarmProgram()
179typedef CustomListViewItem<Incidence *> KOListViewItem; 179typedef CustomListViewItem<Incidence *> KOListViewItem;
180 180
181/** 181/**
182 This class provides the initialisation of a KOListViewItem for calendar 182 This class provides the initialisation of a KOListViewItem for calendar
183 components using the Incidence::Visitor. 183 components using the Incidence::Visitor.
184*/ 184*/
185class ListItemVisitor : public Incidence::Visitor 185class ListItemVisitor : public Incidence::Visitor
186{ 186{
187 public: 187 public:
188 ListItemVisitor(KOListViewItem *, QDate d); 188 ListItemVisitor(KOListViewItem *, QDate d);
189 ~ListItemVisitor(); 189 ~ListItemVisitor();
190 190
191 bool visit(Event *); 191 bool visit(Event *);
192 bool visit(Todo *); 192 bool visit(Todo *);
193 bool visit(Journal *); 193 bool visit(Journal *);
194 194
195 private: 195 private:
196 KOListViewItem *mItem; 196 KOListViewItem *mItem;
197 QDate mDate; 197 QDate mDate;
198}; 198};
199 199
200/** 200/**
201 This class provides a multi-column list view of events. It can 201 This class provides a multi-column list view of events. It can
202 display events from one particular day or several days, it doesn't 202 display events from one particular day or several days, it doesn't
203 matter. To use a view that only handles one day at a time, use 203 matter. To use a view that only handles one day at a time, use
204 KODayListView. 204 KODayListView.
205 205
206 @short multi-column list view of various events. 206 @short multi-column list view of various events.
207 @author Preston Brown <pbrown@kde.org> 207 @author Preston Brown <pbrown@kde.org>
208 @see KOBaseView, KODayListView 208 @see KOBaseView, KODayListView
209*/ 209*/
210class KOListView; 210class KOListView;
211 211
212class KOListViewListView : public KListView 212class KOListViewListView : public KListView
213{ 213{
214 Q_OBJECT 214 Q_OBJECT
215 public: 215 public:
216 KOListViewListView(KOListView * lv ); 216 KOListViewListView(KOListView * lv );
217 signals: 217 signals:
218 void newEvent(); 218 void newEvent();
219 void showIncidence( Incidence* ); 219 void showIncidence( Incidence* );
220 private: 220 private:
221 void keyPressEvent ( QKeyEvent * ) ; 221 void keyPressEvent ( QKeyEvent * ) ;
222 void contentsMouseDoubleClickEvent(QMouseEvent *e); 222 void contentsMouseDoubleClickEvent(QMouseEvent *e);
223 void contentsMousePressEvent(QMouseEvent *e); 223 void contentsMousePressEvent(QMouseEvent *e);
224 void contentsMouseReleaseEvent(QMouseEvent *e); 224 void contentsMouseReleaseEvent(QMouseEvent *e);
225 void contentsMouseMoveEvent(QMouseEvent *e); 225 void contentsMouseMoveEvent(QMouseEvent *e);
226 bool mAllowPopupMenu; 226 bool mAllowPopupMenu;
227 bool mMouseDown; 227 bool mMouseDown;
228 int mYMousePos; 228 int mYMousePos;
229}; 229};
230 230
231class KOListView : public KOEventView 231class KOListView : public KOEventView
232{ 232{
233 Q_OBJECT 233 Q_OBJECT
234 public: 234 public:
235 KOListView(Calendar *calendar, QWidget *parent = 0, 235 KOListView(Calendar *calendar, QWidget *parent = 0,
236 const char *name = 0); 236 const char *name = 0);
237 ~KOListView(); 237 ~KOListView();
238 238
239 virtual int maxDatesHint(); 239 virtual int maxDatesHint();
240 virtual int currentDateCount(); 240 virtual int currentDateCount();
241 virtual QPtrList<Incidence> selectedIncidences(); 241 virtual QPtrList<Incidence> selectedIncidences();
242 virtual DateList selectedDates(); 242 virtual DateList selectedDates();
243 243
244 void showDates(bool show); 244 void showDates(bool show);
245 Incidence* currentItem(); 245 Incidence* currentItem();
246 void addTodos(QPtrList<Todo> eventList); 246 void addTodos(QPtrList<Todo> eventList);
247 void addJournals(QPtrList<Journal> eventList); 247 void addJournals(QPtrList<Journal> eventList);
248 virtual void printPreview(CalPrinter *calPrinter, 248 virtual void printPreview(CalPrinter *calPrinter,
249 const QDate &, const QDate &); 249 const QDate &, const QDate &);
250 250
251 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 251 void readSettings(KConfig *config, QString setting = "KOListView Layout");
252 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 252 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
253 void updateList(); 253 void updateList();
254 void setStartDate(const QDate &start); 254 void setStartDate(const QDate &start);
255 int count(); 255 int count();
256 QString getWhatsThisText(QPoint p); 256 QString getWhatsThisText(QPoint p);
257 void resetFocus(); 257 void resetFocus();
258 signals: 258 signals:
259 void signalNewEvent(); 259 void signalNewEvent();
260 void beamIncidenceList(QPtrList<Incidence>); 260 void beamIncidenceList(QPtrList<Incidence>);
261 261
262 public slots: 262 public slots:
263 virtual void updateView(); 263 virtual void updateView();
264 virtual void showDates(const QDate &start, const QDate &end); 264 virtual void showDates(const QDate &start, const QDate &end);
265 virtual void showEvents(QPtrList<Event> eventList); 265 virtual void showEvents(QPtrList<Event> eventList);
266 void clearSelection(); 266 void clearSelection();
267 void allSelection(); 267 void allSelection();
268 268
269 void clear(); 269 void clear();
270 void beamDone( Ir *ir ); 270 void beamDone( Ir *ir );
271 void showDates(); 271 void showDates();
272 void hideDates(); 272 void hideDates();
273 void deleteAll(); 273 void deleteAll();
274 void saveToFile(); 274 void saveToFile();
275 void saveToFileVCS();
275 void saveDescriptionToFile(); 276 void saveDescriptionToFile();
276 void beamSelected(); 277 void beamSelected();
277 void updateConfig(); 278 void updateConfig();
278 void addCat(); 279 void addCat();
279 void setCat(); 280 void setCat();
280 void setAlarm(); 281 void setAlarm();
281 void setCategories( bool removeOld ); 282 void setCategories( bool removeOld );
282 void changeEventDisplay(Event *, int); 283 void changeEventDisplay(Event *, int);
283 284
284 void defaultItemAction(QListViewItem *item); 285 void defaultItemAction(QListViewItem *item);
285 void popupMenu(QListViewItem *item,const QPoint &,int); 286 void popupMenu(QListViewItem *item,const QPoint &,int);
286 287
287 protected slots: 288 protected slots:
288 void processSelectionChange(QListViewItem *); 289 void processSelectionChange(QListViewItem *);
289 290
290 protected: 291 protected:
292 void writeToFile( bool iCal );
291 void addEvents(QPtrList<Event> eventList); 293 void addEvents(QPtrList<Event> eventList);
292 void addIncidence(Incidence *); 294 void addIncidence(Incidence *);
293 KOListViewItem *getItemForEvent(Event *event); 295 KOListViewItem *getItemForEvent(Event *event);
294 296
295 private: 297 private:
296 KOListViewListView *mListView; 298 KOListViewListView *mListView;
297 KOEventPopupMenu *mPopupMenu; 299 KOEventPopupMenu *mPopupMenu;
298 KOListViewItem *mActiveItem; 300 KOListViewItem *mActiveItem;
299 QDict<Incidence> mUidDict; 301 QDict<Incidence> mUidDict;
300 QDate mStartDate; 302 QDate mStartDate;
301 void keyPressEvent ( QKeyEvent * ) ; 303 void keyPressEvent ( QKeyEvent * ) ;
302}; 304};
303 305
304#endif 306#endif