summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/configpage.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index 0f1469d..8782ffd 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -118,124 +118,127 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name )
groupBoxLayout->addWidget( buttonBox, 1, 1 );
mainLayout->addWidget( groupBox );
connect( mFamilyCombo, SIGNAL( activated( int ) ),
SLOT( slotFamilyChanged( int ) ) );
connect( mListView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionChanged() ) );
connect( mListView, SIGNAL( clicked( QListViewItem * ) ),
SLOT( slotItemClicked( QListViewItem * ) ) );
mLastItem = 0;
//US mConfig = new KConfig( "kcmkresourcesrc" );
mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") );
mConfig->setGroup( "General" );
load();
}
ConfigPage::~ConfigPage()
{
QValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) {
(*it).mManager->removeListener( this );
delete (*it).mManager;
delete (*it).mConfig;
}
mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() );
delete mConfig;
mConfig = 0;
}
void ConfigPage::load()
{
kdDebug(5650) << "ConfigPage::load()" << endl;
mListView->clear();
//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
//US KTrader::OfferList::ConstIterator it;
//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
//US QString family = tmp.toString();
-
- QString family = "contact";
+ QStringList families;
+ families << "contact" << "sync-contacts";
+ for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
+ {
+ QString family = (*it);
if ( !family.isEmpty() ) {
if ( !mFamilyMap.contains( family ) ) {
mCurrentManager = new Manager<Resource>( family );
if ( mCurrentManager ) {
mFamilyMap.append( family );
mCurrentManager->addListener( this );
ResourcePageInfo info;
info.mManager = mCurrentManager;
QString configDir = KGlobal::dirs()->saveLocation( "config" );
//QString configDir = KStandardDirs::appDir() + "/config";
if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) );
} else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) );
} else {
QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
info.mConfig = new KConfig( configFile );
}
info.mManager->readConfig( info.mConfig );
mInfoMap.append( info );
}
}
}
-//US }
+ }
mCurrentManager = 0;
mFamilyCombo->insertStringList( mFamilyMap );
int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 );
mFamilyCombo->setCurrentItem( currentFamily );
slotFamilyChanged( currentFamily );
}
void ConfigPage::save()
{
saveResourceSettings();
QValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it )
(*it).mManager->writeConfig( (*it).mConfig );
emit changed( false );
}
void ConfigPage::defaults()
{
}
void ConfigPage::slotFamilyChanged( int pos )
{
if ( pos < 0 || pos >= (int)mFamilyMap.count() )
return;
saveResourceSettings();
mFamily = mFamilyMap[ pos ];
//US qDebug("ConfigPage::slotFamilyChanged 4 family=%s", mFamily.latin1());
mCurrentManager = mInfoMap[ pos ].mManager;
mCurrentConfig = mInfoMap[ pos ].mConfig;
if ( !mCurrentManager )
kdDebug(5650) << "ERROR: cannot create ResourceManager<Resource>( mFamily )" << endl;
mListView->clear();
if ( mCurrentManager->isEmpty() ) {
//US qDebug("ConfigPage::slotFamilyChanged 4.1 mCurrentManager=%ul", mCurrentManager );
defaults();
}