summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-03-03 18:17:31 -0400
committerMichael Meeks <michael.meeks@collabora.com>2021-03-04 18:56:36 +0100
commit74afa0a061ce11f0305cd2103c5950c525921aa7 (patch)
tree8f7eace83be53c9fee99a52b50e0e4e755bb00fc
parent1c1604cf6ca6012efcc7f1642906ce686081b3c4 (diff)
lok: strip directory and suffix from filenames
The Macro Warning dialog should only show the filename Change-Id: I04f1d3a1b945d65276187ca0a284e41bd08ed298 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111941 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--uui/source/secmacrowarnings.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index c63c0a3f9499..c1f99f3c01d9 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -21,11 +21,14 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <comphelper/documentconstants.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
+#include <osl/file.hxx>
#include <osl/file.h>
#include <sal/macros.h>
#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
#include <unotools/resmgr.hxx>
#include <com/sun/star/security/NoPasswordException.hpp>
@@ -90,7 +93,13 @@ IMPL_STATIC_LINK_NOARG(MacroWarning, InstallLOKNotifierHdl, void*, vcl::ILibreOf
void MacroWarning::SetDocumentURL( const OUString& rDocURL )
{
OUString aAbbreviatedPath;
- osl_abbreviateSystemPath(rDocURL.pData, &aAbbreviatedPath.pData, 50, nullptr);
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ osl::FileBase::getFileURLFromSystemPath(rDocURL, aAbbreviatedPath);
+ aAbbreviatedPath = INetURLObject(aAbbreviatedPath).GetLastName();
+ }
+ else
+ osl_abbreviateSystemPath(rDocURL.pData, &aAbbreviatedPath.pData, 50, nullptr);
m_xDialog->set_primary_text(aAbbreviatedPath);
}