[Libreoffice-commits] core.git: cui/source
Heiko Tietze (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 14 08:49:29 UTC 2020
cui/source/dialogs/tipofthedaydlg.cxx | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
New commits:
commit 2b7ccc1ee083abee812a4e9917c1324179ec97cb
Author: Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Tue Oct 13 12:44:24 2020 +0200
Commit: Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Wed Oct 14 10:48:48 2020 +0200
Resolves tdf#137429 - Ensure first tip is shown first
Starting in safe mode (or the first time) shows now
array[0] instead of [1]
Change-Id: I50643c4443705a5137080c6dbdb1ad329151b308
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104230
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index c64362d35c08..ee4a9edebb50 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -76,13 +76,13 @@ static bool file_exists(const OUString& fileName)
void TipOfTheDayDialog::UpdateTip()
{
- if ((nCurrentTip + 1 > nNumberOfTips) || (nCurrentTip < 0))
- nCurrentTip = 0;
- m_xDialog->set_title(CuiResId(STR_TITLE) + ": " + OUString::number(nCurrentTip + 1) + "/"
+ if ((nCurrentTip > nNumberOfTips) || (nCurrentTip < 1))
+ nCurrentTip = 1;
+ m_xDialog->set_title(CuiResId(STR_TITLE) + ": " + OUString::number(nCurrentTip) + "/"
+ OUString::number(nNumberOfTips));
// text
- OUString aText = CuiResId(std::get<0>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]));
+ OUString aText = CuiResId(std::get<0>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip - 1]));
//replace MOD1 & MOD2 shortcuts depending on platform
#ifdef MACOSX
const OUString aMOD1 = CuiResId(STR_CMD);
@@ -107,7 +107,7 @@ void TipOfTheDayDialog::UpdateTip()
m_pText->set_label(aText);
// hyperlink
- aLink = std::get<1>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip]);
+ aLink = std::get<1>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip - 1]);
if (aLink.isEmpty())
{
m_pLink->set_visible(false);
@@ -148,7 +148,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]);
+ OUString aImage = std::get<2>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip - 1]);
// use default image if none is available with the number
if (aImage.isEmpty() || !file_exists(aURL + aImage))
aImage = "tipoftheday.png";
More information about the Libreoffice-commits
mailing list