From fe21365ffafb922a6b24959f3d1096e4c6171427 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Nov 2010 01:32:04 +0100 Subject: Print && Find actions for the parts :) - handle print & find with different signals in mainwindow - show right tab title (moving titleChanged signal from view to tab) --- src/webtab.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/webtab.cpp') diff --git a/src/webtab.cpp b/src/webtab.cpp index 0a55060b..b4f070a9 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -51,6 +51,7 @@ WebTab::WebTab(QWidget *parent) , _view(new WebView(this)) , _bar(new UrlBar(this)) , _progress(0) + , _part(0) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -74,6 +75,7 @@ WebTab::WebTab(QWidget *parent) connect(_view, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int))); connect(_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); + connect(_view, SIGNAL(titleChanged(const QString &)), this, SIGNAL(titleChanged(const QString &))); } @@ -81,13 +83,18 @@ WebTab::~WebTab() { _walletBar.clear(); _previewSelectorBar.clear(); + + delete _part; } KUrl WebTab::url() { if(page() && page()->isOnRekonqPage()) + { + kDebug() << "REKONQ PAGE. URL = " << page()->loadingUrl(); return page()->loadingUrl(); + } return view()->url(); } @@ -203,3 +210,28 @@ void WebTab::showRSSInfo(QPoint pos) RSSWidget *widget = new RSSWidget(map, window()); widget->showAt(pos); } + + +void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u) +{ + if(p) + { + // Ok, part exists. Insert & show it.. + _part = p; + qobject_cast(layout())->insertWidget(1, p->widget()); + p->openUrl(u); + _view->hide(); + + emit titleChanged(u.url()); + return; + } + + if(!_part) + return; + + // Part NO more exists. Let's clean up from webtab + _view->show(); + qobject_cast(layout())->removeWidget(_part->widget()); + delete _part; + _part = 0; +} -- cgit v1.2.1