author | ulf69 <ulf69> | 2004-08-04 22:45:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-04 22:45:22 (UTC) |
commit | c3a704f5acda9cf9fee66e5c0b1b864f3b7dd852 (patch) (unidiff) | |
tree | dc59744a6d59ba241e793ce051da485d0bf16d06 /microkde | |
parent | b83866e08ddcc5cb2734801977927f48b53a2e1c (diff) | |
download | kdepimpi-c3a704f5acda9cf9fee66e5c0b1b864f3b7dd852.zip kdepimpi-c3a704f5acda9cf9fee66e5c0b1b864f3b7dd852.tar.gz kdepimpi-c3a704f5acda9cf9fee66e5c0b1b864f3b7dd852.tar.bz2 |
final changes for addressbook sync config dialog
-rw-r--r-- | microkde/kresources/configdialog.cpp | 78 | ||||
-rw-r--r-- | microkde/kresources/configdialog.h | 4 | ||||
-rw-r--r-- | microkde/kresources/configpage.cpp | 15 | ||||
-rw-r--r-- | microkde/kresources/factory.cpp | 4 | ||||
-rw-r--r-- | microkde/kresources/factory.h | 5 | ||||
-rw-r--r-- | microkde/kresources/resource.h | 8 | ||||
-rw-r--r-- | microkde/kresources/syncwidget.h | 10 |
7 files changed, 97 insertions, 27 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 | |||
@@ -31,4 +31,6 @@ | |||
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 | ||
@@ -48,3 +50,3 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
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 | { |
@@ -56,4 +58,8 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
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 | ||
@@ -61,2 +67,3 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
61 | 67 | ||
68 | |||
62 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 69 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); |
@@ -100,10 +107,43 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
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 ) { |
@@ -113,2 +153,3 @@ ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | |||
113 | } | 153 | } |
154 | */ | ||
114 | } | 155 | } |
@@ -133,4 +174,8 @@ void ConfigDialog::setInEditMode( bool 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 | ||
@@ -184,7 +229,8 @@ void ConfigDialog::accept() | |||
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 | ||
diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h index b629347..63cd4e9 100644 --- a/microkde/kresources/configdialog.h +++ b/microkde/kresources/configdialog.h | |||
@@ -53,3 +53,5 @@ class ConfigDialog : public KDialogBase | |||
53 | ConfigWidget *mConfigWidget; | 53 | ConfigWidget *mConfigWidget; |
54 | SyncWidget *mSyncWidget; | 54 | SyncWidget *mSyncWidget_Settings; |
55 | SyncWidget *mSyncWidget_Conflicts; | ||
56 | SyncWidget *mSyncWidget_Remote; | ||
55 | Resource* mResource; | 57 | Resource* mResource; |
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index 2fe021d..1a3a22c 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp | |||
@@ -207,2 +207,4 @@ void ConfigPage::load() | |||
207 | info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); | 207 | info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); |
208 | } else if ( family == syncfamily && QFile::exists( configDir + "/kabcsyncrc" ) ) { | ||
209 | info.mConfig = new KConfig( locateLocal( "config", "kabcsyncrc" ) ); | ||
208 | } else { | 210 | } else { |
@@ -313,3 +315,3 @@ void ConfigPage::slotAdd() | |||
313 | desc = QInputDialog::getItem( i18n( "Sync Configuration" ), | 315 | desc = QInputDialog::getItem( i18n( "Sync Configuration" ), |
314 | i18n( "Please select resource type for new sync profile:" ), descs, 0, | 316 | i18n( "Select resource type for the new sync profile:" ), descs, 0, |
315 | false, &ok, this ); | 317 | false, &ok, this ); |
@@ -319,3 +321,3 @@ void ConfigPage::slotAdd() | |||
319 | desc = QInputDialog::getItem( i18n( "Resource Configuration" ), | 321 | desc = QInputDialog::getItem( i18n( "Resource Configuration" ), |
320 | i18n( "Please select type of the new resource:" ), descs, 0, | 322 | i18n( "Select type of the new resource:" ), descs, 0, |
321 | false, &ok, this ); | 323 | false, &ok, this ); |
@@ -336,3 +338,10 @@ void ConfigPage::slotAdd() | |||
336 | 338 | ||
337 | resource->setResourceName( type + "-resource" ); | 339 | if (mFamily == syncfamily) |
340 | { | ||
341 | resource->setResourceName( type + "-syncprofile" ); | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | resource->setResourceName( type + "-resource" ); | ||
346 | } | ||
338 | 347 | ||
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 7a5c2f6..e44fce3 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -189,3 +189,3 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | |||
189 | 189 | ||
190 | SyncWidget *Factory::syncWidget( const QString& type, QWidget *parent ) | 190 | SyncWidgetContainer *Factory::syncWidgetContainer( const QString& type ) |
191 | { | 191 | { |
@@ -212,3 +212,3 @@ SyncWidget *Factory::syncWidget( const QString& type, QWidget *parent ) | |||
212 | 212 | ||
213 | SyncWidget *wdg = pluginFactory->syncWidget( parent ); | 213 | SyncWidgetContainer *wdg = pluginFactory->syncWidgetContainer( ); |
214 | if ( !wdg ) { | 214 | if ( !wdg ) { |
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h index a265bc8..0e4231b 100644 --- a/microkde/kresources/factory.h +++ b/microkde/kresources/factory.h | |||
@@ -36,2 +36,5 @@ namespace KRES { | |||
36 | 36 | ||
37 | class SyncWidgetContainer; | ||
38 | class ConfigWidget; | ||
39 | |||
37 | //US | 40 | //US |
@@ -94,3 +97,3 @@ class Factory | |||
94 | */ | 97 | */ |
95 | SyncWidget *syncWidget( const QString& type, QWidget *parent = 0 ); | 98 | SyncWidgetContainer *syncWidgetContainer( const QString& type ); |
96 | 99 | ||
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index c9202c9..580b5d1 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h | |||
@@ -42,3 +42,3 @@ namespace KRES { | |||
42 | class ConfigWidget; | 42 | class ConfigWidget; |
43 | class SyncWidget; | 43 | class SyncWidgetContainer; |
44 | 44 | ||
@@ -380,3 +380,3 @@ class PluginFactoryBase : public KLibFactory | |||
380 | 380 | ||
381 | virtual SyncWidget *syncWidget( QWidget *parent ) = 0; | 381 | virtual SyncWidgetContainer *syncWidgetContainer() = 0; |
382 | 382 | ||
@@ -404,5 +404,5 @@ class PluginFactory : public PluginFactoryBase | |||
404 | 404 | ||
405 | virtual SyncWidget *syncWidget( QWidget *parent ) | 405 | SyncWidgetContainer *syncWidgetContainer() |
406 | { | 406 | { |
407 | return new TS( parent ); | 407 | return new TS(); |
408 | } | 408 | } |
diff --git a/microkde/kresources/syncwidget.h b/microkde/kresources/syncwidget.h index e94252c..6632b69 100644 --- a/microkde/kresources/syncwidget.h +++ b/microkde/kresources/syncwidget.h | |||
@@ -60,2 +60,12 @@ protected: | |||
60 | 60 | ||
61 | class SyncWidgetContainer : public QObject | ||
62 | { | ||
63 | Q_OBJECT | ||
64 | |||
65 | public: | ||
66 | virtual SyncWidget* generateSettingsTab(QWidget *parent = 0, const char *name = 0) = 0; | ||
67 | virtual SyncWidget* generateConflictsTab(QWidget *parent = 0, const char *name = 0) = 0; | ||
68 | virtual SyncWidget* generateRemoteTab(QWidget *parent = 0, const char *name = 0) = 0; | ||
69 | }; | ||
70 | |||
61 | } | 71 | } |