From 1166a4797a91cedd5002a3513d5028c5e86016f0 Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 11 Mar 2005 19:26:02 +0000 Subject: better kopi export --- 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 @@ -1296,6 +1296,10 @@ { "Import","Importiere" }, { "Export","Exportiere" }, { "Beam","Beame" }, +{ "Export selected","Exportiere Selektierte" }, +{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, +{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, +{ "Journal/Details...","Journale/Details..." }, { "","" }, { "","" }, { "","" }, @@ -1303,4 +1307,3 @@ { "","" }, { "","" }, { "","" }, - diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 49049f6..2c0f2d8 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp @@ -347,6 +347,7 @@ void IMAPconfig::slotConnectionToggle( int index ) if ( index == 2 ) { portLine->setText( IMAP_SSL_PORT ); + CommandEdit->hide(); } else if ( index == 3 ) { @@ -356,6 +357,7 @@ void IMAPconfig::slotConnectionToggle( int index ) else { portLine->setText( IMAP_PORT ); + CommandEdit->hide(); } } @@ -428,6 +430,7 @@ void POP3config::slotConnectionToggle( int index ) if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); + CommandEdit->hide(); } else if ( index == 3 ) { @@ -437,6 +440,7 @@ void POP3config::slotConnectionToggle( int index ) else { portLine->setText( POP3_PORT ); + CommandEdit->hide(); } } @@ -520,12 +524,13 @@ void SMTPconfig::chooseSig() } void SMTPconfig::slotConnectionToggle( int index ) { - // 2 is ssl connection - if ( index == 2 ) + // 3 is ssl connection + if ( index == 3 ) { portLine->setText( SMTP_SSL_PORT ); + CommandEdit->hide(); } - else if ( index == 3 ) + else if ( index == 4 ) { portLine->setText( SMTP_PORT ); CommandEdit->show(); @@ -533,6 +538,7 @@ void SMTPconfig::slotConnectionToggle( int index ) else { portLine->setText( SMTP_PORT ); + CommandEdit->hide(); } } 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 @@ -244,7 +244,7 @@ void SMTPwrapper::connect_server() failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); } } - if (try_tls) { + if (result && try_tls) { qDebug("Smpt: Try tls "); err = start_smtp_tls(); if (err != MAILSMTP_NO_ERROR) { @@ -252,6 +252,8 @@ void SMTPwrapper::connect_server() qDebug("no tls "); } else { err = mailesmtp_ehlo(m_smtp); + if ( err != MAILSMTP_NO_ERROR ) + result = 0; } } //qDebug("mailesmtp_ehlo %d ",err ); @@ -290,6 +292,10 @@ void SMTPwrapper::connect_server() } } } + if ( result == 0 ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } void SMTPwrapper::disc_server() @@ -346,7 +352,11 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer&mail,bool later sendProgress->hide(); delete sendProgress; sendProgress = 0; - mailmime_free( mimeMail ); + mailmime_free( mimeMail ); + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } return result; } @@ -458,6 +468,7 @@ bool SMTPwrapper::flushOutbox() { m_SmtpAccount->setUser(oldUser); m_SmtpAccount->setPassword(oldPw); } + KConfig cfg( locateLocal("config", "kopiemailrc" ) ); cfg.setGroup( "Status" ); m_queuedMail = mailsToSend.count(); @@ -467,6 +478,10 @@ bool SMTPwrapper::flushOutbox() { delete sendProgress; sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); - delete wrap; + delete wrap; + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } return returnValue; } diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 710a9f9..f235705 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -265,12 +265,14 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, i18n("Delete all selected"),this, SLOT(deleteAll()),true); mPopupMenu->insertSeparator(); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Save selected to file..."),this, - SLOT(saveToFile()),true); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Save Journal/Description..."),this, - SLOT(saveDescriptionToFile()),true); + QPopupMenu * exportPO = new QPopupMenu ( this ); + mPopupMenu->insertItem( i18n("Export selected"), exportPO ); + exportPO->insertItem( i18n("As iCal (ics) file..."),this, + SLOT(saveToFile())); + exportPO->insertItem( i18n("As vCal (vcs) file..."),this, + SLOT(saveToFileVCS())); + exportPO->insertItem( i18n("Journal/Details..."),this, + SLOT(saveDescriptionToFile())); // mPopupMenu->insertSeparator(); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Add Categ. to selected..."),this, @@ -606,8 +608,16 @@ void KOListView::saveDescriptionToFile() } } } +void KOListView::saveToFileVCS() +{ + writeToFile( false ); +} void KOListView::saveToFile() { + writeToFile( true ); +} +void KOListView::writeToFile( bool iCal ) +{ int icount = 0; QPtrList delSel ; @@ -622,6 +632,16 @@ void KOListView::saveToFile() } if ( icount ) { QString fn = KOPrefs::instance()->mLastSaveFile; + QString extension; + if ( iCal ) { + if ( fn.right( 4 ).lower() == ".vcs" ) { + fn = fn.left( fn.length() -3) + "ics"; + } + } else { + if ( fn.right( 4 ).lower() == ".ics" ) { + fn = fn.left( fn.length() -3) + "vcs"; + } + } fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); if ( fn == "" ) @@ -647,8 +667,13 @@ void KOListView::saveToFile() cal.addIncidence( incidence->clone() ); incidence = delSel.next(); } - ICalFormat format; - format.save( &cal, fn ); + if ( iCal ) { + ICalFormat format; + format.save( &cal, fn ); + } else { + VCalFormat format; + format.save( &cal, fn ); + } mes = i18n("KO/Pi:Saved %1").arg(fn ); KOPrefs::instance()->mLastSaveFile = fn; topLevelWidget()->setCaption(mes); diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index c86449d..0d9c525 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -272,6 +272,7 @@ class KOListView : public KOEventView void hideDates(); void deleteAll(); void saveToFile(); + void saveToFileVCS(); void saveDescriptionToFile(); void beamSelected(); void updateConfig(); @@ -288,6 +289,7 @@ class KOListView : public KOEventView void processSelectionChange(QListViewItem *); protected: + void writeToFile( bool iCal ); void addEvents(QPtrList eventList); void addIncidence(Incidence *); KOListViewItem *getItemForEvent(Event *event); -- cgit v0.9.0.2