KMenu weirdness with accelerator char

Martin Koller kollix at aon.at
Sat Aug 29 14:49:00 BST 2009


Hi,

I've got a problem with KMenu (in kmail) in trunk:
It inserts a list of strings for some actions (in this case each string is an email address).
Whenever the result of menu.exec() is asked for its text(), the text contains an "&" accelerator 
character.

Using the same code but just QMenu instead, does not show this behavior.
I looked through KMenu's code but couldn't find the problem (as setKeyboardShortcutsEnabled is OFF 
by default)

Code:

  KMenu menu( this );
  menu.setObjectName( "Addresschooser" );
  for ( QStringList::const_iterator it = emails.begin(), end = emails.end() ; it != end; ++it )
  {
    kDebug() << *it;
    menu.addAction( *it );
  }
  const QAction *result = menu.exec( QCursor::pos() );
  if ( !result )
    return;
    kDebug() << "result:" << result->text();
 

The debug output:
kmail(7045) KMLineEdit::insertEmails: "martin.koller at etm.at"                                                                     
kmail(7045) KMLineEdit::insertEmails: "koller at etm.at"                                                                            
kmail(7045) KMLineEdit::insertEmails: "martin.b.koller at siemens.com"                                                              
kmail(7045) KMLineEdit::insertEmails: result: "&koller at etm.at"                                                                   

-- 
Best regards/Schöne Grüße

Martin    ()  ascii ribbon campaign - against html mail 
          /\                        - against microsoft attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090829/0ce4da15/attachment.sig>


More information about the kde-core-devel mailing list