mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: use platform-specific text of QKeySequence in context menu
This commit is contained in:
parent
d6ca4245d9
commit
d2ef9608fc
@ -20,6 +20,7 @@
|
|||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
#include <QKeySequence>
|
||||||
|
|
||||||
#include "vfile.h"
|
#include "vfile.h"
|
||||||
#include "vnote.h"
|
#include "vnote.h"
|
||||||
@ -696,3 +697,8 @@ void VUtils::decodeUrl(QString &p_url)
|
|||||||
p_url.replace(it.key(), it.value());
|
p_url.replace(it.key(), it.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString VUtils::getShortcutText(const QString &p_keySeq)
|
||||||
|
{
|
||||||
|
return QKeySequence(p_keySeq).toString(QKeySequence::NativeText);
|
||||||
|
}
|
||||||
|
@ -121,6 +121,9 @@ public:
|
|||||||
// Decode URL by simply replacing meta-characters.
|
// Decode URL by simply replacing meta-characters.
|
||||||
static void decodeUrl(QString &p_url);
|
static void decodeUrl(QString &p_url);
|
||||||
|
|
||||||
|
// Returns the shortcut text.
|
||||||
|
static QString getShortcutText(const QString &p_keySeq);
|
||||||
|
|
||||||
// Regular expression for image link.
|
// Regular expression for image link.
|
||||||
// 
|
// 
|
||||||
// Captured texts (need to be trimmed):
|
// Captured texts (need to be trimmed):
|
||||||
|
@ -88,25 +88,25 @@ void VDirectoryTree::initActions()
|
|||||||
this, &VDirectoryTree::deleteDirectory);
|
this, &VDirectoryTree::deleteDirectory);
|
||||||
|
|
||||||
dirInfoAct = new QAction(QIcon(":/resources/icons/dir_info.svg"),
|
dirInfoAct = new QAction(QIcon(":/resources/icons/dir_info.svg"),
|
||||||
tr("&Info\t%1").arg(QKeySequence(c_infoShortcutSequence).toString()), this);
|
tr("&Info\t%1").arg(VUtils::getShortcutText(c_infoShortcutSequence)), this);
|
||||||
dirInfoAct->setToolTip(tr("View and edit current folder's information"));
|
dirInfoAct->setToolTip(tr("View and edit current folder's information"));
|
||||||
connect(dirInfoAct, &QAction::triggered,
|
connect(dirInfoAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::editDirectoryInfo);
|
this, &VDirectoryTree::editDirectoryInfo);
|
||||||
|
|
||||||
copyAct = new QAction(QIcon(":/resources/icons/copy.svg"),
|
copyAct = new QAction(QIcon(":/resources/icons/copy.svg"),
|
||||||
tr("&Copy\t%1").arg(QKeySequence(c_copyShortcutSequence).toString()), this);
|
tr("&Copy\t%1").arg(VUtils::getShortcutText(c_copyShortcutSequence)), this);
|
||||||
copyAct->setToolTip(tr("Copy selected folders"));
|
copyAct->setToolTip(tr("Copy selected folders"));
|
||||||
connect(copyAct, &QAction::triggered,
|
connect(copyAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::copySelectedDirectories);
|
this, &VDirectoryTree::copySelectedDirectories);
|
||||||
|
|
||||||
cutAct = new QAction(QIcon(":/resources/icons/cut.svg"),
|
cutAct = new QAction(QIcon(":/resources/icons/cut.svg"),
|
||||||
tr("C&ut\t%1").arg(QKeySequence(c_cutShortcutSequence).toString()), this);
|
tr("C&ut\t%1").arg(VUtils::getShortcutText(c_cutShortcutSequence)), this);
|
||||||
cutAct->setToolTip(tr("Cut selected folders"));
|
cutAct->setToolTip(tr("Cut selected folders"));
|
||||||
connect(cutAct, &QAction::triggered,
|
connect(cutAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::cutSelectedDirectories);
|
this, &VDirectoryTree::cutSelectedDirectories);
|
||||||
|
|
||||||
pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"),
|
pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"),
|
||||||
tr("&Paste\t%1").arg(QKeySequence(c_pasteShortcutSequence).toString()), this);
|
tr("&Paste\t%1").arg(VUtils::getShortcutText(c_pasteShortcutSequence)), this);
|
||||||
pasteAct->setToolTip(tr("Paste folders in this folder"));
|
pasteAct->setToolTip(tr("Paste folders in this folder"));
|
||||||
connect(pasteAct, &QAction::triggered,
|
connect(pasteAct, &QAction::triggered,
|
||||||
this, &VDirectoryTree::pasteDirectoriesInCurDir);
|
this, &VDirectoryTree::pasteDirectoriesInCurDir);
|
||||||
|
@ -85,7 +85,7 @@ void VFileList::initActions()
|
|||||||
{
|
{
|
||||||
newFileAct = new QAction(QIcon(":/resources/icons/create_note.svg"),
|
newFileAct = new QAction(QIcon(":/resources/icons/create_note.svg"),
|
||||||
tr("&New Note"), this);
|
tr("&New Note"), this);
|
||||||
QString shortcutStr = QKeySequence(g_config->getShortcutKeySequence("NewNote")).toString();
|
QString shortcutStr = VUtils::getShortcutText(g_config->getShortcutKeySequence("NewNote"));
|
||||||
if (!shortcutStr.isEmpty()) {
|
if (!shortcutStr.isEmpty()) {
|
||||||
newFileAct->setText(tr("&New Note\t%1").arg(shortcutStr));
|
newFileAct->setText(tr("&New Note\t%1").arg(shortcutStr));
|
||||||
}
|
}
|
||||||
@ -101,25 +101,25 @@ void VFileList::initActions()
|
|||||||
this, SLOT(deleteFile()));
|
this, SLOT(deleteFile()));
|
||||||
|
|
||||||
fileInfoAct = new QAction(QIcon(":/resources/icons/note_info.svg"),
|
fileInfoAct = new QAction(QIcon(":/resources/icons/note_info.svg"),
|
||||||
tr("&Info\t%1").arg(QKeySequence(c_infoShortcutSequence).toString()), this);
|
tr("&Info\t%1").arg(VUtils::getShortcutText(c_infoShortcutSequence)), this);
|
||||||
fileInfoAct->setToolTip(tr("View and edit current note's information"));
|
fileInfoAct->setToolTip(tr("View and edit current note's information"));
|
||||||
connect(fileInfoAct, SIGNAL(triggered(bool)),
|
connect(fileInfoAct, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(fileInfo()));
|
this, SLOT(fileInfo()));
|
||||||
|
|
||||||
copyAct = new QAction(QIcon(":/resources/icons/copy.svg"),
|
copyAct = new QAction(QIcon(":/resources/icons/copy.svg"),
|
||||||
tr("&Copy\t%1").arg(QKeySequence(c_copyShortcutSequence).toString()), this);
|
tr("&Copy\t%1").arg(VUtils::getShortcutText(c_copyShortcutSequence)), this);
|
||||||
copyAct->setToolTip(tr("Copy selected notes"));
|
copyAct->setToolTip(tr("Copy selected notes"));
|
||||||
connect(copyAct, &QAction::triggered,
|
connect(copyAct, &QAction::triggered,
|
||||||
this, &VFileList::copySelectedFiles);
|
this, &VFileList::copySelectedFiles);
|
||||||
|
|
||||||
cutAct = new QAction(QIcon(":/resources/icons/cut.svg"),
|
cutAct = new QAction(QIcon(":/resources/icons/cut.svg"),
|
||||||
tr("C&ut\t%1").arg(QKeySequence(c_cutShortcutSequence).toString()), this);
|
tr("C&ut\t%1").arg(VUtils::getShortcutText(c_cutShortcutSequence)), this);
|
||||||
cutAct->setToolTip(tr("Cut selected notes"));
|
cutAct->setToolTip(tr("Cut selected notes"));
|
||||||
connect(cutAct, &QAction::triggered,
|
connect(cutAct, &QAction::triggered,
|
||||||
this, &VFileList::cutSelectedFiles);
|
this, &VFileList::cutSelectedFiles);
|
||||||
|
|
||||||
pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"),
|
pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"),
|
||||||
tr("&Paste\t%1").arg(QKeySequence(c_pasteShortcutSequence).toString()), this);
|
tr("&Paste\t%1").arg(VUtils::getShortcutText(c_pasteShortcutSequence)), this);
|
||||||
pasteAct->setToolTip(tr("Paste notes in current folder"));
|
pasteAct->setToolTip(tr("Paste notes in current folder"));
|
||||||
connect(pasteAct, &QAction::triggered,
|
connect(pasteAct, &QAction::triggered,
|
||||||
this, &VFileList::pasteFilesInCurDir);
|
this, &VFileList::pasteFilesInCurDir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user