[PATCH] Show only filename in "Recent Files" list on Start Center

Prashant Pandey (via Code Review) gerrit at gerrit.libreoffice.org
Fri May 24 07:18:46 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4027

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/27/4027/1

Show only filename in "Recent Files" list on Start Center

Change-Id: I57f7564aae035ce158b819ca1495a547754a95f8
---
M framework/source/services/backingwindow.cxx
1 file changed, 6 insertions(+), 16 deletions(-)



diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index f18152b..2cb9f0f 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -353,25 +353,15 @@
 
             if ( aURLObj.GetProtocol() == INET_PROT_FILE )
             {
-                // Do handle file URL differently => convert it to a system
-                // path and abbreviate it with a special function:
-                String aFileSystemPath( aURLObj.getFSysPath( INetURLObject::FSYS_DETECT ) );
-
-                OUString   aSystemPath( aFileSystemPath );
-                OUString   aCompactedSystemPath;
-
-                oslFileError nError = osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData, 46, NULL );
-                if ( !nError )
-                    aMenuTitle = String( aCompactedSystemPath );
-                else
-                    aMenuTitle = aSystemPath;
+                // Do handle file URL differently: don't show the protocol, just the file name
+                aMenuTitle = aURLObj.GetLastName(INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8);
             }
             else
             {
-                // Use INetURLObject to abbreviate all other URLs
-                Reference< util::XStringWidth > xStringLength( new RecentFilesStringLength() );
-                aMenuTitle = aURLObj.getAbbreviated( xStringLength, 46, INetURLObject::DECODE_UNAMBIGUOUS );
+                // In all other URLs show the protocol name before the file name
+                aMenuTitle = aURLObj.GetSchemeName(aURLObj.GetProtocol()) + ": " + aURLObj.getName();
             }
+
             OUStringBuffer aBuf( aMenuTitle.getLength() + 5 );
             if( i < 9 )
             {
@@ -382,7 +372,7 @@
                 aBuf.appendAscii( "1~0" );
             else
                 aBuf.append( i+1 );
-            aBuf.appendAscii( ": " );
+            aBuf.appendAscii( ". " );
             aBuf.append( aMenuTitle );
             mpRecentMenu->InsertItem( static_cast<sal_uInt16>(i+1), aBuf.makeStringAndClear() );
         }

-- 
To view, visit https://gerrit.libreoffice.org/4027
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57f7564aae035ce158b819ca1495a547754a95f8
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Prashant Pandey <prashant3.yishu at gmail.com>



More information about the LibreOffice mailing list