Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3700
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/00/3700/1
Show only filename in "Recent Files" list
As discussed here:
http://nabble.documentfoundation.org/Libreoffice-ux-advise-Recent-files-dropdown-td4052945.html#a4052996
The changes are (inspired by Gedit):
* Display only the filename, not the (abbreviated) path
* Show the protocol name before the file, if not local (e.g. "ftp: myfile.odt")
* After the keyboard shortcut (a number from 1 to 10) display a '.' instead of a ':' (because the
protocol has a ':')
Change-Id: I47472c901aa866adb76c7c7ab36bc871f82ad8df
---
M framework/source/uielement/recentfilesmenucontroller.cxx
M include/tools/urlobj.hxx
M tools/source/fsys/urlobj.cxx
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx
b/framework/source/uielement/recentfilesmenucontroller.cxx
index 3d8d9c9..6259924 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -40,13 +40,12 @@
using namespace com::sun::star::beans;
using namespace com::sun::star::util;
-#define MAX_STR_WIDTH 46
#define MAX_MENU_ITEMS 99
static const char SFX_REFERER_USER[] = "private:user";
static const char CMD_CLEAR_LIST[] = ".uno:ClearRecentFileList";
static const char CMD_PREFIX[] = "vnd.sun.star.popup:RecentFileList?entry=";
-static const char MENU_SHOTCUT[] = "~N: ";
+static const char MENU_SHORTCUT[] = "~N. ";
namespace framework
{
@@ -133,17 +132,17 @@
if ( i <= 9 )
{
if ( i == 9 )
- aMenuShortCut.append( "1~0: " );
+ aMenuShortCut.append( "1~0. " );
else
{
- aMenuShortCut.append( MENU_SHOTCUT );
+ aMenuShortCut.append( MENU_SHORTCUT );
aMenuShortCut[ 1 ] = sal_Unicode( i + '1' );
}
}
else
{
aMenuShortCut.append( sal_Int32( i + 1 ) );
- aMenuShortCut.append( ": " );
+ aMenuShortCut.append( ". " );
}
OUStringBuffer aStrBuffer;
@@ -152,28 +151,19 @@
OUString aURLString( aStrBuffer.makeStringAndClear() );
// Abbreviate URL
- OUString aTipHelpText;
OUString aMenuTitle;
INetURLObject aURL( m_aRecentFilesItems[i].aURL );
+ OUString aTipHelpText( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) );
if ( aURL.GetProtocol() == INET_PROT_FILE )
{
- // Do handle file URL differently => convert it to a system
- // path and abbreviate it with a special function:
- OUString aSystemPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) );
- aTipHelpText = aSystemPath;
-
- OUString aCompactedSystemPath;
- if ( osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData,
MAX_STR_WIDTH, NULL ) == osl_File_E_None )
- aMenuTitle = aCompactedSystemPath;
- else
- aMenuTitle = aSystemPath;
+ // Do handle file URL differently: don't show the protocol, just the file name
+ aMenuTitle = aURL.getName();
}
else
{
- // Use INetURLObject to abbreviate all other URLs
- aMenuTitle = aURL.getAbbreviated( xStringLength, MAX_STR_WIDTH,
INetURLObject::DECODE_UNAMBIGUOUS );
- aTipHelpText = aURLString;
+ // In all other URLs show the protocol name before the file name
+ aMenuTitle = aURL.GetSchemeName(aURL.GetProtocol()) + ": " + aURL.getName();
}
aMenuShortCut.append( aMenuTitle );
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index fef9f46..8905334 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -484,6 +484,14 @@
*/
static OUString GetScheme(INetProtocol eTheScheme);
+ /** Return the a human-readable name for a given scheme.
+
+ @param eTheScheme One of the supported URL schemes.
+
+ @return The protocol name of URLs of the given scheme.
+ */
+ static OUString GetSchemeName(INetProtocol eTheScheme);
+
static inline INetProtocol CompareProtocolScheme(const OString&
rTheAbsURIRef)
{ return CompareProtocolScheme(extend(rTheAbsURIRef)); }
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 2724b71..071ca7a 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -4192,6 +4192,12 @@
}
// static
+OUString INetURLObject::GetSchemeName(INetProtocol eTheScheme)
+{
+ return OUString::createFromAscii(getSchemeInfo(eTheScheme).m_pScheme);
+}
+
+// static
INetProtocol INetURLObject::CompareProtocolScheme(OUString const &
rTheAbsURIRef)
{
--
To view, visit https://gerrit.libreoffice.org/3700
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I47472c901aa866adb76c7c7ab36bc871f82ad8df
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
Context
- [PATCH] Show only filename in "Recent Files" list · Samuel Mehrbrodt (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.