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);
}
예제 #2
0
파일: spinbox.cpp 프로젝트: vasi/kdelibs
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);
}
예제 #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;
        }
    }
예제 #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;
        }
    }
예제 #5
0
파일: spinbox.cpp 프로젝트: vasi/kdelibs
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);
}