28 files changed, 91 insertions, 317 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 592d78d..c584c35 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -276,9 +276,9 @@ void AddressBook::init(const QString &config, const QString &family ) // qDebug("AddressBook::init 1 config=0"); } //US d->mErrorHandler = 0; - d->mManager = new KRES::Manager<Resource>( fami, false ); + d->mManager = new KRES::Manager<Resource>( fami ); d->mManager->readConfig( d->mConfig ); if ( family == "syncContact" ) { KRES::Manager<Resource> *manager = d->mManager; KRES::Manager<Resource>::ActiveIterator it; diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro index 061909b..96fe39e 100644 --- a/kabc/kabcE.pro +++ b/kabc/kabcE.pro @@ -40,9 +40,8 @@ HEADERS = \ resource.h \ secrecy.h \ sound.h \ stdaddressbook.h \ - syncprefwidget.h \ timezone.h \ tmpaddressbook.h \ vcardconverter.h \ vcard21parser.h \ @@ -145,9 +144,8 @@ SOURCES = \ resource.cpp \ secrecy.cpp \ sound.cpp \ stdaddressbook.cpp \ - syncprefwidget.cpp \ timezone.cpp \ tmpaddressbook.cpp \ vcardconverter.cpp \ vcard21parser.cpp \ diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index e58e4f7..e2b7b08 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -57,9 +57,8 @@ $Id$ #include <qdir.h> #define NO_DIRWATCH #include "resourcedir.h" -#include "syncprefwidget.h" //#define ALLOW_LOCKING using namespace KABC; @@ -73,16 +72,16 @@ __declspec(dllexport) //US void *init_kabc_dir() void *init_microkabc_dir() { - return new KRES::PluginFactory<ResourceDir,ResourceDirConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); } #ifndef _WIN32_ } #endif -ResourceDir::ResourceDir( const KConfig *config, bool syncable ) - : Resource( config, syncable ) +ResourceDir::ResourceDir( const KConfig *config ) + : Resource( config ) { QString path; KConfig *cfg = (KConfig *)config; diff --git a/kabc/plugins/dir/resourcedir.h b/kabc/plugins/dir/resourcedir.h index 77cd18c..6c1e922 100644 --- a/kabc/plugins/dir/resourcedir.h +++ b/kabc/plugins/dir/resourcedir.h @@ -48,9 +48,9 @@ class ResourceDir : public Resource { Q_OBJECT public: - ResourceDir( const KConfig*, bool syncable ); + ResourceDir( const KConfig* ); ~ResourceDir(); virtual void writeConfig( KConfig* ); diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 163f2b4..dc5932f 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -50,9 +50,8 @@ $Id$ #include "resourcefileconfig.h" #include "stdaddressbook.h" #define NO_DIRWATCH #include "resourcefile.h" -#include "syncprefwidget.h" //#define ALLOW_LOCKING @@ -68,23 +67,20 @@ __declspec(dllexport) //US void *init_kabc_file() void *init_microkabc_file() { - return new KRES::PluginFactory<ResourceFile,ResourceFileConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); } #ifndef _WIN32_ } #endif -ResourceFile::ResourceFile( const KConfig *config, bool syncable ) - : Resource( config, syncable ) , mFormat( 0 ) +ResourceFile::ResourceFile( const KConfig *config ) + : Resource( config ) , mFormat( 0 ) { QString fileName, formatName, default_fileName; - if (syncable == true) - default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf"; - else - default_fileName = StdAddressBook::fileName(); + default_fileName = StdAddressBook::fileName(); KConfig *cfg = (KConfig *)config; if ( cfg ) { fileName = cfg->readEntry( "FileName", default_fileName ); @@ -96,11 +92,11 @@ ResourceFile::ResourceFile( const KConfig *config, bool syncable ) init( fileName, formatName ); } -ResourceFile::ResourceFile( const QString &fileName, bool syncable , +ResourceFile::ResourceFile( const QString &fileName , const QString &formatName ) - : Resource( 0, syncable ) + : Resource( 0 ) { // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); init( fileName, formatName ); } diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h index 8339340..b4421b2 100644 --- a/kabc/plugins/file/resourcefile.h +++ b/kabc/plugins/file/resourcefile.h @@ -57,14 +57,14 @@ public: Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceFile( const KConfig *cfg, bool syncable ); + ResourceFile( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceFile( const QString &fileName, bool syncable , const QString &formatName = "vcard" ); + ResourceFile( const QString &fileName , const QString &formatName = "vcard" ); /** * Destructor. */ diff --git a/kabc/plugins/ldap/resourceldap.cpp b/kabc/plugins/ldap/resourceldap.cpp index 17f115d..55c43af 100644 --- a/kabc/plugins/ldap/resourceldap.cpp +++ b/kabc/plugins/ldap/resourceldap.cpp @@ -35,26 +35,25 @@ $Id$ #include <stdlib.h> #include "resourceldap.h" #include "resourceldapconfig.h" -#include "syncprefwidget.h" using namespace KABC; extern "C" { //US void *init_kabc_ldap() void *init_microkabc_ldap() { - return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>(); } } void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); -ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mPort( 389 ), mLdap( 0 ) +ResourceLDAP::ResourceLDAP( const KConfig *config ) + : Resource( config ), mPort( 389 ), mLdap( 0 ) { KConfig *cfg = (KConfig *)config; if ( cfg ) { mUser = cfg->readEntry( "LdapUser" ); diff --git a/kabc/plugins/ldap/resourceldap.h b/kabc/plugins/ldap/resourceldap.h index 0aad3c1..0625f30 100644 --- a/kabc/plugins/ldap/resourceldap.h +++ b/kabc/plugins/ldap/resourceldap.h @@ -42,9 +42,9 @@ namespace KABC { class ResourceLDAP : public Resource { public: - ResourceLDAP( const KConfig*, bool syncable ); + ResourceLDAP( const KConfig* ); virtual void writeConfig( KConfig* ); virtual bool doOpen(); diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index 22237dc..f610b38 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -49,9 +49,8 @@ $Id$ #include <opie/ocontactaccessbackend_xml.h> #include "resourceopieconfig.h" #include "stdaddressbook.h" -#include "syncprefwidget.h" #include "opieconverter.h" #include "resourceopie.h" @@ -60,14 +59,14 @@ using namespace KABC; extern "C" { void *init_microkabc_opie() { - return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>(); } } -ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mAccess(0), mConverter (0) +ResourceOpie::ResourceOpie( const KConfig *config ) + : Resource( config ), mAccess(0), mConverter (0) { QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; KConfig *cfg = (KConfig *)config; @@ -78,10 +77,10 @@ ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) init( fileName ); } -ResourceOpie::ResourceOpie( const QString &fileName, bool syncable ) - : Resource( 0, syncable ) +ResourceOpie::ResourceOpie( const QString &fileName ) + : Resource( 0 ) { init( fileName ); } diff --git a/kabc/plugins/opie/resourceopie.h b/kabc/plugins/opie/resourceopie.h index d5b4ebd..9d05c70 100644 --- a/kabc/plugins/opie/resourceopie.h +++ b/kabc/plugins/opie/resourceopie.h @@ -56,14 +56,14 @@ public: Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceOpie( const KConfig *cfg, bool syncable ); + ResourceOpie( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceOpie( const QString &fileName, bool syncable ); + ResourceOpie( const QString &fileName ); /** * Destructor. */ diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index f9cabcb..deb218b 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -48,31 +48,30 @@ $Id$ #include "resourceqtopiaconfig.h" #include "stdaddressbook.h" #include "qtopiaconverter.h" -#include "syncprefwidget.h" #include "resourceqtopia.h" using namespace KABC; extern "C" { void *init_microkabc_qtopia() { - return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig, SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>(); } } -ResourceQtopia::ResourceQtopia( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mConverter (0) +ResourceQtopia::ResourceQtopia( const KConfig *config ) + : Resource( config ), mConverter (0) { // we can not choose the filename. Therefore use the default to display QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; init( fileName ); } -ResourceQtopia::ResourceQtopia( const QString &fileName, bool syncable ) - : Resource( 0, syncable ) +ResourceQtopia::ResourceQtopia( const QString &fileName ) + : Resource( 0 ) { init( fileName ); } diff --git a/kabc/plugins/qtopia/resourceqtopia.h b/kabc/plugins/qtopia/resourceqtopia.h index eace280..ff6350d 100644 --- a/kabc/plugins/qtopia/resourceqtopia.h +++ b/kabc/plugins/qtopia/resourceqtopia.h @@ -57,14 +57,14 @@ public: Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceQtopia( const KConfig *cfg, bool syncable ); + ResourceQtopia( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceQtopia( const QString &fileName, bool syncable ); + ResourceQtopia( const QString &fileName ); /** * Destructor. */ diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index c013f52..2cdf4bf 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp @@ -49,10 +49,8 @@ $Id$ #include "resourcesharpdtmconfig.h" #include "resourcesharpdtm.h" -#include "syncprefwidget.h" - #include "stdaddressbook.h" #include "sharpdtmconverter.h" //#define ALLOW_LOCKING @@ -60,14 +58,14 @@ using namespace KABC; extern "C" { void *init_microkabc_sharpdtm() { - return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig,SyncPrefWidgetContainer>(); + return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); } } -ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) - : Resource( config, syncable ), mConverter (0) +ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) + : Resource( config ), mConverter (0) { // we can not choose the filename. Therefore use the default to display QString fileName = SlZDataBase::addressbookFileName(); diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.h b/kabc/plugins/sharpdtm/resourcesharpdtm.h index f386e69..64d06f9 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.h +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.h @@ -57,14 +57,14 @@ public: Constructor. @param cfg The config object where custom resource settings are stored. */ - ResourceSharpDTM( const KConfig *cfg, bool syncable ); + ResourceSharpDTM( const KConfig *cfg ); /** Construct file resource on file @arg fileName using format @arg formatName. */ - ResourceSharpDTM( const QString &fileName, bool syncable ); + ResourceSharpDTM( const QString &fileName ); /** * Destructor. */ diff --git a/kabc/resource.cpp b/kabc/resource.cpp index 7b91239..267cdaf 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp @@ -26,37 +26,24 @@ $Id$ */ #include <kdebug.h> -#include <ksyncprofile.h> - #include "resource.h" using namespace KABC; -Resource::Resource( const KConfig *config, bool syncable ) - : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) +Resource::Resource( const KConfig *config ) + : KRES::Resource( config ), mAddressBook( 0 ) { - if(syncable == true) { - mSyncProfile = new KSyncProfile( ); - mSyncProfile->setName("pending" /*resourceName()*/); - mSyncProfile->readConfig( (KConfig *)config ); - } } Resource::~Resource() { - if (mSyncProfile != 0) { - delete mSyncProfile; - } } void Resource::writeConfig( KConfig *config ) { KRES::Resource::writeConfig( config ); - - if(mSyncProfile != 0) - mSyncProfile->writeConfig( config ); } void Resource::setAddressBook( AddressBook *ab ) @@ -107,19 +94,8 @@ void Resource::cleanUp() { // do nothing } -bool Resource::isSyncable() const -{ - return (mSyncProfile != 0); -} - -KSyncProfile* Resource::getSyncProfile() -{ - return mSyncProfile; -} - - QString Resource::fileName() const { return mFileName; } @@ -135,10 +111,6 @@ void Resource::setFileName( const QString &fileName ) */ void Resource::setResourceName( const QString &name ) { KRES::Resource::setResourceName(name); - if(mSyncProfile != 0) { - mSyncProfile->setName( name ); - } - } diff --git a/kabc/resource.h b/kabc/resource.h index 2024d2d..e5f0d5d 100644 --- a/kabc/resource.h +++ b/kabc/resource.h @@ -32,10 +32,8 @@ $Id$ #include "addressbook.h" -class KSyncProfile; - namespace KABC { /** * @short Helper class for handling coordinated save of address books. @@ -59,19 +57,13 @@ class Ticket * @internal */ class Resource : public KRES::Resource { -private: - /** - * make this constructor private to force everybody to use the other one - */ - Resource( const KConfig *config); - public: /** * Constructor */ - Resource( const KConfig *config, bool syncable ); + Resource( const KConfig *config ); /** * Destructor. */ @@ -138,13 +130,8 @@ public: * Return name of file used for loading and saving the address book. */ virtual QString fileName() const; - - virtual bool isSyncable() const; - - virtual KSyncProfile* getSyncProfile(); - /** * Set the name of resource.You can override this method, * but also remember to call Resource::setResourceName(). */ @@ -157,9 +144,8 @@ protected: virtual void doClose(); private: AddressBook *mAddressBook; - KSyncProfile *mSyncProfile; QString mFileName; }; diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index 4351753..67e8406 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp @@ -175,9 +175,9 @@ bool XXPortResourceObject::isAvailable() bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, const QString& identifier, const QString& fileName ) { //create new resource - KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0, false )); + KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 )); if (mResource == 0) return false; @@ -235,9 +235,9 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con KABC::AddresseeList XXPortResourceObject::_importContacts( const QString& identifier, const QString& fileName ) const { - KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0, false )); + KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 )); if (mResource == 0) return KABC::AddresseeList(); diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index 030b547..24e82bc 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp @@ -40,16 +40,15 @@ #include "factory.h" #include "configwidget.h" #include "configdialog.h" -#include "syncwidget.h" using namespace KRES; ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, Resource* resource, const char *name ) - : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ), - Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false) + : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), + Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) { Factory *factory = Factory::self( resourceFamily ); @@ -57,32 +56,28 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); QFrame *main; - if (!mResource->isSyncable()) - main = plainPage(); - else - main = addPage("Profile"); + main = plainPage(); QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); generalGroupBox->layout()->setSpacing( spacingHint() ); generalGroupBox->setTitle( i18n( "General Settings" ) ); - new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox ); + new QLabel( i18n( "Name:" ), generalGroupBox ); mName = new KLineEdit( generalGroupBox ); - if (!mResource->isSyncable()) { - new QLabel("", generalGroupBox ); - mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); - mReadOnly->setChecked( mResource->readOnly() ); - new QLabel("", generalGroupBox ); - mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); - mIncludeInSync->setChecked( mResource->includeInSync() ); - } + new QLabel("", generalGroupBox ); + mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); + mReadOnly->setChecked( mResource->readOnly() ); + + new QLabel("", generalGroupBox ); + mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); + mIncludeInSync->setChecked( mResource->includeInSync() ); mName->setText( mResource->resourceName() ); mainLayout->addWidget( generalGroupBox ); @@ -98,69 +93,18 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); if ( mConfigWidget ) { connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), SLOT( setReadOnly( bool ) ) ); + connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), + SLOT( setIncludeInSync( bool ) ) ); connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), SLOT( setPersistentReadOnly( bool ) ) ); mConfigWidget->setInEditMode( false ); mConfigWidget->loadSettings( mResource ); mConfigWidget->show(); } - if (mResource->isSyncable()) - { - SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() ); - - QFrame* syncPage = addPage("Settings"); - QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); - mSyncWidget_Settings = c->generateSettingsTab(syncPage); - syncLayout->addWidget( mSyncWidget_Settings ); - - syncPage = addPage("Conflicts"); - syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); - mSyncWidget_Conflicts = c->generateConflictsTab(syncPage); - syncLayout->addWidget( mSyncWidget_Conflicts ); - - syncPage = addPage("Remote"); - syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); - mSyncWidget_Remote = c->generateRemoteTab(syncPage); - syncLayout->addWidget( mSyncWidget_Remote ); - - - mSyncWidget_Settings->setInEditMode( false ); - mSyncWidget_Settings->loadSettings( mResource ); - mSyncWidget_Settings->show(); - - mSyncWidget_Conflicts->setInEditMode( false ); - mSyncWidget_Conflicts->loadSettings( mResource ); - mSyncWidget_Conflicts->show(); - - mSyncWidget_Remote->setInEditMode( false ); - mSyncWidget_Remote->loadSettings( mResource ); - mSyncWidget_Remote->show(); - - delete c; - -// QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, syncPage ); -// syncGroupBox->layout()->setSpacing( spacingHint()); -// syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) ); -// syncLayout->addWidget( syncGroupBox ); - -// syncLayout->addStretch(); -/*US - mSyncWidget = factory->syncWidget( resource->type(), syncPage ); - syncLayout->addWidget( mSyncWidget ); - if ( mSyncWidget ) { - mSyncWidget->setInEditMode( false ); - mSyncWidget->loadSettings( mResource ); - mSyncWidget->show(); - } - */ - } - - - connect( mName, SIGNAL( textChanged(const QString &)), SLOT( slotNameChanged(const QString &))); @@ -174,16 +118,8 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, void ConfigDialog::setInEditMode( bool value ) { if ( mConfigWidget ) mConfigWidget->setInEditMode( value ); - - if ( mSyncWidget_Settings ) - mSyncWidget_Settings->setInEditMode( value ); - if ( mSyncWidget_Conflicts ) - mSyncWidget_Conflicts->setInEditMode( value ); - if ( mSyncWidget_Remote ) - mSyncWidget_Remote->setInEditMode( value ); - } void ConfigDialog::slotNameChanged( const QString &text) { @@ -191,56 +127,53 @@ void ConfigDialog::slotNameChanged( const QString &text) } void ConfigDialog::setReadOnly( bool value ) { - if (!mResource->isSyncable()) { - if (mPersistentReadOnly == false) mReadOnly->setChecked( value ); else mReadOnly->setChecked( true ); - } } -void ConfigDialog::setPersistentReadOnly( bool value ) +void ConfigDialog::setIncludeInSync( bool value ) { - if (!mResource->isSyncable()) { + if (mPersistentReadOnly == false) + mIncludeInSync->setChecked( value ); + else + mIncludeInSync->setChecked( true ); +} +void ConfigDialog::setPersistentReadOnly( bool value ) +{ mPersistentReadOnly = value; - if (value == true) + if (value == true) { setReadOnly( true ); + setIncludeInSync( true ); + } mReadOnly->setEnabled( !value ); - } + mIncludeInSync->setEnabled (!value ); } + void ConfigDialog::accept() { if ( mName->text().isEmpty() ) { - KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) ); + KMessageBox::sorry( this, i18n( "Please enter a resource name" ) ); return; } mResource->setResourceName( mName->text() ); - if (!mResource->isSyncable()) - mResource->setReadOnly( mReadOnly->isChecked() ); - mResource->setIncludeInSync( mIncludeInSync->isChecked() ); + mResource->setReadOnly( mReadOnly->isChecked() ); + mResource->setIncludeInSync( mIncludeInSync->isChecked() ); if ( mConfigWidget ) { // First save generic information // Also save setting of specific resource type mConfigWidget->saveSettings( mResource ); } - if ( mSyncWidget_Settings ) - mSyncWidget_Settings->saveSettings( mResource ); - if ( mSyncWidget_Conflicts ) - mSyncWidget_Conflicts->saveSettings( mResource ); - if ( mSyncWidget_Remote ) - mSyncWidget_Remote->saveSettings( mResource ); - - KDialog::accept(); } //US #include "configdialog.moc" diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h index ed3ecab..b205975 100644 --- a/microkde/kresources/configdialog.h +++ b/microkde/kresources/configdialog.h @@ -30,9 +30,8 @@ class KButtonBox; namespace KRES { class Resource; class ConfigWidget; - class SyncWidget; class ConfigDialog : public KDialogBase { Q_OBJECT @@ -45,16 +44,14 @@ class ConfigDialog : public KDialogBase protected slots: void accept(); void setReadOnly( bool value ); + void setIncludeInSync( bool value ); void setPersistentReadOnly( bool value ); void slotNameChanged( const QString &text); private: ConfigWidget *mConfigWidget; - SyncWidget *mSyncWidget_Settings; - SyncWidget *mSyncWidget_Conflicts; - SyncWidget *mSyncWidget_Remote; Resource* mResource; KLineEdit *mName; QCheckBox *mReadOnly; diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index 02c5fb1..533be51 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp @@ -56,11 +56,8 @@ $Id$ #include <kglobal.h> using namespace KRES; -const QString ConfigPage::syncfamily = "syncprofiles"; - - class ConfigViewItem : public QCheckListItem { public: ConfigViewItem( QListView *parent, Resource* resource ) : @@ -183,17 +180,17 @@ void ConfigPage::load() //US for ( it = plugins.begin(); it != plugins.end(); ++it ) { //US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); //US QString family = tmp.toString(); QStringList families; - families << "contact" << syncfamily; + families << "contact"; for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) { QString family = (*it); if ( !family.isEmpty() ) { if ( !mFamilyMap.contains( family ) ) { - mCurrentManager = new Manager<Resource>( family, (family == syncfamily) ); + mCurrentManager = new Manager<Resource>( family ); if ( mCurrentManager ) { mFamilyMap.append( family ); mCurrentManager->addListener( this ); @@ -204,10 +201,8 @@ void ConfigPage::load() if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) { info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) ); } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) { info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); - } else if ( family == syncfamily && QFile::exists( configDir + "/kabcsyncrc" ) ) { - info.mConfig = new KConfig( locateLocal( "config", "kabcsyncrc" ) ); } else { QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); info.mConfig = new KConfig( configFile ); } @@ -309,20 +304,11 @@ void ConfigPage::slotAdd() bool ok = false; QString desc; - if (mFamily == syncfamily) - { - desc = QInputDialog::getItem( i18n( "Sync Configuration" ), - i18n( "Select resource type for the new sync profile:" ), descs, 0, - false, &ok, this ); - } - else - { - desc = QInputDialog::getItem( i18n( "Resource Configuration" ), + desc = QInputDialog::getItem( i18n( "Resource Configuration" ), i18n( "Select type of the new resource:" ), descs, 0, false, &ok, this ); - } if ( !ok ) return; @@ -335,16 +321,9 @@ void ConfigPage::slotAdd() .arg( type ) ); return; } - if (mFamily == syncfamily) - { - resource->setResourceName( type + "-syncprofile" ); - } - else - { - resource->setResourceName( type + "-resource" ); - } + resource->setResourceName( type + "-resource" ); ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); if ( dlg.exec() ) { diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index e44fce3..4e4456d 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp @@ -186,42 +186,8 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) return wdg; } -SyncWidgetContainer *Factory::syncWidgetContainer( const QString& type ) -{ - if ( type.isEmpty() || !mTypeMap.contains( type ) ) - return 0; - -//US KService::Ptr ptr = mTypeMap[ type ]; -//US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); - PluginInfo* pi = mTypeMap[ type ]; - KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); - if ( !factory ) { - qDebug("KRES::Factory::syncWidget(): Factory creation failed for library %s", pi->library.latin1()); - kdDebug() << "KRES::Factory::syncWidget(): Factory creation failed" << endl; - return 0; - } - - PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); - - if ( !pluginFactory ) { - qDebug("KRES::Factory::syncWidget(): no plugin factory for library %s", pi->library.latin1()); - kdDebug() << "KRES::Factory::syncWidget(): no plugin factory." << endl; - return 0; - } - - SyncWidgetContainer *wdg = pluginFactory->syncWidgetContainer( ); - if ( !wdg ) { -//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; - qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); - return 0; - } - return wdg; - -} - - QString Factory::typeName( const QString &type ) const { if ( type.isEmpty() || !mTypeMap.contains( type ) ) return QString(); @@ -244,9 +210,9 @@ QString Factory::typeDescription( const QString &type ) const PluginInfo* pi = mTypeMap[ type ]; return pi->descriptionLabel; } -Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable ) +Resource *Factory::resource( const QString& type, const KConfig *config ) { if ( type.isEmpty() || !mTypeMap.contains( type ) ) @@ -275,9 +241,9 @@ Resource *Factory::resource( const QString& type, const KConfig *config, bool sy kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; return 0; } - Resource *resource = pluginFactory->resource( config, syncable ); + Resource *resource = pluginFactory->resource( config ); if ( !resource ) { //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); return 0; diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h index 0e4231b..ea01b23 100644 --- a/microkde/kresources/factory.h +++ b/microkde/kresources/factory.h @@ -33,9 +33,8 @@ #include "resource.h" namespace KRES { -class SyncWidgetContainer; class ConfigWidget; //US struct PluginInfo @@ -86,28 +85,16 @@ class Factory */ ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); /** - * Returns the sync widget for the given resource type, - * or a null pointer if resource type doesn't exist, - * or a null pointer if resource does not support syncing. - * - * @param type The type of the resource, returned by @ref resources() - * @param resource The resource to be editted. - * @param parent The parent widget - */ - SyncWidgetContainer *syncWidgetContainer( const QString& type ); - - /** * Returns a pointer to a resource object or a null pointer * if resource type doesn't exist. * * @param type The type of the resource, returned by @ref resources() * @param ab The address book, the resource should belong to * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. - * @param syncable If the resource should support syncing capabilities. */ - Resource *resource( const QString& type, const KConfig *config, bool syncable ); + Resource *resource( const QString& type, const KConfig *config); /** * Returns a list of all available resource types. */ diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h index 7e9e19a..0e6f838 100644 --- a/microkde/kresources/manager.h +++ b/microkde/kresources/manager.h @@ -166,19 +166,14 @@ class Manager : private ManagerImplListener } bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } - /** - Return true, if the manager manages syncable resources. - */ - bool manageSyncable() { return mImpl->manageSyncable(); } - - Manager( const QString &family, bool syncable ) + Manager( const QString &family ) { mFactory = Factory::self( family ); // The managerimpl will use the same Factory object as the manager // because of the Factory::self() pattern - mImpl = new ManagerImpl( family, syncable ); + mImpl = new ManagerImpl( family ); mImpl->setListener( this ); mListeners = new QPtrList<ManagerListener<T> >; } @@ -259,13 +254,12 @@ class Manager : private ManagerImplListener if resource type doesn't exist. @param type The type of the resource, one of those returned by @ref resourceTypeNames() - * @param syncable If the resource should support syncing capabilities. */ T *createResource( const QString& type ) { - return (T *)( mFactory->resource( type, 0, mImpl->manageSyncable() ) ); + return (T *)( mFactory->resource( type, 0 ) ); } /** Returns a list of the names of all available resource types. diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 3655f50..81bbbec 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp @@ -40,10 +40,10 @@ $Id$ #include "managerimpl.h" using namespace KRES; -ManagerImpl::ManagerImpl( const QString &family, bool syncable ) - : mFamily( family ), mSyncable(syncable), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), +ManagerImpl::ManagerImpl( const QString &family ) + : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), mFactory( 0 ) { kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; @@ -267,9 +267,9 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier, mConfig->setTempGroup( "Resource_" + identifier ); #endif QString type = mConfig->readEntry( "ResourceType" ); QString name = mConfig->readEntry( "ResourceName" ); - Resource *resource = mFactory->resource( type, mConfig, mSyncable ); + Resource *resource = mFactory->resource( type, mConfig ); if ( !resource ) { qDebug("Failed to create resource with id %s ",identifier.latin1() ); return 0; } @@ -363,12 +363,5 @@ Resource* ManagerImpl::getResource( const QString& identifier ) } return 0; } -/** - Return true, if the manager manages syncable resources. -*/ -bool ManagerImpl::manageSyncable() const -{ - return mSyncable; -} diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h index 0425279..56a2db6 100644 --- a/microkde/kresources/managerimpl.h +++ b/microkde/kresources/managerimpl.h @@ -64,9 +64,9 @@ class ManagerImplListener class ManagerImpl : public QObject { Q_OBJECT public: - ManagerImpl( const QString &family, bool syncable); + ManagerImpl( const QString &family); ~ManagerImpl(); void readConfig( KConfig * ); void writeConfig( KConfig * ); @@ -89,13 +89,8 @@ class ManagerImpl : public QObject QStringList resourceNames(); void setListener( ManagerImplListener *listener ); - /** - Return true, if the manager manages syncable resources. - */ - bool manageSyncable() const; - public slots: void resourceChanged( Resource *resource ); private: @@ -111,9 +106,8 @@ class ManagerImpl : public QObject Resource *getResource( Resource *resource ); Resource *getResource( const QString& identifier ); QString mFamily; - bool mSyncable; KConfig *mConfig; KConfig *mStdConfig; Resource *mStandard; Factory *mFactory; diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index f79bcd0..cccd485 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp @@ -197,8 +197,9 @@ void Resource::dump() const kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; kdDebug(5650) << " Type: " << d->mType << endl; kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; + kdDebug(5650) << " IncludeInSync: " << ( d->mIncludeInSync ? "yes" : "no" ) << endl; kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; } diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index 70b5613..ed5af96 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h @@ -39,9 +39,8 @@ class KConfig; namespace KRES { class ConfigWidget; -class SyncWidgetContainer; /** * @internal * @libdoc The KDE Resource library @@ -231,9 +230,9 @@ link_DATA= resourceexample.desktop /** * A @ref Resource is a ... * * A subclass should reimplement at least the constructor and the - * @ref writeConfig method. +k * @ref writeConfig method. * */ class Resource : public QObject { @@ -322,13 +321,8 @@ class Resource : public QObject * Returns the name of resource. */ virtual QString resourceName() const; - - - virtual bool isSyncable() const = 0; - - /** Sets, if the resource is active. */ void setActive( bool active ); @@ -375,41 +369,33 @@ class Resource : public QObject class PluginFactoryBase : public KLibFactory { public: - virtual Resource *resource( const KConfig *config, bool syncable ) = 0; + virtual Resource *resource( const KConfig *config) = 0; virtual ConfigWidget *configWidget( QWidget *parent ) = 0; - virtual SyncWidgetContainer *syncWidgetContainer() = 0; - protected: virtual QObject* createObject( QObject*, const char*, const char*, const QStringList & ) { return 0; } }; -template<class TR,class TC, class TS> +template<class TR,class TC> class PluginFactory : public PluginFactoryBase { public: - Resource *resource( const KConfig *config, bool syncable ) + Resource *resource( const KConfig *config) { - return new TR( config, syncable ); + return new TR( config ); } ConfigWidget *configWidget( QWidget *parent ) { return new TC( parent ); } - - SyncWidgetContainer *syncWidgetContainer() - { - return new TS(); - } - }; diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro index df914ce..071ceb3 100644 --- a/microkde/microkdeE.pro +++ b/microkde/microkdeE.pro @@ -88,9 +88,8 @@ osmartpointer.h \ kresources/configpage.h \ kresources/configwidget.h \ kresources/configdialog.h \ kresources/kcmkresources.h \ - kresources/syncwidget.h \ kdecore/kmdcodec.h \ kdecore/kconfigbase.h \ kdecore/klocale.h \ kdecore/klibloader.h \ @@ -172,8 +171,7 @@ oprocess.cpp \ kresources/kcmkresources.cpp \ kresources/managerimpl.cpp \ kresources/resource.cpp \ kresources/selectdialog.cpp \ - kresources/syncwidget.cpp \ kutils/kcmultidialog.cpp \ kidmanager.cpp |