Diffstat (limited to 'microkde/kresources/configpage.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | microkde/kresources/configpage.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index 02c5fb1..533be51 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp | |||
@@ -54,15 +54,12 @@ $Id$ | |||
54 | #include <qpushbutton.h> | 54 | #include <qpushbutton.h> |
55 | #include <qfile.h> | 55 | #include <qfile.h> |
56 | #include <kglobal.h> | 56 | #include <kglobal.h> |
57 | 57 | ||
58 | using namespace KRES; | 58 | using namespace KRES; |
59 | 59 | ||
60 | const QString ConfigPage::syncfamily = "syncprofiles"; | ||
61 | |||
62 | |||
63 | class ConfigViewItem : public QCheckListItem | 60 | class ConfigViewItem : public QCheckListItem |
64 | { | 61 | { |
65 | public: | 62 | public: |
66 | ConfigViewItem( QListView *parent, Resource* resource ) : | 63 | ConfigViewItem( QListView *parent, Resource* resource ) : |
67 | QCheckListItem( parent, resource->resourceName(), CheckBox ), | 64 | QCheckListItem( parent, resource->resourceName(), CheckBox ), |
68 | mResource( resource ), | 65 | mResource( resource ), |
@@ -181,35 +178,33 @@ void ConfigPage::load() | |||
181 | //US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" ); | 178 | //US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" ); |
182 | //US KTrader::OfferList::ConstIterator it; | 179 | //US KTrader::OfferList::ConstIterator it; |
183 | //US for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 180 | //US for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
184 | //US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); | 181 | //US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); |
185 | //US QString family = tmp.toString(); | 182 | //US QString family = tmp.toString(); |
186 | QStringList families; | 183 | QStringList families; |
187 | families << "contact" << syncfamily; | 184 | families << "contact"; |
188 | 185 | ||
189 | 186 | ||
190 | for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) | 187 | for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it ) |
191 | { | 188 | { |
192 | QString family = (*it); | 189 | QString family = (*it); |
193 | if ( !family.isEmpty() ) { | 190 | if ( !family.isEmpty() ) { |
194 | if ( !mFamilyMap.contains( family ) ) { | 191 | if ( !mFamilyMap.contains( family ) ) { |
195 | mCurrentManager = new Manager<Resource>( family, (family == syncfamily) ); | 192 | mCurrentManager = new Manager<Resource>( family ); |
196 | if ( mCurrentManager ) { | 193 | if ( mCurrentManager ) { |
197 | mFamilyMap.append( family ); | 194 | mFamilyMap.append( family ); |
198 | mCurrentManager->addListener( this ); | 195 | mCurrentManager->addListener( this ); |
199 | 196 | ||
200 | ResourcePageInfo info; | 197 | ResourcePageInfo info; |
201 | info.mManager = mCurrentManager; | 198 | info.mManager = mCurrentManager; |
202 | QString configDir = KGlobal::dirs()->saveLocation( "config" ); | 199 | QString configDir = KGlobal::dirs()->saveLocation( "config" ); |
203 | //QString configDir = KStandardDirs::appDir() + "/config"; | 200 | //QString configDir = KStandardDirs::appDir() + "/config"; |
204 | if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) { | 201 | if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) { |
205 | info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) ); | 202 | info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) ); |
206 | } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) { | 203 | } else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) { |
207 | info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); | 204 | info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) ); |
208 | } else if ( family == syncfamily && QFile::exists( configDir + "/kabcsyncrc" ) ) { | ||
209 | info.mConfig = new KConfig( locateLocal( "config", "kabcsyncrc" ) ); | ||
210 | } else { | 205 | } else { |
211 | QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); | 206 | QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); |
212 | info.mConfig = new KConfig( configFile ); | 207 | info.mConfig = new KConfig( configFile ); |
213 | } | 208 | } |
214 | info.mManager->readConfig( info.mConfig ); | 209 | info.mManager->readConfig( info.mConfig ); |
215 | 210 | ||
@@ -307,24 +302,15 @@ void ConfigPage::slotAdd() | |||
307 | QStringList types = mCurrentManager->resourceTypeNames(); | 302 | QStringList types = mCurrentManager->resourceTypeNames(); |
308 | QStringList descs = mCurrentManager->resourceTypeDescriptions(); | 303 | QStringList descs = mCurrentManager->resourceTypeDescriptions(); |
309 | bool ok = false; | 304 | bool ok = false; |
310 | 305 | ||
311 | QString desc; | 306 | QString desc; |
312 | 307 | ||
313 | if (mFamily == syncfamily) | ||
314 | { | ||
315 | desc = QInputDialog::getItem( i18n( "Sync Configuration" ), | ||
316 | i18n( "Select resource type for the new sync profile:" ), descs, 0, | ||
317 | false, &ok, this ); | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | desc = QInputDialog::getItem( i18n( "Resource Configuration" ), | 308 | desc = QInputDialog::getItem( i18n( "Resource Configuration" ), |
322 | i18n( "Select type of the new resource:" ), descs, 0, | 309 | i18n( "Select type of the new resource:" ), descs, 0, |
323 | false, &ok, this ); | 310 | false, &ok, this ); |
324 | } | ||
325 | 311 | ||
326 | if ( !ok ) | 312 | if ( !ok ) |
327 | return; | 313 | return; |
328 | 314 | ||
329 | QString type = types[ descs.findIndex( desc ) ]; | 315 | QString type = types[ descs.findIndex( desc ) ]; |
330 | 316 | ||
@@ -333,20 +319,13 @@ void ConfigPage::slotAdd() | |||
333 | if ( !resource ) { | 319 | if ( !resource ) { |
334 | KMessageBox::error( this, i18n("Unable to create resource of type '%1'.") | 320 | KMessageBox::error( this, i18n("Unable to create resource of type '%1'.") |
335 | .arg( type ) ); | 321 | .arg( type ) ); |
336 | return; | 322 | return; |
337 | } | 323 | } |
338 | 324 | ||
339 | if (mFamily == syncfamily) | ||
340 | { | ||
341 | resource->setResourceName( type + "-syncprofile" ); | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | resource->setResourceName( type + "-resource" ); | 325 | resource->setResourceName( type + "-resource" ); |
346 | } | ||
347 | 326 | ||
348 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); | 327 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); |
349 | 328 | ||
350 | if ( dlg.exec() ) { | 329 | if ( dlg.exec() ) { |
351 | mCurrentManager->add( resource ); | 330 | mCurrentManager->add( resource ); |
352 | 331 | ||