Changeset View
Changeset View
Standalone View
Standalone View
shell/currentcontainmentactionsmodel.cpp
Show All 19 Lines | |||||
20 | #include "currentcontainmentactionsmodel.h" | 20 | #include "currentcontainmentactionsmodel.h" | ||
21 | 21 | | |||
22 | #include <QMouseEvent> | 22 | #include <QMouseEvent> | ||
23 | 23 | | |||
24 | #include <QDebug> | 24 | #include <QDebug> | ||
25 | #include <QDialog> | 25 | #include <QDialog> | ||
26 | #include <QVBoxLayout> | 26 | #include <QVBoxLayout> | ||
27 | #include <QDialogButtonBox> | 27 | #include <QDialogButtonBox> | ||
28 | #include <QQuickItem> | ||||
29 | #include <QQuickWindow> | ||||
30 | #include <QWindow> | ||||
28 | 31 | | |||
29 | #include <kaboutdata.h> | 32 | #include <kaboutdata.h> | ||
30 | #include <kaboutapplicationdialog.h> | 33 | #include <kaboutapplicationdialog.h> | ||
31 | #include <klocalizedstring.h> | 34 | #include <klocalizedstring.h> | ||
32 | 35 | | |||
33 | #include <Plasma/Corona> | 36 | #include <Plasma/Corona> | ||
34 | #include <Plasma/Containment> | 37 | #include <Plasma/Containment> | ||
35 | #include <Plasma/ContainmentActions> | 38 | #include <Plasma/ContainmentActions> | ||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 217 | [configDlg, pluginInstance] () { | |||
215 | pluginInstance->configurationAccepted(); | 218 | pluginInstance->configurationAccepted(); | ||
216 | }); | 219 | }); | ||
217 | 220 | | |||
218 | connect(pluginInstance, &QObject::destroyed, configDlg, &QDialog::reject); | 221 | connect(pluginInstance, &QObject::destroyed, configDlg, &QDialog::reject); | ||
219 | 222 | | |||
220 | configDlg->show(); | 223 | configDlg->show(); | ||
221 | } | 224 | } | ||
222 | 225 | | |||
223 | void CurrentContainmentActionsModel::showAbout(int row) | 226 | void CurrentContainmentActionsModel::showAbout(int row, QQuickItem *ctx) | ||
224 | { | 227 | { | ||
225 | const QString action = itemData(index(row, 0)).value(ActionRole).toString(); | 228 | const QString action = itemData(index(row, 0)).value(ActionRole).toString(); | ||
226 | 229 | | |||
227 | if (!m_plugins.contains(action)) { | 230 | if (!m_plugins.contains(action)) { | ||
228 | return; | 231 | return; | ||
229 | } | 232 | } | ||
230 | 233 | | |||
231 | KPluginInfo info = m_plugins[action]->pluginInfo(); | 234 | KPluginInfo info = m_plugins[action]->pluginInfo(); | ||
232 | 235 | | |||
233 | KAboutData aboutData(info.name().toUtf8(), | 236 | KAboutData aboutData(info.name().toUtf8(), | ||
234 | ki18n(info.name().toUtf8()).toString(), | 237 | ki18n(info.name().toUtf8()).toString(), | ||
235 | info.version().toUtf8(), | 238 | info.version().toUtf8(), | ||
236 | ki18n(info.comment().toUtf8()).toString(), | 239 | ki18n(info.comment().toUtf8()).toString(), | ||
237 | KAboutLicense::byKeyword(info.license()).key(), | 240 | KAboutLicense::byKeyword(info.license()).key(), | ||
238 | QByteArray(), | 241 | QByteArray(), | ||
239 | QByteArray(), info.website().toLatin1(), | 242 | QByteArray(), info.website().toLatin1(), | ||
240 | info.email().toLatin1()); | 243 | info.email().toLatin1()); | ||
241 | 244 | | |||
242 | aboutData.addAuthor(ki18n(info.author().toUtf8()).toString(), QByteArray(), info.email().toLatin1()); | 245 | aboutData.addAuthor(ki18n(info.author().toUtf8()).toString(), QByteArray(), info.email().toLatin1()); | ||
243 | 246 | | |||
244 | KAboutApplicationDialog *aboutDialog = new KAboutApplicationDialog(aboutData, qobject_cast<QWidget*>(parent())); | 247 | KAboutApplicationDialog *aboutDialog = new KAboutApplicationDialog(aboutData, qobject_cast<QWidget*>(parent())); | ||
245 | aboutDialog->setWindowIcon(QIcon::fromTheme(info.icon())); | 248 | aboutDialog->setWindowIcon(QIcon::fromTheme(info.icon())); | ||
246 | aboutDialog->setAttribute(Qt::WA_DeleteOnClose); | 249 | aboutDialog->setAttribute(Qt::WA_DeleteOnClose); | ||
250 | | ||||
251 | if (ctx && ctx->window()) { | ||||
252 | aboutDialog->setWindowModality(Qt::WindowModal); | ||||
253 | aboutDialog->winId(); // so it creates the windowHandle(); | ||||
254 | aboutDialog->windowHandle()->setTransientParent(ctx->window()); | ||||
255 | } | ||||
247 | aboutDialog->show(); | 256 | aboutDialog->show(); | ||
248 | } | 257 | } | ||
249 | 258 | | |||
250 | void CurrentContainmentActionsModel::save() | 259 | void CurrentContainmentActionsModel::save() | ||
251 | { | 260 | { | ||
252 | 261 | | |||
253 | foreach (const QString &removedTrigger, m_removedTriggers) { | 262 | foreach (const QString &removedTrigger, m_removedTriggers) { | ||
254 | m_containment->setContainmentActions(removedTrigger, QString()); | 263 | m_containment->setContainmentActions(removedTrigger, QString()); | ||
Show All 15 Lines |