Changeset View
Changeset View
Standalone View
Standalone View
src/scriptengines/qml/plasmoid/containmentinterface.cpp
Show First 20 Lines • Show All 1125 Lines • ▼ Show 20 Line(s) | 1125 | if (configureApplet && configureApplet->isEnabled()) { | |||
---|---|---|---|---|---|
1126 | desktopMenu->addAction(configureApplet); | 1126 | desktopMenu->addAction(configureApplet); | ||
1127 | } | 1127 | } | ||
1128 | QAction *appletAlternatives = applet->actions()->action(QStringLiteral("alternatives")); | 1128 | QAction *appletAlternatives = applet->actions()->action(QStringLiteral("alternatives")); | ||
1129 | if (appletAlternatives && appletAlternatives->isEnabled()) { | 1129 | if (appletAlternatives && appletAlternatives->isEnabled()) { | ||
1130 | desktopMenu->addAction(appletAlternatives); | 1130 | desktopMenu->addAction(appletAlternatives); | ||
1131 | } | 1131 | } | ||
1132 | } | 1132 | } | ||
1133 | 1133 | | |||
1134 | QMenu *containmentMenu = new QMenu(i18nc("%1 is the name of the containment", "%1 Options", m_containment->title()), desktopMenu); | | |||
1135 | if (m_containment->containmentType() != Plasma::Types::DesktopContainment) { | 1134 | if (m_containment->containmentType() != Plasma::Types::DesktopContainment) { | ||
1136 | addContainmentActions(containmentMenu, event); | 1135 | desktopMenu->addSeparator(); | ||
1137 | } | 1136 | addContainmentActions(desktopMenu, event); | ||
1138 | | ||||
1139 | if (!containmentMenu->isEmpty()) { | | |||
1140 | int enabled = 0; | | |||
1141 | //count number of real actions | | |||
1142 | QListIterator<QAction *> actionsIt(containmentMenu->actions()); | | |||
1143 | while (enabled < 3 && actionsIt.hasNext()) { | | |||
1144 | QAction *action = actionsIt.next(); | | |||
1145 | if (action->isVisible() && !action->isSeparator()) { | | |||
1146 | ++enabled; | | |||
1147 | } | | |||
1148 | } | | |||
1149 | | ||||
1150 | if (enabled) { | | |||
1151 | //if there is only one, don't create a submenu | | |||
1152 | if (enabled < 2) { | | |||
1153 | foreach (QAction *action, containmentMenu->actions()) { | | |||
1154 | if (action->isVisible() && !action->isSeparator()) { | | |||
1155 | desktopMenu->addAction(action); | | |||
1156 | } | | |||
1157 | } | | |||
1158 | } else { | | |||
1159 | desktopMenu->addMenu(containmentMenu); | | |||
1160 | } | | |||
1161 | } | | |||
1162 | } | 1137 | } | ||
1163 | 1138 | | |||
1164 | if (m_containment->immutability() == Plasma::Types::Mutable && | 1139 | if (m_containment->immutability() == Plasma::Types::Mutable && | ||
1165 | (m_containment->containmentType() != Plasma::Types::PanelContainment || m_containment->isUserConfiguring())) { | 1140 | (m_containment->containmentType() != Plasma::Types::PanelContainment || m_containment->isUserConfiguring())) { | ||
1166 | QAction *closeApplet = applet->actions()->action(QStringLiteral("remove")); | 1141 | QAction *closeApplet = applet->actions()->action(QStringLiteral("remove")); | ||
1167 | //qDebug() << "checking for removal" << closeApplet; | 1142 | //qDebug() << "checking for removal" << closeApplet; | ||
1168 | if (closeApplet) { | 1143 | if (closeApplet) { | ||
1169 | if (!desktopMenu->isEmpty()) { | 1144 | if (!desktopMenu->isEmpty()) { | ||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |