summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp94
-rw-r--r--kaddressbook/kabprefs.cpp3
-rw-r--r--kaddressbook/kabprefs.h12
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp109
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h8
-rw-r--r--microkde/kdialogbase.cpp1
-rw-r--r--microkde/kutils/kcmultidialog.cpp3
7 files changed, 196 insertions, 34 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a7ca0ce..2a54900 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -78,8 +78,14 @@
#include <kcmkabconfig.h>
-//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
#include <kcmkabconfig.h>
@@ -91,11 +97,17 @@
#include <resource.h>
//US#include <qsplitter.h>
+#include <qmap.h>
+#include <qdir.h>
+#include <qfile.h>
#include <qvbox.h>
#include <qlayout.h>
#include <qclipboard.h>
+#include <qtextstream.h>
#include <libkdepim/categoryselectdialog.h>
+#include <kabc/vcardconverter.h>
+
#include "addresseeutil.h"
#include "undocmds.h"
@@ -129,10 +141,7 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
mReadWrite( readWrite ), mModified( false )
#endif //KAB_EMBEDDED
{
-#ifdef KAB_EMBEDDED
- //US we define here our own global actioncollection.
- //mActionCollection = new KActionCollection(this);
-#endif //KAB_EMBEDDED
+
mExtensionBarSplitter = 0;
mIsPart = !parent->inherits( "KAddressBookMain" );
@@ -196,12 +205,13 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
mJumpButtonBar, SLOT( recreateButtons() ) );
+ connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
+ SLOT( sendMail( const QString& ) ) );
+
#ifndef KAB_EMBEDDED
connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
mXXPortManager, SLOT( importVCard( const KURL& ) ) );
- connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
- SLOT( sendMail( const QString& ) ) );
connect( mDetails, SIGNAL( browse( const QString& ) ),
SLOT( browse( const QString& ) ) );
@@ -221,12 +231,6 @@ KABCore::~KABCore()
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
-
-#ifdef KAB_EMBEDDED
- //US we define here our own global actioncollection.
- // delete mActionCollection;
-#endif //KAB_EMBEDDED
-
}
void KABCore::restoreSettings()
@@ -451,38 +455,50 @@ void KABCore::setContactSelected( const QString &uid )
void KABCore::sendMail()
{
-#ifndef KAB_EMBEDDED
sendMail( mViewManager->selectedEmails().join( ", " ) );
-#else //KAB_EMBEDDED
- qDebug("KABCore::sendMail() ust be fixed");
-#endif //KAB_EMBEDDED
}
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
}
void KABCore::mailVCard()
{
-#ifndef KAB_EMBEDDED
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
mailVCard( uids );
-#else //KAB_EMBEDDED
- qDebug("KABCore::mailVCard() must be fixed");
-#endif //KAB_EMBEDDED
}
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
KTempFile tempDir;
if ( tempDir.status() != 0 ) {
@@ -492,6 +508,11 @@ void KABCore::mailVCard( const QStringList& uids )
QString dirName = tempDir.name();
tempDir.unlink();
+*/
+ QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
+
+
+
QDir().mkdir( dirName, true );
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
@@ -520,15 +541,26 @@ void KABCore::mailVCard( const QStringList& uids )
urls.append( fileName );
}
}
-
+/*US
kapp->invokeMailer( QString::null, QString::null, QString::null,
QString::null, // subject
QString::null, // body
QString::null,
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
+
}
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 5b3b1ab..8bd4b15 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -50,6 +50,9 @@ KABPrefs::KABPrefs()
addItemBool("AskForQuit",&mAskForQuit,false);
addItemBool("ToolBarHor",&mToolBarHor, true );
addItemBool("ToolBarUp",&mToolBarUp, false );
+ addItemInt( "EmailChannelType", &mEmailClient, OMPI );
+ addItemString( "EmailChannelOther", &mEmailChannel, "" );
+
#endif //KAB_EMBEDDED
KPrefs::setCurrentGroup( "MainWindow" );
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 370fc5b..c81a9a9 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -37,6 +37,14 @@ class KABPrefs : public KPimPrefs
static KABPrefs *instance();
+ enum EMailClients {
+ OMPI = 0,
+ QTOPIA = 1,
+ OPIE = 2,
+ OTHER = 3
+ };
+
+
// General
bool mHonorSingleClick;
bool mAutomaticNameParsing;
@@ -49,6 +57,10 @@ class KABPrefs : public KPimPrefs
bool mToolBarHor;
bool mToolBarUp;
bool mAskForQuit;
+
+ int mEmailClient;
+ QString mEmailChannel;
+
/** Set preferences to default values */
// void usrSetDefaults();
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 38c7946..1bac26f 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -27,6 +27,10 @@
#include <qlayout.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qfile.h>
#include <kconfig.h>
#include <kdebug.h>
@@ -93,7 +97,7 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
QWidget *generalPage = new QWidget( this );
QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
-
+ //general groupbox
QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
boxLayout->setAlignment( Qt::AlignTop );
@@ -109,6 +113,9 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
layout->addWidget( groupBox );
+
+ //extensions groupbox
+
groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
boxLayout = new QVBoxLayout( groupBox->layout() );
boxLayout->setAlignment( Qt::AlignTop );
@@ -145,8 +152,96 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
mAddresseeWidget = new AddresseeWidget( this );
tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
+
+ // mailclient page
+ QWidget *mailclientPage = new QWidget( this );
+ layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
+ KDialog::spacingHintSmall() );
+
+ groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
+ boxLayout = new QVBoxLayout( groupBox->layout() );
+ boxLayout->setAlignment( Qt::AlignTop );
+// boxLayout->setMargin(KDialog::marginHintSmall() );
+// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
+// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
+// boxLayout->setSpacing( KDialog::spacingHintSmall() );
+
+ mEmailClient = new QComboBox( groupBox );
+ mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI );
+ mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA );
+ mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE );
+ mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER );
+ boxLayout->addWidget( mEmailClient );
+
+ connect( mEmailClient, SIGNAL( activated( int ) ),
+ this, SLOT (emailclient_changed( int ) ) );
+
+ QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
+ boxLayout->addWidget( lab );
+ mEmailChannel = new QLineEdit(groupBox);
+ mEmailChannel->setReadOnly(true);
+ boxLayout->addWidget( mEmailChannel );
+
+ layout->addWidget( groupBox );
+ tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
+
+
+
}
+
+
+void KABConfigWidget::emailclient_changed( int newClient )
+{
+ if (newClient == KABPrefs::OTHER)
+ mEmailChannel->setReadOnly(false);
+ else
+ mEmailChannel->setReadOnly(true);
+
+ QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
+ QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
+
+ if (opiepath.isEmpty())
+ opiepath = qtopiapath;
+
+ QString text = mEmailChannel->text();
+
+ if (newClient == KABPrefs::OPIE)
+ {
+ if ( QFile::exists( opiepath + "/bin/opiemail" ))
+ text = "QPE/Application/opiemail";
+ else
+ text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
+ }
+ else if (newClient == KABPrefs::QTOPIA)
+ {
+ if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
+ text = "QPE/Application/qtmail";
+ else
+ text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
+
+ }
+ else if (newClient == KABPrefs::OMPI)
+ {
+ if ( QFile::exists( qtopiapath + "/bin/ompi" ))
+ text = "QPE/Application/ompi";
+ else if ( QFile::exists( opiepath + "/bin/ompi" ))
+ text = "QPE/Application/ompi";
+ else
+ text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
+
+ }
+ else
+ {
+ //do nothing if we choosed other
+ }
+
+ mEmailChannel->setText( text );
+
+
+}
+
+
void KABConfigWidget::restoreSettings()
{
bool blocked = signalsBlocked();
@@ -154,6 +249,10 @@ void KABConfigWidget::restoreSettings()
mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing );
mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick );
+
+ mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
+ mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
+
mAddresseeWidget->restoreSettings();
restoreExtensionSettings();
@@ -167,6 +266,10 @@ void KABConfigWidget::saveSettings()
{
KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked();
KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked();
+
+ KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
+ KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
+
mAddresseeWidget->saveSettings();
saveExtensionSettings();
@@ -180,6 +283,10 @@ void KABConfigWidget::defaults()
mNameParsing->setChecked( true );
mViewsSingleClickBox->setChecked( false );
+ mEmailClient->setCurrentItem(KABPrefs::OMPI);
+ emailclient_changed( KABPrefs::OMPI );
+
+
emit changed( true );
}
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 0f36d9e..9d1363b 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -29,7 +29,8 @@
class QCheckBox;
class QListViewItem;
class QPushButton;
-
+class QComboBox;
+class QLineEdit;
class KListView;
class AddresseeWidget;
@@ -51,10 +52,13 @@ class KABConfigWidget : public QWidget
public slots:
void modified();
+
+
private slots:
void configureExtension();
void selectionChanged( QListViewItem* );
void itemClicked( QListViewItem* );
+ void emailclient_changed( int newClient );
private:
void restoreExtensionSettings();
@@ -65,6 +69,8 @@ class KABConfigWidget : public QWidget
QCheckBox *mNameParsing;
QCheckBox *mViewsSingleClickBox;
QPushButton *mConfigureButton;
+ QComboBox* mEmailClient;
+ QLineEdit* mEmailChannel;
AddresseeWidget *mAddresseeWidget;
};
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index c953058..d1f7630 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -78,7 +78,6 @@ void KDialogBase::init( const QString &caption, int buttonMask,
mOkButton = 0;
}
if ( buttonMask & Default ) {
- qDebug("buttonMask & Default ");
mDefaultButton = new QPushButton( i18n("Default"), this );
connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) );
} else {
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index 4136622..13be2ce 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -43,6 +43,9 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch
{
enableButton(Apply, false);
//connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
+
+ connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
+
_baseGroup = baseGroup;
mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
setMainWidget(mMainWidget );