2008-08-15 Håvard Wall <hwall@trolltech.com>
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Aug 2008 18:12:55 +0000 (18:12 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Aug 2008 18:12:55 +0000 (18:12 +0000)
        Reviewed by Simon.

Fixes: compile with QT_NO_UNDOCOMMAND/STACK
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35796 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/Api/qwebpage.h
WebKit/qt/Api/qwebpage_p.h
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/EditCommandQt.cpp
WebKit/qt/WebCoreSupport/EditCommandQt.h
WebKit/qt/WebCoreSupport/EditorClientQt.cpp

index 8af131ee33bb2f047d96dbf9ab52f5d75b6ba419..7b6d549580a998d2886e8a6e52ab6aa20c56024e 100644 (file)
@@ -226,7 +226,9 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
 
     settings = new QWebSettings(page->settings());
 
+#ifndef QT_NO_UNDOSTACK
     undoStack = 0;
+#endif
     mainFrame = 0;
 #if QT_VERSION < 0x040400
     networkInterface = 0;
@@ -251,7 +253,9 @@ QWebPagePrivate::~QWebPagePrivate()
 #ifndef QT_NO_CONTEXTMENU
     delete currentContextMenu;
 #endif
+#ifndef QT_NO_UNDOSTACK
     delete undoStack;
+#endif
     delete settings;
     delete page;
 }
@@ -432,10 +436,12 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action)
         case QWebPage::Paste:
             enabled = editor->canPaste();
             break;
+#ifndef QT_NO_UNDOSTACK
         case QWebPage::Undo:
         case QWebPage::Redo:
             // those two are handled by QUndoStack
             break;
+#endif // QT_NO_UNDOSTACK
         case QWebPage::ToggleBold:
         case QWebPage::ToggleItalic:
         case QWebPage::ToggleUnderline:
@@ -1579,7 +1585,7 @@ QAction *QWebPage::action(WebAction action) const
         case Paste:
             text = contextMenuItemTagPaste();
             break;
-
+#ifndef QT_NO_UNDOSTACK
         case Undo: {
             QAction *a = undoStack()->createUndoAction(d->q);
             d->actions[action] = a;
@@ -1590,6 +1596,7 @@ QAction *QWebPage::action(WebAction action) const
             d->actions[action] = a;
             return a;
         }
+#endif // QT_NO_UNDOSTACK
         case MoveToNextChar:
         case MoveToPreviousChar:
         case MoveToNextWord:
@@ -1676,11 +1683,16 @@ QAction *QWebPage::action(WebAction action) const
 */
 bool QWebPage::isModified() const
 {
+#ifdef QT_NO_UNDOSTACK
+    return false;
+#else
     if (!d->undoStack)
         return false;
     return d->undoStack->canUndo();
+#endif // QT_NO_UNDOSTACK
 }
 
+#ifndef QT_NO_UNDOSTACK
 /*!
     Returns a pointer to the undo stack used for editable content.
 */
@@ -1691,6 +1703,7 @@ QUndoStack *QWebPage::undoStack() const
 
     return d->undoStack;
 }
+#endif // QT_NO_UNDOSTACK
 
 /*! \reimp
 */
index 388cbc0bbdc35bea031747688039a3a1606ac68d..b28fe1d96d214c3baf26d9b35820a628f5766340 100644 (file)
@@ -179,7 +179,9 @@ public:
     QWidget *view() const;
 
     bool isModified() const;
+#ifndef QT_NO_UNDOSTACK
     QUndoStack *undoStack() const;
+#endif
 
 #if QT_VERSION < 0x040400 && !defined(qdoc)
     void setNetworkInterface(QWebNetworkInterface *interface);
index 1235bef6e9b0b43335bd40a6c6334f23147e6b49..6d0ee50055be925d5d079ddba103915b332ea4f6 100644 (file)
@@ -120,7 +120,9 @@ public:
     QPointer<QWebFrame> mainFrame;
 
     QWebPage *q;
+#ifndef QT_NO_UNDOSTACK
     QUndoStack *undoStack;
+#endif
     QWidget *view;
 
     bool insideOpenCall;
index 1d859d582dc922cba0f1fdd0e249e0beb0200b78..3ff713005ade80115b690f75fcad5c7f21729ecf 100644 (file)
@@ -1,3 +1,32 @@
+2008-08-15  Håvard Wall  <hwall@trolltech.com>
+
+        Reviewed by Simon.
+
+        Fixes: compile with QT_NO_UNDOCOMMAND/STACK
+        
+
+        * Api/qwebpage.cpp:
+        (SetCursorEvent::SetCursorEvent):
+        (QWebPagePrivate::createContextMenu):
+        (QWebPage::action):
+        * Api/qwebpage.h:
+        * Api/qwebpage_p.h:
+        * WebCoreSupport/EditCommandQt.cpp:
+        (EditCommandQt::EditCommandQt):
+        * WebCoreSupport/EditCommandQt.h:
+        * WebCoreSupport/EditorClientQt.cpp:
+        (dumpPath):
+        (WebCore::EditorClientQt::shouldInsertText):
+        (WebCore::EditorClientQt::shouldChangeSelectedRange):
+        (WebCore::EditorClientQt::isEditable):
+        (WebCore::EditorClientQt::registerCommandForUndo):
+        (WebCore::EditorClientQt::clearUndoRedoOperations):
+        (WebCore::EditorClientQt::canUndo):
+        (WebCore::EditorClientQt::canRedo):
+        (WebCore::EditorClientQt::undo):
+        (WebCore::EditorClientQt::redo):
+        (WebCore::EditorClientQt::shouldInsertNode):
+
 2008-08-15  Håvard Wall  <hwall@trolltech.com>
 
         Reviewed by Simon.
index e316a165a9ea4447999f288ae722738adadfebb4..153238889fffe300db3ff4314e7b19e57fec2e87 100644 (file)
 using namespace WebCore;
 
 EditCommandQt::EditCommandQt(WTF::RefPtr<EditCommand> cmd, QUndoCommand *parent)
-: QUndoCommand(parent), _cmd(cmd), _first(true) {
+:
+#ifndef QT_NO_UNDOCOMMAND
+    QUndoCommand(parent),
+#endif
+    _cmd(cmd), _first(true)
+{
 }
 
 
index dd7c85aef514618a1c361ca9a4b1f7aaca32cbaf..412c1e522e428964385e90397979e264ae71a82c 100644 (file)
 #ifndef EDITCOMMANDQT_H
 #define EDITCOMMANDQT_H
 
+class QUndoCommand;
 
 #include <QUndoCommand>
 #include <EditCommand.h>
 
-class EditCommandQt : public QUndoCommand {
+class EditCommandQt
+#ifndef QT_NO_UNDOCOMMAND
+    : public QUndoCommand
+#endif
+{
     public:
         EditCommandQt(WTF::RefPtr<WebCore::EditCommand> cmd, QUndoCommand *parent = 0);
         ~EditCommandQt();
index 560f9585a671323775b1ae98f8097cbfc649552f..7463571b1ce35bafeb450531f3f1f9f9236671d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
  * Copyright (C) 2006 Apple Computer, Inc.
  *
@@ -73,7 +73,7 @@ void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
 static QString dumpPath(WebCore::Node *node)
 {
     QString str = node->nodeName();
-    
+
     WebCore::Node *parent = node->parentNode();
     while (parent) {
         str.append(QLatin1String(" > "));
@@ -94,14 +94,14 @@ static QString dumpRange(WebCore::Range *range)
                 range->endOffset(code), dumpPath(range->endContainer(code)).unicode());
     return str;
 }
-    
+
 
 namespace WebCore {
 
 
 bool EditorClientQt::shouldDeleteRange(Range* range)
 {
-    if (dumpEditingCallbacks) 
+    if (dumpEditingCallbacks)
         printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dumpRange(range).toUtf8().constData());
 
     return true;
@@ -109,7 +109,7 @@ bool EditorClientQt::shouldDeleteRange(Range* range)
 
 bool EditorClientQt::shouldShowDeleteInterface(HTMLElement* element)
 {
-    if (drt_run) 
+    if (drt_run)
         return element->className() == "needsDeletionUI";
     return false;
 }
@@ -151,7 +151,7 @@ bool EditorClientQt::shouldInsertText(const String& string, Range* range, Editor
             "WebViewInsertActionPasted",
             "WebViewInsertActionDropped",
         };
-        
+
         printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n",
                QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]);
     }
@@ -169,7 +169,7 @@ bool EditorClientQt::shouldChangeSelectedRange(Range* currentRange, Range* propo
             "FALSE",
             "TRUE"
         };
-        
+
         printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n",
                dumpRange(currentRange).toUtf8().constData(),
                dumpRange(proposedRange).toUtf8().constData(),
@@ -249,11 +249,13 @@ bool EditorClientQt::isEditable()
 
 void EditorClientQt::registerCommandForUndo(WTF::PassRefPtr<WebCore::EditCommand> cmd)
 {
+#ifndef QT_NO_UNDOSTACK
     Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
     if (m_inUndoRedo || (frame && !frame->editor()->lastEditCommand() /* HACK!! Don't recreate undos */)) {
         return;
     }
     m_page->undoStack()->push(new EditCommandQt(cmd));
+#endif // QT_NO_UNDOSTACK
 }
 
 void EditorClientQt::registerCommandForRedo(WTF::PassRefPtr<WebCore::EditCommand>)
@@ -262,31 +264,45 @@ void EditorClientQt::registerCommandForRedo(WTF::PassRefPtr<WebCore::EditCommand
 
 void EditorClientQt::clearUndoRedoOperations()
 {
+#ifndef QT_NO_UNDOSTACK
     return m_page->undoStack()->clear();
+#endif
 }
 
 bool EditorClientQt::canUndo() const
 {
+#ifdef QT_NO_UNDOSTACK
+    return false;
+#else
     return m_page->undoStack()->canUndo();
+#endif
 }
 
 bool EditorClientQt::canRedo() const
 {
+#ifdef QT_NO_UNDOSTACK
+    return false;
+#else
     return m_page->undoStack()->canRedo();
+#endif
 }
 
 void EditorClientQt::undo()
 {
+#ifndef QT_NO_UNDOSTACK
     m_inUndoRedo = true;
     m_page->undoStack()->undo();
     m_inUndoRedo = false;
+#endif
 }
 
 void EditorClientQt::redo()
 {
+#ifndef QT_NO_UNDOSTACK
     m_inUndoRedo = true;
     m_page->undoStack()->redo();
     m_inUndoRedo = false;
+#endif
 }
 
 bool EditorClientQt::shouldInsertNode(Node* node, Range* range, EditorInsertAction action)
@@ -297,7 +313,7 @@ bool EditorClientQt::shouldInsertNode(Node* node, Range* range, EditorInsertActi
             "WebViewInsertActionPasted",
             "WebViewInsertActionDropped",
         };
-        
+
         printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).toUtf8().constData(),
                dumpRange(range).toUtf8().constData(), insertactionstring[action]);
     }