aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browser.cpp2
-rw-r--r--src/browser.h5
-rw-r--r--src/forms/profilesdialog.cpp2
-rw-r--r--src/lib/bookmarks/bookmarks.qbs26
-rw-r--r--src/lib/bookmarks/bookmarksform.ui (renamed from src/forms/bookmarksform.ui)0
-rw-r--r--src/lib/bookmarks/bookmarkswidget.cpp (renamed from src/forms/bookmarkswidget.cpp)24
-rw-r--r--src/lib/bookmarks/bookmarkswidget.h (renamed from src/forms/bookmarkswidget.h)6
-rw-r--r--src/lib/bookmarks/xbel.cpp (renamed from src/xbel.cpp)0
-rw-r--r--src/lib/bookmarks/xbel.h (renamed from src/xbel.h)0
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/webengine/webengineprofile.cpp1
-rw-r--r--src/widgets/mainwindowmenubar.cpp2
-rw-r--r--src/widgets/webviewtabbar.cpp2
13 files changed, 52 insertions, 24 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index 20a91dd..8db1980 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -139,7 +139,7 @@ QNetworkAccessManager *Browser::network()
BookmarksWidget *Browser::bookmarks()
{
if(!m_bookmarksManager) {
- m_bookmarksManager = new BookmarksWidget();
+ m_bookmarksManager = new BookmarksWidget(settings()->value("bookmarks.path").toString());
}
return m_bookmarksManager;
}
diff --git a/src/browser.h b/src/browser.h
index 75102c6..7a5d300 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -23,12 +23,15 @@
#include "singleapplication.h"
#include <QVector>
-#include "forms/bookmarkswidget.h"
+#include <bookmarks/bookmarkswidget.h>
#include "forms/downloadswidget.h"
#include "settings.h"
#include <QNetworkAccessManager>
#include "webengine/webengineprofile.h"
+#include "filter/blockermanager.h"
+#include "webengine/urlinterceptor.h"
+
#ifdef qApp
#undef qApp
#define qApp Browser::instance()
diff --git a/src/forms/profilesdialog.cpp b/src/forms/profilesdialog.cpp
index 557d865..00e4920 100644
--- a/src/forms/profilesdialog.cpp
+++ b/src/forms/profilesdialog.cpp
@@ -28,6 +28,8 @@
#include <QPushButton>
#include <QInputDialog>
+#include "mainwindow.h"
+
ProfilesDialog::ProfilesDialog(MainWindow *window, QWidget *parent) :
QDialog(parent),
ui(new Ui::ProfilesDialog)
diff --git a/src/lib/bookmarks/bookmarks.qbs b/src/lib/bookmarks/bookmarks.qbs
new file mode 100644
index 0000000..22971a4
--- /dev/null
+++ b/src/lib/bookmarks/bookmarks.qbs
@@ -0,0 +1,26 @@
+import qbs 1.0
+
+Project {
+ name: "bookmarks"
+
+ StaticLibrary {
+ id: bookmarks
+ name: "bookmarks"
+
+ cpp.includePaths: ['../..']
+
+ Depends {
+ name: "Qt"
+ versionAtLeast: "5.9.0"
+ submodules: ["core", "widgets"]
+ }
+
+ files: [
+ "bookmarksform.ui",
+ "bookmarkswidget.cpp",
+ "bookmarkswidget.h",
+ "xbel.cpp",
+ "xbel.h",
+ ]
+ }
+}
diff --git a/src/forms/bookmarksform.ui b/src/lib/bookmarks/bookmarksform.ui
index 2df0c4b..2df0c4b 100644
--- a/src/forms/bookmarksform.ui
+++ b/src/lib/bookmarks/bookmarksform.ui
diff --git a/src/forms/bookmarkswidget.cpp b/src/lib/bookmarks/bookmarkswidget.cpp
index 9a43224..38716ce 100644
--- a/src/forms/bookmarkswidget.cpp
+++ b/src/lib/bookmarks/bookmarkswidget.cpp
@@ -20,10 +20,10 @@
#include "bookmarkswidget.h"
#include "ui_bookmarksform.h"
-#include "browser.h"
#include <QTreeWidget>
+#include <QUrl>
-BookmarksWidget::BookmarksWidget(QWidget *parent) :
+BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) :
DockingWidget(tr("Bookmarks"), parent),
ui(new Ui::BookmarksDialog)
{
@@ -45,8 +45,9 @@ BookmarksWidget::BookmarksWidget(QWidget *parent) :
ui->deleteItem_toolButton->setShortcut(QKeySequence::Delete);
connect(ui->deleteItem_toolButton, SIGNAL(clicked(bool)), this, SLOT(deleteCurrentItem()));
+ m_path = path;
xbel = new Xbel(ui->treeWidget);
- xbel->read(sSettings->value("bookmarks.path").toString());
+ xbel->read(m_path);
connect(ui->addFolder_toolButton, &QToolButton::clicked, [this]() {
xbel->addFolder(ui->treeWidget->currentItem());
@@ -64,21 +65,13 @@ BookmarksWidget::~BookmarksWidget()
qDebug("Destroying BookmarksManager");
if(ui->treeWidget->topLevelItemCount() > 0) {
- xbel->write(sSettings->value("bookmarks.path").toString());
+ xbel->write(m_path);
}
delete xbel;
delete ui;
}
-void BookmarksWidget::show()
-{
- // show() gets called by a QAction in MainWindow
- window = qobject_cast<MainWindow *>(sender()->parent());
-
- DockingWidget::show();
-}
-
void BookmarksWidget::deleteCurrentItem()
{
delete ui->treeWidget->currentItem();
@@ -87,12 +80,7 @@ void BookmarksWidget::deleteCurrentItem()
void BookmarksWidget::openItem(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column)
-
- if(window) {
- window->newTab(QUrl::fromUserInput(item->text(1)));
- } else {
- qWarning("Trying to open a link without a MainWindow set");
- }
+ emit openUrl(QUrl::fromUserInput(item->text(1)));
}
void BookmarksWidget::showItemDetails()
diff --git a/src/forms/bookmarkswidget.h b/src/lib/bookmarks/bookmarkswidget.h
index ba0b361..a31cfea 100644
--- a/src/forms/bookmarkswidget.h
+++ b/src/lib/bookmarks/bookmarkswidget.h
@@ -24,7 +24,6 @@
#include "widgets/dockingwidget.h"
#include <QDockWidget>
#include "xbel.h"
-#include "mainwindow.h"
namespace Ui {
class BookmarksDialog;
@@ -35,14 +34,13 @@ class BookmarksWidget : public DockingWidget
Q_OBJECT
public:
- explicit BookmarksWidget(QWidget *parent = 0);
+ explicit BookmarksWidget(const QString &path, QWidget *parent = 0);
~BookmarksWidget();
signals:
void openUrl(const QUrl &url);
public slots:
- void show();
// void addFolder(const QString &title);
// void addBookmark(const QString &title, const QString &href);
// void addSeparator();
@@ -53,7 +51,7 @@ private slots:
void showItemDetails();
private:
- MainWindow *window;
+ QString m_path;
Ui::BookmarksDialog *ui;
Xbel *xbel;
};
diff --git a/src/xbel.cpp b/src/lib/bookmarks/xbel.cpp
index 7ba0cb4..7ba0cb4 100644
--- a/src/xbel.cpp
+++ b/src/lib/bookmarks/xbel.cpp
diff --git a/src/xbel.h b/src/lib/bookmarks/xbel.h
index 0ff98fc..0ff98fc 100644
--- a/src/xbel.h
+++ b/src/lib/bookmarks/xbel.h
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index dd16172..be19021 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -108,6 +108,12 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) :
});
connect(tabBar, SIGNAL(currentTabChanged(WebView*)), this, SLOT(handleTabChanged(WebView*)));
+ connect(qApp->bookmarks(), &BookmarksWidget::openUrl, [this](const QUrl &url) {
+ if(this->isActiveWindow()) {
+ this->newTab(url);
+ }
+ });
+
// Load profile
tabBar->setProfile(qApp->profile(sSettings->value("browser.profile.default").toString()));
diff --git a/src/webengine/webengineprofile.cpp b/src/webengine/webengineprofile.cpp
index 583be3e..9745949 100644
--- a/src/webengine/webengineprofile.cpp
+++ b/src/webengine/webengineprofile.cpp
@@ -22,6 +22,7 @@
#include "browser.h"
#include <QSettings>
#include <QWebEngineSettings>
+#include <QFile>
WebEngineProfile::WebEngineProfile(QObject *parent) :
QWebEngineProfile(parent)
diff --git a/src/widgets/mainwindowmenubar.cpp b/src/widgets/mainwindowmenubar.cpp
index 8dd7fe6..e69a207 100644
--- a/src/widgets/mainwindowmenubar.cpp
+++ b/src/widgets/mainwindowmenubar.cpp
@@ -26,6 +26,8 @@
#include "interfaces.h"
+#include "mainwindow.h"
+
MainWindowMenuBar::MainWindowMenuBar(MainWindow *parent) :
QMenuBar(parent)
{
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index eb2e463..7ec7f0b 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -21,6 +21,8 @@
#include "webviewtabbar.h"
#include "browser.h"
#include <QAction>
+#include <QContextMenuEvent>
+#include <QMenu>
WebViewTabBar::WebViewTabBar(WebEngineProfile *profile, QWidget *parent) :
QTabBar(parent)