-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 @@ -70,18 +70,22 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 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()); @@ -215,16 +219,17 @@ 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 ) 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 @@ -53,15 +53,16 @@ class ConfigDialog : public KDialogBase 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 @@ -34,16 +34,17 @@ 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 ) { @@ -58,40 +59,41 @@ Resource::Resource( const KConfig* config ) // 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 @@ -144,16 +146,24 @@ 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; 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 @@ -305,16 +305,18 @@ class Resource : public QObject */ 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. |