author | zautrix <zautrix> | 2005-02-28 18:16:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-28 18:16:03 (UTC) |
commit | 27466d3bc668e7a4c4bdedb6f407e14844908347 (patch) (side-by-side diff) | |
tree | ecc5f637b7430d34161a267bd4047cdd0de056f3 /kmicromail | |
parent | 16575cca67c9047de72530080dfeb5793a66c935 (diff) | |
download | kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.zip kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.tar.gz kdepimpi-27466d3bc668e7a4c4bdedb6f407e14844908347.tar.bz2 |
ompi fixes
-rw-r--r-- | kmicromail/editaccounts.cpp | 12 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 8 | ||||
-rw-r--r-- | kmicromail/selectsmtp.cpp | 2 |
3 files changed, 16 insertions, 6 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 8253c91..f1075c0 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp @@ -192,457 +192,469 @@ void EditAccounts::slotEditAccount( Account *account ) } } else if ( account->getType()==MAILLIB::A_SMTP ) { SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) { slotFillLists(); } } else if ( account->getType()==MAILLIB::A_NNTP) { NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) { slotFillLists(); } } } void EditAccounts::slotDeleteAccount( Account *account ) { if ( QMessageBox::information( this, i18n( "Question" ), i18n( "<p>Do you really want to delete the selected Account?</p>" ), i18n( "Yes" ), i18n( "No" ) ) == 0 ) { settings->delAccount( account ); slotFillLists(); } } void EditAccounts::slotEditMail() { if ( !mailList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotEditAccount( a ); } void EditAccounts::slotDeleteMail() { if ( !mailList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotNewNews() { slotNewAccount( "NNTP" ); } void EditAccounts::slotEditNews() { if ( !newsList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotEditAccount( a ); } void EditAccounts::slotDeleteNews() { if ( !newsList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotAdjustColumns() { int currPage = configTab->currentPageIndex(); configTab->showPage( mailTab ); mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); mailList->setColumnWidth( 1, 50 ); configTab->showPage( newsTab ); newsList->setColumnWidth( 0, newsList->visibleWidth() ); configTab->setCurrentPage( currPage ); } void EditAccounts::accept() { settings->saveAccounts(); QDialog::accept(); } /** * SelectMailType */ SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) : SelectMailTypeUI( parent, name, modal, flags ) { selected = selection; selected->replace( 0, selected->length(), typeBox->currentText() ); connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); } void SelectMailType::slotSelection( const QString &sel ) { selected->replace( 0, selected->length(), sel ); } /** * IMAPconfig */ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : IMAPconfigUI( parent, name, modal, flags ) { data = account; fillValues(); 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(); ComboBox1->setCurrentItem( data->ConnectionType() ); } void IMAPconfig::slotConnectionToggle( int index ) { if ( index == 2 ) { portLine->setText( IMAP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( IMAP_PORT ); CommandEdit->show(); } else { portLine->setText( IMAP_PORT ); } } 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 ); SpinBoxDown->setValue ( max ); } else { CheckBoxDown->setChecked( false ); SpinBoxDown->setValue ( 5 ); } CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); } void IMAPconfig::accept() { + if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { + QMessageBox::information( this, i18n( "Error" ), + i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), + i18n( "Ok" ) ); + return; + } data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setPrefix(prefixLine->text()); data->setLocalFolder( localFolder->text() ); data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); QDialog::accept(); } /** * POP3config */ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : POP3configUI( parent, name, modal, flags ) { data = account; fillValues(); 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(); ComboBox1->setCurrentItem( data->ConnectionType() ); } void POP3config::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( POP3_PORT ); CommandEdit->show(); } else { portLine->setText( POP3_PORT ); } } 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 ); } else { CheckBoxDown->setChecked( false ); SpinBoxDown->setValue ( 5 ); } CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); } void POP3config::accept() { + if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { + QMessageBox::information( this, i18n( "Error" ), + i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), + i18n( "Ok" ) ); + return; + } data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setLocalFolder( localFolder->text() ); data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); QDialog::accept(); } /** * SMTPconfig */ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : SMTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); fillValues(); QIconSet icon; //icon = SmallIcon("fileexport"); icon = SmallIcon("fileopen"); SignaturButton->setText(""); SignaturButton->setIconSet (icon ) ; SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 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(); 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 ) { portLine->setText( SMTP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( SMTP_PORT ); CommandEdit->show(); } else { portLine->setText( SMTP_PORT ); } } 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() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setSigFile( SignaturEdit->text() ); QDialog::accept(); } /** * NNTPconfig */ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : NNTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); fillValues(); connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); } void NNTPconfig::slotShowSub() { save(); data->save(); ListViewGroups->clear(); for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); item->setOn( true ); } topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); } void NNTPconfig::slotShowFilter() { save(); data->save(); ListViewGroups->clear(); int count = 0; for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { QCheckListItem *item; if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); ++count; if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); } } } topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); } void NNTPconfig::slotGetNG() { save(); data->save(); topLevelWidget()->setCaption( i18n("Fetching group list...")); qApp->processEvents(); NNTPwrapper* tmp = new NNTPwrapper( data ); allGroups = tmp->listAllNewsgroups(); topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); ListViewGroups->clear(); for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); } } delete tmp; } void NNTPconfig::slotSSL( bool enabled ) { if ( enabled ) { portLine->setText( NNTP_SSL_PORT ); } else { portLine->setText( NNTP_PORT ); } } void NNTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); sslBox->setChecked( data->getSSL() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); subscribedGroups = data->getGroups(); /* don't forget that - you will overwrite values if user clicks cancel! */ for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); item->setOn( true ); } } diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 197f7ec..b701446 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -16,401 +16,399 @@ #include "opiemail.h" #include "editaccounts.h" #include "composemail.h" #include "mailistviewitem.h" #include "viewmail.h" #include "selectstore.h" #include "selectsmtp.h" #include "accountitem.h" #include "accountview.h" #include "klocale.h" #include <qmessagebox.h> #include <qtimer.h> #include <qcursor.h> #include <qtextbrowser.h> #include <qregexp.h> #include <qpe/global.h> #ifdef DESKTOP_VERSION #include <qapplication.h> #else #include <qpe/qpeapplication.h> #endif #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> #include "koprefs.h" //using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name ) : MainWindow( parent, name) //, WStyle_ContextHelp ) { mCurrentComposer = 0; settings = new Settings(); tb = 0; setIcon(SmallIcon( "kmicromail" ) ); folderView->populate( settings->getAccounts() ); connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); } OpieMail::~OpieMail() { if (settings) delete settings; if ( tb ) delete tb; } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { } #include <stdlib.h> void OpieMail::message(const QCString &msg, const QByteArray &data) { // copied from old mail2 static int ii = 0; //qDebug("QCOP CALL ############################# %d ", ii); //QString mess ( msg ); //qDebug("Message = %s ",mess.latin1()); ++ii; //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); mPendingEmail = QString::null; mPendingName = QString::null; if (msg == "writeMail(QString,QString)") { //qDebug("writeMail(QString,QString) "); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName >> mPendingEmail; // removing the whitespaces at beginning and end is needed! QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else if (msg == "newMail()") { //qDebug("slotComposeMail() "); // we cannot call slotComposeMail(); directly, because may be executing a QCOP call // and a QCOP call does not like a processevents in his execution // with the Qtimer we call slotComposeMail() after we reached the main event loop QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); // slotComposeMail(); } else if (msg == "newMail(QString)") { //qDebug(" newMail(QString)"); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName; // the format is // NAME <EMAIL>:SUBJECT QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else { mPendingData = data; mPendingMessage = msg; QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); } //qDebug("END OpieMail::message "); } void OpieMail::slotExtAppHandler() { ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); } void OpieMail::slotwriteMail2(const QString& namemail ) { //qDebug("OpieMail::slotwriteMail2 "); //qApp->processEvents(); ComposeMail compose( settings, this, 0, true ); if ( !namemail.isEmpty() ) { QString to = namemail; if ( namemail.find( " <") > 1 ) { to = "\"" +to.replace( QRegExp( " <"), "\" <") ; } else if ( namemail.find( "<") > 1 ) { to = "\"" +to.replace( QRegExp( "<"), "\" <") ; } int sub = to.find( ">:"); if ( sub > 0 ) { compose.setTo( to.left(sub+1) ); compose.setSubject( to.mid(sub+2) ); } else compose.setTo( to ); } compose.slotAdjustColumns(); #ifndef DESKTOP_VERSION compose.showMaximized(); #endif mCurrentComposer = &compose; compose.exec(); mCurrentComposer = 0; folderView->refreshOutgoing(); raise(); //qDebug("retttich "); } void OpieMail::slotwriteMail(const QString&name,const QString&email) { // qDebug("OpieMail::slotwriteMail "); ComposeMail compose( settings, this, 0, true ); if (!email.isEmpty()) { if (!name.isEmpty()) { compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); } else { compose.setTo(email); } } compose.slotAdjustColumns(); #ifndef DESKTOP_VERSION compose.showMaximized(); #endif mCurrentComposer = &compose; compose.exec(); mCurrentComposer = 0; folderView->refreshOutgoing(); raise(); } void OpieMail::slotComposeMail() { if ( mPendingEmail == QString::null && mPendingName == QString::null) slotwriteMail2( QString () ); else { if ( mPendingEmail == QString::null ) slotwriteMail2( mPendingName ); else slotwriteMail( mPendingName, mPendingEmail ); } //slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { SMTPaccount *smtp = 0; QList<Account> list = settings->getAccounts(); QList<SMTPaccount> smtpList; smtpList.setAutoDelete(false); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType() == MAILLIB::A_SMTP ) { smtp = static_cast<SMTPaccount *>(it); smtpList.append(smtp); } } if (smtpList.count()==0) { - QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); + QMessageBox::information(0,i18n("Info"),i18n("Define a smtp\n account first!\n")); return; } - if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) + if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to\nsend all queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) return; if (smtpList.count()==1) { smtp = smtpList.at(0); } else { smtp = 0; selectsmtp selsmtp; selsmtp.setSelectionlist(&smtpList); -#ifndef DESKTOP_VERSION - selsmtp.showMaximized(); -#endif + selsmtp.resize( selsmtp.sizeHint() ); if ( selsmtp.exec() == QDialog::Accepted ) { smtp = selsmtp.selected_smtp(); } } if (smtp) { Global::statusMessage("Sending mails...!"); SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { Global::statusMessage("Mails sent!"); } delete wrap; } folderView->refreshOutgoing(); } void OpieMail::slotSearchMails() { qDebug("OpieMail::slotSearchMails():not implemented "); } void OpieMail::slotEditSettings() { KOPrefsDialog settingsDialog( this, "koprefs", true ); #ifndef DESKTOP_VERSION settingsDialog.showMaximized(); #endif settingsDialog.exec(); slotSetCodec( KOPrefs::instance()->mCurrentCodec ); // KApplication::execDialog(settingsDialog); } void OpieMail::slotEditAccounts() { EditAccounts eaDialog( settings, this, 0, true ); eaDialog.slotAdjustColumns(); #ifndef DESKTOP_VERSION eaDialog.showMaximized(); #endif eaDialog.exec(); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::replyMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); QString rtext; rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose .arg( mail->getFrom()) .arg( mail->getDate()); QString text = body->Bodytext(); QStringList lines = QStringList::split(QRegExp("\\n"), text); QStringList::Iterator it; for (it = lines.begin(); it != lines.end(); it++) { rtext += "> " + *it + "\n"; } rtext += "\n"; QString prefix; if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; else prefix = "Re: "; // no i18n on purpose Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); if (mail->Replyto().isEmpty()) { composer.setTo( mail->getFrom()); } else { composer.setTo( mail->Replyto()); } composer.setSubject( prefix + mail->getSubject()); composer.setMessage( rtext ); composer.setInReplyTo( mail->Msgid()); composer.setCharset( body->getCharset() ); mCurrentComposer = &composer; if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) { mail->Wrapper()->answeredMail(mail); } mCurrentComposer = 0; folderView->refreshOutgoing(); delete settings; } void OpieMail::closeViewMail(ViewMail * vm) { vm->hide(); } void OpieMail::slotDownloadMail( ) { QListViewItem*item = mailView->currentItem(); if (!item ) { Global::statusMessage("Error: No item slected!"); return; } RecMailP mail = ((MailListViewItem*)item)->data(); Account * acc = mail->Wrapper()->getAccount(); if ( !acc ) { Global::statusMessage("Mail is already stored locally!"); return; } QString lfName = acc->getLocalFolder(); //qDebug("local folder " + lfName ); if ( lfName.isEmpty() ) lfName = acc->getAccountName(); AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); //qDebug("target %d %d ",targetMail,mail->Wrapper() ); if ( targetMail == mail->Wrapper() ) { Global::statusMessage("Mail is already locally stored!"); return; } if ( !targetMail->createMbox(lfName)) { Global::statusMessage("Error creating folder!"); return; } Global::statusMessage("Fetching mail...please wait!"); qApp->processEvents(); encodedString*st = 0; st = mail->Wrapper()->fetchRawBody(mail); if ( st ) { targetMail->storeMessage(st->Content(),st->Length(),lfName); Global::statusMessage("Mail stored in "+ lfName); delete st; } else { Global::statusMessage("Error: Cannot fetch mail!"); } } void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) { QListViewItem*item = mailView->currentItem(); if (!item ) { closeViewMail(vm); return; } RecMailP mail = ((MailListViewItem*)item)->data(); mail->Wrapper()->deleteMail( mail ); item = item->itemBelow(); if (!item ) { closeViewMail(vm); return; } mailView->setCurrentItem(item); mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); vm->setBody( body ); vm->setMail( mail ); } void OpieMail::displayNextMail(ViewMail * vm) { QListViewItem*item = mailView->currentItem(); if (!item) return; ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); item = item->itemBelow(); if (!item) { vm->setCaption(i18n("End of List" )); return; } mailView->setCurrentItem(item); RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); vm->setBody( body ); vm->setMail( mail ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal ); readMail.setBody( body ); readMail.setMail( mail ); #ifndef DESKTOP_VERSION readMail.showMaximized(); #else diff --git a/kmicromail/selectsmtp.cpp b/kmicromail/selectsmtp.cpp index ff8b524..10b6d79 100644 --- a/kmicromail/selectsmtp.cpp +++ b/kmicromail/selectsmtp.cpp @@ -1,64 +1,64 @@ #include "selectsmtp.h" #include <libmailwrapper/mailwrapper.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> #include <klocale.h> selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl) : selectstoreui(parent,name,modal,fl) { //m_smtpList.setAutoDelete(false); m_smtpList = 0; //headlabel->setText(i18n("<center>Select SMTP account to use</center>")); headlabel->hide(); folderSelection->hide(); folderLabel->hide(); - accountlabel->setText("<center>SMTP Accounts</center>"); + //accountlabel->setText(i18n("SMTP\nAccount:")); Line1->hide(); newFoldersel->hide(); newFolderedit->hide(); newFolderLabel->hide(); Line2->hide(); selMove->hide(); m_current_smtp = 0; setCaption(i18n("Select SMTP Account")); } selectsmtp::~selectsmtp() { } void selectsmtp::slotAccountselected(int which) { if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) { m_current_smtp = 0; return; } m_current_smtp = m_smtpList->at(which); } void selectsmtp::setSelectionlist(QList<SMTPaccount>*list) { m_smtpList = list; accountSelection->clear(); if (!m_smtpList || m_smtpList->count()==0) { accountSelection->setEnabled(false); return; } accountSelection->setEnabled(true); for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) { accountSelection->insertItem( m_smtpList->at(i)->getAccountName()); } m_current_smtp = m_smtpList->at(0); } SMTPaccount*selectsmtp::selected_smtp() { return m_current_smtp; } |