diff --git a/libs/vtextedit b/libs/vtextedit index 5c52cfe2..e6591f8b 160000 --- a/libs/vtextedit +++ b/libs/vtextedit @@ -1 +1 @@ -Subproject commit 5c52cfe2b211b021773d9e3c9559e5358a312381 +Subproject commit e6591f8bda53ecbdbac8d7aae4be80aa6f198017 diff --git a/src/core/sessionconfig.cpp b/src/core/sessionconfig.cpp index 47b1dd45..f3dd073b 100644 --- a/src/core/sessionconfig.cpp +++ b/src/core/sessionconfig.cpp @@ -246,6 +246,7 @@ QJsonObject SessionConfig::saveStateAndGeometry() const writeStringList(obj, QStringLiteral("visible_docks_before_expand"), m_mainWindowStateGeometry.m_visibleDocksBeforeExpand); writeByteArray(obj, QStringLiteral("tag_explorer_state"), m_mainWindowStateGeometry.m_tagExplorerState); writeByteArray(obj, QStringLiteral("notebook_explorer_state"), m_mainWindowStateGeometry.m_notebookExplorerState); + writeByteArray(obj, QStringLiteral("location_list_state"), m_mainWindowStateGeometry.m_locationListState); return obj; } @@ -378,6 +379,7 @@ void SessionConfig::loadStateAndGeometry(const QJsonObject &p_session) m_mainWindowStateGeometry.m_visibleDocksBeforeExpand = readStringList(obj, QStringLiteral("visible_docks_before_expand")); m_mainWindowStateGeometry.m_tagExplorerState = readByteArray(obj, QStringLiteral("tag_explorer_state")); m_mainWindowStateGeometry.m_notebookExplorerState = readByteArray(obj, QStringLiteral("notebook_explorer_state")); + m_mainWindowStateGeometry.m_locationListState = readByteArray(obj, QStringLiteral("location_list_state")); } QByteArray SessionConfig::getViewAreaSessionAndClear() diff --git a/src/core/sessionconfig.h b/src/core/sessionconfig.h index e9db74f5..52ee7ee7 100644 --- a/src/core/sessionconfig.h +++ b/src/core/sessionconfig.h @@ -38,7 +38,8 @@ namespace vnotex && m_mainGeometry == p_other.m_mainGeometry && m_visibleDocksBeforeExpand == p_other.m_visibleDocksBeforeExpand && m_tagExplorerState == p_other.m_tagExplorerState - && m_notebookExplorerState == p_other.m_notebookExplorerState; + && m_notebookExplorerState == p_other.m_notebookExplorerState + && m_locationListState == p_other.m_locationListState; } QByteArray m_mainState; @@ -50,6 +51,8 @@ namespace vnotex QByteArray m_tagExplorerState; QByteArray m_notebookExplorerState; + + QByteArray m_locationListState; }; enum OpenGL diff --git a/src/data/core/vnotex.json b/src/data/core/vnotex.json index e2276672..b8ba726c 100644 --- a/src/data/core/vnotex.json +++ b/src/data/core/vnotex.json @@ -489,7 +489,7 @@ "//comment" : "Whether close the file before opening it with external program", "node_explorer_close_before_open_with_enabled" : true, "//comment" : "0 - combined/1 - separate_single/2 - separate_double", - "node_explorer_explore_mode" : 1, + "node_explorer_explore_mode" : 0, "search_panel_advanced_settings_visible" : true, "//comment" : "Docks to ignore when expanding content area of main window", "main_window_keep_docks_expanding_content_area": ["OutlineDock.vnotex"], diff --git a/src/widgets/editors/markdowneditor.cpp b/src/widgets/editors/markdowneditor.cpp index 98ae8990..e2a3c301 100644 --- a/src/widgets/editors/markdowneditor.cpp +++ b/src/widgets/editors/markdowneditor.cpp @@ -622,7 +622,7 @@ bool MarkdownEditor::processUrlFromMimeData(const QMimeData *p_source) if (QFileInfo::exists(text)) { url = QUrl::fromLocalFile(text); } else { - url = QUrl::fromUserInput(text); + url.setUrl(text); if (url.scheme() != QStringLiteral("https") && url.scheme() != QStringLiteral("http")) { url.clear(); } diff --git a/src/widgets/locationlist.cpp b/src/widgets/locationlist.cpp index 5270d014..825bbe9d 100644 --- a/src/widgets/locationlist.cpp +++ b/src/widgets/locationlist.cpp @@ -45,7 +45,7 @@ void LocationList::setupUI() m_tree = new TreeWidget(TreeWidget::Flag::EnhancedStyle, this); // When updated, pay attention to the Columns enum. m_tree->setHeaderLabels(QStringList() << tr("Path") << tr("Line") << tr("Text")); - TreeWidget::showHorizontalScrollbar(m_tree); + m_tree->header()->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); m_tree->header()->setStretchLastSection(true); connect(m_tree, &QTreeWidget::itemActivated, this, [this](QTreeWidgetItem *p_item, int p_col) { @@ -194,3 +194,13 @@ void LocationList::updateItemsCountLabel() m_titleBar->setInfoLabel(tr("%n Item(s)", "", cnt)); } } + +QByteArray LocationList::saveState() const +{ + return m_tree->header()->saveState(); +} + +void LocationList::restoreState(const QByteArray &p_data) +{ + m_tree->header()->restoreState(p_data); +} diff --git a/src/widgets/locationlist.h b/src/widgets/locationlist.h index dcba13ca..fe9da1d2 100644 --- a/src/widgets/locationlist.h +++ b/src/widgets/locationlist.h @@ -31,6 +31,9 @@ namespace vnotex // Start a new session of the location list to set a callback for activation handling. void startSession(const LocationCallback &p_callback); + QByteArray saveState() const; + void restoreState(const QByteArray &p_data); + private: enum Columns { diff --git a/src/widgets/mainwindow.cpp b/src/widgets/mainwindow.cpp index d297f93d..06c766af 100644 --- a/src/widgets/mainwindow.cpp +++ b/src/widgets/mainwindow.cpp @@ -432,6 +432,7 @@ void MainWindow::saveStateAndGeometry() sg.m_visibleDocksBeforeExpand = m_visibleDocksBeforeExpand; sg.m_tagExplorerState = m_tagExplorer->saveState(); sg.m_notebookExplorerState = m_notebookExplorer->saveState(); + sg.m_locationListState = m_locationList->saveState(); auto& sessionConfig = ConfigMgr::getInst().getSessionConfig(); sessionConfig.setMainWindowStateGeometry(sg); @@ -466,6 +467,10 @@ void MainWindow::loadStateAndGeometry(bool p_stateOnly) if (!sg.m_notebookExplorerState.isEmpty()) { m_notebookExplorer->restoreState(sg.m_notebookExplorerState); } + + if (!sg.m_locationListState.isEmpty()) { + m_locationList->restoreState(sg.m_locationListState); + } } void MainWindow::resetStateAndGeometry() diff --git a/src/widgets/notebooknodeexplorer.cpp b/src/widgets/notebooknodeexplorer.cpp index 018b5989..151f2590 100644 --- a/src/widgets/notebooknodeexplorer.cpp +++ b/src/widgets/notebooknodeexplorer.cpp @@ -2312,20 +2312,7 @@ void NotebookNodeExplorer::loadMasterItemChildren(QTreeWidgetItem *p_item) const QString NotebookNodeExplorer::generateToolTip(const Node *p_node) { Q_ASSERT(p_node->isLoaded()); - QString tip = p_node->exists() ? p_node->getName() : (tr("[Invalid] %1").arg(p_node->getName())); - tip += QLatin1String("\n\n"); - - if (!p_node->getTags().isEmpty()) { - const auto &tags = p_node->getTags(); - QString tagString = tags.first(); - for (int i = 1; i < tags.size(); ++i) { - tagString += QLatin1String("; ") + tags[i]; - } - tip += tr("Tags: %1\n").arg(tagString); - } - - tip += tr("Created Time: %1\n").arg(Utils::dateTimeString(p_node->getCreatedTimeUtc().toLocalTime())); - tip += tr("Modified Time: %1").arg(Utils::dateTimeString(p_node->getModifiedTimeUtc().toLocalTime())); + const QString tip = p_node->exists() ? p_node->getName() : (tr("[Invalid] %1").arg(p_node->getName())); return tip; }