Bug in KAction::initPrivate

Michael Brade brade at kde.org
Tue Sep 24 18:59:45 BST 2002


On Tuesday 24 September 2002 19:34, Ellis Whitehead wrote:
> The code isn't particularly new: at least since April, I think.
Yes, and that's the time since this menu is broken... I was lucky (or the 
opposite?) that nobody noticed (me included) up until a few days ago.

> The code
> snippet above couldn't have worked before, anyhow, because
Well, it did - at least for KDE 3.0.x :-)

> SLOT(slotToDesktop(int)) can only be connected to a signal which takes a
> single integer: e.g., SIGNAL(mySignal(int)).

> What kind of value is slotToDesktop(int) method expecting to receive?
The menu reads "To Desktop ->", the submenu contains all the desktops, e.g.
0:  All Desktops
1:  Desktop 1
2:  Desktop 2
The int is the value in the first column above, i.e. the number of the item. 
The code in KSelectAction is correct and is called if I click on such a 
desktop item:

void KSelectAction::slotActivated()
  kdDebug(129) << "KSelectAction::slotActivated currentItem=" << currentItem() 
<< " currentText=" << currentText() << endl;
  emit activated( currentItem() );
  emit activated( currentText() );

However, the connection to my slot in the constructor is missing...

** searching old code **

Ha, wait, here's the culprit - Simon and Martijn! :) They removed the 
necessary connect() call:

revision 1.278
date: 2002/07/01 21:30:38;  author: hausmann;  state: Exp;  lines: +0 -6
@@ -1923,8 +1923,6 @@ KListAction::KListAction( const QString&
 : KSelectAction( text, cut, parent, name )
   d = new KListActionPrivate;
-  if ( receiver )
-    connect( this, SIGNAL(activated(int)), receiver, slot );

(done in three KListAction constructors)
It's pretty stupid to do this connect as the KAction ctor does it, too.
Thanks Martijn for noticing.

So it wasn't your change, Ellis, but Simons. Simon, any explanation for 
breaking my app? ;-))

Michael Brade;                 KDE Developer, Student of Computer Science
  |-mail: echo brade !#|tr -d "c oh"|s\e\d 's/e/\@/2;s/$/.org/;s/bra/k/2'
  °--web: http://www.kde.org/people/michaelb.html

KDE 3: The Next Generation in Desktop Experience

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020924/feb9dda1/attachment.sig>

More information about the kde-core-devel mailing list