[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: PATCH: "configure toolbars" in toolbar context menu
From: Hans Meine <hans_meine () gmx ! net>
Date: 2001-07-16 19:25:36
[Download RAW message or body]
Hi again,
since I could not react this weekend, and the freeze has become even
"harder", I´d like to know if the stripped-down ktoolbar-patch
(attached again) should be committed for 2.2?
(For the record: I tested it and found no problems so far..)
I´d even like to look into how to provide a "configure this toolbar"-
entry, but that´s for after 2.2 of course.
David Faure <david@mandrakesoft.com> writes:
> On Friday 13 July 2001 14:07, Hans Meine wrote:
> > For a long time, I was wondering, why there was no "configure
> > toolbars" in the context menu. I think this is much more intuitive.
>
> Excellent idea.
>
> > Now I looked into it and prepared a patch, but there are some things I
> > find not so nice and want to note:
> >
> > 1) Finding the right action is not really failsave. I thought most
> > programs would use the standardaction, but those I looked into
> > explicitely gave it another name ("configuretoolbars"). I thought
> > about it and made it possible to give the right action to the toolbar.
> > If this is not done, the toolbar looks for the stdname and
> > "configuretoolbars" in the actionCollection (which it has to look for,
> > too). Maybe this is not nice, but it makes it work out-of-the-box in
> > many programs (konq, koffice, ...)
>
> Ok, you can remove that now, I have converted konqueror and koffice to the
> standard naming for those two actions.
> (In case you wonder: I think those were using those actions before they were
> made standard, hence the non-standard names).
[snip]
--
Ciao, / /
/--/
/ / ANS .,* Hamburg, Germany *,.
[Attachment #3 (text/x-patch)]
Index: ktoolbar.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ktoolbar.cpp,v
retrieving revision 1.265
diff -b -u -3 -p -d -r1.265 ktoolbar.cpp
--- ktoolbar.cpp 2001/05/27 10:23:52 1.265
+++ ktoolbar.cpp 2001/07/16 19:14:05
@@ -1,6 +1,6 @@
/* This file is part of the KDE libraries
Copyright
- (C) 2000 Reinald Stadlbauer (reggie@kde.org)
+ (C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997, 1998 Stephan Kulow (coolo@kde.org)
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Sven Radej (radej@kde.org)
@@ -41,6 +41,8 @@
#include "kseparator.h"
#include <klocale.h>
#include <kapp.h>
+#include <kaction.h>
+#include <kstdaction.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kiconloader.h>
@@ -83,6 +85,7 @@ public:
m_enableContext = true;
m_xmlguiClient = 0;
+ m_configurePlugged = false;
hasRealPos = FALSE;
oldPos = QMainWindow::Unmanaged;
@@ -107,6 +110,7 @@ public:
QMainWindow::ToolBarDock oldPos;
KXMLGUIClient *m_xmlguiClient;
+ bool m_configurePlugged;
bool modified;
bool positioned;
@@ -1127,7 +1131,6 @@ void KToolBar::setXMLGUIClient( KXMLGUIC
d->m_xmlguiClient = client;
}
-
void KToolBar::setText( const QString & txt )
{
setLabel( txt );
@@ -1194,7 +1197,7 @@ void KToolBar::mousePressEvent ( QMouseE
if ( i >= CONTEXT_ICONSIZES )
setIconSize( i - CONTEXT_ICONSIZES );
else
- kdWarning(220) << "No such menu item " << i << " in toolbar \
context menu" << endl; + return; // assume this was an action \
handled elsewhere, no need for setSettingsDirty() }
if ( mw->inherits("KMainWindow") )
static_cast<KMainWindow *>(mw)->setSettingsDirty();
@@ -1989,6 +1992,23 @@ KPopupMenu *KToolBar::contextMenu()
void KToolBar::slotContextAboutToShow()
{
+ if (!d->m_configurePlugged)
+ {
+ // try to find "configure toolbars" action
+ KXMLGUIClient *xmlGuiClient = d->m_xmlguiClient;
+ if ( !xmlGuiClient && parentWidget() && parentWidget()->inherits( "KMainWindow" \
) ) + xmlGuiClient = (KMainWindow *)parentWidget();
+ if ( xmlGuiClient )
+ {
+ KAction *configureAction = \
xmlGuiClient->actionCollection()->action(KStdAction::stdName(KStdAction::ConfigureToolbars));
+ if ( configureAction )
+ {
+ configureAction->plug(context);
+ d->m_configurePlugged = true;
+ }
+ }
+ }
+
for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i)
context->setItemChecked(i, false);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic