Diffstat (limited to 'noncore/net/mail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 113 |
1 files changed, 71 insertions, 42 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 0795436..abf93dc 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -1,2 +1,2 @@ -#include <qmessagebox.h> + #include "settingsdialog.h" @@ -5,16 +5,22 @@ #include "composemail.h" +#include "mailistviewitem.h" +#include "viewmail.h" +#include "selectstore.h" +#include "selectsmtp.h" + +/* OPIE */ #include <libmailwrapper/smtpwrapper.h> +#include <libmailwrapper/mailtypes.h> +#include <libmailwrapper/abstractmail.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> +#include <qpe/qpeapplication.h> + +/* QT */ +#include <qmessagebox.h> #include <qaction.h> #include <qapplication.h> -#include <libmailwrapper/mailtypes.h> -#include <libmailwrapper/abstractmail.h> -#include "mailistviewitem.h" -#include "viewmail.h" -#include "selectstore.h" -#include "selectsmtp.h" OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) - : MainWindow( parent, name, WStyle_ContextHelp ) + : MainWindow( parent, name, WStyle_ContextHelp ) { @@ -33,3 +39,4 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data) // copied from old mail2 - if (msg == "writeMail(QString,QString)") { + if (msg == "writeMail(QString,QString)") + { QDataStream stream(data,IO_ReadOnly); @@ -39,3 +46,5 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data) slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); - } else if (msg == "newMail()") { + } + else if (msg == "newMail()") + { slotComposeMail(); @@ -47,6 +56,10 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); - if (!email.isEmpty()) { - if (!name.isEmpty()) { + if (!email.isEmpty()) + { + if (!name.isEmpty()) + { compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); - } else { + } + else + { compose.setTo(email); @@ -54,5 +67,4 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) } - compose.showMaximized(); compose.slotAdjustColumns(); - compose.exec(); + QPEApplication::execDialog( &compose ); } @@ -74,4 +86,6 @@ void OpieMail::slotSendQueued() Account *it; - for ( it = list.first(); it; it = list.next() ) { - if ( it->getType().compare( "SMTP" ) == 0 ) { + for ( it = list.first(); it; it = list.next() ) + { + if ( it->getType().compare( "SMTP" ) == 0 ) + { smtp = static_cast<SMTPaccount *>(it); @@ -80,3 +94,4 @@ void OpieMail::slotSendQueued() } - if (smtpList.count()==0) { + if (smtpList.count()==0) + { QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); @@ -84,5 +99,8 @@ void OpieMail::slotSendQueued() } - if (smtpList.count()==1) { + if (smtpList.count()==1) + { smtp = smtpList.at(0); - } else { + } + else + { smtp = 0; @@ -90,4 +108,4 @@ void OpieMail::slotSendQueued() selsmtp.setSelectionlist(&smtpList); - selsmtp.showMaximized(); - if (selsmtp.exec()==QDialog::Accepted) { + if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) + { smtp = selsmtp.selected_smtp(); @@ -95,5 +113,7 @@ void OpieMail::slotSendQueued() } - if (smtp) { + if (smtp) + { SMTPwrapper * wrap = new SMTPwrapper(smtp); - if ( wrap->flushOutbox() ) { + if ( wrap->flushOutbox() ) + { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); @@ -112,4 +132,3 @@ void OpieMail::slotEditSettings() SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); - settingsDialog.showMaximized(); - settingsDialog.exec(); + QPEApplication::execDialog( &settingsDialog ); } @@ -120,5 +139,4 @@ void OpieMail::slotEditAccounts() EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); - eaDialog.showMaximized(); eaDialog.slotAdjustColumns(); - eaDialog.exec(); + QPEApplication::execDialog( &eaDialog ); if ( settings ) delete settings; @@ -141,5 +159,8 @@ void OpieMail::displayMail() - if ( readMail.deleted ) { - folderView->refreshCurrent(); - } else { + if ( readMail.deleted ) + { + folderView->refreshCurrent(); + } + else + { ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); @@ -152,5 +173,6 @@ void OpieMail::slotDeleteMail() RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); - if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { - mail.Wrapper()->deleteMail( mail ); - folderView->refreshCurrent(); + if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) + { + mail.Wrapper()->deleteMail( mail ); + folderView->refreshCurrent(); } @@ -165,3 +187,4 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) QPopupMenu *m = new QPopupMenu(0); - if (m) { + if (m) + { m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); @@ -177,7 +200,10 @@ void OpieMail::slotShowFolders( bool show ) { - qDebug( "Show Folders" ); - if ( show && folderView->isHidden() ) { + qDebug( "Show Folders" ); + if ( show && folderView->isHidden() ) + { qDebug( "-> showing" ); folderView->show(); - } else if ( !show && !folderView->isHidden() ) { + } + else if ( !show && !folderView->isHidden() ) + { qDebug( "-> hiding" ); @@ -191,3 +217,4 @@ void OpieMail::refreshMailView(QList<RecMail>*list) mailView->clear(); - for (unsigned int i = 0; i < list->count();++i) { + for (unsigned int i = 0; i < list->count();++i) + { item = new MailListViewItem(mailView,item); @@ -218,8 +245,10 @@ void OpieMail::slotMoveCopyMail() if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || - targetFolder.isEmpty()) { + targetFolder.isEmpty()) + { return; } - if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { + if (sels.newFolder() && !targetMail->createMbox(targetFolder)) + { QMessageBox::critical(0,tr("Error creating new Folder"), - tr("<center>Error while creating<br>new folder - breaking.</center>")); + tr("<center>Error while creating<br>new folder - breaking.</center>")); return; |