summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/configdialog.cpp
Unidiff
Diffstat (limited to 'microkde/kresources/configdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/configdialog.cpp105
1 files changed, 19 insertions, 86 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
@@ -42,5 +42,4 @@
42#include "configwidget.h" 42#include "configwidget.h"
43#include "configdialog.h" 43#include "configdialog.h"
44#include "syncwidget.h"
45 44
46using namespace KRES; 45using namespace KRES;
@@ -48,6 +47,6 @@ using namespace KRES;
48ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 47ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
49 Resource* resource, const char *name ) 48 Resource* resource, const char *name )
50 : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ), 49 : KDialogBase( parent, name, true, i18n( "Resource Configuration" ),
51 Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false) 50 Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false)
52{ 51{
53 52
@@ -59,8 +58,5 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
59 QFrame *main; 58 QFrame *main;
60 59
61 if (!mResource->isSyncable())
62 main = plainPage(); 60 main = plainPage();
63 else
64 main = addPage("Profile");
65 61
66 QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); 62 QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() );
@@ -71,16 +67,15 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
71 generalGroupBox->setTitle( i18n( "General Settings" ) ); 67 generalGroupBox->setTitle( i18n( "General Settings" ) );
72 68
73 new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox ); 69 new QLabel( i18n( "Name:" ), generalGroupBox );
74 70
75 mName = new KLineEdit( generalGroupBox ); 71 mName = new KLineEdit( generalGroupBox );
76 72
77 if (!mResource->isSyncable()) {
78 new QLabel("", generalGroupBox ); 73 new QLabel("", generalGroupBox );
79 mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); 74 mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
80 mReadOnly->setChecked( mResource->readOnly() ); 75 mReadOnly->setChecked( mResource->readOnly() );
76
81 new QLabel("", generalGroupBox ); 77 new QLabel("", generalGroupBox );
82 mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); 78 mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox );
83 mIncludeInSync->setChecked( mResource->includeInSync() ); 79 mIncludeInSync->setChecked( mResource->includeInSync() );
84 }
85 80
86 mName->setText( mResource->resourceName() ); 81 mName->setText( mResource->resourceName() );
@@ -100,4 +95,6 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
100 connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), 95 connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ),
101 SLOT( setReadOnly( bool ) ) ); 96 SLOT( setReadOnly( bool ) ) );
97 connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ),
98 SLOT( setIncludeInSync( bool ) ) );
102 connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), 99 connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ),
103 SLOT( setPersistentReadOnly( bool ) ) ); 100 SLOT( setPersistentReadOnly( bool ) ) );
@@ -108,57 +105,4 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
108 } 105 }
109 106
110 if (mResource->isSyncable())
111 {
112 SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() );
113
114 QFrame* syncPage = addPage("Settings");
115 QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
116 mSyncWidget_Settings = c->generateSettingsTab(syncPage);
117 syncLayout->addWidget( mSyncWidget_Settings );
118
119 syncPage = addPage("Conflicts");
120 syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
121 mSyncWidget_Conflicts = c->generateConflictsTab(syncPage);
122 syncLayout->addWidget( mSyncWidget_Conflicts );
123
124 syncPage = addPage("Remote");
125 syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
126 mSyncWidget_Remote = c->generateRemoteTab(syncPage);
127 syncLayout->addWidget( mSyncWidget_Remote );
128
129
130 mSyncWidget_Settings->setInEditMode( false );
131 mSyncWidget_Settings->loadSettings( mResource );
132 mSyncWidget_Settings->show();
133
134 mSyncWidget_Conflicts->setInEditMode( false );
135 mSyncWidget_Conflicts->loadSettings( mResource );
136 mSyncWidget_Conflicts->show();
137
138 mSyncWidget_Remote->setInEditMode( false );
139 mSyncWidget_Remote->loadSettings( mResource );
140 mSyncWidget_Remote->show();
141
142 delete c;
143
144// QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, syncPage );
145// syncGroupBox->layout()->setSpacing( spacingHint());
146// syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) );
147// syncLayout->addWidget( syncGroupBox );
148
149// syncLayout->addStretch();
150/*US
151 mSyncWidget = factory->syncWidget( resource->type(), syncPage );
152 syncLayout->addWidget( mSyncWidget );
153 if ( mSyncWidget ) {
154 mSyncWidget->setInEditMode( false );
155 mSyncWidget->loadSettings( mResource );
156 mSyncWidget->show();
157 }
158 */
159 }
160
161
162
163 107
164 connect( mName, SIGNAL( textChanged(const QString &)), 108 connect( mName, SIGNAL( textChanged(const QString &)),
@@ -176,12 +120,4 @@ void ConfigDialog::setInEditMode( bool value )
176 if ( mConfigWidget ) 120 if ( mConfigWidget )
177 mConfigWidget->setInEditMode( value ); 121 mConfigWidget->setInEditMode( value );
178
179 if ( mSyncWidget_Settings )
180 mSyncWidget_Settings->setInEditMode( value );
181 if ( mSyncWidget_Conflicts )
182 mSyncWidget_Conflicts->setInEditMode( value );
183 if ( mSyncWidget_Remote )
184 mSyncWidget_Remote->setInEditMode( value );
185
186} 122}
187 123
@@ -193,6 +129,4 @@ void ConfigDialog::slotNameChanged( const QString &text)
193void ConfigDialog::setReadOnly( bool value ) 129void ConfigDialog::setReadOnly( bool value )
194{ 130{
195 if (!mResource->isSyncable()) {
196
197 if (mPersistentReadOnly == false) 131 if (mPersistentReadOnly == false)
198 mReadOnly->setChecked( value ); 132 mReadOnly->setChecked( value );
@@ -200,28 +134,35 @@ void ConfigDialog::setReadOnly( bool value )
200 mReadOnly->setChecked( true ); 134 mReadOnly->setChecked( true );
201 } 135 }
136
137void ConfigDialog::setIncludeInSync( bool value )
138{
139 if (mPersistentReadOnly == false)
140 mIncludeInSync->setChecked( value );
141 else
142 mIncludeInSync->setChecked( true );
202} 143}
203 144
204void ConfigDialog::setPersistentReadOnly( bool value ) 145void ConfigDialog::setPersistentReadOnly( bool value )
205{ 146{
206 if (!mResource->isSyncable()) {
207
208 mPersistentReadOnly = value; 147 mPersistentReadOnly = value;
209 148
210 if (value == true) 149 if (value == true) {
211 setReadOnly( true ); 150 setReadOnly( true );
151 setIncludeInSync( true );
152 }
212 153
213 mReadOnly->setEnabled( !value ); 154 mReadOnly->setEnabled( !value );
155 mIncludeInSync->setEnabled (!value );
214 } 156 }
215} 157
216 158
217void ConfigDialog::accept() 159void ConfigDialog::accept()
218{ 160{
219 if ( mName->text().isEmpty() ) { 161 if ( mName->text().isEmpty() ) {
220 KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) ); 162 KMessageBox::sorry( this, i18n( "Please enter a resource name" ) );
221 return; 163 return;
222 } 164 }
223 165
224 mResource->setResourceName( mName->text() ); 166 mResource->setResourceName( mName->text() );
225 if (!mResource->isSyncable())
226 mResource->setReadOnly( mReadOnly->isChecked() ); 167 mResource->setReadOnly( mReadOnly->isChecked() );
227 mResource->setIncludeInSync( mIncludeInSync->isChecked() ); 168 mResource->setIncludeInSync( mIncludeInSync->isChecked() );
@@ -233,12 +174,4 @@ void ConfigDialog::accept()
233 } 174 }
234 175
235 if ( mSyncWidget_Settings )
236 mSyncWidget_Settings->saveSettings( mResource );
237 if ( mSyncWidget_Conflicts )
238 mSyncWidget_Conflicts->saveSettings( mResource );
239 if ( mSyncWidget_Remote )
240 mSyncWidget_Remote->saveSettings( mResource );
241
242
243 KDialog::accept(); 176 KDialog::accept();
244} 177}