Implemented the webcore actions for changing the text direction.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 13:09:20 +0000 (13:09 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2007 13:09:20 +0000 (13:09 +0000)
Signed-off-by: Holger
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27645 268f45cc-cd09-0410-ab3c-d52691b4dbfc

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

index 40860e1c171e66e733ffc380d001e095079f29a0..40cae0c87d0d8c2e84a84a259393e054fb39e1d0 100644 (file)
@@ -154,6 +154,9 @@ static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAct
         case WebCore::ContextMenuItemTagReload: return QWebPage::Reload;
         case WebCore::ContextMenuItemTagCut: return QWebPage::Cut;
         case WebCore::ContextMenuItemTagPaste: return QWebPage::Paste;
+        case WebCore::ContextMenuItemTagDefaultDirection: return QWebPage::SetTextDirectionDefault;
+        case WebCore::ContextMenuItemTagLeftToRight: return QWebPage::SetTextDirectionLeftToRight;
+        case WebCore::ContextMenuItemTagRightToLeft: return QWebPage::SetTextDirectionRightToLeft;
         default: break;
     }
     return QWebPage::NoWebAction;
@@ -567,6 +570,16 @@ void QWebPage::triggerAction(WebAction action, bool checked)
             command = "DeleteWordForward";
             break;
 
+        case SetTextDirectionDefault:
+            editor->setBaseWritingDirection("inherit");
+            break;
+        case SetTextDirectionLeftToRight:
+            editor->setBaseWritingDirection("ltr");
+            break;
+        case SetTextDirectionRightToLeft:
+            editor->setBaseWritingDirection("rtl");
+            break;
+
         default: break;
     }
 
@@ -682,6 +695,16 @@ QAction *QWebPage::action(WebAction action) const
         case DeleteEndOfWord:
             break; // ####
 
+        case SetTextDirectionDefault:
+            text = contextMenuItemTagDefaultDirection();
+            break;
+        case SetTextDirectionLeftToRight:
+            text = contextMenuItemTagLeftToRight();
+            break;
+        case SetTextDirectionRightToLeft:
+            text = contextMenuItemTagRightToLeft();
+            break;
+
         case NoWebAction:
             return 0;
     }
index a6be21b5cc8d370d82876888baad244c48a90f9d..15180ec1072d8ba4ced297716d0f5271561a4976 100644 (file)
@@ -122,6 +122,10 @@ public:
         DeleteStartOfWord,
         DeleteEndOfWord,
 
+        SetTextDirectionDefault,
+        SetTextDirectionLeftToRight,
+        SetTextDirectionRightToLeft,
+
         WebActionCount
     };
 
index a2c5938e570bdb356a45a764d827b51278b34b2b..8a1e40237ece1a26b45124a2475173a90c5b4a65 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-09  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Holger.
+
+        Implemented the webcore actions for changing the text direction.
+        
+
+        * Api/qwebpage.cpp:
+        (webActionForContextMenuAction):
+        (QWebPage::triggerAction):
+        (QWebPage::action):
+        * Api/qwebpage.h:
+
 2007-11-09  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Holger.