mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
support Flash Page
Ctrl+Alt+L to edit Flash Page. Config flash_page gives the path of the flash page.
This commit is contained in:
parent
c2973d9e23
commit
8d568e6e23
17
src/resources/icons/flash_page.svg
Normal file
17
src/resources/icons/flash_page.svg
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<path d="M400,172.9C400,95.1,333.9,32,256,32c-77.9,0-144,63.1-144,141c0,31,13.2,59,30.2,83h-0.3c10.9,15,21.4,27.7,31.5,45
|
||||||
|
c22,37.8,18.6,74.3,18.7,81.6v1.4h128v-1.4c0-8.9-3.6-43.8,18.4-81.6c10.1-17.3,20.6-30,31.5-45h-0.1C386.8,232,400,204,400,172.9z
|
||||||
|
M351,254.4c-0.6,0.8-1.1,1.5-1.7,2.3c-8.1,10.9-16.5,22.2-24.7,36.1c-17.3,29.7-20.4,57.9-20.8,75.1H288V256l32-64h-16.6L272,256
|
||||||
|
v112h-32V256l-31.4-64H192l32,64v112h-15.9c-0.5-17.2-3.9-45.7-20.9-75c-4.5-7.7-9.1-15-13.7-21h0.2l-18.6-25.6
|
||||||
|
c-15.8-21.6-27.1-47.1-27.1-73.6c0-33.4,16-64.8,39.6-88.4s55-36.7,88.4-36.7c33.4,0,64.8,13.1,88.4,36.7
|
||||||
|
c23.6,23.6,39.6,55,39.6,88.4c0,26.5-11.3,51.9-27.1,73.5L351,254.4z"/>
|
||||||
|
<rect x="224" y="464" width="64" height="16"/>
|
||||||
|
<rect x="208" y="432" width="96" height="16"/>
|
||||||
|
<rect x="208" y="400" width="96" height="16"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -170,6 +170,10 @@ enable_backup_file=true
|
|||||||
; v: Ctrl+V
|
; v: Ctrl+V
|
||||||
vim_exemption_keys=cv
|
vim_exemption_keys=cv
|
||||||
|
|
||||||
|
; Path of the flash page, related to the configuration folder
|
||||||
|
; Could be absolute path
|
||||||
|
flash_page=flash_page.md
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
; Location and configuration for Mathjax
|
; Location and configuration for Mathjax
|
||||||
mathjax_javascript=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML
|
mathjax_javascript=https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML
|
||||||
@ -215,6 +219,8 @@ LastClosedFile=Ctrl+Shift+T
|
|||||||
ActivateNextTab=Ctrl+Tab
|
ActivateNextTab=Ctrl+Tab
|
||||||
; Activate previous tab
|
; Activate previous tab
|
||||||
ActivatePreviousTab=Ctrl+Shift+Tab
|
ActivatePreviousTab=Ctrl+Shift+Tab
|
||||||
|
; Activate flash page
|
||||||
|
FlashPage=Ctrl+Alt+L
|
||||||
|
|
||||||
[captain_mode_shortcuts]
|
[captain_mode_shortcuts]
|
||||||
; Define shortcuts in Captain mode here.
|
; Define shortcuts in Captain mode here.
|
||||||
|
@ -1055,3 +1055,14 @@ bool VUtils::isControlModifierForVim(int p_modifiers)
|
|||||||
return p_modifiers == Qt::ControlModifier;
|
return p_modifiers == Qt::ControlModifier;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VUtils::touchFile(const QString &p_file)
|
||||||
|
{
|
||||||
|
QFile file(p_file);
|
||||||
|
if (!file.open(QIODevice::WriteOnly)) {
|
||||||
|
qWarning() << "fail to touch file" << p_file;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
@ -255,6 +255,9 @@ public:
|
|||||||
// See if @p_modifiers is Control which is different on macOs and Windows.
|
// See if @p_modifiers is Control which is different on macOs and Windows.
|
||||||
static bool isControlModifierForVim(int p_modifiers);
|
static bool isControlModifierForVim(int p_modifiers);
|
||||||
|
|
||||||
|
// If @p_file does not exists, create an empty file.
|
||||||
|
static void touchFile(const QString &p_file);
|
||||||
|
|
||||||
// Regular expression for image link.
|
// Regular expression for image link.
|
||||||
// 
|
// 
|
||||||
// Captured texts (need to be trimmed):
|
// Captured texts (need to be trimmed):
|
||||||
|
@ -1111,8 +1111,8 @@ QHash<QString, QString> VConfigManager::readShortcutsFromSettings(QSettings *p_s
|
|||||||
|
|
||||||
bool VConfigManager::isValidKeySequence(const QString &p_seq)
|
bool VConfigManager::isValidKeySequence(const QString &p_seq)
|
||||||
{
|
{
|
||||||
return p_seq.toLower() != "ctrl+q"
|
return p_seq.isEmpty()
|
||||||
&& !QKeySequence(p_seq).isEmpty();
|
|| (p_seq.toLower() != "ctrl+q" && !QKeySequence(p_seq).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void VConfigManager::readShortcutsFromSettings()
|
void VConfigManager::readShortcutsFromSettings()
|
||||||
@ -1143,10 +1143,9 @@ void VConfigManager::readShortcutsFromSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (matched.size() < m_shortcuts.size()) {
|
if (matched.size() < m_shortcuts.size()) {
|
||||||
|
qDebug() << "override user shortcuts settings using default settings";
|
||||||
writeShortcutsToSettings(userSettings, group, m_shortcuts);
|
writeShortcutsToSettings(userSettings, group, m_shortcuts);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "shortcuts:" << m_shortcuts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VConfigManager::readCaptainShortcutsFromSettings()
|
void VConfigManager::readCaptainShortcutsFromSettings()
|
||||||
@ -1321,3 +1320,26 @@ QVector<QPair<QString, QString>> VConfigManager::getExternalEditors() const
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &VConfigManager::getFlashPage() const
|
||||||
|
{
|
||||||
|
if (m_flashPage.isEmpty()) {
|
||||||
|
VConfigManager *var = const_cast<VConfigManager *>(this);
|
||||||
|
|
||||||
|
var->m_flashPage = var->getConfigFromSettings("global",
|
||||||
|
"flash_page").toString();
|
||||||
|
if (var->m_flashPage.isEmpty()) {
|
||||||
|
var->m_flashPage = var->resetDefaultConfig("global", "flash_page").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VUtils::checkFileNameLegal(m_flashPage)) {
|
||||||
|
var->m_flashPage = QDir(getConfigFolder()).filePath(m_flashPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!QFileInfo::exists(m_flashPage)) {
|
||||||
|
VUtils::touchFile(m_flashPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_flashPage;
|
||||||
|
}
|
||||||
|
@ -389,6 +389,8 @@ public:
|
|||||||
|
|
||||||
const QString &getVimExemptionKeys() const;
|
const QString &getVimExemptionKeys() const;
|
||||||
|
|
||||||
|
const QString &getFlashPage() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Look up a config from user and default settings.
|
// Look up a config from user and default settings.
|
||||||
QVariant getConfigFromSettings(const QString §ion, const QString &key) const;
|
QVariant getConfigFromSettings(const QString §ion, const QString &key) const;
|
||||||
@ -737,6 +739,9 @@ private:
|
|||||||
// v: Ctrl+V
|
// v: Ctrl+V
|
||||||
QString m_vimExemptionKeys;
|
QString m_vimExemptionKeys;
|
||||||
|
|
||||||
|
// Absolute path of flash page.
|
||||||
|
QString m_flashPage;
|
||||||
|
|
||||||
// The name of the config file in each directory, obsolete.
|
// The name of the config file in each directory, obsolete.
|
||||||
// Use c_dirConfigFile instead.
|
// Use c_dirConfigFile instead.
|
||||||
static const QString c_obsoleteDirConfigFile;
|
static const QString c_obsoleteDirConfigFile;
|
||||||
|
@ -71,8 +71,13 @@ VMainWindow::VMainWindow(VSingleInstanceGuard *p_guard, QWidget *p_parent)
|
|||||||
setupUI();
|
setupUI();
|
||||||
|
|
||||||
initMenuBar();
|
initMenuBar();
|
||||||
|
|
||||||
initToolBar();
|
initToolBar();
|
||||||
|
|
||||||
|
initShortcuts();
|
||||||
|
|
||||||
initDockWindows();
|
initDockWindows();
|
||||||
|
|
||||||
initAvatar();
|
initAvatar();
|
||||||
|
|
||||||
restoreStateAndGeometry();
|
restoreStateAndGeometry();
|
||||||
@ -317,7 +322,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
|
|||||||
tr("&Single Panel"),
|
tr("&Single Panel"),
|
||||||
m_viewActGroup);
|
m_viewActGroup);
|
||||||
onePanelViewAct->setStatusTip(tr("Display only the notes list panel"));
|
onePanelViewAct->setStatusTip(tr("Display only the notes list panel"));
|
||||||
onePanelViewAct->setToolTip(tr("Single Panel (Ctrl+E P)"));
|
onePanelViewAct->setToolTip(tr("Single Panel"));
|
||||||
onePanelViewAct->setCheckable(true);
|
onePanelViewAct->setCheckable(true);
|
||||||
onePanelViewAct->setData((int)PanelViewState::SinglePanel);
|
onePanelViewAct->setData((int)PanelViewState::SinglePanel);
|
||||||
|
|
||||||
@ -325,7 +330,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
|
|||||||
tr("&Two Panels"),
|
tr("&Two Panels"),
|
||||||
m_viewActGroup);
|
m_viewActGroup);
|
||||||
twoPanelViewAct->setStatusTip(tr("Display both the folders and notes list panel"));
|
twoPanelViewAct->setStatusTip(tr("Display both the folders and notes list panel"));
|
||||||
twoPanelViewAct->setToolTip(tr("Two Panels (Ctrl+E P)"));
|
twoPanelViewAct->setToolTip(tr("Two Panels"));
|
||||||
twoPanelViewAct->setCheckable(true);
|
twoPanelViewAct->setCheckable(true);
|
||||||
twoPanelViewAct->setData((int)PanelViewState::TwoPanels);
|
twoPanelViewAct->setData((int)PanelViewState::TwoPanels);
|
||||||
|
|
||||||
@ -368,7 +373,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
|
|||||||
panelMenu->addAction(compactViewAct);
|
panelMenu->addAction(compactViewAct);
|
||||||
|
|
||||||
expandViewAct = new QAction(QIcon(":/resources/icons/expand.svg"),
|
expandViewAct = new QAction(QIcon(":/resources/icons/expand.svg"),
|
||||||
tr("Expand (Ctrl+E E)"), this);
|
tr("Expand"), this);
|
||||||
expandViewAct->setStatusTip(tr("Expand the edit area"));
|
expandViewAct->setStatusTip(tr("Expand the edit area"));
|
||||||
expandViewAct->setCheckable(true);
|
expandViewAct->setCheckable(true);
|
||||||
expandViewAct->setMenu(panelMenu);
|
expandViewAct->setMenu(panelMenu);
|
||||||
@ -420,7 +425,8 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
m_editToolBar->addAction(m_headingSequenceAct);
|
m_editToolBar->addAction(m_headingSequenceAct);
|
||||||
|
|
||||||
QAction *boldAct = new QAction(QIcon(":/resources/icons/bold.svg"),
|
QAction *boldAct = new QAction(QIcon(":/resources/icons/bold.svg"),
|
||||||
tr("Bold (Ctrl+B)"), this);
|
tr("Bold\t%1").arg(VUtils::getShortcutText("Ctrl+B")),
|
||||||
|
this);
|
||||||
boldAct->setStatusTip(tr("Insert bold text or change selected text to bold"));
|
boldAct->setStatusTip(tr("Insert bold text or change selected text to bold"));
|
||||||
connect(boldAct, &QAction::triggered,
|
connect(boldAct, &QAction::triggered,
|
||||||
this, [this](){
|
this, [this](){
|
||||||
@ -432,7 +438,8 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
m_editToolBar->addAction(boldAct);
|
m_editToolBar->addAction(boldAct);
|
||||||
|
|
||||||
QAction *italicAct = new QAction(QIcon(":/resources/icons/italic.svg"),
|
QAction *italicAct = new QAction(QIcon(":/resources/icons/italic.svg"),
|
||||||
tr("Italic (Ctrl+I)"), this);
|
tr("Italic\t%1").arg(VUtils::getShortcutText("Ctrl+I")),
|
||||||
|
this);
|
||||||
italicAct->setStatusTip(tr("Insert italic text or change selected text to italic"));
|
italicAct->setStatusTip(tr("Insert italic text or change selected text to italic"));
|
||||||
connect(italicAct, &QAction::triggered,
|
connect(italicAct, &QAction::triggered,
|
||||||
this, [this](){
|
this, [this](){
|
||||||
@ -444,7 +451,8 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
m_editToolBar->addAction(italicAct);
|
m_editToolBar->addAction(italicAct);
|
||||||
|
|
||||||
QAction *strikethroughAct = new QAction(QIcon(":/resources/icons/strikethrough.svg"),
|
QAction *strikethroughAct = new QAction(QIcon(":/resources/icons/strikethrough.svg"),
|
||||||
tr("Strikethrough (Ctrl+D)"), this);
|
tr("Strikethrough\t%1").arg(VUtils::getShortcutText("Ctrl+D")),
|
||||||
|
this);
|
||||||
strikethroughAct->setStatusTip(tr("Insert strikethrough text or change selected text to strikethroughed"));
|
strikethroughAct->setStatusTip(tr("Insert strikethrough text or change selected text to strikethroughed"));
|
||||||
connect(strikethroughAct, &QAction::triggered,
|
connect(strikethroughAct, &QAction::triggered,
|
||||||
this, [this](){
|
this, [this](){
|
||||||
@ -456,7 +464,8 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
m_editToolBar->addAction(strikethroughAct);
|
m_editToolBar->addAction(strikethroughAct);
|
||||||
|
|
||||||
QAction *inlineCodeAct = new QAction(QIcon(":/resources/icons/inline_code.svg"),
|
QAction *inlineCodeAct = new QAction(QIcon(":/resources/icons/inline_code.svg"),
|
||||||
tr("Inline Code (Ctrl+K)"), this);
|
tr("Inline Code\t%1").arg(VUtils::getShortcutText("Ctrl+K")),
|
||||||
|
this);
|
||||||
inlineCodeAct->setStatusTip(tr("Insert inline-code text or change selected text to inline-coded"));
|
inlineCodeAct->setStatusTip(tr("Insert inline-code text or change selected text to inline-coded"));
|
||||||
connect(inlineCodeAct, &QAction::triggered,
|
connect(inlineCodeAct, &QAction::triggered,
|
||||||
this, [this](){
|
this, [this](){
|
||||||
@ -468,7 +477,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
m_editToolBar->addAction(inlineCodeAct);
|
m_editToolBar->addAction(inlineCodeAct);
|
||||||
|
|
||||||
QAction *codeBlockAct = new QAction(QIcon(":/resources/icons/code_block.svg"),
|
QAction *codeBlockAct = new QAction(QIcon(":/resources/icons/code_block.svg"),
|
||||||
tr("Code Block (Ctrl+M)"),
|
tr("Code Block\t%1").arg(VUtils::getShortcutText("Ctrl+M")),
|
||||||
this);
|
this);
|
||||||
codeBlockAct->setStatusTip(tr("Insert fenced code block text or wrap selected text into a fenced code block"));
|
codeBlockAct->setStatusTip(tr("Insert fenced code block text or wrap selected text into a fenced code block"));
|
||||||
connect(codeBlockAct, &QAction::triggered,
|
connect(codeBlockAct, &QAction::triggered,
|
||||||
@ -484,7 +493,8 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
|
|
||||||
// Insert link.
|
// Insert link.
|
||||||
QAction *insetLinkAct = new QAction(QIcon(":/resources/icons/link.svg"),
|
QAction *insetLinkAct = new QAction(QIcon(":/resources/icons/link.svg"),
|
||||||
tr("Insert Link (Ctrl+L)"), this);
|
tr("Insert Link\t%1").arg(VUtils::getShortcutText("Ctrl+L")),
|
||||||
|
this);
|
||||||
insetLinkAct->setStatusTip(tr("Insert a link"));
|
insetLinkAct->setStatusTip(tr("Insert a link"));
|
||||||
connect(insetLinkAct, &QAction::triggered,
|
connect(insetLinkAct, &QAction::triggered,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
@ -538,7 +548,18 @@ void VMainWindow::initNoteToolBar(QSize p_iconSize)
|
|||||||
m_attachmentBtn->setFocusPolicy(Qt::NoFocus);
|
m_attachmentBtn->setFocusPolicy(Qt::NoFocus);
|
||||||
m_attachmentBtn->setEnabled(false);
|
m_attachmentBtn->setEnabled(false);
|
||||||
|
|
||||||
|
QAction *flashPageAct = new QAction(QIcon(":/resources/icons/flash_page.svg"),
|
||||||
|
tr("Flash Page"),
|
||||||
|
this);
|
||||||
|
flashPageAct->setStatusTip(tr("Open the Flash Page to edit"));
|
||||||
|
QString keySeq = g_config->getShortcutKeySequence("FlashPage");
|
||||||
|
qDebug() << "set FlashPage shortcut to" << keySeq;
|
||||||
|
flashPageAct->setShortcut(QKeySequence(keySeq));
|
||||||
|
connect(flashPageAct, &QAction::triggered,
|
||||||
|
this, &VMainWindow::openFlashPage);
|
||||||
|
|
||||||
noteToolBar->addWidget(m_attachmentBtn);
|
noteToolBar->addWidget(m_attachmentBtn);
|
||||||
|
noteToolBar->addAction(flashPageAct);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMainWindow::initFileToolBar(QSize p_iconSize)
|
void VMainWindow::initFileToolBar(QSize p_iconSize)
|
||||||
@ -577,13 +598,6 @@ void VMainWindow::initFileToolBar(QSize p_iconSize)
|
|||||||
connect(deleteNoteAct, &QAction::triggered,
|
connect(deleteNoteAct, &QAction::triggered,
|
||||||
this, &VMainWindow::deleteCurNote);
|
this, &VMainWindow::deleteCurNote);
|
||||||
|
|
||||||
keySeq = g_config->getShortcutKeySequence("CloseNote");
|
|
||||||
qDebug() << "set CloseNote shortcut to" << keySeq;
|
|
||||||
m_closeNoteShortcut = new QShortcut(QKeySequence(keySeq), this);
|
|
||||||
m_closeNoteShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
|
||||||
connect(m_closeNoteShortcut, &QShortcut::activated,
|
|
||||||
this, &VMainWindow::closeCurrentFile);
|
|
||||||
|
|
||||||
editNoteAct = new QAction(QIcon(":/resources/icons/edit_note.svg"),
|
editNoteAct = new QAction(QIcon(":/resources/icons/edit_note.svg"),
|
||||||
tr("&Edit"), this);
|
tr("&Edit"), this);
|
||||||
editNoteAct->setStatusTip(tr("Edit current note"));
|
editNoteAct->setStatusTip(tr("Edit current note"));
|
||||||
@ -596,7 +610,7 @@ void VMainWindow::initFileToolBar(QSize p_iconSize)
|
|||||||
discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"),
|
discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"),
|
||||||
tr("Discard Changes And Read"), this);
|
tr("Discard Changes And Read"), this);
|
||||||
discardExitAct->setStatusTip(tr("Discard changes and exit edit mode"));
|
discardExitAct->setStatusTip(tr("Discard changes and exit edit mode"));
|
||||||
discardExitAct->setToolTip(tr("Discard Changes And Read (Ctrl+E Q)"));
|
discardExitAct->setToolTip(tr("Discard Changes And Read"));
|
||||||
connect(discardExitAct, &QAction::triggered,
|
connect(discardExitAct, &QAction::triggered,
|
||||||
editArea, &VEditArea::readFile);
|
editArea, &VEditArea::readFile);
|
||||||
|
|
||||||
@ -605,7 +619,7 @@ void VMainWindow::initFileToolBar(QSize p_iconSize)
|
|||||||
exitEditMenu->addAction(discardExitAct);
|
exitEditMenu->addAction(discardExitAct);
|
||||||
|
|
||||||
saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"),
|
saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"),
|
||||||
tr("Save Changes And Read (Ctrl+T)"), this);
|
tr("Save Changes And Read"), this);
|
||||||
saveExitAct->setStatusTip(tr("Save changes and exit edit mode"));
|
saveExitAct->setStatusTip(tr("Save changes and exit edit mode"));
|
||||||
saveExitAct->setMenu(exitEditMenu);
|
saveExitAct->setMenu(exitEditMenu);
|
||||||
keySeq = g_config->getShortcutKeySequence("SaveAndRead");
|
keySeq = g_config->getShortcutKeySequence("SaveAndRead");
|
||||||
@ -2424,7 +2438,10 @@ bool VMainWindow::tryOpenInternalFile(const QString &p_filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMainWindow::openFiles(const QStringList &p_files, bool p_forceOrphan)
|
void VMainWindow::openFiles(const QStringList &p_files,
|
||||||
|
bool p_forceOrphan,
|
||||||
|
OpenFileMode p_mode,
|
||||||
|
bool p_forceMode)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < p_files.size(); ++i) {
|
for (int i = 0; i < p_files.size(); ++i) {
|
||||||
VFile *file = NULL;
|
VFile *file = NULL;
|
||||||
@ -2436,7 +2453,7 @@ void VMainWindow::openFiles(const QStringList &p_files, bool p_forceOrphan)
|
|||||||
file = vnote->getOrphanFile(p_files[i], true);
|
file = vnote->getOrphanFile(p_files[i], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
editArea->openFile(file, OpenFileMode::Read);
|
editArea->openFile(file, p_mode, p_forceMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2648,3 +2665,23 @@ void VMainWindow::promptNewNotebookIfEmpty()
|
|||||||
notebookSelector->newNotebook();
|
notebookSelector->newNotebook();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VMainWindow::initShortcuts()
|
||||||
|
{
|
||||||
|
QString keySeq = g_config->getShortcutKeySequence("CloseNote");
|
||||||
|
qDebug() << "set CloseNote shortcut to" << keySeq;
|
||||||
|
if (!keySeq.isEmpty()) {
|
||||||
|
QShortcut *closeNoteShortcut = new QShortcut(QKeySequence(keySeq), this);
|
||||||
|
closeNoteShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
connect(closeNoteShortcut, &QShortcut::activated,
|
||||||
|
this, &VMainWindow::closeCurrentFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VMainWindow::openFlashPage()
|
||||||
|
{
|
||||||
|
openFiles(QStringList() << g_config->getFlashPage(),
|
||||||
|
false,
|
||||||
|
OpenFileMode::Edit,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
@ -34,7 +34,6 @@ class VTabIndicator;
|
|||||||
class VSingleInstanceGuard;
|
class VSingleInstanceGuard;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class QSystemTrayIcon;
|
class QSystemTrayIcon;
|
||||||
class QShortcut;
|
|
||||||
class VButtonWithWidget;
|
class VButtonWithWidget;
|
||||||
class VAttachmentList;
|
class VAttachmentList;
|
||||||
class VSnippetList;
|
class VSnippetList;
|
||||||
@ -72,7 +71,10 @@ public:
|
|||||||
// Open files @p_files as orphan files or internal note files.
|
// Open files @p_files as orphan files or internal note files.
|
||||||
// If @p_forceOrphan is false, for each file, VNote will try to find out if
|
// If @p_forceOrphan is false, for each file, VNote will try to find out if
|
||||||
// it is a note inside VNote. If yes, VNote will open it as internal file.
|
// it is a note inside VNote. If yes, VNote will open it as internal file.
|
||||||
void openFiles(const QStringList &p_files, bool p_forceOrphan = false);
|
void openFiles(const QStringList &p_files,
|
||||||
|
bool p_forceOrphan = false,
|
||||||
|
OpenFileMode p_mode = OpenFileMode::Read,
|
||||||
|
bool p_forceMode = false);
|
||||||
|
|
||||||
// Try to open @p_filePath as internal note.
|
// Try to open @p_filePath as internal note.
|
||||||
bool tryOpenInternalFile(const QString &p_filePath);
|
bool tryOpenInternalFile(const QString &p_filePath);
|
||||||
@ -173,6 +175,9 @@ private slots:
|
|||||||
// Close current note.
|
// Close current note.
|
||||||
void closeCurrentFile();
|
void closeCurrentFile();
|
||||||
|
|
||||||
|
// Open flash page in edit mode.
|
||||||
|
void openFlashPage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||||
@ -254,6 +259,8 @@ private:
|
|||||||
// Only available for writable Markdown file.
|
// Only available for writable Markdown file.
|
||||||
bool isHeadingSequenceApplicable() const;
|
bool isHeadingSequenceApplicable() const;
|
||||||
|
|
||||||
|
void initShortcuts();
|
||||||
|
|
||||||
// Captain mode functions.
|
// Captain mode functions.
|
||||||
|
|
||||||
// Popup the attachment list if it is enabled.
|
// Popup the attachment list if it is enabled.
|
||||||
@ -353,8 +360,6 @@ private:
|
|||||||
// Act group for panel view actions.
|
// Act group for panel view actions.
|
||||||
QActionGroup *m_viewActGroup;
|
QActionGroup *m_viewActGroup;
|
||||||
|
|
||||||
QShortcut *m_closeNoteShortcut;
|
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
QMenu *viewMenu;
|
QMenu *viewMenu;
|
||||||
|
|
||||||
|
@ -142,5 +142,6 @@
|
|||||||
<file>resources/icons/snippet_info.svg</file>
|
<file>resources/icons/snippet_info.svg</file>
|
||||||
<file>resources/icons/apply_snippet.svg</file>
|
<file>resources/icons/apply_snippet.svg</file>
|
||||||
<file>resources/icons/reading_modified.svg</file>
|
<file>resources/icons/reading_modified.svg</file>
|
||||||
|
<file>resources/icons/flash_page.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user