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=/branches/KDE/4.4/kdelibs/; revision=1084747
This commit is contained in:
Aaron J. Seigo 2010-02-03 17:41:18 +00:00
parent ed37e1acc0
commit 0d51b21cab

View File

@ -1713,31 +1713,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 {