[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 49601] ALT-F1 shortcut opens K-Menu at random location
From: "Aaron J.Seigo" <aseigo () kde ! org>
Date: 2005-01-12 4:11:24
Message-ID: 20050112041124.29204.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=49601
aseigo kde org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
------- Additional Comments From aseigo kde org 2005-01-12 05:11 -------
CVS commit by aseigo:
handle multiple kmenu buttons properly
BUG:49601
M +2 -2 buttons/kbutton.cpp 1.21
M +44 -3 core/menumanager.cpp 1.4
M +6 -4 core/menumanager.h 1.3
M +2 -2 ui/service_mnu.cpp 1.89
M +1 -1 ui/service_mnu.h 1.35
--- kdebase/kicker/buttons/kbutton.cpp #1.20:1.21
@ -43,5 +43,5 @ KButton::KButton( QWidget* parent )
setPopup(MenuManager::the()->kmenu());
- MenuManager::the()->setKButton(this);
+ MenuManager::the()->registerKButton(this);
setIcon("kmenu");
}
@ -49,5 +49,5 @ KButton::KButton( QWidget* parent )
KButton::~KButton()
{
- MenuManager::the()->setKButton(0);
+ MenuManager::the()->unregisterKButton(this);
}
--- kdebase/kicker/ui/service_mnu.cpp #1.88:1.89
@ -419,6 +419,6 @ void PanelServiceMenu::activateParent(co
else
{
- PanelPopupButton *kButton = MenuManager::the()->KButton();
- if (kButton && (kButton->popup() == this))
+ PanelPopupButton *kButton = MenuManager::the()->findKButtonFor(this);
+ if (kButton)
{
adjustSize();
--- kdebase/kicker/ui/service_mnu.h #1.34:1.35
@ -44,5 +44,5 @ typedef QMap<int, KSycocaEntry::Ptr> Ent
typedef QPtrList<QPopupMenu> PopupMenuList;
-class PanelServiceMenu : public KPanelMenu
+class KDE_EXPORT PanelServiceMenu : public KPanelMenu
{
Q_OBJECT
--- kdebase/kicker/core/menumanager.h #1.2:1.3
@ -32,4 +32,6 @ class KickerClientMenu;
class PanelPopupButton;
+typedef QPtrList<PanelPopupButton> KButtonList;
+
/**
* The factory for menus created by other applications. Also the owner of these menus.
@ -53,7 +55,7 @ public:
void popupKMenu(const QPoint &p);
- // TODO: this is totally unuseful for multiple KMenu buttons
- void setKButton(PanelPopupButton *button) { m_kbutton = button; }
- PanelPopupButton* KButton() { return m_kbutton; }
+ void registerKButton(PanelPopupButton *button);
+ void unregisterKButton(PanelPopupButton *button);
+ PanelPopupButton* findKButtonFor(QPopupMenu* menu);
public slots:
@ -73,5 +75,5 @ private:
static MenuManager* m_self;
- PanelPopupButton* m_kbutton;
+ KButtonList m_kbuttons;
};
--- kdebase/kicker/core/menumanager.cpp #1.3:1.4
@ -29,7 +29,9 @ CONNECTION WITH THE SOFTWARE OR THE USE
#include <dcopclient.h>
+#include "client_mnu.h"
+#include "global.h"
#include "k_mnu.h"
#include "kicker.h"
-#include "client_mnu.h"
+#include "panelbutton.h"
#include "menumanager.h"
@ -90,4 +92,33 @ void MenuManager::popupKMenu(const QPoin
}
+void MenuManager::registerKButton(PanelPopupButton *button)
+{
+ if (!button)
+ {
+ return;
+ }
+
+ m_kbuttons.append(button);
+}
+
+void MenuManager::unregisterKButton(PanelPopupButton *button)
+{
+ m_kbuttons.remove(button);
+}
+
+PanelPopupButton* MenuManager::findKButtonFor(QPopupMenu* menu)
+{
+ KButtonList::const_iterator itEnd = m_kbuttons.end();
+ for (KButtonList::const_iterator it = m_kbuttons.begin(); it != itEnd; ++it)
+ {
+ if ((*it)->popup() == menu)
+ {
+ return *it;
+ }
+ }
+
+ return 0;
+}
+
void MenuManager::kmenuAccelActivated()
{
@ -95,8 +126,12 @ void MenuManager::kmenuAccelActivated()
{
m_kmenu->hide();
+ return;
}
- else
- {
+
m_kmenu->initialize();
+
+ if (m_kbuttons.isEmpty())
+ {
+ // no button to use, make it behave like a desktop menu
QPoint p;
// Popup the K-menu at the center of the screen.
@ -113,4 +148,10 @ void MenuManager::kmenuAccelActivated()
QTimer::singleShot(0, this, SLOT(slotSetKMenuItemActive()));
}
+ else
+ {
+ PanelPopupButton* button = m_kbuttons.at(0);
+ m_kmenu->popup(popupPosition(button->popupDirection(),
+ m_kmenu, button));
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic