summaryrefslogtreecommitdiff
path: root/src/webtab/webtab.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-08-01 10:46:15 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:04 +0100
commit76af6dc385cb275da7af92933ec14c0177b229d6 (patch)
tree95658c2e0019f082a4aad695d2d14a9edfe49ba9 /src/webtab/webtab.cpp
parentCopy webtab related files from rekonq repo (diff)
downloadrekonq-76af6dc385cb275da7af92933ec14c0177b229d6.tar.xz
Let WebView compile and work
WARNING: Not everything compiles yet...
Diffstat (limited to 'src/webtab/webtab.cpp')
-rw-r--r--src/webtab/webtab.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index 457e9006..13d2da93 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -56,6 +56,10 @@
#include <KWebView>
#include <KDebug>
#include <KBuildSycocaProgressDialog>
+#include <kdeprintdialog.h>
+
+#include <KParts/Part>
+#include <KParts/BrowserExtension>
// Qt Includes
#include <QVBoxLayout>
@@ -133,6 +137,12 @@ WebPage *WebTab::page()
}
+WebWindow *WebTab::webWindow()
+{
+ WebWindow *w = qobject_cast<WebWindow *>(parent());
+ return w;
+}
+
KUrl WebTab::url()
{
if (page() && page()->isOnRekonqPage())
@@ -417,3 +427,48 @@ void WebTab::showSearchEngineBar()
qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, seBar);
seBar->animatedShow();
}
+
+
+void WebTab::printFrame()
+{
+ if (page()->isOnRekonqPage())
+ {
+ // trigger print part action instead of ours..
+ KParts::ReadOnlyPart *p = part();
+ if (p)
+ {
+ KParts::BrowserExtension *ext = p->browserExtension();
+ if (ext)
+ {
+ KParts::BrowserExtension::ActionSlotMap *actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
+
+ connect(this, SIGNAL(triggerPartPrint()), ext, actionSlotMap->value("print"));
+ emit triggerPartPrint();
+
+ return;
+ }
+ }
+ }
+
+ QWebFrame *printFrame = 0;
+ if (frame == 0)
+ {
+ printFrame = page()->mainFrame();
+ }
+ else
+ {
+ printFrame = frame;
+ }
+
+ QPrinter printer;
+ printer.setDocName(printFrame->title());
+ QPrintDialog *printDialog = KdePrint::createPrintDialog(&printer, this);
+
+ if (printDialog) //check if the Dialog was created
+ {
+ if (printDialog->exec())
+ printFrame->print(&printer);
+
+ delete printDialog;
+ }
+}