summaryrefslogtreecommitdiffabout
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
parent64a8ef1629f523df3006de5cb2b9882a50d96a05 (diff)
downloadkdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.zip
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.gz
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.bz2
Implemented Ompi - kapi connection
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/stdaddressbook.cpp12
-rw-r--r--kaddressbook/kabcore.cpp20
-rw-r--r--kmicromail/composemail.cpp93
-rw-r--r--kmicromail/composemail.h6
-rw-r--r--kmicromail/main.cpp3
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/opiemail.cpp1
-rw-r--r--korganizer/koeventviewer.cpp2
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
@@ -60,17 +60,12 @@ void StdAddressBook::handleCrash()
StdAddressBook *StdAddressBook::self()
{
if ( !mSelf )
{
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
mSelf = addressBookDeleter.setObject( new StdAddressBook );
#else //KAB_EMBEDDED
addressBookDeleter.setObject( mSelf, new StdAddressBook );
#endif //KAB_EMBEDDED
@@ -100,19 +95,12 @@ QString StdAddressBook::setTempAppDir()
}
StdAddressBook *StdAddressBook::self( bool onlyFastResources )
{
if ( !mSelf )
{
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
- qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
QString appdir =StdAddressBook::setTempAppDir();
#ifdef KAB_EMBEDDED
mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) );
#else //KAB_EMBEDDED
addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) );
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2f9f1df..6522ccc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2041,13 +2041,31 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt
*/
void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
{
//qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
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
Addressee::List namelist;
Addressee::List emaillist;
if (!name.isEmpty())
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 654cfc0..5f446fa 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -26,23 +26,35 @@
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <kabc/addresseedialog.h>
#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
//using namespace Opie::Core;
//using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: ComposeMailUI( parent, name, modal, flags )
{
+ 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();
QString defmail = con.preferredEmail();
if ( mails.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" ),
@@ -54,12 +66,13 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
for (;sit!=mails.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(con.formattedName());
+#endif
Config cfg( "mail" );
cfg.setGroup( "Compose" );
checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
attList->addColumn( tr( "Name" ) );
attList->addColumn( tr( "Size" ) );
@@ -91,12 +104,15 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
mMail = 0;
warnAttach = true;
}
+
+
+
void ComposeMail::saveAsDraft()
{
Opie::Core::OSmartPointer<Mail> mail= new Mail();
mail->setMail(fromBox->currentText());
mail->setTo( toLine->text() );
@@ -137,35 +153,92 @@ void ComposeMail::clearStatus()
}
void ComposeMail::setStatus( QString status )
{
topLevelWidget()->setCaption( 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();
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
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() +">";
+
}
}
if ( line->text().isEmpty() ) {
line->setText( names );
} else if ( !names.isEmpty() ) {
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 )
{
toLine->setText( to );
}
@@ -184,28 +257,32 @@ void ComposeMail::setMessage( const QString & text )
message->setText( 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( );
}
void ComposeMail::fillValues( int )
{
#if 0
SMTPaccount *smtp = smtpAccounts.at( current );
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 876b597..657f665 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -31,43 +31,47 @@ class RecMail;
class ComposeMail : public ComposeMailUI
{
Q_OBJECT
public:
+
ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
virtual ~ComposeMail();
void reEditMail(const Opie::Core::OSmartPointer<RecMail>&current);
public slots:
void slotAdjustColumns();
void setTo( const QString & to );
void setSubject( const QString & subject );
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:
void accept();
void reject();
private slots:
void fillValues( int current );
- void pickAddress( QLineEdit *line );
+ void pickAddress();
void pickAddressTo();
void pickAddressCC();
void pickAddressBCC();
void pickAddressReply();
void saveAsDraft();
void addAttachment();
void removeAttachment();
void clearStatus();
void setStatus( QString );
protected:
+ QLineEdit* mPickLineEdit;
Opie::Core::OSmartPointer<Mail> mMail;
Settings *settings;
QList<SMTPaccount> smtpAccounts;
QString m_replyid;
bool warnAttach;
};
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 22f1200..a3e1b86 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,10 +1,12 @@
// CHANGED 2004-08-06 Lutz Rogowski
+
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+#include <libkdepim/externalapphandler.h>
#include <stdlib.h>
#else
#include <qapplication.h>
#include <qstring.h>
#include <qwindowsstyle.h>
#include <qplatinumstyle.h>
@@ -42,12 +44,13 @@ int main( int argc, char **argv ) {
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail")));
OpieMail mw;
#ifndef DESKTOP_VERSION
//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
a.setMainWidget(&mw );
mw.show();
//m.resize( 800, 600 );
QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 704a9ab..6df95c6 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -21,13 +21,13 @@
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
: QMainWindow( parent, name ) //, flags )
{
setCaption( tr( "KOpieMail/Pi" ) );
setToolBarsMovable( false );
- KABC::StdAddressBook::self();
+ //KABC::StdAddressBook::self();
toolBar = new QToolBar( this );
menuBar = new QMenuBar( toolBar );
mailMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Mail" ), mailMenu );
settingsMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Settings" ), settingsMenu );
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 251f15a..3e560c5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -101,12 +101,13 @@ void OpieMail::slotwriteMail2(const QString& namemail )
} else
compose.setTo( to );
}
compose.slotAdjustColumns();
compose.showMaximized();
compose.exec();
+ raise();
//qDebug("retttich ");
}
void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
// qDebug("OpieMail::slotwriteMail ");
ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 0866939..2f538c4 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -106,13 +106,13 @@ void KOEventViewer::setSource(const QString& n)
{
QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
if (attendees.count()) {
Attendee *a;
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;
}
}
}
return;
}