Bug 112127 - Rename page dialog title says 'Rename Slide'
Summary: Rename page dialog title says 'Rename Slide'
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Muhammet Kara
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp, skillUI
Depends on:
Blocks: SD-Shared-Code
  Show dependency treegraph
 
Reported: 2017-08-31 07:13 UTC by Yousuf Philips (jay) (retired)
Modified: 2019-10-30 15:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2017-08-31 07:13:56 UTC
Steps:
1. Open Draw
2. Right-click on page in the page pane and click 'Rename Page'
3. Dialog appears with the title 'Rename Slide'

Version: 6.0.0.0.alpha0+
Build ID: 0e35b7738d9f276c0566df0f2cc0f1eed7900d6c
CPU threads: 2; OS: Linux 4.4; UI render: default; VCL: gtk2; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 1 Jacques Guilleron 2017-08-31 16:03:25 UTC
Hi Yousuf,
Reproduced with 
LO 6.0.0.0.alpha0+ Build ID: 9420391cc9f6af2a16c1db72596f277439df29e9
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2017-08-29_06:08:06
Locale: fr-FR (fr_FR); Calc: CL
also with 
LO 3.5.3.2 Version ID : 235ab8a-3802056-4a8fed3-2d66ea8-e241b80
and
OOo 3.1.0 000310m11 (Build:9399) on windows XP
so Inherited from OOo.
Comment 2 QA Administrators 2019-06-30 02:51:04 UTC Comment hidden (obsolete)
Comment 3 Muhammet Kara 2019-07-02 14:33:34 UTC
Actually, the Draw page is also named as "Slide 1". It should be "Page 1" instead.
Comment 4 Muhammet Kara 2019-07-02 15:54:43 UTC
(In reply to Muhammet Kara from comment #3)
> Actually, the Draw page is also named as "Slide 1". It should be "Page 1"
> instead.

Let's keep this separate for now.

Here are the code pointers (or, suggested workflow):

Let's try to find the code pointers together. We will use the Linux/bash terminal command "grep" to search through the source files. We will issue commands inside the "core" repo.

 core  git grep "Rename Slide"
android/source/res/values/strings.xml:    <string name="action_rename_slide">Rename Slide</string>
officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu:          <value xml:lang="en-US">Rename Slide</value>
sd/inc/strings.hrc:#define STR_TITLE_RENAMESLIDE                           NC_("STR_TITLE_RENAMESLIDE", "Rename Slide")

So there are 3 possible candidates where this string is used. Pay attention to sd/inc/strings.hrc:#define STR_TITLE_RENAMESLIDE

STR_TITLE_RENAMESLIDE here is called a define, and it is used as a shortcut (google "preprocessor macros" for more info) to the string, and it allows localization. Wherever we use this shortcut instead of directly using the string itself, it will come up as a localized version for the user's language.

Now, let's see where this shortcut is used:
 core  git grep -n STR_TITLE_RENAMESLIDE
sd/inc/strings.hrc:235:#define STR_TITLE_RENAMESLIDE                           NC_("STR_TITLE_RENAMESLIDE", "Rename Slide")
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867:        aTitle = SdResId( STR_TITLE_RENAMESLIDE );
sd/source/ui/view/drviews2.cxx:792:                OUString aTitle = SdResId(STR_TITLE_RENAMESLIDE);
sd/source/ui/view/unmodpg.cxx:175:    , maComment(SdResId(STR_TITLE_RENAMESLIDE))

Since we are interested in the title of a dialog, it is probably a good idea to check the instances of variable named "aTitle". (Btw, you see that we used "grep -n" instead of "grep" this time. "-n" brings the results with line numbers.)

A quick way to check which one is correct is to put a break point to the concerned lines, open a new Draw doc, right click on the page on the page pane, and select "Rename Page". If you hit a break point, you will know it is the right place. Let's do that:

(You need to have gdb installed on your system, you should be inside the core directory, and you should have a debug build: simply add these to your autogen.input file before building:
--enable-debug
--enable-dbgutil)

 core  make debugrun
.....

(gdb) b /home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867
No source file named /home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (/home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867) pending.

(gdb) b /home/kara/core/sd/source/ui/view/drviews2.cxx:792
No source file named /home/kara/core/sd/source/ui/view/drviews2.cxx.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (/home/kara/core/sd/source/ui/view/drviews2.cxx:792) pending.

(WATCH OUT! We have put the full paths of the source files beginning with /home...)

(gdb) run --draw

...

Thread 1 "soffice.bin" hit Breakpoint 2, sd::slidesorter::controller::SlotManager::RenameSlide (this=0x1ef8190, rRequest=...) at /home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867
867	        aTitle = SdResId( STR_TITLE_RENAMESLIDE );

Ahhaa!

That's where the title of our rename dialog is determined.

Now:
* Just put an if-check against DocumentType, and put STR_TITLE_RENAMESLIDE or STR_TITLE_RENAMEPAGE based on the document type. (If there is no STR_TITLE_RENAMEPAGE, go to where STR_TITLE_RENAMESLIDE is defined, and add it there)

* You can get the document type with mrSlideSorter.GetModel().GetDocument()->GetDocumentType()

May it be easy! :)
Comment 5 Muhammet Kara 2019-10-30 15:58:09 UTC
Fixed with commit f943dd99ce7dfab222edaafbc7e5d3711781f89c

https://gerrit.libreoffice.org/#/c/81738/