Bug 287198 - Action "Add a note" could edit an existing note (not erase it)
Summary: Action "Add a note" could edit an existing note (not erase it)
Alias: None
Product: lokalize
Classification: Applications
Component: editor (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Nick Shaforostoff
Depends on:
Reported: 2011-11-21 22:04 UTC by Lasse Liehu
Modified: 2011-12-06 10:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:

Patch with minor modifications to make the fix work (971 bytes, patch)
2011-12-06 05:53 UTC, Lasse Liehu

Note You need to log in before you can comment on or make changes to this bug.
Description Lasse Liehu 2011-11-21 22:04:28 UTC
Version:           unspecified (using KDE 4.7.3) 
OS:                Linux

Currently the toolbar action / keyboard shortcut for "Add a note" erases the current note for an entry.

Reproducible: Didn't try

Expected Results:  
Would be great if it instead changed the current note into edit mode, perhaps all of it already selected (like having both features).
Comment 1 Nick Shaforostoff 2011-12-03 09:45:00 UTC
i couldnt reproduce this behaviour. if the note is present, then 'edit' link is displayed instead of 'add note'. 

do you work with PO or XLIFF?
can you send me the file with notes?
Comment 2 Lasse Liehu 2011-12-03 12:40:07 UTC
Yes, that way works fine. This bug is about "the toolbar action / keyboard shortcut".

I'm working with PO files (KDE ones to be exact). Should happen with every PO file. Don't know about XLIFF files.

Example steps to reproduce for the keyboard shortcut:
1. Open a .po file
2. From menu Settings | Configure Shortcuts...
3. Add Ctrl+Alt+H as the shortcut for "Add a note" and press OK
2. Press Ctrl+Alt+H and type a note.
3. Save it and press Ctrl+Alt+H again

Steps to reproduce for the toolbar action:
1. Open a .po file
2. From menu Settings | Configure Toolbars...
3. Add action "Add a note" to the "Main Toolbar <Editor>" and press OK
4. Click that button on the toolbar and type a note.
5. Save it and press the button again

In both cases the edit box now opens empty (not with the existing note's content). Thus if the note is now saved, the old one is lost. Canceling preserves it.

The action is connected to MsgCtxtView::addNoteUI() in EditorTab::setupActions(). It always simulates clicking "note:/add" whereas "Edit..." link is "note:/%1" with some value.
Comment 3 Nick Shaforostoff 2011-12-03 15:21:18 UTC
ok, now i see the problem
Comment 4 Nick Shaforostoff 2011-12-03 17:45:56 UTC
SVN commit 1267125 by shaforo:

BUG: 287198
make overwriting existing notes impossible:
edit existing note instead, if multiple notes are not supported
(this is the case for PO)

 M  +1 -1      editortab.cpp  
 M  +13 -5     msgctxtview.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1267125
Comment 5 Lasse Liehu 2011-12-06 05:50:36 UTC
This fix crashes for me when adding a new note (if it didn't already exist) and doesn't edit the existing note, either. Thanks for quick response by the way.
Comment 6 Lasse Liehu 2011-12-06 05:53:54 UTC
Created attachment 66428 [details]
Patch with minor modifications to make the fix work

With these modifications it now works for both cases mentioned in the previous comment.
Comment 7 Nick Shaforostoff 2011-12-06 10:46:11 UTC
SVN commit 1267265 by shaforo:

CCBUG: 287198
fix crash ;)

thanks for the feedback, Lasse!

 M  +6 -6      msgctxtview.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1267265