-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 @@ -16,17 +16,17 @@ 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 "kabcore.h" +#include "kabcore.h" #include <stdaddressbook.h> #include <klocale.h> #ifndef KAB_EMBEDDED #include <qclipboard.h> #include <qdir.h> #include <qfile.h> @@ -73,34 +73,46 @@ #include <qmessagebox.h> #include <kdebug.h> #include <kiconloader.h> // needed for SmallIcon #include <kresources/kcmkresources.h> #include <ktoolbar.h> #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> #include <kresources/selectdialog.h> #include <kmessagebox.h> #include <picture.h> #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" #include "addresseeeditordialog.h" #include "viewmanager.h" #include "details/detailsviewcontainer.h" #include "kabprefs.h" #include "xxportmanager.h" @@ -124,30 +136,27 @@ KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, con mReadWrite( readWrite ), mModified( false ), mMainWindow(client) #else //KAB_EMBEDDED KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 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" ); mAddressBook = KABC::StdAddressBook::self(); KABC::StdAddressBook::setAutomaticSave( false ); #ifndef KAB_EMBEDDED mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); #endif //KAB_EMBEDDED - + connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), SLOT( addressBookChanged() ) ); mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, "X-Department", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, "X-Profession", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, @@ -157,18 +166,18 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, "X-SpousesName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, "X-Office", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, "X-IMAddress", "KADDRESSBOOK" ); 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, "X-Gender", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, "X-Children", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, "X-FreeBusyUrl", "KADDRESSBOOK" ); @@ -190,23 +199,24 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const connect( mXXPortManager, SIGNAL( modified() ), SLOT( setModified() ) ); connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); 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& ) ) ); mAddressBookService = new KAddressBookService( this ); #endif //KAB_EMBEDDED mEditorDialog = 0; createAddresseeEditorDialog( this ); @@ -216,31 +226,25 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const KABCore::~KABCore() { // save(); //saveSettings(); //KABPrefs::instance()->writeConfig(); 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() { bool state = KABPrefs::instance()->mJumpButtonBarVisible; mActionJumpBar->setChecked( state ); setJumpButtonBarVisible( state ); - + state = KABPrefs::instance()->mDetailsPageVisible; mActionDetails->setChecked( state ); setDetailsVisible( state ); QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); @@ -289,19 +293,19 @@ void KABCore::saveSettings() KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); #ifndef KAB_EMBEDDED KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); #endif //KAB_EMBEDDED mExtensionManager->saveSettings(); mViewManager->saveSettings(); - + KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); - + } KABC::AddressBook *KABCore::addressBook() const { return mAddressBook; } KConfig *KABCore::config() @@ -373,29 +377,29 @@ void KABCore::createAboutData() about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), "michel@klaralvdalens-datakonsult.se" ); about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), "hansen@kde.org" ); return about; #endif //KAB_EMBEDDED - + QString version; -#include <../version> +#include <../version> QMessageBox::about( this, "About KAddressbook/Pi", "KAddressbook/Platform-independent\n" "(KA/Pi) " +version + " - " + #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\n" "for: Zaurus 5500 / 7x0 / 8x0\n" #endif - + "(c) 2004 Ulf Schenk\n" "(c) 1997-2003, The KDE PIM Team\n" "Tobias Koenig Current maintainer tokoe@kde.org\n" "Don Sanders Original author\n" "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" "Mike Pilone GUI and framework redesign mpilone@slac.com\n" "Greg Stern DCOP interface\n" "Mark Westcot Contact pinning\n" @@ -413,23 +417,23 @@ void KABCore::setContactSelected( const QString &uid ) if ( !mDetails->isHidden() ) mDetails->setAddressee( addr ); if ( !addr.isEmpty() ) { emit contactSelected( addr.formattedName() ); KABC::Picture pic = addr.photo(); if ( pic.isIntern() ) { //US emit contactSelected( pic.data() ); -//US instead use: +//US instead use: QPixmap px; if (pic.data().isNull() != true) { px.convertFromImage(pic.data()); } - + emit contactSelected( px ); } } mExtensionManager->setSelectionChanged(); // update the actions @@ -446,57 +450,74 @@ void KABCore::setContactSelected( const QString &uid ) mActionMail->setEnabled( selected ); mActionMailVCard->setEnabled( selected ); mActionWhoAmI->setEnabled( selected ); mActionCategories->setEnabled( selected ); } 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 ) { kdWarning() << strerror( tempDir.status() ) << endl; return; } 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 ) { KABC::Addressee a = mAddressBook->findByUid( *it ); if ( a.isEmpty() ) continue; @@ -515,25 +536,36 @@ void KABCore::mailVCard( const QStringList& uids ) t.setEncoding( QTextStream::UnicodeUTF8 ); t << vcard; outFile.close(); 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 + } void KABCore::browse( const QString& url ) { #ifndef KAB_EMBEDDED kapp->invokeBrowser( url ); #else //KAB_EMBEDDED @@ -747,27 +779,27 @@ void KABCore::setModified( bool modified ) mModified = modified; mActionSave->setEnabled( mModified ); if ( modified ) mJumpButtonBar->recreateButtons(); mViewManager->refreshView(); mDetails->refreshView(); - + } bool KABCore::modified() const { return mModified; } void KABCore::contactModified( const KABC::Addressee &addr ) { - + Command *command = 0; QString uid; // check if it exists already KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); if ( origAddr.isEmpty() ) command = new PwNewCommand( mAddressBook, addr ); else { @@ -801,24 +833,24 @@ void KABCore::newContact() KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); resource = static_cast<KABC::Resource*>( res ); if ( resource ) { KABC::Addressee addr; addr.setResource( resource ); mEditorDialog->setAddressee( addr ); - KApplication::execDialog ( mEditorDialog ); - + KApplication::execDialog ( mEditorDialog ); + } else return; - + // mEditorDict.insert( dialog->addressee().uid(), dialog ); - + } void KABCore::addEmail( QString aStr ) { #ifndef KAB_EMBEDDED QString fullName, email; KABC::Addressee::parseEmailAddress( aStr, fullName, email ); @@ -883,17 +915,17 @@ void KABCore::importFromOL() #endif } void KABCore::importVCard( const QString &vCard, bool showPreview ) { mXXPortManager->importVCard( vCard, showPreview ); } -//US added a second method without defaultparameter +//US added a second method without defaultparameter void KABCore::editContact2() { editContact( QString::null ); } void KABCore::editContact( const QString &uid ) { if ( mExtensionManager->isQuickEditVisible() ) @@ -976,32 +1008,32 @@ void KABCore::setDetailsVisible( bool visible ) if ( visible ) mDetails->show(); else mDetails->hide(); } void KABCore::extensionModified( const KABC::Addressee::List &list ) { - + if ( list.count() != 0 ) { KABC::Addressee::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) mAddressBook->insertAddressee( *it ); if ( list.count() > 1 ) setModified(); - else + else setModifiedWOrefresh(); } if ( list.count() == 0 ) mViewManager->refreshView(); else mViewManager->refreshView( list[ 0 ].uid() ); - + } QString KABCore::getNameByPhone( const QString &phone ) { #ifndef KAB_EMBEDDED QRegExp r( "[/*/-/ ]" ); QString localPhone( phone ); @@ -1023,17 +1055,17 @@ QString KABCore::getNameByPhone( const QString &phone ) } } return ownerName; #else //KAB_EMBEDDED qDebug("KABCore::getNameByPhone finsih method"); return ""; #endif //KAB_EMBEDDED - + } void KABCore::openConfigDialog() { KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); ConfigureDialog->addModule(kabcfg ); connect( ConfigureDialog, SIGNAL( applyClicked() ), @@ -1180,44 +1212,44 @@ void KABCore::initGUI() topLayout->addWidget( mExtensionBarSplitter ); topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); topLayout->addWidget( mJumpButtonBar ); topLayout->setStretchFactor( mJumpButtonBar, 1 ); mXXPortManager = new XXPortManager( this, this ); #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 ); settingsMenu = new QPopupMenu( this ); //filterMenu = new QPopupMenu( this ); ImportMenu = new QPopupMenu( this ); ExportMenu = new QPopupMenu( this ); changeMenu= new QPopupMenu( this ); //US since we have no splitter for the embedded system, setup // a layout with two frames. One left and one right. QBoxLayout *topLayout; // = new QHBoxLayout( this ); // QBoxLayout *topLayout = (QBoxLayout*)layout(); - + // QWidget *mainBox = new QWidget( this ); // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); #ifdef DESKTOP_VERSION topLayout = new QHBoxLayout( this ); - + mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); - + topLayout->addWidget(mMiniSplitter ); mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); mViewManager = new ViewManager( this, mExtensionBarSplitter ); mDetails = new ViewContainer( mMiniSplitter ); mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); #else @@ -1226,43 +1258,43 @@ void KABCore::initGUI() mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { topLayout = new QHBoxLayout( this ); mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 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 QHBoxLayout *topLayout = new QHBoxLayout( this ); //US topLayout->setSpacing( KDialogBase::spacingHint() ); topLayout->setSpacing( 10 ); mDetailsSplitter = new QSplitter( this ); QVBox *viewSpace = new QVBox( mDetailsSplitter ); mViewManager = new ViewManager( this, viewSpace ); viewSpace->setStretchFactor( mViewManager, 1 ); mDetails = new ViewContainer( mDetailsSplitter ); - + topLayout->addWidget( mDetailsSplitter ); topLayout->setStretchFactor( mDetailsSplitter, 100 ); #else //KAB_NOSPLITTER QHBoxLayout *topLayout = new QHBoxLayout( this ); //US topLayout->setSpacing( KDialogBase::spacingHint() ); topLayout->setSpacing( 10 ); // mDetailsSplitter = new QSplitter( this ); @@ -1275,17 +1307,17 @@ void KABCore::initGUI() mDetails = new ViewContainer( this ); topLayout->addWidget( viewSpace ); // topLayout->setStretchFactor( mDetailsSplitter, 100 ); topLayout->addWidget( mDetails ); #endif //KAB_NOSPLITTER */ - + #endif //KAB_EMBEDDED initActions(); #ifdef KAB_EMBEDDED addActionsManually(); //US make sure the export and import menues are initialized before creating the xxPortManager. mXXPortManager = new XXPortManager( this, this ); @@ -1293,70 +1325,70 @@ void KABCore::initGUI() //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); // mActionQuit->plug ( mMainWindow->toolBar()); //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); // mIncSearchWidget->hide(); connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 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 ) { mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, SLOT( sendMail() ), actionCollection(), "kaddressbook_mail" ); mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, SLOT( print() ), actionCollection(), "kaddressbook_print" ); } else { mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 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() ), actionCollection(), "file_mail_vcard"); mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, this, SLOT( editContact2() ), actionCollection(), "file_properties" ); #ifdef KAB_EMBEDDED // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, mMainWindow, SLOT( exit() ), actionCollection(), "quit" ); #endif //KAB_EMBEDDED - + // edit menu if ( mIsPart ) { mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, SLOT( copyContacts() ), actionCollection(), "kaddressbook_copy" ); mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, SLOT( cutContacts() ), actionCollection(), "kaddressbook_cut" ); @@ -1382,65 +1414,65 @@ void KABCore::initActions() } mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", Key_Delete, this, SLOT( deleteContacts() ), actionCollection(), "edit_delete" ); mActionUndo->setEnabled( false ); mActionRedo->setEnabled( false ); - + // settings menu #ifdef KAB_EMBEDDED //US special menuentry to configure the addressbook resources. On KDE // you do that through the control center !!! mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, SLOT( configureResources() ), actionCollection(), "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(), "kaddressbook_configure_shortcuts" ); #ifdef KAB_EMBEDDED mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 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, this, SLOT( openLDAPDialog() ), actionCollection(), "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, SLOT( setWhoAmI() ), actionCollection(), "set_personal" ); mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, SLOT( setCategories() ), actionCollection(), "edit_set_categories" ); @@ -1452,17 +1484,17 @@ void KABCore::initActions() SLOT( importFromOL() ), actionCollection(), "import_OL" ); #ifdef KAB_EMBEDDED mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, this, SLOT( createAboutData() ), actionCollection(), "kaddressbook_about_data" ); #endif //KAB_EMBEDDED - + clipboardDataChanged(); connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); } //US we need this function, to plug all actions into the correct menues. // KDE uses a XML format to plug the actions, but we work her without this overhead. void KABCore::addActionsManually() @@ -1473,36 +1505,36 @@ void KABCore::addActionsManually() QPopupMenu *fileMenu = new QPopupMenu( this ); QPopupMenu *editMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); KToolBar* tb = mMainWindow->toolBar(); #ifdef DESKTOP_VERSION QMenuBar* mb = mMainWindow->menuBar(); - + //US setup menubar. //Disable the following block if you do not want to have a menubar. mb->insertItem( "&File", fileMenu ); mb->insertItem( "&Edit", editMenu ); mb->insertItem( "&View", viewMenu ); mb->insertItem( "&Settings", settingsMenu ); mb->insertItem( "&Change selected", changeMenu ); mb->insertItem( "&Help", helpMenu ); mIncSearchWidget = new IncSearchWidget( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget); - -#else + +#else //US setup toolbar QMenuBar *menuBarTB = new QMenuBar( tb ); QPopupMenu *popupBarTB = new QPopupMenu( this ); menuBarTB->insertItem( "ME", popupBarTB); tb->insertWidget(-1, 0, menuBarTB); mIncSearchWidget = new IncSearchWidget( tb ); - + tb->enableMoving(false); popupBarTB->insertItem( "&File", fileMenu ); popupBarTB->insertItem( "&Edit", editMenu ); popupBarTB->insertItem( "&View", viewMenu ); popupBarTB->insertItem( "&Settings", settingsMenu ); mViewManager->getFilterAction()->plug ( popupBarTB); popupBarTB->insertItem( "&Change selected", changeMenu ); popupBarTB->insertItem( "&Help", helpMenu ); @@ -1513,101 +1545,101 @@ void KABCore::addActionsManually() // mActionQuit->plug ( mMainWindow->toolBar()); //US Now connect the actions with the menue entries. mActionPrint->plug( fileMenu ); mActionMail->plug( fileMenu ); fileMenu->insertSeparator(); - + mActionNewContact->plug( fileMenu ); mActionNewContact->plug( tb ); - + mActionEditAddressee->plug( fileMenu ); fileMenu->insertSeparator(); mActionSave->plug( fileMenu ); fileMenu->insertItem( "&Import", ImportMenu ); fileMenu->insertItem( "&Emport", ExportMenu ); fileMenu->insertSeparator(); mActionMailVCard->plug( fileMenu ); fileMenu->insertSeparator(); mActionQuit->plug( fileMenu ); #ifdef _WIN32_ mActionImportOL->plug( ImportMenu ); -#endif +#endif // edit menu mActionUndo->plug( editMenu ); mActionRedo->plug( editMenu ); editMenu->insertSeparator(); mActionCut->plug( editMenu ); mActionCopy->plug( editMenu ); mActionPaste->plug( editMenu ); mActionDelete->plug( editMenu ); editMenu->insertSeparator(); mActionSelectAll->plug( editMenu ); - + mActionRemoveVoice->plug( changeMenu ); // settings menu //US special menuentry to configure the addressbook resources. On KDE // you do that through the control center !!! mActionConfigResources->plug( settingsMenu ); settingsMenu->insertSeparator(); mActionConfigKAddressbook->plug( settingsMenu ); - + if ( mIsPart ) { mActionConfigShortcuts->plug( settingsMenu ); mActionConfigureToolbars->plug( settingsMenu ); - + } else { mActionKeyBindings->plug( settingsMenu ); } - + settingsMenu->insertSeparator(); - + mActionJumpBar->plug( settingsMenu ); mActionDetails->plug( settingsMenu ); settingsMenu->insertSeparator(); 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 ); mActionDelete->plug( tb ); mActionRedo->plug( tb ); } } //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 } void KABCore::removeVoice() { if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) return; KABC::Addressee::List list = mViewManager->selectedAddressees(); KABC::Addressee::List::Iterator it; @@ -1618,28 +1650,28 @@ void KABCore::removeVoice() for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found if ((*phoneIt).type() - PhoneNumber::Voice ) { (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); (*it).insertPhoneNumber( (*phoneIt) ); found = true; } } - + } if ( found ) contactModified((*it) ); } } void KABCore::clipboardDataChanged() { - + if ( mReadWrite ) mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); } void KABCore::updateActionMenu() { UndoStack *undo = UndoStack::instance(); @@ -1668,17 +1700,17 @@ void KABCore::configureKeyBindings() 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 diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 5b3b1ab..8bd4b15 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -1,28 +1,28 @@ -/* - 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. */ //US#ifdef KAB_EMBEDDED //#include <qstring.h> //#endif //KAB_EMBEDDED @@ -41,22 +41,25 @@ KABPrefs::KABPrefs() { KPrefs::setCurrentGroup( "Views" ); addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); KPrefs::setCurrentGroup( "General" ); addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 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 ); addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); addItemIntList( "DetailsSplitter", &mDetailsSplitter ); KPrefs::setCurrentGroup( "Extensions_General" ); QStringList defaultExtensions; @@ -92,17 +95,17 @@ KABPrefs *KABPrefs::instance() } return sInstance; } void KABPrefs::setCategoryDefaults() { mCustomCategories.clear(); - + mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) << i18n( "Customer" ) << i18n( "Friend" ); } // US introduce a nonconst way to return the config object. KConfig* KABPrefs::getConfig() { return config(); diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 370fc5b..c81a9a9 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h @@ -1,70 +1,82 @@ -/* - 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 #define KABPREFS_H #include <qstringlist.h> #include <libkdepim/kpimprefs.h> class KConfig; class KABPrefs : public KPimPrefs { public: virtual ~KABPrefs(); static KABPrefs *instance(); - + + enum EMailClients { + OMPI = 0, + QTOPIA = 1, + OPIE = 2, + OTHER = 3 + }; + + // General bool mHonorSingleClick; bool mAutomaticNameParsing; int mCurrentIncSearchField; #ifdef KAB_EMBEDDED // US introduce a nonconst way to return the config object. KConfig* getConfig(); bool mToolBarHor; bool mToolBarUp; bool mAskForQuit; + + int mEmailClient; + QString mEmailChannel; + /** Set preferences to default values */ // void usrSetDefaults(); /** Read preferences from config file */ // void usrReadConfig(); /** Write preferences to config file */ // void usrWriteConfig(); #endif //KAB_EMBEDDED - + // GUI bool mJumpButtonBarVisible; bool mDetailsPageVisible; QValueList<int> mExtensionsSplitter; QValueList<int> mDetailsSplitter; // Extensions stuff int mCurrentExtension; @@ -73,16 +85,16 @@ class KABPrefs : public KPimPrefs // Views stuff QString mCurrentView; QStringList mViewNames; // Filter int mCurrentFilter; void setCategoryDefaults(); - + private: KABPrefs(); - + static KABPrefs *sInstance; }; #endif 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,37 +1,41 @@ -/* - 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> #include <qframe.h> #include <qgroupbox.h> #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> #include <kdialog.h> #include <klistview.h> #include <klocale.h> #include <kglobal.h> #include <kmessagebox.h> @@ -70,63 +74,66 @@ class ExtensionItem : public QCheckListItem private: #ifndef KAB_EMBEDDED KService::Ptr mPtr; #else //KAB_EMBEDDED ExtensionFactory* mFactory; QString mName; QString mComment; - + #endif //KAB_EMBEDDED - + }; KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); QTabWidget *tabWidget = new QTabWidget( this ); topLayout->addWidget( tabWidget ); // General page 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 ); boxLayout->setMargin(KDialog::marginHintSmall() ); groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); boxLayout->setSpacing( KDialog::spacingHintSmall() ); mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); boxLayout->addWidget( mViewsSingleClickBox ); mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); boxLayout->addWidget( mNameParsing ); layout->addWidget( groupBox ); + + //extensions groupbox + groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); boxLayout = new QVBoxLayout( groupBox->layout() ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall()); boxLayout->setSpacing(KDialog::spacingHintSmall()); groupBox->layout()->setMargin(1) ; groupBox->layout()->setSpacing(0); mExtensionView = new KListView( groupBox ); mExtensionView->setAllColumnsShowFocus( true ); mExtensionView->addColumn( i18n( "Name" ) ); mExtensionView->addColumn( i18n( "Description" ) ); mExtensionView->setMaximumHeight(80); - + boxLayout->addWidget( mExtensionView ); mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); mConfigureButton->setEnabled( false ); boxLayout->addWidget( mConfigureButton ); layout->addWidget( groupBox ); @@ -140,51 +147,151 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name ) SLOT( configureExtension() ) ); tabWidget->addTab( generalPage, i18n( "General" ) ); // Addressee page 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(); blockSignals( true ); mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); + + mEmailChannel->setText( KABPrefs::instance()->mEmailChannel ); + mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient); + mAddresseeWidget->restoreSettings(); restoreExtensionSettings(); blockSignals( blocked ); emit changed( false ); } 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(); KABPrefs::instance()->writeConfig(); emit changed( false ); } void KABConfigWidget::defaults() { mNameParsing->setChecked( true ); mViewsSingleClickBox->setChecked( false ); + mEmailClient->setCurrentItem(KABPrefs::OMPI); + emailclient_changed( KABPrefs::OMPI ); + + emit changed( true ); } void KABConfigWidget::modified() { emit changed( true ); } @@ -205,34 +312,34 @@ void KABConfigWidget::restoreExtensionSettings() item->setService( *it ); if ( activeExtensions.contains( item->factory()->identifier() ) ) item->setOn( true ); } #else //KAB_EMBEDDED ExtensionFactory *extensionFactory = new MergeFactory(); 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 - + } void KABConfigWidget::saveExtensionSettings() { QStringList activeExtensions; QPtrList<QListViewItem> list; QListViewItemIterator it( mExtensionView ); @@ -312,17 +419,17 @@ bool ExtensionItem::configWidgetAvailable() const #ifndef KAB_EMBEDDED KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); if ( !factory ) return false; ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); if ( !extensionFactory ) return false; - + return extensionFactory->configureWidgetAvailable(); #else //KAB_EMBEDDED return mFactory->configureWidgetAvailable(); #endif //KAB_EMBEDDED } ExtensionFactory *ExtensionItem::factory() const 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,72 +1,78 @@ -/* - 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 #define KABCONFIGWIDGET_H #include <qwidget.h> class QCheckBox; class QListViewItem; class QPushButton; - +class QComboBox; +class QLineEdit; class KListView; class AddresseeWidget; class KABConfigWidget : public QWidget { Q_OBJECT - + public: KABConfigWidget( QWidget *parent, const char *name = 0 ); - + void restoreSettings(); void saveSettings(); void defaults(); signals: void changed( bool ); public slots: void modified(); + + private slots: void configureExtension(); void selectionChanged( QListViewItem* ); void itemClicked( QListViewItem* ); + void emailclient_changed( int newClient ); private: void restoreExtensionSettings(); void saveExtensionSettings(); KListView *mExtensionView; QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; QPushButton *mConfigureButton; + QComboBox* mEmailClient; + QLineEdit* mEmailChannel; AddresseeWidget *mAddresseeWidget; }; #endif diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index c953058..d1f7630 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp @@ -11,31 +11,31 @@ KDialogBase::KDialogBase() { } 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, const QString &user3) : KDialog( parent, name, modal ) { init( caption, buttonMask, user1, user2 ); if (findButton( defaultButton ) ) (findButton( defaultButton ) )->setFocus(); } -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, const QString &user2, const QString &user3) : KDialog( parent, name, modal ) { init( caption, buttonMask, user1, user2 ); if (findButton( defaultButton ) ) @@ -73,17 +73,16 @@ void KDialogBase::init( const QString &caption, int buttonMask, if ( buttonMask & Ok ) { mOkButton = new QPushButton( i18n("Ok"), this ); connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); } else { mOkButton = 0; } if ( buttonMask & Default ) { - qDebug("buttonMask & Default "); mDefaultButton = new QPushButton( i18n("Default"), this ); connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); } else { mDefaultButton = 0; } if ( buttonMask & Apply ) { mApplyButton = new QPushButton( i18n("Apply"), this ); @@ -99,17 +98,17 @@ void KDialogBase::init( const QString &caption, int buttonMask, mCancelButton = 0; } if ( buttonMask & Close ) { mCloseButton = new QPushButton( i18n("Close"), this ); connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); } else { mCloseButton = 0; - } + } } QTabWidget *KDialogBase::tabWidget() { if ( !mTabWidget ) { mTabWidget = new QTabWidget( this ); setMainWidget( mTabWidget ); } @@ -120,31 +119,31 @@ void KDialogBase::hideButtons() { if ( mUser1Button ) mUser1Button->hide() ; if ( mUser2Button ) mUser2Button->hide() ; if ( mOkButton ) mOkButton->hide() ; if ( mApplyButton ) mApplyButton->hide() ; if ( mDefaultButton ) mDefaultButton->hide(); 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 ); if ( mOkButton ) buttonLayout->addWidget( mOkButton ); if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); } @@ -200,25 +199,25 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) case User1: button = mUser1Button; break; case User2: button = mUser2Button; break; case Cancel: button = mCancelButton; - break; + break; case Default: button = mDefaultButton; break; case Close: button = mCloseButton; break; default: - break; + break; } return button; } void KDialogBase::enableButtonOK( bool state ) { enableButton( Ok, state ); } 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 @@ -38,70 +38,73 @@ //US #include "kcmoduleloader.h" KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, parent, name, modal, true), d(0L) { 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 ); #ifdef DESKTOP_VERSION resize(640,480); #else - resize(640,480); + resize(640,480); setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); //showMaximized(); #endif - + } KCMultiDialog::~KCMultiDialog() { //US moduleDict.setAutoDelete(true); } void KCMultiDialog::slotDefault() { int curPageIndex = mMainWidget->activePageIndex(); - + QPtrListIterator<KCModule> it(modules); for (; it.current(); ++it) { if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) { (*it)->defaults(); clientChanged(true); return; } } - + } void KCMultiDialog::slotApply() { qDebug("KCMultiDialog::slotApply clicked"); QPtrListIterator<KCModule> it(modules); for (; it.current(); ++it) (*it)->save(); clientChanged(false); emit applyClicked(); - + } void KCMultiDialog::slotOk() { qDebug("KCMultiDialog::slotOk clicked"); - + QPtrListIterator<KCModule> it(modules); for (; it.current(); ++it) (*it)->save(); accept(); emit okClicked(); } @@ -114,25 +117,25 @@ void KCMultiDialog::slotHelp() KProcess process; process << "khelpcenter" << url.url(); process.start(KProcess::DontCare); process.detach(); } else { new KRun(url); } -*/ +*/ } void KCMultiDialog::clientChanged(bool state) { enableButton(Apply, state); } -/*US +/*US void KCMultiDialog::addModule(const QString& path, bool withfallback) { kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; KCModuleInfo info(path, _baseGroup); QHBox* page = addHBoxPage(info.moduleName(), info.comment(), KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); @@ -152,17 +155,17 @@ QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) } //US special method for microkde. We dop noty want to load everything dynamically. void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) { modules.append(module); connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); - + } void KCMultiDialog::slotAboutToShow(QWidget *page) { /*US LoadInfo *loadInfo = moduleDict[page]; if (!loadInfo) @@ -192,10 +195,10 @@ void KCMultiDialog::slotAboutToShow(QWidget *page) //KCGlobal::repairAccels( topLevelWidget() ); delete loadInfo; QApplication::restoreOverrideCursor(); */ -qDebug("KCMultiDialog::slotAboutToShow not implemented"); +qDebug("KCMultiDialog::slotAboutToShow not implemented"); } |