From 76af6dc385cb275da7af92933ec14c0177b229d6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 1 Aug 2012 10:46:15 +0200 Subject: Let WebView compile and work WARNING: Not everything compiles yet... --- src/webtab/webtab.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'src/webtab/webtab.cpp') 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 #include #include +#include + +#include +#include // Qt Includes #include @@ -133,6 +137,12 @@ WebPage *WebTab::page() } +WebWindow *WebTab::webWindow() +{ + WebWindow *w = qobject_cast(parent()); + return w; +} + KUrl WebTab::url() { if (page() && page()->isOnRekonqPage()) @@ -417,3 +427,48 @@ void WebTab::showSearchEngineBar() qobject_cast(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; + } +} -- cgit v1.2.1