forked from qt-creator/qt-creator
Welcome: Reimplement session and project shortcuts
Got disabled in 16944277d2 during
refactoring.
Delegates and models are not the right places for registering commands,
since there can be multiple instances. Do registration in project
welcome page, and let delegates retrieve shortcut string from the
models.
Task-number: QTCREATORBUG-17881
Change-Id: I06e3c29e57ee893865bf108a2f13bdb385c26d70
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
|
||||
#include "sessiondialog.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/stringutils.h>
|
||||
@@ -35,6 +38,8 @@
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
@@ -146,6 +151,11 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
|
||||
case ProjectsDisplayRole:
|
||||
result = pathsToBaseNames(SessionManager::projectsForSessionName(sessionName));
|
||||
break;
|
||||
case ShortcutRole: {
|
||||
const Id sessionBase = SESSION_BASE_ID;
|
||||
if (Command *cmd = ActionManager::command(sessionBase.withSuffix(index.row() + 1)))
|
||||
result = cmd->keySequence().toString(QKeySequence::NativeText);
|
||||
} break;
|
||||
} // switch (role)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user