author | ulf69 <ulf69> | 2004-08-10 01:34:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-10 01:34:22 (UTC) |
commit | c9d570427f3d5bead7bee1301514a2d4b82836ea (patch) (side-by-side diff) | |
tree | 8d25f388217c591b7dac1db6c26d0777e6459352 /kaddressbook | |
parent | 4f05a9fcbb9e54184aef93883886aaf865104463 (diff) | |
download | kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.zip kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.gz kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.bz2 |
enhancements to configure external apps like email and phones through a
generalized interface
-rw-r--r-- | kaddressbook/kabcore.cpp | 53 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.h | 10 |
3 files changed, 28 insertions, 55 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4303cab..fe4841a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1,187 +1,189 @@ /* 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, without including the source code for Qt in the source distribution. */ #include "kabcore.h" #include <stdaddressbook.h> #include <klocale.h> #ifndef KAB_EMBEDDED #include <qclipboard.h> #include <qdir.h> #include <qfile.h> #include <qapplicaton.h> #include <qlayout.h> #include <qregexp.h> #include <qvbox.h> #include <kabc/addresseelist.h> #include <kabc/errorhandler.h> #include <kabc/resource.h> #include <kabc/vcardconverter.h> #include <kapplication.h> #include <kactionclasses.h> #include <kcmultidialog.h> #include <kdebug.h> #include <kdeversion.h> #include <kkeydialog.h> #include <kmessagebox.h> #include <kprinter.h> #include <kprotocolinfo.h> #include <kresources/selectdialog.h> #include <kstandarddirs.h> #include <ktempfile.h> #include <kxmlguiclient.h> #include <kaboutdata.h> #include <libkdepim/categoryselectdialog.h> #include "addresseeutil.h" #include "addresseeeditordialog.h" #include "extensionmanager.h" #include "kstdaction.h" #include "kaddressbookservice.h" #include "ldapsearchdialog.h" #include "printing/printingwizard.h" #else // KAB_EMBEDDED #include <kapplication.h> #include "KDGanttMinimizeSplitter.h" #include "kaddressbookmain.h" #include "kactioncollection.h" #include <qapp.h> #include <qmenubar.h> //#include <qtoolbar.h> #include <qmessagebox.h> #include <kdebug.h> #include <kiconloader.h> // needed for SmallIcon #include <kresources/kcmkresources.h> #include <ktoolbar.h> //#include <qlabel.h> #ifndef DESKTOP_VERSION #include <qtopia/services.h> #include <qtopia/qcopenvelope_qws.h> #include <qpe/ir.h> #endif #endif // KAB_EMBEDDED #include "kcmconfigs/kcmkabconfig.h" #include "kcmconfigs/kcmkdepimconfig.h" +#include "kpimglobalprefs.h" +#include "externalapphandler.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" #include "incsearchwidget.h" #include "jumpbuttonbar.h" #include "extensionmanager.h" #include "addresseeconfig.h" #include <kcmultidialog.h> #ifdef _WIN32_ #include "kaimportoldialog.h" #endif bool pasteWithNewUid = true; #ifdef KAB_EMBEDDED KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 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 { 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, "X-AssistantsName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, "X-ManagersName", "KADDRESSBOOK" ); 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 // 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" ); initGUI(); mIncSearchWidget->setFocus(); @@ -374,295 +376,264 @@ void KABCore::createAboutData() "schumacher@kde.org" ); about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), "mpilone@slac.com" ); about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 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> 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" "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" "Steffen Hansen LDAP Lookup hansen@kde.org\n" #ifdef _WIN32_ "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" #endif ); } void KABCore::setContactSelected( const QString &uid ) { KABC::Addressee addr = mAddressBook->findByUid( 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: QPixmap px; if (pic.data().isNull() != true) { px.convertFromImage(pic.data()); } emit contactSelected( px ); } } mExtensionManager->setSelectionChanged(); // update the actions bool selected = !uid.isEmpty(); if ( mReadWrite ) { mActionCut->setEnabled( selected ); mActionPaste->setEnabled( selected ); } mActionCopy->setEnabled( selected ); mActionDelete->setEnabled( selected ); mActionEditAddressee->setEnabled( selected ); mActionMail->setEnabled( selected ); mActionMailVCard->setEnabled( selected ); //if (mActionBeam) //mActionBeam->setEnabled( selected ); if (mActionBeamVCard) mActionBeamVCard->setEnabled( selected ); mActionWhoAmI->setEnabled( selected ); mActionCategories->setEnabled( selected ); } void KABCore::sendMail() { sendMail( mViewManager->selectedEmails().join( ", " ) ); } void KABCore::sendMail( const QString& email ) { -//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 + bool result = ExternalAppHandler::instance()->mailToContacts(email); } void KABCore::mailVCard() { QStringList uids = mViewManager->selectedUids(); if ( !uids.isEmpty() ) mailVCard( uids ); } void KABCore::mailVCard( const QStringList& uids ) { 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; QString name = a.givenName() + "_" + a.familyName() + ".vcf"; QString fileName = dirName + "/" + name; QFile outFile(fileName); if ( outFile.open(IO_WriteOnly) ) { // file opened successfully KABC::VCardConverter converter; QString vcard; converter.addresseeToVCard( a, vcard ); QTextStream t( &outFile ); // use a text stream t.setEncoding( QTextStream::UnicodeUTF8 ); t << vcard; outFile.close(); urls.append( fileName ); } } + + bool result = ExternalAppHandler::instance()->mailAttachments(urls.join(", ")); + + /*US kapp->invokeMailer( QString::null, QString::null, QString::null, QString::null, // subject QString::null, // body QString::null, urls ); // attachments */ -#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 - } /** Beams the "WhoAmI contact. */ void KABCore::beamMySelf() { KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); if (!a.isEmpty()) { QStringList uids; uids << a.uid(); beamVCard(uids); } else { KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); } } void KABCore::beamVCard() { QStringList uids = mViewManager->selectedUids(); if ( !uids.isEmpty() ) beamVCard( uids ); } void KABCore::beamVCard(const QStringList& uids) { /*US QString beamFilename; Opie::OPimContact c; if ( actionPersonal->isOn() ) { beamFilename = addressbookPersonalVCardName(); if ( !QFile::exists( beamFilename ) ) return; // can't beam a non-existent file Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, beamFilename ); Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); Opie::OPimContactAccess::List allList = access->allRecords(); Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first c = *it; delete access; } else { unlink( beamfile ); // delete if exists mkdir("/tmp/obex/", 0755); c = m_abView -> currentEntry(); Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, beamfile ); Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); access->add( c ); access->save(); delete access; beamFilename = beamfile; } owarn << "Beaming: " << beamFilename << oendl; */ #if 0 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); QString name = "contact.vcf"; QString fileName = dirName + "/" + name; #endif // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory // QString fileName = "/tmp/kdepimbeamfile"; //QDir().mkdir( dirName, true ); QFile outFile(fileName); KABC::VCardConverter converter; QString description; if ( outFile.open(IO_WriteOnly) ) { // file opened successfully QTextStream t( &outFile ); // use a text stream t.setEncoding( QTextStream::UnicodeUTF8 ); for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { KABC::Addressee a = mAddressBook->findByUid( *it ); if ( a.isEmpty() ) continue; if (description.isEmpty()) @@ -1104,197 +1075,199 @@ void KABCore::save() void KABCore::statusMessage(QString mess , int time ) { //topLevelWidget()->setCaption( mess ); // pending setting timer to revome message } void KABCore::undo() { UndoStack::instance()->undo(); // Refresh the view mViewManager->refreshView(); } void KABCore::redo() { RedoStack::instance()->redo(); // Refresh the view mViewManager->refreshView(); } void KABCore::setJumpButtonBarVisible( bool visible ) { if ( visible ) mJumpButtonBar->show(); else mJumpButtonBar->hide(); } void KABCore::setDetailsToState() { setDetailsVisible( mActionDetails->isChecked() ); } 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 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 ); bool found = false; QString ownerName = ""; KABC::AddressBook::Iterator iter; KABC::PhoneNumber::List::Iterator phoneIter; KABC::PhoneNumber::List phoneList; for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { phoneList = (*iter).phoneNumbers(); for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); ++phoneIter) { // Get rid of separator chars so just the numbers are compared. if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { ownerName = (*iter).formattedName(); found = true; } } } return ownerName; #else //KAB_EMBEDDED qDebug("KABCore::getNameByPhone finsih method"); return ""; #endif //KAB_EMBEDDED } void KABCore::openConfigDialog() { - KABPrefs* prefs = KABPrefs::instance(); - KCMultiDialog* ConfigureDialog = new KCMultiDialog( prefs, "PIM", this ,"kabconfigdialog", true ); - KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); + KABPrefs* kab_prefs = KABPrefs::instance(); + KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); + + KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); + KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); ConfigureDialog->addModule(kabcfg ); - KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Pim")) , "KCMKdeLibConfig" ); + KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); ConfigureDialog->addModule(kdelibcfg ); connect( ConfigureDialog, SIGNAL( applyClicked() ), this, SLOT( configurationChanged() ) ); connect( ConfigureDialog, SIGNAL( okClicked() ), this, SLOT( configurationChanged() ) ); saveSettings(); ConfigureDialog->showMaximized(); if ( ConfigureDialog->exec() ) KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); delete ConfigureDialog; } void KABCore::openLDAPDialog() { #ifndef KAB_EMBEDDED if ( !mLdapSearchDialog ) { mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, SLOT( refreshView() ) ); connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, SLOT( setModified() ) ); } else mLdapSearchDialog->restoreSettings(); if ( mLdapSearchDialog->isOK() ) mLdapSearchDialog->exec(); #else //KAB_EMBEDDED qDebug("KABCore::openLDAPDialog() finsih method"); #endif //KAB_EMBEDDED } void KABCore::print() { #ifndef KAB_EMBEDDED KPrinter printer; if ( !printer.setup( this ) ) return; KABPrinting::PrintingWizard wizard( &printer, mAddressBook, mViewManager->selectedUids(), this ); wizard.exec(); #else //KAB_EMBEDDED qDebug("KABCore::print() finsih method"); #endif //KAB_EMBEDDED } void KABCore::addGUIClient( KXMLGUIClient *client ) { if ( mGUIClient ) mGUIClient->insertChildClient( client ); else KMessageBox::error( this, "no KXMLGUICLient"); } void KABCore::configurationChanged() { mExtensionManager->reconfigure(); } void KABCore::addressBookChanged() { /*US QDictIterator<AddresseeEditorDialog> it( mEditorDict ); while ( it.current() ) { if ( it.current()->dirty() ) { QString text = i18n( "Data has been changed externally. Unsaved " "changes will be lost." ); KMessageBox::information( this, text ); } it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); ++it; } */ if (mEditorDialog) { if (mEditorDialog->dirty()) { QString text = i18n( "Data has been changed externally. Unsaved " "changes will be lost." ); KMessageBox::information( this, text ); } QString currentuid = mEditorDialog->addressee().uid(); mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); } mViewManager->refreshView(); // mDetails->refreshView(); } diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp index 26398f8..b460a81 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp +++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp @@ -1,92 +1,92 @@ /* 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, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #ifndef KAB_EMBEDDED #include <kaboutdata.h> #endif //KAB_EMBEDDED #include <kdebug.h> //#include <klocale.h> //#include <stdlib.h> #include "kabconfigwidget.h" #include "kcmkabconfig.h" #include "kabprefs.h" #include "kprefs.h" extern "C" { - KCModule *create_kabconfig( QWidget *parent, const char * ) { - return new KCMKabConfig( parent, "kcmkabconfig" ); + KCModule *create_kabconfig( KABPrefs* prefs, QWidget *parent, const char * ) { + return new KCMKabConfig( prefs, parent, "kcmkabconfig" ); } } -KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) - : KCModule( parent, name ) +KCMKabConfig::KCMKabConfig( KABPrefs* prefs, QWidget *parent, const char *name ) + : KCModule( prefs, parent, name ) { //abort(); QVBoxLayout *layout = new QVBoxLayout( this ); mConfigWidget = new KABConfigWidget( this, "mConfigWidget" ); layout->addWidget( mConfigWidget ); layout->setSpacing( 0 ); layout->setMargin( 0 ); connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); } -void KCMKabConfig::load(KPrefs* prefs) +void KCMKabConfig::load() { - mConfigWidget->restoreSettings((KABPrefs*)prefs); + mConfigWidget->restoreSettings((KABPrefs*)getPreferences()); } -void KCMKabConfig::save(KPrefs* prefs) +void KCMKabConfig::save() { - mConfigWidget->saveSettings((KABPrefs*)prefs); + mConfigWidget->saveSettings((KABPrefs*)getPreferences()); } -void KCMKabConfig::defaults(KPrefs* prefs) +void KCMKabConfig::defaults() { - mConfigWidget->defaults((KABPrefs*)prefs); + mConfigWidget->defaults((KABPrefs*)getPreferences()); } #ifndef KAB_EMBEDDED const KAboutData* KCMKabConfig::aboutData() const { KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), I18N_NOOP( "KAddressBook Configure Dialog" ), 0, 0, KAboutData::License_GPL, I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); return about; } #endif //KAB_EMBEDDED #ifndef KAB_EMBEDDED #include "kcmkabconfig.moc" #endif //KAB_EMBEDDED diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h index b4858c1..1cb6ad3 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.h +++ b/kaddressbook/kcmconfigs/kcmkabconfig.h @@ -1,47 +1,47 @@ /* 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, without including the source code for Qt in the source distribution. */ #ifndef KCMKABCONFIG_H #define KCMKABCONFIG_H #include <kcmodule.h> class KABConfigWidget; -class KPrefs; +class KABPrefs; class KCMKabConfig : public KCModule { Q_OBJECT public: - KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); + KCMKabConfig( KABPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); - virtual void load(KPrefs* prefs); - virtual void save(KPrefs* prefs); - virtual void defaults(KPrefs* prefs); + virtual void load(); + virtual void save(); + virtual void defaults(); private: KABConfigWidget *mConfigWidget; }; #endif |