summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-10 01:34:22 (UTC)
committer ulf69 <ulf69>2004-08-10 01:34:22 (UTC)
commitc9d570427f3d5bead7bee1301514a2d4b82836ea (patch) (side-by-side diff)
tree8d25f388217c591b7dac1db6c26d0777e6459352
parent4f05a9fcbb9e54184aef93883886aaf865104463 (diff)
downloadkdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.zip
kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.gz
kdepimpi-c9d570427f3d5bead7bee1301514a2d4b82836ea.tar.bz2
enhancements to configure external apps like email and phones through a
generalized interface
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp53
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.cpp20
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.h10
-rw-r--r--libkdepim/addresseeview.cpp31
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp24
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h10
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp534
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h68
-rw-r--r--libkdepim/kpimprefs.cpp11
-rw-r--r--libkdepim/kpimprefs.h19
-rw-r--r--libkdepim/libkdepim.pro4
-rw-r--r--libkdepim/libkdepimE.pro4
-rw-r--r--microkde/kdeui/kcmodule.cpp16
-rw-r--r--microkde/kdeui/kcmodule.h11
-rw-r--r--microkde/kutils/kcmultidialog.cpp13
-rw-r--r--microkde/kutils/kcmultidialog.h5
16 files changed, 580 insertions, 253 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4303cab..fe4841a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,764 +1,735 @@
/*
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();
connect( mViewManager, SIGNAL( selected( const QString& ) ),
SLOT( setContactSelected( const QString& ) ) );
connect( mViewManager, SIGNAL( executed( const QString& ) ),
SLOT( editContact( const QString& ) ) );
connect( mViewManager, SIGNAL( deleteRequest( ) ),
SLOT( deleteContacts( ) ) );
connect( mViewManager, SIGNAL( modified() ),
SLOT( setModified() ) );
connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
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( browse( const QString& ) ),
SLOT( browse( const QString& ) ) );
mAddressBookService = new KAddressBookService( this );
#endif //KAB_EMBEDDED
mEditorDialog = 0;
createAddresseeEditorDialog( this );
setModified( false );
}
KABCore::~KABCore()
{
// save();
//saveSettings();
//KABPrefs::instance()->writeConfig();
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
}
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 );
}
mMiniSplitter->setSizes( splitterSize );
if ( mExtensionBarSplitter ) {
splitterSize = KABPrefs::instance()->mExtensionsSplitter;
if ( splitterSize.count() == 0 ) {
splitterSize.append( width() / 2 );
splitterSize.append( width() / 2 );
}
mExtensionBarSplitter->setSizes( splitterSize );
}
#ifndef KAB_EMBEDDED
QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
if ( splitterSize.count() == 0 ) {
splitterSize.append( width() / 2 );
splitterSize.append( width() / 2 );
}
mExtensionBarSplitter->setSizes( splitterSize );
splitterSize = KABPrefs::instance()->mDetailsSplitter;
if ( splitterSize.count() == 0 ) {
splitterSize.append( height() / 2 );
splitterSize.append( height() / 2 );
}
mDetailsSplitter->setSizes( splitterSize );
mExtensionManager->restoreSettings();
#endif //KAB_EMBEDDED
mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
mViewManager->restoreSettings();
mExtensionManager->restoreSettings();
}
void KABCore::saveSettings()
{
KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
if ( mExtensionBarSplitter )
KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
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()
{
#ifndef KAB_EMBEDDED
return KABPrefs::instance()->config();
#else //KAB_EMBEDDED
return KABPrefs::instance()->getConfig();
#endif //KAB_EMBEDDED
}
KActionCollection *KABCore::actionCollection() const
{
return mGUIClient->actionCollection();
}
KABC::Field *KABCore::currentSearchField() const
{
if (mIncSearchWidget)
return mIncSearchWidget->currentField();
else
return 0;
}
QStringList KABCore::selectedUIDs() const
{
return mViewManager->selectedUids();
}
KABC::Resource *KABCore::requestResource( QWidget *parent )
{
QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
QPtrList<KRES::Resource> kresResources;
QPtrListIterator<KABC::Resource> resIt( kabcResources );
KABC::Resource *resource;
while ( ( resource = resIt.current() ) != 0 ) {
++resIt;
if ( !resource->readOnly() ) {
KRES::Resource *res = static_cast<KRES::Resource*>( resource );
if ( res )
kresResources.append( res );
}
}
KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
return static_cast<KABC::Resource*>( res );
}
#ifndef KAB_EMBEDDED
KAboutData *KABCore::createAboutData()
#else //KAB_EMBEDDED
void KABCore::createAboutData()
#endif //KAB_EMBEDDED
{
#ifndef KAB_EMBEDDED
KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
"3.1", I18N_NOOP( "The KDE Address Book" ),
KAboutData::License_GPL_V2,
I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
about->addAuthor( "Cornelius Schumacher",
I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
"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())
description = a.formattedName();
QString vcard;
converter.addresseeToVCard( a, vcard );
t << vcard;
}
} else {
qDebug("Error open temp beam file ");
return;
}
outFile.close();
#ifndef DESKTOP_VERSION
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
ir->send( fileName, description, "text/x-vCard" );
#endif
}
void KABCore::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
}
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
void KABCore::selectAllContacts()
{
mViewManager->setSelected( QString::null, true );
}
void KABCore::deleteContacts()
{
QStringList uidList = mViewManager->selectedUids();
deleteContacts( uidList );
}
void KABCore::deleteContacts( const QStringList &uids )
{
if ( uids.count() > 0 ) {
PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
// now if we deleted anything, refresh
setContactSelected( QString::null );
setModified( true );
}
}
void KABCore::copyContacts()
{
KABC::Addressee::List addrList = mViewManager->selectedAddressees();
QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
QClipboard *cb = QApplication::clipboard();
cb->setText( clipText );
}
void KABCore::cutContacts()
{
QStringList uidList = mViewManager->selectedUids();
//US if ( uidList.size() > 0 ) {
if ( uidList.count() > 0 ) {
PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
setModified( true );
}
}
void KABCore::pasteContacts()
{
QClipboard *cb = QApplication::clipboard();
KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
pasteContacts( list );
@@ -1008,389 +979,391 @@ void KABCore::addEmail( QString aStr )
mAddressBook->insertAddressee( addr );
mViewManager->refreshView( addr.uid() );
editContact( addr.uid() );
}
#else //KAB_EMBEDDED
qDebug("KABCore::addEmail finsih method");
#endif //KAB_EMBEDDED
}
void KABCore::importVCard( const KURL &url, bool showPreview )
{
mXXPortManager->importVCard( url, showPreview );
}
void KABCore::importFromOL()
{
#ifdef _WIN32_
KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
idgl->exec();
KABC::Addressee::List list = idgl->getAddressList();
if ( list.count() > 0 ) {
KABC::Addressee::List listNew;
KABC::Addressee::List listExisting;
KABC::Addressee::List::Iterator it;
KABC::AddressBook::Iterator iter;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
listNew.append( (*it) );
else
listExisting.append( (*it) );
}
if ( listExisting.count() > 0 )
KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
if ( listNew.count() > 0 ) {
pasteWithNewUid = false;
pasteContacts( listNew );
pasteWithNewUid = true;
}
}
delete idgl;
#endif
}
void KABCore::importVCard( const QString &vCard, bool showPreview )
{
mXXPortManager->importVCard( vCard, showPreview );
}
//US added a second method without defaultparameter
void KABCore::editContact2() {
editContact( QString::null );
}
void KABCore::editContact( const QString &uid )
{
if ( mExtensionManager->isQuickEditVisible() )
return;
// First, locate the contact entry
QString localUID = uid;
if ( localUID.isNull() ) {
QStringList uidList = mViewManager->selectedUids();
if ( uidList.count() > 0 )
localUID = *( uidList.at( 0 ) );
}
KABC::Addressee addr = mAddressBook->findByUid( localUID );
if ( !addr.isEmpty() ) {
mEditorDialog->setAddressee( addr );
KApplication::execDialog ( mEditorDialog );
}
}
void KABCore::save()
{
if ( !mModified )
return;
QString text = i18n( "There was an error while attempting to save\n the "
"address book. Please check that some \nother application is "
"not using it. " );
statusMessage(i18n("Saving addressbook ... "));
#ifndef KAB_EMBEDDED
KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
if ( !b || !b->save() ) {
KMessageBox::error( this, text, i18n( "Unable to Save" ) );
}
#else //KAB_EMBEDDED
KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
if ( !b || !b->save() ) {
QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
}
#endif //KAB_EMBEDDED
statusMessage(i18n("Addressbook saved!"));
setModified( false );
}
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();
}
AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
if ( mEditorDialog == 0 ) {
mEditorDialog = new AddresseeEditorDialog( this, parent,
name ? name : "editorDialog" );
connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
SLOT( contactModified( const KABC::Addressee& ) ) );
//connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
// SLOT( slotEditorDestroyed( const QString& ) ) );
}
return mEditorDialog;
}
void KABCore::slotEditorDestroyed( const QString &uid )
{
//mEditorDict.remove( uid );
}
void KABCore::initGUI()
{
#ifndef KAB_EMBEDDED
QHBoxLayout *topLayout = new QHBoxLayout( this );
topLayout->setSpacing( KDialogBase::spacingHint() );
mExtensionBarSplitter = new QSplitter( this );
mExtensionBarSplitter->setOrientation( Qt::Vertical );
mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
QVBox *viewSpace = new QVBox( mDetailsSplitter );
mIncSearchWidget = new IncSearchWidget( viewSpace );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mViewManager = new ViewManager( this, viewSpace );
viewSpace->setStretchFactor( mViewManager, 1 );
mDetails = new ViewContainer( mDetailsSplitter );
mJumpButtonBar = new JumpButtonBar( this, this );
mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
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.
// 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
if ( QApplication::desktop()->width() > 480 ) {
topLayout = new QHBoxLayout( this );
mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
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
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index 547441c..83aba48 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -1,345 +1,346 @@
/*
This file is part of libkdepim.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kabc/address.h>
#include <kabc/addressee.h>
#include <kabc/phonenumber.h>
#include <kglobal.h>
//US#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstringhandler.h>
#include <qscrollview.h>
#include <qregexp.h>
#include <qfile.h>
#include <qapplication.h>
#include "addresseeview.h"
#ifndef DESKTOP_VERSION
-#include <qtopia/qcopenvelope_qws.h>
-#include <qpe/qpeapplication.h>
+#include <qtopia/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
#endif
static int kphoneInstalled = 0;
using namespace KPIM;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
//US : KTextBrowser( parent, name )
: QTextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
-
+
}
void AddresseeView::setSource(const QString& n)
{
qDebug("********AddresseeView::setSource %s", n.latin1());
#ifndef DESKTOP_VERSION
if ( n.left( 6 ) == "mailto" ) {
QCopEnvelope e("QPE/Application/ompi", "newMail(QString)");
e << n.mid(7);
}
if ( n.left( 7 ) == "phoneto" ) {
QString mess = "-ring:" + n.mid(8);
QCopEnvelope e("QPE/Application/kppi", mess.latin1());
}
#endif
}
void AddresseeView::setAddressee( const KABC::Addressee& addr )
{
bool kphoneAvail = false;
#ifndef DESKTOP_VERSION
if ( ! kphoneInstalled ) {
if ( QFile::exists( QPEApplication::qpeDir() + "/bin/kppi" ) )
kphoneInstalled = 1;
else
kphoneInstalled = -1;
}
if ( kphoneInstalled > 0 )
- kphoneAvail = true;
+ kphoneAvail = true;
#if 0
if ( kphoneAvail )
qDebug("KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
else
qDebug("NOOOOOOOOOOOo KPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPone avail ");
#endif
-
+
#endif
mAddressee = addr;
// clear view
setText( QString::null );
if ( mAddressee.isEmpty() )
return;
QString name = ( mAddressee.formattedName().isEmpty() ?
mAddressee.assembledName() : mAddressee.formattedName() );
QString dynamicPart;
QStringList emails = mAddressee.emails();
QStringList::ConstIterator emailIt;
QString type = i18n( "Email" );
emailIt = emails.begin();
if ( emailIt != emails.end() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )
.arg( name )
.arg( *emailIt )
.arg( *emailIt );
++emailIt;
}
KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
KABC::PhoneNumber::List::ConstIterator phoneIt;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
if ( kphoneAvail ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"phoneto:%2 \">%3</a></td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
.arg( (*phoneIt).number() )
.arg( (*phoneIt).number() );
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( (*phoneIt).type() ) )
.arg( (*phoneIt).number() );
}
}
-
+
for ( ; emailIt != emails.end(); ++emailIt ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )
.arg( name )
.arg( *emailIt )
.arg( *emailIt );
}
if ( !mAddressee.url().url().isEmpty() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n( "Homepage" ) )
//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) );
.arg( mAddressee.url().url() );
//qDebug("AddresseeView::setAddressee has to be verified.");
}
KABC::Address::List addresses = mAddressee.addresses();
KABC::Address::List::ConstIterator addrIt;
for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
if ( true /*(*addrIt).label().isEmpty()*/ ) {
QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
//qDebug("adresss %s ",formattedAddress.latin1() );
formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
//qDebug("AddresseeView::setAddressee has to be verified.");
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( KABC::Address::typeLabel( (*addrIt).type() ) )
.arg( formattedAddress );
} else {
-
+
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( KABC::Address::typeLabel( (*addrIt).type() ) )
//US .arg( (*addrIt).label().replace( '\n', "<br>" ) );
.arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ );
-
+
}
}
QString notes;
if ( !mAddressee.note().isEmpty() ) {
notes = QString(
"<tr>"
"<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
"<td align=\"left\">%2</td>" // note
"</tr>" ).arg( i18n( "Notes" ) )
//US .arg( mAddressee.note().replace( '\n', "<br>" ) );
.arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
//qDebug("AddresseeView::setAddressee has to be verified.");
}
QString aRole = "";
QString aOrga = "";
if ( true /*!mAddressee.role().isEmpty()*/ ) {
aRole = "<tr>"
- "<td align=\"left\">" + mAddressee.role() + "</td>"
+ "<td align=\"left\">" + mAddressee.role() + "</td>"
"</tr>";
- }
+ }
if ( true /*!mAddressee.organization().isEmpty()*/ ) {
aOrga = "<tr>"
"<td align=\"left\">" + mAddressee.organization() + "</td>" ;
"</tr>";
}
mText = "";
QString picString = "";
KABC::Picture picture = mAddressee.photo();
bool picAvailintern = false;
bool picAvailUrl = false;
if (! picture.undefined() ) {
picAvailintern = (picture.isIntern() && !picture.data().isNull());
picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
}
if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
if ( picAvailintern ) {
QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
} else {
if ( picAvailUrl ) {
QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() ));
} else {
QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) );
}
}
picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
mText = QString::fromLatin1(
"<html>"
"<body text=\"%1\" bgcolor=\"%2\">" // text and background color
"<table>"
"<tr>"
"<td rowspan=\"3\" align=\"right\" valign=\"top\">"
"%3"
"</td>"
"<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
"</tr>"
"%5" // role
"%6" // organization
"<td colspan=\"2\">&nbsp;</td>"
"%7" // dynamic part
"%8" // notes
"</table>"
"</body>"
"</html>")
//US
.arg( /*KGlobalSettings::textColor().name()*/ "black" )
//US
.arg( /*KGlobalSettings::baseColor().name()*/ "white" )
.arg( picString )
.arg( name )
.arg( aRole )
.arg( aOrga )
.arg( dynamicPart )
.arg( notes );
} else { // no picture!
mText = "<table width=\"100%\">\n";
- //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
+ //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>";
#endif
-
+
#ifdef DESKTOP_VERSION
mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>";
#else
mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>";
#endif
mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
mText += "<table><td colspan=\"2\">&nbsp;</td>";
/*
mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
"<td align=\"left\"><b>%2</b></td></tr>" )
.arg( i18n(" ") )
- .arg( name );
+ .arg( name );
*/
if ( ! mAddressee.role().isEmpty() )
mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n(" ") )
.arg( mAddressee.role());
if ( ! mAddressee.organization().isEmpty() )
mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n(" ") )
.arg( mAddressee.organization());
mText += dynamicPart;
mText += notes;
mText += "</table>";
-
+
}
// at last display it...
setText( mText );
+
}
KABC::Addressee AddresseeView::addressee() const
{
return mAddressee;
}
void AddresseeView::addTag(const QString & tag,const QString & text)
{
if ( text.isEmpty() )
return;
int number=text.contains("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
- if(number !=-1)
+ if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
index 830d5d2..f26efe0 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -1,77 +1,79 @@
/*
This file is part of KDEPim/Pi.
Copyright (c) 2004 Ulf Schenk
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.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <kdebug.h>
//#include <klocale.h>
//#include <stdlib.h>
#include "kdepimconfigwidget.h"
#include "kcmkdepimconfig.h"
#include "kprefs.h"
-#include "kpimprefs.h"
+#include "kpimglobalprefs.h"
+
#ifndef _WIN32_
extern "C"
{
- KCModule *create_kabconfig( QWidget *parent, const char * ) {
- return new KCMKdePimConfig( parent, "kcmkdepimconfig" );
+ KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) {
+ return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" );
}
}
#endif
-KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name )
- : KCModule( parent, name )
+
+KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name )
+ : KCModule( prefs, parent, name )
{
//abort();
QVBoxLayout *layout = new QVBoxLayout( this );
mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" );
layout->addWidget( mConfigWidget );
layout->setSpacing( 0 );
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}
-void KCMKdePimConfig::load(KPrefs* prefs)
+void KCMKdePimConfig::load()
{
- mConfigWidget->restoreSettings((KPimPrefs*)prefs);
+ mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences());
}
-void KCMKdePimConfig::save(KPrefs* prefs)
+void KCMKdePimConfig::save()
{
- mConfigWidget->saveSettings((KPimPrefs*)prefs);
+ mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences());
}
-void KCMKdePimConfig::defaults(KPrefs* prefs)
+void KCMKdePimConfig::defaults()
{
- mConfigWidget->defaults((KPimPrefs*)prefs);
+ mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences());
}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
index 8cb74f4..fa96eda 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.h
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -1,54 +1,54 @@
/*
This file is part of KdePim/Pi.
Copyright (c) 2004 Ulf Schenk
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.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KCMKDEPIMCONFIG_H
#define KCMKDEPIMCONFIG_H
#include <kcmodule.h>
class KDEPIMConfigWidget;
-class KPrefs;
+class KPimGlobalPrefs;
class KCMKdePimConfig : public KCModule
{
Q_OBJECT
public:
- KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 );
+ KCMKdePimConfig( KPimGlobalPrefs* 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:
KDEPIMConfigWidget *mConfigWidget;
};
#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 477267c..9964eeb 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,273 +1,557 @@
/*
This file is part of KdePim/Pi.
Copyright (c) 2004 Ulf Schenk
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.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qfile.h>
#include <kdialog.h>
#include <klocale.h>
#include <stdlib.h>
/*US
#include <qcheckbox.h>
#include <qframe.h>
#include <qpushbutton.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>
#include <kstandarddirs.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else // KAB_EMBEDDED
#include <mergewidget.h>
#include <distributionlistwidget.h>
#endif // KAB_EMBEDDED
#include "addresseewidget.h"
#include "extensionconfigdialog.h"
#include "extensionwidget.h"
*/
-#include "kpimprefs.h"
+#include "kpimglobalprefs.h"
#include "kdepimconfigwidget.h"
KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
+ mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
+ mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
+ mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
+ mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
+ mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
+
+
QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
KDialog::spacingHint() );
QTabWidget *tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
-/*US
- // 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
-
- QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
- QVBoxLayout *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 );
-
- connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
- connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
- connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
- SLOT( selectionChanged( QListViewItem* ) ) );
- connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
- SLOT( itemClicked( QListViewItem* ) ) );
- connect( mConfigureButton, SIGNAL( clicked() ),
- 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 );
- QVBoxLayout* layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
+ QWidget *externalAppsPage = new QWidget( this );
+ QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
- QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
- 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() );
+ mExternalApps = new QComboBox( externalAppsPage );
+
+ QMap<ExternalAppHandler::Types, QString>::Iterator it;
+ for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
+ mExternalApps->insertItem( it.data(), it.key() );
+
+ layout->addWidget( mExternalApps );
+
+ connect( mExternalApps, SIGNAL( activated( int ) ),
+ this, SLOT (externalapp_changed( int ) ) );
+
+
+
+
+ mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
+ QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
+
+
+ mClient = new QComboBox( mExternalAppGroupBox );
+ boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
+
+ connect( mClient, SIGNAL( activated( int ) ),
+ this, SLOT (client_changed( int ) ) );
+
+ QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 1, 0 );
+ mChannel = new QLineEdit(mExternalAppGroupBox);
+ mChannel->setReadOnly(true);
+ boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
+
+ lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 3, 0 );
+ mMessage = new QLineEdit(mExternalAppGroupBox);
+ mMessage->setReadOnly(true);
+ boxLayout->addWidget( mMessage , 4, 0);
+
+ lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 3, 1 );
+ mParameters = new QLineEdit(mExternalAppGroupBox);
+ mParameters->setReadOnly(true);
+ boxLayout->addWidget( mParameters, 4, 1 );
+
+ lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 5, 0 );
+ mMessage2 = new QLineEdit(mExternalAppGroupBox);
+ mMessage2->setReadOnly(true);
+ boxLayout->addWidget( mMessage2 , 6, 0);
+
+ lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
+ boxLayout->addWidget( lab, 5, 1 );
+ mParameters2 = new QLineEdit(mExternalAppGroupBox);
+ mParameters2->setReadOnly(true);
+ boxLayout->addWidget( mParameters2, 6, 1 );
- mEmailClient = new QComboBox( groupBox );
- mEmailClient->insertItem( i18n("OM/Pi"), KPimPrefs::OMPI );
- mEmailClient->insertItem( i18n("Qtopia mail"), KPimPrefs::QTOPIA );
- mEmailClient->insertItem( i18n("Opie mail"), KPimPrefs::OPIE );
- mEmailClient->insertItem( i18n("Other"), KPimPrefs::OTHER );
- boxLayout->addWidget( mEmailClient );
+ lab = new QLabel( i18n("HINT: Delimiter=; Data=%1 "), mExternalAppGroupBox);
+ boxLayout->addMultiCellWidget( lab, 7, 7, 0, 1 );
- 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 );
+ connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
+ connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
- layout->addWidget( groupBox );
- tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
+ layout->addWidget( mExternalAppGroupBox );
+ tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
}
+void KDEPIMConfigWidget::externalapp_changed( int newApp )
+{
+ // first store the current data
+ saveEditFieldSettings();
+
+ // set mCurrentApp
+ mCurrentApp = (ExternalAppHandler::Types)newApp;
+
+ // set mCurrentClient
+ switch(mCurrentApp)
+ {
+ case(ExternalAppHandler::EMAIL):
+ mCurrentClient = mEmailClient;
+ break;
+ case(ExternalAppHandler::PHONE):
+ mCurrentClient = mPhoneClient;
+ break;
+ case(ExternalAppHandler::SMS):
+ mCurrentClient = mSMSClient;
+ break;
+ case(ExternalAppHandler::FAX):
+ mCurrentClient = mFaxClient;
+ break;
+ case(ExternalAppHandler::PAGER):
+ mCurrentClient = mPagerClient;
+ break;
+ default:
+ return;
+ }
+ // and at last update the widgets
+ updateClientWidgets();
+}
-void KDEPIMConfigWidget::emailclient_changed( int newClient )
+
+
+void KDEPIMConfigWidget::client_changed( int newClient )
{
- if (newClient == KPimPrefs::OTHER)
- mEmailChannel->setReadOnly(false);
- else
- mEmailChannel->setReadOnly(true);
+ if (newClient == mCurrentClient)
+ return;
- QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
- QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
+ // first store the current data
+ saveEditFieldSettings();
- if (opiepath.isEmpty())
- opiepath = qtopiapath;
- QString text = mEmailChannel->text();
+ //then reset the clientvariable
+ mCurrentClient = newClient;
- if (newClient == KPimPrefs::OPIE)
+ // and at last update the widgets
+ updateClientWidgets();
+
+ modified();
+}
+
+void KDEPIMConfigWidget::saveEditFieldSettings()
+{
+
+ switch(mCurrentApp)
{
- if ( QFile::exists( opiepath + "/bin/opiemail" ))
- text = "QPE/Application/opiemail";
- else
- text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
+ case(ExternalAppHandler::EMAIL):
+ mEmailClient = mClient->currentItem();
+ break;
+ case(ExternalAppHandler::PHONE):
+ mPhoneClient= mClient->currentItem();
+ break;
+ case(ExternalAppHandler::SMS):
+ mSMSClient = mClient->currentItem();
+ break;
+ case(ExternalAppHandler::FAX):
+ mFaxClient = mClient->currentItem();
+ break;
+ case(ExternalAppHandler::PAGER):
+ mPagerClient = mClient->currentItem();
+ break;
+ default:
+ return;
}
- else if (newClient == KPimPrefs::QTOPIA)
- {
- if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
- text = "QPE/Application/qtmail";
- else
- text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
+ //store the current data back to the apropriate membervariables if we had set it to "other"
+ if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
+ {
+ mEmailOtherChannel = mChannel->text();
+ mEmailOtherMessage = mMessage->text();
+ mEmailOtherMessageParameters = mParameters->text();
+ mEmailOtherMessage2 = mMessage2->text();
+ mEmailOtherMessageParameters2 = mParameters2->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
+ {
+ mPhoneOtherChannel = mChannel->text();
+ mPhoneOtherMessage = mMessage->text();
+ mPhoneOtherMessageParameters = mParameters->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
+ {
+ mSMSOtherChannel = mChannel->text();
+ mSMSOtherMessage = mMessage->text();
+ mSMSOtherMessageParameters = mParameters->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
+ {
+ mFaxOtherChannel = mChannel->text();
+ mFaxOtherMessage = mMessage->text();
+ mFaxOtherMessageParameters = mParameters->text();
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
+ {
+ mPagerOtherChannel = mChannel->text();
+ mPagerOtherMessage = mMessage->text();
+ mPagerOtherMessageParameters = mParameters->text();
}
- else if (newClient == KPimPrefs::OMPI)
+
+}
+
+void KDEPIMConfigWidget::updateClientWidgets()
+{
+ bool blocked = signalsBlocked();
+ blockSignals( true );
+
+ // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
+ QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
+ if (it == mExternalAppsMap.end())
+ return;
+
+ // update group box
+ mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
+
+ //update the entries in the client combobox
+ mClient->clear();
+
+ QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
+ DefaultAppItem* dai;
+ for ( dai=items.first(); dai != 0; dai=items.next() )
{
- 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";
+ mClient->insertItem( i18n(dai->_label), dai->_id );
+
+ if (dai->_id == mCurrentClient)
+ {
+ //restore the edit fields with the data of the local membervariables if we had set it to "other".
+ //Otherwise take the default data from externalapphandler.
+ mChannel->setText(dai->_channel);
+ mMessage->setText(dai->_message);
+ mParameters->setText(dai->_parameters);
+ mMessage2->setText(dai->_message2);
+ mParameters2->setText(dai->_parameters2);
+
+
+ if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
+ {
+ mChannel->setText(mEmailOtherChannel);
+ mMessage->setText(mEmailOtherMessage);
+ mParameters->setText(mEmailOtherMessageParameters);
+ mMessage2->setText(mEmailOtherMessage2);
+ mParameters2->setText(mEmailOtherMessageParameters2);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
+ {
+ mChannel->setText(mPhoneOtherChannel);
+ mMessage->setText(mPhoneOtherMessage);
+ mParameters->setText(mPhoneOtherMessageParameters);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
+ {
+ mChannel->setText(mSMSOtherChannel);
+ mMessage->setText(mSMSOtherMessage);
+ mParameters->setText(mSMSOtherMessageParameters);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
+ {
+ mChannel->setText(mFaxOtherChannel);
+ mMessage->setText(mFaxOtherMessage);
+ mParameters->setText(mFaxOtherMessageParameters);
+ }
+ else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
+ {
+ mChannel->setText(mPagerOtherChannel);
+ mMessage->setText(mPagerOtherMessage);
+ mParameters->setText(mPagerOtherMessageParameters);
+ }
+ }
+
+ }
+ bool readonly;
+ bool enabled;
+ if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
+ ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
+ ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
+ ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
+ ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)))
+ {
+ readonly = false;
+ }
+ else
+ {
+ readonly = true;
+ }
+
+ if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
+ ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
+ ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
+ ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
+ ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)))
+ {
+ enabled = false;
+ }
+ else
+ {
+ enabled = true;
+ }
+
+
+ mChannel->setReadOnly(readonly);
+ mMessage->setReadOnly(readonly);
+ mParameters->setReadOnly(readonly);
+ mMessage2->setReadOnly(readonly);
+ mParameters2->setReadOnly(readonly);
+
+ mChannel->setEnabled(enabled);
+ mMessage->setEnabled(enabled);
+ mParameters->setEnabled(enabled);
+ mMessage2->setEnabled(enabled);
+ mParameters2->setEnabled(enabled);
+
+
+
+ mClient->setCurrentItem(mCurrentClient);
+
+
+ // enable/disable the extra message/parameter field
+ if (mCurrentApp == ExternalAppHandler::EMAIL)
+ {
}
else
{
- //do nothing if we choosed other
+ mMessage2->setText( "" );
+ mParameters2->setText( "" );
}
- mEmailChannel->setText( text );
+ if (enabled == true) {
+ mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
+ mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
+ }
+ blockSignals( blocked );
+
}
-void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs)
+
+
+void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
{
bool blocked = signalsBlocked();
blockSignals( true );
- mEmailChannel->setText( prefs->mEmailChannel );
- mEmailClient->setCurrentItem(prefs->mEmailClient);
+ mEmailClient = prefs->mEmailClient;
+ mEmailOtherChannel = prefs->mEmailOtherChannel;
+ mEmailOtherMessage = prefs->mEmailOtherMessage;
+ mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
+ mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
+ mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
+
+ mPhoneClient = prefs->mPhoneClient;
+ mPhoneOtherChannel = prefs->mPhoneOtherChannel;
+ mPhoneOtherMessage = prefs->mPhoneOtherMessage;
+ mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
+
+ mFaxClient = prefs->mFaxClient;
+ mFaxOtherChannel = prefs->mFaxOtherChannel;
+ mFaxOtherMessage = prefs->mFaxOtherMessage;
+ mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
+
+ mSMSClient = prefs->mSMSClient;
+ mSMSOtherChannel = prefs->mSMSOtherChannel;
+ mSMSOtherMessage = prefs->mSMSOtherMessage;
+ mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
+
+ mPagerClient = prefs->mPagerClient;
+ mPagerOtherChannel = prefs->mPagerOtherChannel;
+ mPagerOtherMessage = prefs->mPagerOtherMessage;
+ mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
+
+ mCurrentApp = ExternalAppHandler::EMAIL;
+ mCurrentClient = mEmailClient;
+
+ updateClientWidgets();
blockSignals( blocked );
emit changed( false );
+
}
-void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs)
+void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
{
- prefs->mEmailClient = mEmailClient->currentItem();
- prefs->mEmailChannel = mEmailChannel->text();
+ saveEditFieldSettings();
+
+ prefs->mEmailClient = mEmailClient;
+ prefs->mEmailOtherChannel = mEmailOtherChannel;
+ prefs->mEmailOtherMessage = mEmailOtherMessage;
+ prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
+ prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
+ prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
+
+ prefs->mPhoneClient = mPhoneClient;
+ prefs->mPhoneOtherChannel = mPhoneOtherChannel;
+ prefs->mPhoneOtherMessage = mPhoneOtherMessage;
+ prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
+
+ prefs->mFaxClient = mFaxClient;
+ prefs->mFaxOtherChannel = mFaxOtherChannel;
+ prefs->mFaxOtherMessage = mFaxOtherMessage;
+ prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
+
+ prefs->mSMSClient = mSMSClient;
+ prefs->mSMSOtherChannel = mSMSOtherChannel;
+ prefs->mSMSOtherMessage = mSMSOtherMessage;
+ prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
+
+ prefs->mPagerClient = mPagerClient;
+ prefs->mPagerOtherChannel = mPagerOtherChannel;
+ prefs->mPagerOtherMessage = mPagerOtherMessage;
+ prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
prefs->writeConfig();
emit changed( false );
}
-void KDEPIMConfigWidget::defaults(KPimPrefs* prefs)
+void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs)
{
- mEmailClient->setCurrentItem(KPimPrefs::OMPI);
- emailclient_changed( KPimPrefs::OMPI );
+
+ DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC);
+
+ mEmailClient = dai->_id;
+ mEmailOtherChannel = dai->_channel;
+ mEmailOtherMessage = dai->_message;
+ mEmailOtherMessageParameters = dai->_parameters;
+ mEmailOtherMessage2 = dai->_message2;
+ mEmailOtherMessageParameters2 = dai->_parameters2;
+
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC);
+
+ mPhoneClient = dai->_id;
+ mPhoneOtherChannel = dai->_channel;
+ mPhoneOtherMessage = dai->_message;
+ mPhoneOtherMessageParameters = dai->_parameters;
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC);
+
+ mFaxClient = dai->_id;
+ mFaxOtherChannel = dai->_channel;
+ mFaxOtherMessage = dai->_message;
+ mFaxOtherMessageParameters = dai->_parameters;
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC);
+
+ mSMSClient = dai->_id;
+ mSMSOtherChannel = dai->_channel;
+ mSMSOtherMessage = dai->_message;
+ mSMSOtherMessageParameters = dai->_parameters;
+
+ dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC);
+
+ mPagerClient = dai->_id;
+ mPagerOtherChannel = dai->_channel;
+ mPagerOtherMessage = dai->_message;
+ mPagerOtherMessageParameters = dai->_parameters;
emit changed( true );
}
void KDEPIMConfigWidget::modified()
{
emit changed( true );
}
+
+void KDEPIMConfigWidget::textChanged( const QString& text )
+{
+ emit changed( true );
+}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index 109a847..6e02544 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -1,86 +1,140 @@
/*
This file is part of KDEPim/Pi.
Copyright (c) 2004 Ulf Schenk
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.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KDEPIMCONFIGWIDGET_H
#define KDEPIMCONFIGWIDGET_H
#include <qwidget.h>
+#include <qmap.h>
+
+#include "externalapphandler.h"
+
/*
class QCheckBox;
class QListViewItem;
class QPushButton;
class KListView;
*/
class QComboBox;
class QLineEdit;
-class KPimPrefs;
+class KPimGlobalPrefs;
+class QGroupBox;
class KDEPIMConfigWidget : public QWidget
{
Q_OBJECT
public:
KDEPIMConfigWidget( QWidget *parent, const char *name = 0 );
- void restoreSettings(KPimPrefs* prefs);
- void saveSettings(KPimPrefs* prefs);
- void defaults(KPimPrefs* prefs);
+ void restoreSettings(KPimGlobalPrefs* prefs);
+ void saveSettings(KPimGlobalPrefs* prefs);
+ void defaults(KPimGlobalPrefs* prefs);
signals:
void changed( bool );
+
public slots:
void modified();
+ void textChanged( const QString& text );
private slots:
// void configureExtension();
// void selectionChanged( QListViewItem* );
// void itemClicked( QListViewItem* );
- void emailclient_changed( int newClient );
+ void client_changed( int newClient );
+ void externalapp_changed( int newApp );
private:
+ void saveEditFieldSettings();
+ void updateClientWidgets();
+
// void restoreExtensionSettings();
// void saveExtensionSettings();
// KListView *mExtensionView;
// QCheckBox *mNameParsing;
// QCheckBox *mViewsSingleClickBox;
// QPushButton *mConfigureButton;
- QComboBox* mEmailClient;
- QLineEdit* mEmailChannel;
+ QComboBox* mExternalApps;
+ QGroupBox* mExternalAppGroupBox;
+
+
+ QComboBox* mClient;
+ QLineEdit* mChannel;
+ QLineEdit* mMessage;
+ QLineEdit* mParameters;
+ QLineEdit* mMessage2;
+ QLineEdit* mParameters2;
+
+ ExternalAppHandler::Types mCurrentApp;
+ int mCurrentClient;
+
+
+ int mEmailClient;
+ QString mEmailOtherChannel;
+ QString mEmailOtherMessage;
+ QString mEmailOtherMessageParameters;
+ QString mEmailOtherMessage2;
+ QString mEmailOtherMessageParameters2;
+
+ int mPhoneClient;
+ QString mPhoneOtherChannel;
+ QString mPhoneOtherMessage;
+ QString mPhoneOtherMessageParameters;
+
+ int mFaxClient;
+ QString mFaxOtherChannel;
+ QString mFaxOtherMessage;
+ QString mFaxOtherMessageParameters;
+
+ int mSMSClient;
+ QString mSMSOtherChannel;
+ QString mSMSOtherMessage;
+ QString mSMSOtherMessageParameters;
+
+ int mPagerClient;
+ QString mPagerOtherChannel;
+ QString mPagerOtherMessage;
+ QString mPagerOtherMessageParameters;
+
+
+
+ QMap<ExternalAppHandler::Types, QString> mExternalAppsMap;
// AddresseeWidget *mAddresseeWidget;
};
#endif
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 15531c7..140a286 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -1,63 +1,66 @@
/*
This file is part of libkdepim.
Copyright (c) 2002 Cornelius Schumacher <schumacher@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.
*/
+/*
+Enhanced Version of the file for platform independent KDE tools.
+Copyright (c) 2004 Ulf Schenk
+
+$Id$
+*/
+
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include "kpimprefs.h"
KPimPrefs::KPimPrefs( const QString &name ) :
KPrefs( name )
{
- KPrefs::setCurrentGroup( "ExternalApplications" );
- addItemInt( "EmailChannelType", &mEmailClient, OMPI );
- addItemString( "EmailChannelOther", &mEmailChannel, "" );
-
}
KPimPrefs::~KPimPrefs()
{
}
void KPimPrefs::usrSetDefaults()
{
setCategoryDefaults();
}
void KPimPrefs::usrReadConfig()
{
kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
if (mCustomCategories.isEmpty()) setCategoryDefaults();
}
void KPimPrefs::usrWriteConfig()
{
config()->setGroup("General");
config()->writeEntry("Custom Categories",mCustomCategories);
}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 5186315..9bd9466 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -1,67 +1,64 @@
/*
This file is part of libkdepim.
Copyright (c) 2002 Cornelius Schumacher <schumacher@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.
*/
+
+/*
+Enhanced Version of the file for platform independent KDE tools.
+Copyright (c) 2004 Ulf Schenk
+
+$Id$
+*/
+
#ifndef KPIMPREFS_H
#define KPIMPREFS_H
#include <qstringlist.h>
#include "kprefs.h"
class KPimPrefs : public KPrefs
{
public:
KPimPrefs( const QString &name = QString::null );
virtual ~KPimPrefs();
/** Set preferences to default values */
void usrSetDefaults();
/** Read preferences from config file */
void usrReadConfig();
/** Write preferences to config file */
void usrWriteConfig();
- enum EMailClients {
- OMPI = 0,
- QTOPIA = 1,
- OPIE = 2,
- OTHER = 3
- };
-
public:
QStringList mCustomCategories;
- int mEmailClient;
- QString mEmailChannel;
-
-
protected:
virtual void setCategoryDefaults() = 0;
};
#endif
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro
index 902f049..e05e681 100644
--- a/libkdepim/libkdepim.pro
+++ b/libkdepim/libkdepim.pro
@@ -1,55 +1,59 @@
TEMPLATE = lib
CONFIG = qt warn_on
DEFINES +=KORG_NOKABC
TARGET = microkdepim
INCLUDEPATH += ../microkde ../libkabcwrap ../microkde/kdecore ../microkde/kdeui . ..
DESTDIR=../bin
DEFINES += DESKTOP_VERSION
include( ../variables.pri )
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
+ externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kincidenceformatter.h \
kpimprefs.h \
+ kpimglobalprefs.h \
kprefsdialog.h \
addresseeview.h \
ksyncprofile.h \
ksyncprefsdialog.h \
kcmconfigs/kcmkdepimconfig.h \
kcmconfigs/kdepimconfigwidget.h
SOURCES = \
categoryeditdialog.cpp \
categoryeditdialog_base.cpp \
categoryselectdialog.cpp \
categoryselectdialog_base.cpp \
+ externalapphandler.cpp \
kdateedit.cpp \
kdatepicker.cpp \
kinputdialog.cpp \
kincidenceformatter.cpp \
kpimprefs.cpp \
+ kpimglobalprefs.cpp \
kprefsdialog.cpp \
addresseeview.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \
kcmconfigs/kcmkdepimconfig.cpp \
kcmconfigs/kdepimconfigwidget.cpp
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index fc8abe1..b322bce 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,49 +1,53 @@
TEMPLATE = lib
CONFIG += qt warn_on
TARGET = microkdepim
INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore ../microkde/kdeui $(QPEDIR)/include
INCLUDEPATH += . ..
LIBS += -lmicrokde
LIBS += -L$(QPEDIR)/lib
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
+ externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kincidenceformatter.h \
kpimprefs.h \
+ kpimglobalprefs.h \
kprefsdialog.h \
addresseeview.h \
ksyncprofile.h \
ksyncprefsdialog.h \
kcmconfigs/kcmkdepimconfig.h \
kcmconfigs/kdepimconfigwidget.h
SOURCES = \
categoryeditdialog.cpp \
categoryeditdialog_base.cpp \
categoryselectdialog.cpp \
categoryselectdialog_base.cpp \
+ externalapphandler.cpp \
kdateedit.cpp \
kinputdialog.cpp \
kdatepicker.cpp \
kincidenceformatter.cpp \
kpimprefs.cpp \
+ kpimglobalprefs.cpp \
kprefsdialog.cpp \
addresseeview.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \
kcmconfigs/kcmkdepimconfig.cpp \
kcmconfigs/kdepimconfigwidget.cpp
diff --git a/microkde/kdeui/kcmodule.cpp b/microkde/kdeui/kcmodule.cpp
index 915cd0f..f646db3 100644
--- a/microkde/kdeui/kcmodule.cpp
+++ b/microkde/kdeui/kcmodule.cpp
@@ -1,106 +1,114 @@
/*
This file is part of the KDE libraries
Copyright (c) 2001 Michael Goffioul <goffioul@imec.be>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kcmodule.h"
//US#include <kinstance.h>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
class KCModulePrivate
{
public:
//US KInstance *_instance;
QString _rootOnlyMsg;
bool _useRootOnlyMsg;
bool _hasOwnInstance;
+ KPrefs* _prefs;
};
-KCModule::KCModule(QWidget *parent, const char *name, const QStringList &)
+KCModule::KCModule(KPrefs* prefs, QWidget *parent, const char *name, const QStringList &)
: QWidget(parent, name), _btn(Help|Default|Apply)
{
kdDebug() << "KCModule " << name << endl;
d = new KCModulePrivate;
d->_useRootOnlyMsg = true;
-/*US
+ d->_prefs = prefs;
+/*US
d->_instance = new KInstance(name);
if (name && strlen(name)) {
d->_instance = new KInstance(name);
KGlobal::locale()->insertCatalogue(name);
} else
d->_instance = new KInstance("kcmunnamed");
-*/
+*/
d->_hasOwnInstance = true;
//US KGlobal::setActiveInstance(this->instance());
}
/*US
KCModule::KCModule(KInstance *instance, QWidget *parent, const QStringList & )
: QWidget(parent, instance ? instance->instanceName().data() : 0), _btn(Help|Default|Apply)
{
kdDebug() << "KCModule instance " << (instance ? instance->instanceName().data() : "none") << endl;
d = new KCModulePrivate;
d->_useRootOnlyMsg = true;
d->_instance = instance;
KGlobal::locale()->insertCatalogue(instance->instanceName());
d->_hasOwnInstance = false;
KGlobal::setActiveInstance(this->instance());
}
*/
KCModule::~KCModule()
{
/*US
if (d->_hasOwnInstance)
delete d->_instance;
-*/
+*/
delete d;
}
void KCModule::setRootOnlyMsg(const QString& msg)
{
d->_rootOnlyMsg = msg;
}
QString KCModule::rootOnlyMsg() const
{
return d->_rootOnlyMsg;
}
void KCModule::setUseRootOnlyMsg(bool on)
{
d->_useRootOnlyMsg = on;
}
bool KCModule::useRootOnlyMsg() const
{
return d->_useRootOnlyMsg;
}
+
+KPrefs* KCModule::getPreferences()
+{
+ return d->_prefs;
+}
+
/*US
KInstance *KCModule::instance() const
{
return d->_instance;
}
*/
void KCModule::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "kcmodule.moc"
diff --git a/microkde/kdeui/kcmodule.h b/microkde/kdeui/kcmodule.h
index bc020bc..874958c 100644
--- a/microkde/kdeui/kcmodule.h
+++ b/microkde/kdeui/kcmodule.h
@@ -1,267 +1,268 @@
/*
This file is part of the KDE libraries
Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __KCMODULE_H__
#define __KCMODULE_H__
#include <qwidget.h>
#include <qstringlist.h>
//USclass KAboutData;
class KCModulePrivate;
class KPrefs;
//US class KInstance;
/**
* The base class for control center modules.
*
* Starting from KDE 2.0, control center modules are realized as shared
* libraries that are loaded into the control center at runtime.
*
* The module in principle is a simple widget displaying the
* item to be changed. The module has a very small interface.
*
* All the necessary glue logic and the GUI bells and whistles
* are provided by the control center and must not concern
* the module author.
*
* To write a config module, you have to create a library
* that contains at one factory function like this:
*
* <pre>
* #include <kgenericfactory.h>
*
* typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory;
* K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") );
* </pre>
*
* The parameter "name_of_the_po_file" has to correspond with the messages target
* that you created in your Makefile.am.
*
* See kdebase/kcontrol/HOWTO for more detailed documentation.
*
* @author Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
*/
class KCModule : public QWidget
{
Q_OBJECT
public:
/**
* An enumeration type for the buttons used by this module.
* You should only use Help, Default and Apply. The rest is obsolete.
*
* @see KCModule::buttons @see KCModule::setButtons
*/
enum Button {Help=1, Default=2, Apply=16,
Reset=4, /* obsolete, do not use! */
Cancel=8, /* obsolete, do not use! */
Ok=32, /* obsolete, do not use! */
SysDefault=64 /* obsolete, do not use! */ };
/*
* Base class for all KControlModules.
* Make sure you have a QStringList argument in your
* implementation.
*/
- KCModule(QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() );
+ KCModule(KPrefs* prefs, QWidget *parent=0, const char *name=0, const QStringList &args=QStringList() );
//US KCModule(KInstance *instance, QWidget *parent=0, const QStringList &args=QStringList() );
/*
* Destroys the module.
*/
~KCModule();
/**
* Load the configuration data into the module.
*
* The load method sets the user interface elements of the
* module to reflect the current settings stored in the
* configuration files.
*
* This method is invoked whenever the module should read its configuration
* (most of the times from a config file) and update the user interface.
* This happens when the user clicks the "Reset" button in the control
* center, to undo all of his changes and restore the currently valid
* settings. NOTE that this is not called after the modules is loaded,
* so you probably want to call this method in the constructor.
*/
- virtual void load(KPrefs* prefs) {};
+ virtual void load() {};
/**
* Save the configuration data.
*
* The save method stores the config information as shown
* in the user interface in the config files.
*
* If necessary, this method also updates the running system,
* e.g. by restarting applications.
*
* save is called when the user clicks "Apply" or "Ok".
*/
- virtual void save(KPrefs* prefs) {};
+ virtual void save() {};
/**
* Sets the configuration to sensible default values.
*
* This method is called when the user clicks the "Default"
* button. It should set the display to useful values.
*/
- virtual void defaults(KPrefs* prefs) {};
+ virtual void defaults() {};
/**
* Set the configuration to system default values.
*
* This method is called when the user clicks the "System-Default"
* button. It should set the display to the system default values.
*
* NOTE: The default behaviour is to call defaults().
*/
- virtual void sysdefaults(KPrefs* prefs) { defaults(prefs); };
+ virtual void sysdefaults() { defaults(); };
/**
* Return a quick-help text.
*
* This method is called when the module is docked.
* The quick-help text should contain a short description of the module and
* links to the module's help files. You can use QML formating tags in the text.
*
* NOTE: Please make sure the quick help text gets translated (use i18n()).
*/
virtual QString quickHelp() const { return QString::null; };
/**
* Returns a the KAboutData for this module
* This is generally only called for the KBugReport.
* Override and have it return a pointer to a constant
*/
//US virtual const KAboutData *aboutData() const { return 0; }
/**
* Indicate which buttons will be used.
*
* The return value is a value or'ed together from
* the Button enumeration type.
*
* @see KCModule::setButtons
*/
int buttons() const { return _btn; };
/**
* Get the RootOnly message for this module.
*
* When the module must be run as root, or acts differently
* for root and a normal user, it is sometimes useful to
* customize the message that appears at the top of the module
* when used as a normal user. This function returns this
* customized message. If none has been set, a default message
* will be used.
*
* @see KCModule::setRootOnlyMsg
*/
QString rootOnlyMsg() const;
/**
* Tell if KControl should show a RootOnly message when run as
* a normal user.
*
* In some cases, the module don't want a RootOnly message to
* appear (for example if it has already one). This function
* tells KControl if a RootOnly message should be shown
*
* @see KCModule::setUseRootOnlyMsg
*/
bool useRootOnlyMsg() const;
+ KPrefs* getPreferences();
//US KInstance *instance() const;
signals:
/**
* Indicate that the state of the modules contents has changed.
*
* This signal is emitted whenever the state of the configuration
* shown in the module changes. It allows the control center to
* keep track of unsaved changes.
*
*/
void changed(bool state);
/**
* Indicate that the module's quickhelp has changed.
*
* Emit this signal whenever the module's quickhelp changes.
* Modules implemented as tabbed dialogs might want to implement
* per-tab quickhelp for example.
*
*/
void quickHelpChanged();
protected:
/**
* Sets the buttons to display.
*
* Help: shows a "Help" button.
* Default: shows a "Use Defaults" button
* Apply: in kcontrol this will show an "Apply" and "Reset" button
* in kcmshell this will show an "Ok", "Apply" and "Cancel" button
*
* If Apply is not specified, kcmshell will show a "Close" button.
*
* @see KCModule::buttons
*/
void setButtons(int btn) { _btn = btn; };
/**
* Sets the RootOnly message.
*
* This message will be shown at the top of the module of the
* corresponding desktop file contains the line X-KDE-RootOnly=true.
* If no message is set, a default one will be used.
*
* @see KCModule::rootOnlyMessage
*/
void setRootOnlyMsg(const QString& msg);
/**
* Change wether or not the RootOnly message should be shown.
*
* Following the value of @p on, the RootOnly message will be
* shown or not.
*
* @see KCModule::useRootOnlyMsg
*/
void setUseRootOnlyMsg(bool on);
private:
int _btn;
protected:
virtual void virtual_hook( int id, void* data );
private:
KCModulePrivate *d;
};
#endif
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index c2378fb..6c82e4f 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,207 +1,206 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qhbox.h>
#include <qvbox.h>
#include <qcursor.h>
#include <qlayout.h>
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
//US #include <klibloader.h>
#include <krun.h>
#include <kprocess.h>
#include "kcmultidialog.h"
-#include "kprefs.h"
//US #include "kcmultidialog.moc"
//US #include "kcmoduleloader.h"
-KCMultiDialog::KCMultiDialog(KPrefs* prefs, const QString& baseGroup, QWidget *parent, const char *name, bool modal)
+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), mPrefs(prefs), d(0L)
+ 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);
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(mPrefs);
+ (*it)->defaults();
clientChanged(true);
return;
}
}
}
void KCMultiDialog::slotApply()
{
qDebug("KCMultiDialog::slotApply clicked");
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
- (*it)->save(mPrefs);
+ (*it)->save();
clientChanged(false);
emit applyClicked();
}
void KCMultiDialog::slotOk()
{
qDebug("KCMultiDialog::slotOk clicked");
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
- (*it)->save(mPrefs);
+ (*it)->save();
accept();
emit okClicked();
}
void KCMultiDialog::slotHelp()
{
/*US
KURL url( KURL("help:/"), _docPath );
if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
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
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));
if(!page) {
KCModuleLoader::unloadModule(info);
return;
}
moduleDict.insert(page, new LoadInfo(path, withfallback));
if (modules.isEmpty())
slotAboutToShow(page);
}
*/
QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
{
QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
return page;
}
//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)));
//US
- module->load(mPrefs);
+ module->load();
}
void KCMultiDialog::slotAboutToShow(QWidget *page)
{
/*US
LoadInfo *loadInfo = moduleDict[page];
if (!loadInfo)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
moduleDict.remove(page);
KCModuleInfo info(loadInfo->path, _baseGroup);
KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
if (!module)
{
QApplication::restoreOverrideCursor();
KCModuleLoader::showLastLoaderError(this);
delete loadInfo;
return;
}
module->reparent(page,0,QPoint(0,0),true);
connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
//setHelp( docpath, QString::null );
_docPath = info.docPath();
modules.append(module);
//KCGlobal::repairAccels( topLevelWidget() );
delete loadInfo;
QApplication::restoreOverrideCursor();
*/
qDebug("KCMultiDialog::slotAboutToShow not implemented");
}
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index a42555f..1aa66b2 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -1,149 +1,146 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCMULTIDIALOG_H
#define KCMULTIDIALOG_H
#include <qptrlist.h>
#include <qptrdict.h>
#include <kdialogbase.h>
#include <kjanuswidget.h>
#include <kcmodule.h>
-class KPrefs;
-
/**
* A class that offers a @ref KDialogBase containing arbitrary KControl Modules
*
* @short A method that offers a @ref KDialogBase containing arbitrary
* KControl Modules.
*
* @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org>
* @since 3.2
*/
class KCMultiDialog : public KDialogBase
{
Q_OBJECT
public:
/**
* Constructs a new KCMultiDialog
*
* @param parent The parent Widget
* @param name The widget name
* @param baseGroup The baseGroup, if you want to call a module out of
* kcontrol, just keep "settings"
* @param modal If you pass true here, the dialog will be modal
**/
- KCMultiDialog(KPrefs* prefs, const QString& baseGroup = QString::fromLatin1("settings"),
+ KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"),
QWidget *parent=0, const char *name=0,
bool modal=false);
/**
* Destructor
**/
virtual ~KCMultiDialog();
/**
* Add a module.
*
* @param module Specify the name of the module that is to be added
* to the list of modules the dialog will show.
*
* @param withfallback Try harder to load the module. Might result
* in the module appearing outside the dialog.
**/
//US void addModule(const QString& module, bool withfallback=true);
//US special method for microkde. We dop noty want to load everything dynamically.
void addModule(KCModule* module );//, const QString& modulename, const QString& iconname);
QVBox* getNewVBoxPage(const QString & modulename) ;
protected slots:
/**
* This slot is called when the user presses the "Default" Button
* You can reimplement it if needed.
*
* @note Make sure you call the original implementation!
**/
virtual void slotDefault();
/**
* This slot is called when the user presses the "Apply" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotApply();
/**
* This slot is called when the user presses the "OK" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotOk();
/**
* This slot is called when the user presses the "Help" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotHelp();
private slots:
void slotAboutToShow(QWidget *);
void clientChanged(bool state);
private:
/*US
struct LoadInfo {
LoadInfo(const QString &_path, bool _withfallback)
: path(_path), withfallback(_withfallback)
{ }
QString path;
bool withfallback;
};
*/
QPtrList<KCModule> modules;
/*
QPtrDict<LoadInfo> moduleDict;
QString _docPath;
*/
QString _baseGroup;
//US
KJanusWidget* mMainWidget;
- KPrefs* mPrefs;
// For future use
class KCMultiDialogPrivate;
KCMultiDialogPrivate *d;
};
#endif //KCMULTIDIALOG_H