-rw-r--r-- | microkde/kresources/configdialog.cpp | 5 | ||||
-rw-r--r-- | microkde/kresources/configdialog.h | 1 | ||||
-rw-r--r-- | microkde/kresources/resource.cpp | 14 | ||||
-rw-r--r-- | microkde/kresources/resource.h | 2 |
4 files changed, 20 insertions, 2 deletions
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index f8240f9..030b547 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp @@ -66,26 +66,30 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 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 ); 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() ); } mName->setText( mResource->resourceName() ); mainLayout->addWidget( generalGroupBox ); QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); resourceGroupBox->layout()->setSpacing( spacingHint()); resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) .arg( factory->typeName( resource->type() ) ) ); mainLayout->addWidget( resourceGroupBox ); @@ -211,24 +215,25 @@ void ConfigDialog::setPersistentReadOnly( bool 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" ) ); return; } mResource->setResourceName( mName->text() ); if (!mResource->isSyncable()) 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 ) diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h index 63cd4e9..ed3ecab 100644 --- a/microkde/kresources/configdialog.h +++ b/microkde/kresources/configdialog.h @@ -49,19 +49,20 @@ class ConfigDialog : public KDialogBase 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; + QCheckBox *mIncludeInSync; //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. bool mPersistentReadOnly; }; } #endif diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index 4f69540..f79bcd0 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp @@ -30,72 +30,74 @@ using namespace KRES; class Resource::ResourcePrivate { public: #ifdef QT_THREAD_SUPPORT QMutex mMutex; #endif int mOpenCount; QString mType; QString mIdentifier; bool mReadOnly; + bool mIncludeInSync; QString mName; bool mActive; bool mIsOpen; }; Resource::Resource( const KConfig* config ) : QObject( 0, "" ), d( new ResourcePrivate ) { d->mOpenCount = 0; d->mIsOpen = false; //US compiler claimed that const discards qualifier KConfig* cfg = (KConfig*)config; if ( cfg ) { #ifdef _WIN32_ // we use plugins on win32. the group is stored in a static variable // such that group info not available on win32 plugins // to fix that, it would be a looooot of work if ( !cfg->tempGroup().isEmpty() ) cfg->setGroup( cfg->tempGroup() ); #endif d->mType = cfg->readEntry( "ResourceType" ); d->mName = cfg->readEntry( "ResourceName" ); d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); + d->mIncludeInSync = cfg->readBoolEntry( "ResourceIncludeInSync", true );; d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); } else { d->mType = "type"; d->mName = "resource-name"; d->mReadOnly = false; + d->mIncludeInSync = true; d->mActive = true; d->mIdentifier = KApplication::randomString( 10 ); } } Resource::~Resource() { delete d; d = 0; } void Resource::writeConfig( KConfig* config ) { - - config->writeEntry( "ResourceType", d->mType ); config->writeEntry( "ResourceName", d->mName ); config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); + config->writeEntry( "ResourceIncludeInSync", d->mIncludeInSync ); config->writeEntry( "ResourceIsActive", d->mActive ); config->writeEntry( "ResourceIdentifier", d->mIdentifier ); } bool Resource::open() { d->mIsOpen = true; #ifdef QT_THREAD_SUPPORT QMutexLocker guard( &(d->mMutex) ); #endif if ( !d->mOpenCount ) { kdDebug(5650) << "Opening resource " << resourceName() << endl; @@ -140,24 +142,32 @@ QString Resource::identifier() const } void Resource::setType( const QString& type ) { d->mType = type; } QString Resource::type() const { return d->mType; } +void Resource::setIncludeInSync( bool value ) +{ + d->mIncludeInSync = value; +} +bool Resource::includeInSync() const +{ + return d->mIncludeInSync; +} void Resource::setReadOnly( bool value ) { d->mReadOnly = value; } bool Resource::readOnly() const { return d->mReadOnly; } void Resource::setResourceName( const QString &name ) { diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index 580b5d1..70b5613 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h @@ -301,24 +301,26 @@ class Resource : public QObject /** * Mark the resource as read-only. You can override this method, * but also remember to call Resource::setReadOnly(). */ virtual void setReadOnly( bool value ); /** * Returns, if the resource is read-only. */ virtual bool readOnly() const; + void setIncludeInSync( bool value ); + bool includeInSync() const; /** * Set the name of resource.You can override this method, * but also remember to call Resource::setResourceName(). */ virtual void setResourceName( const QString &name ); /** * Returns the name of resource. */ virtual QString resourceName() const; |