another use case, another way the code could fail; reorganize this code so that if a dialog isn't auto-generated (no matter why!) we fall back to the ScriptEngine's own implemenation

svn path=/trunk/KDE/kdelibs/; revision=1084746
This commit is contained in:
Aaron J. Seigo 2010-02-03 17:37:54 +00:00
parent 7d33f20f40
commit 342be4bd86

View File

@ -1707,31 +1707,27 @@ void Applet::showConfigurationInterface()
}
if (d->package && d->configLoader) {
KConfigDialog *dialog = new KConfigDialog(0, d->configDialogId(), d->configLoader);
KConfigDialog *dialog = 0;
QString uiFile = d->package->filePath("mainconfigui");
if (!uiFile.isEmpty()) {
QFile f(uiFile);
QUiLoader loader;
QWidget *w = loader.load(&f);
if (!w) {
delete dialog;
if (d->script) {
d->script->showConfigurationInterface();
}
return;
if (w) {
dialog = new KConfigDialog(0, d->configDialogId(), d->configLoader);
dialog->setWindowTitle(d->configWindowTitle());
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
d->addGlobalShortcutsPage(dialog);
d->addPublishPage(dialog);
dialog->show();
}
dialog->setWindowTitle(d->configWindowTitle());
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
}
d->addGlobalShortcutsPage(dialog);
d->addPublishPage(dialog);
dialog->show();
if (!dialog && d->script) {
d->script->showConfigurationInterface();
}
} else if (d->script) {
d->script->showConfigurationInterface();
} else {