summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp4
-rw-r--r--kmicromail/composemail.cpp11
-rw-r--r--kmicromail/opiemail.cpp62
-rw-r--r--kmicromail/opiemail.h2
4 files changed, 49 insertions, 30 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d1d385c..74e5cf7 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2041,62 +2041,62 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt
2041 for (i=0; i < list.count(); i++) 2041 for (i=0; i < list.count(); i++)
2042 { 2042 {
2043 nameList.append(list[i].realName()); 2043 nameList.append(list[i].realName());
2044 emailList.append(list[i].preferredEmail()); 2044 emailList.append(list[i].preferredEmail());
2045 uidList.append(list[i].uid()); 2045 uidList.append(list[i].uid());
2046 } 2046 }
2047 2047
2048 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2048 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2049 2049
2050} 2050}
2051 2051
2052/* this method will be called through the QCop interface from other apps to show details of a contact. 2052/* this method will be called through the QCop interface from other apps to show details of a contact.
2053 */ 2053 */
2054void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2054void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2055{ 2055{
2056 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2056 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2057 2057
2058 QString foundUid = QString::null; 2058 QString foundUid = QString::null;
2059 if ( ! uid.isEmpty() ) { 2059 if ( ! uid.isEmpty() ) {
2060 Addressee adrr = mAddressBook->findByUid( uid ); 2060 Addressee adrr = mAddressBook->findByUid( uid );
2061 if ( !adrr.isEmpty() ) { 2061 if ( !adrr.isEmpty() ) {
2062 foundUid = uid; 2062 foundUid = uid;
2063 } 2063 }
2064 if ( email == "sendbacklist" ) { 2064 if ( email == "sendbacklist" ) {
2065 qDebug("ssssssssssssssssssssssend "); 2065 //qDebug("ssssssssssssssssssssssend ");
2066 QStringList nameList; 2066 QStringList nameList;
2067 QStringList emailList; 2067 QStringList emailList;
2068 QStringList uidList; 2068 QStringList uidList;
2069 nameList.append(adrr.realName()); 2069 nameList.append(adrr.realName());
2070 emailList = adrr.emails(); 2070 emailList = adrr.emails();
2071 uidList.append( adrr.preferredEmail()); 2071 uidList.append( adrr.preferredEmail());
2072 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2072 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2073 return; 2073 return;
2074 } 2074 }
2075 2075
2076 } 2076 }
2077 2077
2078 if ( email == "sendback" ) 2078 if ( email == "sendbacklist" )
2079 return; 2079 return;
2080 if (foundUid.isEmpty()) 2080 if (foundUid.isEmpty())
2081 { 2081 {
2082 //find the uid of the person first 2082 //find the uid of the person first
2083 Addressee::List namelist; 2083 Addressee::List namelist;
2084 Addressee::List emaillist; 2084 Addressee::List emaillist;
2085 2085
2086 if (!name.isEmpty()) 2086 if (!name.isEmpty())
2087 namelist = mAddressBook->findByName( name ); 2087 namelist = mAddressBook->findByName( name );
2088 2088
2089 if (!email.isEmpty()) 2089 if (!email.isEmpty())
2090 emaillist = mAddressBook->findByEmail( email ); 2090 emaillist = mAddressBook->findByEmail( email );
2091 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2091 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2092 //check if we have a match in Namelist and Emaillist 2092 //check if we have a match in Namelist and Emaillist
2093 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2093 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2094 foundUid = emaillist[0].uid(); 2094 foundUid = emaillist[0].uid();
2095 } 2095 }
2096 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2096 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2097 foundUid = namelist[0].uid(); 2097 foundUid = namelist[0].uid();
2098 else 2098 else
2099 { 2099 {
2100 for (int i = 0; i < namelist.count(); i++) 2100 for (int i = 0; i < namelist.count(); i++)
2101 { 2101 {
2102 for (int j = 0; j < emaillist.count(); j++) 2102 for (int j = 0; j < emaillist.count(); j++)
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 01dd406..9efa932 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -20,90 +20,92 @@
20#include <qcombobox.h> 20#include <qcombobox.h>
21#include <qcheckbox.h> 21#include <qcheckbox.h>
22#include <qtimer.h> 22#include <qtimer.h>
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25#include <qmultilineedit.h> 25#include <qmultilineedit.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qtabwidget.h> 27#include <qtabwidget.h>
28#include <qlistview.h> 28#include <qlistview.h>
29#include <kabc/addresseedialog.h> 29#include <kabc/addresseedialog.h>
30#include <kabc/stdaddressbook.h> 30#include <kabc/stdaddressbook.h>
31#include <kabc/addressee.h> 31#include <kabc/addressee.h>
32#ifdef DESKTOP_VERSION 32#ifdef DESKTOP_VERSION
33#include <kabc/addresseedialog.h> 33#include <kabc/addresseedialog.h>
34#else //DESKTOP_VERSION 34#else //DESKTOP_VERSION
35#include <libkdepim/externalapphandler.h> 35#include <libkdepim/externalapphandler.h>
36#endif //DESKTOP_VERSION 36#endif //DESKTOP_VERSION
37 37
38 38
39//using namespace Opie::Core; 39//using namespace Opie::Core;
40//using namespace Opie::Ui; 40//using namespace Opie::Ui;
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&)));
48 settings = s; 48 settings = s;
49 m_replyid = ""; 49 m_replyid = "";
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();
63 QString defmail = con.preferredEmail(); 66 QString defmail = con.preferredEmail();
64 if ( mails.count() == 0) 67 if ( mails.count() == 0)
65 QMessageBox::information( 0, tr( "Hint" ), 68 QMessageBox::information( 0, tr( "Hint" ),
66 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 69 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
67 tr( "Ok" ) ); 70 tr( "Ok" ) );
68 if (defmail.length()!=0) { 71 if (defmail.length()!=0) {
69 fromBox->insertItem(defmail); 72 fromBox->insertItem(defmail);
70 } 73 }
71 QStringList::ConstIterator sit = mails.begin(); 74 QStringList::ConstIterator sit = mails.begin();
72 for (;sit!=mails.end();++sit) { 75 for (;sit!=mails.end();++sit) {
73 if ( (*sit)==defmail) 76 if ( (*sit)==defmail)
74 continue; 77 continue;
75 fromBox->insertItem((*sit)); 78 fromBox->insertItem((*sit));
76 } 79 }
77 senderNameEdit->setText(con.formattedName()); 80 senderNameEdit->setText(con.formattedName());
78#endif 81#endif
79 Config cfg( "mail" ); 82 Config cfg( "mail" );
80 cfg.setGroup( "Compose" ); 83 cfg.setGroup( "Compose" );
81 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 84 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
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;
89 for ( it = accounts.first(); it; it = accounts.next() ) { 91 for ( it = accounts.first(); it; it = accounts.next() ) {
90 if ( it->getType()==MAILLIB::A_SMTP ) { 92 if ( it->getType()==MAILLIB::A_SMTP ) {
91 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 93 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
92 smtpAccountBox->insertItem( smtp->getAccountName() ); 94 smtpAccountBox->insertItem( smtp->getAccountName() );
93 smtpAccounts.append( smtp ); 95 smtpAccounts.append( smtp );
94 } 96 }
95 } 97 }
96 if ( smtpAccounts.count() > 0 ) { 98 if ( smtpAccounts.count() > 0 ) {
97 fillValues( smtpAccountBox->currentItem() ); 99 fillValues( smtpAccountBox->currentItem() );
98 } else { 100 } else {
99 QMessageBox::information( 0, tr( "Problem" ), 101 QMessageBox::information( 0, tr( "Problem" ),
100 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 102 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
101 tr( "Ok" ) ); 103 tr( "Ok" ) );
102 return; 104 return;
103 } 105 }
104 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 106 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
105 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 107 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
106 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 108 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
107 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 109 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
108 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 110 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
109 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 111 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
@@ -176,53 +178,52 @@ void ComposeMail::pickAddress( )
176 uint i=0; 178 uint i=0;
177 for (i=0; i < list.count(); i++) { 179 for (i=0; i < list.count(); i++) {
178 if ( !list[i].preferredEmail().isEmpty()) { 180 if ( !list[i].preferredEmail().isEmpty()) {
179 if ( ! names.isEmpty() ) 181 if ( ! names.isEmpty() )
180 names+= ","; 182 names+= ",";
181 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 183 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
182 184
183 } 185 }
184 } 186 }
185 187
186 188
187 if ( line->text().isEmpty() ) { 189 if ( line->text().isEmpty() ) {
188 line->setText( names ); 190 line->setText( names );
189 } else if ( !names.isEmpty() ) { 191 } else if ( !names.isEmpty() ) {
190 line->setText( line->text() + ", " + names ); 192 line->setText( line->text() + ", " + names );
191 } 193 }
192#else 194#else
193 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 195 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
194 // the result should now arrive through method insertAttendees 196 // the result should now arrive through method insertAttendees
195#endif 197#endif
196} 198}
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" ),
208 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 209 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
209 tr( "Ok" ) ); 210 tr( "Ok" ) );
210 if (defmail.length()!=0) { 211 if (defmail.length()!=0) {
211 fromBox->insertItem(defmail); 212 fromBox->insertItem(defmail);
212 } 213 }
213 QStringList::ConstIterator sit = emailList.begin(); 214 QStringList::ConstIterator sit = emailList.begin();
214 int pref = 0; 215 int pref = 0;
215 for (;sit!=emailList.end();++sit) { 216 for (;sit!=emailList.end();++sit) {
216 if ( (*sit)==defmail) 217 if ( (*sit)==defmail)
217 continue; 218 continue;
218 fromBox->insertItem((*sit)); 219 fromBox->insertItem((*sit));
219 } 220 }
220 senderNameEdit->setText(nameList[0]); 221 senderNameEdit->setText(nameList[0]);
221 return; 222 return;
222 } 223 }
223 QString names ; 224 QString names ;
224 QLineEdit *line = mPickLineEdit; 225 QLineEdit *line = mPickLineEdit;
225 if (uid == this->name()) 226 if (uid == this->name())
226 { 227 {
227 for ( int i = 0; i < nameList.count(); i++) 228 for ( int i = 0; i < nameList.count(); i++)
228 { 229 {
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 0c581c0..b2119e6 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,159 +1,175 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "settingsdialog.h" 4#include "settingsdialog.h"
5#include "opiemail.h" 5#include "opiemail.h"
6#include "editaccounts.h" 6#include "editaccounts.h"
7#include "composemail.h" 7#include "composemail.h"
8#include "mailistviewitem.h" 8#include "mailistviewitem.h"
9#include "viewmail.h" 9#include "viewmail.h"
10#include "selectstore.h" 10#include "selectstore.h"
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>
17#include <libmailwrapper/smtpwrapper.h> 18#include <libmailwrapper/smtpwrapper.h>
18#include <libmailwrapper/mailtypes.h> 19#include <libmailwrapper/mailtypes.h>
19#include <libmailwrapper/abstractmail.h> 20#include <libmailwrapper/abstractmail.h>
20/* OPIE */ 21/* OPIE */
21//#include <qpe/resource.h> 22//#include <qpe/resource.h>
22//#include <qpe/qpeapplication.h> 23//#include <qpe/qpeapplication.h>
23 24
24/* QT */ 25/* QT */
25 26
26//using namespace Opie::Core; 27//using namespace Opie::Core;
27 28
28OpieMail::OpieMail( QWidget *parent, const char *name ) 29OpieMail::OpieMail( QWidget *parent, const char *name )
29 : MainWindow( parent, name) //, WStyle_ContextHelp ) 30 : MainWindow( parent, name) //, WStyle_ContextHelp )
30{ 31{
31 settings = new Settings(); 32 settings = new Settings();
32 33
33 folderView->populate( settings->getAccounts() ); 34 folderView->populate( settings->getAccounts() );
34 35
35} 36}
36 37
37OpieMail::~OpieMail() 38OpieMail::~OpieMail()
38{ 39{
39 if (settings) delete settings; 40 if (settings) delete settings;
40} 41}
41 42
42void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 43void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
43{ 44{
44 45
45} 46}
46#include <stdlib.h> 47#include <stdlib.h>
47void OpieMail::message(const QCString &msg, const QByteArray &data) 48void 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;
94 if ( namemail.find( " <") > 1 ) { 102 if ( namemail.find( " <") > 1 ) {
95 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 103 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
96 } else 104 } else
97 if ( namemail.find( "<") > 1 ) { 105 if ( namemail.find( "<") > 1 ) {
98 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 106 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
99 } 107 }
100 int sub = to.find( ">:"); 108 int sub = to.find( ">:");
101 if ( sub > 0 ) { 109 if ( sub > 0 ) {
102 compose.setTo( to.left(sub+1) ); 110 compose.setTo( to.left(sub+1) );
103 compose.setSubject( to.mid(sub+2) ); 111 compose.setSubject( to.mid(sub+2) );
104 } else 112 } else
105 compose.setTo( to ); 113 compose.setTo( to );
106 } 114 }
107 compose.slotAdjustColumns(); 115 compose.slotAdjustColumns();
108 compose.showMaximized(); 116 compose.showMaximized();
109 compose.exec(); 117 compose.exec();
110 raise(); 118 raise();
111 //qDebug("retttich "); 119 //qDebug("retttich ");
112} 120}
113void OpieMail::slotwriteMail(const QString&name,const QString&email) 121void OpieMail::slotwriteMail(const QString&name,const QString&email)
114{ 122{
115 // qDebug("OpieMail::slotwriteMail "); 123 // qDebug("OpieMail::slotwriteMail ");
116 ComposeMail compose( settings, this, 0, true ); 124 ComposeMail compose( settings, this, 0, true );
117 if (!email.isEmpty()) 125 if (!email.isEmpty())
118 { 126 {
119 if (!name.isEmpty()) 127 if (!name.isEmpty())
120 { 128 {
121 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 129 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
122 } 130 }
123 else 131 else
124 { 132 {
125 compose.setTo(email); 133 compose.setTo(email);
126 } 134 }
127 } 135 }
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
139void OpieMail::slotSendQueued() 155void OpieMail::slotSendQueued()
140{ 156{
141 SMTPaccount *smtp = 0; 157 SMTPaccount *smtp = 0;
142 158
143 QList<Account> list = settings->getAccounts(); 159 QList<Account> list = settings->getAccounts();
144 QList<SMTPaccount> smtpList; 160 QList<SMTPaccount> smtpList;
145 smtpList.setAutoDelete(false); 161 smtpList.setAutoDelete(false);
146 Account *it; 162 Account *it;
147 for ( it = list.first(); it; it = list.next() ) 163 for ( it = list.first(); it; it = list.next() )
148 { 164 {
149 if ( it->getType() == MAILLIB::A_SMTP ) 165 if ( it->getType() == MAILLIB::A_SMTP )
150 { 166 {
151 smtp = static_cast<SMTPaccount *>(it); 167 smtp = static_cast<SMTPaccount *>(it);
152 smtpList.append(smtp); 168 smtpList.append(smtp);
153 } 169 }
154 } 170 }
155 if (smtpList.count()==0) 171 if (smtpList.count()==0)
156 { 172 {
157 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 173 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
158 return; 174 return;
159 } 175 }
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index 7434e59..1de5f6b 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -20,29 +20,31 @@ public:
20public slots: 20public slots:
21 virtual void slotwriteMail(const QString&name,const QString&email); 21 virtual void slotwriteMail(const QString&name,const QString&email);
22 virtual void slotwriteMail2(const QString&nameemail); 22 virtual void slotwriteMail2(const QString&nameemail);
23 virtual void slotComposeMail(); 23 virtual void slotComposeMail();
24 virtual void appMessage(const QCString &msg, const QByteArray &data); 24 virtual void appMessage(const QCString &msg, const QByteArray &data);
25 virtual void message(const QCString &msg, const QByteArray &data); 25 virtual void message(const QCString &msg, const QByteArray &data);
26protected slots: 26protected slots:
27 virtual void slotSendQueued(); 27 virtual void slotSendQueued();
28 virtual void slotSearchMails(); 28 virtual void slotSearchMails();
29 virtual void slotEditSettings(); 29 virtual void slotEditSettings();
30 virtual void slotEditAccounts(); 30 virtual void slotEditAccounts();
31 virtual void displayMail(); 31 virtual void displayMail();
32 virtual void slotDeleteMail(); 32 virtual void slotDeleteMail();
33 virtual void slotDeleteAllMail(); 33 virtual void slotDeleteAllMail();
34 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 34 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
35 virtual void slotShowFolders( bool show ); 35 virtual void slotShowFolders( bool show );
36 virtual void refreshMailView(const QValueList<RecMailP>&); 36 virtual void refreshMailView(const QValueList<RecMailP>&);
37 virtual void mailLeftClicked( QListViewItem * ); 37 virtual void mailLeftClicked( QListViewItem * );
38 virtual void slotMoveCopyMail(); 38 virtual void slotMoveCopyMail();
39 virtual void slotMoveCopyAllMail(); 39 virtual void slotMoveCopyAllMail();
40 virtual void reEditMail(); 40 virtual void reEditMail();
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};
47 49
48#endif 50#endif