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

List:       kde-core-devel
Subject:    [PATCH] kaction.cpp
From:       Martijn Klingens <mklingens () yahoo ! com>
Date:       2001-05-30 15:48:05
[Download RAW message or body]

Attached is a patch for KAction to support iconsets/pixmaps when plugged into 
popup menus. A few styles (KDE SGI, Marble, Risc OS and MegaGradient) break 
with checkable menu items that have icons. IMO those styles need to be fixed 
and KAction should not hide the pixmaps instead. Besides, some parts of KDE 
already use checkable menu entries with icons outside of KAction, so the 
problems are there already anyway.

Please review, I can commit myself.

Martijn

["kaction.cpp.patch" (text/plain)]

Index: kaction.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kaction.cpp,v
retrieving revision 1.182
diff -b -u -p -r1.182 kaction.cpp
--- kaction.cpp	2001/05/25 22:32:10	1.182
+++ kaction.cpp	2001/05/30 15:38:38
@@ -428,12 +428,10 @@ int KAction::plug( QWidget *w, int index
     QPopupMenu* menu = static_cast<QPopupMenu*>( w );
     int id;
 
-    if (!inherits("KToggleAction")) {
-        if ( !d->m_pixmap.isNull() ) {
+    if ( !d->m_pixmap.isNull() )
             id = menu->insertItem( d->m_pixmap, this, SLOT( slotActivated() ),
                                    d->m_accel, -1, index );
-        } else {
-            if ( d->m_bIconSet )
+		else if ( d->m_bIconSet )
                 id = menu->insertItem( iconSet(), d->m_text, this,//dsweet
                                        SLOT( slotActivated() ), d->m_accel,
                                        -1, index );
@@ -441,14 +439,6 @@ int KAction::plug( QWidget *w, int index
                 id = menu->insertItem( d->m_text, this,
                                        SLOT( slotActivated() ),  //dsweet
                                        d->m_accel, -1, index );
-        }
-    } else {
-        // toggle actions do not have a pixmap or icon in the menu
-        // Lotzi B.
-        id = menu->insertItem( d->m_text, this,
-                               SLOT( slotActivated() ),
-                               d->m_accel, -1, index );
-    }
 
     // call setItemEnabled only if the item really should be disabled,
     // because that method is slow and the item is per default enabled


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

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