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) (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
@@ -18,143 +18,131 @@
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qdir.h>
#include "resource.h"
#include <kresources/manager.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstaticdeleter.h>
#include <kstandarddirs.h>
#include "stdaddressbook.h"
using namespace KABC;
StdAddressBook *StdAddressBook::mSelf = 0;
bool StdAddressBook::mAutomaticSave = true;
static KStaticDeleter<StdAddressBook> addressBookDeleter;
QString StdAddressBook::fileName()
{
return locateLocal( "data", "kabc/std.vcf" );
}
QString StdAddressBook::directoryName()
{
return locateLocal( "data", "kabc/stdvcf" );
}
void StdAddressBook::handleCrash()
{
StdAddressBook::self()->cleanUp();
}
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
KStandardDirs::setAppDir( appdir );
}
return mSelf;
}
QString StdAddressBook::setTempAppDir()
{
QString appDIR = KStandardDirs::appDir();
#ifdef DESKTOP_VERSION
QString appdir = QDir::homeDirPath();
if ( appdir.right(1) == "\\" || appdir.right(1) == "/" )
appdir += "kaddressbook/";
else
appdir += "/kaddressbook/";
KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
#else
QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook";
KStandardDirs::setAppDir( appdir );
#endif
return appDIR;
}
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
KStandardDirs::setAppDir( appdir );
}
return mSelf;
}
StdAddressBook::StdAddressBook()
: AddressBook( "kabcrc" )
{
init( false );
}
StdAddressBook::StdAddressBook( bool onlyFastResources )
: AddressBook( "kabcrc" )
{
init( onlyFastResources );
}
StdAddressBook::~StdAddressBook()
{
if ( mAutomaticSave )
save();
}
void StdAddressBook::init( bool )
{
KRES::Manager<Resource> *manager = resourceManager();
KRES::Manager<Resource>::ActiveIterator it;
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
(*it)->setAddressBook( this );
if ( !(*it)->open() )
error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
}
Resource *res = standardResource();
if ( !res ) {
res = manager->createResource( "file" );
if ( res )
{
addResource( res );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2f9f1df..6522ccc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1998,98 +1998,116 @@ void KABCore::configureKeyBindings()
{
#ifndef KAB_EMBEDDED
KKeyDialog::configure( actionCollection(), true );
#else //KAB_EMBEDDED
qDebug("KABCore::configureKeyBindings() not implemented");
#endif //KAB_EMBEDDED
}
#ifdef KAB_EMBEDDED
void KABCore::configureResources()
{
KRES::KCMKResources dlg( this, "" , 0 );
if ( !dlg.exec() )
return;
KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
}
#endif //KAB_EMBEDDED
/* this method will be called through the QCop interface from Ko/Pi to select addresses
* for the attendees list of an event.
*/
void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
{
QStringList nameList;
QStringList emailList;
QStringList uidList;
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
for (i=0; i < list.count(); i++)
{
nameList.append(list[i].realName());
emailList.append(list[i].preferredEmail());
uidList.append(list[i].uid());
}
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
}
/* this method will be called through the QCop interface from other apps to show details of a contact.
*/
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())
+ QString foundUid = QString::null;
+ 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())
namelist = mAddressBook->findByName( name );
if (!email.isEmpty())
emaillist = mAddressBook->findByEmail( email );
qDebug("count %d %d ", namelist.count(),emaillist.count() );
//check if we have a match in Namelist and Emaillist
if ((namelist.count() == 0) && (emaillist.count() > 0)) {
foundUid = emaillist[0].uid();
}
else if ((namelist.count() > 0) && (emaillist.count() == 0))
foundUid = namelist[0].uid();
else
{
for (int i = 0; i < namelist.count(); i++)
{
for (int j = 0; j < emaillist.count(); j++)
{
if (namelist[i] == emaillist[j])
{
foundUid = namelist[i].uid();
}
}
}
}
}
else
{
foundUid = uid;
}
if (!foundUid.isEmpty())
{
// raise Ka/Pi if it is in the background
#ifndef DESKTOP_VERSION
#ifndef KORG_NODCOP
//QCopEnvelope e("QPE/Application/kapi", "raise()");
#endif
#endif
mMainWindow->showMaximized();
mMainWindow-> raise();
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 654cfc0..5f446fa 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,253 +1,330 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include "composemail.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/storemail.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailtypes.h>
/* OPIE */
//#include <opie2/ofiledialog.h>
//#include <opie2/odebug.h>
#include <kfiledialog.h>
//#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/global.h>
//#include <qpe/contact.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qmultilineedit.h>
#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 = "";
+ 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" ),
tr( "Ok" ) );
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = mails.begin();
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" ) );
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
}
if ( smtpAccounts.count() > 0 ) {
fillValues( smtpAccountBox->currentItem() );
} else {
QMessageBox::information( 0, tr( "Problem" ),
tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
tr( "Ok" ) );
return;
}
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
mMail = 0;
- warnAttach = true;
+ warnAttach = true;
}
+
+
+
void ComposeMail::saveAsDraft()
{
Opie::Core::OSmartPointer<Mail> mail= new Mail();
mail->setMail(fromBox->currentText());
mail->setTo( toLine->text() );
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != 0 ) {
if ( warnAttach )
QMessageBox::warning(0,tr("Store message"),
tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
warnAttach = false;
}
setStatus( tr("Mail saved as draft!") );
}
void ComposeMail::clearStatus()
{
topLevelWidget()->setCaption( tr("Compose mail") );
}
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 );
}
void ComposeMail::setSubject( const QString & subject )
{
subjectLine->setText( subject );
}
void ComposeMail::setInReplyTo( const QString & messageId )
{
m_replyid = messageId;
}
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 );
ccLine->clear();
if ( smtp->getUseCC() ) {
ccLine->setText( smtp->getCC() );
}
bccLine->clear();
if ( smtp->getUseBCC() ) {
bccLine->setText( smtp->getBCC() );
}
replyLine->clear();
if ( smtp->getUseReply() ) {
replyLine->setText( smtp->getReply() );
}
sigMultiLine->setText( smtp->getSignature() );
#endif
}
void ComposeMail::slotAdjustColumns()
{
int currPage = tabWidget->currentPageIndex();
tabWidget->showPage( attachTab );
attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
attList->setColumnWidth( 1, 80 );
tabWidget->setCurrentPage( currPage );
}
void ComposeMail::addAttachment()
{
QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
if ( !lnk.isEmpty() ) {
Attachment *att = new Attachment( lnk );
(void) new AttachViewItem( attList, att );
}
}
void ComposeMail::removeAttachment()
{
if ( !attList->currentItem() ) {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select a File.</p>" ),
tr( "Ok" ) );
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 876b597..657f665 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -1,86 +1,90 @@
#ifndef COMPOSEMAIL_H
#define COMPOSEMAIL_H
#include <qlineedit.h>
#include <qlistview.h>
#include "composemailui.h"
//#include "addresspickerui.h"
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
class RecMail;
#include <opie2/osmartpointer.h>
#if 0
class AddressPicker : public AddressPickerUI
{
//Q_OBJECT
public:
AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
static QString getNames();
protected:
QString selectedNames;
void accept();
};
#endif
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 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;
};
class AttachViewItem : public QListViewItem
{
public:
AttachViewItem( QListView *parent, Attachment *att );
Attachment *getAttachment() { return attachment; }
private:
Attachment *attachment;
};
#endif
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 22f1200..a3e1b86 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,58 +1,61 @@
// 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>
#include <qsgistyle.h>
#endif
#include "opiemail.h"
#include <qdir.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <stdio.h>
#include "mainwindow.h"
using namespace Opie::Core;
int main( int argc, char **argv ) {
#ifndef DESKTOP_VERSION
QPEApplication a( argc, argv );
a.setKeepRunning ();
#else
QApplication a( argc, argv );
QApplication::setStyle( new QPlatinumStyle ());
#endif
KGlobal::setAppName( "kmicromail" );
QString fileName ;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
if ( QApplication::desktop()->width() > 320 )
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/");
else
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/");
#else
fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/";
KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
#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 & )),&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()));
#endif
int rv = a.exec();
return rv;
}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 704a9ab..6df95c6 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,75 +1,75 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include <qlabel.h>
#include <qvbox.h>
#include <qheader.h>
#include <qtimer.h>
#include <qlayout.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <kapplication.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
#include "defines.h"
#include "mainwindow.h"
#include <KDGanttMinimizeSplitter.h>
#include <kabc/stdaddressbook.h>
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 );
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
0, 0, this );
composeMail->addTo( toolBar );
composeMail->addTo( mailMenu );
sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") ,
0, 0, this );
sendQueued->addTo( toolBar );
sendQueued->addTo( mailMenu );
/*
syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
0, 0, this );
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
*/
showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") ,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
showFolders->setOn( true );
connect(showFolders, SIGNAL( toggled(bool) ),
SLOT( slotShowFolders(bool) ) );
/*
searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ),
0, 0, this );
searchMails->addTo( toolBar );
searchMails->addTo( mailMenu );
*/
deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this);
deleteMails->addTo( toolBar );
deleteMails->addTo( mailMenu );
connect( deleteMails, SIGNAL( activated() ),
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 251f15a..3e560c5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -59,96 +59,97 @@ void OpieMail::message(const QCString &msg, const QByteArray &data)
//qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
if (msg == "writeMail(QString,QString)")
{
QDataStream stream(data,IO_ReadOnly);
QString name, email;
stream >> name >> email;
// removing the whitespaces at beginning and end is needed!
slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
}
else if (msg == "newMail()")
{
slotComposeMail();
}
else if (msg == "newMail(QString)")
{
QDataStream stream(data,IO_ReadOnly);
QString nameemail;
stream >> nameemail;
// the format is
// NAME <EMAIL>:SUBJECT
//qDebug("message %s ", nameemail.latin1());
slotwriteMail2( nameemail );
}
}
void OpieMail::slotwriteMail2(const QString& namemail )
{
// qDebug("OpieMail::slotwriteMail2 ");
qApp->processEvents();
ComposeMail compose( settings, this, 0, true );
if ( !namemail.isEmpty() ) {
QString to = namemail;
if ( namemail.find( " <") > 1 ) {
to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
} else
if ( namemail.find( "<") > 1 ) {
to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
}
int sub = to.find( ">:");
if ( sub > 0 ) {
compose.setTo( to.left(sub+1) );
compose.setSubject( to.mid(sub+2) );
} 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 );
if (!email.isEmpty())
{
if (!name.isEmpty())
{
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
}
else
{
compose.setTo(email);
}
}
compose.slotAdjustColumns();
compose.showMaximized();
compose.exec();
}
void OpieMail::slotComposeMail()
{
slotwriteMail2( QString () );
//slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
return;
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 0866939..2f538c4 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -64,97 +64,97 @@ KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
mSyncMode = false;
mColorMode = 0;
}
KOEventViewer::~KOEventViewer()
{
}
void KOEventViewer::setSource(const QString& n)
{
if ( n.left(3) == "uid" )
#ifdef DESKTOP_VERSION
{
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
// LR I do not understand, why the uid string is different on zaurus and desktop
QString uid = "uid://"+(*it).uid();
//qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
if (n == uid ) {
//qDebug("found %s ",(*it).mobileHomePhone().latin1() );
QDialog dia( this,"dia123", true );
dia.setCaption( i18n("Details of attendee") );
QVBoxLayout lay ( &dia );
KPIM::AddresseeView av ( &dia );
av.setAddressee( (*it) );
lay.addWidget( &av );
if ( QApplication::desktop()->width() < 480 )
dia.resize( 220, 240);
else {
dia.resize( 400,400);
}
dia.exec();
break;
}
}
return;
}
#else
{
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;
}
//requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
// the result should now arrive through method insertAttendees
//QString uid = "uid:"+(*it).uid();
#endif
if ( n.left(6) == "mailto" ) {
// qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
#ifndef DESKTOP_VERSION
QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
e << n.mid(7);
#endif
}
#ifndef KORG_NODCOP
kdDebug() << "KOEventViewer::setSource(): " << n << endl;
QString tmpStr;
if (n.startsWith("mailto:")) {
KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
//emit showIncidence(n);
return;
} else if (n.startsWith("uid:")) {
DCOPClient *client = KApplication::kApplication()->dcopClient();
const QByteArray noParamData;
const QByteArray paramData;
QByteArray replyData;
QCString replyTypeStr;
#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
bool foundAbbrowser = PING_ABBROWSER;
if (foundAbbrowser) {
//KAddressbook is already running, so just DCOP to it to bring up the contact editor
//client->send("kaddressbook","KAddressBookIface",
QDataStream arg(paramData, IO_WriteOnly);
arg << n.mid(6);
client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
return;
} else {
/*
KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
We start it without its main interface
*/