aboutsummaryrefslogtreecommitdiff
path: root/src/webengine
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/webprofile.cpp8
-rw-r--r--src/webengine/webprofile.h6
-rw-r--r--src/webengine/webview.cpp10
-rw-r--r--src/webengine/webview.h2
4 files changed, 21 insertions, 5 deletions
diff --git a/src/webengine/webprofile.cpp b/src/webengine/webprofile.cpp
index 24b23a0..54aab5a 100644
--- a/src/webengine/webprofile.cpp
+++ b/src/webengine/webprofile.cpp
@@ -53,15 +53,19 @@ QUrl WebProfile::newtab() const
return m_newtab;
}
-void WebProfile::loadProfile(QHash<QString, QString> conf, const QString &path)
+void WebProfile::loadProfile(QHash<QString, QString> conf)
{
- m_configPath = path;
+ if(isOffTheRecord())
+ m_configPath = conf.value("profile.path") + "/otr.ini";
+ else
+ m_configPath = conf.value("profile.path") + "/" + storageName() + "/profile.ini";
#ifdef QT_DEBUG
qDebug("Reading config for profile '%s': %s", qUtf8Printable(m_name), qUtf8Printable(m_configPath));
#endif
QSettings config(m_configPath, QSettings::IniFormat);
+ m_search = config.value("search", conf.value("profile.search")).toString();
m_homepage = config.value("homepage", conf["profile.homepage"]).toUrl();
m_newtab = config.value("newtab", conf["profile.newtab"]).toUrl();
diff --git a/src/webengine/webprofile.h b/src/webengine/webprofile.h
index 41d1aec..1668067 100644
--- a/src/webengine/webprofile.h
+++ b/src/webengine/webprofile.h
@@ -34,11 +34,14 @@ public:
}
QString name() const;
+ QString search() const {
+ return m_search;
+ }
QUrl homepage() const;
QUrl newtab() const;
public slots:
- void loadProfile(QHash<QString, QString> conf, const QString &path);
+ void loadProfile(QHash<QString, QString> conf);
void saveProfile(const QString &path = QString());
private:
@@ -46,6 +49,7 @@ private:
QString m_configPath;
QString m_name;
+ QString m_search = QString("about:blank");
QUrl m_homepage = QUrl("about:blank");
QUrl m_newtab = QUrl("about:blank");
};
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index d145d2b..1e5d8d5 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -74,10 +74,16 @@ int WebView::loadProgress() const
return m_loadProgress;
}
+void WebView::search(const QString& term)
+{
+ const QString searchUrl = m_profile->search().arg(QString(QUrl::toPercentEncoding(term)));
+ load(searchUrl);
+}
+
WebView *WebView::createWindow(QWebEnginePage::WebWindowType type)
{
if(m_parentWindow == nullptr) {
- qDebug("parent window not found!");
+ qDebug("WebView::createWindow: parent window not found, returning nullptr");
return nullptr;
}
@@ -111,7 +117,7 @@ WebView *WebView::createWindow(QWebEnginePage::WebWindowType type)
void WebView::handleLinkHovered(const QString &url)
{
// TODO: tooltip
- qDebug("%s", qUtf8Printable(url));
+ Q_UNUSED(url);
}
void WebView::triggerViewAction(WebView::ViewAction action)
diff --git a/src/webengine/webview.h b/src/webengine/webview.h
index a27a61f..ab86ec2 100644
--- a/src/webengine/webview.h
+++ b/src/webengine/webview.h
@@ -38,6 +38,8 @@ public:
bool isLoaded() const;
int loadProgress() const;
+ void search(const QString &term);
+
void triggerViewAction(ViewAction action);
signals: