diff options
Diffstat (limited to 'cui')
-rw-r--r-- | cui/inc/tipoftheday.hrc | 2 | ||||
-rw-r--r-- | cui/source/dialogs/tipofthedaydlg.cxx | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/cui/inc/tipoftheday.hrc b/cui/inc/tipoftheday.hrc index f464a1f3d936..acb7bdd15d3e 100644 --- a/cui/inc/tipoftheday.hrc +++ b/cui/inc/tipoftheday.hrc @@ -273,7 +273,7 @@ const std::tuple<const char*, OUString, OUString> TIPOFTHEDAY_STRINGARRAY[] = #define STR_MORE_LINK NC_("STR_MORE_LINK", "More info") #define STR_UNO_LINK NC_("STR_UNO_LINK", "Run this action now...") #define STR_UNO_EXECUTE NC_("STR_UNO_EXECUTE", "Execute the command %COMMAND") //tooltip for STR_UNO_LINK -#define STR_TITLE NC_("STR_TITLE", "Tip of the Day") +#define STR_TITLE NC_("STR_TITLE", "Tip of the Day: %CURRENT/%TOTAL") #define STR_CMD NC_("STR_CMD", "⌘ Cmd") //use narrow no-break space U+202F here #define STR_CTRL NC_("STR_CTRL", "Ctrl") #define STR_Alt NC_("STR_CMD", "Alt") 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"; |