summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp254
-rw-r--r--kaddressbook/kabprefs.cpp47
-rw-r--r--kaddressbook/kabprefs.h58
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp167
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h48
5 files changed, 367 insertions, 207 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a7ca0ce..2a54900 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -23,3 +23,3 @@
-#include "kabcore.h"
+#include "kabcore.h"
@@ -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;
@@ -144,3 +153,3 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
#endif //KAB_EMBEDDED
-
+
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
@@ -164,4 +173,4 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
"X-Anniversary", "KADDRESSBOOK" );
-
- //US added this field to become compatible with Opie/qtopia addressbook
+
+ //US added this field to become compatible with Opie/qtopia addressbook
// values can be "female" or "male" or "". An empty field represents undefined.
@@ -197,3 +206,6 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
mJumpButtonBar, SLOT( recreateButtons() ) );
-
+
+ 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
-
}
@@ -237,3 +241,3 @@ void KABCore::restoreSettings()
setJumpButtonBarVisible( state );
-
+
state = KABPrefs::instance()->mDetailsPageVisible;
@@ -296,5 +300,5 @@ void KABCore::saveSettings()
mViewManager->saveSettings();
-
+
KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
-
+
}
@@ -380,5 +384,5 @@ void KABCore::createAboutData()
#endif //KAB_EMBEDDED
-
+
QString version;
-#include <../version>
+#include <../version>
QMessageBox::about( this, "About KAddressbook/Pi",
@@ -392,3 +396,3 @@ void KABCore::createAboutData()
#endif
-
+
"(c) 2004 Ulf Schenk\n"
@@ -420,3 +424,3 @@ void KABCore::setContactSelected( const QString &uid )
//US emit contactSelected( pic.data() );
-//US instead use:
+//US instead use:
QPixmap px;
@@ -426,3 +430,3 @@ void KABCore::setContactSelected( const QString &uid )
}
-
+
emit contactSelected( px );
@@ -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
+
@@ -754,3 +786,3 @@ void KABCore::setModified( bool modified )
mDetails->refreshView();
-
+
}
@@ -764,3 +796,3 @@ void KABCore::contactModified( const KABC::Addressee &addr )
{
-
+
Command *command = 0;
@@ -808,10 +840,10 @@ void KABCore::newContact()
mEditorDialog->setAddressee( addr );
- KApplication::execDialog ( mEditorDialog );
-
+ KApplication::execDialog ( mEditorDialog );
+
} else
return;
-
+
// mEditorDict.insert( dialog->addressee().uid(), dialog );
-
+
}
@@ -890,3 +922,3 @@ void KABCore::importVCard( const QString &vCard, bool showPreview )
-//US added a second method without defaultparameter
+//US added a second method without defaultparameter
void KABCore::editContact2() {
@@ -983,3 +1015,3 @@ void KABCore::extensionModified( const KABC::Addressee::List &list )
{
-
+
if ( list.count() != 0 ) {
@@ -990,3 +1022,3 @@ void KABCore::extensionModified( const KABC::Addressee::List &list )
setModified();
- else
+ else
setModifiedWOrefresh();
@@ -998,3 +1030,3 @@ void KABCore::extensionModified( const KABC::Addressee::List &list )
-
+
@@ -1030,3 +1062,3 @@ QString KABCore::getNameByPhone( const QString &phone )
#endif //KAB_EMBEDDED
-
+
}
@@ -1187,3 +1219,3 @@ void KABCore::initGUI()
#else //KAB_EMBEDDED
- //US initialize viewMenu before settingup viewmanager.
+ //US initialize viewMenu before settingup viewmanager.
// Viewmanager needs this menu to plugin submenues.
@@ -1204,3 +1236,3 @@ void KABCore::initGUI()
// QBoxLayout *topLayout = (QBoxLayout*)layout();
-
+
// QWidget *mainBox = new QWidget( this );
@@ -1211,6 +1243,6 @@ void KABCore::initGUI()
-
+
mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
-
+
topLayout->addWidget(mMiniSplitter );
@@ -1233,3 +1265,3 @@ void KABCore::initGUI()
}
-
+
topLayout->addWidget(mMiniSplitter );
@@ -1237,4 +1269,4 @@ void KABCore::initGUI()
mDetails = new ViewContainer( mMiniSplitter );
-
-
+
+
mExtensionManager = new ExtensionManager( this, mMiniSplitter );
@@ -1243,4 +1275,4 @@ void KABCore::initGUI()
// topLayout->addWidget(mExtensionManager );
-
-
+
+
/*US
@@ -1259,3 +1291,3 @@ void KABCore::initGUI()
mDetails = new ViewContainer( mDetailsSplitter );
-
+
topLayout->addWidget( mDetailsSplitter );
@@ -1282,3 +1314,3 @@ void KABCore::initGUI()
-
+
#endif //KAB_EMBEDDED
@@ -1300,3 +1332,3 @@ void KABCore::initGUI()
-
+
mJumpButtonBar = new JumpButtonBar( this, this );
@@ -1305,3 +1337,3 @@ void KABCore::initGUI()
//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
-
+
// mMainWindow->getIconToolBar()->raise();
@@ -1309,3 +1341,3 @@ void KABCore::initGUI()
#endif //KAB_EMBEDDED
-
+
}
@@ -1314,3 +1346,3 @@ void KABCore::initActions()
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
-
+
#ifndef KAB_EMBEDDED
@@ -1319,3 +1351,3 @@ void KABCore::initActions()
#endif //KAB_EMBEDDED
-
+
// file menu
@@ -1332,9 +1364,9 @@ void KABCore::initActions()
}
-
+
mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
SLOT( save() ), actionCollection(), "file_sync" );
-
+
mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
SLOT( newContact() ), actionCollection(), "file_new_contact" );
-
+
mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
@@ -1353,3 +1385,3 @@ void KABCore::initActions()
#endif //KAB_EMBEDDED
-
+
// edit menu
@@ -1389,3 +1421,3 @@ void KABCore::initActions()
mActionRedo->setEnabled( false );
-
+
// settings menu
@@ -1398,3 +1430,3 @@ void KABCore::initActions()
#endif //KAB_EMBEDDED
-
+
if ( mIsPart ) {
@@ -1403,3 +1435,3 @@ void KABCore::initActions()
"kaddressbook_configure" );
-
+
mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
@@ -1411,9 +1443,9 @@ void KABCore::initActions()
#endif //KAB_EMBEDDED
-
+
} else {
mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
-
+
mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
}
-
+
mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
@@ -1421,3 +1453,3 @@ void KABCore::initActions()
connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
-
+
mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
@@ -1425,6 +1457,6 @@ void KABCore::initActions()
connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
-
+
// misc
// only enable LDAP lookup if we can handle the protocol
-#ifndef KAB_EMBEDDED
+#ifndef KAB_EMBEDDED
if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
@@ -1434,6 +1466,6 @@ void KABCore::initActions()
}
-#else //KAB_EMBEDDED
+#else //KAB_EMBEDDED
//qDebug("KABCore::initActions() LDAP has to be implemented");
-#endif //KAB_EMBEDDED
-
+#endif //KAB_EMBEDDED
+
@@ -1459,3 +1491,3 @@ void KABCore::initActions()
#endif //KAB_EMBEDDED
-
+
clipboardDataChanged();
@@ -1480,3 +1512,3 @@ void KABCore::addActionsManually()
QMenuBar* mb = mMainWindow->menuBar();
-
+
//US setup menubar.
@@ -1491,4 +1523,4 @@ void KABCore::addActionsManually()
// tb->insertWidget(-1, 0, mIncSearchWidget);
-
-#else
+
+#else
//US setup toolbar
@@ -1499,3 +1531,3 @@ void KABCore::addActionsManually()
mIncSearchWidget = new IncSearchWidget( tb );
-
+
tb->enableMoving(false);
@@ -1520,6 +1552,6 @@ void KABCore::addActionsManually()
fileMenu->insertSeparator();
-
+
mActionNewContact->plug( fileMenu );
mActionNewContact->plug( tb );
-
+
mActionEditAddressee->plug( fileMenu );
@@ -1535,3 +1567,3 @@ void KABCore::addActionsManually()
mActionImportOL->plug( ImportMenu );
-#endif
+#endif
// edit menu
@@ -1546,3 +1578,3 @@ void KABCore::addActionsManually()
mActionSelectAll->plug( editMenu );
-
+
mActionRemoveVoice->plug( changeMenu );
@@ -1555,3 +1587,3 @@ void KABCore::addActionsManually()
mActionConfigKAddressbook->plug( settingsMenu );
-
+
if ( mIsPart ) {
@@ -1559,3 +1591,3 @@ void KABCore::addActionsManually()
mActionConfigureToolbars->plug( settingsMenu );
-
+
} else {
@@ -1563,5 +1595,5 @@ void KABCore::addActionsManually()
}
-
+
settingsMenu->insertSeparator();
-
+
mActionJumpBar->plug( settingsMenu );
@@ -1572,6 +1604,6 @@ void KABCore::addActionsManually()
mActionCategories->plug( settingsMenu );
-
+
mActionAboutKAddressbook->plug( helpMenu );
-
+
if (QApplication::desktop()->width() > 320 ) {
@@ -1580,3 +1612,3 @@ void KABCore::addActionsManually()
mActionSave->plug( tb );
- mViewManager->getFilterAction()->plug ( tb);
+ mViewManager->getFilterAction()->plug ( tb);
if (QApplication::desktop()->width() > 480 ) {
@@ -1589,3 +1621,3 @@ void KABCore::addActionsManually()
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
-
+
//US link the searchwidget first to this.
@@ -1594,3 +1626,3 @@ void KABCore::addActionsManually()
//US tb->insertItem( mIncSearchWidget );
-/*US
+/*US
mIncSearchWidget = new IncSearchWidget( tb );
@@ -1598,5 +1630,5 @@ void KABCore::addActionsManually()
SLOT( incrementalSearch( const QString& ) ) );
-
+
mJumpButtonBar = new JumpButtonBar( this, this );
-
+
//US topLayout->addWidget( mJumpButtonBar );
@@ -1604,3 +1636,3 @@ void KABCore::addActionsManually()
*/
-
+
#endif //KAB_EMBEDDED
@@ -1625,3 +1657,3 @@ void KABCore::removeVoice()
}
-
+
}
@@ -1636,3 +1668,3 @@ void KABCore::clipboardDataChanged()
{
-
+
if ( mReadWrite )
@@ -1675,3 +1707,3 @@ void KABCore::configureResources()
KRES::KCMKResources dlg( this, "" , 0 );
-
+
if ( !dlg.exec() )
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 5b3b1ab..8bd4b15 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,21 +1,21 @@
-/*
- This file is part of KAddressBook.
- Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
-
+/*
+ This file is part of KAddressBook.
+ Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- As a special exception, permission is given to link this program
- with any edition of Qt, and distribute the resulting executable,
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
@@ -48,8 +48,11 @@ KABPrefs::KABPrefs()
-#ifdef KAB_EMBEDDED
- addItemBool("AskForQuit",&mAskForQuit,false);
+#ifdef KAB_EMBEDDED
+ 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" );
@@ -99,3 +102,3 @@ void KABPrefs::setCategoryDefaults()
mCustomCategories.clear();
-
+
mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 370fc5b..c81a9a9 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -1,23 +1,23 @@
-/*
- This file is part of KAddressBook.
- Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
-
+/*
+ This file is part of KAddressBook.
+ Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- As a special exception, permission is given to link this program
- with any edition of Qt, and distribute the resulting executable,
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
-*/
+*/
@@ -38,3 +38,11 @@ class KABPrefs : public KPimPrefs
static KABPrefs *instance();
-
+
+ enum EMailClients {
+ OMPI = 0,
+ QTOPIA = 1,
+ OPIE = 2,
+ OTHER = 3
+ };
+
+
// General
@@ -51,2 +59,6 @@ class KABPrefs : public KPimPrefs
bool mAskForQuit;
+
+ int mEmailClient;
+ QString mEmailChannel;
+
/** Set preferences to default values */
@@ -61,3 +73,3 @@ class KABPrefs : public KPimPrefs
-
+
// GUI
@@ -80,6 +92,6 @@ class KABPrefs : public KPimPrefs
void setCategoryDefaults();
-
+
private:
KABPrefs();
-
+
static KABPrefs *sInstance;
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
@@ -1,23 +1,23 @@
-/*
- This file is part of KAddressBook.
+/*
+ This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- As a special exception, permission is given to link this program
- with any edition of Qt, and distribute the resulting executable,
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
-*/
+*/
@@ -29,2 +29,6 @@
#include <qtabwidget.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qfile.h>
@@ -77,5 +81,5 @@ class ExtensionItem : public QCheckListItem
QString mComment;
-
+
#endif //KAB_EMBEDDED
-
+
};
@@ -95,3 +99,3 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
KDialog::spacingHintSmall() );
-
+ //general groupbox
QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
@@ -111,2 +115,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
+
+ //extensions groupbox
+
groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
@@ -123,3 +130,3 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
mExtensionView->setMaximumHeight(80);
-
+
boxLayout->addWidget( mExtensionView );
@@ -147,4 +154,92 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
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()
@@ -156,2 +251,6 @@ void KABConfigWidget::restoreSettings()
mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick );
+
+ mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
+ mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
+
mAddresseeWidget->restoreSettings();
@@ -169,2 +268,6 @@ void KABConfigWidget::saveSettings()
KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked();
+
+ KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
+ KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
+
mAddresseeWidget->saveSettings();
@@ -182,2 +285,6 @@ void KABConfigWidget::defaults()
+ mEmailClient->setCurrentItem(KABPrefs::OMPI);
+ emailclient_changed( KABPrefs::OMPI );
+
+
emit changed( true );
@@ -212,3 +319,3 @@ void KABConfigWidget::restoreExtensionSettings()
ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
-
+
item->setFactory( extensionFactory );
@@ -216,5 +323,5 @@ void KABConfigWidget::restoreExtensionSettings()
item->setOn( true );
-
-
+
+
extensionFactory = new DistributionListFactory();
@@ -222,3 +329,3 @@ void KABConfigWidget::restoreExtensionSettings()
item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
-
+
item->setFactory( extensionFactory );
@@ -226,6 +333,6 @@ void KABConfigWidget::restoreExtensionSettings()
item->setOn( true );
-
-
+
+
#endif //KAB_EMBEDDED
-
+
}
@@ -319,3 +426,3 @@ bool ExtensionItem::configWidgetAvailable() const
return false;
-
+
return extensionFactory->configureWidgetAvailable();
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
@@ -1,23 +1,23 @@
-/*
- This file is part of KAddressBook.
+/*
+ This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- As a special exception, permission is given to link this program
- with any edition of Qt, and distribute the resulting executable,
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
-*/
+*/
@@ -31,3 +31,4 @@ class QListViewItem;
class QPushButton;
-
+class QComboBox;
+class QLineEdit;
class KListView;
@@ -39,6 +40,6 @@ class KABConfigWidget : public QWidget
Q_OBJECT
-
+
public:
KABConfigWidget( QWidget *parent, const char *name = 0 );
-
+
void restoreSettings();
@@ -53,2 +54,4 @@ class KABConfigWidget : public QWidget
+
+
private slots:
@@ -57,2 +60,3 @@ class KABConfigWidget : public QWidget
void itemClicked( QListViewItem* );
+ void emailclient_changed( int newClient );
@@ -67,2 +71,4 @@ class KABConfigWidget : public QWidget
QPushButton *mConfigureButton;
+ QComboBox* mEmailClient;
+ QLineEdit* mEmailChannel;