author | ulf69 <ulf69> | 2004-08-05 22:50:37 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-05 22:50:37 (UTC) |
commit | c807547c32dd25e9d181d396590af9915b7a1166 (patch) (side-by-side diff) | |
tree | 0950df8ef9653ab30e2faebf67bdd254e0ec1b8a | |
parent | bb1dd236b41cbd5cc4aed3b320801aa07974122d (diff) | |
download | kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.zip kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.gz kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.bz2 |
enabled the sending of emails to selected contacts, and mailing of vCards
-rw-r--r-- | kaddressbook/kabcore.cpp | 254 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 47 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 58 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 167 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 48 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 25 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.cpp | 23 |
7 files changed, 392 insertions, 230 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a7ca0ce..2a54900 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -22,5 +22,5 @@ */ -#include "kabcore.h" +#include "kabcore.h" #include <stdaddressbook.h> @@ -79,6 +79,12 @@ #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> @@ -92,9 +98,15 @@ //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" @@ -130,8 +142,5 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const #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" ); @@ -143,5 +152,5 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); #endif //KAB_EMBEDDED - + connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), SLOT( addressBookChanged() ) ); @@ -163,6 +172,6 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, "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. mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, @@ -196,11 +205,12 @@ 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& ) ) ); @@ -222,10 +232,4 @@ KABCore::~KABCore() mAddressBook = 0; KABC::StdAddressBook::close(); - -#ifdef KAB_EMBEDDED - //US we define here our own global actioncollection. - // delete mActionCollection; -#endif //KAB_EMBEDDED - } @@ -236,5 +240,5 @@ void KABCore::restoreSettings() mActionJumpBar->setChecked( state ); setJumpButtonBarVisible( state ); - + state = KABPrefs::instance()->mDetailsPageVisible; @@ -295,7 +299,7 @@ void KABCore::saveSettings() mExtensionManager->saveSettings(); mViewManager->saveSettings(); - + KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); - + } @@ -379,7 +383,7 @@ void KABCore::createAboutData() return about; #endif //KAB_EMBEDDED - + QString version; -#include <../version> +#include <../version> QMessageBox::about( this, "About KAddressbook/Pi", "KAddressbook/Platform-independent\n" @@ -391,5 +395,5 @@ void KABCore::createAboutData() "for: Zaurus 5500 / 7x0 / 8x0\n" #endif - + "(c) 2004 Ulf Schenk\n" "(c) 1997-2003, The KDE PIM Team\n" @@ -419,5 +423,5 @@ void KABCore::setContactSelected( const QString &uid ) if ( pic.isIntern() ) { //US emit contactSelected( pic.data() ); -//US instead use: +//US instead use: QPixmap px; if (pic.data().isNull() != true) @@ -425,5 +429,5 @@ void KABCore::setContactSelected( const QString &uid ) px.convertFromImage(pic.data()); } - + emit contactSelected( px ); } @@ -452,36 +456,48 @@ 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; @@ -493,4 +509,9 @@ void KABCore::mailVCard( const QStringList& uids ) QString dirName = tempDir.name(); tempDir.unlink(); +*/ + QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); + + + QDir().mkdir( dirName, true ); @@ -521,5 +542,5 @@ void KABCore::mailVCard( const QStringList& uids ) } } - +/*US kapp->invokeMailer( QString::null, QString::null, QString::null, QString::null, // subject @@ -527,7 +548,18 @@ void KABCore::mailVCard( const QStringList& uids ) 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 + } @@ -753,5 +785,5 @@ void KABCore::setModified( bool modified ) mViewManager->refreshView(); mDetails->refreshView(); - + } @@ -763,5 +795,5 @@ bool KABCore::modified() const void KABCore::contactModified( const KABC::Addressee &addr ) { - + Command *command = 0; QString uid; @@ -807,12 +839,12 @@ void KABCore::newContact() addr.setResource( resource ); mEditorDialog->setAddressee( addr ); - KApplication::execDialog ( mEditorDialog ); - + KApplication::execDialog ( mEditorDialog ); + } else return; - + // mEditorDict.insert( dialog->addressee().uid(), dialog ); - + } @@ -889,5 +921,5 @@ 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() { editContact( QString::null ); @@ -982,5 +1014,5 @@ void KABCore::setDetailsVisible( bool visible ) void KABCore::extensionModified( const KABC::Addressee::List &list ) { - + if ( list.count() != 0 ) { KABC::Addressee::List::ConstIterator it; @@ -989,5 +1021,5 @@ void KABCore::extensionModified( const KABC::Addressee::List &list ) if ( list.count() > 1 ) setModified(); - else + else setModifiedWOrefresh(); } @@ -997,5 +1029,5 @@ void KABCore::extensionModified( const KABC::Addressee::List &list ) mViewManager->refreshView( list[ 0 ].uid() ); - + } @@ -1029,5 +1061,5 @@ QString KABCore::getNameByPhone( const QString &phone ) return ""; #endif //KAB_EMBEDDED - + } @@ -1186,5 +1218,5 @@ 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. viewMenu = new QPopupMenu( this ); @@ -1203,5 +1235,5 @@ void KABCore::initGUI() // = new QHBoxLayout( this ); // QBoxLayout *topLayout = (QBoxLayout*)layout(); - + // QWidget *mainBox = new QWidget( this ); // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); @@ -1210,8 +1242,8 @@ void KABCore::initGUI() topLayout = new QHBoxLayout( this ); - + mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); - + topLayout->addWidget(mMiniSplitter ); @@ -1232,16 +1264,16 @@ void KABCore::initGUI() mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); } - + topLayout->addWidget(mMiniSplitter ); mViewManager = new ViewManager( this, mMiniSplitter ); mDetails = new ViewContainer( mMiniSplitter ); - - + + mExtensionManager = new ExtensionManager( this, mMiniSplitter ); #endif //eh->hide(); // topLayout->addWidget(mExtensionManager ); - - + + /*US #ifndef KAB_NOSPLITTER @@ -1258,5 +1290,5 @@ void KABCore::initGUI() mDetails = new ViewContainer( mDetailsSplitter ); - + topLayout->addWidget( mDetailsSplitter ); topLayout->setStretchFactor( mDetailsSplitter, 100 ); @@ -1281,5 +1313,5 @@ void KABCore::initGUI() */ - + #endif //KAB_EMBEDDED initActions(); @@ -1299,24 +1331,24 @@ void KABCore::initGUI() SLOT( incrementalSearch( const QString& ) ) ); - + mJumpButtonBar = new JumpButtonBar( this, this ); topLayout->addWidget( mJumpButtonBar ); //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); - + // mMainWindow->getIconToolBar()->raise(); #endif //KAB_EMBEDDED - + } void KABCore::initActions() { //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); - + #ifndef KAB_EMBEDDED connect( QApplication::clipboard(), SIGNAL( dataChanged() ), SLOT( clipboardDataChanged() ) ); #endif //KAB_EMBEDDED - + // file menu if ( mIsPart ) { @@ -1331,11 +1363,11 @@ void KABCore::initActions() mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); } - + 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, this, SLOT( mailVCard() ), @@ -1352,5 +1384,5 @@ void KABCore::initActions() actionCollection(), "quit" ); #endif //KAB_EMBEDDED - + // edit menu if ( mIsPart ) { @@ -1388,5 +1420,5 @@ void KABCore::initActions() mActionUndo->setEnabled( false ); mActionRedo->setEnabled( false ); - + // settings menu #ifdef KAB_EMBEDDED @@ -1397,10 +1429,10 @@ void KABCore::initActions() "kaddressbook_configure_resources" ); #endif //KAB_EMBEDDED - + if ( mIsPart ) { mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, SLOT( openConfigDialog() ), actionCollection(), "kaddressbook_configure" ); - + mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, this, SLOT( configureKeyBindings() ), actionCollection(), @@ -1410,22 +1442,22 @@ void KABCore::initActions() mActionConfigureToolbars->setEnabled( false ); #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, actionCollection(), "options_show_jump_bar" ); connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); - + mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, actionCollection(), "options_show_details" ); 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" ) ) ) { new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, @@ -1433,8 +1465,8 @@ void KABCore::initActions() "ldap_lookup" ); } -#else //KAB_EMBEDDED +#else //KAB_EMBEDDED //qDebug("KABCore::initActions() LDAP has to be implemented"); -#endif //KAB_EMBEDDED - +#endif //KAB_EMBEDDED + mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, @@ -1458,5 +1490,5 @@ void KABCore::initActions() "kaddressbook_about_data" ); #endif //KAB_EMBEDDED - + clipboardDataChanged(); connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); @@ -1479,5 +1511,5 @@ void KABCore::addActionsManually() #ifdef DESKTOP_VERSION QMenuBar* mb = mMainWindow->menuBar(); - + //US setup menubar. //Disable the following block if you do not want to have a menubar. @@ -1490,6 +1522,6 @@ void KABCore::addActionsManually() mIncSearchWidget = new IncSearchWidget( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget); - -#else + +#else //US setup toolbar QMenuBar *menuBarTB = new QMenuBar( tb ); @@ -1498,5 +1530,5 @@ void KABCore::addActionsManually() tb->insertWidget(-1, 0, menuBarTB); mIncSearchWidget = new IncSearchWidget( tb ); - + tb->enableMoving(false); popupBarTB->insertItem( "&File", fileMenu ); @@ -1519,8 +1551,8 @@ void KABCore::addActionsManually() mActionMail->plug( fileMenu ); fileMenu->insertSeparator(); - + mActionNewContact->plug( fileMenu ); mActionNewContact->plug( tb ); - + mActionEditAddressee->plug( fileMenu ); fileMenu->insertSeparator(); @@ -1534,5 +1566,5 @@ void KABCore::addActionsManually() #ifdef _WIN32_ mActionImportOL->plug( ImportMenu ); -#endif +#endif // edit menu mActionUndo->plug( editMenu ); @@ -1545,5 +1577,5 @@ void KABCore::addActionsManually() editMenu->insertSeparator(); mActionSelectAll->plug( editMenu ); - + mActionRemoveVoice->plug( changeMenu ); // settings menu @@ -1554,15 +1586,15 @@ void KABCore::addActionsManually() mActionConfigKAddressbook->plug( settingsMenu ); - + if ( mIsPart ) { mActionConfigShortcuts->plug( settingsMenu ); mActionConfigureToolbars->plug( settingsMenu ); - + } else { mActionKeyBindings->plug( settingsMenu ); } - + settingsMenu->insertSeparator(); - + mActionJumpBar->plug( settingsMenu ); mActionDetails->plug( settingsMenu ); @@ -1571,13 +1603,13 @@ void KABCore::addActionsManually() mActionWhoAmI->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); - + mActionAboutKAddressbook->plug( helpMenu ); - + if (QApplication::desktop()->width() > 320 ) { mActionEditAddressee->plug( tb ); mActionSave->plug( tb ); - mViewManager->getFilterAction()->plug ( tb); + mViewManager->getFilterAction()->plug ( tb); if (QApplication::desktop()->width() > 480 ) { mActionUndo->plug( tb ); @@ -1588,20 +1620,20 @@ void KABCore::addActionsManually() //mActionQuit->plug ( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget, 6); - + //US link the searchwidget first to this. // The real linkage to the toolbar happens later. //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); //US tb->insertItem( mIncSearchWidget ); -/*US +/*US mIncSearchWidget = new IncSearchWidget( tb ); connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); - + mJumpButtonBar = new JumpButtonBar( this, this ); - + //US topLayout->addWidget( mJumpButtonBar ); this->layout()->add( mJumpButtonBar ); */ - + #endif //KAB_EMBEDDED } @@ -1624,5 +1656,5 @@ void KABCore::removeVoice() } } - + } if ( found ) @@ -1635,5 +1667,5 @@ void KABCore::removeVoice() void KABCore::clipboardDataChanged() { - + if ( mReadWrite ) mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); @@ -1674,5 +1706,5 @@ void KABCore::configureResources() { KRES::KCMKResources dlg( this, "" , 0 ); - + if ( !dlg.exec() ) return; diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 5b3b1ab..8bd4b15 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -1,22 +1,22 @@ -/* - 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. */ @@ -47,10 +47,13 @@ KABPrefs::KABPrefs() addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); -#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" ); addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); @@ -98,5 +101,5 @@ void KABPrefs::setCategoryDefaults() { mCustomCategories.clear(); - + mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) << i18n( "Customer" ) << i18n( "Friend" ); diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 370fc5b..c81a9a9 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -1,24 +1,24 @@ -/* - 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. -*/ +*/ #ifndef KABPREFS_H @@ -37,5 +37,13 @@ class KABPrefs : public KPimPrefs static KABPrefs *instance(); - + + enum EMailClients { + OMPI = 0, + QTOPIA = 1, + OPIE = 2, + OTHER = 3 + }; + + // General bool mHonorSingleClick; @@ -50,4 +58,8 @@ class KABPrefs : public KPimPrefs bool mToolBarUp; bool mAskForQuit; + + int mEmailClient; + QString mEmailChannel; + /** Set preferences to default values */ // void usrSetDefaults(); @@ -60,5 +72,5 @@ class KABPrefs : public KPimPrefs #endif //KAB_EMBEDDED - + // GUI bool mJumpButtonBarVisible; @@ -79,8 +91,8 @@ 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,24 +1,24 @@ -/* - 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. -*/ +*/ #include <qcheckbox.h> @@ -28,4 +28,8 @@ #include <qpushbutton.h> #include <qtabwidget.h> +#include <qcombobox.h> +#include <qlineedit.h> +#include <qlabel.h> +#include <qfile.h> #include <kconfig.h> @@ -76,7 +80,7 @@ class ExtensionItem : public QCheckListItem QString mName; QString mComment; - + #endif //KAB_EMBEDDED - + }; @@ -94,5 +98,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) 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() ); @@ -110,4 +114,7 @@ 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() ); @@ -122,5 +129,5 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) mExtensionView->addColumn( i18n( "Description" ) ); mExtensionView->setMaximumHeight(80); - + boxLayout->addWidget( mExtensionView ); @@ -146,6 +153,94 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) 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() { @@ -155,4 +250,8 @@ 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(); @@ -168,4 +267,8 @@ 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(); @@ -181,4 +284,8 @@ void KABConfigWidget::defaults() mViewsSingleClickBox->setChecked( false ); + mEmailClient->setCurrentItem(KABPrefs::OMPI); + emailclient_changed( KABPrefs::OMPI ); + + emit changed( true ); } @@ -211,22 +318,22 @@ void KABConfigWidget::restoreExtensionSettings() ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); - + item->setFactory( extensionFactory ); if ( activeExtensions.contains( extensionFactory->identifier() ) ) item->setOn( true ); - - + + extensionFactory = new DistributionListFactory(); item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); - + item->setFactory( extensionFactory ); if ( activeExtensions.contains( extensionFactory->identifier() ) ) item->setOn( true ); - - + + #endif //KAB_EMBEDDED - + } @@ -318,5 +425,5 @@ bool ExtensionItem::configWidgetAvailable() const if ( !extensionFactory ) return false; - + return extensionFactory->configureWidgetAvailable(); #else //KAB_EMBEDDED 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,24 +1,24 @@ -/* - 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. -*/ +*/ #ifndef KABCONFIGWIDGET_H @@ -30,5 +30,6 @@ class QCheckBox; class QListViewItem; class QPushButton; - +class QComboBox; +class QLineEdit; class KListView; @@ -38,8 +39,8 @@ class KABConfigWidget : public QWidget { Q_OBJECT - + public: KABConfigWidget( QWidget *parent, const char *name = 0 ); - + void restoreSettings(); void saveSettings(); @@ -52,8 +53,11 @@ class KABConfigWidget : public QWidget void modified(); + + private slots: void configureExtension(); void selectionChanged( QListViewItem* ); void itemClicked( QListViewItem* ); + void emailclient_changed( int newClient ); private: @@ -66,4 +70,6 @@ class KABConfigWidget : public QWidget 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 @@ -17,5 +17,5 @@ KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, const QString &caption, int buttonMask, ButtonCode defaultButton, - bool separator, + bool separator, const QString &user1, const QString &user2, @@ -29,7 +29,7 @@ KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, } -KDialogBase::KDialogBase( int dialogFace, const QString &caption, - int buttonMask, ButtonCode defaultButton, - QWidget *parent, const char *name, bool modal, +KDialogBase::KDialogBase( int dialogFace, const QString &caption, + int buttonMask, ButtonCode defaultButton, + QWidget *parent, const char *name, bool modal, bool separator, const QString &user1, @@ -79,5 +79,4 @@ void KDialogBase::init( const QString &caption, int buttonMask, } if ( buttonMask & Default ) { - qDebug("buttonMask & Default "); mDefaultButton = new QPushButton( i18n("Default"), this ); connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); @@ -105,5 +104,5 @@ void KDialogBase::init( const QString &caption, int buttonMask, } else { mCloseButton = 0; - } + } } @@ -126,19 +125,19 @@ void KDialogBase::hideButtons() if ( mCancelButton ) mCancelButton->hide() ; if ( mCloseButton ) mCloseButton->hide() ; - + } void KDialogBase::initLayout() { - + delete mTopLayout; mTopLayout = new QVBoxLayout( this ); mTopLayout->setMargin( marginHint() ); mTopLayout->setSpacing( spacingHint() ); - + mTopLayout->addWidget( mMainWidget ); - + QBoxLayout *buttonLayout = new QHBoxLayout; mTopLayout->addLayout( buttonLayout ); - + if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); @@ -206,5 +205,5 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) case Cancel: button = mCancelButton; - break; + break; case Default: button = mDefaultButton; @@ -214,5 +213,5 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) break; default: - break; + break; } return button; 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 @@ -44,4 +44,7 @@ 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 ); @@ -50,9 +53,9 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch resize(640,480); #else - resize(640,480); + resize(640,480); setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); //showMaximized(); #endif - + } @@ -66,5 +69,5 @@ void KCMultiDialog::slotDefault() int curPageIndex = mMainWidget->activePageIndex(); - + QPtrListIterator<KCModule> it(modules); for (; it.current(); ++it) @@ -77,5 +80,5 @@ void KCMultiDialog::slotDefault() } } - + } @@ -90,5 +93,5 @@ qDebug("KCMultiDialog::slotApply clicked"); emit applyClicked(); - + } @@ -97,5 +100,5 @@ void KCMultiDialog::slotOk() { qDebug("KCMultiDialog::slotOk clicked"); - + QPtrListIterator<KCModule> it(modules); for (; it.current(); ++it) @@ -120,5 +123,5 @@ void KCMultiDialog::slotHelp() new KRun(url); } -*/ +*/ } @@ -128,5 +131,5 @@ void KCMultiDialog::clientChanged(bool state) } -/*US +/*US void KCMultiDialog::addModule(const QString& path, bool withfallback) { @@ -158,5 +161,5 @@ void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, modules.append(module); connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); - + } @@ -198,4 +201,4 @@ void KCMultiDialog::slotAboutToShow(QWidget *page) */ -qDebug("KCMultiDialog::slotAboutToShow not implemented"); +qDebug("KCMultiDialog::slotAboutToShow not implemented"); } |