Commit b6304653 authored by Kurt Granroth's avatar Kurt Granroth
Browse files

Proof of concept that the popup menus defined in XML do work!

Also, enableToolBar() isn't the best way to disable toolbars permanently.
Use <ToolBar name="mainToolBar" noMerge="1"/> instead

svn path=/trunk/kdegames/kmines/; revision=43369
parent 5e3a3b6a
......@@ -107,20 +107,6 @@ MainWidget::MainWidget()
for (uint i=0; i<levelAction.size(); i++)
levelAction[i]->setExclusiveGroup("level");
// Popup
popup = new KActionMenu(i18n("Popup"), actionCollection());
popup->insert(MENUBAR_ACTION);
popup->insert(SAVE_SETTINGS_ACTION);
popup->insert( new KActionSeparator(actionCollection()) );
popup->insert(actionCollection()->action("game_new"));
popup->insert(actionCollection()->action("game_pause"));
popup->insert( new KActionSeparator(actionCollection()) );
popup->insert(actionCollection()->action("game_highscores"));
popup->insert(actionCollection()->action("game_print"));
popup->insert( new KActionSeparator(actionCollection()) );
popup->insert(actionCollection()->action("game_quit"));
enableToolBar(KToolBar::Hide);
createGUI("ui_kmines.rc");
readSettings();
setView(status);
......@@ -166,9 +152,11 @@ void MainWidget::changeLevel(uint i)
bool MainWidget::eventFilter(QObject *, QEvent *e)
{
QPopupMenu *popup;
switch (e->type()) {
case QEvent::MouseButtonPress :
if ( ((QMouseEvent *)e)->button()!=RightButton ) return FALSE;
popup = (QPopupMenu*)factory()->container("popup", this);
popup->popup(QCursor::pos());
return TRUE;
default : return FALSE;
......
......@@ -30,7 +30,6 @@ class MainWidget : public KTMainWindow
private:
KAccel *kacc;
KActionMenu *popup;
QArray<KRadioAction *> levelAction;
Status *status;
......
......@@ -17,4 +17,18 @@
<Action name="level_custom"/>
</Menu>
</MenuBar>
<Menu name="popup">
<Action name="options_show_menubar"/>
<Action name="options_save_options"/>
<Separator/>
<Action name="game_new"/>
<Separator/>
<Action name="game_highscores"/>
<Separator/>
<Action name="game_pause"/>
<Action name="game_print"/>
<Separator/>
<Action name="game_quit"/>
</Menu>
<ToolBar name="mainToolBar" noMerge="1"/>
</kpartgui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment