summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -1283,24 +1283,27 @@
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
@@ -334,41 +334,43 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name,
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 );
@@ -415,41 +417,43 @@ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name,
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 );
@@ -507,45 +511,47 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name,
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()
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
@@ -231,40 +231,42 @@ void SMTPwrapper::connect_server()
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() ) {
@@ -277,32 +279,36 @@ void SMTPwrapper::connect_server()
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
@@ -333,33 +339,37 @@ bool 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 );
@@ -445,28 +455,33 @@ bool SMTPwrapper::flushOutbox() {
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
@@ -252,38 +252,40 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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()),
@@ -593,75 +595,98 @@ void KOListView::saveDescriptionToFile()
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 }
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index c86449d..0d9c525 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -259,46 +259,48 @@ class KOListView : public KOEventView
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