Diffstat (limited to 'microkde/kresources/configdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/configdialog.cpp | 125 |
1 files changed, 29 insertions, 96 deletions
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 @@ -41,14 +41,13 @@ #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 ); @@ -58,10 +57,7 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, QFrame *main; - if (!mResource->isSyncable()) - main = plainPage(); - else - main = addPage("Profile"); + main = plainPage(); QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); @@ -70,18 +66,17 @@ 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 ); + 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() ); @@ -99,6 +94,8 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 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 ); @@ -107,59 +104,6 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, } - 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 &))); @@ -175,14 +119,6 @@ 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) @@ -192,39 +128,44 @@ 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 @@ -232,14 +173,6 @@ void ConfigDialog::accept() 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(); } |