Changeset View
Changeset View
Standalone View
Standalone View
plugins/switchtobuddy/switchtobuddyplugin.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | |||||
96 | { | 96 | { | ||
97 | setXMLFile(QStringLiteral("kdevswitchtobuddy.rc")); | 97 | setXMLFile(QStringLiteral("kdevswitchtobuddy.rc")); | ||
98 | } | 98 | } | ||
99 | 99 | | |||
100 | SwitchToBuddyPlugin::~SwitchToBuddyPlugin() | 100 | SwitchToBuddyPlugin::~SwitchToBuddyPlugin() | ||
101 | { | 101 | { | ||
102 | } | 102 | } | ||
103 | 103 | | |||
104 | ContextMenuExtension SwitchToBuddyPlugin::contextMenuExtension(Context* context) | 104 | ContextMenuExtension SwitchToBuddyPlugin::contextMenuExtension(Context* context, QWidget* parent) | ||
105 | { | 105 | { | ||
106 | EditorContext* ctx = dynamic_cast<EditorContext*>(context); | 106 | EditorContext* ctx = dynamic_cast<EditorContext*>(context); | ||
107 | if (!ctx) { | 107 | if (!ctx) { | ||
108 | return ContextMenuExtension(); | 108 | return ContextMenuExtension(); | ||
109 | } | 109 | } | ||
110 | 110 | | |||
111 | QUrl currentUrl = ctx->url(); | 111 | QUrl currentUrl = ctx->url(); | ||
112 | IBuddyDocumentFinder* buddyFinder = IBuddyDocumentFinder::finderForMimeType(QMimeDatabase().mimeTypeForUrl(currentUrl).name()); | 112 | IBuddyDocumentFinder* buddyFinder = IBuddyDocumentFinder::finderForMimeType(QMimeDatabase().mimeTypeForUrl(currentUrl).name()); | ||
Show All 11 Lines | |||||
124 | } | 124 | } | ||
125 | m_signalMapper = new QSignalMapper(this); | 125 | m_signalMapper = new QSignalMapper(this); | ||
126 | 126 | | |||
127 | foreach(const QUrl& url, potentialBuddies) { | 127 | foreach(const QUrl& url, potentialBuddies) { | ||
128 | if (!QFile::exists(url.toLocalFile())) { | 128 | if (!QFile::exists(url.toLocalFile())) { | ||
129 | continue; | 129 | continue; | ||
130 | } | 130 | } | ||
131 | 131 | | |||
132 | QAction* action = new QAction(i18n("Switch to '%1'", url.fileName()), this); | 132 | QAction* action = new QAction(i18n("Switch to '%1'", url.fileName()), parent); | ||
133 | connect(action, &QAction::triggered, m_signalMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map), Qt::QueuedConnection); | 133 | connect(action, &QAction::triggered, m_signalMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map), Qt::QueuedConnection); | ||
134 | m_signalMapper->setMapping(action, url.toLocalFile()); | 134 | m_signalMapper->setMapping(action, url.toLocalFile()); | ||
135 | connect(m_signalMapper, static_cast<void(QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped), | 135 | connect(m_signalMapper, static_cast<void(QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped), | ||
136 | this, &SwitchToBuddyPlugin::switchToBuddy, Qt::QueuedConnection); | 136 | this, &SwitchToBuddyPlugin::switchToBuddy, Qt::QueuedConnection); | ||
137 | extension.addAction(ContextMenuExtension::NavigationGroup, action); | 137 | extension.addAction(ContextMenuExtension::NavigationGroup, action); | ||
138 | } | 138 | } | ||
139 | 139 | | |||
140 | return extension; | 140 | return extension; | ||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |