[PATCH] Fix 20522 - kedittoolbar does not handle iconsets

Ravikiran Rajagopal ravi at ee.eng.ohio-state.edu
Wed Mar 12 00:18:47 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
  KGuiItem can have either an icon or an iconset. If it has one, it returns 
true on hasIcon(). However, its icon() method returns an empty string if it 
contains only an iconset. This means that KEditToolbar does not show an 
associated icon. (The bug reporter's patch does not work any longer as too 
many things have changed in the last 2 years.) The follwing patch fixes it. 
Ok to commit? Should (nearly trivial) patches like this be submitted for 
review?

Regards,
Ravi

Index: kedittoolbar.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kedittoolbar.cpp,v
retrieving revision 1.72
diff -u -p -r1.72 kedittoolbar.cpp
- --- kedittoolbar.cpp    30 Dec 2002 20:37:47 -0000      1.72
+++ kedittoolbar.cpp    12 Mar 2003 00:08:26 -0000
@@ -646,7 +646,10 @@ void KEditToolbarWidget::loadActionList(
         ToolbarItem *act = new ToolbarItem(m_activeList, it.tagName(), 
action->name(), action->toolTip());
         act->setText(1, action->plainText());
         if (action->hasIcon())
- -          act->setPixmap(0, BarIcon(action->icon(), 16));
+          if (!action->icon().isEmpty())
+            act->setPixmap(0, BarIcon(action->icon(), 16));
+          else // Has iconset
+            act->setPixmap(0, action->iconSet(KIcon::Small).pixmap());

         active_list.insert(action->name(), true);
         break;
@@ -665,8 +668,11 @@ void KEditToolbarWidget::loadActionList(

     ToolbarItem *act = new ToolbarItem(m_inactiveList, tagActionList, 
action->name(), action->toolTip());
     act->setText(1, action->plainText());
- -    if (!action->icon().isEmpty())
+    if (action->hasIcon())
+      if (!action->icon().isEmpty())
         act->setPixmap(0, BarIcon(action->icon(), 16));
+      else // Has iconset
+        act->setPixmap(0, action->iconSet(KIcon::Small).pixmap());
   }

   // finally, add a default separator to the inactive list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+bnzvbI8Y8y0oVXcRAkS3AJ4nbyrGJHhj/E8qonJckMWmfvpGJwCePZ4C
ma6Sbh1o9C+5/ymuVQiHvjE=
=annp
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list