summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-07 22:51:29 (UTC)
committer zautrix <zautrix>2004-09-07 22:51:29 (UTC)
commit2676646d4744ccceab1063dc02d772a26a203c61 (patch) (unidiff)
tree0a0d5261b9a804a29b61a38f68339979051282e2
parent64a8ef1629f523df3006de5cb2b9882a50d96a05 (diff)
downloadkdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.zip
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.gz
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.bz2
Implemented Ompi - kapi connection
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/stdaddressbook.cpp12
-rw-r--r--kaddressbook/kabcore.cpp22
-rw-r--r--kmicromail/composemail.cpp99
-rw-r--r--kmicromail/composemail.h8
-rw-r--r--kmicromail/main.cpp5
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/opiemail.cpp1
-rw-r--r--korganizer/koeventviewer.cpp2
8 files changed, 121 insertions, 30 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 9f38f08..ec47a4e 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -63,11 +63,6 @@ StdAddressBook *StdAddressBook::self()
63 if ( !mSelf ) 63 if ( !mSelf )
64 { 64 {
65 QString appdir = StdAddressBook::setTempAppDir(); 65 QString appdir = StdAddressBook::setTempAppDir();
66 qDebug("****************************************************** ");
67 qDebug("****************************************************** ");
68 qDebug("****************************************************** ");
69 qDebug("****************************************************** ");
70 qDebug("****************************************************** ");
71// US im am not sure why I have to use the other format here?? 66// US im am not sure why I have to use the other format here??
72#ifdef KAB_EMBEDDED 67#ifdef KAB_EMBEDDED
73 mSelf = addressBookDeleter.setObject( new StdAddressBook ); 68 mSelf = addressBookDeleter.setObject( new StdAddressBook );
@@ -103,13 +98,6 @@ StdAddressBook *StdAddressBook::self( bool onlyFastResources )
103 98
104 if ( !mSelf ) 99 if ( !mSelf )
105 { 100 {
106 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
107 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
108 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
109 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
110 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
111 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
112 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
113 QString appdir =StdAddressBook::setTempAppDir(); 101 QString appdir =StdAddressBook::setTempAppDir();
114#ifdef KAB_EMBEDDED 102#ifdef KAB_EMBEDDED
115 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); 103 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2f9f1df..6522ccc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2043,8 +2043,26 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses
2043{ 2043{
2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2045 2045
2046 QString foundUid = QString::null; 2046 QString foundUid = QString::null;
2047 if (uid.isEmpty()) 2047 if ( ! uid.isEmpty() ) {
2048 Addressee adrr = mAddressBook->findByUid( uid );
2049 if ( !adrr.isEmpty() ) {
2050 foundUid = uid;
2051 if ( email == "sendbacklist" ) {
2052 QStringList nameList;
2053 QStringList emailList;
2054 QStringList uidList;
2055 nameList.append(adrr.realName());
2056 emailList = adrr.emails();
2057 uidList.append( adrr.preferredEmail());
2058 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2059 }
2060 }
2061 }
2062
2063 if ( email == "sendback" )
2064 return;
2065 if (foundUid.isEmpty())
2048 { 2066 {
2049 //find the uid of the person first 2067 //find the uid of the person first
2050 Addressee::List namelist; 2068 Addressee::List namelist;
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 654cfc0..5f446fa 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -29,7 +29,11 @@
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 32#ifdef DESKTOP_VERSION
33#include <kabc/addresseedialog.h>
34#else //DESKTOP_VERSION
35#include <libkdepim/externalapphandler.h>
36#endif //DESKTOP_VERSION
33 37
34 38
35//using namespace Opie::Core; 39//using namespace Opie::Core;
@@ -38,8 +42,16 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
38 : ComposeMailUI( parent, name, modal, flags ) 42 : ComposeMailUI( parent, name, modal, flags )
39{ 43{
40 44
45 mPickLineEdit = 0;
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&)));
41 settings = s; 48 settings = s;
42 m_replyid = ""; 49 m_replyid = "";
50 KConfig config( locateLocal("config", "kabcrc") );
51 config.setGroup( "General" );
52 QString whoami_uid = config.readEntry( "WhoAmI" );
53 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
54#ifdef DESKTOP_VERSION
43 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 55 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
44 QStringList mails = con.emails(); 56 QStringList mails = con.emails();
45 QString defmail = con.preferredEmail(); 57 QString defmail = con.preferredEmail();
@@ -57,6 +69,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
57 fromBox->insertItem((*sit)); 69 fromBox->insertItem((*sit));
58 } 70 }
59 senderNameEdit->setText(con.formattedName()); 71 senderNameEdit->setText(con.formattedName());
72#endif
60 Config cfg( "mail" ); 73 Config cfg( "mail" );
61 cfg.setGroup( "Compose" ); 74 cfg.setGroup( "Compose" );
62 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 75 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
@@ -91,9 +104,12 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
91 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 104 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
92 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 105 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
93 mMail = 0; 106 mMail = 0;
94 warnAttach = true; 107 warnAttach = true;
95 108
96} 109}
110
111
112
97void ComposeMail::saveAsDraft() 113void ComposeMail::saveAsDraft()
98{ 114{
99 115
@@ -140,8 +156,13 @@ void ComposeMail::setStatus( QString status )
140 topLevelWidget()->setCaption( status ); 156 topLevelWidget()->setCaption( status );
141 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 157 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
142} 158}
143void ComposeMail::pickAddress( QLineEdit *line ) 159void ComposeMail::pickAddress( )
144{ 160{
161
162 QLineEdit *line = mPickLineEdit;
163 if ( line == 0 )
164 return;
165#ifdef DESKTOP_VERSION
145 //qDebug(" ComposeMail::pickAddress "); 166 //qDebug(" ComposeMail::pickAddress ");
146 QString names ;//= AddressPicker::getNames(); 167 QString names ;//= AddressPicker::getNames();
147 168
@@ -149,9 +170,10 @@ void ComposeMail::pickAddress( QLineEdit *line )
149 uint i=0; 170 uint i=0;
150 for (i=0; i < list.count(); i++) { 171 for (i=0; i < list.count(); i++) {
151 if ( !list[i].preferredEmail().isEmpty()) { 172 if ( !list[i].preferredEmail().isEmpty()) {
152 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 173 if ( ! names.isEmpty() )
153 if ( i < list.count() -1 )
154 names+= ","; 174 names+= ",";
175 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
176
155 } 177 }
156 } 178 }
157 179
@@ -161,8 +183,59 @@ void ComposeMail::pickAddress( QLineEdit *line )
161 } else if ( !names.isEmpty() ) { 183 } else if ( !names.isEmpty() ) {
162 line->setText( line->text() + ", " + names ); 184 line->setText( line->text() + ", " + names );
163 } 185 }
186#else
187 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
188 // the result should now arrive through method insertAttendees
189#endif
190}
191//the map includes name/email pairs, that comes from Ka/Pi
192void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
193{
194 qDebug("ComposeMail::insertAttendees ");
195 raise();
196
197 if ( mPickLineEdit == 0 ) { //whoami received
198
199 QString defmail = uidList[0];
200 if ( emailList.count() == 0 )
201 QMessageBox::information( 0, tr( "Hint" ),
202 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
203 tr( "Ok" ) );
204 if (defmail.length()!=0) {
205 fromBox->insertItem(defmail);
206 }
207 QStringList::ConstIterator sit = emailList.begin();
208 int pref = 0;
209 for (;sit!=emailList.end();++sit) {
210 if ( (*sit)==defmail)
211 continue;
212 fromBox->insertItem((*sit));
213 }
214 senderNameEdit->setText(nameList[0]);
215 return;
216 }
217 QString names ;
218 QLineEdit *line = mPickLineEdit;
219 if (uid == this->name())
220 {
221 for ( int i = 0; i < nameList.count(); i++)
222 {
223 QString _name = nameList[i];
224 QString _email = emailList[i];
225 QString _uid = uidList[i];
226 if ( ! _email.isEmpty() ) {
227 if ( ! names.isEmpty() )
228 names+= ",";
229 names+= "\""+_name +"\"<" +_email +">";
230 }
231 }
232 }
233 if ( line->text().isEmpty() ) {
234 line->setText( names );
235 } else if ( !names.isEmpty() ) {
236 line->setText( line->text() + ", " + names );
237 }
164} 238}
165
166 239
167void ComposeMail::setTo( const QString & to ) 240void ComposeMail::setTo( const QString & to )
168{ 241{
@@ -187,22 +260,26 @@ void ComposeMail::setMessage( const QString & text )
187 260
188void ComposeMail::pickAddressTo() 261void ComposeMail::pickAddressTo()
189{ 262{
190 pickAddress( toLine ); 263 mPickLineEdit = toLine;
264 pickAddress( );
191} 265}
192 266
193void ComposeMail::pickAddressCC() 267void ComposeMail::pickAddressCC()
194{ 268{
195 pickAddress( ccLine ); 269 mPickLineEdit = ccLine;
270 pickAddress( );
196} 271}
197 272
198void ComposeMail::pickAddressBCC() 273void ComposeMail::pickAddressBCC()
199{ 274{
200 pickAddress( bccLine ); 275 mPickLineEdit = bccLine;
276 pickAddress( );
201} 277}
202 278
203void ComposeMail::pickAddressReply() 279void ComposeMail::pickAddressReply()
204{ 280{
205 pickAddress( replyLine ); 281 mPickLineEdit = replyLine;
282 pickAddress( );
206} 283}
207 284
208void ComposeMail::fillValues( int ) 285void ComposeMail::fillValues( int )
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 876b597..657f665 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -34,6 +34,7 @@ class ComposeMail : public ComposeMailUI
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37
37 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 38 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
38 virtual ~ComposeMail(); 39 virtual ~ComposeMail();
39 40
@@ -45,7 +46,9 @@ public slots:
45 void setTo( const QString & to ); 46 void setTo( const QString & to );
46 void setSubject( const QString & subject ); 47 void setSubject( const QString & subject );
47 void setInReplyTo( const QString & messageId ); 48 void setInReplyTo( const QString & messageId );
48 void setMessage( const QString & text ); 49 void setMessage( const QString & text );
50 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
51
49 52
50protected slots: 53protected slots:
51 void accept(); 54 void accept();
@@ -53,7 +56,7 @@ protected slots:
53 56
54private slots: 57private slots:
55 void fillValues( int current ); 58 void fillValues( int current );
56 void pickAddress( QLineEdit *line ); 59 void pickAddress();
57 void pickAddressTo(); 60 void pickAddressTo();
58 void pickAddressCC(); 61 void pickAddressCC();
59 void pickAddressBCC(); 62 void pickAddressBCC();
@@ -65,6 +68,7 @@ private slots:
65 void setStatus( QString ); 68 void setStatus( QString );
66 69
67protected: 70protected:
71 QLineEdit* mPickLineEdit;
68 Opie::Core::OSmartPointer<Mail> mMail; 72 Opie::Core::OSmartPointer<Mail> mMail;
69 Settings *settings; 73 Settings *settings;
70 QList<SMTPaccount> smtpAccounts; 74 QList<SMTPaccount> smtpAccounts;
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 22f1200..a3e1b86 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,7 +1,9 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3
3#ifndef DESKTOP_VERSION 4#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <libkdepim/externalapphandler.h>
5#include <stdlib.h> 7#include <stdlib.h>
6#else 8#else
7#include <qapplication.h> 9#include <qapplication.h>
@@ -44,7 +46,8 @@ int main( int argc, char **argv ) {
44 OpieMail mw; 46 OpieMail mw;
45#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
46 //qDebug("CONNECT "); 48 //qDebug("CONNECT ");
47 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 & )));
48 a.showMainWidget(&mw ); 51 a.showMainWidget(&mw );
49#else 52#else
50 a.setMainWidget(&mw ); 53 a.setMainWidget(&mw );
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 704a9ab..6df95c6 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -24,7 +24,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
24{ 24{
25 setCaption( tr( "KOpieMail/Pi" ) ); 25 setCaption( tr( "KOpieMail/Pi" ) );
26 setToolBarsMovable( false ); 26 setToolBarsMovable( false );
27 KABC::StdAddressBook::self(); 27 //KABC::StdAddressBook::self();
28 toolBar = new QToolBar( this ); 28 toolBar = new QToolBar( this );
29 menuBar = new QMenuBar( toolBar ); 29 menuBar = new QMenuBar( toolBar );
30 mailMenu = new QPopupMenu( menuBar ); 30 mailMenu = new QPopupMenu( menuBar );
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 251f15a..3e560c5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -104,6 +104,7 @@ void OpieMail::slotwriteMail2(const QString& namemail )
104 compose.slotAdjustColumns(); 104 compose.slotAdjustColumns();
105 compose.showMaximized(); 105 compose.showMaximized();
106 compose.exec(); 106 compose.exec();
107 raise();
107 //qDebug("retttich "); 108 //qDebug("retttich ");
108} 109}
109void OpieMail::slotwriteMail(const QString&name,const QString&email) 110void OpieMail::slotwriteMail(const QString&name,const QString&email)
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 0866939..2f538c4 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -109,7 +109,7 @@ void KOEventViewer::setSource(const QString& n)
109 Attendee *a; 109 Attendee *a;
110 for(a=attendees.first();a;a=attendees.next()) { 110 for(a=attendees.first();a;a=attendees.next()) {
111 if ( "uid:"+a->uid() == n ) { 111 if ( "uid:"+a->uid() == n ) {
112 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), ""); 112 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
113 return; 113 return;
114 } 114 }
115 } 115 }