diff options
author | Vert D <devoptmsoi@gmx.com> | 2020-12-22 00:46:49 -0500 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2020-12-23 11:32:59 +0100 |
commit | 421d3fe399e798212fb6c1a14b4f2de1e545eb3c (patch) | |
tree | 99ccabdcf0803a6d474f595e5533859d8a28b313 /sfx2 | |
parent | 610153dd28b57ea2670f5cf240e4da9655fb7093 (diff) |
fix columns widths and formated string
Change-Id: I99d4cf17a49ce78857b282b5be5d8c88ddd7e740
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108136
Tested-by: Jenkins
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/listview.cxx | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/sfx2/source/control/listview.cxx b/sfx2/source/control/listview.cxx index d4b8769447cc..8ed1255a594f 100644 --- a/sfx2/source/control/listview.cxx +++ b/sfx2/source/control/listview.cxx @@ -11,7 +11,7 @@ #include <sfx2/sfxresid.hxx> #include <tools/urlobj.hxx> - +#include <tools/datetime.hxx> #include <sfx2/strings.hrc> #include <osl/file.hxx> #include <osl/time.h> @@ -55,7 +55,6 @@ ListView::ListView(std::unique_ptr<weld::TreeView> xTreeView) aWidths.push_back(static_cast<int>(nDigitWidth * 22)); /* Category Column */ aWidths.push_back(static_cast<int>(nDigitWidth * 15)); /* Application Column */ aWidths.push_back(static_cast<int>(nDigitWidth * 18)); /* Modify Column */ - aWidths.push_back(static_cast<int>(nDigitWidth * 10)); /* Size Column */ mxTreeView->set_column_fixed_widths(aWidths); mxTreeView->set_selection_mode(SelectionMode::Multiple); @@ -346,23 +345,13 @@ static OUString getDisplayFileModifyTime(const OUString& rURL) if (systemTimeValue.Seconds == 0) return OUString(); TimeValue localTimeValue; - oslDateTime dateTime; osl_getLocalTimeFromSystemTime(&systemTimeValue, &localTimeValue); - osl_getDateTimeFromTimeValue(&localTimeValue, &dateTime); - - struct tm tm; - tm.tm_sec = dateTime.Seconds; - tm.tm_min = dateTime.Minutes; - tm.tm_hour = dateTime.Hours; - tm.tm_mday = dateTime.Day; - tm.tm_mon = dateTime.Month - 1; - tm.tm_year = dateTime.Year - 1900; - char ts[50]; - for (char& c : ts) - c = ' '; - strftime(ts, sizeof(ts), "%x %X", &tm); - OUString sModifyTime(ts, sizeof(ts), RTL_TEXTENCODING_UTF8); - return sModifyTime.trim(); + const SvtSysLocale aSysLocale; + const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData(); + DateTime aDateTime = DateTime::CreateFromUnixTime(localTimeValue.Seconds); + OUString aDisplayDateTime + = rLocaleWrapper.getDate(aDateTime) + ", " + rLocaleWrapper.getTime(aDateTime, false); + return aDisplayDateTime; } static OUString getDisplayFileSize(const OUString& rURL) |