summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp63
-rw-r--r--src/mainview.h6
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/protocolhandler.cpp4
-rw-r--r--src/rekonqpage/newtabpage.cpp2
-rw-r--r--src/webpage.h1
-rw-r--r--src/webtab.cpp8
-rw-r--r--src/webview.cpp19
-rw-r--r--src/webview.h3
9 files changed, 60 insertions, 52 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 940e1273..98d8b0a6 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -63,15 +63,15 @@
MainView::MainView(MainWindow *parent)
- : KTabWidget(parent)
- , m_urlBar(new UrlBar(this))
- , m_tabBar(new TabBar(this))
- , m_addTabButton(new QToolButton(this))
- , m_currentTabIndex(0)
- , m_parentWindow(parent)
+ : KTabWidget(parent)
+ , m_urlBar(new UrlBar(this))
+ , m_addTabButton(new QToolButton(this))
+ , m_currentTabIndex(0)
+ , m_parentWindow(parent)
{
// setting tabbar
- setTabBar(m_tabBar);
+ TabBar *tabBar = new TabBar(this);
+ setTabBar(tabBar);
// set mouse tracking for tab previews
setMouseTracking(true);
@@ -80,17 +80,17 @@ MainView::MainView(MainWindow *parent)
m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
// connecting tabbar signals
- connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()));
+ connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)) );
+ connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)) );
+ connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()) );
- connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
- connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
- connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
- connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
- connect(m_tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
+ connect(tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)) );
+ connect(tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)) );
+ connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)) );
+ connect(tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()) );
+ connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)) );
- connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
+ connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)) );
// current page index changing
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
@@ -123,7 +123,7 @@ void MainView::updateTabButtonPosition()
static bool ButtonInCorner = false;
int tabWidgetWidth = frameSize().width();
- int tabBarWidth = m_tabBar->tabSizeHint(0).width()*m_tabBar->count();
+ int tabBarWidth = tabBar()->tabSizeHint(0).width() * tabBar()->count();
if (tabBarWidth + m_addTabButton->width() > tabWidgetWidth)
{
@@ -143,7 +143,7 @@ void MainView::updateTabButtonPosition()
// detecting X position
int newPosX = tabBarWidth;
- int tabWidthHint = m_tabBar->tabSizeHint(0).width();
+ int tabWidthHint = tabBar()->tabSizeHint(0).width();
if (tabWidthHint < sizeHint().width()/4)
newPosX = tabWidgetWidth - m_addTabButton->width();
@@ -164,7 +164,8 @@ QToolButton *MainView::addTabButton() const
TabBar *MainView::tabBar() const
{
- return m_tabBar;
+ TabBar *tabBar = qobject_cast<TabBar *>( KTabWidget::tabBar() );
+ return tabBar;
}
@@ -182,13 +183,13 @@ WebTab *MainView::currentWebTab() const
void MainView::updateTabBar()
{
- if (ReKonfig::alwaysShowTabBar())
+ if( ReKonfig::alwaysShowTabBar() )
{
if (!isTabBarHidden())
{
- if (m_tabBar->isHidden())
+ if (tabBar()->isHidden())
{
- m_tabBar->show();
+ tabBar()->show();
m_addTabButton->show();
}
updateTabButtonPosition();
@@ -196,16 +197,16 @@ void MainView::updateTabBar()
return;
}
- if (m_tabBar->count() == 1)
+ if( tabBar()->count() == 1 )
{
- m_tabBar->hide();
+ tabBar()->hide();
m_addTabButton->hide();
}
- else if (!isTabBarHidden())
+ else if( !isTabBarHidden() )
{
- if (m_tabBar->isHidden())
+ if ( tabBar()->isHidden() )
{
- m_tabBar->show();
+ tabBar()->show();
m_addTabButton->show();
}
updateTabButtonPosition();
@@ -622,7 +623,7 @@ void MainView::webViewUrlChanged(const QUrl &url)
int index = indexOf( view->parentWidget() );
if (-1 != index)
{
- m_tabBar->setTabData(index, url);
+ tabBar()->setTabData(index, url);
}
emit tabsChanged();
}
@@ -651,7 +652,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
if (index == -1)
return 0;
- QLabel *label = qobject_cast<QLabel*>(m_tabBar->tabButton(index, QTabBar::LeftSide));
+ QLabel *label = qobject_cast<QLabel* >(tabBar()->tabButton(index, QTabBar::LeftSide));
if (!label)
{
label = new QLabel(this);
@@ -663,8 +664,8 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
label->setMovie(movie);
movie->start();
}
- m_tabBar->setTabButton(index, QTabBar::LeftSide, 0);
- m_tabBar->setTabButton(index, QTabBar::LeftSide, label);
+ tabBar()->setTabButton(index, QTabBar::LeftSide, 0);
+ tabBar()->setTabButton(index, QTabBar::LeftSide, label);
return label;
}
diff --git a/src/mainview.h b/src/mainview.h
index ace9d941..061ad1aa 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -69,8 +69,6 @@ public:
MainView(MainWindow *parent);
~MainView();
-public:
-
UrlBar *urlBar() const;
WebTab *webTab(int index) const;
@@ -168,8 +166,10 @@ private:
*/
QLabel *animatedLoading(int index, bool addMovie);
+
+// --------------------------------------------------------------------------
+
UrlBar *m_urlBar;
- TabBar *m_tabBar;
QString m_loadingGitPath;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d61b56f9..ef74adab 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -671,7 +671,7 @@ void MainWindow::updateWindowTitle(const QString &title)
{
if(settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
- setWindowTitle(i18nc("Window title when private browsing is activated", "rekonq (Private Browsing)"));
+ setWindowTitle(i18nc("Window title when private browsing is activated", "rekonq (Private Browsing)"));
}
else
{
@@ -682,11 +682,11 @@ void MainWindow::updateWindowTitle(const QString &title)
{
if(settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
- setWindowTitle(title + " - rekonq (" + i18n("Private Browsing") + ')');
+ setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq (Private Browsing)", title) );
}
else
{
- setWindowTitle(title + " - rekonq");
+ setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq", title));
}
}
}
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index a80f0a46..1a533a6e 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -110,7 +110,7 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
{
if( _url == KUrl("about:blank") )
{
- frame->setHtml( QString() );
+ frame->setHtml( QString() , _url );
return true;
}
@@ -288,7 +288,7 @@ void ProtocolHandler::showResults(const KFileItemList &list)
}
QString html = dirHandling(list);
- _frame->setHtml(html);
+ _frame->setHtml( html, _url );
Application::instance()->mainWindow()->currentTab()->setFocus();
Application::instance()->mainWindow()->mainView()->urlBar()->setUrl(_url);
diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp
index f7ebcdbf..cc8aa1fb 100644
--- a/src/rekonqpage/newtabpage.cpp
+++ b/src/rekonqpage/newtabpage.cpp
@@ -95,7 +95,7 @@ void NewTabPage::generate(KUrl url)
}
QWebPage *page = m_root.webFrame()->page();
- page->mainFrame()->setHtml(m_html);
+ page->mainFrame()->setHtml(m_html,m_url);
m_root = page->mainFrame()->documentElement().findFirst("#content");
diff --git a/src/webpage.h b/src/webpage.h
index c9c5bb8c..bbaa0f63 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -60,6 +60,7 @@ public slots:
void manageNetworkErrors(QNetworkReply *reply);
virtual void downloadRequest(const QNetworkRequest &request);
void downloadAllContentsWithKGet();
+
protected:
WebPage *createWindow(WebWindowType type);
diff --git a/src/webtab.cpp b/src/webtab.cpp
index 9dea9a72..4172103b 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -60,7 +60,7 @@
#include <QVBoxLayout>
-WebTab::WebTab(QWidget* parent)
+WebTab::WebTab(QWidget *parent)
: QWidget(parent)
, m_view( new WebView(this) )
, m_progress(0)
@@ -68,15 +68,15 @@ WebTab::WebTab(QWidget* parent)
// fix focus handling
setFocusProxy( m_view );
- QVBoxLayout* l = new QVBoxLayout(this);
+ QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0);
l->setSpacing(0);
- QWidget* messageBar = new QWidget(this);
+ QWidget *messageBar = new QWidget(this);
l->addWidget(messageBar);
messageBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
- QVBoxLayout* l2 = new QVBoxLayout(messageBar);
+ QVBoxLayout *l2 = new QVBoxLayout(messageBar);
l2->setMargin(0);
l2->setSpacing(0);
diff --git a/src/webview.cpp b/src/webview.cpp
index 36f62bfa..e39ff32e 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -62,16 +62,16 @@
WebView::WebView(QWidget* parent)
: KWebView(parent, false)
- , m_page( new WebPage(this) )
- , m_mousePos(QPoint(0,0))
+ , m_mousePos( QPoint(0,0) )
{
- setPage(m_page);
+ WebPage *page = new WebPage(this);
+ setPage(page);
// download system
connect(this, SIGNAL(linkShiftClicked(const KUrl &)),
- m_page, SLOT(downloadUrl(const KUrl &)));
- connect(m_page, SIGNAL(downloadRequested(const QNetworkRequest &)),
- m_page, SLOT(downloadRequest(const QNetworkRequest &)));
+ page, SLOT(downloadUrl(const KUrl &)));
+ connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)),
+ page, SLOT(downloadRequest(const QNetworkRequest &)));
// middle click || ctrl + click signal
connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
@@ -89,6 +89,13 @@ WebView::~WebView()
}
+WebPage *WebView::page()
+{
+ WebPage *page = qobject_cast<WebPage *>( KWebView::page() );
+ return page;
+}
+
+
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
diff --git a/src/webview.h b/src/webview.h
index 1598b19c..6d75c549 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -46,7 +46,7 @@ public:
explicit WebView(QWidget *parent);
~WebView();
- WebPage *page() { return m_page; }
+ WebPage *page();
QPoint mousePos();
protected:
@@ -71,7 +71,6 @@ signals:
void loadUrl(const KUrl &, const Rekonq::OpenType &);
private:
- WebPage *const m_page;
QPoint m_mousePos;
};