int main(int argc, char *argv[])
{
	QApplication app(argc, argv);

	Plasma::Applet* aMuleEngine = new Plasma::Applet;
	Plasma::DataEngine::Data data = aMuleEngine->dataEngine("plasmamule")->query(QString("cat_names"));

	QStringList cat_names = data["cat_names"].toStringList();
	QMenu *menu = new QMenu;

	for (QStringList::const_iterator constIterator = cat_names.constBegin(); constIterator != cat_names.constEnd(); ++constIterator)
	{
		menu->addAction(*constIterator);
		if (constIterator != cat_names.constEnd())
		{
			menu->addSeparator();
		}
	}

	QAction *cat_selection = menu->exec(QCursor::pos());
	if (cat_selection)
	{
		for (int i = 1; i < argc; i++)
		{
			sendLinkToEngine (argv[i], cat_names.indexOf(cat_selection->text()), 0, 0);
		}
	}

	QCoreApplication::exit(0);
}
Ejemplo n.º 2
0
void SpinBox::focusOutEvent(QFocusEvent *event)
{
    QGraphicsWidget *widget = parentWidget();
    Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);

    while (!applet && widget) {
        widget = widget->parentWidget();
        applet = qobject_cast<Plasma::Applet *>(widget);
    }

    if (applet) {
        applet->setStatus(Plasma::UnknownStatus);
    }

    QEvent closeEvent(QEvent::CloseSoftwareInputPanel);
    if (qApp) {
        if (QGraphicsView *view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
            if (view->scene() && view->scene() == scene()) {
                QApplication::sendEvent(view, &closeEvent);
            }
        }
    }

    QGraphicsProxyWidget::focusOutEvent(event);
}
Ejemplo n.º 3
0
QList<QAction*> AppletInterface::contextualActions() const
{
    QList<QAction*> actions;
    Plasma::Applet *a = applet();

    foreach (const QString &name, m_actions) {
        QAction *action = a->action(name);

        if (action) {
            actions << action;
        }
    }
Ejemplo n.º 4
0
QList<QAction*> AppletInterface::contextualActions() const
{
    QList<QAction*> actions;
    Plasma::Applet *a = applet();
    if (a->hasFailedToLaunch()) {
        return actions;
    }

    foreach (const QString &name, m_actions) {
        QAction *action = a->action(name);

        if (action) {
            actions << action;
        }
    }
Ejemplo n.º 5
0
void SpinBox::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    QGraphicsWidget *widget = parentWidget();
    Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);

    while (!applet && widget) {
        widget = widget->parentWidget();
        applet = qobject_cast<Plasma::Applet *>(widget);
    }

    if (applet) {
        applet->setStatus(Plasma::AcceptingInputStatus);
    }
    QGraphicsProxyWidget::mousePressEvent(event);
}