Changeset View
Changeset View
Standalone View
Standalone View
containmentactions/contextmenu/menu.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 64 | { | |||
---|---|---|---|---|---|
67 | 67 | | |||
68 | m_actions.clear(); | 68 | m_actions.clear(); | ||
69 | m_actionOrder.clear(); | 69 | m_actionOrder.clear(); | ||
70 | QHash<QString, bool> actions; | 70 | QHash<QString, bool> actions; | ||
71 | QSet<QString> disabled; | 71 | QSet<QString> disabled; | ||
72 | 72 | | |||
73 | if (c->containmentType() == Plasma::Types::PanelContainment || | 73 | if (c->containmentType() == Plasma::Types::PanelContainment || | ||
74 | c->containmentType() == Plasma::Types::CustomPanelContainment) { | 74 | c->containmentType() == Plasma::Types::CustomPanelContainment) { | ||
75 | m_actionOrder << QStringLiteral("add widgets") << QStringLiteral("_add panel") << QStringLiteral("lock widgets") << QStringLiteral("_context") << QStringLiteral("configure") << QStringLiteral("remove"); | 75 | m_actionOrder << QStringLiteral("add widgets") << QStringLiteral("_add panel") << QStringLiteral("lock widgets") << QStringLiteral("edit mode") << QStringLiteral("_context") << QStringLiteral("configure") << QStringLiteral("remove"); | ||
76 | } else { | 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("edit mode") << 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 | foreach (const QString &name, m_actionOrder) { | ||
86 | actions.insert(name, !disabled.contains(name)); | 86 | actions.insert(name, !disabled.contains(name)); | ||
87 | } | 87 | } | ||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 155 | { | |||
176 | } else if (name == QLatin1String("_logout")) { | 176 | } else if (name == QLatin1String("_logout")) { | ||
177 | if (KAuthorized::authorize(QStringLiteral("logout"))) { | 177 | if (KAuthorized::authorize(QStringLiteral("logout"))) { | ||
178 | return m_logoutAction; | 178 | return m_logoutAction; | ||
179 | } | 179 | } | ||
180 | } else if (name == QLatin1String("lock widgets")) { | 180 | } else if (name == QLatin1String("lock widgets")) { | ||
181 | if (c->corona()) { | 181 | if (c->corona()) { | ||
182 | return c->corona()->actions()->action(QStringLiteral("lock widgets")); | 182 | return c->corona()->actions()->action(QStringLiteral("lock widgets")); | ||
183 | } | 183 | } | ||
184 | } else if (name == QLatin1String("edit mode")) { | ||||
185 | if (c->corona()) { | ||||
186 | return c->corona()->actions()->action(QStringLiteral("edit mode")); | ||||
187 | } | ||||
184 | } else if (name == QLatin1String("manage activities")) { | 188 | } else if (name == QLatin1String("manage activities")) { | ||
185 | if (c->corona()) { | 189 | if (c->corona()) { | ||
186 | return c->corona()->actions()->action(QStringLiteral("manage activities")); | 190 | return c->corona()->actions()->action(QStringLiteral("manage activities")); | ||
187 | } | 191 | } | ||
188 | } else { | 192 | } else { | ||
189 | //FIXME: remove action: make removal of current activity possible | 193 | //FIXME: remove action: make removal of current activity possible | ||
190 | return c->actions()->action(name); | 194 | return c->actions()->action(name); | ||
191 | } | 195 | } | ||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |