summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp11
-rw-r--r--kmicromail/opiemail.cpp62
-rw-r--r--kmicromail/opiemail.h2
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
@@ -41,7 +41,7 @@
41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
42 : ComposeMailUI( parent, name, modal ) 42 : ComposeMailUI( parent, name, modal )
43{ 43{
44 44
45 mPickLineEdit = 0; 45 mPickLineEdit = 0;
46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
@@ -50,13 +50,16 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
50 KConfig config( locateLocal("config", "kabcrc") ); 50 KConfig config( locateLocal("config", "kabcrc") );
51 config.setGroup( "General" ); 51 config.setGroup( "General" );
52 QString whoami_uid = config.readEntry( "WhoAmI" ); 52 QString whoami_uid = config.readEntry( "WhoAmI" );
53
53 if ( whoami_uid.isEmpty() ) { 54 if ( whoami_uid.isEmpty() ) {
54 QMessageBox::information( 0, tr( "Hint" ), 55 QMessageBox::information( 0, tr( "Hint" ),
55 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
56 tr( "Ok" ) ); 57 tr( "Ok" ) );
57 58
58 } else 59 } else
59 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 60 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
61
62
60#ifdef DESKTOP_VERSION 63#ifdef DESKTOP_VERSION
61 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 64 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
62 QStringList mails = con.emails(); 65 QStringList mails = con.emails();
@@ -82,7 +85,6 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
82 85
83 attList->addColumn( tr( "Name" ) ); 86 attList->addColumn( tr( "Name" ) );
84 attList->addColumn( tr( "Size" ) ); 87 attList->addColumn( tr( "Size" ) );
85
86 QList<Account> accounts = settings->getAccounts(); 88 QList<Account> accounts = settings->getAccounts();
87 89
88 Account *it; 90 Account *it;
@@ -197,11 +199,10 @@ void ComposeMail::pickAddress( )
197//the map includes name/email pairs, that comes from Ka/Pi 199//the map includes name/email pairs, that comes from Ka/Pi
198void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 200void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
199{ 201{
200 qDebug("ComposeMail::insertAttendees "); 202 //qDebug("ComposeMail::insertAttendees ");
201 raise(); 203 raise();
202 204
203 if ( mPickLineEdit == 0 ) { //whoami received 205 if ( mPickLineEdit == 0 ) { //whoami received
204 qDebug("returnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
205 QString defmail = uidList[0]; 206 QString defmail = uidList[0];
206 if ( emailList.count() == 0 ) 207 if ( emailList.count() == 0 )
207 QMessageBox::information( 0, tr( "Hint" ), 208 QMessageBox::information( 0, tr( "Hint" ),
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 0c581c0..b2119e6 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -11,6 +11,7 @@
11#include "selectsmtp.h" 11#include "selectsmtp.h"
12 12
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14#include <qtimer.h>
14#include <libkdepim/externalapphandler.h> 15#include <libkdepim/externalapphandler.h>
15 16
16#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
@@ -48,46 +49,53 @@ void OpieMail::message(const QCString &msg, const QByteArray &data)
48{ 49{
49 // copied from old mail2 50 // copied from old mail2
50 static int ii = 0; 51 static int ii = 0;
51 qDebug("call ############################# %d ", ii); 52 //qDebug("QCOP CALL ############################# %d ", ii);
52 // block second call 53 //QString mess ( msg );
53 if ( ii < 2 ) { 54 //qDebug("Message = %s ",mess.latin1());
54 //++ii;
55 if ( ii > 1 ) {
56 qDebug("qcop call blocked ");
57 //return;
58 }
59 }
60 ++ii; 55 ++ii;
61 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 56 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
57
58 mPendingEmail = QString::null;
59 mPendingName = QString::null;
62 if (msg == "writeMail(QString,QString)") 60 if (msg == "writeMail(QString,QString)")
63 { 61 {
62 //qDebug("writeMail(QString,QString) ");
64 QDataStream stream(data,IO_ReadOnly); 63 QDataStream stream(data,IO_ReadOnly);
65 QString name, email; 64 stream >> mPendingName >> mPendingEmail;
66 stream >> name >> email;
67 // removing the whitespaces at beginning and end is needed! 65 // removing the whitespaces at beginning and end is needed!
68 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 66 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
69 } 67 }
70 else if (msg == "newMail()") 68 else if (msg == "newMail()")
71 { 69 {
72 slotComposeMail(); 70 //qDebug("slotComposeMail() ");
71 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
72 // and a QCOP call does not like a processevents in his execution
73 // with the Qtimer we call slotComposeMail() after we reached the main event loop
74 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
75 // slotComposeMail();
73 } 76 }
74 else if (msg == "newMail(QString)") 77 else if (msg == "newMail(QString)")
75 { 78 {
79 //qDebug(" newMail(QString)");
76 QDataStream stream(data,IO_ReadOnly); 80 QDataStream stream(data,IO_ReadOnly);
77 QString nameemail; 81 stream >> mPendingName;
78 stream >> nameemail;
79 // the format is 82 // the format is
80 // NAME <EMAIL>:SUBJECT 83 // NAME <EMAIL>:SUBJECT
81 //qDebug("message %s ", nameemail.latin1()); 84 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
82 85 } else {
83 slotwriteMail2( nameemail ); 86 if ( ii == 1 ) {
84 } else 87 qDebug("Kopiemail::Error:: Initial QCOP call for ExternalAppHandler not supported ");
85 ExternalAppHandler::instance()->appMessage ( msg, data); 88 return;
89 }
90 ExternalAppHandler::instance()->appMessage ( msg, data);
91 }
92
93 //qDebug("END OpieMail::message ");
86} 94}
87void OpieMail::slotwriteMail2(const QString& namemail ) 95void OpieMail::slotwriteMail2(const QString& namemail )
88{ 96{
89 // qDebug("OpieMail::slotwriteMail2 "); 97 //qDebug("OpieMail::slotwriteMail2 ");
90 qApp->processEvents(); 98 //qApp->processEvents();
91 ComposeMail compose( settings, this, 0, true ); 99 ComposeMail compose( settings, this, 0, true );
92 if ( !namemail.isEmpty() ) { 100 if ( !namemail.isEmpty() ) {
93 QString to = namemail; 101 QString to = namemail;
@@ -128,11 +136,19 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
128 compose.slotAdjustColumns(); 136 compose.slotAdjustColumns();
129 compose.showMaximized(); 137 compose.showMaximized();
130 compose.exec(); 138 compose.exec();
139 raise();
131} 140}
132 141
133void OpieMail::slotComposeMail() 142void OpieMail::slotComposeMail()
134{ 143{
135 slotwriteMail2( QString () ); 144 if ( mPendingEmail == QString::null && mPendingName == QString::null)
145 slotwriteMail2( QString () );
146 else {
147 if ( mPendingEmail == QString::null )
148 slotwriteMail2( mPendingName );
149 else
150 slotwriteMail( mPendingName, mPendingEmail );
151 }
136 //slotwriteMail(0l,0l); 152 //slotwriteMail(0l,0l);
137} 153}
138 154
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 7434e59..1de5f6b 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -41,6 +41,8 @@ protected slots:
41 void clearSelection(); 41 void clearSelection();
42 42
43private: 43private:
44 QString mPendingEmail;
45 QString mPendingName;
44 Settings *settings; 46 Settings *settings;
45 47
46}; 48};