summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/configdialog.cpp
Unidiff
Diffstat (limited to 'microkde/kresources/configdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/configdialog.cpp78
1 files changed, 62 insertions, 16 deletions
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp
index 90febca..f8240f9 100644
--- a/microkde/kresources/configdialog.cpp
+++ b/microkde/kresources/configdialog.cpp
@@ -29,8 +29,10 @@
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qvbox.h>
32 33
33#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qscrollview.h>
34 36
35#include <kbuttonbox.h> 37#include <kbuttonbox.h>
36#include <kdialog.h> 38#include <kdialog.h>
@@ -46,7 +48,7 @@ using namespace KRES;
46ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 48ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
47 Resource* resource, const char *name ) 49 Resource* resource, const char *name )
48 : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ), 50 : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ),
49 Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget(0), mResource( resource ), mPersistentReadOnly(false) 51 Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false)
50{ 52{
51 53
52 Factory *factory = Factory::self( resourceFamily ); 54 Factory *factory = Factory::self( resourceFamily );
@@ -54,11 +56,16 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
54//US resize( 250, 240 ); 56//US resize( 250, 240 );
55 resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); 57 resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240));
56 58
57//US QFrame *main = makeMainWidget(); 59 QFrame *main;
58 QFrame *main = plainPage(); 60
61 if (!mResource->isSyncable())
62 main = plainPage();
63 else
64 main = addPage("Profile");
59 65
60 QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); 66 QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() );
61 67
68
62 QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); 69 QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
63 generalGroupBox->layout()->setSpacing( spacingHint() ); 70 generalGroupBox->layout()->setSpacing( spacingHint() );
64 generalGroupBox->setTitle( i18n( "General Settings" ) ); 71 generalGroupBox->setTitle( i18n( "General Settings" ) );
@@ -98,19 +105,53 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
98 105
99 if (mResource->isSyncable()) 106 if (mResource->isSyncable())
100 { 107 {
101 QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); 108 SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() );
102 syncGroupBox->layout()->setSpacing( spacingHint()); 109
103 syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) ); 110 QFrame* syncPage = addPage("Settings");
104 mainLayout->addWidget( syncGroupBox ); 111 QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
112 mSyncWidget_Settings = c->generateSettingsTab(syncPage);
113 syncLayout->addWidget( mSyncWidget_Settings );
114
115 syncPage = addPage("Conflicts");
116 syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
117 mSyncWidget_Conflicts = c->generateConflictsTab(syncPage);
118 syncLayout->addWidget( mSyncWidget_Conflicts );
119
120 syncPage = addPage("Remote");
121 syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
122 mSyncWidget_Remote = c->generateRemoteTab(syncPage);
123 syncLayout->addWidget( mSyncWidget_Remote );
124
105 125
106 mainLayout->addStretch(); 126 mSyncWidget_Settings->setInEditMode( false );
127 mSyncWidget_Settings->loadSettings( mResource );
128 mSyncWidget_Settings->show();
107 129
108 mSyncWidget = factory->syncWidget( resource->type(), syncGroupBox ); 130 mSyncWidget_Conflicts->setInEditMode( false );
131 mSyncWidget_Conflicts->loadSettings( mResource );
132 mSyncWidget_Conflicts->show();
133
134 mSyncWidget_Remote->setInEditMode( false );
135 mSyncWidget_Remote->loadSettings( mResource );
136 mSyncWidget_Remote->show();
137
138 delete c;
139
140// QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, syncPage );
141// syncGroupBox->layout()->setSpacing( spacingHint());
142// syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) );
143// syncLayout->addWidget( syncGroupBox );
144
145// syncLayout->addStretch();
146/*US
147 mSyncWidget = factory->syncWidget( resource->type(), syncPage );
148 syncLayout->addWidget( mSyncWidget );
109 if ( mSyncWidget ) { 149 if ( mSyncWidget ) {
110 mSyncWidget->setInEditMode( false ); 150 mSyncWidget->setInEditMode( false );
111 mSyncWidget->loadSettings( mResource ); 151 mSyncWidget->loadSettings( mResource );
112 mSyncWidget->show(); 152 mSyncWidget->show();
113 } 153 }
154 */
114 } 155 }
115 156
116 157
@@ -131,8 +172,12 @@ void ConfigDialog::setInEditMode( bool value )
131 if ( mConfigWidget ) 172 if ( mConfigWidget )
132 mConfigWidget->setInEditMode( value ); 173 mConfigWidget->setInEditMode( value );
133 174
134 if ( mSyncWidget ) 175 if ( mSyncWidget_Settings )
135 mSyncWidget->setInEditMode( value ); 176 mSyncWidget_Settings->setInEditMode( value );
177 if ( mSyncWidget_Conflicts )
178 mSyncWidget_Conflicts->setInEditMode( value );
179 if ( mSyncWidget_Remote )
180 mSyncWidget_Remote->setInEditMode( value );
136 181
137} 182}
138 183
@@ -182,11 +227,12 @@ void ConfigDialog::accept()
182 mConfigWidget->saveSettings( mResource ); 227 mConfigWidget->saveSettings( mResource );
183 } 228 }
184 229
185 if ( mSyncWidget ) { 230 if ( mSyncWidget_Settings )
186 // First save generic information 231 mSyncWidget_Settings->saveSettings( mResource );
187 // Also save setting of specific resource type 232 if ( mSyncWidget_Conflicts )
188 mSyncWidget->saveSettings( mResource ); 233 mSyncWidget_Conflicts->saveSettings( mResource );
189 } 234 if ( mSyncWidget_Remote )
235 mSyncWidget_Remote->saveSettings( mResource );
190 236
191 237
192 KDialog::accept(); 238 KDialog::accept();