Added support for the Bold/Italic/Underline toggle actions.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Nov 2007 22:24:29 +0000 (22:24 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Nov 2007 22:24:29 +0000 (22:24 +0000)
Signed-off-by: Nikolas
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27672 268f45cc-cd09-0410-ab3c-d52691b4dbfc

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

index aab4c41a42a7e2f645186b107ce866f46e27569d..c1cdd5c247ae6e178dc73d096df97937a27e8672 100644 (file)
@@ -157,6 +157,9 @@ static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAct
         case WebCore::ContextMenuItemTagDefaultDirection: return QWebPage::SetTextDirectionDefault;
         case WebCore::ContextMenuItemTagLeftToRight: return QWebPage::SetTextDirectionLeftToRight;
         case WebCore::ContextMenuItemTagRightToLeft: return QWebPage::SetTextDirectionRightToLeft;
+        case WebCore::ContextMenuItemTagBold: return QWebPage::ToggleBold;
+        case WebCore::ContextMenuItemTagItalic: return QWebPage::ToggleItalic;
+        case WebCore::ContextMenuItemTagUnderline: return QWebPage::ToggleUnderline;
         default: break;
     }
     return QWebPage::NoWebAction;
@@ -587,6 +590,16 @@ void QWebPage::triggerAction(WebAction action, bool checked)
             editor->setBaseWritingDirection("rtl");
             break;
 
+        case ToggleBold:
+            command = "ToggleBold";
+            break;
+        case ToggleItalic:
+            command = "ToggleItalic";
+            break;
+        case ToggleUnderline:
+            editor->toggleUnderline();
+            break;
+
         default: break;
     }
 
@@ -715,6 +728,19 @@ QAction *QWebPage::action(WebAction action) const
             checkable = true;
             break;
 
+        case ToggleBold:
+            text = contextMenuItemTagBold();
+            checkable = true;
+            break;
+        case ToggleItalic:
+            text = contextMenuItemTagItalic();
+            checkable = true;
+            break;
+        case ToggleUnderline:
+            text = contextMenuItemTagUnderline();
+            checkable = true;
+            break;
+
         case NoWebAction:
             return 0;
     }
index 15180ec1072d8ba4ced297716d0f5271561a4976..68a351db7f478f532a70daddd41289457b9f9264 100644 (file)
@@ -126,6 +126,10 @@ public:
         SetTextDirectionLeftToRight,
         SetTextDirectionRightToLeft,
 
+        ToggleBold,
+        ToggleItalic,
+        ToggleUnderline,
+
         WebActionCount
     };
 
index b6fda36f9111f064388b8e867f87d8b2a26abdf4..9a3d29adbd869dddf82fa0d58bd5b763cf7acd25 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-10  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Nikolas.
+
+        Added support for the Bold/Italic/Underline toggle actions.
+        
+
+        * Api/qwebpage.cpp:
+        (webActionForContextMenuAction):
+        (QWebPage::triggerAction):
+        (QWebPage::action):
+        * Api/qwebpage.h:
+
 2007-11-10  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Nikolas.