mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
do not support deleting notebook from VNote directly
This commit is contained in:
parent
810438b5e5
commit
9e9a6bd584
@ -114,7 +114,11 @@ void SessionConfig::loadCore(const QJsonObject &p_session)
|
|||||||
if (!isUndefinedKey(coreObj, QStringLiteral("system_title_bar"))) {
|
if (!isUndefinedKey(coreObj, QStringLiteral("system_title_bar"))) {
|
||||||
m_systemTitleBarEnabled = readBool(coreObj, QStringLiteral("system_title_bar"));
|
m_systemTitleBarEnabled = readBool(coreObj, QStringLiteral("system_title_bar"));
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
m_systemTitleBarEnabled = false;
|
||||||
|
#else
|
||||||
m_systemTitleBarEnabled = true;
|
m_systemTitleBarEnabled = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isUndefinedKey(coreObj, QStringLiteral("minimize_to_system_tray"))) {
|
if (!isUndefinedKey(coreObj, QStringLiteral("minimize_to_system_tray"))) {
|
||||||
@ -314,6 +318,9 @@ void SessionConfig::doVersionSpecificOverride()
|
|||||||
{
|
{
|
||||||
// In a new version, we may want to change one value by force.
|
// In a new version, we may want to change one value by force.
|
||||||
// SHOULD set the in memory variable only, or will override the notebook list.
|
// SHOULD set the in memory variable only, or will override the notebook list.
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
m_systemTitleBarEnabled = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const ExportOption &SessionConfig::getExportOption() const
|
const ExportOption &SessionConfig::getExportOption() const
|
||||||
|
@ -173,7 +173,7 @@ namespace vnotex
|
|||||||
OpenGL m_openGL = OpenGL::None;
|
OpenGL m_openGL = OpenGL::None;
|
||||||
|
|
||||||
// Whether use system's title bar or not.
|
// Whether use system's title bar or not.
|
||||||
bool m_systemTitleBarEnabled = false;
|
bool m_systemTitleBarEnabled = true;
|
||||||
|
|
||||||
// Whether to minimize to tray.
|
// Whether to minimize to tray.
|
||||||
// -1 for prompting for user;
|
// -1 for prompting for user;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include "notebook/notebook.h"
|
#include "notebook/notebook.h"
|
||||||
#include "notebookinfowidget.h"
|
#include "notebookinfowidget.h"
|
||||||
@ -60,7 +61,7 @@ void ManageNotebooksDialog::setupUI()
|
|||||||
auto btnLayout = new QHBoxLayout();
|
auto btnLayout = new QHBoxLayout();
|
||||||
infoLayout->addLayout(btnLayout);
|
infoLayout->addLayout(btnLayout);
|
||||||
|
|
||||||
m_closeNotebookBtn = new QPushButton(tr("Close"), infoWidget);
|
m_closeNotebookBtn = new QPushButton(tr("Close Noteboook"), infoWidget);
|
||||||
btnLayout->addStretch();
|
btnLayout->addStretch();
|
||||||
btnLayout->addWidget(m_closeNotebookBtn);
|
btnLayout->addWidget(m_closeNotebookBtn);
|
||||||
connect(m_closeNotebookBtn, &QPushButton::clicked,
|
connect(m_closeNotebookBtn, &QPushButton::clicked,
|
||||||
@ -71,7 +72,7 @@ void ManageNotebooksDialog::setupUI()
|
|||||||
closeNotebook(m_notebookInfoWidget->getNotebook());
|
closeNotebook(m_notebookInfoWidget->getNotebook());
|
||||||
});
|
});
|
||||||
|
|
||||||
m_deleteNotebookBtn = new QPushButton(tr("Delete (DANGER)"), infoWidget);
|
m_deleteNotebookBtn = new QPushButton(tr("Delete"), infoWidget);
|
||||||
WidgetUtils::setPropertyDynamically(m_deleteNotebookBtn, PropertyDefs::c_dangerButton, true);
|
WidgetUtils::setPropertyDynamically(m_deleteNotebookBtn, PropertyDefs::c_dangerButton, true);
|
||||||
btnLayout->addWidget(m_deleteNotebookBtn);
|
btnLayout->addWidget(m_deleteNotebookBtn);
|
||||||
connect(m_deleteNotebookBtn, &QPushButton::clicked,
|
connect(m_deleteNotebookBtn, &QPushButton::clicked,
|
||||||
@ -287,28 +288,15 @@ void ManageNotebooksDialog::removeNotebook(const Notebook *p_notebook)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ret = MessageBoxHelper::questionOkCancel(MessageBoxHelper::Warning,
|
int ret = MessageBoxHelper::questionOkCancel(MessageBoxHelper::Warning,
|
||||||
tr("Delete notebook (%1) from disk?").arg(p_notebook->getName()),
|
tr("Please close the notebook in VNote first and delete the notebook root folder files manually."),
|
||||||
tr("CALM DOWN! CALM DOWN! CALM DOWN! It will delete all files belonging to this notebook from disk. "
|
tr("Press \"Ok\" to open the location of the notebook root folder."),
|
||||||
"It is dangerous since it will bypass system's recycle bin!"),
|
tr("Notebook location: %1").arg(p_notebook->getRootFolderAbsolutePath()),
|
||||||
tr("Notebook location: %1\nUse the \"Close\" button if you just want to remove it from %2.")
|
|
||||||
.arg(p_notebook->getRootFolderAbsolutePath())
|
|
||||||
.arg(ConfigMgr::c_appName),
|
|
||||||
this);
|
this);
|
||||||
if (ret != QMessageBox::Ok) {
|
if (ret != QMessageBox::Ok) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
WidgetUtils::openUrlByDesktop(QUrl::fromLocalFile(p_notebook->getRootFolderAbsolutePath()));
|
||||||
VNoteX::getInst().getNotebookMgr().removeNotebook(p_notebook->getId());
|
|
||||||
} catch (Exception &p_e) {
|
|
||||||
MessageBoxHelper::notify(MessageBoxHelper::Warning,
|
|
||||||
tr("Failed to delete notebook (%1)").arg(p_e.what()),
|
|
||||||
this);
|
|
||||||
loadNotebooks(nullptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadNotebooks(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ManageNotebooksDialog::checkUnsavedChanges()
|
bool ManageNotebooksDialog::checkUnsavedChanges()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user