Changeset View
Changeset View
Standalone View
Standalone View
kcmshell/main.cpp
Show All 27 Lines | |||||
28 | #include <QtDBus/QtDBus> | 28 | #include <QtDBus/QtDBus> | ||
29 | 29 | | |||
30 | #include <KAboutData> | 30 | #include <KAboutData> | ||
31 | #include <QApplication> | 31 | #include <QApplication> | ||
32 | #include <KAuthorized> | 32 | #include <KAuthorized> | ||
33 | 33 | | |||
34 | #include <KCModuleInfo> | 34 | #include <KCModuleInfo> | ||
35 | #include <KCMultiDialog> | 35 | #include <KCMultiDialog> | ||
36 | #include <KCModuleProxy> | ||||
36 | #include <QDebug> | 37 | #include <QDebug> | ||
37 | #include <KLocalizedString> | 38 | #include <KLocalizedString> | ||
38 | #include <KServiceTypeTrader> | 39 | #include <KServiceTypeTrader> | ||
39 | #include <KStartupInfo> | 40 | #include <KStartupInfo> | ||
40 | #include <QIcon> | 41 | #include <KActivities/ResourceInstance> | ||
41 | 42 | | |||
43 | #include <QIcon> | ||||
42 | #include <QCommandLineParser> | 44 | #include <QCommandLineParser> | ||
43 | #include <QCommandLineOption> | 45 | #include <QCommandLineOption> | ||
44 | 46 | | |||
45 | 47 | | |||
46 | using namespace std; | 48 | using namespace std; | ||
47 | 49 | | |||
48 | KService::List m_modules; | 50 | KService::List m_modules; | ||
49 | 51 | | |||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | |||||
117 | 119 | | |||
118 | KCMShellMultiDialog::KCMShellMultiDialog(KPageDialog::FaceType dialogFace, QWidget *parent) | 120 | KCMShellMultiDialog::KCMShellMultiDialog(KPageDialog::FaceType dialogFace, QWidget *parent) | ||
119 | : KCMultiDialog(parent) | 121 | : KCMultiDialog(parent) | ||
120 | { | 122 | { | ||
121 | setFaceType(dialogFace); | 123 | setFaceType(dialogFace); | ||
122 | setModal(false); | 124 | setModal(false); | ||
123 | 125 | | |||
124 | QDBusConnection::sessionBus().registerObject("/KCModule/dialog", this, QDBusConnection::ExportScriptableSlots); | 126 | QDBusConnection::sessionBus().registerObject("/KCModule/dialog", this, QDBusConnection::ExportScriptableSlots); | ||
127 | | ||||
128 | connect(this, &KCMShellMultiDialog::currentPageChanged, | ||||
129 | this, [this](KPageWidgetItem *newPage,KPageWidgetItem *oldPage) { | ||||
130 | KCModuleProxy *activeModule = qobject_cast<KCModuleProxy *>(newPage->widget()); | ||||
131 | if (activeModule) { | ||||
132 | KActivities::ResourceInstance::notifyAccessed(QUrl("kcm:" + activeModule->moduleInfo().service()->storageId()), | ||||
133 | "org.kde.systemsettings"); | ||||
134 | } | ||||
135 | }); | ||||
125 | } | 136 | } | ||
126 | 137 | | |||
127 | void KCMShellMultiDialog::activate(const QByteArray& asn_id) | 138 | void KCMShellMultiDialog::activate(const QByteArray& asn_id) | ||
128 | { | 139 | { | ||
129 | #ifdef HAVE_X11 | 140 | #ifdef HAVE_X11 | ||
130 | KStartupInfo::setNewStartupId(this, asn_id); | 141 | KStartupInfo::setNewStartupId(this, asn_id); | ||
131 | #endif | 142 | #endif | ||
132 | } | 143 | } | ||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | 175 | { | |||
279 | KCMShellMultiDialog *dlg = new KCMShellMultiDialog(ftype); | 290 | KCMShellMultiDialog *dlg = new KCMShellMultiDialog(ftype); | ||
280 | dlg->setAttribute(Qt::WA_DeleteOnClose); | 291 | dlg->setAttribute(Qt::WA_DeleteOnClose); | ||
281 | if (parser.isSet("caption")) { | 292 | if (parser.isSet("caption")) { | ||
282 | dlg->setWindowTitle(parser.value("caption")); | 293 | dlg->setWindowTitle(parser.value("caption")); | ||
283 | } else if (modules.count() == 1) { | 294 | } else if (modules.count() == 1) { | ||
284 | dlg->setWindowTitle(modules.first()->name()); | 295 | dlg->setWindowTitle(modules.first()->name()); | ||
285 | } | 296 | } | ||
286 | 297 | | |||
287 | for (KService::List::ConstIterator it = modules.constBegin(); it != modules.constEnd(); ++it) { | 298 | for (KService::List::ConstIterator it = modules.constBegin(); it != modules.constEnd(); ++it) { | ||
davidedmundson:
? | |||||
mart: eww, sorry :) | |||||
288 | dlg->addModule(*it, 0, moduleArgs); | 299 | dlg->addModule(*it, 0, moduleArgs); | ||
289 | } | 300 | } | ||
290 | 301 | | |||
291 | if (parser.isSet("icon")) { | 302 | if (parser.isSet("icon")) { | ||
292 | dlg->setWindowIcon(QIcon::fromTheme(parser.value("icon"))); | 303 | dlg->setWindowIcon(QIcon::fromTheme(parser.value("icon"))); | ||
293 | } else if (!parser.isSet("icon") && !modules.isEmpty()) { | 304 | } else if (!parser.isSet("icon") && !modules.isEmpty()) { | ||
294 | const QString iconName = KCModuleInfo(modules.first()).icon(); | 305 | const QString iconName = KCModuleInfo(modules.first()).icon(); | ||
295 | dlg->setWindowIcon( QIcon::fromTheme(iconName) ); | 306 | dlg->setWindowIcon( QIcon::fromTheme(iconName) ); | ||
Show All 19 Lines |
?