Bug 137547 - Change label "Recent" to "No recent character" or "No recent color" when no recent character or color selected
Summary: Change label "Recent" to "No recent character" or "No recent color" when no r...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.0.1.2 release
Hardware: All All
: medium enhancement
Assignee: Shyam Praveen Singh
URL:
Whiteboard: target:7.2.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicDesign
Depends on:
Blocks:
 
Reported: 2020-10-17 02:31 UTC by Rizal Muttaqin
Modified: 2021-08-04 22:49 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
"Recent" should be "No Recent Character" (11.30 KB, image/png)
2020-10-17 02:31 UTC, Rizal Muttaqin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rizal Muttaqin 2020-10-17 02:31:18 UTC
Created attachment 166449 [details]
"Recent" should be "No Recent Character"

Insert Special Character has ability to store recent inserted character. When no recent character inserted, the label "Recent" should be "No Recent Character"

Step to reproduce:
1. Open Writer or Calc
2. In the Standard toolbar, click the Insert Special Character dropdown, cancel the action (press Esc e.g.)
Comment 1 Rizal Muttaqin 2020-10-21 10:44:34 UTC
After looking further, this request seems valid also against color chooser.
Comment 2 Heiko Tietze 2020-10-22 09:03:51 UTC
Yes, would be nicer to consider this a label rather than a heading.
Comment 3 Heiko Tietze 2020-10-22 09:23:19 UTC
Code pointer:
sfx2/uiconfig/ui/charmapcontrol.ui: label2
sfx2/source/control/charmapcontrol.cxx: m_aRecentCharList.size()
Comment 4 Shyam Praveen Singh 2020-11-12 06:35:46 UTC
Hi, I am a beginner and I would like to work on this bug. 

I just have to change the label from "Recent" to "No Recent Character" and "No Recent Color" for "Color"?


And I cannot find the line "m_aRecentCharList.size()" in the file "sfx2/source/control/charmapcontrol.cxx"
Comment 5 Heiko Tietze 2020-11-12 07:27:59 UTC
First, you have to make the label available at code. Add std::unique_ptr<weld::Label> m_xRecentLabel; to the header file charmapcontrol.hxx. Load the control per  ", m_xRecentLabel(m_xBuilder->weld_label("label2"))" in SfxCharmapCtrl::SfxCharmapCtrl() (sequence matters, so place the command where you added the label in the header file). Now you may set the label to either "Recent" or "No Recent Characters" depending on "m_aRecentCharList.size()>0". Add <sfx2/strings.hrc> to the includes, define the two string variables there, and use m_xRecentLabel->set_label(SfxResId(STR_RECENT)); (or STR_NORECENT respectively). Find a good place for this so the label is set initially and responds when recent items are deleted.

If you want to continue, please use "take" at the field assignee and set status to assigned.
Comment 6 Shyam Praveen Singh 2020-11-12 14:48:12 UTC
Sure I'd like to continue.
Comment 7 An-Kh 2020-11-23 02:15:55 UTC
Can I work on this issue?
Comment 8 Shyam Praveen Singh 2020-11-23 03:01:10 UTC
Hi! I am already working on this bug and I'm almost done.

You can check out more un-assigned bug here:
https://wiki.documentfoundation.org/Development/EasyHacks/by_Required_Skill/Skill_C%2B%2B
Comment 9 An-Kh 2020-11-23 17:13:26 UTC
Okay..I will look into some other bugs..
Comment 10 Shyam Praveen Singh 2020-11-26 05:46:09 UTC
Jenkins is showing me this error:

error: use of undeclared identifier 'STR_RECENT' in file
I have declared the identifiers there.
Comment 11 Heiko Tietze 2020-11-26 08:16:32 UTC
(In reply to Shyam Praveen Singh from comment #10)
> Jenkins is showing me this error...

https://gerrit.libreoffice.org/c/core/+/106557 tries to read some string but doesn't define it. Please add the new strings STR_RECENT and STR_NORECENT to sfx2/strings.hrc

Not a developer but how do you call getRecent()/getNoRecent()? Also don't get the point of initializing m_aRecentCharList with these UI strings. I would expect something like

SfxCharmapCtrl::updateRecentCharControl() //probably somewhere else
...
m_xRecentLabel->set_label(m_aRecentCharList.size() > 0 ? SfxResId(STR_RECENT) : SfxResId(STR_NORECENT));

or if you don't like this compact code

OUString sRecentLabel;
if (m_aRecentCharList.size() > 0)
    sRecentLabel = SfxResId(STR_RECENT)
else
    sRecentLabel = SfxResId(STR_NORECENT);
m_xRecentLabel->set_label(sRecentLabel);
Comment 12 Shyam Praveen Singh 2020-11-26 09:52:58 UTC
Okay, thanks! I will try to make changes and see if it works.
Comment 13 Shyam Praveen Singh 2020-11-28 05:43:13 UTC
(In reply to Heiko Tietze from comment #11)
> (In reply to Shyam Praveen Singh from comment #10)
> > Jenkins is showing me this error...
> 
> https://gerrit.libreoffice.org/c/core/+/106557 tries to read some string but
> doesn't define it. Please add the new strings STR_RECENT and STR_NORECENT to
> sfx2/strings.hrc
> 
> Not a developer but how do you call getRecent()/getNoRecent()? Also don't
> get the point of initializing m_aRecentCharList with these UI strings. I
> would expect something like
> 
> SfxCharmapCtrl::updateRecentCharControl() //probably somewhere else
> ...
> m_xRecentLabel->set_label(m_aRecentCharList.size() > 0 ?
> SfxResId(STR_RECENT) : SfxResId(STR_NORECENT));
> 
> or if you don't like this compact code
> 
> OUString sRecentLabel;
> if (m_aRecentCharList.size() > 0)
>     sRecentLabel = SfxResId(STR_RECENT)
> else
>     sRecentLabel = SfxResId(STR_NORECENT);
> m_xRecentLabel->set_label(sRecentLabel);

I removed the m_aRecentCharList from the UI strings.
Also, got rid off getRecent and getNoRecent from the charmapcontrol.hxx and added the line  m_xRecentLabel->set_label(m_aRecentCharList.size() > 0 ?
> SfxResId(STR_RECENT) : SfxResId(STR_NORECENT)); inside fxCharmapCtrl::getRecentCharacterList

I just cannot figure out how to include new strings STR_RECENT and STR_NORECENT to sfx2/strings.hrc

https://gerrit.libreoffice.org/c/core/+/106557/4#message-136970d380158171237e2083c0d278c57bf8814b
Comment 14 Heiko Tietze 2020-11-28 08:24:41 UTC
(In reply to Shyam Praveen Singh from comment #13)
> I just cannot figure out how to include new strings STR_RECENT and
> STR_NORECENT to sfx2/strings.hrc

Commented on Gerrit
Comment 15 Commit Notification 2020-12-02 15:59:23 UTC
ShyamPraveenSingh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b6c69a02222e3b6860efadb294a5b4d924bed819

Resolves tdf#137547 CharmapCtrl label depending on recent chars

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Stéphane Guillou (stragu) 2021-08-03 10:58:10 UTC
verified as fixed in:

Version: 7.2.0.2 / LibreOffice Community
Build ID: 614be4f5c67816389257027dc5e56c801a547089
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

and:

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 1dd4a80fa076bedb3a82821517036bad8dd79857
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-07-26_22:41:19
Calc: threaded
Comment 17 Rizal Muttaqin 2021-08-04 22:49:31 UTC
(In reply to Rizal Muttaqin from comment #1)
> After looking further, this request seems valid also against color chooser.

Should I file a new separate ticket for color chooser?