diff options
author | Matthew J. Francis <mjay.francis@gmail.com> | 2014-09-18 21:35:45 +0800 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-19 10:14:51 +0200 |
commit | cd68903660d2ba71fe6e033b0ae7880366913a4e (patch) | |
tree | 24d520b70d38062bd6fff625b2c0930e52d5b48b | |
parent | e9d3907c39f092ac2db367a51d1322a2d5d12eae (diff) |
fdo#83891 Show document names including " - " during autorecovery
Change-Id: I9c8076ec51858967ddde0dbbf109f30025975d57
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | svx/source/dialog/docrecovery.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 34de399fedb2..c119619880d5 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) |