diff --git a/src/resources/icons/explore_root.svg b/src/resources/icons/explore_root.svg index 05c4011f..6eab7dc3 100644 --- a/src/resources/icons/explore_root.svg +++ b/src/resources/icons/explore_root.svg @@ -4,7 +4,7 @@ viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"> - + + + + + + + + + diff --git a/src/vexplorer.cpp b/src/vexplorer.cpp index dd680f81..15b25c36 100644 --- a/src/vexplorer.cpp +++ b/src/vexplorer.cpp @@ -62,6 +62,25 @@ void VExplorer::setupUI() } }); + m_upBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/up.svg"), + "", + this); + m_upBtn->setToolTip(tr("Up")); + m_upBtn->setProperty("FlatBtn", true); + connect(m_upBtn, &QPushButton::clicked, + this, [this]() { + if (checkIndex()) { + QDir dir(m_entries[m_index].m_directory); + if (dir.cdUp()) { + int idx = addEntry(dir.absolutePath()); + updateDirectoryComboBox(); + if (idx != -1) { + setCurrentEntry(idx); + } + } + } + }); + m_openLocationBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/open_location.svg"), "", this); @@ -97,6 +116,7 @@ void VExplorer::setupUI() dirLayout->addWidget(dirLabel); dirLayout->addStretch(); dirLayout->addWidget(m_openBtn); + dirLayout->addWidget(m_upBtn); dirLayout->addWidget(m_openLocationBtn); dirLayout->addWidget(m_starBtn); dirLayout->setContentsMargins(0, 0, 0, 0); @@ -345,6 +365,7 @@ void VExplorer::handleEntryActivated(int p_idx) m_imgFolderEdit->setEnabled(valid); m_openLocationBtn->setEnabled(valid); + m_upBtn->setEnabled(valid); m_newFileBtn->setEnabled(valid); m_newDirBtn->setEnabled(valid); diff --git a/src/vexplorer.h b/src/vexplorer.h index 0133a27c..e9e5c89b 100644 --- a/src/vexplorer.h +++ b/src/vexplorer.h @@ -82,6 +82,7 @@ private: int m_index; QPushButton *m_openBtn; + QPushButton *m_upBtn; QPushButton *m_openLocationBtn; QPushButton *m_starBtn; QComboBox *m_dirCB; diff --git a/src/vnote.qrc b/src/vnote.qrc index 5b592c8b..8801bb2a 100644 --- a/src/vnote.qrc +++ b/src/vnote.qrc @@ -266,5 +266,6 @@ resources/icons/decrease_outline_level.svg resources/icons/increase_outline_level.svg utils/markdown-it/markdown-it-texmath.js + resources/icons/up.svg