[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdegames/ktron
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-06-02 14:17:45
Message-ID: 20040602141745.DD3F0126EB () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

Fix custom shortcuts. (BR82385)
CCMAIL: 82385-done@bugs.kde.org


  M +24 -15    ktron.cpp   1.51


--- kdegames/ktron/ktron.cpp  #1.50:1.51
@@ -55,18 +55,28 @@ KTron::KTron(QWidget *parent, const char
   statusBar()->insertItem("abcdefghijklmnopqrst: 0  ",ID_STATUS_BASE+2);
 
-  actionCollection()->setAutoConnectShortcuts(false);
-  (void)new KAction(i18n("Player 1 Up"), Key_R, 0, 0, actionCollection(), "Pl1Up");
-  (void)new KAction(i18n("Player 1 Down"), Key_F, 0, 0, actionCollection(), "Pl1Down");
-  (void)new KAction(i18n("Player 1 Right"), Key_G, 0, 0, actionCollection(), "Pl1Right");
-  (void)new KAction(i18n("Player 1 Left"), Key_D, 0, 0, actionCollection(), "Pl1Left");
-  (void)new KAction(i18n("Player 1 Accelerator"), Key_A, 0, 0, actionCollection(), "Pl1Ac");
- 
-  (void)new KAction(i18n("Player 2 Up"), Key_Up, 0, 0, actionCollection(), "Pl2Up");
-  (void)new KAction(i18n("Player 2 Down"), Key_Down, 0, 0, actionCollection(), "Pl2Down");
-  (void)new KAction(i18n("Player 2 Right"), Key_Right, 0, 0, actionCollection(), "Pl2Right");
-  (void)new KAction(i18n("Player 2 Left"), Key_Left, 0, 0, actionCollection(), "Pl2Left");
-  (void)new KAction(i18n("Player 2 Accelerator"), Key_0, 0, 0, actionCollection(), "Pl2Ac");
+  // We match up keyboard events ourselves in Tron::keyPressEvent()
+  // We must disable the actions, otherwise we don't get the keyPressEvent's
+  KAction *act;
+  act = new KAction(i18n("Player 1 Up"), Key_R, 0, 0, actionCollection(), "Pl1Up");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 1 Down"), Key_F, 0, 0, actionCollection(), "Pl1Down");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 1 Right"), Key_G, 0, 0, actionCollection(), "Pl1Right");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 1 Left"), Key_D, 0, 0, actionCollection(), "Pl1Left");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 1 Accelerator"), Key_A, 0, 0, actionCollection(), "Pl1Ac");
+  act->setEnabled(false);
 
-  actionCollection()->setAutoConnectShortcuts(true);
+  act = new KAction(i18n("Player 2 Up"), Key_Up, 0, 0, actionCollection(), "Pl2Up");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 2 Down"), Key_Down, 0, 0, actionCollection(), "Pl2Down");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 2 Right"), Key_Right, 0, 0, actionCollection(), "Pl2Right");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 2 Left"), Key_Left, 0, 0, actionCollection(), "Pl2Left");
+  act->setEnabled(false);
+  act = new KAction(i18n("Player 2 Accelerator"), Key_0, 0, 0, actionCollection(), "Pl2Ac");
+  act->setEnabled(false);
 
   tron->setActionCollection(actionCollection());
@@ -76,6 +86,5 @@ KTron::KTron(QWidget *parent, const char
   KStdGameAction::quit(this, SLOT( close() ), actionCollection());
 
-  KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), 
-actionCollection());
+  KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
    
   KStdAction::preferences(this, SLOT(showSettings()), actionCollection());


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic