-rw-r--r-- | kmicromail/composemail.cpp | 14 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 33 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 5 |
3 files changed, 48 insertions, 4 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index ed8a2ee..3231b45 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -46,26 +46,27 @@ #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> //using namespace Opie::Core; //using namespace Opie::Ui; ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) : ComposeMailUI( parent, name, modal ) { mPickLineEdit = 0; mEncoding = KOPrefs::instance()->mCurrentCodeName; - connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), - this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); + //managed from opiemail now + //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), + // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); settings = sett; m_replyid = ""; if ( KOPrefs::instance()->mUseKapi) { KConfig config( locateLocal("config", "kabcrc") ); config.setGroup( "General" ); QString whoami_uid = config.readEntry( "WhoAmI" ); if ( whoami_uid.isEmpty() ) { QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); @@ -251,46 +252,53 @@ void ComposeMail::pickAddress( ) } #else bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); // the result should now arrive through method insertAttendees #endif } //the map includes name/email pairs, that comes from Ka/Pi void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) { //qDebug("ComposeMail::insertAttendees "); raise(); + QString UID = uid; + if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) { + mPickLineEdit = toLine; + UID = this->name(); + subjectLine->setText( uid.mid( 18 ) ); + } + //qDebug("ccc %s %s ", uid.latin1(), this->name()); if ( mPickLineEdit == 0 ) { //whoami received QString defmail = uidList[0]; if ( emailList.count() == 0 ) QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = emailList.begin(); int pref = 0; for (;sit!=emailList.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(nameList[0]); return; } QString names ; QLineEdit *line = mPickLineEdit; - if (uid == this->name()) + if (UID == this->name()) { for ( int i = 0; i < nameList.count(); i++) { QString _name = nameList[i]; QString _email = emailList[i]; QString _uid = uidList[i]; if ( ! _email.isEmpty() ) { if ( ! names.isEmpty() ) names+= ","; names+= "\""+_name +"\"<" +_email +">"; } } diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index f56711d..e159b73 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -37,29 +37,31 @@ #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) { @@ -129,48 +131,53 @@ void OpieMail::slotwriteMail2(const QString& namemail ) } 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; 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; raise(); } void OpieMail::slotComposeMail() { if ( mPendingEmail == QString::null && mPendingName == QString::null) slotwriteMail2( QString () ); else { if ( mPendingEmail == QString::null ) slotwriteMail2( mPendingName ); else slotwriteMail( mPendingName, mPendingEmail ); @@ -291,28 +298,31 @@ void OpieMail::replyMail() 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; delete settings; } void OpieMail::closeViewMail(ViewMail * vm) { vm->hide(); } void OpieMail::slotDownloadMail( ) { QListViewItem*item = mailView->currentItem(); if (!item ) { @@ -628,14 +638,35 @@ void OpieMail::slotMoveCopyAllMail() void OpieMail::reEditMail() { if (!mailView->currentItem()) return; ComposeMail compose( settings, this, 0, true ); compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); compose.slotAdjustColumns(); #ifndef DESKTOP_VERSION compose.showMaximized(); #else compose.resize(640,480); #endif + mCurrentComposer = &compose; + compose.exec(); + mCurrentComposer = 0; +} + +void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) +{ + + if ( mCurrentComposer ) { + mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); + } else { + ComposeMail compose( settings, this, 0, true ); + compose.slotAdjustColumns(); +#ifndef DESKTOP_VERSION + compose.showMaximized(); +#endif + mCurrentComposer = &compose; + mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); compose.exec(); + mCurrentComposer = 0; + raise(); + } } diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index b8a527f..4f75b3f 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h @@ -1,61 +1,66 @@ // CHANGED 2004-09-31 Lutz Rogowski #ifndef OPIEMAIL_H #define OPIEMAIL_H #include "mainwindow.h" #include <libmailwrapper/settings.h> #include <opie2/osmartpointer.h> #include <libmailwrapper/mailtypes.h> #include <viewmail.h> +#include <qstringlist.h> + +class ComposeMail; class OpieMail : public MainWindow { Q_OBJECT public: OpieMail( QWidget *parent = 0, const char *name = 0 ); virtual ~OpieMail(); static QString appName() { return QString::fromLatin1("kopiemail"); } public slots: virtual void slotwriteMail(const QString&name,const QString&email); virtual void slotwriteMail2(const QString&nameemail); virtual void slotComposeMail(); virtual void slotExtAppHandler(); virtual void appMessage(const QCString &msg, const QByteArray &data); virtual void message(const QCString &msg, const QByteArray &data); + void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); protected slots: virtual void deleteAndDisplayNextMail(ViewMail * vm); virtual void displayNextMail(ViewMail * vm); virtual void slotSendQueued(); virtual void slotSearchMails(); virtual void slotEditSettings(); virtual void slotEditAccounts(); virtual void displayMail(); virtual void replyMail(); virtual void slotDeleteMail(); virtual void slotGetMail(); virtual void slotGetAllMail(); virtual void slotDeleteAllMail(); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void mailLeftClicked( QListViewItem * ); virtual void slotMoveCopyMail(); virtual void slotMoveCopyAllMail(); virtual void reEditMail(); void clearSelection(); void slotDownloadMail(); private: + ComposeMail* mCurrentComposer; void closeViewMail(ViewMail * vm); QString mPendingEmail; QString mPendingName; QByteArray mPendingData; QCString mPendingMessage; Settings *settings; QTextBrowser * tb; }; #endif |