-rw-r--r-- | kaddressbook/kabcore.cpp | 94 |
1 files changed, 63 insertions, 31 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a7ca0ce..2a54900 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -80,4 +80,10 @@ -//US#include <qpe/resource.h> // needed for Resource::loadPixmap //#include <qlabel.h> + + +#ifdef Q_WS_QWS +#include <qtopia/services.h> +#include <qtopia/qcopenvelope_qws.h> +#endif + #endif // KAB_EMBEDDED @@ -93,2 +99,5 @@ //US#include <qsplitter.h> +#include <qmap.h> +#include <qdir.h> +#include <qfile.h> #include <qvbox.h> @@ -96,4 +105,7 @@ #include <qclipboard.h> +#include <qtextstream.h> #include <libkdepim/categoryselectdialog.h> +#include <kabc/vcardconverter.h> + @@ -131,6 +143,3 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const { -#ifdef KAB_EMBEDDED - //US we define here our own global actioncollection. - //mActionCollection = new KActionCollection(this); -#endif //KAB_EMBEDDED + mExtensionBarSplitter = 0; @@ -198,2 +207,5 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const + connect( mDetails, SIGNAL( sendEmail( const QString& ) ), + SLOT( sendMail( const QString& ) ) ); + #ifndef KAB_EMBEDDED @@ -202,4 +214,2 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const - connect( mDetails, SIGNAL( sendEmail( const QString& ) ), - SLOT( sendMail( const QString& ) ) ); connect( mDetails, SIGNAL( browse( const QString& ) ), @@ -223,8 +233,2 @@ KABCore::~KABCore() KABC::StdAddressBook::close(); - -#ifdef KAB_EMBEDDED - //US we define here our own global actioncollection. - // delete mActionCollection; -#endif //KAB_EMBEDDED - } @@ -453,7 +457,3 @@ void KABCore::sendMail() { -#ifndef KAB_EMBEDDED sendMail( mViewManager->selectedEmails().join( ", " ) ); -#else //KAB_EMBEDDED - qDebug("KABCore::sendMail() ust be fixed"); -#endif //KAB_EMBEDDED } @@ -462,7 +462,25 @@ void KABCore::sendMail( const QString& email ) { -#ifndef KAB_EMBEDDED - kapp->invokeMailer( email, "" ); -#else //KAB_EMBEDDED - qDebug("KABCore::sendMail(const QString& email) ust be fixed"); -#endif //KAB_EMBEDDED +//US original kde implementation : kapp->invokeMailer( email, "" ); + +/*US original qtopia implementation + PimContact c = abList->currentEntry(); + QString name = c.fileAs(); + QString email = c.defaultEmail(); +#ifndef QT_NO_COP + QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)"); + e << name << email; +#else +*/ + + +#ifndef QT_NO_COP + QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); + qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); + + QCopEnvelope e(channel, "writeMail(QString,QString)"); + //US we need no names in the To field. The emailadresses are enough + e << "" << email; +#else + KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); +#endif } @@ -471,3 +489,2 @@ void KABCore::mailVCard() { -#ifndef KAB_EMBEDDED QStringList uids = mViewManager->selectedUids(); @@ -475,5 +492,2 @@ void KABCore::mailVCard() mailVCard( uids ); -#else //KAB_EMBEDDED - qDebug("KABCore::mailVCard() must be fixed"); -#endif //KAB_EMBEDDED } @@ -482,5 +496,7 @@ void KABCore::mailVCard( const QStringList& uids ) { -#ifndef KAB_EMBEDDED QStringList urls; + QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); + +/*US // Create a temp dir, so that we can put the files in it with proper names @@ -494,2 +510,7 @@ void KABCore::mailVCard( const QStringList& uids ) tempDir.unlink(); +*/ + QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); + + + QDir().mkdir( dirName, true ); @@ -522,3 +543,3 @@ void KABCore::mailVCard( const QStringList& uids ) } - +/*US kapp->invokeMailer( QString::null, QString::null, QString::null, @@ -528,5 +549,16 @@ void KABCore::mailVCard( const QStringList& uids ) urls ); // attachments -#else //KAB_EMBEDDED - qDebug("KABCore::mailVCard( must be fixed"); -#endif //KAB_EMBEDDED +*/ +#ifndef QT_NO_COP + QCString channel = KABPrefs::instance()->mEmailChannel.latin1(); + qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")"); + + QMap<QString, QString> parameterMap; + parameterMap.insert("ATTACHMENT<n>", urls.join(", ")); + + QCopEnvelope e(channel, "writeMail(QMap(QString,QString))"); + e << parameterMap; +#else + KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) ); +#endif + |