From 135000c39535ba8f401b7ecfcf39f8fe2988244e Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Wed, 13 May 2009 15:10:09 +0200
Subject: [PATCH] Made uic-codecompletion use the new quiet-save API of Qt
 Designer.

---
 src/plugins/designer/formwindoweditor.cpp         | 15 ++++++++++++---
 .../designer/qt_private/formwindowbase_p.h        |  3 +++
 .../qt_private/qdesigner_formwindowmanager_p.h    |  1 +
 src/plugins/designer/syncqtheader.sh              |  4 ++--
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp
index e3d623c2660..8b82d2bab58 100644
--- a/src/plugins/designer/formwindoweditor.cpp
+++ b/src/plugins/designer/formwindoweditor.cpp
@@ -38,6 +38,8 @@
 #include <projectexplorer/projectnodes.h>
 #include <projectexplorer/nodesvisitor.h>
 
+#include <utils/qtcassert.h>
+
 #include <QtDesigner/QDesignerFormWindowInterface>
 #include <QtDesigner/QDesignerFormEditorInterface>
 #include <QtDesigner/QDesignerFormWindowManagerInterface>
@@ -359,7 +361,14 @@ QString FormWindowEditor::contextHelpId() const
 
 QString FormWindowEditor::contents() const
 {
-    if (m_host && m_host->formWindow())
-        return m_host->formWindow()->contents();
-    return QString::null;
+    if (!m_formWindow)
+        return QString::null;
+#if QT_VERSION > 0x040501
+    // Quiet save as of Qt 4.5.2
+    qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(m_formWindow);
+    QTC_ASSERT(fwb, return QString::null);
+    return fwb->fileContents();
+#else
+    return m_formWindow->contents();
+#endif
 }
diff --git a/src/plugins/designer/qt_private/formwindowbase_p.h b/src/plugins/designer/qt_private/formwindowbase_p.h
index 7c6d649e77f..b49fb88ea69 100644
--- a/src/plugins/designer/qt_private/formwindowbase_p.h
+++ b/src/plugins/designer/qt_private/formwindowbase_p.h
@@ -78,6 +78,9 @@ public:
     QVariantMap formData();
     void setFormData(const QVariantMap &vm);
 
+    // Return contents without warnings. Should be 'contents(bool quiet)'
+    QString fileContents() const;
+
     // Return the widget containing the form. This is used to
     // apply embedded design settings to that are inherited (for example font).
     // These are meant to be applied to the form only and not to the other editors
diff --git a/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h b/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h
index 91f0c9c96d6..36aae1956c0 100644
--- a/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h
+++ b/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h
@@ -74,6 +74,7 @@ Q_SIGNALS:
 
 public Q_SLOTS:
     virtual void closeAllPreviews() = 0;
+    void aboutPlugins();
 
 private:
     void *m_unused;
diff --git a/src/plugins/designer/syncqtheader.sh b/src/plugins/designer/syncqtheader.sh
index c184711451c..d9e98a85f95 100755
--- a/src/plugins/designer/syncqtheader.sh
+++ b/src/plugins/designer/syncqtheader.sh
@@ -55,8 +55,8 @@ syncHeader()
   TARGET=qt_private/$HDR
 
   # Exchange license header
-  head -n 32 formwindowfile.h > $TARGET || exit 1
-  tail -n +11 $QTHDR >> $TARGET || exit 1
+  head -n 28 formwindowfile.h > $TARGET || exit 1
+  tail -n +41 $QTHDR >> $TARGET || exit 1
 }
 
 for H in $REQUIRED_HEADERS
-- 
GitLab