only do the work if the file exists

svn path=/trunk/KDE/kdelibs/; revision=1071440
This commit is contained in:
Aaron J. Seigo 2010-01-08 02:11:58 +00:00
parent 30ec5b73bb
commit c856db301c

View File

@ -2772,12 +2772,14 @@ KConfigGroup *AppletPrivate::mainConfigGroup()
mainConfig = new KConfigGroup(&appletConfig, QString::number(appletId));
}
if (newGroup && q->package()) {
if (newGroup && package) {
//see if we have a default configuration in our package
kDebug() << "copying default config: " << q->package()->filePath("defaultconfig");
KConfigGroup defaultConfig(KSharedConfig::openConfig(q->package()->filePath("config",
"default-configrc"))->group("Configuration"));
defaultConfig.copyTo(mainConfig);
const QString defaultConfigFile = q->package()->filePath("defaultconfig");
if (!defaultConfigFile.isEmpty()) {
kDebug() << "copying default config: " << q->package()->filePath("defaultconfig");
KConfigGroup defaultConfig(KSharedConfig::openConfig(defaultConfigFile)->group("Configuration"));
defaultConfig.copyTo(mainConfig);
}
}
return mainConfig;