author | zautrix <zautrix> | 2004-09-08 11:34:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-08 11:34:38 (UTC) |
commit | 1fcec858408b88bb412af18fbf853b49b6970d8a (patch) (side-by-side diff) | |
tree | 702e94a74f0bb90335b9b193d28e31c1dc392c03 | |
parent | cdff4506a9148c47406af86968da73c0dbfca0ba (diff) | |
download | kdepimpi-1fcec858408b88bb412af18fbf853b49b6970d8a.zip kdepimpi-1fcec858408b88bb412af18fbf853b49b6970d8a.tar.gz kdepimpi-1fcec858408b88bb412af18fbf853b49b6970d8a.tar.bz2 |
Fixed QCOP call problem of kopiemail
-rw-r--r-- | kaddressbook/kabcore.cpp | 4 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 9 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 56 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 2 |
4 files changed, 45 insertions, 26 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d1d385c..74e5cf7 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2063,5 +2063,5 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses } if ( email == "sendbacklist" ) { - qDebug("ssssssssssssssssssssssend "); + //qDebug("ssssssssssssssssssssssend "); QStringList nameList; QStringList emailList; @@ -2076,5 +2076,5 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses } - if ( email == "sendback" ) + if ( email == "sendbacklist" ) return; if (foundUid.isEmpty()) diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 01dd406..9efa932 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -51,4 +51,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m config.setGroup( "General" ); QString whoami_uid = config.readEntry( "WhoAmI" ); + if ( whoami_uid.isEmpty() ) { QMessageBox::information( 0, tr( "Hint" ), @@ -57,5 +58,7 @@ 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 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); @@ -83,5 +86,4 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m attList->addColumn( tr( "Name" ) ); attList->addColumn( tr( "Size" ) ); - QList<Account> accounts = settings->getAccounts(); @@ -198,9 +200,8 @@ void ComposeMail::pickAddress( ) void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) { - qDebug("ComposeMail::insertAttendees "); + //qDebug("ComposeMail::insertAttendees "); raise(); if ( mPickLineEdit == 0 ) { //whoami received - qDebug("returnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn "); QString defmail = uidList[0]; if ( emailList.count() == 0 ) diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 0c581c0..b2119e6 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -12,4 +12,5 @@ #include <qmessagebox.h> +#include <qtimer.h> #include <libkdepim/externalapphandler.h> @@ -49,44 +50,51 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) // copied from old mail2 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() ) ); } else if (msg == "newMail()") { - 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(); } else if (msg == "newMail(QString)") { + //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 + 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 "); +} void OpieMail::slotwriteMail2(const QString& namemail ) { // qDebug("OpieMail::slotwriteMail2 "); - qApp->processEvents(); + //qApp->processEvents(); ComposeMail compose( settings, this, 0, true ); if ( !namemail.isEmpty() ) { @@ -129,9 +137,17 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) compose.showMaximized(); compose.exec(); + raise(); } void OpieMail::slotComposeMail() { + 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 @@ -42,4 +42,6 @@ protected slots: private: + QString mPendingEmail; + QString mPendingName; Settings *settings; |