diff --git a/pics/main.png b/pics/main.png
index 605b8d67..ce59a01b 100644
Binary files a/pics/main.png and b/pics/main.png differ
diff --git a/src/data/core/translations/vnote_zh_CN.qm b/src/data/core/translations/vnote_zh_CN.qm
index 254dbd4f..8ae88aa1 100644
Binary files a/src/data/core/translations/vnote_zh_CN.qm and b/src/data/core/translations/vnote_zh_CN.qm differ
diff --git a/src/data/core/translations/vnote_zh_CN.ts b/src/data/core/translations/vnote_zh_CN.ts
index 94a04239..55a3869b 100644
--- a/src/data/core/translations/vnote_zh_CN.ts
+++ b/src/data/core/translations/vnote_zh_CN.ts
@@ -1391,25 +1391,30 @@
vnotex::NewNoteDialog
-
+
New Note
新建笔记
-
+
Please specify a name for the note.
请为笔记指定一个名字。
-
+
Name conflicts with existing note.
名字和已有笔记冲突。
-
+
Failed to create note under (%1) in (%2) (%3).
无法在笔记本 (%2) 中文件夹 (%1) 下创建笔记 (%3)。
+
+
+ note
+ 笔记
+
vnotex::NewNotebookDialog
diff --git a/src/widgets/dialogs/newnotedialog.cpp b/src/widgets/dialogs/newnotedialog.cpp
index e89dac1f..768fd9fc 100644
--- a/src/widgets/dialogs/newnotedialog.cpp
+++ b/src/widgets/dialogs/newnotedialog.cpp
@@ -6,21 +6,20 @@
#include "notebook/node.h"
#include "../widgetsfactory.h"
#include
+#include
#include "exception.h"
#include "nodeinfowidget.h"
#include
using namespace vnotex;
-const QString NewNoteDialog::c_defaultNoteName = "new_note.md";
-
NewNoteDialog::NewNoteDialog(Node *p_node, QWidget *p_parent)
: ScrollDialog(p_parent)
{
Q_ASSERT(p_node && p_node->isLoaded());
setupUI(p_node);
- initDefaultValues();
+ initDefaultValues(p_node);
m_infoWidget->getNameLineEdit()->setFocus();
}
@@ -106,11 +105,14 @@ const QSharedPointer &NewNoteDialog::getNewNode() const
return m_newNode;
}
-void NewNoteDialog::initDefaultValues()
+void NewNoteDialog::initDefaultValues(const Node *p_node)
{
{
auto lineEdit = m_infoWidget->getNameLineEdit();
- lineEdit->setText(c_defaultNoteName);
+ auto defaultName = FileUtils::generateFileNameWithSequence(p_node->fetchAbsolutePath(),
+ tr("note"),
+ QStringLiteral("md"));
+ lineEdit->setText(defaultName);
WidgetUtils::selectBaseName(lineEdit);
validateInputs();
diff --git a/src/widgets/dialogs/newnotedialog.h b/src/widgets/dialogs/newnotedialog.h
index 54cdbb26..b5c8cdf3 100644
--- a/src/widgets/dialogs/newnotedialog.h
+++ b/src/widgets/dialogs/newnotedialog.h
@@ -33,13 +33,11 @@ namespace vnotex
bool newNote();
- void initDefaultValues();
+ void initDefaultValues(const Node *p_node);
NodeInfoWidget *m_infoWidget = nullptr;
QSharedPointer m_newNode;
-
- static const QString c_defaultNoteName;
};
} // ns vnotex