diff --git a/plasma.cpp b/plasma.cpp index 312763c88..a2757528f 100644 --- a/plasma.cpp +++ b/plasma.cpp @@ -92,38 +92,4 @@ QGraphicsView *viewFor(const QGraphicsItem *item) return found; } -QList actionsFromMenu(QMenu *menu, const QString &prefix, QObject *parent) -{ - Q_ASSERT(menu); - - QList ret; - foreach (QAction *action, menu->actions()) { - if (QMenu *submenu = action->menu()) { - //Flatten hierarchy and prefix submenu text to all actions in submenu - ret << actionsFromMenu(submenu, action->text(), parent); - } else if (!action->isSeparator() && action->isEnabled()) { - QString text = action->text(); - if (action->isCheckable()) { - if (action->isChecked()) { - text = QString("(%1) %2").arg(QChar(0x2613)).arg(text); - } else { - text = QString("( ) %1").arg(text); - } - } - - if (!prefix.isEmpty()) { - text = QString("%1: %2").arg(prefix).arg(text); - } - text = text.replace(QRegExp("&([\\S])"), "\\1"); - - QAction *a = new QAction(action->icon(), text, parent); - - QObject::connect(a, SIGNAL(triggered(bool)), action, SIGNAL(triggered(bool))); - ret << a; - } - } - return ret; -} - - } // Plasma namespace diff --git a/plasma.h b/plasma.h index 5124239a6..73c5ae7ac 100644 --- a/plasma.h +++ b/plasma.h @@ -302,21 +302,6 @@ PLASMA_EXPORT Direction locationToInverseDirection(Location location); */ PLASMA_EXPORT QGraphicsView *viewFor(const QGraphicsItem *item); -/** - * Returns a list of all actions in the given QMenu - * This method flattens the hierarchy of the menu by prefixing the - * text of all actions in a submenu with the submenu title. - * - * @param menu the QMenu storing the actions - * @param prefix text to display before the text of all actions in the menu - * @param parent QObject to be passed as parent of all the actions in the list - * - * @since 4.4 - */ -PLASMA_EXPORT QList actionsFromMenu(QMenu *menu, - const QString &prefix = QString(), - QObject *parent = 0); - } // Plasma namespace Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Constraints)