Bug 29859 - [Qt] Emiting a signal for each page being printed
Summary: [Qt] Emiting a signal for each page being printed
Status: RESOLVED DUPLICATE of bug 26584
Alias: None
Product: WebKit
Classification: Unclassified
Component: Printing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-09-29 05:44 PDT by Tor Arne Vestbø
Modified: 2009-11-24 07:53 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-29 05:44:15 PDT
This bug report originated from issue QTBUG-3568
http://bugreports.qt.nokia.com/browse/QTBUG-3568

--- Description ---

It would be nice if QtWebkit would emit a signal of each page being printed. This can be used both for user feedback, and for inserting headers and footers. A good name for this signal should obviously be invented. I have included a patch, that I use currently. 

patch:

diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index ae71356..574e14d 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -955,10 +955,13 @@ void QWebFrame::print(QPrinter *printer) const
                     return;
                 }
                 printContext.spoolPage(ctx, page - 1, pageRect.width());
-                if (j < pageCopies - 1)
+                if (j < pageCopies - 1) {
+                    emit printingNewPage(printer,fromPage,toPage,page);
                     printer->newPage();
+                }
             }
-
+            emit printingNewPage(printer,fromPage,toPage,page);
+        
             if (page == toPage)
                 break;
 
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
index 18ae697..1d40a29 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
@@ -21,6 +21,8 @@
 #ifndef QWEBFRAME_H
 #define QWEBFRAME_H
 
+#define WKHTMLTOPDF_QT_WEBFRAME_PATCH
+
 #include <QtCore/qobject.h>
 #include <QtCore/qurl.h>
 #include <QtCore/qvariant.h>
@@ -191,6 +193,7 @@ Q_SIGNALS:
 
     void iconChanged();
 
+    void printingNewPage(QPrinter *p, int fromPage, int toPage, int Page) const;
 private:
     friend class QWebPage;
     friend class QWebPagePrivate;
Comment 1 Simon Hausmann 2009-11-24 07:53:17 PST

*** This bug has been marked as a duplicate of bug 26584 ***