cui/inc/tipoftheday.hrc                                    |    2 -
 cui/source/dialogs/tipofthedaydlg.cxx                      |   17 +++++++------
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    2 -
 3 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 728548f8d7698d06c21ae37b2e03fa8e73676341
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Wed Oct 14 12:38:44 2020 +0200
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Wed Oct 14 15:09:28 2020 +0200

    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.kagan...@collabora.com>
    Tested-by: Jenkins

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";
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index b5bcb9c8bde0..f0420ec158cd 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5621,7 +5621,7 @@
           <info>
               <desc>The last shown Tip-of-the-Day.</desc>
           </info>
-          <value>0</value>
+          <value>-1</value>
       </prop>
       <prop oor:name="UseOpenCL" oor:type="xs:boolean" oor:nillable="false">
         <info>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to