Skip to content

Commit 897e05e

Browse files
committed
remove support of legacy VNote2 notebook
1 parent 1d665bb commit 897e05e

12 files changed

Lines changed: 1 addition & 423 deletions

‎src/core/vnotex.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public slots:
6161
// Requested to import a notebook.
6262
void importNotebookRequested();
6363

64-
// Requested to import a legacy notebook from VNote 2.0.
65-
void importLegacyNotebookRequested();
66-
6764
void manageNotebooksRequested();
6865

6966
// Requested to import files.

‎src/widgets/CMakeLists.txt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ target_sources(vnote PRIVATE
1414
dialogs/imageinsertdialog.cpp dialogs/imageinsertdialog.h
1515
dialogs/importfolderdialog.cpp dialogs/importfolderdialog.h
1616
dialogs/importfolderutils.cpp dialogs/importfolderutils.h
17-
dialogs/importlegacynotebookdialog.cpp dialogs/importlegacynotebookdialog.h
1817
dialogs/importnotebookdialog.cpp dialogs/importnotebookdialog.h
19-
dialogs/legacynotebookutils.cpp dialogs/legacynotebookutils.h
2018
dialogs/levellabelwithupbutton.cpp dialogs/levellabelwithupbutton.h
2119
dialogs/linkinsertdialog.cpp dialogs/linkinsertdialog.h
2220
dialogs/managenotebooksdialog.cpp dialogs/managenotebooksdialog.h
Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "importfolderutils.h"
22

3-
#include "legacynotebookutils.h"
43
#include <QCoreApplication>
54
#include <core/exception.h>
65
#include <notebook/nodeparameters.h>
@@ -45,85 +44,3 @@ void ImportFolderUtils::importFolderContents(Notebook *p_notebook, Node *p_node,
4544
}
4645
}
4746
}
48-
49-
void ImportFolderUtils::importFolderContentsByLegacyConfig(Notebook *p_notebook, Node *p_node,
50-
QString &p_errMsg) {
51-
auto rootDir = p_node->toDir();
52-
53-
QJsonObject config;
54-
try {
55-
config = LegacyNotebookUtils::getFolderConfig(rootDir.absolutePath());
56-
} catch (Exception &p_e) {
57-
Utils::appendMsg(p_errMsg,
58-
ImportFolderUtilsTranslate::tr("Failed to read folder config (%1) (%2).")
59-
.arg(rootDir.absolutePath(), p_e.what()));
60-
return;
61-
}
62-
63-
// Remove the config file.
64-
LegacyNotebookUtils::removeFolderConfigFile(rootDir.absolutePath());
65-
66-
// Folders.
67-
LegacyNotebookUtils::forEachFolder(config, [&rootDir, p_notebook, p_node,
68-
&p_errMsg](const QString &name) {
69-
if (!rootDir.exists(name)) {
70-
Utils::appendMsg(p_errMsg,
71-
ImportFolderUtilsTranslate::tr("Folder (%1) does not exist.").arg(name));
72-
return;
73-
}
74-
75-
if (p_notebook->isBuiltInFolder(p_node, name)) {
76-
Utils::appendMsg(
77-
p_errMsg,
78-
ImportFolderUtilsTranslate::tr("Folder (%1) conflicts with built-in folder.").arg(name));
79-
return;
80-
}
81-
82-
QSharedPointer<Node> node;
83-
try {
84-
NodeParameters paras;
85-
paras.m_createdTimeUtc =
86-
LegacyNotebookUtils::getCreatedTimeUtcOfFolder(rootDir.filePath(name));
87-
node = p_notebook->addAsNode(p_node, Node::Flag::Container, name, paras);
88-
} catch (Exception &p_e) {
89-
Utils::appendMsg(p_errMsg,
90-
ImportFolderUtilsTranslate::tr("Failed to add folder (%1) as node (%2).")
91-
.arg(name, p_e.what()));
92-
return;
93-
}
94-
95-
ImportFolderUtils::importFolderContentsByLegacyConfig(p_notebook, node.data(), p_errMsg);
96-
});
97-
98-
// Files.
99-
LegacyNotebookUtils::forEachFile(config, [&rootDir, p_notebook, p_node,
100-
&p_errMsg](const LegacyNotebookUtils::FileInfo &info) {
101-
if (!rootDir.exists(info.m_name)) {
102-
Utils::appendMsg(
103-
p_errMsg, ImportFolderUtilsTranslate::tr("File (%1) does not exist.").arg(info.m_name));
104-
return;
105-
}
106-
107-
if (p_notebook->isBuiltInFile(p_node, info.m_name)) {
108-
Utils::appendMsg(p_errMsg,
109-
ImportFolderUtilsTranslate::tr("File (%1) conflicts with built-in file.")
110-
.arg(info.m_name));
111-
return;
112-
}
113-
114-
QSharedPointer<Node> node;
115-
try {
116-
NodeParameters paras;
117-
paras.m_createdTimeUtc = info.m_createdTimeUtc;
118-
paras.m_modifiedTimeUtc = info.m_modifiedTimeUtc;
119-
paras.m_attachmentFolder = info.m_attachmentFolder;
120-
paras.m_tags = info.m_tags;
121-
node = p_notebook->addAsNode(p_node, Node::Flag::Content, info.m_name, paras);
122-
} catch (Exception &p_e) {
123-
Utils::appendMsg(p_errMsg,
124-
ImportFolderUtilsTranslate::tr("Failed to add file (%1) as node (%2).")
125-
.arg(info.m_name, p_e.what()));
126-
return;
127-
}
128-
});
129-
}

‎src/widgets/dialogs/importfolderutils.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ class ImportFolderUtils {
2222
// @p_node has already been added.
2323
static void importFolderContents(Notebook *p_notebook, Node *p_node,
2424
const QStringList &p_suffixes, QString &p_errMsg);
25-
26-
// Process folder @p_node by legacy notebook config.
27-
// @p_node has already been added.
28-
static void importFolderContentsByLegacyConfig(Notebook *p_notebook, Node *p_node,
29-
QString &p_errMsg);
3025
};
3126
} // namespace vnotex
3227

‎src/widgets/dialogs/importlegacynotebookdialog.cpp‎

Lines changed: 0 additions & 149 deletions
This file was deleted.

‎src/widgets/dialogs/importlegacynotebookdialog.h‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎src/widgets/dialogs/legacynotebookutils.cpp‎

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)