diff options
author | saturneric <[email protected]> | 2024-11-25 21:46:04 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-11-25 21:46:04 +0000 |
commit | 21bbd04e05790de5a5feed41ea4d6dbd4a06ad24 (patch) | |
tree | 1ad5d897f31cfcf7bafbb418ca7f36b483ef7bd3 /src/ui/widgets/TextEdit.cpp | |
parent | fix: correct spelling mistake (diff) | |
download | GpgFrontend-21bbd04e05790de5a5feed41ea4d6dbd4a06ad24.tar.gz GpgFrontend-21bbd04e05790de5a5feed41ea4d6dbd4a06ad24.zip |
feat: support drop down and open directory
Diffstat (limited to 'src/ui/widgets/TextEdit.cpp')
-rw-r--r-- | src/ui/widgets/TextEdit.cpp | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index a742d49d..d0cfe58e 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -72,18 +72,11 @@ void TextEdit::SlotNewHelpTab(const QString& title, const QString& path) const { } void TextEdit::SlotNewFileTab() { - auto const target_dir = QFileDialog::getExistingDirectory( + auto const target_directory = QFileDialog::getExistingDirectory( this, tr("Open Directory"), QDir::home().path(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - if (target_dir.isEmpty()) return; - - auto* page = new FilePage(qobject_cast<QWidget*>(parent()), target_dir); - auto index = tab_widget_->addTab(page, QString()); - tab_widget_->setTabIcon(index, QIcon(":/icons/file-browser.png")); - tab_widget_->setCurrentIndex(tab_widget_->count() - 1); - connect(page, &FilePage::SignalPathChanged, this, - &TextEdit::slot_file_page_path_changed); - page->SlotGoPath(); + if (target_directory.isEmpty()) return; + tab_widget_->SlotOpenDirectory(target_directory); } void TextEdit::SlotOpenFile(const QString& path) { @@ -556,20 +549,4 @@ void TextEdit::SlotSelectAll() const { } CurTextPage()->GetTextPage()->selectAll(); } - -void TextEdit::slot_file_page_path_changed(const QString& path) const { - int index = tab_widget_->currentIndex(); - QString m_path; - QFileInfo file_info(path); - QString t_path = file_info.absoluteFilePath(); - if (path.size() > 18) { - m_path = t_path.mid(t_path.size() - 18, 18).prepend("..."); - } else { - m_path = t_path; - } - tab_widget_->setTabText(index, m_path); - - emit UISignalStation::GetInstance() - -> SignalMainWindowlUpdateBasicalOperaMenu(0); -} } // namespace GpgFrontend::UI |