-rw-r--r-- | noncore/net/mail/opiemail.cpp | 30 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 3 |
2 files changed, 25 insertions, 8 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 5399c3c..2f87e44 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -9,39 +9,53 @@ #include "selectsmtp.h" #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> /* OPIE */ #include <opie2/odebug.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> /* QT */ +/* UNIX */ +#include <signal.h> + using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) : MainWindow( parent, name, WStyle_ContextHelp ) { + setup_signalblocking(); settings = new Settings(); folderView->populate( settings->getAccounts() ); } OpieMail::~OpieMail() { if (settings) delete settings; } +void OpieMail::setup_signalblocking() +{ + /* for networking we must block SIGPIPE and Co. */ + struct sigaction blocking_action,temp_action; + blocking_action.sa_handler = SIG_IGN; + sigemptyset(&(blocking_action.sa_mask)); + blocking_action.sa_flags = 0; + sigaction(SIGPIPE,&blocking_action,&temp_action); +} + void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { // copied from old mail2 if (msg == "writeMail(QString,QString)") { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; // removing the whitespaces at beginning and end is needed! slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); } else if (msg == "newMail()") @@ -61,31 +75,31 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) } else { compose.setTo(email); } } compose.slotAdjustColumns(); QPEApplication::execDialog( &compose ); } void OpieMail::slotComposeMail() { - odebug << "Compose Mail" << oendl; + odebug << "Compose Mail" << oendl; slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { - odebug << "Send Queued" << oendl; + odebug << "Send Queued" << oendl; 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); @@ -114,36 +128,36 @@ void OpieMail::slotSendQueued() { SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); } delete wrap; } } void OpieMail::slotSearchMails() { - odebug << "Search Mails" << oendl; + odebug << "Search Mails" << oendl; } void OpieMail::slotEditSettings() { SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); QPEApplication::execDialog( &settingsDialog ); } void OpieMail::slotEditAccounts() { - odebug << "Edit Accounts" << oendl; + odebug << "Edit Accounts" << oendl; EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); eaDialog.slotAdjustColumns(); QPEApplication::execDialog( &eaDialog ); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); @@ -174,57 +188,57 @@ void OpieMail::slotDeleteMail() { mail->Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } } void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) { if (!mailView->currentItem()) return; MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); /* just the RIGHT button - or hold on pda */ if (button!=2) {return;} - odebug << "Event right/hold" << oendl; + odebug << "Event right/hold" << oendl; if (!item) return; QPopupMenu *m = new QPopupMenu(0); if (m) { if (mailtype==MAILLIB::A_NNTP) { m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); } else { if (folderView->currentisDraft()) { m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); } m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; } } void OpieMail::slotShowFolders( bool show ) { - odebug << "Show Folders" << oendl; + odebug << "Show Folders" << oendl; if ( show && folderView->isHidden() ) { - odebug << "-> showing" << oendl; + odebug << "-> showing" << oendl; folderView->show(); } else if ( !show && !folderView->isHidden() ) { - odebug << "-> hiding" << oendl; + odebug << "-> hiding" << oendl; folderView->hide(); } } void OpieMail::refreshMailView(const QValueList<RecMailP>&list) { MailListViewItem*item = 0; mailView->clear(); QValueList<RecMailP>::ConstIterator it; for (it = list.begin(); it != list.end();++it) { diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index b93bd60..3d25b3d 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h @@ -25,18 +25,21 @@ protected slots: virtual void slotSearchMails(); virtual void slotEditSettings(); virtual void slotEditAccounts(); virtual void displayMail(); virtual void slotDeleteMail(); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); virtual void slotMoveCopyMail(); virtual void reEditMail(); +protected: + void setup_signalblocking(); + private: Settings *settings; }; #endif |