PATCH: Open With...

David Faure david at mandrakesoft.com
Tue Jul 16 09:37:51 BST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 16 July 2002 07:10, Dawit A. wrote:
> On Monday 15 July 2002 21:57, Dawit A. wrote:
> > On Monday 15 July 2002 04:04, David Faure wrote:
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > On Sunday 14 July 2002 20:27, Dawit A. wrote:
> > > > - Make sure that separators are added properly.  Currently there were
> > > > cuircumstances where a double/triple separators were being drawn. The
> > > > way to make sure this does not happen is to only add separators
> > > > "before" adding new menu items, never "after".  The culprit for the
> > > > above problem were the plugins, specifically the kuick plugin.  As
> > > > such, with the patch attached below, a plugin no longer needs to add
> > > > any separator unless it specifically needs to separate its own items...
> > >
> > > I don't see the point of this change. IIRC the logic was simply the other
> > > way round: "always add separators _after_ adding new menu items, never
> > > _before_".
> >
> > Well IMHO that was part of the problem :) . Deciding whether or not you
> > need to add separators should be done before adding the item that you want
> > to separate. A couple of reasons for this.  The first being that the popup
> > menu is context based.  As such things are shown based on context.  This
> > means you do not want to draw a separator that might otherwise be
> > unnecessary if that particular group of items are not supposed to be
> > shown...  The other issue is that you are more likely to add a unwanted
> > separator "after" the last item than "before" the first item :)  Believe me
> > I run into this problem before with my own dirfilter plugins and ever since
> > I adapted the "before" approach I never once had that problem anymore.
> 
> On second though... I take back almost all that I said except that my patch 
> working under all the circumstances I tested :) It really does not matter 
> whether the approach followed is "before-items" or "after-items" so long as 
> one mode is used consistently throughout.  
Exactly.

> It just happens that this is not 
> currently done consistently in konq_popupmenu.  Specially, the way addPlugins 
> are handled. 

Can this be fixed instead?

> and want a separator b/n items B and C, then the separator is "tied to item C" 
> instead of item B.  Thus, for example if items C & D are only used in certain 
> contexts:
> 
> item A
> item B
> 
> if ( context )
> {
>   addSeparator();
>  item C;
>  item D;
> }

... and another addSeparator before "item E", since you assume there's
something following in the code below.

> By comparison the "after-items" will tie the separator to item B:
> 
> item A
> item B
> addSeparator ()
> 
> if (context)
> {
>   item C
>   item D
>   addSeparator ()
> }

.... and here, no need for an addSeparator before "item E", it's already been done.
So it's exactly the same amount of addSeparator calls.

> The only down side is that you have to be careful not to be left with a 
> separator at the end.  However, the same is true for the other approach as 
> well where you do not want to accidentally start with a separator ; so it 
> does not really matter how it is done so long as the same approach is used 
> throughout...  
Exactly.

> For me it is much much easier to follow the "before-items" 
> approach
I really don't see why!
It's the same thing. Instead of
"separator ; group of items"
it's
"group of items ; separator"
What's easier to follow in one compared to the other?

> hence the implementation in my patch... YMMV
So I take it you're not willing to make a patch that fixes the plugin issue
with the "after items" solution? :(

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
KOffice-1.2-beta2 is out! http://dot.kde.org/1025176121/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9M9tf72KcVAmwbhARAip1AJ9Th1z1IaLiXxOjj87WK7zx8QxoOACdE98i
mDRyaxvIzI+NuqJsNh5fycU=
=S7Mi
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list