summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/adblock/adblockmanager.h2
-rw-r--r--src/adblock/adblockrule.cpp19
-rw-r--r--src/adblock/adblockrule.h8
-rw-r--r--src/application.cpp61
-rw-r--r--src/application.h5
-rw-r--r--src/bookmarks/bookmarkspanel.cpp5
-rw-r--r--src/bookmarks/bookmarkspanel.h3
-rw-r--r--src/filterurljob.cpp (renamed from src/history/sidepanel.cpp)49
-rw-r--r--src/filterurljob.h (renamed from src/history/sidepanel.h)43
-rw-r--r--src/history/historypanel.cpp82
-rw-r--r--src/history/historypanel.h21
-rw-r--r--src/mainview.cpp15
-rw-r--r--src/mainview.h2
-rw-r--r--src/mainwindow.cpp103
-rw-r--r--src/mainwindow.h19
-rw-r--r--src/networkaccessmanager.cpp8
-rw-r--r--src/previewimage.cpp8
-rw-r--r--src/previewimage.h4
-rw-r--r--src/rekonq.kcfg2
-rw-r--r--src/settings/settings_general.ui13
-rw-r--r--src/tabbar.cpp6
-rw-r--r--src/urlbar/urlbar.cpp53
-rw-r--r--src/webinspectorpanel.cpp (renamed from src/webinspectordock.cpp)20
-rw-r--r--src/webinspectorpanel.h (renamed from src/webinspectordock.h)10
-rw-r--r--src/webpage.cpp15
-rw-r--r--src/webtab.cpp10
-rw-r--r--src/webtab.h4
-rw-r--r--src/webview.cpp37
-rw-r--r--src/webview.h9
30 files changed, 352 insertions, 289 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c80aedc0..b0a3fbd8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,15 +21,15 @@ SET( rekonq_KDEINIT_SRCS
webtab.cpp
clicktoflash.cpp
networkaccessmanager.cpp
- webinspectordock.cpp
+ webinspectorpanel.cpp
walletbar.cpp
protocolhandler.cpp
+ filterurljob.cpp
#----------------------------------------
history/autosaver.cpp
history/historymanager.cpp
history/historymodels.cpp
history/historypanel.cpp
- history/sidepanel.cpp
#----------------------------------------
rekonqpage/newtabpage.cpp
#----------------------------------------
@@ -94,6 +94,7 @@ TARGET_LINK_LIBRARIES ( kdeinit_rekonq
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${KDE4_KPARTS_LIBS}
+ ${KDE4_THREADWEAVER_LIBRARIES}
)
diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h
index c07a9492..f01aaca0 100644
--- a/src/adblock/adblockmanager.h
+++ b/src/adblock/adblockmanager.h
@@ -110,11 +110,11 @@
// Qt Includes
#include <QObject>
#include <QNetworkReply>
+#include <QStringList>
// Forward Includes
class QNetworkRequest;
class WebPage;
-class QStringList;
// Definitions
typedef QList<AdBlockRule> AdBlockRuleList;
diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp
index c6fe47c9..9f86ffee 100644
--- a/src/adblock/adblockrule.cpp
+++ b/src/adblock/adblockrule.cpp
@@ -52,17 +52,22 @@
* ============================================================ */
+// Self Includes
#include "adblockrule.h"
+// Qt Includes
+#include <QStringList>
#include <QDebug>
#include <QRegExp>
#include <QUrl>
+// Defines
#define QL1S(x) QLatin1String(x)
#define QL1C(x) QLatin1Char(x)
AdBlockRule::AdBlockRule(const QString &filter)
+ : m_optionMatchRule(false)
{
bool isRegExpRule = false;
@@ -75,11 +80,13 @@ AdBlockRule::AdBlockRule(const QString &filter)
isRegExpRule = true;
}
- int options = parsedLine.indexOf( QL1C('$'), 0);
- if (options >= 0)
+ int optionsNumber = parsedLine.indexOf( QL1C('$'), 0);
+ QStringList options;
+
+ if (optionsNumber >= 0)
{
- m_options = parsedLine.mid(options + 1).split(QL1C(','));
- parsedLine = parsedLine.left(options);
+ options = parsedLine.mid(optionsNumber + 1).split(QL1C(','));
+ parsedLine = parsedLine.left(optionsNumber);
}
if(!isRegExpRule)
@@ -87,10 +94,10 @@ AdBlockRule::AdBlockRule(const QString &filter)
m_regExp = QRegExp(parsedLine, Qt::CaseInsensitive, QRegExp::RegExp2);
- if (m_options.contains( QL1S("match-case") ))
+ if ( options.contains( QL1S("match-case") ))
{
m_regExp.setCaseSensitivity(Qt::CaseSensitive);
- m_options.removeOne( QL1S("match-case") );
+ m_optionMatchRule = true;
}
}
diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h
index 7c4c4161..35715051 100644
--- a/src/adblock/adblockrule.h
+++ b/src/adblock/adblockrule.h
@@ -55,11 +55,11 @@
#define ADBLOCKRULE_H
// Qt Includes
-#include <QStringList>
+#include <QRegExp>
+#include <QString>
// Forward Includes
class QUrl;
-class QRegExp;
class AdBlockRule
@@ -73,7 +73,9 @@ private:
QString convertPatternToRegExp(const QString &wildcardPattern);
QRegExp m_regExp;
- QStringList m_options;
+
+ // Rule Options
+ bool m_optionMatchRule;
};
diff --git a/src/application.cpp b/src/application.cpp
index e06f6f15..05004f30 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -42,6 +42,8 @@
#include "urlbar.h"
#include "sessionmanager.h"
#include "adblockmanager.h"
+#include "webview.h"
+#include "filterurljob.h"
// KDE Includes
#include <KCmdLineArgs>
@@ -53,6 +55,7 @@
#include <KMessageBox>
#include <KWindowInfo>
#include <KUrl>
+#include <ThreadWeaver/Weaver>
// Qt Includes
#include <QRegExp>
@@ -68,16 +71,21 @@ QPointer<AdBlockManager> Application::s_adblockManager;
Application::Application()
- : KUniqueApplication()
+ : KUniqueApplication()
{
+ connect(Weaver::instance(), SIGNAL( jobDone(ThreadWeaver::Job*) ),
+ this, SLOT( loadResolvedUrl(ThreadWeaver::Job*) ) );
}
Application::~Application()
{
qDeleteAll(m_mainWindows);
+
delete s_bookmarkProvider;
delete s_historyManager;
+ delete s_sessionManager;
+ delete s_adblockManager;
}
@@ -290,8 +298,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
switch(type)
{
case Rekonq::SettingOpenTab:
- tab = w->mainView()->newWebTab(!ReKonfig::openTabsBack(),
- ReKonfig::openTabsNearCurrent());
+ tab = w->mainView()->newWebTab(!ReKonfig::openTabsBack(), ReKonfig::openTabsNearCurrent());
break;
case Rekonq::NewCurrentTab:
tab = w->mainView()->newWebTab(true);
@@ -304,28 +311,13 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
tab = w->mainView()->currentWebTab();
break;
};
-
- // this should let rekonq filtering URI info and supporting
- // the beautiful KDE web browsing shortcuts
- KUriFilterData data(loadingUrl.pathOrUrl());
- data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
- loadingUrl = KUriFilter::self()->filterUri(data) ? data.uri().pathOrUrl() : QUrl::fromUserInput(loadingUrl.pathOrUrl());
-
- // we are sure of the url now, let's add it to history
- // anyway we store here just http sites because local and ftp ones are
- // added trough the protocol handler and the other are ignored
- if( url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("https") )
- historyManager()->addHistoryEntry( loadingUrl.prettyUrl() );
- if (!ReKonfig::openTabsBack())
- {
- w->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl());
- }
+ WebView *view = tab->view();
- if (tab)
+ if (view)
{
- tab->setFocus();
- tab->view()->load(loadingUrl);
+ FilterUrlJob *job = new FilterUrlJob(view, loadingUrl.pathOrUrl(), this);
+ Weaver::instance()->enqueue(job);
}
}
@@ -340,7 +332,7 @@ void Application::loadUrl(const QString& urlString, const Rekonq::OpenType& typ
MainWindow *Application::newMainWindow()
{
MainWindow *w = new MainWindow();
- w->mainView()->newWebTab(); // remember using newWebView and NOT newTab here!!
+ w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
m_mainWindows.prepend(w);
w->show();
@@ -361,7 +353,6 @@ MainWindowList Application::mainWindowList()
}
-
AdBlockManager *Application::adblockManager()
{
if(!s_adblockManager)
@@ -370,4 +361,26 @@ AdBlockManager *Application::adblockManager()
}
return s_adblockManager;
}
+
+
+void Application::loadResolvedUrl(ThreadWeaver::Job *job)
+{
+ FilterUrlJob *threadedJob = static_cast<FilterUrlJob *>(job);
+ KUrl url = threadedJob->url();
+ WebView *view = threadedJob->view();
+
+ if (view)
+ {
+ view->setFocus();
+ view->load(url);
+
+ // we are sure of the url now, let's add it to history
+ // anyway we store here just http sites because local and ftp ones are
+ // added trough the protocol handler and the other are ignored
+ if( url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("https") )
+ historyManager()->addHistoryEntry( url.prettyUrl() );
+ }
+ // Bye and thanks :)
+ delete threadedJob;
+}
diff --git a/src/application.h b/src/application.h
index 12ff2e3b..4b951ded 100644
--- a/src/application.h
+++ b/src/application.h
@@ -35,6 +35,7 @@
#include <KIcon>
#include <kio/job.h>
#include <kio/jobclasses.h>
+#include <ThreadWeaver/Job>
// Qt Includes
#include <QPointer>
@@ -48,6 +49,7 @@ class HistoryManager;
class MainWindow;
class SessionManager;
class AdBlockManager;
+class WebView;
typedef QList< QPointer<MainWindow> > MainWindowList;
@@ -110,6 +112,7 @@ public:
public slots:
/**
* Save application's configuration
+ *
* @see ReKonfig::self()->writeConfig();
*/
void saveConfiguration() const;
@@ -133,6 +136,8 @@ private slots:
*/
void postLaunch();
+ void loadResolvedUrl(ThreadWeaver::Job *);
+
private:
static QPointer<HistoryManager> s_historyManager;
static QPointer<BookmarkProvider> s_bookmarkProvider;
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index 97097fbb..9164dbb6 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -57,7 +57,6 @@ BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::Window
BookmarksPanel::~BookmarksPanel()
{
ReKonfig::setShowBookmarksPanel(!isHidden());
- delete ui;
}
@@ -73,7 +72,7 @@ void BookmarksPanel::setup()
setObjectName("bookmarksPanel");
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- ui = new QWidget(this);
+ QWidget *ui = new QWidget(this);
// setup search bar
QHBoxLayout *searchLayout = new QHBoxLayout;
@@ -110,5 +109,5 @@ void BookmarksPanel::setup()
treeView->setModel( proxy );
connect(search, SIGNAL(textChanged(QString)), proxy, SLOT(setFilterFixedString(QString)));
- connect( treeView, SIGNAL( activated(QModelIndex) ), this, SLOT( bookmarkActivated(QModelIndex) ) );
+ connect(treeView, SIGNAL( activated(QModelIndex) ), this, SLOT( bookmarkActivated(QModelIndex) ) );
}
diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h
index b7c0b5ed..6c0e153f 100644
--- a/src/bookmarks/bookmarkspanel.h
+++ b/src/bookmarks/bookmarkspanel.h
@@ -38,7 +38,6 @@ class QModelIndex;
class BookmarksPanel : public QDockWidget
{
Q_OBJECT
- Q_DISABLE_COPY(BookmarksPanel)
public:
explicit BookmarksPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
@@ -52,8 +51,6 @@ private slots:
private:
void setup();
-
- QWidget *ui;
};
#endif // BOOKMARKSPANEL_H
diff --git a/src/history/sidepanel.cpp b/src/filterurljob.cpp
index 7c42301c..00bdee36 100644
--- a/src/history/sidepanel.cpp
+++ b/src/filterurljob.cpp
@@ -2,8 +2,7 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
+* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -26,35 +25,43 @@
// Self Includes
-#include "sidepanel.h"
-#include "sidepanel.moc"
+#include "filterurljob.h"
-// Auto Includes
-#include "rekonq.h"
+// KDE Includes
+#include <KUriFilter>
+#include <KUriFilterData>
-// Local Includes
-#include "historypanel.h"
+// Qt Includes
+#include <QUrl>
-SidePanel::SidePanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(title, parent, flags)
- , m_historyPanel(new HistoryPanel(this))
+FilterUrlJob::FilterUrlJob(WebView *view, const QString &urlString, QObject *parent)
+ : Job(parent)
+ , _view(view)
+ , _urlString(urlString)
{
- setObjectName("sidePanel");
- setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
- setShown(ReKonfig::showSideBar());
+}
- connect(m_historyPanel, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&)));
- setWidget(m_historyPanel);
+WebView *FilterUrlJob::view()
+{
+ return _view;
}
-SidePanel::~SidePanel()
+KUrl FilterUrlJob::url()
{
- // Save side panel's state
- ReKonfig::setShowSideBar(!isHidden());
+ return _url;
+}
+
- delete m_historyPanel;
+void FilterUrlJob::run()
+{
+ // this should let rekonq filtering URI info and supporting
+ // the beautiful KDE web browsing shortcuts
+ KUriFilterData data(_urlString);
+ data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
+ _url = KUriFilter::self()->filterUri(data)
+ ? data.uri().pathOrUrl()
+ : QUrl::fromUserInput( _urlString );
}
diff --git a/src/history/sidepanel.h b/src/filterurljob.h
index 6aca3587..3a9511ea 100644
--- a/src/history/sidepanel.h
+++ b/src/filterurljob.h
@@ -2,8 +2,7 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
+* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -25,34 +24,38 @@
* ============================================================ */
-#ifndef SIDEPANEL_H
-#define SIDEPANEL_H
+#ifndef FILTER_URL_JOB_H
+#define FILTER_URL_JOB_H
// Local Includes
-#include "application.h"
+#include "webview.h"
+
+// KDE Includes
+#include <KUrl>
+#include <ThreadWeaver/Job>
// Qt Includes
-#include <QDockWidget>
+#include <QString>
+
-// Forward Declarations
-class KUrl;
-class HistoryPanel;
+using namespace ThreadWeaver;
-class SidePanel : public QDockWidget
+class FilterUrlJob : public Job
{
- Q_OBJECT
-
public:
- explicit SidePanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~SidePanel();
-
-signals:
- void openUrl(const KUrl &);
+ FilterUrlJob(WebView *view, const QString &urlString, QObject *parent = 0);
+ WebView *view();
+ KUrl url();
+
+protected:
+ void run();
+
private:
- HistoryPanel *m_historyPanel;
-
+ WebView *_view;
+ QString _urlString;
+ KUrl _url;
};
-#endif // SIDEPANEL_H
+#endif // FILTER_URL_JOB_H
diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp
index 42497f9e..08dc3800 100644
--- a/src/history/historypanel.cpp
+++ b/src/history/historypanel.cpp
@@ -29,25 +29,52 @@
#include "historypanel.h"
#include "historypanel.moc"
+// Auto Includes
+#include "rekonq.h"
+
+// Local Includes
+#include "application.h"
+#include "historymodels.h"
+
// Qt Includes
#include <QtGui/QLabel>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
+#include <QtGui/QTreeView>
+
// KDE Includes
#include <KLineEdit>
#include <KLocalizedString>
-HistoryPanel::HistoryPanel(QWidget *parent)
- : QWidget(parent)
- , m_historyTreeView(new QTreeView)
- , m_treeProxyModel(new TreeProxyModel(this))
+HistoryPanel::HistoryPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
+ : QDockWidget(title, parent, flags)
+{
+ setup();
+ setShown(ReKonfig::showHistoryPanel());
+}
+
+
+HistoryPanel::~HistoryPanel()
+{
+ // Save side panel's state
+ ReKonfig::setShowHistoryPanel(!isHidden());
+}
+
+
+void HistoryPanel::setup()
{
- m_historyTreeView->setUniformRowHeights(true);
- m_historyTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
- m_historyTreeView->setTextElideMode(Qt::ElideMiddle);
- m_historyTreeView->setAlternatingRowColors(true);
+ setObjectName("historyPanel");
+ setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+
+ QWidget *ui = new QWidget(this);
+
+ QTreeView *historyTreeView = new QTreeView(this);
+ historyTreeView->setUniformRowHeights(true);
+ historyTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
+ historyTreeView->setTextElideMode(Qt::ElideMiddle);
+ historyTreeView->setAlternatingRowColors(true);
// add search bar
QHBoxLayout *hBoxLayout = new QHBoxLayout;
@@ -60,42 +87,35 @@ HistoryPanel::HistoryPanel(QWidget *parent)
QWidget *searchBar = new QWidget;
searchBar->setLayout(hBoxLayout);
- // setup view
+ // setup layout
QVBoxLayout *vBoxLayout = new QVBoxLayout;
vBoxLayout->setContentsMargins(0, 0, 0, 0);
vBoxLayout->addWidget(searchBar);
- vBoxLayout->addWidget(m_historyTreeView);
- setLayout(vBoxLayout);
+ vBoxLayout->addWidget(historyTreeView);
+
+ // add it to the UI
+ ui->setLayout(vBoxLayout);
+ setWidget(ui);
//-
HistoryManager *historyManager = Application::historyManager();
QAbstractItemModel *model = historyManager->historyTreeModel();
- m_treeProxyModel->setSourceModel(model);
- m_historyTreeView->setModel(m_treeProxyModel);
- m_historyTreeView->setExpanded(m_treeProxyModel->index(0, 0), true);
- m_historyTreeView->header()->hideSection(1);
+ TreeProxyModel *treeProxyModel = new TreeProxyModel(this);
+ treeProxyModel->setSourceModel(model);
+ historyTreeView->setModel(treeProxyModel);
+ historyTreeView->setExpanded(treeProxyModel->index(0, 0), true);
+ historyTreeView->header()->hideSection(1);
QFontMetrics fm(font());
int header = fm.width(QLatin1Char('m')) * 40;
- m_historyTreeView->header()->resizeSection(0, header);
-
- connect(search, SIGNAL(textChanged(QString)), m_treeProxyModel, SLOT(setFilterFixedString(QString)));
- connect(m_historyTreeView, SIGNAL(activated(const QModelIndex&)), this, SLOT(open()));
-}
-
+ historyTreeView->header()->resizeSection(0, header);
-HistoryPanel::~HistoryPanel()
-{
- delete m_treeProxyModel;
- delete m_historyTreeView;
+ connect(search, SIGNAL(textChanged(QString)), treeProxyModel, SLOT(setFilterFixedString(QString)));
+ connect(historyTreeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
}
-void HistoryPanel::open()
+void HistoryPanel::itemActivated(const QModelIndex &item)
{
- QModelIndex index = m_historyTreeView->currentIndex();
- if (!index.parent().isValid())
- return;
- emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
+ emit openUrl( item.data(HistoryModel::UrlRole).toUrl() );
}
-
diff --git a/src/history/historypanel.h b/src/history/historypanel.h
index 083b2741..e07e2190 100644
--- a/src/history/historypanel.h
+++ b/src/history/historypanel.h
@@ -29,36 +29,31 @@
#define HISTORYPANEL_H
-// Local Includes
-#include "application.h"
-#include "historymodels.h"
-
// Qt Includes
-#include <QtGui/QWidget>
-#include <QtGui/QTreeView>
+#include <QDockWidget>
// Forward Declarations
class KUrl;
+class QWidget;
+class QModelIndex;
-class HistoryPanel : public QWidget
+class HistoryPanel : public QDockWidget
{
Q_OBJECT
public:
- explicit HistoryPanel(QWidget *parent = 0);
- virtual ~HistoryPanel();
+ explicit HistoryPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
+ ~HistoryPanel();
signals:
void openUrl(const KUrl &);
private slots:
- void open();
+ void itemActivated(const QModelIndex &);
private:
- QTreeView *m_historyTreeView;
- TreeProxyModel *m_treeProxyModel;
-
+ void setup();
};
#endif // HISTORYPANEL_H
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 7dbe8b23..b26e7466 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -146,14 +146,11 @@ void MainView::updateTabButtonPosition()
if (tabWidthHint < sizeHint().width()/4)
newPosX = tabWidgetWidth - m_addTabButton->width();
- // detecting Y position
- int newPosY = m_tabBar->height() - m_addTabButton->height();
- if(newPosY < 0)
- newPosY = 5; // this hardcoded value is used in just ONE situation:
- // the first time an user changes the "Always Show Tab Bar" settings
- // try some better fixes, if you can :D
-
- m_addTabButton->move(newPosX, newPosY);
+ // Y position is fixed
+ // Here I noticed with some emphiric valutations ( :D )
+ // that 2 look better than 0, just that..
+
+ m_addTabButton->move(newPosX, 2);
}
}
@@ -511,7 +508,7 @@ void MainView::closeTab(int index)
removeTab(index);
updateTabBar(); // UI operation: do it ASAP!!
- delete tab; // webView is scheduled for deletion.
+ tab->deleteLater(); // webView is scheduled for deletion.
emit tabsChanged();
diff --git a/src/mainview.h b/src/mainview.h
index f8a8c283..908389b1 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -148,7 +148,7 @@ private slots:
void postLaunch();
-
+
protected:
virtual void resizeEvent(QResizeEvent *event);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 9352ec36..df600c05 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -40,9 +40,9 @@
#include "webtab.h"
#include "mainview.h"
#include "findbar.h"
-#include "sidepanel.h"
+#include "historypanel.h"
#include "bookmarkspanel.h"
-#include "webinspectordock.h"
+#include "webinspectorpanel.h"
#include "urlbar.h"
#include "tabbar.h"
#include "adblockmanager.h"
@@ -98,9 +98,9 @@ MainWindow::MainWindow()
: KMainWindow()
, m_view( new MainView(this) )
, m_findBar( new FindBar(this) )
- , m_sidePanel(0)
+ , m_historyPanel(0)
, m_bookmarksPanel(0)
- , m_webInspectorDock(0)
+ , m_webInspectorPanel(0)
, m_historyBackMenu(0)
, m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, false, false) )
, m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, false) )
@@ -134,10 +134,8 @@ MainWindow::MainWindow()
// then, setup our actions
setupActions();
- // setting Side Panel
- setupSidePanel();
- setupBookmarksPanel();
- setupWebInspector();
+ // setting Panels
+ setupPanels();
// setting up rekonq tools
setupTools();
@@ -166,17 +164,6 @@ MainWindow::~MainWindow()
}
-SidePanel *MainWindow::sidePanel()
-{
- return m_sidePanel;
-}
-
-BookmarksPanel *MainWindow::bookmarksPanel()
-{
- return m_bookmarksPanel;
-}
-
-
void MainWindow::setupToolbars()
{
// ============ Main ToolBar ================================
@@ -200,7 +187,7 @@ void MainWindow::setupToolbars()
m_bmBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_bmBar->setAcceptDrops(true);
m_bmBar->setContextMenuPolicy(Qt::CustomContextMenu);
-
+ m_bmBar->setIconDimensions(16);
Application::bookmarkProvider()->setupBookmarkBar(m_bmBar);
}
@@ -459,51 +446,50 @@ void MainWindow::setupTools()
}
-void MainWindow::setupSidePanel()
+void MainWindow::setupPanels()
{
- // Setup history side panel
- m_sidePanel = new SidePanel(i18n("History Panel"), this);
- connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&)));
- connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration()));
+ KAction* a;
+
+ // STEP 1
+ // Setup history panel
+ m_historyPanel = new HistoryPanel(i18n("History Panel"), this);
+ connect(m_historyPanel, SIGNAL(openUrl(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&)));
+ connect(m_historyPanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration()));
- addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel);
+ addDockWidget(Qt::LeftDockWidgetArea, m_historyPanel);
- // setup side panel actions
- KAction* a = (KAction *) m_sidePanel->toggleViewAction();
- a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
+ // setup history panel action
+ a = (KAction *) m_historyPanel->toggleViewAction();
+ a->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_H) );
a->setIcon(KIcon("view-history"));
actionCollection()->addAction(QLatin1String("show_history_panel"), a);
-}
-
-void MainWindow::setupBookmarksPanel()
-{
+ // STEP 2
+ // Setup bookmarks panel
m_bookmarksPanel = new BookmarksPanel(i18n("Bookmarks Panel"), this);
connect(m_bookmarksPanel, SIGNAL(openUrl(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&)));
connect(m_bookmarksPanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration()));
addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksPanel);
- // setup side panel actions
- KAction* a = (KAction *) m_bookmarksPanel->toggleViewAction();
- a->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
+ // setup bookmarks panel action
+ a = (KAction *) m_bookmarksPanel->toggleViewAction();
+ a->setShortcut( QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B) );
a->setIcon(KIcon("bookmarks-organize"));
actionCollection()->addAction(QLatin1String("show_bookmarks_panel"), a);
-}
-
-void MainWindow::setupWebInspector()
-{
- m_webInspectorDock = new WebInspectorDock(i18n("Web Inspector"), this);
- connect(mainView(), SIGNAL(currentChanged(int)), m_webInspectorDock, SLOT(changeCurrentPage()));
+ // STEP 3
+ // Setup webinspector panel
+ m_webInspectorPanel = new WebInspectorPanel(i18n("Web Inspector"), this);
+ connect(mainView(), SIGNAL(currentChanged(int)), m_webInspectorPanel, SLOT(changeCurrentPage()));
- KAction *a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this);
+ a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this);
a->setCheckable(true);
actionCollection()->addAction(QLatin1String("web_inspector"), a);
- connect(a, SIGNAL(triggered(bool)), m_webInspectorDock, SLOT(toggle(bool)));
+ connect(a, SIGNAL(triggered(bool)), m_webInspectorPanel, SLOT(toggle(bool)));
- addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorDock);
- m_webInspectorDock->hide();
+ addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel);
+ m_webInspectorPanel->hide();
}
@@ -710,13 +696,12 @@ void MainWindow::privateBrowsing(bool enable)
"<p>When private browsing is turned on,"
" web pages are not added to the history,"
" new cookies are not stored, current cookies cannot be accessed,"
- " site icons will not be stored, the session will not be saved, "
- " and searches are not added to the pop-up menu in the Google search box."
- " Until you close the window, you can still click the Back and Forward buttons"
+ " site icons will not be stored, the session will not be saved."
+ " Until you close the window, you can still click the Back and Forward buttons"
" to return to the web pages you have opened.</p>", title);
- int button = KMessageBox::questionYesNo(this, text, title);
- if (button == KMessageBox::Yes)
+ int button = KMessageBox::warningContinueCancel(this, text, title);
+ if (button == KMessageBox::Continue)
{
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
m_view->urlBar()->setBackgroundColor(Qt::lightGray); // palette().color(QPalette::Active, QPalette::Background));
@@ -808,7 +793,7 @@ void MainWindow::setWidgetsVisible(bool makeVisible)
{
// state flags
static bool bookmarksToolBarFlag;
- static bool sidePanelFlag;
+ static bool historyPanelFlag;
static bool bookmarksPanelFlag;
if (!makeVisible)
@@ -817,14 +802,14 @@ void MainWindow::setWidgetsVisible(bool makeVisible)
if (!isFullScreen())
{
bookmarksToolBarFlag = m_bmBar->isHidden();
- sidePanelFlag = sidePanel()->isHidden();
- bookmarksPanelFlag = bookmarksPanel()->isHidden();
+ historyPanelFlag = m_historyPanel->isHidden();
+ bookmarksPanelFlag = m_bookmarksPanel->isHidden();
}
m_bmBar->hide();
m_view->setTabBarHidden(true);
- sidePanel()->hide();
- bookmarksPanel()->hide();
+ m_historyPanel->hide();
+ m_bookmarksPanel->hide();
// hide main toolbar
m_mainBar->hide();
@@ -838,10 +823,10 @@ void MainWindow::setWidgetsVisible(bool makeVisible)
// restore state of windowed mode
if (!bookmarksToolBarFlag)
m_bmBar->show();
- if (!sidePanelFlag)
- sidePanel()->show();
+ if (!historyPanelFlag)
+ m_historyPanel->show();
if (!bookmarksPanelFlag)
- bookmarksPanel()->show();
+ m_bookmarksPanel->show();
}
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 49dc2a59..7083591d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -46,9 +46,9 @@ class KAction;
class KPassivePopup;
class FindBar;
-class SidePanel;
+class HistoryPanel;
class BookmarksPanel;
-class WebInspectorDock;
+class WebInspectorPanel;
class WebTab;
class MainView;
@@ -77,15 +77,8 @@ private:
void setupActions();
void setupTools();
void setupToolbars();
-
- void setupSidePanel();
- SidePanel *sidePanel();
-
- void setupBookmarksPanel();
- BookmarksPanel *bookmarksPanel();
+ void setupPanels();
- void setupWebInspector();
-
public slots:
void updateBrowser();
void homePage();
@@ -159,9 +152,10 @@ private slots:
private:
MainView *m_view;
FindBar *m_findBar;
- SidePanel *m_sidePanel;
+
+ HistoryPanel *m_historyPanel;
BookmarksPanel *m_bookmarksPanel;
- WebInspectorDock *m_webInspectorDock;
+ WebInspectorPanel *m_webInspectorPanel;
KAction *m_stopReloadAction;
KMenu *m_historyBackMenu;
@@ -178,4 +172,3 @@ private:
};
#endif // MAINWINDOW_H
-
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
index 7d6bf434..eadbfab3 100644
--- a/src/networkaccessmanager.cpp
+++ b/src/networkaccessmanager.cpp
@@ -41,14 +41,6 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent)
QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData)
{
- if (op == PostOperation && outgoingData)
- {
- QByteArray outgoingDataByteArray = outgoingData->peek(1024 * 1024);
- kDebug() << "*************************************************************************";
- kDebug() << outgoingDataByteArray;
- kDebug() << "*************************************************************************";
- }
-
// Adblock
if (op == QNetworkAccessManager::GetOperation)
{
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index 80757ca2..9c8bb194 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -29,7 +29,6 @@
#include "previewimage.moc"
// Local Includes
-#include "application.h"
#include "historymanager.h"
#include "rekonq.h"
#include "mainwindow.h"
@@ -103,6 +102,9 @@ PreviewImage::PreviewImage(const QUrl &url, const QString &title, int index, boo
layout()->setAlignment(Qt::AlignCenter);
layout()->addWidget(m_previewLabel);
+ connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)),
+ Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &)));
+
loadUrlPreview(url);
}
@@ -260,12 +262,12 @@ void PreviewImage::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
- Application::instance()->loadUrl(m_url);
+ emit loadUrl(m_url, Rekonq::CurrentTab);
return;
}
else if(event->button() == Qt::MidButton)
{
- Application::instance()->loadUrl(m_url, Rekonq::SettingOpenTab);
+ emit loadUrl(m_url, Rekonq::SettingOpenTab);
return;
}
diff --git a/src/previewimage.h b/src/previewimage.h
index e9504210..4dd8df3b 100644
--- a/src/previewimage.h
+++ b/src/previewimage.h
@@ -29,6 +29,7 @@
// Local Includes
#include "websnap.h"
+#include "application.h"
// KDE Includes
#include <KActionMenu>
@@ -58,6 +59,9 @@ public slots:
void setUrlFromAction();
void refreshPreview();
+signals:
+ void loadUrl(const KUrl &, const Rekonq::OpenType &);
+
protected:
void contextMenuEvent(QContextMenuEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index f74fb144..a24508fc 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -35,7 +35,7 @@
<entry name="homePage" type="String">
<default>http://www.kde.org/</default>
</entry>
- <entry name="showSideBar" type="Bool">
+ <entry name="showHistoryPanel" type="Bool">
<default>false</default>
</entry>
<entry name="showBookmarksPanel" type="Bool">
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui
index 17ac0d0f..a4503d4a 100644
--- a/src/settings/settings_general.ui
+++ b/src/settings/settings_general.ui
@@ -244,22 +244,22 @@
</property>
<item>
<property name="text">
- <string>favorites</string>
+ <string>Favorites</string>
</property>
</item>
<item>
<property name="text">
- <string>closed tabs</string>
+ <string>Closed Tabs</string>
</property>
</item>
<item>
<property name="text">
- <string>history</string>
+ <string>Bookmarks</string>
</property>
</item>
<item>
<property name="text">
- <string>bookmarks</string>
+ <string>History</string>
</property>
</item>
</widget>
@@ -276,12 +276,15 @@
<item>
<widget class="QCheckBox" name="kcfg_kgetDownload">
<property name="text">
- <string>Download with KGet</string>
+ <string>Use KGet for downloading files</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_kgetList">
+ <property name="whatsThis">
+ <string>If enabled, rekonq will display an additional context menu entry, which, when selected, lists all available links of the current website in KGet.</string>
+ </property>
<property name="text">
<string>List links with KGet</string>
</property>
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 12745772..460a2464 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -153,8 +153,8 @@ void TabBar::showTabPreview(int tab)
WebTab *view = mv->webTab(tab);
WebTab *currentView = mv->webTab(currentIndex());
- // should fix bug #212219
- if(!currentView)
+ // check if view && currentView exist before using them :)
+ if(!currentView || !view)
return;
int w = tabSizeHint(tab).width();
@@ -199,7 +199,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
}
//if found and not the current tab then show tab preview
- if (tab != -1 && tab != currentIndex() && m_currentTabPreview != tab)
+ if (tab != -1 && tab != currentIndex() && m_currentTabPreview != tab && event->buttons() == Qt::NoButton)
{
showTabPreview(tab);
m_currentTabPreview = tab;
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index be19dae4..adeba6ae 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -140,13 +140,15 @@ void UrlBar::setUrl(const QUrl& url)
if(url.scheme() == "about")
{
m_currentUrl = KUrl();
+ updateUrl(); // updateUrl before setFocus
setFocus();
}
else
{
m_currentUrl = KUrl(url);
+ updateUrl();
}
- updateUrl();
+
}
@@ -302,36 +304,43 @@ bool UrlBar::isLoading()
return true;
}
+
void UrlBar::keyPressEvent(QKeyEvent *event)
{
QString currentText = m_lineEdit->text().trimmed();
- if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
- && !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive))
+ if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
- QString append;
- if (event->modifiers() == Qt::ControlModifier)
+ if( !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive) )
{
- append = QLatin1String(".com");
+ QString append;
+ if (event->modifiers() == Qt::ControlModifier)
+ {
+ append = QLatin1String(".com");
+ }
+ else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
+ {
+ append = QLatin1String(".org");
+ }
+ else if (event->modifiers() == Qt::ShiftModifier)
+ {
+ append = QLatin1String(".net");
+ }
+
+ QUrl url(QLatin1String("http://www.") + currentText);
+ QString host = url.host();
+ if (!host.endsWith(append, Qt::CaseInsensitive))
+ {
+ host += append;
+ url.setHost(host);
+ m_lineEdit->setText(url.toString());
+ }
}
- else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
- {
- append = QLatin1String(".org");
- }
- else if (event->modifiers() == Qt::ShiftModifier)
- {
- append = QLatin1String(".net");
- }
-
- QUrl url(QLatin1String("http://www.") + currentText);
- QString host = url.host();
- if (!host.endsWith(append, Qt::CaseInsensitive))
+ else
{
- host += append;
- url.setHost(host);
- m_lineEdit->setText(url.toString());
+ // fill lineEdit with its stripped contents to remove trailing spaces
+ m_lineEdit->setText(currentText);
}
}
KHistoryComboBox::keyPressEvent(event);
}
-
diff --git a/src/webinspectordock.cpp b/src/webinspectorpanel.cpp
index 2c17a607..a038d280 100644
--- a/src/webinspectordock.cpp
+++ b/src/webinspectorpanel.cpp
@@ -23,9 +23,10 @@
*
* ============================================================ */
+
// Self Includes
-#include "webinspectordock.h"
-#include "webinspectordock.moc"
+#include "webinspectorpanel.h"
+#include "webinspectorpanel.moc"
// Local Includes
#include "webtab.h"
@@ -40,27 +41,28 @@
#include <QWebInspector>
-WebInspectorDock::WebInspectorDock(QString title, QWidget *parent)
+WebInspectorPanel::WebInspectorPanel(QString title, QWidget *parent)
: QDockWidget(title, parent)
{
setObjectName("webInspectorDock");
- QWebInspector *inspector = new QWebInspector(this);
- setWidget(inspector);
+ setWidget( new QWebInspector(this) );
}
-void WebInspectorDock::closeEvent(QCloseEvent *event)
+
+void WebInspectorPanel::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
toggle(false);
}
-MainWindow* WebInspectorDock::mainWindow()
+
+MainWindow* WebInspectorPanel::mainWindow()
{
return qobject_cast< MainWindow* >(parentWidget());
}
-void WebInspectorDock::toggle(bool enable)
+void WebInspectorPanel::toggle(bool enable)
{
mainWindow()->actionByName("web_inspector")->setChecked(enable);
if (enable)
@@ -77,7 +79,7 @@ void WebInspectorDock::toggle(bool enable)
}
-void WebInspectorDock::changeCurrentPage()
+void WebInspectorPanel::changeCurrentPage()
{
bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);
toggle(enable);
diff --git a/src/webinspectordock.h b/src/webinspectorpanel.h
index c6697361..8f65b48a 100644
--- a/src/webinspectordock.h
+++ b/src/webinspectorpanel.h
@@ -24,8 +24,8 @@
* ============================================================ */
-#ifndef WEBINSPECTORDOCK_H
-#define WEBINSPECTORDOCK_H
+#ifndef WEBINSPECTOR_PANEL_H
+#define WEBINSPECTOR_PANEL_H
// Local Includes
@@ -38,11 +38,11 @@
Docked web inspector
behaviour : hide/show by tab, not globally
*/
-class WebInspectorDock : public QDockWidget
+class WebInspectorPanel : public QDockWidget
{
Q_OBJECT
public:
- WebInspectorDock(QString title, QWidget *parent);
+ WebInspectorPanel(QString title, QWidget *parent);
public slots:
void toggle(bool enable);
@@ -55,4 +55,4 @@ protected:
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 6bf172a6..b2bedffc 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -73,11 +73,19 @@
WebPage::WebPage(QObject *parent)
: KWebPage(parent, KWalletIntegration)
{
- // rekonq own classes integration
- setNetworkAccessManager(new NetworkAccessManager(this));
+ setForwardUnsupportedContent(true);
+
+ // rekonq Network Manager
+ NetworkAccessManager *manager = new NetworkAccessManager(this);
+
+ // disable QtWebKit cache to just use KIO one..
+ manager->setCache(0);
+
+ setNetworkAccessManager(manager);
+
+ // Web Plugin Factory
setPluginFactory(new WebPluginFactory(this));
- setForwardUnsupportedContent(true);
connect(networkAccessManager(), SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*)));
@@ -91,6 +99,7 @@ WebPage::WebPage(QObject *parent)
WebPage::~WebPage()
{
+ disconnect();
}
diff --git a/src/webtab.cpp b/src/webtab.cpp
index 908fc7a3..b1f2cdfc 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -91,8 +91,6 @@ WebTab::WebTab(QWidget* parent)
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
-
- connect(m_view, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)), this, SLOT(loadInNewTab(const KUrl &)) );
}
@@ -110,7 +108,7 @@ WebView *WebTab::view()
WebPage *WebTab::page()
{
- return m_view->page();
+ return m_view->page(); // FIXME
}
@@ -150,12 +148,6 @@ void WebTab::loadFinished(bool)
}
-void WebTab::loadInNewTab(const KUrl &url)
-{
- Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
-}
-
-
void WebTab::createWalletBar(const QString &key, const QUrl &url)
{
KWebWallet *wallet = page()->wallet();
diff --git a/src/webtab.h b/src/webtab.h
index 2eb8d733..ecf8e5b3 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -57,10 +57,8 @@ private slots:
void updateProgress(int progress);
void loadFinished(bool);
- void loadInNewTab(const KUrl &url);
-
void createWalletBar(const QString &, const QUrl &);
-
+
private:
WebView *const m_view;
int m_progress;
diff --git a/src/webview.cpp b/src/webview.cpp
index 292eb364..232a2633 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -33,7 +33,6 @@
#include "rekonq.h"
// Local Includes
-#include "application.h"
#include "mainwindow.h"
#include "mainview.h"
#include "webpage.h"
@@ -60,6 +59,7 @@
#include <QtDBus/QDBusReply>
#include <QDir>
+
WebView::WebView(QWidget* parent)
: KWebView(parent, false)
, m_page( new WebPage(this) )
@@ -68,8 +68,18 @@ WebView::WebView(QWidget* parent)
setPage(m_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 &)));
+ 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 &)));
+
+ // middle click || ctrl + click signal
+ connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
+ this, SLOT(loadUrlInNewTab(const KUrl &)) );
+
+ // loadUrl signal
+ connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)),
+ Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &)));
}
@@ -268,7 +278,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (ReKonfig::kgetList())
{
- a = new KAction(KIcon("kget"), i18n("List all links"), this);
+ a = new KAction(KIcon("kget"), i18n("List All Links"), this);
connect(a, SIGNAL(triggered(bool)), page(), SLOT(downloadAllContentsWithKGet()));
menu.addAction(a);
}
@@ -340,7 +350,8 @@ void WebView::search()
KAction *a = qobject_cast<KAction*>(sender());
QString search = a->data().toString() + selectedText();
KUrl urlSearch = KUrl::fromEncoded(search.toUtf8());
- Application::instance()->loadUrl(urlSearch, Rekonq::NewCurrentTab);
+
+ emit loadUrl(urlSearch, Rekonq::NewCurrentTab);
}
@@ -357,11 +368,11 @@ void WebView::viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifier
if (modifiers & Qt::ControlModifier || buttons == Qt::MidButton)
{
- Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
+ emit loadUrl(url, Rekonq::SettingOpenTab);
}
else
{
- Application::instance()->loadUrl(url, Rekonq::CurrentTab);
+ emit loadUrl(url, Rekonq::CurrentTab);
}
}
@@ -370,7 +381,8 @@ void WebView::openLinkInNewWindow()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
- Application::instance()->loadUrl(url, Rekonq::NewWindow);
+
+ emit loadUrl(url, Rekonq::NewWindow);
}
@@ -378,7 +390,8 @@ void WebView::openLinkInNewTab()
{
KAction *a = qobject_cast<KAction*>(sender());
KUrl url(a->data().toUrl());
- Application::instance()->loadUrl(url, Rekonq::SettingOpenTab);
+
+ emit loadUrl(url, Rekonq::SettingOpenTab);
}
@@ -406,3 +419,9 @@ void WebView::inspect()
if(a && !a->isChecked())
a->trigger();
}
+
+
+void WebView::loadUrlInNewTab(const KUrl &url)
+{
+ emit loadUrl(url, Rekonq::SettingOpenTab);
+}
diff --git a/src/webview.h b/src/webview.h
index d34d108b..263b2ec4 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -28,12 +28,16 @@
#ifndef WEBVIEW_H
#define WEBVIEW_H
+// Local Includes
+#include "application.h"
+
// KDE Includes
#include <KWebView>
// Forward Declarations
class WebPage;
+
class WebView : public KWebView
{
Q_OBJECT
@@ -56,11 +60,16 @@ private slots:
void printFrame();
+ void loadUrlInNewTab(const KUrl &);
void openLinkInNewWindow();
void openLinkInNewTab();
+
void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
void inspect();
+signals:
+ void loadUrl(const KUrl &, const Rekonq::OpenType &);
+
private:
WebPage *const m_page;
QPoint m_mousePos;