Aaron's patch for loading system KCMs in scripted plasmoids config dialog by specifying them in the plasmoid's .desktop file
This commit is contained in:
parent
356e618364
commit
6c19c0b3c4
@ -261,7 +261,7 @@ kde4_add_library(plasma ${LIBRARY_TYPE} ${plasma_LIB_SRCS})
|
||||
#add kdeclarative after the 4.7 release
|
||||
target_link_libraries(plasma ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
|
||||
${QT_QTSCRIPT_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
|
||||
${KDE4_KDEUI_LIBS} kdnssd threadweaver ${PLASMA_EXTRA_LIBS})
|
||||
${KDE4_KDEUI_LIBS} ${KDE4_KUTILS_LIBS} kdnssd threadweaver ${PLASMA_EXTRA_LIBS})
|
||||
|
||||
if(QCA2_FOUND)
|
||||
target_link_libraries(plasma ${QCA2_LIBRARIES})
|
||||
|
34
applet.cpp
34
applet.cpp
@ -53,7 +53,10 @@
|
||||
#include <kactioncollection.h>
|
||||
#include <kauthorized.h>
|
||||
#include <kcolorscheme.h>
|
||||
#include <kcmoduleinfo.h>
|
||||
#include <kcmoduleproxy.h>
|
||||
#include <kdialog.h>
|
||||
#include <kdesktopfile.h>
|
||||
#include <kicon.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kkeysequencewidget.h>
|
||||
@ -1885,19 +1888,40 @@ void Applet::showConfigurationInterface()
|
||||
if (d->package && d->configLoader) {
|
||||
KConfigDialog *dialog = 0;
|
||||
|
||||
QString uiFile = d->package->filePath("mainconfigui");
|
||||
if (!uiFile.isEmpty()) {
|
||||
const QString uiFile = d->package->filePath("mainconfigui");
|
||||
KDesktopFile df(d->package->path() + "/metadata.destkop");
|
||||
const QStringList kcmPlugins = df.desktopGroup().readEntry("X-Plasma-ConfigPlugins", QStringList());
|
||||
if (!uiFile.isEmpty() || !kcmPlugins.isEmpty()) {
|
||||
dialog = new AppletConfigDialog(0, d->configDialogId(), d->configLoader);
|
||||
dialog->setWindowTitle(d->configWindowTitle());
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
bool hasPages = false;
|
||||
|
||||
QFile f(uiFile);
|
||||
QUiLoader loader;
|
||||
QWidget *w = loader.load(&f);
|
||||
if (w) {
|
||||
dialog = new AppletConfigDialog(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()));
|
||||
hasPages = true;
|
||||
}
|
||||
|
||||
foreach (const QString &kcm, kcmPlugins) {
|
||||
KCModuleProxy *module = new KCModuleProxy(kcm);
|
||||
if (module->realModule()) {
|
||||
dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon());
|
||||
hasPages = true;
|
||||
} else {
|
||||
delete module;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPages) {
|
||||
d->addGlobalShortcutsPage(dialog);
|
||||
d->addPublishPage(dialog);
|
||||
dialog->show();
|
||||
} else {
|
||||
delete dialog;
|
||||
dialog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user