QString QWebFrameProto::title() const { scriptDeprecated("QWebFrame will not be available in future versions"); QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject()); if (item) return item->title(); return QString(); }
QString ForumProbe::getTitle(QString &html) { QString title; #ifndef NO_WEBKITWIDGETS QWebPage *page = new QWebPage(); QWebFrame *frame = page->mainFrame(); frame->setHtml(html); title = frame->title(); page->deleteLater(); #else int titleBegin = html.indexOf("<title>"); if(titleBegin > 0) { int titleEnd = html.indexOf("</", titleBegin); title = html.mid(titleBegin + 7, titleEnd - titleBegin - 7); } #endif return title; }
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 = page()->currentFrame(); if (printFrame == 0) { printFrame = page()->mainFrame(); } 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; } }