keditbookmark: automagically forwarding changes

Daniel Teske teske at squorn.de
Mon Jun 6 03:17:04 BST 2005


Hi

There  are 3 ways to look at these patches:

a) As a bug fix
While working on bug: 77355 I noticed that the merging-while-modified 
feature of keditbookamarks is seriosly broken.
These patches remove that feature

b) As a feature removal
These patches remove the save feature

c) As a feature addition
Any changes in keditbookmarks are immediately visible in all bookmark 
displays.


_The implementation is pretty simple:_
Every command has a function
QString affectedBookmark()
which returns the folder for which we have to send an notification.

Complexer commands are implemented as KEBMacroCommands, which is 
KMacroCommand with a affectedBookmark() function.

KEBMacroCommand returns the commonParent of all its children's 
affectedBookmark()

On every execution of a command (be it undo, redo or add), a 
notification is send.


_The implementation requires a subtle change to semantics of the signal 
KBookmarkManger::changed( const QString & groupAddress, ... )_

Currently the signal is emmited if any of the direct children of 
groupAddress has changed.
For example: Added a bookmark to groupAddress.

I don't want to generate a changed() signal for every folder which has 
been changed with a command, because every KBookmarkManager would 
reparse the whole bookmarks.xml file. So I collect all affected folders 
and determine the commonParent and send only one notification.

This requires that the signal can mean that not only the direct 
children, but all childrens might have changed.

kbookmarkmenu doesn't need a change.
kbookmarkbar needs the attachd change: 
keditbookmark-nosave-kio-bookmarks.patch


_The implementation has a bug_
The problem:
There are textfields at the bottom of keditbookmarks, I obviously don't 
want to send a notification for every key press.
Currently the changes are saved (and others notified) on LostFocus().
The problem is: LostFocus() isn't emitted if the user clicks on a 
toolbar icon.
Any ideas how to do this in a clean way? 
(Not simulation the LostFocus() event at hundred different places.)


_Comments and Feedback_
I would appreciate if anyone would test this patch and/or review the 
code.

If you notice any other strangeness in keditbookmarks, now would be a 
good time to open a bug report. 
I have identified a few bugs and code which looks broken, which I want 
to fix after this.

daniel teske
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keditbookmark-nosave-kio-bookmarks.patch
Type: text/x-diff
Size: 1874 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20050606/c0b60efc/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keditbookmark-nosave.patch
Type: text/x-diff
Size: 45513 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20050606/c0b60efc/attachment-0001.patch>


More information about the kfm-devel mailing list