Commit f6e27008 authored by Bernhard Beschow's avatar Bernhard Beschow
Browse files

open URLs in external browser

An external browser greatly enhances browsing experience:
* no more too small window
* tabbed browsing
* save web pages, add bookmarks
* more privacy (adblockers)
* browser extensions
parent 7321f7fc
......@@ -27,6 +27,7 @@
#include <QPrintDialog>
#include <QMouseEvent>
#include <QApplication>
#include <QDesktopServices>
#include <QPixmapCache>
#include <qdrawutil.h>
#include <QPainter>
......@@ -64,6 +65,7 @@ PopupItem::PopupItem( QObject* parent ) :
m_ui.webView->setPalette(palette);
#ifndef MARBLE_NO_WEBKITWIDGETS
m_ui.webView->page()->setPalette(palette);
m_ui.webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
#endif
m_ui.webView->setAttribute(Qt::WA_OpaquePaintEvent, false);
m_ui.webView->setUrl( QUrl( "about:blank" ) );
......@@ -75,6 +77,7 @@ PopupItem::PopupItem( QObject* parent ) :
#ifndef MARBLE_NO_WEBKITWIDGETS
// Update the popupitem on changes while loading the webpage
connect( m_ui.webView->page(), SIGNAL(repaintRequested(QRect)), this, SLOT(requestUpdate()) );
connect(m_ui.webView->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openUrl(QUrl)));
#endif
}
......@@ -386,6 +389,11 @@ void PopupItem::goBack()
#endif
}
void PopupItem::openUrl(const QUrl &url)
{
QDesktopServices::openUrl(url);
}
QPixmap PopupItem::pixmap( const QString &imageId ) const
{
QPixmap result;
......
......@@ -163,6 +163,12 @@ private Q_SLOTS:
*/
void goBack();
/**
* @brief Opens clicked URL in external browser.
* @param url URL to be opened in external browser
*/
void openUrl(const QUrl &url);
protected:
void paint( QPainter *painter );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment