summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp2
-rw-r--r--kmicromail/main.cpp2
-rw-r--r--kmicromail/opiemail.cpp11
3 files changed, 9 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index f7604ad..14feeee 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -172,65 +172,65 @@ void ComposeMail::pickAddress( )
172 //qDebug(" ComposeMail::pickAddress "); 172 //qDebug(" ComposeMail::pickAddress ");
173 QString names ;//= AddressPicker::getNames(); 173 QString names ;//= AddressPicker::getNames();
174 174
175 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 175 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
176 uint i=0; 176 uint i=0;
177 for (i=0; i < list.count(); i++) { 177 for (i=0; i < list.count(); i++) {
178 if ( !list[i].preferredEmail().isEmpty()) { 178 if ( !list[i].preferredEmail().isEmpty()) {
179 if ( ! names.isEmpty() ) 179 if ( ! names.isEmpty() )
180 names+= ","; 180 names+= ",";
181 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 181 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
182 182
183 } 183 }
184 } 184 }
185 185
186 186
187 if ( line->text().isEmpty() ) { 187 if ( line->text().isEmpty() ) {
188 line->setText( names ); 188 line->setText( names );
189 } else if ( !names.isEmpty() ) { 189 } else if ( !names.isEmpty() ) {
190 line->setText( line->text() + ", " + names ); 190 line->setText( line->text() + ", " + names );
191 } 191 }
192#else 192#else
193 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 193 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 194 // the result should now arrive through method insertAttendees
195#endif 195#endif
196} 196}
197//the map includes name/email pairs, that comes from Ka/Pi 197//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) 198void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
199{ 199{
200 qDebug("ComposeMail::insertAttendees "); 200 qDebug("ComposeMail::insertAttendees ");
201 raise(); 201 raise();
202 202
203 if ( mPickLineEdit == 0 ) { //whoami received 203 if ( mPickLineEdit == 0 ) { //whoami received
204 204 qDebug("returnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn ");
205 QString defmail = uidList[0]; 205 QString defmail = uidList[0];
206 if ( emailList.count() == 0 ) 206 if ( emailList.count() == 0 )
207 QMessageBox::information( 0, tr( "Hint" ), 207 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" ), 208 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
209 tr( "Ok" ) ); 209 tr( "Ok" ) );
210 if (defmail.length()!=0) { 210 if (defmail.length()!=0) {
211 fromBox->insertItem(defmail); 211 fromBox->insertItem(defmail);
212 } 212 }
213 QStringList::ConstIterator sit = emailList.begin(); 213 QStringList::ConstIterator sit = emailList.begin();
214 int pref = 0; 214 int pref = 0;
215 for (;sit!=emailList.end();++sit) { 215 for (;sit!=emailList.end();++sit) {
216 if ( (*sit)==defmail) 216 if ( (*sit)==defmail)
217 continue; 217 continue;
218 fromBox->insertItem((*sit)); 218 fromBox->insertItem((*sit));
219 } 219 }
220 senderNameEdit->setText(nameList[0]); 220 senderNameEdit->setText(nameList[0]);
221 return; 221 return;
222 } 222 }
223 QString names ; 223 QString names ;
224 QLineEdit *line = mPickLineEdit; 224 QLineEdit *line = mPickLineEdit;
225 if (uid == this->name()) 225 if (uid == this->name())
226 { 226 {
227 for ( int i = 0; i < nameList.count(); i++) 227 for ( int i = 0; i < nameList.count(); i++)
228 { 228 {
229 QString _name = nameList[i]; 229 QString _name = nameList[i];
230 QString _email = emailList[i]; 230 QString _email = emailList[i];
231 QString _uid = uidList[i]; 231 QString _uid = uidList[i];
232 if ( ! _email.isEmpty() ) { 232 if ( ! _email.isEmpty() ) {
233 if ( ! names.isEmpty() ) 233 if ( ! names.isEmpty() )
234 names+= ","; 234 names+= ",";
235 names+= "\""+_name +"\"<" +_email +">"; 235 names+= "\""+_name +"\"<" +_email +">";
236 } 236 }
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index a3e1b86..65de770 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -18,44 +18,44 @@
18#include <kglobal.h> 18#include <kglobal.h>
19#include <stdio.h> 19#include <stdio.h>
20#include "mainwindow.h" 20#include "mainwindow.h"
21 21
22using namespace Opie::Core; 22using namespace Opie::Core;
23int main( int argc, char **argv ) { 23int main( int argc, char **argv ) {
24 24
25#ifndef DESKTOP_VERSION 25#ifndef DESKTOP_VERSION
26 QPEApplication a( argc, argv ); 26 QPEApplication a( argc, argv );
27 a.setKeepRunning (); 27 a.setKeepRunning ();
28#else 28#else
29 QApplication a( argc, argv ); 29 QApplication a( argc, argv );
30 QApplication::setStyle( new QPlatinumStyle ()); 30 QApplication::setStyle( new QPlatinumStyle ());
31#endif 31#endif
32 32
33 KGlobal::setAppName( "kmicromail" ); 33 KGlobal::setAppName( "kmicromail" );
34 QString fileName ; 34 QString fileName ;
35#ifndef DESKTOP_VERSION 35#ifndef DESKTOP_VERSION
36 fileName = getenv("QPEDIR"); 36 fileName = getenv("QPEDIR");
37 if ( QApplication::desktop()->width() > 320 ) 37 if ( QApplication::desktop()->width() > 320 )
38 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); 38 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/");
39 else 39 else
40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); 40 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/");
41#else 41#else
42 fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; 42 fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/";
43 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 43 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
44#endif 44#endif
45 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); 45 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail")));
46 OpieMail mw; 46 OpieMail mw;
47#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
48 //qDebug("CONNECT "); 48 //qDebug("CONNECT ");
49 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); 49 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
50 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 50 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
51 a.showMainWidget(&mw ); 51 a.showMainWidget(&mw );
52#else 52#else
53 a.setMainWidget(&mw ); 53 a.setMainWidget(&mw );
54 mw.show(); 54 mw.show();
55 //m.resize( 800, 600 ); 55 //m.resize( 800, 600 );
56 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 56 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
57#endif 57#endif
58 int rv = a.exec(); 58 int rv = a.exec();
59 return rv; 59 return rv;
60 60
61} 61}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 3e560c5..a1c5645 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,114 +1,117 @@
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 <libkdepim/externalapphandler.h>
14 15
15#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
16#include <libmailwrapper/smtpwrapper.h> 17#include <libmailwrapper/smtpwrapper.h>
17#include <libmailwrapper/mailtypes.h> 18#include <libmailwrapper/mailtypes.h>
18#include <libmailwrapper/abstractmail.h> 19#include <libmailwrapper/abstractmail.h>
19/* OPIE */ 20/* OPIE */
20//#include <qpe/resource.h> 21//#include <qpe/resource.h>
21//#include <qpe/qpeapplication.h> 22//#include <qpe/qpeapplication.h>
22 23
23/* QT */ 24/* QT */
24 25
25using namespace Opie::Core; 26using namespace Opie::Core;
26 27
27OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 28OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
28 : MainWindow( parent, name) //, WStyle_ContextHelp ) 29 : MainWindow( parent, name) //, WStyle_ContextHelp )
29{ 30{
30 settings = new Settings(); 31 settings = new Settings();
31 32
32 folderView->populate( settings->getAccounts() ); 33 folderView->populate( settings->getAccounts() );
33 34
34} 35}
35 36
36OpieMail::~OpieMail() 37OpieMail::~OpieMail()
37{ 38{
38 if (settings) delete settings; 39 if (settings) delete settings;
39} 40}
40 41
41void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 42void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
42{ 43{
43 44
44} 45}
45#include <stdlib.h> 46#include <stdlib.h>
46void OpieMail::message(const QCString &msg, const QByteArray &data) 47void OpieMail::message(const QCString &msg, const QByteArray &data)
47{ 48{
48 // copied from old mail2 49 // copied from old mail2
49 static int ii = 0; 50 static int ii = 0;
50 51 qDebug("call ############################# %d ", ii);
51 // block second call 52 // block second call
52 if ( ii < 2 ) { 53 if ( ii < 2 ) {
53 ++ii; 54 //++ii;
54 if ( ii > 1 ) { 55 if ( ii > 1 ) {
55 qDebug("qcop call blocked "); 56 qDebug("qcop call blocked ");
56 return; 57 //return;
57 } 58 }
58 } 59 }
60 ++ii;
59 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 61 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
60 if (msg == "writeMail(QString,QString)") 62 if (msg == "writeMail(QString,QString)")
61 { 63 {
62 QDataStream stream(data,IO_ReadOnly); 64 QDataStream stream(data,IO_ReadOnly);
63 QString name, email; 65 QString name, email;
64 stream >> name >> email; 66 stream >> name >> email;
65 // removing the whitespaces at beginning and end is needed! 67 // removing the whitespaces at beginning and end is needed!
66 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 68 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
67 } 69 }
68 else if (msg == "newMail()") 70 else if (msg == "newMail()")
69 { 71 {
70 slotComposeMail(); 72 slotComposeMail();
71 } 73 }
72 else if (msg == "newMail(QString)") 74 else if (msg == "newMail(QString)")
73 { 75 {
74 QDataStream stream(data,IO_ReadOnly); 76 QDataStream stream(data,IO_ReadOnly);
75 QString nameemail; 77 QString nameemail;
76 stream >> nameemail; 78 stream >> nameemail;
77 // the format is 79 // the format is
78 // NAME <EMAIL>:SUBJECT 80 // NAME <EMAIL>:SUBJECT
79 //qDebug("message %s ", nameemail.latin1()); 81 //qDebug("message %s ", nameemail.latin1());
80 82
81 slotwriteMail2( nameemail ); 83 slotwriteMail2( nameemail );
82 } 84 } else
85 ExternalAppHandler::instance()->appMessage ( msg, data);
83} 86}
84void OpieMail::slotwriteMail2(const QString& namemail ) 87void OpieMail::slotwriteMail2(const QString& namemail )
85{ 88{
86 // qDebug("OpieMail::slotwriteMail2 "); 89 // qDebug("OpieMail::slotwriteMail2 ");
87 qApp->processEvents(); 90 qApp->processEvents();
88 ComposeMail compose( settings, this, 0, true ); 91 ComposeMail compose( settings, this, 0, true );
89 if ( !namemail.isEmpty() ) { 92 if ( !namemail.isEmpty() ) {
90 QString to = namemail; 93 QString to = namemail;
91 if ( namemail.find( " <") > 1 ) { 94 if ( namemail.find( " <") > 1 ) {
92 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 95 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
93 } else 96 } else
94 if ( namemail.find( "<") > 1 ) { 97 if ( namemail.find( "<") > 1 ) {
95 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 98 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
96 } 99 }
97 int sub = to.find( ">:"); 100 int sub = to.find( ">:");
98 if ( sub > 0 ) { 101 if ( sub > 0 ) {
99 compose.setTo( to.left(sub+1) ); 102 compose.setTo( to.left(sub+1) );
100 compose.setSubject( to.mid(sub+2) ); 103 compose.setSubject( to.mid(sub+2) );
101 } else 104 } else
102 compose.setTo( to ); 105 compose.setTo( to );
103 } 106 }
104 compose.slotAdjustColumns(); 107 compose.slotAdjustColumns();
105 compose.showMaximized(); 108 compose.showMaximized();
106 compose.exec(); 109 compose.exec();
107 raise(); 110 raise();
108 //qDebug("retttich "); 111 //qDebug("retttich ");
109} 112}
110void OpieMail::slotwriteMail(const QString&name,const QString&email) 113void OpieMail::slotwriteMail(const QString&name,const QString&email)
111{ 114{
112 // qDebug("OpieMail::slotwriteMail "); 115 // qDebug("OpieMail::slotwriteMail ");
113 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 116 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
114 if (!email.isEmpty()) 117 if (!email.isEmpty())