Holger Hans Peter Freyther <holger.freyther@trolltech.com>
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Mar 2008 11:38:07 +0000 (11:38 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Mar 2008 11:38:07 +0000 (11:38 +0000)
* Set a Icon on the QAction if we have one.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30956 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog

index 4121a41..c128826 100644 (file)
@@ -60,6 +60,7 @@
 #include "WindowFeatures.h"
 #include "LocalizedStrings.h"
 
+#include <QApplication>
 #include <QDebug>
 #include <QDragEnterEvent>
 #include <QDragLeaveEvent>
@@ -1092,6 +1093,8 @@ QAction *QWebPage::action(WebAction action) const
         return d->actions[action];
 
     QString text;
+    QIcon icon;
+    QStyle *style = view() ? view()->style() : qApp->style();
     bool checkable = false;
 
     switch (action) {
@@ -1124,15 +1127,27 @@ QAction *QWebPage::action(WebAction action) const
 
         case GoBack:
             text = contextMenuItemTagGoBack();
+#if QT_VERSION >= 0x040400
+            icon = style->standardIcon(QStyle::SP_ArrowBack);
+#endif
             break;
         case GoForward:
             text = contextMenuItemTagGoForward();
+#if QT_VERSION >= 0x040400
+            icon = style->standardIcon(QStyle::SP_ArrowForward);
+#endif
             break;
         case Stop:
             text = contextMenuItemTagStop();
+#if QT_VERSION >= 0x040400
+            icon = style->standardIcon(QStyle::SP_BrowserStop);
+#endif
             break;
         case Reload:
             text = contextMenuItemTagReload();
+#if QT_VERSION >= 0x040400
+            icon = style->standardIcon(QStyle::SP_BrowserReload);
+#endif
             break;
 
         case Cut:
@@ -1223,6 +1238,7 @@ QAction *QWebPage::action(WebAction action) const
     a->setText(text);
     a->setData(action);
     a->setCheckable(checkable);
+    a->setIcon(icon);
 
     connect(a, SIGNAL(triggered(bool)),
             this, SLOT(_q_webActionTriggered(bool)));
index e5743a2..a12e23a 100644 (file)
@@ -1,3 +1,13 @@
+2008-03-11  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
+        * Set a Icon on the QAction if we have one.
+        
+
+        * Api/qwebpage.cpp:
+        (QWebPage::action):
+
 2008-03-11  Simon Hausmann  <hausmann@webkit.org>
 
         Fix the Qt build.