mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
refine default new note name
This commit is contained in:
parent
00b8995fc8
commit
b4818e617f
BIN
pics/main.png
BIN
pics/main.png
Binary file not shown.
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 87 KiB |
Binary file not shown.
@ -1391,25 +1391,30 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>vnotex::NewNoteDialog</name>
|
<name>vnotex::NewNoteDialog</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="36"/>
|
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="35"/>
|
||||||
<source>New Note</source>
|
<source>New Note</source>
|
||||||
<translation>新建笔记</translation>
|
<translation>新建笔记</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="63"/>
|
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="62"/>
|
||||||
<source>Please specify a name for the note.</source>
|
<source>Please specify a name for the note.</source>
|
||||||
<translation>请为笔记指定一个名字。</translation>
|
<translation>请为笔记指定一个名字。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="68"/>
|
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="67"/>
|
||||||
<source>Name conflicts with existing note.</source>
|
<source>Name conflicts with existing note.</source>
|
||||||
<translation>名字和已有笔记冲突。</translation>
|
<translation>名字和已有笔记冲突。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="91"/>
|
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="90"/>
|
||||||
<source>Failed to create note under (%1) in (%2) (%3).</source>
|
<source>Failed to create note under (%1) in (%2) (%3).</source>
|
||||||
<translation>无法在笔记本 (%2) 中文件夹 (%1) 下创建笔记 (%3)。</translation>
|
<translation>无法在笔记本 (%2) 中文件夹 (%1) 下创建笔记 (%3)。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../../widgets/dialogs/newnotedialog.cpp" line="113"/>
|
||||||
|
<source>note</source>
|
||||||
|
<translation>笔记</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>vnotex::NewNotebookDialog</name>
|
<name>vnotex::NewNotebookDialog</name>
|
||||||
|
@ -6,21 +6,20 @@
|
|||||||
#include "notebook/node.h"
|
#include "notebook/node.h"
|
||||||
#include "../widgetsfactory.h"
|
#include "../widgetsfactory.h"
|
||||||
#include <utils/pathutils.h>
|
#include <utils/pathutils.h>
|
||||||
|
#include <utils/fileutils.h>
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "nodeinfowidget.h"
|
#include "nodeinfowidget.h"
|
||||||
#include <utils/widgetutils.h>
|
#include <utils/widgetutils.h>
|
||||||
|
|
||||||
using namespace vnotex;
|
using namespace vnotex;
|
||||||
|
|
||||||
const QString NewNoteDialog::c_defaultNoteName = "new_note.md";
|
|
||||||
|
|
||||||
NewNoteDialog::NewNoteDialog(Node *p_node, QWidget *p_parent)
|
NewNoteDialog::NewNoteDialog(Node *p_node, QWidget *p_parent)
|
||||||
: ScrollDialog(p_parent)
|
: ScrollDialog(p_parent)
|
||||||
{
|
{
|
||||||
Q_ASSERT(p_node && p_node->isLoaded());
|
Q_ASSERT(p_node && p_node->isLoaded());
|
||||||
setupUI(p_node);
|
setupUI(p_node);
|
||||||
|
|
||||||
initDefaultValues();
|
initDefaultValues(p_node);
|
||||||
|
|
||||||
m_infoWidget->getNameLineEdit()->setFocus();
|
m_infoWidget->getNameLineEdit()->setFocus();
|
||||||
}
|
}
|
||||||
@ -106,11 +105,14 @@ const QSharedPointer<Node> &NewNoteDialog::getNewNode() const
|
|||||||
return m_newNode;
|
return m_newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewNoteDialog::initDefaultValues()
|
void NewNoteDialog::initDefaultValues(const Node *p_node)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
auto lineEdit = m_infoWidget->getNameLineEdit();
|
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);
|
WidgetUtils::selectBaseName(lineEdit);
|
||||||
|
|
||||||
validateInputs();
|
validateInputs();
|
||||||
|
@ -33,13 +33,11 @@ namespace vnotex
|
|||||||
|
|
||||||
bool newNote();
|
bool newNote();
|
||||||
|
|
||||||
void initDefaultValues();
|
void initDefaultValues(const Node *p_node);
|
||||||
|
|
||||||
NodeInfoWidget *m_infoWidget = nullptr;
|
NodeInfoWidget *m_infoWidget = nullptr;
|
||||||
|
|
||||||
QSharedPointer<Node> m_newNode;
|
QSharedPointer<Node> m_newNode;
|
||||||
|
|
||||||
static const QString c_defaultNoteName;
|
|
||||||
};
|
};
|
||||||
} // ns vnotex
|
} // ns vnotex
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user