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,
|
MoveOneSplitRight,
|
||||||
OpenLastClosedFile,
|
OpenLastClosedFile,
|
||||||
UnitedEntry,
|
UnitedEntry,
|
||||||
|
Copy,
|
||||||
|
Paste,
|
||||||
MaxShortcut
|
MaxShortcut
|
||||||
};
|
};
|
||||||
Q_ENUM(Shortcut)
|
Q_ENUM(Shortcut)
|
||||||
|
@ -60,7 +60,9 @@
|
|||||||
"MoveOneSplitUp" : "Ctrl+G, Shift+K",
|
"MoveOneSplitUp" : "Ctrl+G, Shift+K",
|
||||||
"MoveOneSplitRight" : "Ctrl+G, Shift+L",
|
"MoveOneSplitRight" : "Ctrl+G, Shift+L",
|
||||||
"OpenLastClosedFile" : "Ctrl+Shift+T",
|
"OpenLastClosedFile" : "Ctrl+Shift+T",
|
||||||
"UnitedEntry" : "Ctrl+G, G"
|
"UnitedEntry" : "Ctrl+G, G",
|
||||||
|
"Copy" : "Ctrl+C",
|
||||||
|
"Paste" : "Ctrl+V"
|
||||||
},
|
},
|
||||||
"file_type_suffixes" : [
|
"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()
|
void NotebookNodeExplorer::setupShortcuts()
|
||||||
{
|
{
|
||||||
const auto &coreConfig = ConfigMgr::getInst().getCoreConfig();
|
const auto &coreConfig = ConfigMgr::getInst().getCoreConfig();
|
||||||
@ -2173,15 +2182,31 @@ void NotebookNodeExplorer::setupShortcuts()
|
|||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
connect(shortcut, &QShortcut::activated,
|
connect(shortcut, &QShortcut::activated,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
bool isMaster = true;
|
openSelectedNodesWithProgram(QString(), isActionFromMaster());
|
||||||
if (!isCombinedExploreMode()) {
|
|
||||||
isMaster = m_masterExplorer->hasFocus();
|
|
||||||
}
|
|
||||||
openSelectedNodesWithProgram(QString(), isMaster);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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();
|
const auto &sessionConfig = ConfigMgr::getInst().getSessionConfig();
|
||||||
for (const auto &pro : sessionConfig.getExternalPrograms()) {
|
for (const auto &pro : sessionConfig.getExternalPrograms()) {
|
||||||
auto shortcut = WidgetUtils::createShortcut(pro.m_shortcut, this);
|
auto shortcut = WidgetUtils::createShortcut(pro.m_shortcut, this);
|
||||||
|
@ -176,6 +176,8 @@ namespace vnotex
|
|||||||
|
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
|
bool isActionFromMaster() const;
|
||||||
|
|
||||||
void setupShortcuts();
|
void setupShortcuts();
|
||||||
|
|
||||||
void setupMasterExplorer(QWidget *p_parent = nullptr);
|
void setupMasterExplorer(QWidget *p_parent = nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user