void BehaviorConfig_Shorten::slotAboutClicked() { const QString shorten = shortenPlugins->itemData(shortenPlugins->currentIndex()).toString(); if (shorten == QLatin1String("none")) { return; } KPluginInfo info = availablePlugins.value(shorten); KAboutData aboutData(info.name(), info.name(), info.version(), info.comment(), KAboutLicense::byKeyword(info.license()).key(), QString(), QString(), info.website()); aboutData.addAuthor(info.author(), QString(), info.email()); KAboutApplicationDialog aboutPlugin(aboutData, this); aboutPlugin.setWindowIcon(QIcon::fromTheme(info.icon())); aboutPlugin.exec(); }
void PlasmaMuleApplet::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { QStringList::const_iterator constIterator; QMenu menu; if (m_catDirs.count() == 1) { menu.addAction (KIcon("folder"), QString("Default")); } else { QMenu *open_sub_menu = menu.addMenu("Open Incoming"); for (constIterator = m_catNames.constBegin(); constIterator != m_catNames.constEnd(); constIterator++) { open_sub_menu->addAction(KIcon("folder"), "Folder for " + *constIterator); if (constIterator != m_catNames.constEnd()) { open_sub_menu->addSeparator(); } } menu.addSeparator(); } QClipboard* clipboard = QApplication::clipboard(); if (!clipboard->text(QClipboard::Clipboard).isEmpty() || !clipboard->text(QClipboard::Selection).isEmpty()) { if (m_catDirs.count() == 1) { if (!clipboard->text(QClipboard::Clipboard).isEmpty()) { menu.addAction(KIcon("arrow-down-double"), "Download Link from Clipboard"); if (!clipboard->text(QClipboard::Selection).isEmpty()) { menu.addSeparator(); } } if (!clipboard->text(QClipboard::Selection).isEmpty()) { menu.addAction(KIcon("arrow-down-double"), "Download Link from Selection"); } } else { QMenu *download_sub_menu = menu.addMenu("Download Link"); for (constIterator = m_catNames.constBegin(); constIterator != m_catNames.constEnd(); constIterator++) { if (!clipboard->text(QClipboard::Clipboard).isEmpty()) { download_sub_menu->addAction(KIcon("arrow-down-double"), "Clipboard->" + *constIterator); if (!clipboard->text(QClipboard::Selection).isEmpty()) { download_sub_menu->addSeparator(); } } if (!clipboard->text(QClipboard::Selection).isEmpty()) { download_sub_menu->addAction(KIcon("arrow-down-double"), "Selection->" + *constIterator); } if (constIterator != m_catNames.constEnd()) { download_sub_menu->addSeparator(); } } } } menu.addSeparator(); menu.addAction(KIcon("documentinfo"), "About"); QAction* selectedItem = menu.exec(QCursor::pos()); if (selectedItem) { if (selectedItem->text() == "About") { KPluginInfo* service = new KPluginInfo (KService::serviceByDesktopName ("plasma-applet-plasmamule")); KAboutData* aboutData = new KAboutData (service->name().toUtf8(), service->name().toUtf8(), ki18n(service->pluginName().toUtf8()), service->version().toUtf8(), ki18n(service->comment().toUtf8()), KAboutData::License_GPL_V3, ki18n(QByteArray()), ki18n(QByteArray()), service->website().toLatin1(), service->email().toLatin1()); aboutData->addAuthor (ki18n(service->author().toUtf8()), ki18n(QByteArray()), service->email().toLatin1(), service->website().toLatin1()); aboutData->setTranslator(ki18nc ("NAME OF TRANSLATORS", "Your names"), ki18nc("EMAIL OF TRANSLATORS", "Your emails")); aboutData->setProgramIconName (service->icon()); KAboutApplicationDialog* about = new KAboutApplicationDialog(aboutData, KAboutApplicationDialog::HideTranslators); about->exec(); } else if (selectedItem->text().startsWith("Folder for")) { kDebug(m_debugChannel) << "Opening Folder " << m_catDirs.at(m_catNames.indexOf(selectedItem->text().remove("Folder for "))); KUrl url(m_catDirs.at(m_catNames.indexOf(selectedItem->text().remove("Folder for "))) + "/"); (void) new KRun( url, 0, true ); } else if (selectedItem->text().startsWith("Download")) { if (selectedItem->text().remove("Download Link from ") == "Clipboard") { sendLinkToEngine (clipboard->text(QClipboard::Clipboard), 0, this, m_debugChannel); } else { sendLinkToEngine (clipboard->text(QClipboard::Selection), 0, this, m_debugChannel); } } else if (selectedItem->text().startsWith("Clipboard->")) { sendLinkToEngine (clipboard->text(QClipboard::Clipboard), m_catNames.indexOf(selectedItem->text().remove("Clipboard->")), this, m_debugChannel); } else if (selectedItem->text().startsWith("Selection->")) { sendLinkToEngine (clipboard->text(QClipboard::Selection), m_catNames.indexOf(selectedItem->text().remove("Selection->")), this, m_debugChannel); } } }