summaryrefslogtreecommitdiff
path: root/cui/source/dialogs
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2020-10-14 12:38:44 +0200
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2020-10-14 15:09:28 +0200
commit728548f8d7698d06c21ae37b2e03fa8e73676341 (patch)
tree532da52ef08b9eb156a8493d866f8f285111ca0e /cui/source/dialogs
parenteb395e21a7b1f15de664c4b207dc9e130aa635cf (diff)
Fixes to TipOfTheDay dialog
* Reverts 231a4e024b85aa0ad06a5632d3f514152babea30 and sets initial value to -1 to start from zero * Improves translatability of string Change-Id: Ib541a72fa3f6eecdf5bbdf17ce2a4e56ff90c397 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104276 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r--cui/source/dialogs/tipofthedaydlg.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index ee4a9edebb50..d4f7d8f1c860 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -76,13 +76,16 @@ static bool file_exists(const OUString& fileName)
void TipOfTheDayDialog::UpdateTip()
{
- if ((nCurrentTip > nNumberOfTips) || (nCurrentTip < 1))
- nCurrentTip = 1;
- m_xDialog->set_title(CuiResId(STR_TITLE) + ": " + OUString::number(nCurrentTip) + "/"
- + OUString::number(nNumberOfTips));
+ if ((nCurrentTip >= nNumberOfTips) || (nCurrentTip < 0))
+ nCurrentTip = 0;
+
+ //title
+ m_xDialog->set_title(CuiResId(STR_TITLE)
+ .replaceFirst("%CURRENT", OUString::number(nCurrentTip + 1))
+ .replaceFirst("%TOTAL", OUString::number(nNumberOfTips)));
// text
- OUString aText = CuiResId(std::get<0>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip - 1]));
+ OUString aText = CuiResId(std::get<0>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]));
//replace MOD1 & MOD2 shortcuts depending on platform
#ifdef MACOSX
const OUString aMOD1 = CuiResId(STR_CMD);
@@ -107,7 +110,7 @@ void TipOfTheDayDialog::UpdateTip()
m_pText->set_label(aText);
// hyperlink
- aLink = std::get<1>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip - 1]);
+ aLink = std::get<1>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]);
if (aLink.isEmpty())
{
m_pLink->set_visible(false);
@@ -148,7 +151,7 @@ void TipOfTheDayDialog::UpdateTip()
// image
OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/tipoftheday/");
rtl::Bootstrap::expandMacros(aURL);
- OUString aImage = std::get<2>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip - 1]);
+ OUString aImage = std::get<2>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]);
// use default image if none is available with the number
if (aImage.isEmpty() || !file_exists(aURL + aImage))
aImage = "tipoftheday.png";