author | zautrix <zautrix> | 2005-03-11 19:26:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-11 19:26:02 (UTC) |
commit | 1166a4797a91cedd5002a3513d5028c5e86016f0 (patch) (side-by-side diff) | |
tree | 8e7443bc887a15dcf3852abd36e6e61f2e6bddad | |
parent | 71462ba8ef1803787bba6793f1adb85987eb57df (diff) | |
download | kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.zip kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.gz kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.bz2 |
better kopi export
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 5 | ||||
-rw-r--r-- | kmicromail/editaccounts.cpp | 12 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 17 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 37 | ||||
-rw-r--r-- | korganizer/kolistview.h | 2 |
5 files changed, 62 insertions, 11 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 @@ { "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, { "View Options","Anzeige Optionen" }, { "<b>Created: ","<b>Erstellt am: " }, { "<b>Last modified: ","<b>Zuletzt geändert am: " }, { "Journal: ","Journal: " }, { "yearly","jährlich" }, { "(%1) ","%1-" }, { "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, { "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, { "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, { "Summary/Loc.","Titel/Ort" }, { "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, { "Week Number","Wochennummer" }, { "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..." }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, - 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, connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); fillValues(); // ComboBox1->setCurrentItem( data->ConnectionType() ); } void IMAPconfig::slotConnectionToggle( int index ) { if ( index == 2 ) { portLine->setText( IMAP_SSL_PORT ); + CommandEdit->hide(); } else if ( index == 3 ) { portLine->setText( IMAP_PORT ); CommandEdit->show(); } else { portLine->setText( IMAP_PORT ); + CommandEdit->hide(); } } void IMAPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); prefixLine->setText(data->getPrefix()); localFolder->setText( data->getLocalFolder() ); int max = data->getMaxMailSize() ; if ( max ) { CheckBoxDown->setChecked( true ); @@ -415,41 +417,43 @@ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); fillValues(); //ComboBox1->setCurrentItem( data->ConnectionType() ); } void POP3config::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); + CommandEdit->hide(); } else if ( index == 3 ) { portLine->setText( POP3_PORT ); CommandEdit->show(); } else { portLine->setText( POP3_PORT ); + CommandEdit->hide(); } } void POP3config::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); localFolder->setText( data->getLocalFolder() ); int max = data->getMaxMailSize() ; if ( max ) { CheckBoxDown->setChecked( true ); SpinBoxDown->setValue ( max ); @@ -507,45 +511,47 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, ComboBox1->insertItem( "Always, use TLS", 2 ); ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); ComboBox1->insertItem( "Run command instead", 4 ); CommandEdit->hide(); fillValues(); //ComboBox1->setCurrentItem( data->ConnectionType() ); } void SMTPconfig::chooseSig() { QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); if ( !lnk.isEmpty() ) { SignaturEdit->setText( lnk ); } } 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(); } else { portLine->setText( SMTP_PORT ); + CommandEdit->hide(); } } void SMTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); SignaturEdit->setText( data->getSigFile() ); } void 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() if ( err != MAILSMTP_NO_ERROR ) { qDebug("Error init SMTP connection" ); failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); result = 0; } qDebug("SMTP connection inited "); /* switch to tls after init 'cause there it will send the ehlo */ if (result) { err = mailsmtp_init( m_smtp ); if (err != MAILSMTP_NO_ERROR) { result = 0; qDebug("Error init SMTP connection "); 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) { try_tls = false; qDebug("no tls "); } else { err = mailesmtp_ehlo(m_smtp); + if ( err != MAILSMTP_NO_ERROR ) + result = 0; } } //qDebug("mailesmtp_ehlo %d ",err ); if (!try_tls && force_tls) { result = 0; failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err)); } if (result==1 && m_SmtpAccount->getLogin() ) { ; // odebug << "smtp with auth" << oendl; if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { // get'em LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { @@ -277,32 +279,36 @@ void SMTPwrapper::connect_server() } } else { user = m_SmtpAccount->getUser(); pass = m_SmtpAccount->getPassword(); } ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; if (result) { err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); if ( err == MAILSMTP_NO_ERROR ) { qDebug("Smtp authentification ok "); } else { failuretext = i18n("Authentification failed"); result = 0; } } } + if ( result == 0 ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } void SMTPwrapper::disc_server() { if (m_smtp) { mailsmtp_quit( m_smtp ); mailsmtp_free( m_smtp ); m_smtp = 0; } } int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) { int err,result; QString failuretext = ""; @@ -334,32 +340,36 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later mailmime * mimeMail; bool result = true; mimeMail = createMimeMail(mail ); if ( mimeMail == 0 ) { qDebug("SMTP wrapper:Error creating mail! "); return false; } else { sendProgress = new progressMailSend(); sendProgress->show(); sendProgress->setMaxMails(1); result = smtpSend( mimeMail,later); ; // odebug << "Clean up done" << oendl; sendProgress->hide(); delete sendProgress; sendProgress = 0; mailmime_free( mimeMail ); + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } return result; } int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { size_t curTok = 0; mailimf_fields *fields = 0; mailimf_field*ffrom = 0; clist *rcpts = 0; char*from = 0; int res = 0; encodedString * data = wrap->fetchRawBody(which); if (!data) return 0; int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); @@ -445,28 +455,33 @@ bool SMTPwrapper::flushOutbox() { sendProgress->setMaxMails(mailsToSend.count()); while (returnValue && mailsToSend.count()>0) { if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { QMessageBox::critical(0,i18n("Error sending mail"), i18n("Error sending queued mail.\nBreaking.")); returnValue = false; } mailsToRemove.append((*mailsToSend.begin())); mailsToSend.remove(mailsToSend.begin()); sendProgress->setCurrentMails(mailsToRemove.count()); } if (reset_user_value) { m_SmtpAccount->setUser(oldUser); m_SmtpAccount->setPassword(oldPw); } + KConfig cfg( locateLocal("config", "kopiemailrc" ) ); cfg.setGroup( "Status" ); m_queuedMail = mailsToSend.count(); cfg.writeEntry( "outgoing", m_queuedMail ); emit queuedMails( m_queuedMail ); sendProgress->hide(); delete sendProgress; sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); 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 @@ -252,38 +252,40 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, mListView->setColumnWidthMode( iii, QListView::Manual ); QBoxLayout *layoutTop = new QVBoxLayout(this); layoutTop->addWidget(mListView); mListView->setFont ( KOPrefs::instance()->mListViewFont ); mPopupMenu = eventPopup(); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Select all"),this, SLOT(allSelection()),true); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Deselect all"),this, SLOT(clearSelection()),true); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 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, SLOT(addCat()),true); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Set Categ. for selected..."),this, SLOT(setCat()),true); //mPopupMenu->insertSeparator(); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Set alarm for selected..."),this, SLOT(setAlarm()),true); #ifndef DESKTOP_VERSION mPopupMenu->insertSeparator(); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), @@ -593,75 +595,98 @@ void KOListView::saveDescriptionToFile() } QFile file( fn ); if (!file.open( IO_WriteOnly ) ) { topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); return; } QTextStream ts( &file ); ts << text; file.close(); //qDebug("%s ", text.latin1()); mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); KOPrefs::instance()->mLastSaveFile = fn; topLevelWidget()->setCaption(mes); } } } +void KOListView::saveToFileVCS() +{ + writeToFile( false ); +} void KOListView::saveToFile() { + writeToFile( true ); +} +void KOListView::writeToFile( bool iCal ) +{ int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } item = item->nextSibling(); } 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 == "" ) return; QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; if ( info. exists() ) { mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { createbup = false; } } if ( createbup ) { CalendarLocal cal; cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); while ( incidence ) { cal.addIncidence( incidence->clone() ); incidence = delSel.next(); } + 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); } } } void KOListView::deleteAll() { int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } 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 void signalNewEvent(); void beamIncidenceList(QPtrList<Incidence>); public slots: virtual void updateView(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void clearSelection(); void allSelection(); void clear(); void beamDone( Ir *ir ); void showDates(); void hideDates(); void deleteAll(); void saveToFile(); + void saveToFileVCS(); void saveDescriptionToFile(); void beamSelected(); void updateConfig(); void addCat(); void setCat(); void setAlarm(); void setCategories( bool removeOld ); void changeEventDisplay(Event *, int); void defaultItemAction(QListViewItem *item); void popupMenu(QListViewItem *item,const QPoint &,int); protected slots: void processSelectionChange(QListViewItem *); protected: + void writeToFile( bool iCal ); void addEvents(QPtrList<Event> eventList); void addIncidence(Incidence *); KOListViewItem *getItemForEvent(Event *event); private: KOListViewListView *mListView; KOEventPopupMenu *mPopupMenu; KOListViewItem *mActiveItem; QDict<Incidence> mUidDict; QDate mStartDate; void keyPressEvent ( QKeyEvent * ) ; }; #endif |