summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-09-07 22:51:29 (UTC)
committer zautrix <zautrix>2004-09-07 22:51:29 (UTC)
commit2676646d4744ccceab1063dc02d772a26a203c61 (patch) (side-by-side diff)
tree0a0d5261b9a804a29b61a38f68339979051282e2 /kmicromail
parent64a8ef1629f523df3006de5cb2b9882a50d96a05 (diff)
downloadkdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.zip
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.gz
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.bz2
Implemented Ompi - kapi connection
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-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
5 files changed, 100 insertions, 15 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 654cfc0..5f446fa 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -31,3 +31,7 @@
#include <kabc/addressee.h>
-
+#ifdef DESKTOP_VERSION
+#include <kabc/addresseedialog.h>
+#else //DESKTOP_VERSION
+#include <libkdepim/externalapphandler.h>
+#endif //DESKTOP_VERSION
@@ -40,4 +44,12 @@ 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 = "";
+ 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( );
@@ -59,2 +71,3 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
senderNameEdit->setText(con.formattedName());
+#endif
Config cfg( "mail" );
@@ -93,5 +106,8 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
mMail = 0;
- warnAttach = true;
+ warnAttach = true;
}
+
+
+
void ComposeMail::saveAsDraft()
@@ -142,4 +158,9 @@ void ComposeMail::setStatus( QString status )
}
-void ComposeMail::pickAddress( QLineEdit *line )
+void ComposeMail::pickAddress( )
{
+
+ QLineEdit *line = mPickLineEdit;
+ if ( line == 0 )
+ return;
+#ifdef DESKTOP_VERSION
//qDebug(" ComposeMail::pickAddress ");
@@ -151,5 +172,6 @@ void ComposeMail::pickAddress( QLineEdit *line )
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() +">";
+
}
@@ -163,4 +185,55 @@ void ComposeMail::pickAddress( QLineEdit *line )
}
+#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 );
+ }
}
-
@@ -189,3 +262,4 @@ void ComposeMail::pickAddressTo()
{
- pickAddress( toLine );
+ mPickLineEdit = toLine;
+ pickAddress( );
}
@@ -194,3 +268,4 @@ void ComposeMail::pickAddressCC()
{
- pickAddress( ccLine );
+ mPickLineEdit = ccLine;
+ pickAddress( );
}
@@ -199,3 +274,4 @@ void ComposeMail::pickAddressBCC()
{
- pickAddress( bccLine );
+ mPickLineEdit = bccLine;
+ pickAddress( );
}
@@ -204,3 +280,4 @@ 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
@@ -36,2 +36,3 @@ class ComposeMail : public ComposeMailUI
public:
+
ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
@@ -47,3 +48,5 @@ public slots:
void setInReplyTo( const QString & messageId );
- void setMessage( const QString & text );
+ void setMessage( const QString & text );
+ void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
+
@@ -55,3 +58,3 @@ private slots:
void fillValues( int current );
- void pickAddress( QLineEdit *line );
+ void pickAddress();
void pickAddressTo();
@@ -67,2 +70,3 @@ private slots:
protected:
+ QLineEdit* mPickLineEdit;
Opie::Core::OSmartPointer<Mail> mMail;
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 22f1200..a3e1b86 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -2,4 +2,6 @@
+
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+#include <libkdepim/externalapphandler.h>
#include <stdlib.h>
@@ -46,3 +48,4 @@ 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 & )),&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 );
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 704a9ab..6df95c6 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -26,3 +26,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
setToolBarsMovable( false );
- KABC::StdAddressBook::self();
+ //KABC::StdAddressBook::self();
toolBar = new QToolBar( this );
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 251f15a..3e560c5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -106,2 +106,3 @@ void OpieMail::slotwriteMail2(const QString& namemail )
compose.exec();
+ raise();
//qDebug("retttich ");