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

List:       kde-core-devel
Subject:    [Bug] Accels in KActionMenus aren't enabled by
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2004-01-31 14:00:09
Message-ID: 200401311500.18969 () erwin ! ingo-kloecker ! de
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

see http://bugs.kde.org/show_bug.cgi?id=70459 for a real world example. 
Additionally the attached patch (applied to kdelibs/kparts/tests) 
demonstrates the bug. As long as part 2 hasn't been activated the 
shortcut for "Part 1's Menu->Blah" (which is 'a') and the shortcut for 
"Part 1's Menu->Foo->Bar" (which is 'f') both work. Now activate part 2 
and then reactivate part 1. You can now verify that 'a' is still 
working but that 'f' doesn't work anymore.

Regards,
Ingo

["kpartstest.diff" (text/x-diff)]

Index: kpartstest_part1.rc
===================================================================
RCS file: /home/kde/kdelibs/kparts/tests/kpartstest_part1.rc,v
retrieving revision 1.4
diff -u -3 -p -r1.4 kpartstest_part1.rc
--- kpartstest_part1.rc	6 Feb 2000 22:10:14 -0000	1.4
+++ kpartstest_part1.rc	31 Jan 2004 13:39:17 -0000
@@ -6,6 +6,7 @@
  </Menu>
  <Menu name="Part1Menu"><text>Part1's Menu</text>
   <Action name="p1_blah"/>
+  <Action name="p1_foo"/>
   <Menu name="Part1Sub"><text>Stupid Submenu</text>
    <Action name="p1_blah"/>
   </Menu>
Index: parts.cpp
===================================================================
RCS file: /home/kde/kdelibs/kparts/tests/parts.cpp,v
retrieving revision 1.12
diff -u -3 -p -r1.12 parts.cpp
--- parts.cpp	10 Oct 2001 17:40:41 -0000	1.12
+++ parts.cpp	31 Jan 2004 13:39:17 -0000
@@ -24,10 +24,19 @@ Part1::Part1( QObject *parent, QWidget *
   m_instance = new KInstance( "kpartstestpart" );
   setInstance( m_instance );
   m_edit = new QMultiLineEdit( parentWidget );
+  m_edit->setReadOnly( true );
   setWidget( m_edit );
   setXMLFile( "kpartstest_part1.rc" );
 
-  /*KAction * paBlah = */ new KAction( "Blah", "filemail", 0, actionCollection(), "p1_blah" );
+  /*KAction * paBlah = */ new KAction( "Blah", "filemail", Key_A, this,
+                                       SLOT( slotBlah() ),
+                                       actionCollection(), "p1_blah" );
+  KActionMenu * menu = new KActionMenu( "Foo", "mail_forward",
+                                        actionCollection(),
+                                        "p1_foo" );
+  menu->insert( new KAction( "Bar", "mail_forward", Key_F, this,
+                             SLOT( slotFooBar() ),
+                             actionCollection(), "p1_foo_bar" ) );
 }
 
 Part1::~Part1()
@@ -35,6 +44,16 @@ Part1::~Part1()
   delete m_instance;
 }
 
+void Part1::slotBlah()
+{
+  m_edit->setText( "Blah" );
+}
+
+void Part1::slotFooBar()
+{
+  m_edit->setText( "FooBar" );
+}
+
 bool Part1::openFile()
 {
   kdDebug() << "Part1: opening " << QFile::encodeName(m_file) << endl;
@@ -66,8 +85,8 @@ Part2::Part2( QObject *parent, QWidget *
 
   QCheckBox * cb = new QCheckBox( "something", w );
 
-  QLineEdit * l = new QLineEdit( "something", widget() );
-  l->move(0,50);
+  //QLineEdit * l = new QLineEdit( "something", widget() );
+  //l->move(0,50);
   // Since the main widget is a dummy one, we HAVE to set
   // strong focus for it, otherwise we get the
   // the famous activating-file-menu-switches-part bug.
Index: parts.h
===================================================================
RCS file: /home/kde/kdelibs/kparts/tests/parts.h,v
retrieving revision 1.5
diff -u -3 -p -r1.5 parts.h
--- parts.h	6 Feb 2000 21:06:51 -0000	1.5
+++ parts.h	31 Jan 2004 13:39:17 -0000
@@ -16,6 +16,10 @@ public:
   Part1( QObject *parent, QWidget * parentWidget );
   virtual ~Part1();
 
+public slots:
+ void slotBlah();
+ void slotFooBar();
+
 protected:
   virtual bool openFile();
 

[Attachment #6 (application/pgp-signature)]

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

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