-rw-r--r-- | kabc/stdaddressbook.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 20 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 93 | ||||
-rw-r--r-- | kmicromail/composemail.h | 6 | ||||
-rw-r--r-- | kmicromail/main.cpp | 3 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 2 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 1 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 2 |
8 files changed, 115 insertions, 24 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 9f38f08..ec47a4e 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp @@ -64,9 +64,4 @@ StdAddressBook *StdAddressBook::self() { QString appdir = StdAddressBook::setTempAppDir(); - qDebug("****************************************************** "); - qDebug("****************************************************** "); - qDebug("****************************************************** "); - qDebug("****************************************************** "); - qDebug("****************************************************** "); // US im am not sure why I have to use the other format here?? #ifdef KAB_EMBEDDED @@ -104,11 +99,4 @@ StdAddressBook *StdAddressBook::self( bool onlyFastResources ) if ( !mSelf ) { - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); - qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); QString appdir =StdAddressBook::setTempAppDir(); #ifdef KAB_EMBEDDED diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2f9f1df..6522ccc 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2045,5 +2045,23 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses QString foundUid = QString::null; - if (uid.isEmpty()) + if ( ! uid.isEmpty() ) { + Addressee adrr = mAddressBook->findByUid( uid ); + if ( !adrr.isEmpty() ) { + foundUid = uid; + if ( email == "sendbacklist" ) { + QStringList nameList; + QStringList emailList; + QStringList uidList; + nameList.append(adrr.realName()); + emailList = adrr.emails(); + uidList.append( adrr.preferredEmail()); + bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); + } + } + } + + if ( email == "sendback" ) + return; + if (foundUid.isEmpty()) { //find the uid of the person first diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 654cfc0..5f446fa 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -30,5 +30,9 @@ #include <kabc/stdaddressbook.h> #include <kabc/addressee.h> - +#ifdef DESKTOP_VERSION +#include <kabc/addresseedialog.h> +#else //DESKTOP_VERSION +#include <libkdepim/externalapphandler.h> +#endif //DESKTOP_VERSION @@ -39,6 +43,14 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m { + mPickLineEdit = 0; + connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), + this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); settings = s; m_replyid = ""; + KConfig config( locateLocal("config", "kabcrc") ); + config.setGroup( "General" ); + QString whoami_uid = config.readEntry( "WhoAmI" ); + bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); +#ifdef DESKTOP_VERSION KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); QStringList mails = con.emails(); @@ -58,4 +70,5 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m } senderNameEdit->setText(con.formattedName()); +#endif Config cfg( "mail" ); cfg.setGroup( "Compose" ); @@ -95,4 +108,7 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m } + + + void ComposeMail::saveAsDraft() { @@ -141,6 +157,11 @@ void ComposeMail::setStatus( QString status ) QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; } -void ComposeMail::pickAddress( QLineEdit *line ) +void ComposeMail::pickAddress( ) { + + QLineEdit *line = mPickLineEdit; + if ( line == 0 ) + return; +#ifdef DESKTOP_VERSION //qDebug(" ComposeMail::pickAddress "); QString names ;//= AddressPicker::getNames(); @@ -150,7 +171,8 @@ void ComposeMail::pickAddress( QLineEdit *line ) for (i=0; i < list.count(); i++) { if ( !list[i].preferredEmail().isEmpty()) { - names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; - if ( i < list.count() -1 ) + if ( ! names.isEmpty() ) names+= ","; + names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; + } } @@ -162,6 +184,57 @@ void ComposeMail::pickAddress( QLineEdit *line ) line->setText( line->text() + ", " + names ); } +#else + bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); + // the result should now arrive through method insertAttendees +#endif } +//the map includes name/email pairs, that comes from Ka/Pi +void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) +{ + qDebug("ComposeMail::insertAttendees "); + raise(); + if ( mPickLineEdit == 0 ) { //whoami received + + QString defmail = uidList[0]; + if ( emailList.count() == 0 ) + QMessageBox::information( 0, tr( "Hint" ), + tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), + tr( "Ok" ) ); + if (defmail.length()!=0) { + fromBox->insertItem(defmail); + } + QStringList::ConstIterator sit = emailList.begin(); + int pref = 0; + for (;sit!=emailList.end();++sit) { + if ( (*sit)==defmail) + continue; + fromBox->insertItem((*sit)); + } + senderNameEdit->setText(nameList[0]); + return; + } + QString names ; + QLineEdit *line = mPickLineEdit; + if (uid == this->name()) + { + for ( int i = 0; i < nameList.count(); i++) + { + QString _name = nameList[i]; + QString _email = emailList[i]; + QString _uid = uidList[i]; + if ( ! _email.isEmpty() ) { + if ( ! names.isEmpty() ) + names+= ","; + names+= "\""+_name +"\"<" +_email +">"; + } + } + } + if ( line->text().isEmpty() ) { + line->setText( names ); + } else if ( !names.isEmpty() ) { + line->setText( line->text() + ", " + names ); + } +} void ComposeMail::setTo( const QString & to ) @@ -188,20 +261,24 @@ void ComposeMail::setMessage( const QString & text ) void ComposeMail::pickAddressTo() { - pickAddress( toLine ); + mPickLineEdit = toLine; + pickAddress( ); } void ComposeMail::pickAddressCC() { - pickAddress( ccLine ); + mPickLineEdit = ccLine; + pickAddress( ); } void ComposeMail::pickAddressBCC() { - pickAddress( bccLine ); + mPickLineEdit = bccLine; + pickAddress( ); } void ComposeMail::pickAddressReply() { - pickAddress( replyLine ); + mPickLineEdit = replyLine; + pickAddress( ); } diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 876b597..657f665 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h @@ -35,4 +35,5 @@ class ComposeMail : public ComposeMailUI public: + ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); virtual ~ComposeMail(); @@ -47,4 +48,6 @@ public slots: void setInReplyTo( const QString & messageId ); void setMessage( const QString & text ); + void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); + protected slots: @@ -54,5 +57,5 @@ protected slots: private slots: void fillValues( int current ); - void pickAddress( QLineEdit *line ); + void pickAddress(); void pickAddressTo(); void pickAddressCC(); @@ -66,4 +69,5 @@ private slots: protected: + QLineEdit* mPickLineEdit; Opie::Core::OSmartPointer<Mail> mMail; Settings *settings; diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 22f1200..a3e1b86 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp @@ -1,6 +1,8 @@ // CHANGED 2004-08-06 Lutz Rogowski + #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> +#include <libkdepim/externalapphandler.h> #include <stdlib.h> #else @@ -46,4 +48,5 @@ int main( int argc, char **argv ) { //qDebug("CONNECT "); QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); + QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); a.showMainWidget(&mw ); #else diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 704a9ab..6df95c6 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -25,5 +25,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) setCaption( tr( "KOpieMail/Pi" ) ); setToolBarsMovable( false ); - KABC::StdAddressBook::self(); + //KABC::StdAddressBook::self(); toolBar = new QToolBar( this ); menuBar = new QMenuBar( toolBar ); diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 251f15a..3e560c5 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -105,4 +105,5 @@ void OpieMail::slotwriteMail2(const QString& namemail ) compose.showMaximized(); compose.exec(); + raise(); //qDebug("retttich "); } diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 0866939..2f538c4 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -110,5 +110,5 @@ void KOEventViewer::setSource(const QString& n) for(a=attendees.first();a;a=attendees.next()) { if ( "uid:"+a->uid() == n ) { - bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), ""); + bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); return; } |