Diffstat (limited to 'microkde/kresources/configdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/configdialog.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index 48d9137..0fc199c 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp | |||
@@ -42,13 +42,13 @@ | |||
42 | 42 | ||
43 | using namespace KRES; | 43 | using namespace KRES; |
44 | 44 | ||
45 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | 45 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, |
46 | /*const QString& type,*/ Resource* resource, /*KConfig *config, */const char *name ) | 46 | /*const QString& type,*/ Resource* resource, /*KConfig *config, */const char *name ) |
47 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), | 47 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), |
48 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ) | 48 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) |
49 | { | 49 | { |
50 | Factory *factory = Factory::self( resourceFamily ); | 50 | Factory *factory = Factory::self( resourceFamily ); |
51 | 51 | ||
52 | //US resize( 250, 240 ); | 52 | //US resize( 250, 240 ); |
53 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); | 53 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); |
54 | 54 | ||
@@ -79,17 +79,20 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
79 | mainLayout->addWidget( resourceGroupBox ); | 79 | mainLayout->addWidget( resourceGroupBox ); |
80 | 80 | ||
81 | mainLayout->addStretch(); | 81 | mainLayout->addStretch(); |
82 | 82 | ||
83 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); | 83 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); |
84 | if ( mConfigWidget ) { | 84 | if ( mConfigWidget ) { |
85 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), | ||
86 | SLOT( setReadOnly( bool ) ) ); | ||
87 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), | ||
88 | SLOT( setPersistentReadOnly( bool ) ) ); | ||
85 | mConfigWidget->setInEditMode( false ); | 89 | mConfigWidget->setInEditMode( false ); |
86 | mConfigWidget->loadSettings( mResource ); | 90 | mConfigWidget->loadSettings( mResource ); |
87 | mConfigWidget->show(); | 91 | mConfigWidget->show(); |
88 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), | 92 | |
89 | SLOT( setReadOnly( bool ) ) ); | ||
90 | } | 93 | } |
91 | 94 | ||
92 | connect( mName, SIGNAL( textChanged(const QString &)), | 95 | connect( mName, SIGNAL( textChanged(const QString &)), |
93 | SLOT( slotNameChanged(const QString &))); | 96 | SLOT( slotNameChanged(const QString &))); |
94 | 97 | ||
95 | slotNameChanged( mName->text() ); | 98 | slotNameChanged( mName->text() ); |
@@ -109,13 +112,27 @@ void ConfigDialog::slotNameChanged( const QString &text) | |||
109 | { | 112 | { |
110 | enableButtonOK( !text.isEmpty() ); | 113 | enableButtonOK( !text.isEmpty() ); |
111 | } | 114 | } |
112 | 115 | ||
113 | void ConfigDialog::setReadOnly( bool value ) | 116 | void ConfigDialog::setReadOnly( bool value ) |
114 | { | 117 | { |
115 | mReadOnly->setChecked( value ); | 118 | if (mPersistentReadOnly == false) |
119 | mReadOnly->setChecked( value ); | ||
120 | else | ||
121 | mReadOnly->setChecked( true ); | ||
122 | } | ||
123 | |||
124 | void ConfigDialog::setPersistentReadOnly( bool value ) | ||
125 | { | ||
126 | mPersistentReadOnly = value; | ||
127 | |||
128 | if (value == true) | ||
129 | setReadOnly( true ); | ||
130 | |||
131 | mReadOnly->setEnabled( !value ); | ||
132 | |||
116 | } | 133 | } |
117 | 134 | ||
118 | void ConfigDialog::accept() | 135 | void ConfigDialog::accept() |
119 | { | 136 | { |
120 | if ( mName->text().isEmpty() ) { | 137 | if ( mName->text().isEmpty() ) { |
121 | KMessageBox::sorry( this, i18n( "Please enter a resource name" ) ); | 138 | KMessageBox::sorry( this, i18n( "Please enter a resource name" ) ); |