svx/source/dialog/docrecovery.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
New commits: commit cd68903660d2ba71fe6e033b0ae7880366913a4e Author: Matthew J. Francis <mjay.fran...@gmail.com> Date: Thu Sep 18 21:35:45 2014 +0800 fdo#83891 Show document names including " - " during autorecovery Change-Id: I9c8076ec51858967ddde0dbbf109f30025975d57 Signed-off-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 34de399..c119619 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -410,6 +410,19 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a aNew.DisplayName = lInfo.getUnpackedValueOrDefault(STATEPROP_TITLE , OUString()); aNew.Module = lInfo.getUnpackedValueOrDefault(STATEPROP_MODULE , OUString()); + if (aNew.OrgURL.isEmpty()) { + // If there is no file URL, the window title is used for the display name. + // Remove any unwanted elements such as " - LibreOffice Writer". + sal_Int32 i = aNew.DisplayName.indexOf(" - "); + if (i > 0) + aNew.DisplayName = aNew.DisplayName.copy(0, i); + } else { + // If there is a file URL, parse out the filename part as the display name. + INetURLObject aOrgURL(aNew.OrgURL); + aNew.DisplayName = aOrgURL.getName(INetURLObject::LAST_SEGMENT, true, + INetURLObject::DECODE_WITH_CHARSET); + } + // search for already existing items and update her nState value ... TURLList::iterator pIt; for ( pIt = m_lURLs.begin(); @@ -449,11 +462,6 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a map the doc state to an UI state. */ aNew.RecoveryState = E_NOT_RECOVERED_YET; - // patch DisplayName! Because the document title contain more than the file name ... - sal_Int32 i = aNew.DisplayName.indexOf(" - "); - if (i > 0) - aNew.DisplayName = aNew.DisplayName.copy(0, i); - m_lURLs.push_back(aNew); if (m_pListener) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits