Assign some keyboard shortcuts to task handlers

Change-Id: I21ae01ab393825728b63eb20fd34bec67b892e86
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Tobias Hunger
2012-10-05 14:37:05 +02:00
committed by Eike Ziller
parent 432de3a198
commit b9e21803d6
5 changed files with 16 additions and 3 deletions

View File

@@ -30,8 +30,10 @@
#include "copytaskhandler.h" #include "copytaskhandler.h"
#include "task.h" #include "task.h"
#include "taskwindow.h"
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <QDir> #include <QDir>
#include <QAction> #include <QAction>
@@ -61,9 +63,13 @@ void CopyTaskHandler::handle(const ProjectExplorer::Task &task)
+ type + task.description); + type + task.description);
} }
Core::Id CopyTaskHandler::actionManagerId() const
{
return Core::Id(Core::Constants::COPY);
}
QAction *CopyTaskHandler::createAction(QObject *parent) const QAction *CopyTaskHandler::createAction(QObject *parent) const
{ {
QAction *copyAction = new QAction(tr("&Copy", "Name of the action triggering the copytaskhandler"), parent); QAction *copyAction = new QAction(parent);
copyAction->setToolTip(tr("Copy task to clipboard"));
return copyAction; return copyAction;
} }

View File

@@ -44,6 +44,7 @@ public:
bool canHandle(const Task &) const { return true; } bool canHandle(const Task &) const { return true; }
void handle(const Task &task); void handle(const Task &task);
Core::Id actionManagerId() const;
QAction *createAction(QObject *parent) const; QAction *createAction(QObject *parent) const;
}; };

View File

@@ -52,5 +52,7 @@ QAction *RemoveTaskHandler::createAction(QObject *parent) const
{ {
QAction *removeAction = new QAction(tr("Remove", "Name of the action triggering the removetaskhandler"), parent); QAction *removeAction = new QAction(tr("Remove", "Name of the action triggering the removetaskhandler"), parent);
removeAction->setToolTip(tr("Remove task from the task list")); removeAction->setToolTip(tr("Remove task from the task list"));
removeAction->setShortcut(QKeySequence(QKeySequence::Delete));
removeAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
return removeAction; return removeAction;
} }

View File

@@ -55,7 +55,9 @@ void ShowInEditorTaskHandler::handle(const ProjectExplorer::Task &task)
QAction *ShowInEditorTaskHandler::createAction(QObject *parent) const QAction *ShowInEditorTaskHandler::createAction(QObject *parent) const
{ {
QAction *showAction = new QAction(tr("&Show in Editor"), parent); QAction *showAction = new QAction(tr("Show in Editor"), parent);
showAction->setToolTip(tr("Show task location in an editor.")); showAction->setToolTip(tr("Show task location in an editor."));
showAction->setShortcut(QKeySequence(Qt::Key_Return));
showAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
return showAction; return showAction;
} }

View File

@@ -61,5 +61,7 @@ QAction *ShowOutputTaskHandler::createAction(QObject *parent) const
{ {
QAction *outputAction = new QAction(tr("Show &Output"), parent); QAction *outputAction = new QAction(tr("Show &Output"), parent);
outputAction->setToolTip(tr("Show output generating this issue.")); outputAction->setToolTip(tr("Show output generating this issue."));
outputAction->setShortcut(QKeySequence(tr("O")));
outputAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
return outputAction; return outputAction;
} }