-rw-r--r-- | noncore/net/mail/opiemail.cpp | 21 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 1 |
2 files changed, 17 insertions, 5 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 0dede90..2909893 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -21,45 +21,56 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); // Added by Stefan Eilers to allow starting by addressbook.. // copied from old mail2 #if !defined(QT_NO_COP) connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); #endif } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { // copied from old mail2 - // TODO: compose mail should get parameters of a recipient for starting - // from addressbook. (qcop signal "writeMail(string,string)") if (msg == "writeMail(QString,QString)") { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; - slotComposeMail(); + // removing the whitespaces at beginning and end is needed! + slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); } else if (msg == "newMail()") { slotComposeMail(); } } -void OpieMail::slotComposeMail() +void OpieMail::slotwriteMail(const QString&name,const QString&email) { - qDebug( "Compose Mail" ); ComposeMail compose( settings, this, 0 , true ); + if (!email.isEmpty()) { + if (!name.isEmpty()) { + compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); + } else { + compose.setTo(email); + } + } compose.showMaximized(); compose.slotAdjustColumns(); compose.exec(); } +void OpieMail::slotComposeMail() +{ + qDebug( "Compose Mail" ); + slotwriteMail(0l,0l); +} + void OpieMail::slotSendQueued() { qDebug( "Send Queued" ); SMTPaccount *smtp = 0; QList<Account> list = settings->getAccounts(); Account *it; // if (list.count()==1) { for ( it = list.first(); it; it = list.next() ) { if ( it->getType().compare( "SMTP" ) == 0 ) { smtp = static_cast<SMTPaccount *>(it); break; diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index 3cf5972..8cbcaa4 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h @@ -4,24 +4,25 @@ #include "mainwindow.h" #include "settings.h" class OpieMail : public MainWindow { Q_OBJECT public: OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); static QString appName() { return QString::fromLatin1("opiemail"); } public slots: + void slotwriteMail(const QString&name,const QString&email); void slotComposeMail(); void appMessage(const QCString &msg, const QByteArray &data); protected slots: void slotSendQueued(); void slotSearchMails(); void slotEditSettings(); void slotEditAccounts(); private: Settings *settings; }; |