summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-02 18:15:04 (UTC)
committer ulf69 <ulf69>2004-08-02 18:15:04 (UTC)
commite084a79b8aa0174e7587893f9b87d88670ed9f2c (patch) (unidiff)
treed3250447b9352effc8fb953866c772418c5e166c
parentb4203356adb6008a4b4e6782afdae7dd34178697 (diff)
downloadkdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.zip
kdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.tar.gz
kdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.tar.bz2
added support for the syncing of resources
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/configdialog.cpp55
-rw-r--r--microkde/kresources/configdialog.h2
-rw-r--r--microkde/kresources/configpage.cpp43
-rw-r--r--microkde/kresources/configpage.h1
-rw-r--r--microkde/kresources/factory.cpp38
-rw-r--r--microkde/kresources/factory.h14
-rw-r--r--microkde/microkdeE.pro2
7 files changed, 136 insertions, 19 deletions
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp
index 0fc199c..90febca 100644
--- a/microkde/kresources/configdialog.cpp
+++ b/microkde/kresources/configdialog.cpp
@@ -18,137 +18,178 @@
18 You should have received a copy of the GNU Library General Public License 18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to 19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. 21 Boston, MA 02111-1307, USA.
22*/ 22*/
23 23
24#include <klocale.h> 24#include <klocale.h>
25#include <kglobal.h> 25#include <kglobal.h>
26#include <kmessagebox.h> 26#include <kmessagebox.h>
27 27
28#include <qgroupbox.h> 28#include <qgroupbox.h>
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 32
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34 34
35#include <kbuttonbox.h> 35#include <kbuttonbox.h>
36#include <kdialog.h> 36#include <kdialog.h>
37#include <klineedit.h> 37#include <klineedit.h>
38 38
39#include "factory.h" 39#include "factory.h"
40#include "configwidget.h" 40#include "configwidget.h"
41#include "configdialog.h" 41#include "configdialog.h"
42#include "syncwidget.h"
42 43
43using namespace KRES; 44using namespace KRES;
44 45
45ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 46ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
46 /*const QString& type,*/ Resource* resource, /*KConfig *config, */const char *name ) 47 Resource* resource, const char *name )
47 : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), 48 : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ),
48 Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) 49 Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget(0), mResource( resource ), mPersistentReadOnly(false)
49{ 50{
51
50 Factory *factory = Factory::self( resourceFamily ); 52 Factory *factory = Factory::self( resourceFamily );
51 53
52//US resize( 250, 240 ); 54//US resize( 250, 240 );
53 resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); 55 resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240));
54 56
55//US QFrame *main = makeMainWidget(); 57//US QFrame *main = makeMainWidget();
56 QFrame *main = plainPage(); 58 QFrame *main = plainPage();
57 59
58 QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); 60 QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() );
59 61
60 QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); 62 QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
61 generalGroupBox->layout()->setSpacing( spacingHint() ); 63 generalGroupBox->layout()->setSpacing( spacingHint() );
62 generalGroupBox->setTitle( i18n( "General Settings" ) ); 64 generalGroupBox->setTitle( i18n( "General Settings" ) );
63 65
64 new QLabel( i18n( "Name:" ), generalGroupBox ); 66 new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox );
65 67
66 mName = new KLineEdit( generalGroupBox ); 68 mName = new KLineEdit( generalGroupBox );
67 69
70 if (!mResource->isSyncable()) {
68 mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); 71 mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
72 mReadOnly->setChecked( mResource->readOnly() );
73 }
69 74
70 mName->setText( mResource->resourceName() ); 75 mName->setText( mResource->resourceName() );
71 mReadOnly->setChecked( mResource->readOnly() );
72 76
73 mainLayout->addWidget( generalGroupBox ); 77 mainLayout->addWidget( generalGroupBox );
74 78
75 QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); 79 QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
76 resourceGroupBox->layout()->setSpacing( spacingHint()); 80 resourceGroupBox->layout()->setSpacing( spacingHint());
77 resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) 81 resourceGroupBox->setTitle( i18n( "%1 Resource Settings" )
78 .arg( factory->typeName( resource->type() ) ) ); 82 .arg( factory->typeName( resource->type() ) ) );
79 mainLayout->addWidget( resourceGroupBox ); 83 mainLayout->addWidget( resourceGroupBox );
80 84
81 mainLayout->addStretch(); 85 mainLayout->addStretch();
82 86
83 mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); 87 mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox );
84 if ( mConfigWidget ) { 88 if ( mConfigWidget ) {
85 connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), 89 connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ),
86 SLOT( setReadOnly( bool ) ) ); 90 SLOT( setReadOnly( bool ) ) );
87 connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), 91 connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ),
88 SLOT( setPersistentReadOnly( bool ) ) ); 92 SLOT( setPersistentReadOnly( bool ) ) );
89 mConfigWidget->setInEditMode( false ); 93 mConfigWidget->setInEditMode( false );
90 mConfigWidget->loadSettings( mResource ); 94 mConfigWidget->loadSettings( mResource );
91 mConfigWidget->show(); 95 mConfigWidget->show();
92 96
93 } 97 }
94 98
99 if (mResource->isSyncable())
100 {
101 QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
102 syncGroupBox->layout()->setSpacing( spacingHint());
103 syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) );
104 mainLayout->addWidget( syncGroupBox );
105
106 mainLayout->addStretch();
107
108 mSyncWidget = factory->syncWidget( resource->type(), syncGroupBox );
109 if ( mSyncWidget ) {
110 mSyncWidget->setInEditMode( false );
111 mSyncWidget->loadSettings( mResource );
112 mSyncWidget->show();
113 }
114 }
115
116
117
118
95 connect( mName, SIGNAL( textChanged(const QString &)), 119 connect( mName, SIGNAL( textChanged(const QString &)),
96 SLOT( slotNameChanged(const QString &))); 120 SLOT( slotNameChanged(const QString &)));
97 121
98 slotNameChanged( mName->text() ); 122 slotNameChanged( mName->text() );
99 123
100//US setMinimumSize( 400, 250 ); 124//US setMinimumSize( 400, 250 );
101 setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 400), KMIN(KGlobal::getDesktopHeight(), 250)); 125 setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 400), KMIN(KGlobal::getDesktopHeight(), 250));
102 126
103} 127}
104 128
105void ConfigDialog::setInEditMode( bool value ) 129void ConfigDialog::setInEditMode( bool value )
106{ 130{
107 if ( mConfigWidget ) 131 if ( mConfigWidget )
108 mConfigWidget->setInEditMode( value ); 132 mConfigWidget->setInEditMode( value );
133
134 if ( mSyncWidget )
135 mSyncWidget->setInEditMode( value );
136
109} 137}
110 138
111void ConfigDialog::slotNameChanged( const QString &text) 139void ConfigDialog::slotNameChanged( const QString &text)
112{ 140{
113 enableButtonOK( !text.isEmpty() ); 141 enableButtonOK( !text.isEmpty() );
114} 142}
115 143
116void ConfigDialog::setReadOnly( bool value ) 144void ConfigDialog::setReadOnly( bool value )
117{ 145{
146 if (!mResource->isSyncable()) {
147
118 if (mPersistentReadOnly == false) 148 if (mPersistentReadOnly == false)
119 mReadOnly->setChecked( value ); 149 mReadOnly->setChecked( value );
120 else 150 else
121 mReadOnly->setChecked( true ); 151 mReadOnly->setChecked( true );
122} 152}
153}
123 154
124void ConfigDialog::setPersistentReadOnly( bool value ) 155void ConfigDialog::setPersistentReadOnly( bool value )
125{ 156{
157 if (!mResource->isSyncable()) {
158
126 mPersistentReadOnly = value; 159 mPersistentReadOnly = value;
127 160
128 if (value == true) 161 if (value == true)
129 setReadOnly( true ); 162 setReadOnly( true );
130 163
131 mReadOnly->setEnabled( !value ); 164 mReadOnly->setEnabled( !value );
132 165 }
133} 166}
134 167
135void ConfigDialog::accept() 168void ConfigDialog::accept()
136{ 169{
137 if ( mName->text().isEmpty() ) { 170 if ( mName->text().isEmpty() ) {
138 KMessageBox::sorry( this, i18n( "Please enter a resource name" ) ); 171 KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) );
139 return; 172 return;
140 } 173 }
141 174
142 mResource->setResourceName( mName->text() ); 175 mResource->setResourceName( mName->text() );
176 if (!mResource->isSyncable())
143 mResource->setReadOnly( mReadOnly->isChecked() ); 177 mResource->setReadOnly( mReadOnly->isChecked() );
144 178
145 if ( mConfigWidget ) { 179 if ( mConfigWidget ) {
146 // First save generic information 180 // First save generic information
147 // Also save setting of specific resource type 181 // Also save setting of specific resource type
148 mConfigWidget->saveSettings( mResource ); 182 mConfigWidget->saveSettings( mResource );
149 } 183 }
150 184
185 if ( mSyncWidget ) {
186 // First save generic information
187 // Also save setting of specific resource type
188 mSyncWidget->saveSettings( mResource );
189 }
190
191
151 KDialog::accept(); 192 KDialog::accept();
152} 193}
153 194
154//US #include "configdialog.moc" 195//US #include "configdialog.moc"
diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h
index ba66f8e..b629347 100644
--- a/microkde/kresources/configdialog.h
+++ b/microkde/kresources/configdialog.h
@@ -10,54 +10,56 @@
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#ifndef KRESOURCES_CONFIGDIALOG_H 22#ifndef KRESOURCES_CONFIGDIALOG_H
23#define KRESOURCES_CONFIGDIALOG_H 23#define KRESOURCES_CONFIGDIALOG_H
24 24
25#include <kdialogbase.h> 25#include <kdialogbase.h>
26 26
27class KLineEdit; 27class KLineEdit;
28class QCheckBox; 28class QCheckBox;
29class KButtonBox; 29class KButtonBox;
30 30
31namespace KRES { 31namespace KRES {
32 class Resource; 32 class Resource;
33 class ConfigWidget; 33 class ConfigWidget;
34 class SyncWidget;
34 35
35class ConfigDialog : public KDialogBase 36class ConfigDialog : public KDialogBase
36{ 37{
37 Q_OBJECT 38 Q_OBJECT
38 public: 39 public:
39 // Resource=0: create new resource 40 // Resource=0: create new resource
40 ConfigDialog( QWidget *parent, const QString& resourceFamily, 41 ConfigDialog( QWidget *parent, const QString& resourceFamily,
41 Resource* resource, const char *name = 0); 42 Resource* resource, const char *name = 0);
42 43
43 void setInEditMode( bool value ); 44 void setInEditMode( bool value );
44 45
45 protected slots: 46 protected slots:
46 void accept(); 47 void accept();
47 void setReadOnly( bool value ); 48 void setReadOnly( bool value );
48 void setPersistentReadOnly( bool value ); 49 void setPersistentReadOnly( bool value );
49 void slotNameChanged( const QString &text); 50 void slotNameChanged( const QString &text);
50 51
51 private: 52 private:
52 ConfigWidget *mConfigWidget; 53 ConfigWidget *mConfigWidget;
54 SyncWidget *mSyncWidget;
53 Resource* mResource; 55 Resource* mResource;
54 56
55 KLineEdit *mName; 57 KLineEdit *mName;
56 QCheckBox *mReadOnly; 58 QCheckBox *mReadOnly;
57//US add a persistent readonly flag. We need that for opie and qtopia addressbooks. 59//US add a persistent readonly flag. We need that for opie and qtopia addressbooks.
58 bool mPersistentReadOnly; 60 bool mPersistentReadOnly;
59}; 61};
60 62
61} 63}
62 64
63#endif 65#endif
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index 8782ffd..912c62e 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -1,76 +1,86 @@
1/* 1/*
2 This file is part of libkresources. 2 This file is part of libkresources.
3 3
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details. 16 Library General Public License for more details.
17 17
18 You should have received a copy of the GNU Library General Public License 18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to 19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. 21 Boston, MA 02111-1307, USA.
22*/ 22*/
23 23
24/*
25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk
27
28$Id$
29*/
30
24#include <qgroupbox.h> 31#include <qgroupbox.h>
25#include <qinputdialog.h> 32#include <qinputdialog.h>
26#include <qlabel.h> 33#include <qlabel.h>
27#include <qlayout.h> 34#include <qlayout.h>
28 35
29#include <kapplication.h> 36#include <kapplication.h>
30#include <kcombobox.h> 37#include <kcombobox.h>
31#include <kdebug.h> 38#include <kdebug.h>
32#include <klocale.h> 39#include <klocale.h>
33#include <kmessagebox.h> 40#include <kmessagebox.h>
34#include <ksimpleconfig.h> 41#include <ksimpleconfig.h>
35#include <kstandarddirs.h> 42#include <kstandarddirs.h>
36#include <kurlrequester.h> 43#include <kurlrequester.h>
37#include <klistview.h> 44#include <klistview.h>
38#include <kbuttonbox.h> 45#include <kbuttonbox.h>
39//US #include <ktrader.h> 46//US #include <ktrader.h>
40 47
41#include "resource.h" 48#include "resource.h"
42#include "configdialog.h" 49#include "configdialog.h"
43 50
44#include "configpage.h" 51#include "configpage.h"
45 52
46//US 53//US
47#include <qpushbutton.h> 54#include <qpushbutton.h>
48#include <qfile.h> 55#include <qfile.h>
49#include <kglobal.h> 56#include <kglobal.h>
50 57
51using namespace KRES; 58using namespace KRES;
52 59
60const QString ConfigPage::syncfamily = "syncprofiles";
61
62
53class ConfigViewItem : public QCheckListItem 63class ConfigViewItem : public QCheckListItem
54{ 64{
55 public: 65 public:
56 ConfigViewItem( QListView *parent, Resource* resource ) : 66 ConfigViewItem( QListView *parent, Resource* resource ) :
57 QCheckListItem( parent, resource->resourceName(), CheckBox ), 67 QCheckListItem( parent, resource->resourceName(), CheckBox ),
58 mResource( resource ), 68 mResource( resource ),
59 mIsStandard( false ) 69 mIsStandard( false )
60 { 70 {
61 setText( 1, mResource->type() ); 71 setText( 1, mResource->type() );
62 setOn( mResource->isActive() ); 72 setOn( mResource->isActive() );
63 } 73 }
64 74
65 void setStandard( bool value ) 75 void setStandard( bool value )
66 { 76 {
67 setText( 2, ( value ? i18n( "Yes" ) : QString::null ) ); 77 setText( 2, ( value ? i18n( "Yes" ) : QString::null ) );
68 mIsStandard = value; 78 mIsStandard = value;
69 } 79 }
70 80
71 bool standard() const { return mIsStandard; } 81 bool standard() const { return mIsStandard; }
72 bool readOnly() const { return mResource->readOnly(); } 82 bool readOnly() const { return mResource->readOnly(); }
73 83
74 Resource *resource() { return mResource; } 84 Resource *resource() { return mResource; }
75 85
76 private: 86 private:
@@ -143,55 +153,57 @@ ConfigPage::~ConfigPage()
143 (*it).mManager->removeListener( this ); 153 (*it).mManager->removeListener( this );
144 delete (*it).mManager; 154 delete (*it).mManager;
145 delete (*it).mConfig; 155 delete (*it).mConfig;
146 } 156 }
147 157
148 mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() ); 158 mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() );
149 delete mConfig; 159 delete mConfig;
150 mConfig = 0; 160 mConfig = 0;
151} 161}
152 162
153void ConfigPage::load() 163void ConfigPage::load()
154{ 164{
155 kdDebug(5650) << "ConfigPage::load()" << endl; 165 kdDebug(5650) << "ConfigPage::load()" << endl;
156 166
157 mListView->clear(); 167 mListView->clear();
158 168
159//US we remove the dynamic pluginloader, and set the one family we need (contact) manually. 169//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
160 170
161//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" ); 171//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
162//US KTrader::OfferList::ConstIterator it; 172//US KTrader::OfferList::ConstIterator it;
163//US for ( it = plugins.begin(); it != plugins.end(); ++it ) { 173//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
164//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); 174//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
165//US QString family = tmp.toString(); 175//US QString family = tmp.toString();
166 QStringList families; 176 QStringList families;
167 families << "contact" << "sync-contacts"; 177 families << "contact" << syncfamily;
178
179
168 for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) 180 for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
169 { 181 {
170 QString family = (*it); 182 QString family = (*it);
171 if ( !family.isEmpty() ) { 183 if ( !family.isEmpty() ) {
172 if ( !mFamilyMap.contains( family ) ) { 184 if ( !mFamilyMap.contains( family ) ) {
173 mCurrentManager = new Manager<Resource>( family ); 185 mCurrentManager = new Manager<Resource>( family, (family == syncfamily) );
174 if ( mCurrentManager ) { 186 if ( mCurrentManager ) {
175 mFamilyMap.append( family ); 187 mFamilyMap.append( family );
176 mCurrentManager->addListener( this ); 188 mCurrentManager->addListener( this );
177 189
178 ResourcePageInfo info; 190 ResourcePageInfo info;
179 info.mManager = mCurrentManager; 191 info.mManager = mCurrentManager;
180 QString configDir = KGlobal::dirs()->saveLocation( "config" ); 192 QString configDir = KGlobal::dirs()->saveLocation( "config" );
181 //QString configDir = KStandardDirs::appDir() + "/config"; 193 //QString configDir = KStandardDirs::appDir() + "/config";
182 if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) { 194 if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) {
183 info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) ); 195 info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) );
184 } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) { 196 } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) {
185 info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); 197 info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) );
186 } else { 198 } else {
187 QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); 199 QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
188 info.mConfig = new KConfig( configFile ); 200 info.mConfig = new KConfig( configFile );
189 } 201 }
190 info.mManager->readConfig( info.mConfig ); 202 info.mManager->readConfig( info.mConfig );
191 203
192 mInfoMap.append( info ); 204 mInfoMap.append( info );
193 } 205 }
194 } 206 }
195 } 207 }
196 } 208 }
197 mCurrentManager = 0; 209 mCurrentManager = 0;
@@ -244,69 +256,82 @@ void ConfigPage::slotFamilyChanged( int pos )
244 } 256 }
245 257
246 Resource *standardResource = mCurrentManager->standardResource(); 258 Resource *standardResource = mCurrentManager->standardResource();
247 259
248//US qDebug("ConfigPage::slotFamilyChanged 4.4 resourcename=%s", standardResource->resourceName().latin1()); 260//US qDebug("ConfigPage::slotFamilyChanged 4.4 resourcename=%s", standardResource->resourceName().latin1());
249 261
250 262
251 Manager<Resource>::Iterator it; 263 Manager<Resource>::Iterator it;
252 for ( it = mCurrentManager->begin(); it != mCurrentManager->end(); ++it ) { 264 for ( it = mCurrentManager->begin(); it != mCurrentManager->end(); ++it ) {
253 ConfigViewItem *item = new ConfigViewItem( mListView, *it ); 265 ConfigViewItem *item = new ConfigViewItem( mListView, *it );
254 if ( *it == standardResource ) 266 if ( *it == standardResource )
255 item->setStandard( true ); 267 item->setStandard( true );
256 } 268 }
257 269
258 if ( mListView->childCount() == 0 ) { 270 if ( mListView->childCount() == 0 ) {
259//US qDebug("ConfigPage::slotFamilyChanged 4.5 "); 271//US qDebug("ConfigPage::slotFamilyChanged 4.5 ");
260 272
261 defaults(); 273 defaults();
262 emit changed( true ); 274 emit changed( true );
263 mCurrentManager->writeConfig( mCurrentConfig ); 275 mCurrentManager->writeConfig( mCurrentConfig );
264 } else { 276 } else {
265//US qDebug("ConfigPage::slotFamilyChanged 4.6 "); 277//US qDebug("ConfigPage::slotFamilyChanged 4.6 ");
266 278
267 if ( !standardResource ) { 279 if ( !standardResource ) {
268 KMessageBox::sorry( this, i18n( "There is no standard resource! Please select one." ) ); 280 KMessageBox::sorry( this, i18n( "There is no standard resource!<br> Please select one." ) );
269 281
270//US qDebug("ConfigPage::slotFamilyChanged 4.7" ); 282//US qDebug("ConfigPage::slotFamilyChanged 4.7" );
271 283
272 } 284 }
273 285
274 emit changed( false ); 286 emit changed( false );
275 } 287 }
276} 288}
277 289
278void ConfigPage::slotAdd() 290void ConfigPage::slotAdd()
279{ 291{
280 if ( !mCurrentManager ) 292 if ( !mCurrentManager )
281 return; 293 return;
282 294
283 QStringList types = mCurrentManager->resourceTypeNames(); 295 QStringList types = mCurrentManager->resourceTypeNames();
284 QStringList descs = mCurrentManager->resourceTypeDescriptions(); 296 QStringList descs = mCurrentManager->resourceTypeDescriptions();
285 bool ok = false; 297 bool ok = false;
286 QString desc = QInputDialog::getItem( i18n( "Resource Configuration" ), 298
299 QString desc;
300
301 if (mFamily == syncfamily)
302 {
303 desc = QInputDialog::getItem( i18n( "Sync Configuration" ),
304 i18n( "Please select resource type for new sync profile:" ), descs, 0,
305 false, &ok, this );
306 }
307 else
308 {
309 desc = QInputDialog::getItem( i18n( "Resource Configuration" ),
287 i18n( "Please select type of the new resource:" ), descs, 0, 310 i18n( "Please select type of the new resource:" ), descs, 0,
288 false, &ok, this ); 311 false, &ok, this );
312 }
313
289 if ( !ok ) 314 if ( !ok )
290 return; 315 return;
291 316
292 QString type = types[ descs.findIndex( desc ) ]; 317 QString type = types[ descs.findIndex( desc ) ];
293 318
294 // Create new resource 319 // Create new resource
295 Resource *resource = mCurrentManager->createResource( type ); 320 Resource *resource = mCurrentManager->createResource( type );
296 if ( !resource ) { 321 if ( !resource ) {
297 KMessageBox::error( this, i18n("Unable to create resource of type '%1'.") 322 KMessageBox::error( this, i18n("Unable to create resource of type '%1'.")
298 .arg( type ) ); 323 .arg( type ) );
299 return; 324 return;
300 } 325 }
301 326
302 resource->setResourceName( type + "-resource" ); 327 resource->setResourceName( type + "-resource" );
303 328
304 ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); 329 ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
305 330
306 if ( dlg.exec() ) { 331 if ( dlg.exec() ) {
307 mCurrentManager->add( resource ); 332 mCurrentManager->add( resource );
308 333
309 ConfigViewItem *item = new ConfigViewItem( mListView, resource ); 334 ConfigViewItem *item = new ConfigViewItem( mListView, resource );
310 335
311 mLastItem = item; 336 mLastItem = item;
312 337
@@ -359,73 +384,73 @@ void ConfigPage::slotRemove()
359 delete item; 384 delete item;
360 385
361 emit changed( true ); 386 emit changed( true );
362} 387}
363 388
364void ConfigPage::slotEdit() 389void ConfigPage::slotEdit()
365{ 390{
366 if ( !mCurrentManager ) 391 if ( !mCurrentManager )
367 return; 392 return;
368 393
369 QListViewItem *item = mListView->currentItem(); 394 QListViewItem *item = mListView->currentItem();
370 ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); 395 ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
371 if ( !configItem ) 396 if ( !configItem )
372 return; 397 return;
373 398
374 Resource *resource = configItem->resource(); 399 Resource *resource = configItem->resource();
375 400
376 ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); 401 ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
377 402
378 if ( dlg.exec() ) { 403 if ( dlg.exec() ) {
379 configItem->setText( 0, resource->resourceName() ); 404 configItem->setText( 0, resource->resourceName() );
380 configItem->setText( 1, resource->type() ); 405 configItem->setText( 1, resource->type() );
381 406
382 if ( configItem->standard() && configItem->readOnly() ) { 407 if ( configItem->standard() && configItem->readOnly() ) {
383 KMessageBox::sorry( this, i18n( "You cannot use a read-only resource as standard!" ) ); 408 KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) );
384 configItem->setStandard( false ); 409 configItem->setStandard( false );
385 } 410 }
386 411
387 mCurrentManager->resourceChanged( resource ); 412 mCurrentManager->resourceChanged( resource );
388 emit changed( true ); 413 emit changed( true );
389 } 414 }
390} 415}
391 416
392void ConfigPage::slotStandard() 417void ConfigPage::slotStandard()
393{ 418{
394 if ( !mCurrentManager ) 419 if ( !mCurrentManager )
395 return; 420 return;
396 421
397 ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() ); 422 ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() );
398 if ( !item ) 423 if ( !item )
399 return; 424 return;
400 425
401 if ( item->readOnly() ) { 426 if ( item->readOnly() ) {
402 KMessageBox::sorry( this, i18n( "You cannot use a read-only resource as standard!" ) ); 427 KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) );
403 return; 428 return;
404 } 429 }
405 430
406 if ( !item->isOn() ) { 431 if ( !item->isOn() ) {
407 KMessageBox::sorry( this, i18n( "You cannot use an inactive resource as standard!" ) ); 432 KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) );
408 return; 433 return;
409 } 434 }
410 435
411 QListViewItem *it = mListView->firstChild(); 436 QListViewItem *it = mListView->firstChild();
412 while ( it != 0 ) { 437 while ( it != 0 ) {
413 ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it ); 438 ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it );
414 if ( configItem->standard() ) 439 if ( configItem->standard() )
415 configItem->setStandard( false ); 440 configItem->setStandard( false );
416 it = it->itemBelow(); 441 it = it->itemBelow();
417 } 442 }
418 443
419 item->setStandard( true ); 444 item->setStandard( true );
420 mCurrentManager->setStandardResource( item->resource() ); 445 mCurrentManager->setStandardResource( item->resource() );
421 emit changed( true ); 446 emit changed( true );
422 447
423} 448}
424 449
425void ConfigPage::slotSelectionChanged() 450void ConfigPage::slotSelectionChanged()
426{ 451{
427 bool state = ( mListView->currentItem() != 0 ); 452 bool state = ( mListView->currentItem() != 0 );
428 453
429 mRemoveButton->setEnabled( state ); 454 mRemoveButton->setEnabled( state );
430 mEditButton->setEnabled( state ); 455 mEditButton->setEnabled( state );
431 mStandardButton->setEnabled( state ); 456 mStandardButton->setEnabled( state );
@@ -443,68 +468,68 @@ void ConfigPage::resourceAdded( Resource* resource )
443 468
444 mLastItem = item; 469 mLastItem = item;
445 470
446 emit changed( true ); 471 emit changed( true );
447} 472}
448 473
449void ConfigPage::resourceModified( Resource* resource ) 474void ConfigPage::resourceModified( Resource* resource )
450{ 475{
451 qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1()); 476 qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1());
452 kdDebug(5650) << "ConfigPage::resourceModified( " << resource->resourceName() << " )" << endl; 477 kdDebug(5650) << "ConfigPage::resourceModified( " << resource->resourceName() << " )" << endl;
453} 478}
454 479
455void ConfigPage::resourceDeleted( Resource* resource ) 480void ConfigPage::resourceDeleted( Resource* resource )
456{ 481{
457 qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1()); 482 qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1());
458 kdDebug(5650) << "ConfigPage::resourceDeleted( " << resource->resourceName() << " )" << endl; 483 kdDebug(5650) << "ConfigPage::resourceDeleted( " << resource->resourceName() << " )" << endl;
459} 484}
460 485
461void ConfigPage::slotItemClicked( QListViewItem *item ) 486void ConfigPage::slotItemClicked( QListViewItem *item )
462{ 487{
463 ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item ); 488 ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item );
464 if ( !configItem ) return; 489 if ( !configItem ) return;
465 490
466 if ( configItem->standard() && !configItem->isOn() ) { 491 if ( configItem->standard() && !configItem->isOn() ) {
467 KMessageBox::sorry( this, i18n( "You cannot deactivate the standard resource. Choose another standard resource first." ) ); 492 KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) );
468 configItem->setOn( true ); 493 configItem->setOn( true );
469 return; 494 return;
470 } 495 }
471 496
472 if ( configItem->isOn() != configItem->resource()->isActive() ) { 497 if ( configItem->isOn() != configItem->resource()->isActive() ) {
473 emit changed( true ); 498 emit changed( true );
474 } 499 }
475} 500}
476 501
477void ConfigPage::saveResourceSettings() 502void ConfigPage::saveResourceSettings()
478{ 503{
479 qDebug("ConfigPage::saveResourceSettings() begin"); 504 qDebug("ConfigPage::saveResourceSettings() begin");
480 505
481 if ( mCurrentManager ) { 506 if ( mCurrentManager ) {
482 507
483 QListViewItem *item = mListView->firstChild(); 508 QListViewItem *item = mListView->firstChild();
484 while ( item ) { 509 while ( item ) {
485 ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); 510 ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
486 511
487 // check if standard resource 512 // check if standard resource
488 if ( configItem->standard() && !configItem->readOnly() && 513 if ( configItem->standard() && !configItem->readOnly() &&
489 configItem->isOn() ) { 514 configItem->isOn() ) {
490 515
491 mCurrentManager->setStandardResource( configItem->resource() ); 516 mCurrentManager->setStandardResource( configItem->resource() );
492 } 517 }
493 518
494 // check if active or passive resource 519 // check if active or passive resource
495 configItem->resource()->setActive( configItem->isOn() ); 520 configItem->resource()->setActive( configItem->isOn() );
496 521
497 item = item->nextSibling(); 522 item = item->nextSibling();
498 } 523 }
499 mCurrentManager->writeConfig( mCurrentConfig ); 524 mCurrentManager->writeConfig( mCurrentConfig );
500 525
501 if ( !mCurrentManager->standardResource() ) 526 if ( !mCurrentManager->standardResource() )
502 KMessageBox::sorry( this, i18n( "There is no valid standard resource! Please select one which is neither read-only nor inactive." ) ); 527 KMessageBox::sorry( this, i18n( "There is no valid standard resource!<br>Please select one which is neither read-only nor inactive." ) );
503 } 528 }
504 529
505 qDebug("ConfigPage::saveResourceSettings() end"); 530 qDebug("ConfigPage::saveResourceSettings() end");
506 531
507} 532}
508 533
509//US #include "configpage.moc" 534//US #include "configpage.moc"
510 535
diff --git a/microkde/kresources/configpage.h b/microkde/kresources/configpage.h
index 492ea54..be9239e 100644
--- a/microkde/kresources/configpage.h
+++ b/microkde/kresources/configpage.h
@@ -75,29 +75,30 @@ class ConfigPage : public QWidget, public ManagerListener<Resource>
75 protected slots: 75 protected slots:
76 void slotItemClicked( QListViewItem * ); 76 void slotItemClicked( QListViewItem * );
77 77
78 signals: 78 signals:
79 void changed( bool ); 79 void changed( bool );
80 80
81 private: 81 private:
82 void saveResourceSettings(); 82 void saveResourceSettings();
83 83
84 Manager<Resource>* mCurrentManager; 84 Manager<Resource>* mCurrentManager;
85 KConfig* mCurrentConfig; 85 KConfig* mCurrentConfig;
86 KConfig* mConfig; 86 KConfig* mConfig;
87 QString mFamily; 87 QString mFamily;
88 QStringList mFamilyMap; 88 QStringList mFamilyMap;
89 QValueList<ResourcePageInfo> mInfoMap; 89 QValueList<ResourcePageInfo> mInfoMap;
90 90
91 KComboBox* mFamilyCombo; 91 KComboBox* mFamilyCombo;
92 KListView* mListView; 92 KListView* mListView;
93 QPushButton* mAddButton; 93 QPushButton* mAddButton;
94 QPushButton* mRemoveButton; 94 QPushButton* mRemoveButton;
95 QPushButton* mEditButton; 95 QPushButton* mEditButton;
96 QPushButton* mStandardButton; 96 QPushButton* mStandardButton;
97 97
98 QListViewItem* mLastItem; 98 QListViewItem* mLastItem;
99 static const QString syncfamily;
99}; 100};
100 101
101} 102}
102 103
103#endif 104#endif
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index f82e94c..7a5c2f6 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -166,90 +166,124 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent )
166 if ( !factory ) { 166 if ( !factory ) {
167 qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1()); 167 qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1());
168 kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl; 168 kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl;
169 return 0; 169 return 0;
170 } 170 }
171 171
172 PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); 172 PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
173 173
174 if ( !pluginFactory ) { 174 if ( !pluginFactory ) {
175 qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1()); 175 qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1());
176 kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl; 176 kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl;
177 return 0; 177 return 0;
178 } 178 }
179 179
180 ConfigWidget *wdg = pluginFactory->configWidget( parent ); 180 ConfigWidget *wdg = pluginFactory->configWidget( parent );
181 if ( !wdg ) { 181 if ( !wdg ) {
182//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; 182//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
183 qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); 183 qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
184 return 0; 184 return 0;
185 } 185 }
186 return wdg; 186 return wdg;
187 187
188} 188}
189 189
190SyncWidget *Factory::syncWidget( const QString& type, QWidget *parent )
191{
192 if ( type.isEmpty() || !mTypeMap.contains( type ) )
193 return 0;
194
195//US KService::Ptr ptr = mTypeMap[ type ];
196//US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
197 PluginInfo* pi = mTypeMap[ type ];
198 KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
199 if ( !factory ) {
200 qDebug("KRES::Factory::syncWidget(): Factory creation failed for library %s", pi->library.latin1());
201 kdDebug() << "KRES::Factory::syncWidget(): Factory creation failed" << endl;
202 return 0;
203 }
204
205 PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
206
207 if ( !pluginFactory ) {
208 qDebug("KRES::Factory::syncWidget(): no plugin factory for library %s", pi->library.latin1());
209 kdDebug() << "KRES::Factory::syncWidget(): no plugin factory." << endl;
210 return 0;
211 }
212
213 SyncWidget *wdg = pluginFactory->syncWidget( parent );
214 if ( !wdg ) {
215//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
216 qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
217 return 0;
218 }
219 return wdg;
220
221}
222
223
190QString Factory::typeName( const QString &type ) const 224QString Factory::typeName( const QString &type ) const
191{ 225{
192 if ( type.isEmpty() || !mTypeMap.contains( type ) ) 226 if ( type.isEmpty() || !mTypeMap.contains( type ) )
193 return QString(); 227 return QString();
194 228
195 229
196//US KService::Ptr ptr = mTypeMap[ type ]; 230//US KService::Ptr ptr = mTypeMap[ type ];
197//US return ptr->name(); 231//US return ptr->name();
198 PluginInfo* pi = mTypeMap[ type ]; 232 PluginInfo* pi = mTypeMap[ type ];
199 return pi->nameLabel; 233 return pi->nameLabel;
200 234
201} 235}
202 236
203QString Factory::typeDescription( const QString &type ) const 237QString Factory::typeDescription( const QString &type ) const
204{ 238{
205 if ( type.isEmpty() || !mTypeMap.contains( type ) ) 239 if ( type.isEmpty() || !mTypeMap.contains( type ) )
206 return QString(); 240 return QString();
207 241
208//US KService::Ptr ptr = mTypeMap[ type ]; 242//US KService::Ptr ptr = mTypeMap[ type ];
209//US return ptr->comment(); 243//US return ptr->comment();
210 PluginInfo* pi = mTypeMap[ type ]; 244 PluginInfo* pi = mTypeMap[ type ];
211 return pi->descriptionLabel; 245 return pi->descriptionLabel;
212} 246}
213 247
214Resource *Factory::resource( const QString& type, const KConfig *config ) 248Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable )
215{ 249{
216 250
217 251
218 if ( type.isEmpty() || !mTypeMap.contains( type ) ) 252 if ( type.isEmpty() || !mTypeMap.contains( type ) )
219 return 0; 253 return 0;
220 254
221/*US load the lib not dynamicly. !! 255/*US load the lib not dynamicly. !!
222 KService::Ptr ptr = mTypeMap[ type ]; 256 KService::Ptr ptr = mTypeMap[ type ];
223 KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); 257 KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
224 if ( !factory ) { 258 if ( !factory ) {
225 kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; 259 kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
226 return 0; 260 return 0;
227 } 261 }
228*/ 262*/
229 PluginInfo* pi = mTypeMap[ type ]; 263 PluginInfo* pi = mTypeMap[ type ];
230 KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); 264 KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
231 if ( !factory ) { 265 if ( !factory ) {
232 qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); 266 qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1());
233 kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; 267 kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
234 return 0; 268 return 0;
235 } 269 }
236 270
237 PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); 271 PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
238 272
239 if ( !pluginFactory ) { 273 if ( !pluginFactory ) {
240 qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); 274 qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1());
241 kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; 275 kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl;
242 return 0; 276 return 0;
243 } 277 }
244 278
245 Resource *resource = pluginFactory->resource( config ); 279 Resource *resource = pluginFactory->resource( config, syncable );
246 if ( !resource ) { 280 if ( !resource ) {
247//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; 281//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
248 qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); 282 qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
249 return 0; 283 return 0;
250 } 284 }
251 285
252 resource->setType( type ); 286 resource->setType( type );
253 287
254 return resource; 288 return resource;
255} 289}
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index ad67ab3..a265bc8 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -63,56 +63,68 @@ struct PluginInfo
63 */ 63 */
64class Factory 64class Factory
65{ 65{
66 public: 66 public:
67 67
68 68
69 /** 69 /**
70 * Returns the global resource factory. 70 * Returns the global resource factory.
71 */ 71 */
72 static Factory *self( const QString& resourceFamily ); 72 static Factory *self( const QString& resourceFamily );
73 73
74 ~Factory(); 74 ~Factory();
75 75
76 /** 76 /**
77 * Returns the config widget for the given resource type, 77 * Returns the config widget for the given resource type,
78 * or a null pointer if resource type doesn't exist. 78 * or a null pointer if resource type doesn't exist.
79 * 79 *
80 * @param type The type of the resource, returned by @ref resources() 80 * @param type The type of the resource, returned by @ref resources()
81 * @param resource The resource to be editted. 81 * @param resource The resource to be editted.
82 * @param parent The parent widget 82 * @param parent The parent widget
83 */ 83 */
84 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); 84 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
85 85
86 /** 86 /**
87 * Returns the sync widget for the given resource type,
88 * or a null pointer if resource type doesn't exist,
89 * or a null pointer if resource does not support syncing.
90 *
91 * @param type The type of the resource, returned by @ref resources()
92 * @param resource The resource to be editted.
93 * @param parent The parent widget
94 */
95 SyncWidget *syncWidget( const QString& type, QWidget *parent = 0 );
96
97 /**
87 * Returns a pointer to a resource object or a null pointer 98 * Returns a pointer to a resource object or a null pointer
88 * if resource type doesn't exist. 99 * if resource type doesn't exist.
89 * 100 *
90 * @param type The type of the resource, returned by @ref resources() 101 * @param type The type of the resource, returned by @ref resources()
91 * @param ab The address book, the resource should belong to 102 * @param ab The address book, the resource should belong to
92 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. 103 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
104 * @param syncable If the resource should support syncing capabilities.
93 */ 105 */
94 Resource *resource( const QString& type, const KConfig *config ); 106 Resource *resource( const QString& type, const KConfig *config, bool syncable );
95 107
96 /** 108 /**
97 * Returns a list of all available resource types. 109 * Returns a list of all available resource types.
98 */ 110 */
99 QStringList typeNames() const; 111 QStringList typeNames() const;
100 112
101 /** 113 /**
102 * Returns the name for a special type. 114 * Returns the name for a special type.
103 */ 115 */
104 QString typeName( const QString &type ) const; 116 QString typeName( const QString &type ) const;
105 117
106 /** 118 /**
107 * Returns the description for a special type. 119 * Returns the description for a special type.
108 */ 120 */
109 QString typeDescription( const QString &type ) const; 121 QString typeDescription( const QString &type ) const;
110 122
111 protected: 123 protected:
112 Factory( const QString& resourceFamily ); 124 Factory( const QString& resourceFamily );
113 125
114 private: 126 private:
115 static QDict<Factory> *mSelves; 127 static QDict<Factory> *mSelves;
116 128
117 QString mResourceFamily; 129 QString mResourceFamily;
118//US QMap<QString, KService::Ptr> mTypeMap; 130//US QMap<QString, KService::Ptr> mTypeMap;
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro
index ec2b1f7..b664c9a 100644
--- a/microkde/microkdeE.pro
+++ b/microkde/microkdeE.pro
@@ -68,48 +68,49 @@ osmartpointer.h \
68 kdeui/klistview.h \ 68 kdeui/klistview.h \
69 kdeui/kjanuswidget.h \ 69 kdeui/kjanuswidget.h \
70 kdeui/kseparator.h \ 70 kdeui/kseparator.h \
71 kdeui/kmainwindow.h \ 71 kdeui/kmainwindow.h \
72 kdeui/knuminput.h \ 72 kdeui/knuminput.h \
73 kdeui/knumvalidator.h \ 73 kdeui/knumvalidator.h \
74 kdeui/ksqueezedtextlabel.h \ 74 kdeui/ksqueezedtextlabel.h \
75 kdeui/ktoolbar.h \ 75 kdeui/ktoolbar.h \
76 kdeui/ktoolbarbutton.h \ 76 kdeui/ktoolbarbutton.h \
77 kdeui/ktoolbarhandler.h \ 77 kdeui/ktoolbarhandler.h \
78 kdeui/kxmlguiclient.h \ 78 kdeui/kxmlguiclient.h \
79 kio/job.h \ 79 kio/job.h \
80 kio/kio/kdirwatch.h \ 80 kio/kio/kdirwatch.h \
81 kio/kio/kdirwatch_p.h \ 81 kio/kio/kdirwatch_p.h \
82 kio/kfile/kurlrequester.h \ 82 kio/kfile/kurlrequester.h \
83 kresources/resource.h \ 83 kresources/resource.h \
84 kresources/factory.h \ 84 kresources/factory.h \
85 kresources/managerimpl.h \ 85 kresources/managerimpl.h \
86 kresources/manager.h \ 86 kresources/manager.h \
87 kresources/selectdialog.h \ 87 kresources/selectdialog.h \
88 kresources/configpage.h \ 88 kresources/configpage.h \
89 kresources/configwidget.h \ 89 kresources/configwidget.h \
90 kresources/configdialog.h \ 90 kresources/configdialog.h \
91 kresources/kcmkresources.h \ 91 kresources/kcmkresources.h \
92 kresources/syncwidget.h \
92 kdecore/kmdcodec.h \ 93 kdecore/kmdcodec.h \
93 kdecore/kconfigbase.h \ 94 kdecore/kconfigbase.h \
94 kdecore/klocale.h \ 95 kdecore/klocale.h \
95 kdecore/klibloader.h \ 96 kdecore/klibloader.h \
96 kdecore/kcatalogue.h \ 97 kdecore/kcatalogue.h \
97 kdecore/ksharedptr.h \ 98 kdecore/ksharedptr.h \
98 kdecore/kshell.h \ 99 kdecore/kshell.h \
99 kdecore/kstandarddirs.h \ 100 kdecore/kstandarddirs.h \
100 kdecore/kstringhandler.h \ 101 kdecore/kstringhandler.h \
101 kdecore/kshortcut.h \ 102 kdecore/kshortcut.h \
102 kutils/kcmultidialog.h 103 kutils/kcmultidialog.h
103 104
104 105
105 106
106 107
107SOURCES = \ 108SOURCES = \
108KDGanttMinimizeSplitter.cpp \ 109KDGanttMinimizeSplitter.cpp \
109 kapplication.cpp \ 110 kapplication.cpp \
110 kcalendarsystem.cpp \ 111 kcalendarsystem.cpp \
111 kcalendarsystemgregorian.cpp \ 112 kcalendarsystemgregorian.cpp \
112 kcolorbutton.cpp \ 113 kcolorbutton.cpp \
113 kcolordialog.cpp \ 114 kcolordialog.cpp \
114 kconfig.cpp \ 115 kconfig.cpp \
115 kdatetbl.cpp \ 116 kdatetbl.cpp \
@@ -148,26 +149,27 @@ oprocess.cpp \
148 kdeui/kguiitem.cpp \ 149 kdeui/kguiitem.cpp \
149 kdeui/kjanuswidget.cpp \ 150 kdeui/kjanuswidget.cpp \
150 kdeui/klistbox.cpp \ 151 kdeui/klistbox.cpp \
151 kdeui/klistview.cpp \ 152 kdeui/klistview.cpp \
152 kdeui/kmainwindow.cpp \ 153 kdeui/kmainwindow.cpp \
153 kdeui/knuminput.cpp \ 154 kdeui/knuminput.cpp \
154 kdeui/knumvalidator.cpp \ 155 kdeui/knumvalidator.cpp \
155 kdeui/kseparator.cpp \ 156 kdeui/kseparator.cpp \
156 kdeui/kstdaction.cpp \ 157 kdeui/kstdaction.cpp \
157 kdeui/ksqueezedtextlabel.cpp \ 158 kdeui/ksqueezedtextlabel.cpp \
158 kdeui/ktoolbar.cpp \ 159 kdeui/ktoolbar.cpp \
159 kdeui/ktoolbarbutton.cpp \ 160 kdeui/ktoolbarbutton.cpp \
160 kdeui/ktoolbarhandler.cpp \ 161 kdeui/ktoolbarhandler.cpp \
161 kdeui/kxmlguiclient.cpp \ 162 kdeui/kxmlguiclient.cpp \
162 kio/kfile/kurlrequester.cpp \ 163 kio/kfile/kurlrequester.cpp \
163 kio/kio/kdirwatch.cpp \ 164 kio/kio/kdirwatch.cpp \
164 kresources/configpage.cpp \ 165 kresources/configpage.cpp \
165 kresources/configdialog.cpp \ 166 kresources/configdialog.cpp \
166 kresources/configwidget.cpp \ 167 kresources/configwidget.cpp \
167 kresources/factory.cpp \ 168 kresources/factory.cpp \
168 kresources/kcmkresources.cpp \ 169 kresources/kcmkresources.cpp \
169 kresources/managerimpl.cpp \ 170 kresources/managerimpl.cpp \
170 kresources/resource.cpp \ 171 kresources/resource.cpp \
171 kresources/selectdialog.cpp \ 172 kresources/selectdialog.cpp \
173 kresources/syncwidget.cpp \
172 kutils/kcmultidialog.cpp 174 kutils/kcmultidialog.cpp
173 175