-rw-r--r-- | kmicromail/composemail.cpp | 11 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 62 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 2 |
3 files changed, 47 insertions, 28 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 01dd406..9efa932 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -43,3 +43,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m { - + mPickLineEdit = 0; @@ -52,2 +52,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m QString whoami_uid = config.readEntry( "WhoAmI" ); + if ( whoami_uid.isEmpty() ) { @@ -58,3 +59,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m } else - bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); + ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); + + #ifdef DESKTOP_VERSION @@ -84,3 +87,2 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m attList->addColumn( tr( "Size" ) ); - QList<Account> accounts = settings->getAccounts(); @@ -199,3 +201,3 @@ void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameLis { - qDebug("ComposeMail::insertAttendees "); + //qDebug("ComposeMail::insertAttendees "); raise(); @@ -203,3 +205,2 @@ void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameLis if ( mPickLineEdit == 0 ) { //whoami received - qDebug("returnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn "); QString defmail = uidList[0]; diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 0c581c0..b2119e6 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -13,2 +13,3 @@ #include <qmessagebox.h> +#include <qtimer.h> #include <libkdepim/externalapphandler.h> @@ -50,20 +51,17 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) static int ii = 0; - qDebug("call ############################# %d ", ii); - // block second call - if ( ii < 2 ) { - //++ii; - if ( ii > 1 ) { - qDebug("qcop call blocked "); - //return; - } - } + //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); - QString name, email; - stream >> name >> email; + stream >> mPendingName >> mPendingEmail; // removing the whitespaces at beginning and end is needed! - slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); + QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } @@ -71,3 +69,8 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) { - slotComposeMail(); + //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(); } @@ -75,12 +78,17 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) { + //qDebug(" newMail(QString)"); QDataStream stream(data,IO_ReadOnly); - QString nameemail; - stream >> nameemail; + stream >> mPendingName; // the format is // NAME <EMAIL>:SUBJECT - //qDebug("message %s ", nameemail.latin1()); - - slotwriteMail2( nameemail ); - } else - ExternalAppHandler::instance()->appMessage ( msg, data); + QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); + } else { + if ( ii == 1 ) { + qDebug("Kopiemail::Error:: Initial QCOP call for ExternalAppHandler not supported "); + return; + } + ExternalAppHandler::instance()->appMessage ( msg, data); + } + + //qDebug("END OpieMail::message "); } @@ -88,4 +96,4 @@ void OpieMail::slotwriteMail2(const QString& namemail ) { - // qDebug("OpieMail::slotwriteMail2 "); - qApp->processEvents(); + //qDebug("OpieMail::slotwriteMail2 "); + //qApp->processEvents(); ComposeMail compose( settings, this, 0, true ); @@ -130,2 +138,3 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) compose.exec(); + raise(); } @@ -134,3 +143,10 @@ void OpieMail::slotComposeMail() { - slotwriteMail2( QString () ); + if ( mPendingEmail == QString::null && mPendingName == QString::null) + slotwriteMail2( QString () ); + else { + if ( mPendingEmail == QString::null ) + slotwriteMail2( mPendingName ); + else + slotwriteMail( mPendingName, mPendingEmail ); + } //slotwriteMail(0l,0l); diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 7434e59..1de5f6b 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h @@ -43,2 +43,4 @@ protected slots: private: + QString mPendingEmail; + QString mPendingName; Settings *settings; |