From f441590c8e0b5e970fbdd656198ec4993dfecb43 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Mon, 2 Nov 2015 18:19:40 +0000 Subject: [PATCH] Add "Open Containing Directory" button to the log dialog (#9211, #9834) It takes the place of the "Copy to Clipboard" button which was redundant. --- src/frontends/qt4/GuiLog.cpp | 19 +++++++++++++++++++ src/frontends/qt4/GuiLog.h | 2 ++ src/frontends/qt4/ui/LogUi.ui | 5 +++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiLog.cpp b/src/frontends/qt4/GuiLog.cpp index 14e7aaf73a..427e98961a 100644 --- a/src/frontends/qt4/GuiLog.cpp +++ b/src/frontends/qt4/GuiLog.cpp @@ -24,8 +24,10 @@ #include "support/FileName.h" #include "support/gettext.h" +#include #include #include +#include #include #include @@ -189,6 +191,23 @@ void GuiLog::on_nextWarningPB_clicked() } +void GuiLog::on_openDirPB_clicked() +{ + support::FileName dir = logfile_.onlyPath(); + if (!dir.exists()) + return; + QUrl qdir(toqstr(from_utf8("file://" + dir.absFileName())), + QUrl::StrictMode); + // Give hints in case of bugs + if (!qdir.isValid()) { + LYXERR0("QUrl is invalid!"); + return; + } + if (!QDesktopServices::openUrl(qdir)) + LYXERR0("Unable to open QUrl even though dir exists!"); +} + + void GuiLog::goTo(QRegExp const & exp) const { QTextCursor const newc = diff --git a/src/frontends/qt4/GuiLog.h b/src/frontends/qt4/GuiLog.h index 2a9ebb6e7a..8159836c39 100644 --- a/src/frontends/qt4/GuiLog.h +++ b/src/frontends/qt4/GuiLog.h @@ -41,6 +41,8 @@ private Q_SLOTS: void on_nextErrorPB_clicked(); /// jump to next warning void on_nextWarningPB_clicked(); + /// open containing directory + void on_openDirPB_clicked(); /// Log type changed void typeChanged(int); diff --git a/src/frontends/qt4/ui/LogUi.ui b/src/frontends/qt4/ui/LogUi.ui index ddf6ebcd39..f2497fedc8 100644 --- a/src/frontends/qt4/ui/LogUi.ui +++ b/src/frontends/qt4/ui/LogUi.ui @@ -1,3 +1,4 @@ + LogUi @@ -105,9 +106,9 @@ - + - Copy to Clip&board + &Open Containing Directory -- 2.39.2