| 224 | } |
| 225 | |
| 226 | void ContextBrowserPlugin::createActionsForMainWindow(Sublime::MainWindow* window, QString& xmlFile, |
| 227 | KActionCollection& actions) |
| 228 | { |
| 229 | xmlFile = QStringLiteral("kdevcontextbrowser.rc"); |
| 230 | |
| 231 | QAction* sourceBrowseMode = actions.addAction(QStringLiteral("source_browse_mode")); |
| 232 | sourceBrowseMode->setText(i18nc("@action", "Source &Browse Mode")); |
| 233 | sourceBrowseMode->setIcon(QIcon::fromTheme(QStringLiteral("arrow-up"))); |
| 234 | sourceBrowseMode->setCheckable(true); |
| 235 | connect(sourceBrowseMode, &QAction::triggered, m_browseManager, &BrowseManager::setBrowsing); |
| 236 | |
| 237 | QAction* previousContext = actions.addAction(QStringLiteral("previous_context")); |
| 238 | previousContext->setText(i18nc("@action", "&Previous Visited Context")); |
| 239 | previousContext->setIcon(QIcon::fromTheme(QStringLiteral("go-previous-context"))); |
| 240 | actions.setDefaultShortcut(previousContext, Qt::META | Qt::Key_Left); |
| 241 | QObject::connect(previousContext, &QAction::triggered, this, &ContextBrowserPlugin::previousContextShortcut); |
| 242 | |
| 243 | QAction* nextContext = actions.addAction(QStringLiteral("next_context")); |
| 244 | nextContext->setText(i18nc("@action", "&Next Visited Context")); |
| 245 | nextContext->setIcon(QIcon::fromTheme(QStringLiteral("go-next-context"))); |
| 246 | actions.setDefaultShortcut(nextContext, Qt::META | Qt::Key_Right); |
| 247 | QObject::connect(nextContext, &QAction::triggered, this, &ContextBrowserPlugin::nextContextShortcut); |
| 248 | |
| 249 | QAction* previousUse = actions.addAction(QStringLiteral("previous_use")); |
| 250 | previousUse->setText(i18nc("@action", "&Previous Use")); |
| 251 | previousUse->setIcon(QIcon::fromTheme(QStringLiteral("go-previous-use"))); |
| 252 | actions.setDefaultShortcut(previousUse, Qt::META | Qt::SHIFT | Qt::Key_Left); |
| 253 | QObject::connect(previousUse, &QAction::triggered, this, &ContextBrowserPlugin::previousUseShortcut); |
| 254 | |
| 255 | QAction* nextUse = actions.addAction(QStringLiteral("next_use")); |
| 256 | nextUse->setText(i18nc("@action", "&Next Use")); |
| 257 | nextUse->setIcon(QIcon::fromTheme(QStringLiteral("go-next-use"))); |
| 258 | actions.setDefaultShortcut(nextUse, Qt::META | Qt::SHIFT | Qt::Key_Right); |
| 259 | QObject::connect(nextUse, &QAction::triggered, this, &ContextBrowserPlugin::nextUseShortcut); |
| 260 | |
| 261 | auto* outline = new QWidgetAction(this); |
| 262 | outline->setText(i18nc("@action", "Context Browser")); |
| 263 | QWidget* w = toolbarWidgetForMainWindow(window); |
| 264 | w->setHidden(false); |
| 265 | outline->setDefaultWidget(w); |
| 266 | actions.addAction(QStringLiteral("outline_line"), outline); |
| 267 | // Add to the actioncollection so one can set global shortcuts for the action |
| 268 | actions.addAction(QStringLiteral("find_uses"), m_findUses); |
| 269 | } |
| 270 | |
| 271 | void ContextBrowserPlugin::nextContextShortcut() |
| 272 | { |