diff options
Diffstat (limited to 'src/webtab.cpp')
-rw-r--r-- | src/webtab.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
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<QVBoxLayout *>(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<QVBoxLayout *>(layout())->removeWidget(_part->widget()); + delete _part; + _part = 0; +} |