Changeset View
Changeset View
Standalone View
Standalone View
containmentactions/contextmenu/menu.cpp
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 76 | } else { | |||
---|---|---|---|---|---|
77 | actions.insert(QStringLiteral("configure shortcuts"), false); | 77 | actions.insert(QStringLiteral("configure shortcuts"), false); | ||
78 | m_actionOrder << QStringLiteral("_context") << QStringLiteral("_run_command") << QStringLiteral("add widgets") << QStringLiteral("_add panel") | 78 | m_actionOrder << QStringLiteral("_context") << QStringLiteral("_run_command") << QStringLiteral("add widgets") << QStringLiteral("_add panel") | ||
79 | << QStringLiteral("manage activities") << QStringLiteral("remove") << QStringLiteral("lock widgets") << QStringLiteral("_sep1") | 79 | << QStringLiteral("manage activities") << QStringLiteral("remove") << QStringLiteral("lock widgets") << QStringLiteral("_sep1") | ||
80 | <<QStringLiteral("_lock_screen") << QStringLiteral("_logout") << QStringLiteral("_sep2") << QStringLiteral("run associated application") << QStringLiteral("configure") | 80 | <<QStringLiteral("_lock_screen") << QStringLiteral("_logout") << QStringLiteral("_sep2") << QStringLiteral("run associated application") << QStringLiteral("configure") | ||
81 | << QStringLiteral("configure shortcuts") << QStringLiteral("_sep3") << QStringLiteral("_wallpaper"); | 81 | << QStringLiteral("configure shortcuts") << QStringLiteral("_sep3") << QStringLiteral("_wallpaper"); | ||
82 | disabled.insert(QStringLiteral("configure shortcuts")); | 82 | disabled.insert(QStringLiteral("configure shortcuts")); | ||
83 | } | 83 | } | ||
84 | 84 | | |||
85 | foreach (const QString &name, m_actionOrder) { | 85 | for (const QString &name : qAsConst(m_actionOrder)) { | ||
86 | actions.insert(name, !disabled.contains(name)); | 86 | actions.insert(name, !disabled.contains(name)); | ||
87 | } | 87 | } | ||
88 | 88 | | |||
89 | QHashIterator<QString, bool> it(actions); | 89 | QHashIterator<QString, bool> it(actions); | ||
90 | while (it.hasNext()) { | 90 | while (it.hasNext()) { | ||
91 | it.next(); | 91 | it.next(); | ||
92 | m_actions.insert(it.key(), config.readEntry(it.key(), it.value())); | 92 | m_actions.insert(it.key(), config.readEntry(it.key(), it.value())); | ||
93 | } | 93 | } | ||
Show All 24 Lines | |||||
118 | } | 118 | } | ||
119 | } | 119 | } | ||
120 | 120 | | |||
121 | QList<QAction*> ContextMenu::contextualActions() | 121 | QList<QAction*> ContextMenu::contextualActions() | ||
122 | { | 122 | { | ||
123 | Plasma::Containment *c = containment(); | 123 | Plasma::Containment *c = containment(); | ||
124 | Q_ASSERT(c); | 124 | Q_ASSERT(c); | ||
125 | QList<QAction*> actions; | 125 | QList<QAction*> actions; | ||
126 | foreach (const QString &name, m_actionOrder) { | 126 | for (const QString &name : qAsConst(m_actionOrder)) { | ||
127 | if (!m_actions.value(name)) { | 127 | if (!m_actions.value(name)) { | ||
128 | continue; | 128 | continue; | ||
129 | } | 129 | } | ||
130 | 130 | | |||
131 | if (name == QLatin1String("_context")) { | 131 | if (name == QLatin1String("_context")) { | ||
132 | actions << c->contextualActions(); | 132 | actions << c->contextualActions(); | ||
133 | } if (name == QLatin1String("_wallpaper")) { | 133 | } if (name == QLatin1String("_wallpaper")) { | ||
134 | if (!c->wallpaper().isEmpty()) { | 134 | if (!c->wallpaper().isEmpty()) { | ||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | |||||
250 | { | 250 | { | ||
251 | QWidget *widget = new QWidget(parent); | 251 | QWidget *widget = new QWidget(parent); | ||
252 | QVBoxLayout *lay = new QVBoxLayout(); | 252 | QVBoxLayout *lay = new QVBoxLayout(); | ||
253 | widget->setLayout(lay); | 253 | widget->setLayout(lay); | ||
254 | widget->setWindowTitle(i18nc("plasma_containmentactions_contextmenu", "Configure Contextual Menu Plugin")); | 254 | widget->setWindowTitle(i18nc("plasma_containmentactions_contextmenu", "Configure Contextual Menu Plugin")); | ||
255 | m_buttons = new QButtonGroup(widget); | 255 | m_buttons = new QButtonGroup(widget); | ||
256 | m_buttons->setExclusive(false); | 256 | m_buttons->setExclusive(false); | ||
257 | 257 | | |||
258 | foreach (const QString &name, m_actionOrder) { | 258 | for (const QString &name : qAsConst(m_actionOrder)) { | ||
259 | QCheckBox *item = nullptr; | 259 | QCheckBox *item = nullptr; | ||
260 | 260 | | |||
261 | if (name == QLatin1String("_context")) { | 261 | if (name == QLatin1String("_context")) { | ||
262 | item = new QCheckBox(widget); | 262 | item = new QCheckBox(widget); | ||
263 | //FIXME better text | 263 | //FIXME better text | ||
264 | item->setText(i18nc("plasma_containmentactions_contextmenu", "[Other Actions]")); | 264 | item->setText(i18nc("plasma_containmentactions_contextmenu", "[Other Actions]")); | ||
265 | } else if (name == QLatin1String("_wallpaper")) { | 265 | } else if (name == QLatin1String("_wallpaper")) { | ||
266 | item = new QCheckBox(widget); | 266 | item = new QCheckBox(widget); | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |