mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
add notebooknodeexplorer shortcut copy paste (#2088)
* add notebooknodeexplorer shortcut copy paste * simplify code and add isActionFromMaster function * add const * adj ann * adj return
This commit is contained in:
parent
bbab5cc223
commit
0cadea231a
@ -69,6 +69,8 @@ namespace vnotex
|
||||
MoveOneSplitRight,
|
||||
OpenLastClosedFile,
|
||||
UnitedEntry,
|
||||
Copy,
|
||||
Paste,
|
||||
MaxShortcut
|
||||
};
|
||||
Q_ENUM(Shortcut)
|
||||
|
@ -60,7 +60,9 @@
|
||||
"MoveOneSplitUp" : "Ctrl+G, Shift+K",
|
||||
"MoveOneSplitRight" : "Ctrl+G, Shift+L",
|
||||
"OpenLastClosedFile" : "Ctrl+Shift+T",
|
||||
"UnitedEntry" : "Ctrl+G, G"
|
||||
"UnitedEntry" : "Ctrl+G, G",
|
||||
"Copy" : "Ctrl+C",
|
||||
"Paste" : "Ctrl+V"
|
||||
},
|
||||
"file_type_suffixes" : [
|
||||
{
|
||||
|
@ -2163,6 +2163,15 @@ void NotebookNodeExplorer::addOpenWithMenu(QMenu *p_menu, bool p_master)
|
||||
});
|
||||
}
|
||||
|
||||
// Shortcut auxiliary, it can also be used to determine the browser.
|
||||
bool NotebookNodeExplorer::isActionFromMaster() const
|
||||
{
|
||||
if (!isCombinedExploreMode()) {
|
||||
return m_masterExplorer->hasFocus();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void NotebookNodeExplorer::setupShortcuts()
|
||||
{
|
||||
const auto &coreConfig = ConfigMgr::getInst().getCoreConfig();
|
||||
@ -2173,15 +2182,31 @@ void NotebookNodeExplorer::setupShortcuts()
|
||||
if (shortcut) {
|
||||
connect(shortcut, &QShortcut::activated,
|
||||
this, [this]() {
|
||||
bool isMaster = true;
|
||||
if (!isCombinedExploreMode()) {
|
||||
isMaster = m_masterExplorer->hasFocus();
|
||||
}
|
||||
openSelectedNodesWithProgram(QString(), isMaster);
|
||||
openSelectedNodesWithProgram(QString(), isActionFromMaster());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Copy
|
||||
{
|
||||
auto shortcut = WidgetUtils::createShortcut(coreConfig.getShortcut(CoreConfig::Copy), this);
|
||||
if (shortcut) {
|
||||
connect(shortcut, &QShortcut::activated,
|
||||
this, [this]() {
|
||||
copySelectedNodes(false, isActionFromMaster());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Paste
|
||||
{
|
||||
auto shortcut = WidgetUtils::createShortcut(coreConfig.getShortcut(CoreConfig::Paste), this);
|
||||
if (shortcut) {
|
||||
connect(shortcut, &QShortcut::activated,
|
||||
this, &NotebookNodeExplorer::pasteNodesFromClipboard);
|
||||
}
|
||||
}
|
||||
|
||||
const auto &sessionConfig = ConfigMgr::getInst().getSessionConfig();
|
||||
for (const auto &pro : sessionConfig.getExternalPrograms()) {
|
||||
auto shortcut = WidgetUtils::createShortcut(pro.m_shortcut, this);
|
||||
|
@ -176,6 +176,8 @@ namespace vnotex
|
||||
|
||||
void setupUI();
|
||||
|
||||
bool isActionFromMaster() const;
|
||||
|
||||
void setupShortcuts();
|
||||
|
||||
void setupMasterExplorer(QWidget *p_parent = nullptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user