[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser.spec
^
|
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/common/browserpaths.cpp
^
|
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Jolla Ltd.
+** Contact: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <QDebug>
+#include <QString>
+#include <QDir>
+#include <QStandardPaths>
+#include "browserpaths.h"
+
+#include <pwd.h>
+#include <grp.h>
+#include <unistd.h>
+
+static QString getLocation(QStandardPaths::StandardLocation locationType) {
+ QString location(QStandardPaths::writableLocation(locationType));
+ QDir dir(location);
+ if (!dir.exists()) {
+ if (!dir.mkpath(location)) {
+ qWarning() << QString("Can't create directory %1").arg(location);
+ return QString();
+ }
+ }
+
+ return location;
+}
+
+QString BrowserPaths::downloadLocation()
+{
+ return getLocation(QStandardPaths::DownloadLocation);
+}
+
+QString BrowserPaths::picturesLocation()
+{
+ return getLocation(QStandardPaths::PicturesLocation);
+}
+
+QString BrowserPaths::dataLocation()
+{
+ return getLocation(QStandardPaths::DataLocation);
+}
+
+QString BrowserPaths::applicationsLocation()
+{
+ return getLocation(QStandardPaths::ApplicationsLocation);
+}
+
+QString BrowserPaths::cacheLocation()
+{
+ return getLocation(QStandardPaths::CacheLocation);
+}
+
+bool BrowserPaths::createDirectory(const QString &dirStr)
+{
+ QDir dir(dirStr);
+ if (!dir.exists()) {
+ if (!dir.mkpath(dirStr)) {
+ return false;
+ }
+ uid_t uid = getuid();
+ // assumes that correct groupname is same as username (e.g. nemo:nemo)
+ int gid = getgrnam(getpwuid(uid)->pw_name)->gr_gid;
+ int success = chown(dirStr.toLatin1().data(), uid, gid);
+ Q_UNUSED(success);
+ QFile::Permissions permissions(QFile::ExeOwner | QFile::ExeGroup | QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::WriteGroup);
+ QFile::setPermissions(dirStr, permissions);
+ }
+ return true;
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/common/browserpaths.h
^
|
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Jolla Ltd.
+** Contact: Dmitry Rozhkov <dmitry.rozhkov@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef BROWSERPATHS_H
+#define BROWSERPATHS_H
+
+class QString;
+
+struct BrowserPaths
+{
+ static QString downloadLocation();
+ static QString picturesLocation();
+ static QString dataLocation();
+ static QString applicationsLocation();
+ static QString cacheLocation();
+
+ static bool createDirectory(const QString &dirStr);
+};
+
+#endif // BROWSERPATHS_H
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/common/opensearchconfigs.cpp
^
|
@@ -12,7 +12,6 @@
#include <QDir>
#include <QFile>
-#include <QStandardPaths>
#include <QXmlStreamReader>
#include "opensearchconfigs.h"
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/common/opensearchconfigs.pri
^
|
(renamed from common/common.pri)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/common/paths.pri
^
|
@@ -0,0 +1,9 @@
+INCLUDEPATH += $$PWD
+
+# C++ sources
+SOURCES += \
+ $$PWD/browserpaths.cpp \
+
+# C++ headers
+HEADERS += \
+ $$PWD/browserpaths.h \
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/data/prefs.js
^
|
@@ -0,0 +1 @@
+user_pref("general.useragent.updates.enabled", true);
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/data/preprocess-ua-update-json
^
|
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Remove lines starting with a comment.
+# Using Perl regexp so that this works on device.
+grep -vP ^\\s*// $PWD/ua-update.json.in > $PWD/ua-update.json
+git commit $PWD/ua-update.json -m "[user-agent] Update preprocessed user agent overrides"
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/data/ua-update.json
^
|
@@ -0,0 +1,40 @@
+{
+ "msn.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android 4.4.4",
+ "itau.com.br": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "r7.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "bing.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "magazineluiza.com.br": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "elpais.com.co": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android 4.4.4",
+ "loteriasyapuestas.es": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "bbva.es": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "movistar.com.ve": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "comunio.es": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "citibank.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "citi.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "games.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "ehow.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "blikk.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "koponyeg.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "kuruc.info": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "nemzetisport.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "port.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "portfolio.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "cdm.me": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "download.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "cnet.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "livescore.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "redstarbelgrade.info": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "linkedin.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+ "dailymotion.com": "Maemo; Linux;#Android 4.4.2;",
+ "le.com": "Maemo; Linux;#Android 4.4.2;",
+ "youku.com": "Maemo; Linux;#Android 4.4.2;",
+ "iqiyi.com": "Maemo; Linux; U; #Android;",
+ "facebook.com": "Maemo; Linux; U; Jolla; # ; ",
+ "fbcdn.net": "Maemo; Linux; U; Jolla; # ; ",
+ "engadget.com": "Maemo; Linux; U; Jolla; # ;",
+ "youtube.com": "Mozilla/5.0 (Maemo; Android 4.4.2; U; Jolla; Sailfish; ; rv:31.0) Gecko/31.0 Firefox/31.0 SailfishBrowser/1.0 like Safari/538.1",
+ "yandex.com": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0",
+ "yandex.net": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0",
+ "yandex.ru": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0",
+ "yastatic.net": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/data/ua-update.json.in
^
|
@@ -0,0 +1,66 @@
+// Everything after the first // on a line will be removed by the preproccesor.
+// Send these sites a custom user-agent. Bugs should be included with an entry.
+{
+ // bug 826347, msn.com
+ "msn.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android 4.4.4",
+ // bug 826353, itau.com.br
+ "itau.com.br": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 826510, r7.com
+ "r7.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 827622, bing.com
+ "bing.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 827626, magazineluiza.com.br
+ "magazineluiza.com.br": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 827670, elpais.com.co
+ "elpais.com.co": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android 4.4.4",
+ // bug 828416, loteriasyapuestas.es
+ "loteriasyapuestas.es": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 828418, bbva.es
+ "bbva.es": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 828439, movistar.com.ve
+ "movistar.com.ve": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 843132, comunio.es
+ "comunio.es": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 843151, citibank.com
+ "citibank.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "citi.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 843153, games.com
+ "games.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 843160, ehow.com
+ "ehow.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878228, blikk.hu
+ "blikk.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878238, koponyeg.hu
+ "koponyeg.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878240, kuruc.info
+ "kuruc.info": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878242, nemzetisport.hu
+ "nemzetisport.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878246, port.hu
+ "port.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878249, portfolio.hu
+ "portfolio.hu": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878260, cdm.me
+ "cdm.me": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878262, download.com
+ "download.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ "cnet.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878273, livescore.com
+ "livescore.com": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 878653, redstarbelgrade.info
+ "redstarbelgrade.info": "\\(Maemo; Linux; U; Jolla; Sailfish#(Android",
+ // bug 826348, linkedin.com
+ "linkedin.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+ "dailymotion.com": "Maemo; Linux;#Android 4.4.2;",
+ "le.com": "Maemo; Linux;#Android 4.4.2;",
+ "youku.com": "Maemo; Linux;#Android 4.4.2;",
+ "iqiyi.com": "Maemo; Linux; U; #Android;",
+ "facebook.com": "Maemo; Linux; U; Jolla; # ; ",
+ "fbcdn.net": "Maemo; Linux; U; Jolla; # ; ",
+ "engadget.com": "Maemo; Linux; U; Jolla; # ;",
+ "youtube.com": "Mozilla/5.0 (Maemo; Android 4.4.2; U; Jolla; Sailfish; ; rv:31.0) Gecko/31.0 Firefox/31.0 SailfishBrowser/1.0 like Safari/538.1",
+ "yandex.com": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0",
+ "yandex.net": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0",
+ "yandex.ru": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0",
+ "yastatic.net": "Mozilla/5.0 (Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
+}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/oneshot.d/browser-cleanup-startup-cache
^
|
(renamed from cleanup-browser-startup-cache)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/oneshot.d/browser-update-default-data
^
|
@@ -0,0 +1,25 @@
+#!/bin/sh
+MOZEMBED_DIR=/home/$USER/.mozilla/mozembed
+BROWSER_DATA_DIR=/usr/share/sailfish-browser/data
+
+if [ ! -d "$MOZEMBED_DIR" ]; then
+ mkdir -p $MOZEMBED_DIR
+fi
+
+if [ ! -f "$MOZEMBED_DIR/ua-update.json" -o ! -s "$MOZEMBED_DIR/ua-update.json" ]; then
+ # Remove lines starting with a comment.
+ # Using Perl regexp so that this works on device.
+ grep -vP ^\\s*// $BROWSER_DATA_DIR/ua-update.json.in > "$MOZEMBED_DIR/ua-update.json"
+fi
+
+if [ ! -f "$MOZEMBED_DIR/prefs.js" ]; then
+ cp $BROWSER_DATA_DIR/prefs.js $MOZEMBED_DIR
+else
+ while IFS='' read -r line || [[ -n "$line" ]]; do
+ prefKey=$(echo "$line" | cut -d "," -f1)
+ foundKey=$(grep "$prefKey" $MOZEMBED_DIR/prefs.js | wc -l)
+ if [ $foundKey -eq 0 ]; then
+ echo "$line" >> $MOZEMBED_DIR/prefs.js
+ fi
+ done < "$BROWSER_DATA_DIR/prefs.js"
+fi
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/open-url.desktop
^
|
@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Name=Browser
-NotShowIn=X-MeeGo;
+NoDisplay=true
X-MeeGo-Logical-Id=sailfish-browser-ap-name
X-MeeGo-Translation-Catalog=sailfish-browser
MimeType=text/html;x-maemo-urischeme/http;x-maemo-urischeme/https;
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/org.sailfishos.browser.service
^
|
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.sailfishos.browser
-Exec=/usr/bin/invoker -s --type=browser -G /usr/bin/sailfish-browser
+Exec=/usr/bin/invoker -s --type=browser -G /usr/bin/sailfish-browser -prestart
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/org.sailfishos.browser.ui.service
^
|
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.sailfishos.browser.ui
-Exec=/usr/bin/invoker -s --type=browser --desktop-file=sailfish-browser.desktop -G /usr/bin/sailfish-browser
+Exec=/usr/bin/invoker -s --type=browser --desktop-file=sailfish-browser.desktop -G /usr/bin/sailfish-browser -prestart
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/sailfish-browser.pro
^
|
@@ -12,10 +12,15 @@
chrome_scripts.files = chrome/*.js
chrome_scripts.path = /usr/lib/mozembedlite/chrome/embedlite/content
-oneshots.files = cleanup-browser-startup-cache
+oneshots.files = oneshot.d/browser-cleanup-startup-cache \
+ oneshot.d/browser-update-default-data
oneshots.path = /usr/lib/oneshot.d
-INSTALLS += desktop dbus_service chrome_scripts oneshots
+data.files = data/prefs.js \
+ data/ua-update.json.in
+data.path = /usr/share/sailfish-browser/data
+
+INSTALLS += desktop dbus_service chrome_scripts oneshots data
OTHER_FILES += \
rpm/*.spec
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/settings/browser.qml
^
|
@@ -103,10 +103,27 @@
text: qsTrId("settings_browser-bt-privacy")
onClicked: pageStack.push(Qt.resolvedUrl("Privacy.qml"))
}
+
+ TextSwitch {
+ //: Label for text switch that makes all tabs closed upon closing browser application
+ //% "Close all tabs on exit"
+ text: qsTrId("settings_browser-la-close_all_tabs")
+ //% "Upon exiting Sailfish Browser all open tabs will be closed"
+ description: qsTrId("settings_browser-la-close_all_tabs_description")
+ checked: closeAllTabsConfig.value
+
+ onCheckedChanged: closeAllTabsConfig.value = checked
+ }
}
}
ConfigurationValue {
+ id: closeAllTabsConfig
+ key: "/apps/sailfish-browser/settings/close_all_tabs"
+ defaultValue: false
+ }
+
+ ConfigurationValue {
id: searchEngineConfig
key: "/apps/sailfish-browser/settings/search_engine"
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/settings/settings.pro
^
|
@@ -12,7 +12,7 @@
import.path = $$TARGETPATH
target.path = $$TARGETPATH
-include(../common/common.pri)
+include(../common/opensearchconfigs.pri)
SOURCES += \
declarative_plugin.cpp \
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/bookmarks/bookmarkmanager.cpp
^
|
@@ -11,8 +11,6 @@
#include "bookmarkmanager.h"
#include <QDebug>
-#include <QStandardPaths>
-#include <QDir>
#include <QFile>
#include <QTextStream>
#include <QJsonObject>
@@ -22,6 +20,7 @@
#include <MGConfItem>
#include "bookmark.h"
+#include "browserpaths.h"
BookmarkManager::BookmarkManager()
: QObject(nullptr)
@@ -46,13 +45,9 @@
void BookmarkManager::save(const QList<Bookmark*> & bookmarks)
{
- QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
- QDir dir(dataLocation);
- if (!dir.exists()) {
- if (!dir.mkpath(dataLocation)) {
- qWarning() << "Can't create directory " << dataLocation;
- return;
- }
+ QString dataLocation = BrowserPaths::dataLocation();
+ if (dataLocation.isNull()) {
+ return;
}
QString path = dataLocation + "/bookmarks.json";
QFile file(path);
@@ -85,7 +80,7 @@
QList<Bookmark*> BookmarkManager::load() {
QList<Bookmark*> bookmarks;
- QString bookmarkFile = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/bookmarks.json";
+ QString bookmarkFile = BrowserPaths::dataLocation() + "/bookmarks.json";
QScopedPointer<QFile> file(new QFile(bookmarkFile));
if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/bookmarks/desktopbookmarkwriter.cpp
^
|
@@ -9,12 +9,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "desktopbookmarkwriter.h"
-
#include <QDir>
-#include <QStandardPaths>
#include <QtConcurrent>
+#include "desktopbookmarkwriter.h"
+#include "browserpaths.h"
+
static bool dbw_testMode = false;
DesktopBookmarkWriter::DesktopBookmarkWriter(QObject *parent)
@@ -64,9 +64,9 @@
{
QString filePath;
if (!isTestModeEnabled()) {
- filePath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
+ filePath = BrowserPaths::applicationsLocation();
} else {
- filePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+ filePath = BrowserPaths::dataLocation();
}
title = title.simplified().replace(QString(" "), QString("-"));
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/browser.cpp
^
|
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "browser.h"
+#include "browser_p.h"
+#include "closeeventfilter.h"
+#include "declarativewebutils.h"
+#include "downloadmanager.h"
+#include "settingmanager.h"
+
+#include <QDir>
+#include <QGuiApplication>
+#include <QQmlContext>
+#include <QQuickView>
+#include <QTimer>
+#include <QUrl>
+#include <qmozcontext.h>
+
+BrowserPrivate::BrowserPrivate(QQuickView *view)
+ : view(view)
+ , closeEventFilter(0)
+{
+}
+
+Browser::Browser(QQuickView *view, QObject *parent)
+ : QObject(parent)
+ , d_ptr(new BrowserPrivate(view))
+{
+ Q_D(Browser);
+
+ Q_ASSERT(view);
+ Q_ASSERT(qGuiApp);
+
+ setenv("USE_ASYNC", "1", 1);
+ setenv("USE_NEMO_GSTREAMER", "1", 1);
+ setenv("NO_LIMIT_ONE_GST_DECODER", "1", 1);
+
+ // See https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Clients/ApplicationProperties/
+ setenv("PULSE_PROP_application.process.binary", "sailfish-browser", 1);
+
+ // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=929879
+ setenv("LC_NUMERIC", "C", 1);
+ setlocale(LC_NUMERIC, "C");
+
+ // GRE_HOME must be set before QMozContext is initialized.
+ // With invoker PWD is empty.
+ QByteArray binaryPath = QCoreApplication::applicationDirPath().toLocal8Bit();
+ setenv("GRE_HOME", binaryPath.constData(), 1);
+
+ // Don't set custom user agent string when the environment already contains CUSTOM_UA.
+ if (qgetenv("CUSTOM_UA").isEmpty()) {
+ setenv("CUSTOM_UA", "Mozilla/5.0 (Maemo; Linux; U; Jolla; Sailfish; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0 SailfishBrowser/1.0", 1);
+ }
+
+ QString componentPath(DEFAULT_COMPONENTS_PATH);
+ QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components/EmbedLiteBinComponents.manifest"));
+ QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components/EmbedLiteJSComponents.manifest"));
+ QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome/EmbedLiteJSScripts.manifest"));
+ QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome/EmbedLiteOverrides.manifest"));
+
+ DeclarativeWebUtils *utils = DeclarativeWebUtils::instance();
+ DownloadManager *downloadManager = DownloadManager::instance();
+
+ utils->clearStartupCacheIfNeeded();
+
+ d->view->rootContext()->setContextProperty("WebUtils", utils);
+ d->view->rootContext()->setContextProperty("MozContext", QMozContext::GetInstance());
+ d->view->rootContext()->setContextProperty("Settings", SettingManager::instance());
+ d->view->rootContext()->setContextProperty("DownloadManager", downloadManager);
+
+ d->closeEventFilter = new CloseEventFilter(downloadManager, this);
+ d->view->installEventFilter(d->closeEventFilter);
+
+#ifdef USE_RESOURCES
+ d->view->setSource(QUrl("qrc:///browser.qml"));
+#else
+ d->view->setSource(QUrl::fromLocalFile(Browser::applicationFilePath() + "browser.qml"));
+#endif
+
+ // Setup embedding
+ QTimer::singleShot(0, QMozContext::GetInstance(), SLOT(runEmbedding()));
+}
+
+void Browser::load()
+{
+ Q_ASSERT_X(qGuiApp, Q_FUNC_INFO, "There should always be a QGuiApplication running.");
+ const QStringList arguments = qGuiApp->arguments();
+ if (!arguments.contains(QStringLiteral("-prestart"))) {
+ if (arguments.count() > 1 && (arguments.last() != QStringLiteral("-debugMode"))) {
+ emit DeclarativeWebUtils::instance()->openUrlRequested(arguments.last());
+ } else if (!DeclarativeWebUtils::instance()->firstUseDone()) {
+ emit DeclarativeWebUtils::instance()->openUrlRequested("");
+ }
+ }
+}
+
+QString Browser::applicationFilePath()
+{
+ Q_ASSERT_X(qGuiApp, Q_FUNC_INFO, "There should always be a QGuiApplication running.");
+ if (qGuiApp->arguments().contains("-desktop")) {
+ return qGuiApp->applicationDirPath() + QDir::separator();
+ } else {
+ return QString(DEPLOYMENT_PATH);
+ }
+}
+
+void Browser::openUrl(const QString &url)
+{
+ Q_D(Browser);
+ d->closeEventFilter->cancelStopApplication();
+ emit DeclarativeWebUtils::instance()->openUrlRequested(url);
+}
+
+void Browser::openNewTabView()
+{
+ Q_D(Browser);
+ d->closeEventFilter->cancelStopApplication();
+ emit DeclarativeWebUtils::instance()->activateNewTabViewRequested();
+}
+
+void Browser::cancelDownload(int transferId)
+{
+ DownloadManager::instance()->cancelTransfer(transferId);
+}
+
+void Browser::restartDownload(int transferid)
+{
+ DownloadManager::instance()->restartTransfer(transferid);
+}
+
+void Browser::dumpMemoryInfo(const QString &fileName)
+{
+ DeclarativeWebUtils::instance()->handleDumpMemoryInfoRequest(fileName);
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/browser.h
^
|
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef BROWSER_H
+#define BROWSER_H
+
+#include <QObject>
+
+class QQuickView;
+class BrowserPrivate;
+
+class Browser : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit Browser(QQuickView *view, QObject *parent = 0);
+
+ void load();
+
+ static QString applicationFilePath();
+
+public slots:
+ void openUrl(const QString &url);
+ void openNewTabView();
+
+ void cancelDownload(int transferId);
+ void restartDownload(int transferid);
+
+ // Debug helpers
+ void dumpMemoryInfo(const QString &fileName);
+
+private:
+ BrowserPrivate *d_ptr;
+ Q_DISABLE_COPY(Browser)
+ Q_DECLARE_PRIVATE(Browser)
+};
+
+#endif // BROWSER_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/browser.pri
^
|
@@ -0,0 +1,19 @@
+INCLUDEPATH += $$PWD
+
+# C++ sources
+SOURCES += \
+ $$PWD/browser.cpp \
+ $$PWD/closeeventfilter.cpp \
+ $$PWD/downloadmanager.cpp \
+ $$PWD/downloadmimetypehandler.cpp \
+ $$PWD/declarativewebutils.cpp
+
+# C++ headers
+HEADERS += \
+ $$PWD/browser.h \
+ $$PWD/browser_p.h \
+ $$PWD/closeeventfilter.h \
+ $$PWD/downloadmanager.h \
+ $$PWD/downloadmimetypehandler.h \
+ $$PWD/downloadstatus.h \
+ $$PWD/declarativewebutils.h
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/browser_p.h
^
|
@@ -0,0 +1,26 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef BROWSER_PRIVATE_H
+#define BROWSER_PRIVATE_H
+
+class CloseEventFilter;
+class QQuickView;
+
+class BrowserPrivate {
+public:
+ BrowserPrivate(QQuickView *view);
+
+ QQuickView *view;
+ CloseEventFilter *closeEventFilter;
+};
+
+#endif // BROWSER_PRIVATE_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/closeeventfilter.cpp
^
|
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <QCoreApplication>
+#include "closeeventfilter.h"
+#include "qmozcontext.h"
+#include "declarativewebutils.h"
+#include "dbmanager.h"
+
+CloseEventFilter::CloseEventFilter(DownloadManager *dlMgr, QObject *parent)
+ : QObject(parent),
+ m_downloadManager(dlMgr)
+{
+ connect(QMozContext::GetInstance(), &QMozContext::lastWindowDestroyed,
+ this, &CloseEventFilter::onLastWindowDestroyed);
+ connect(QMozContext::GetInstance(), &QMozContext::destroyed,
+ this, &CloseEventFilter::onContextDestroyed);
+ connect(&m_shutdownWatchdog, &QTimer::timeout,
+ this, &CloseEventFilter::onWatchdogTimeout);
+}
+
+void CloseEventFilter::stopApplication()
+{
+ MGConfItem closeAllTabsConf("/apps/sailfish-browser/settings/close_all_tabs");
+ if (closeAllTabsConf.value(false).toBool()) {
+ DBManager::instance()->removeAllTabs();
+ }
+
+ QMozContext::GetInstance()->stopEmbedding();
+ // Give the engine 5 seconds to shut down. If it fails terminate
+ // with a fatal error.
+ m_shutdownWatchdog.start(5000);
+}
+
+void CloseEventFilter::onLastWindowDestroyed()
+{
+ if (m_downloadManager->existActiveTransfers()) {
+ connect(m_downloadManager, SIGNAL(allTransfersCompleted()),
+ this, SLOT(stopApplication()));
+ } else {
+ stopApplication();
+ }
+}
+
+void CloseEventFilter::onContextDestroyed()
+{
+ qApp->exit();
+}
+
+void CloseEventFilter::onWatchdogTimeout()
+{
+ qFatal("Browser failed to terminate in acceptable time!");
+}
+
+void CloseEventFilter::cancelStopApplication()
+{
+ disconnect(m_downloadManager, SIGNAL(allTransfersCompleted()),
+ this, SLOT(stopApplication()));
+ m_shutdownWatchdog.stop();
+}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/closeeventfilter.h
^
|
(renamed from src/closeeventfilter.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/declarativewebutils.cpp
^
|
@@ -0,0 +1,478 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Vesa-Matti Hartikainen <vesa-matti.hartikainen@jollamobile.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// QtCore
+#include <QtCore/QDateTime>
+#include <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore/QLocale>
+#include <QtCore/QSettings>
+#include <QtCore/QStandardPaths>
+#include <QtCore/QStringList>
+#include <QtCore/QtMath>
+#include <QtCore/QVariant>
+#include <QtCore/QVariantMap>
+
+// QtGui
+#include <QtGui/QClipboard>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QScreen>
+
+#include <math.h>
+#include "declarativewebutils.h"
+#include "qmozcontext.h"
+#include "opensearchconfigs.h"
+#include "browserpaths.h"
+
+static const QString gSystemComponentsTimeStamp("/var/lib/_MOZEMBED_CACHE_CLEAN_");
+static const QString gProfilePath("/.mozilla/mozembed");
+
+static DeclarativeWebUtils *gSingleton = 0;
+static const qreal gCssPixelRatioRoundingFactor = 0.5;
+static const qreal gCssDefaultPixelRatio = 1.5;
+
+static bool testScreenDimensions(qreal pixelRatio) {
+ QScreen *screen = QGuiApplication::primaryScreen();
+ qreal w = screen->size().width() / pixelRatio;
+ qreal h = screen->size().height() / pixelRatio;
+
+ return fmod(w, 1.0) == 0 && fmod(h, 1.0) == 0;
+}
+
+const QSettings &quickSettings()
+{
+ static const QSettings settings(QSettings::SystemScope, QStringLiteral("QtProject"), QStringLiteral("QtQuick2"));
+ return settings;
+}
+
+int getPressAndHoldDelay()
+{
+ return quickSettings().value(QStringLiteral("QuickMouseArea/PressAndHoldDelay"), 800).toInt();
+}
+
+const int PressAndHoldDelay(getPressAndHoldDelay());
+
+static bool fileExists(QString fileName)
+{
+ QFile file(fileName);
+ return file.exists();
+}
+
+DeclarativeWebUtils::DeclarativeWebUtils()
+ : QObject()
+ , m_homePage("/apps/sailfish-browser/settings/home_page", this)
+ , m_silicaPixelRatio(1.0)
+ , m_touchSideRadius(32.0)
+ , m_touchTopRadius(48.0)
+ , m_touchBottomRadius(16.0)
+ , m_inputItemSize(28.0)
+ , m_zoomMargin(14.0)
+{
+ connect(QMozContext::GetInstance(), SIGNAL(onInitialized()),
+ this, SLOT(updateWebEngineSettings()));
+ connect(QMozContext::GetInstance(), SIGNAL(recvObserve(QString, QVariant)),
+ this, SLOT(handleObserve(QString, QVariant)));
+
+ QString path = BrowserPaths::dataLocation() + QStringLiteral("/.firstUseDone");
+ m_firstUseDone = fileExists(path);
+
+ connect(&m_homePage, SIGNAL(valueChanged()), this, SIGNAL(homePageChanged()));
+}
+
+DeclarativeWebUtils::~DeclarativeWebUtils()
+{
+ gSingleton = 0;
+}
+
+int DeclarativeWebUtils::getLightness(QColor color) const
+{
+ return color.lightness();
+}
+
+QString DeclarativeWebUtils::createUniqueFileUrl(const QString &fileName, const QString &path) const
+{
+ if (path.isEmpty() || fileName.isEmpty()) {
+ return QString();
+ }
+
+ const QFileInfo fileInfo(fileName);
+ const QString newFile("%1/%2(%3)%4%5");
+ const QString baseName = fileInfo.baseName();
+ const QString suffix = fileInfo.completeSuffix();
+
+ QString result(path + "/" + fileName);
+ int collisionCount(1);
+
+ while (QFileInfo::exists(result)) {
+ collisionCount++;
+ result = newFile.arg(path).arg(baseName).arg(collisionCount).arg(suffix.isEmpty() ? "" : ".").arg(suffix);
+ }
+
+ return result;
+}
+
+void DeclarativeWebUtils::clearStartupCacheIfNeeded()
+{
+ QFileInfo systemStamp(gSystemComponentsTimeStamp);
+ if (systemStamp.exists()) {
+ QString mostProfilePath = QDir::homePath() + gProfilePath;
+ QString localStampString(mostProfilePath + QString("/_CACHE_CLEAN_"));
+ QFileInfo localStamp(localStampString);
+ if (localStamp.exists() && systemStamp.lastModified() > localStamp.lastModified()) {
+ QDir cacheDir(mostProfilePath + "/startupCache");
+ cacheDir.removeRecursively();
+ QFile(localStampString).remove();
+ }
+ }
+}
+
+void DeclarativeWebUtils::handleDumpMemoryInfoRequest(QString fileName)
+{
+ if (qApp->arguments().contains("-debugMode")) {
+ emit dumpMemoryInfo(fileName);
+ }
+}
+
+void DeclarativeWebUtils::updateWebEngineSettings()
+{
+ // Infer and set Accept-Language header from the current system locale
+ QString langs;
+ QStringList locale = QLocale::system().name().split("_", QString::SkipEmptyParts);
+ if (locale.size() > 1) {
+ langs = QString("%1-%2,%3").arg(locale.at(0)).arg(locale.at(1)).arg(locale.at(0));
+ } else {
+ langs = locale.at(0);
+ }
+
+ QMozContext* mozContext = QMozContext::GetInstance();
+ mozContext->setPref(QString("intl.accept_languages"), QVariant(langs));
+
+ // these are magic numbers defining touch radius required to detect <image src=""> touch
+ mozContext->setPref(QStringLiteral("browser.ui.touch.left"), QVariant(m_touchSideRadius));
+ mozContext->setPref(QStringLiteral("browser.ui.touch.right"), QVariant(m_touchSideRadius));
+ mozContext->setPref(QStringLiteral("browser.ui.touch.top"), QVariant(m_touchTopRadius));
+ mozContext->setPref(QStringLiteral("browser.ui.touch.bottom"), QVariant(m_touchBottomRadius));
+
+ // Install embedlite handlers for guestures
+ mozContext->setPref(QString("embedlite.azpc.handle.singletap"), QVariant(false));
+ mozContext->setPref(QString("embedlite.azpc.json.singletap"), QVariant(true));
+ mozContext->setPref(QString("embedlite.azpc.handle.longtap"), QVariant(false));
+ mozContext->setPref(QString("embedlite.azpc.json.longtap"), QVariant(true));
+ mozContext->setPref(QString("embedlite.azpc.json.viewport"), QVariant(true));
+
+ // Without this pref placeholders get cleaned as soon as a character gets committed
+ // by VKB and that happens only when Enter is pressed or comma/space/dot is entered.
+ mozContext->setPref(QString("dom.placeholder.show_on_focus"), QVariant(false));
+
+ mozContext->setPref(QString("security.alternate_certificate_error_page"), QString("certerror"));
+
+ mozContext->setPref(QString("geo.wifi.scan"), QVariant(false));
+ mozContext->setPref(QString("browser.enable_automatic_image_resizing"), QVariant(true));
+
+ // Make long press timeout equal to the one in Qt
+ mozContext->setPref(QString("ui.click_hold_context_menus.delay"), QVariant(PressAndHoldDelay));
+ mozContext->setPref(QString("apz.fling_stopped_threshold"), QString("0.13f"));
+
+ // TODO: remove this line when the value adjusted for different DPIs makes
+ // its way to Gecko's default prefs.
+ mozContext->setPref(QString("apz.touch_start_tolerance"), QString("0.027777f"));
+
+ mozContext->setPref(QString("media.resource_handler_disabled"), QVariant(true));
+
+ // subscribe to gecko messages
+ mozContext->addObservers(QStringList()
+ << "clipboard:setdata"
+ << "media-decoder-info"
+ << "embed:download"
+ << "embed:allprefs"
+ << "embed:search");
+
+ // Enable internet search
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/declarativewebutils.h
^
|
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Vesa-Matti Hartikainen <vesa-matti.hartikainen@jollamobile.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DECLARATIVEWEBUTILS_H
+#define DECLARATIVEWEBUTILS_H
+
+#include <QObject>
+#include <QUrl>
+#include <QColor>
+#include <QVariant>
+#include "browserservice.h"
+#include <QProcess>
+#include <MGConfItem>
+
+class DeclarativeWebUtils : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
+ Q_PROPERTY(bool firstUseDone READ firstUseDone WRITE setFirstUseDone NOTIFY firstUseDoneChanged)
+ Q_PROPERTY(qreal cssPixelRatio READ cssPixelRatio NOTIFY cssPixelRatioChanged)
+ Q_PROPERTY(qreal silicaPixelRatio READ silicaPixelRatio WRITE setSilicaPixelRatio NOTIFY silicaPixelRatioChanged)
+ Q_PROPERTY(qreal touchSideRadius READ touchSideRadius WRITE setTouchSideRadius NOTIFY touchSideRadiusChanged)
+ Q_PROPERTY(qreal touchTopRadius READ touchTopRadius WRITE setTouchTopRadius NOTIFY touchTopRadiusChanged)
+ Q_PROPERTY(qreal touchBottomRadius READ touchBottomRadius WRITE setTouchBottomRadius NOTIFY touchBottomRadiusChanged)
+ Q_PROPERTY(qreal inputItemSize READ inputItemSize WRITE setInputItemSize NOTIFY inputItemSizeChanged)
+ Q_PROPERTY(qreal zoomMargin READ zoomMargin WRITE setZoomMargin NOTIFY zoomMarginChanged)
+
+public:
+ static DeclarativeWebUtils *instance();
+
+ bool firstUseDone() const;
+ void setFirstUseDone(bool firstUseDone);
+ qreal cssPixelRatio() const;
+ qreal silicaPixelRatio() const;
+ void setSilicaPixelRatio(qreal silicaPixelRatio);
+ qreal touchSideRadius() const;
+ void setTouchSideRadius(qreal touchSideRadius);
+ qreal touchTopRadius() const;
+ void setTouchTopRadius(qreal touchTopRadius);
+ qreal touchBottomRadius() const;
+ void setTouchBottomRadius(qreal touchBottomRadius);
+ qreal inputItemSize() const;
+ void setInputItemSize(qreal inputItemSize);
+ qreal zoomMargin() const;
+ void setZoomMargin(qreal zoomMargin);
+
+ Q_INVOKABLE int getLightness(QColor color) const;
+ Q_INVOKABLE QString createUniqueFileUrl(const QString &fileName, const QString &path) const;
+ Q_INVOKABLE QString displayableUrl(QString fullUrl) const;
+
+public slots:
+ QString homePage() const;
+ void clearStartupCacheIfNeeded();
+ void handleDumpMemoryInfoRequest(QString fileName);
+
+signals:
+ void homePageChanged();
+ void openUrlRequested(QString url);
+ void activateNewTabViewRequested();
+ void firstUseDoneChanged();
+ void dumpMemoryInfo(QString fileName);
+ void cssPixelRatioChanged();
+ void silicaPixelRatioChanged();
+ void touchSideRadiusChanged();
+ void touchTopRadiusChanged();
+ void touchBottomRadiusChanged();
+ void inputItemSizeChanged();
+ void zoomMarginChanged();
+
+private slots:
+ void updateWebEngineSettings();
+ void handleObserve(const QString message, const QVariant data);
+
+private:
+ explicit DeclarativeWebUtils();
+ ~DeclarativeWebUtils();
+ void setContentScaling();
+ void setRenderingPreferences();
+
+ MGConfItem m_homePage;
+ bool m_firstUseDone;
+ qreal m_silicaPixelRatio;
+ qreal m_touchSideRadius;
+ qreal m_touchTopRadius;
+ qreal m_touchBottomRadius;
+ qreal m_inputItemSize;
+ qreal m_zoomMargin;
+};
+#endif // DECLARATIVEWEBUTILS_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/downloadmanager.cpp
^
|
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "downloadmanager.h"
+#include "downloadmimetypehandler.h"
+#include "qmozcontext.h"
+#include "browserpaths.h"
+
+#include <transferengineinterface.h>
+#include <transfertypes.h>
+#include <QDir>
+#include <QFile>
+#include <QDebug>
+
+#if defined(arm) \
+ || defined(__arm__) \
+ || defined(ARM) \
+ || defined(_ARM_)
+#define CPU_ARM 1
+#endif
+
+static DownloadManager *gSingleton = 0;
+
+DownloadManager::DownloadManager()
+ : QObject()
+{
+ m_transferClient = new TransferEngineInterface("org.nemo.transferengine",
+ "/org/nemo/transferengine",
+ QDBusConnection::sessionBus(),
+ this);
+ connect(QMozContext::GetInstance(), SIGNAL(onInitialized()),
+ this, SLOT(setPreferences()));
+ connect(QMozContext::GetInstance(), SIGNAL(recvObserve(const QString, const QVariant)),
+ this, SLOT(recvObserve(const QString, const QVariant)));
+
+ // Ignore the download info argument of the downloadStatusChanged signal.
+ connect(this, &DownloadManager::downloadStatusChanged, [=](int downloadId, int status) {
+ m_statusCache.insert(downloadId, static_cast<DownloadStatus::Status>(status));
+ });
+}
+
+DownloadManager::~DownloadManager()
+{
+ gSingleton = 0;
+}
+
+void DownloadManager::recvObserve(const QString message, const QVariant data)
+{
+
+ if (message != "embed:download") {
+ // here we are interested in download messages only
+ return;
+ }
+
+ QVariantMap dataMap(data.toMap());
+ QString msg = dataMap.value(QStringLiteral("msg")).toString();
+ QString targetPath = dataMap.value(QStringLiteral("targetPath")).toString();
+ qulonglong downloadId(dataMap.value(QStringLiteral("id")).toULongLong());
+ bool needPlatformTransfersUpdate = this->needPlatformTransfersUpdate(targetPath);
+
+ if (msg == QLatin1Literal("dl-start")
+ && needPlatformTransfersUpdate
+ && m_download2transferMap.contains(downloadId)) { // restart existing transfer
+ m_transferClient->startTransfer(m_download2transferMap.value(downloadId));
+ emit downloadStatusChanged(downloadId, DownloadStatus::Started, data);
+ } else if (msg == QLatin1Literal("dl-start")) { // create new transfer
+ emit downloadStarted();
+ if (needPlatformTransfersUpdate) {
+ QStringList callback;
+ QLatin1Literal browserInterface("org.sailfishos.browser");
+ callback << browserInterface << QLatin1Literal("/") << browserInterface;
+ QDBusPendingReply<int> reply = m_transferClient->createDownload(dataMap.value("displayName").toString(),
+ QString("image://theme/icon-launcher-browser"),
+ QString("image://theme/icon-launcher-browser"),
+ targetPath,
+ dataMap.value("mimeType").toString(),
+ dataMap.value("size").toULongLong(),
+ callback,
+ QString("cancelTransfer"),
+ QString("restartTransfer"));
+ reply.waitForFinished();
+
+ if (reply.isError()) {
+ qWarning() << "DownloadManager::recvObserve: failed to get transfer ID!" << reply.error();
+ return;
+ }
+
+ int transferId(reply.value());
+
+ m_download2transferMap.insert(downloadId, transferId);
+ m_transfer2downloadMap.insert(transferId, downloadId);
+ m_transferClient->startTransfer(transferId);
+ emit downloadStatusChanged(downloadId, DownloadStatus::Started, data);
+ }
+ } else if (msg == QLatin1Literal("dl-progress") && needPlatformTransfersUpdate) {
+ qreal progress(dataMap.value(QStringLiteral("percent")).toULongLong() / 100.0);
+ m_transferClient->updateTransferProgress(m_download2transferMap.value(downloadId), progress);
+ } else if (msg == QLatin1Literal("dl-done")) {
+ if (needPlatformTransfersUpdate) {
+ m_transferClient->finishTransfer(m_download2transferMap.value(downloadId),
+ TransferEngineData::TransferFinished,
+ QString("success"));
+ emit downloadStatusChanged(downloadId, DownloadStatus::Done, data);
+ } else if (isMyApp(targetPath)) {
+ finishMyAppDownload(targetPath);
+ }
+ checkAllTransfers();
+ } else if (msg == QLatin1Literal("dl-fail")) {
+ if (needPlatformTransfersUpdate) {
+ m_transferClient->finishTransfer(m_download2transferMap.value(downloadId),
+ TransferEngineData::TransferInterrupted,
+ QString("browser failure"));
+ emit downloadStatusChanged(downloadId, DownloadStatus::Failed, data);
+ }
+ checkAllTransfers();
+ } else if (msg == QLatin1Literal("dl-cancel")) {
+ if (needPlatformTransfersUpdate) {
+ m_transferClient->finishTransfer(m_download2transferMap.value(downloadId),
+ TransferEngineData::TransferCanceled,
+ QString("download canceled"));
+ emit downloadStatusChanged(downloadId, DownloadStatus::Canceled, data);
+ }
+ checkAllTransfers();
+ }
+}
+
+bool DownloadManager::moveMyAppPackage(const QString &path) const
+{
+ QString aptoideDownloadPath = QString("%1/.aptoide/").arg(BrowserPaths::downloadLocation());
+ if (!BrowserPaths::createDirectory(aptoideDownloadPath)) {
+ qWarning() << "Failed to create path for myapp download, aborting";
+ return false;
+ }
+
+ QFile file(path);
+ QFileInfo fileInfo(file);
+ QString newPath(aptoideDownloadPath + fileInfo.fileName());
+ QFile obsoleteFile(newPath);
+ if (obsoleteFile.exists() && !obsoleteFile.remove()) {
+ qWarning() << "Failed to remove obsolete myapp file, aborting";
+ return false;
+ }
+
+ if (!file.rename(newPath)) {
+ qWarning() << "Failed to move myapp file to aptoide's folder, aborting";
+ // Avoid generating ~/Downloads/<name>(2).myapp file in case user downloads the same file again
+ file.remove();
+ return false;
+ }
+
+ return true;
+}
+
+bool DownloadManager::isMyApp(const QString &targetPath) const
+{
+ return QFileInfo(targetPath).completeSuffix() == QLatin1Literal("myapp");
+}
+
+bool DownloadManager::needPlatformTransfersUpdate(const QString &targetPath) const
+{
+ return !isMyApp(targetPath);
+}
+
+void DownloadManager::finishMyAppDownload(const QString &targetPath) const
+{
+ Q_ASSERT(isMyApp(targetPath));
+
+ QString rootNameSpace("com.aptoide.partners%1");
+ QString aptoideSupport = rootNameSpace.arg(QLatin1Literal(".AptoideJollaSupport"));
+#if CPU_ARM
+ QString packageName = rootNameSpace.arg(QString());
+#else
+ QString packageName = rootNameSpace.arg(QLatin1Literal(".jolla_tablet_store"));
+#endif
+ QString apkName = QString("%1.apk").arg(packageName);
+ // TODO: Add proper checking that Aptoide is installed (JB#33047)
+ if (moveMyAppPackage(targetPath)) {
+ QProcess::execute(QStringLiteral("/usr/bin/apkd-launcher"), QStringList() << apkName << QString("%1/%2").arg(packageName).arg(aptoideSupport));
+ }
+}
+
+void DownloadManager::cancelActiveTransfers()
+{
+ foreach (qulonglong downloadId, m_statusCache.keys()) {
+ if (m_statusCache.value(downloadId) == DownloadStatus::Started) {
+ cancelTransfer(m_download2transferMap.value(downloadId));
+ }
+ }
+}
+
+void DownloadManager::cancel(int downloadId)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/downloadmanager.h
^
|
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd.
+** Contact: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DOWNLOADMANAGER_H
+#define DOWNLOADMANAGER_H
+
+#include "downloadstatus.h"
+
+#include <QObject>
+#include <QHash>
+#include <QString>
+#include <QVariant>
+
+class TransferEngineInterface;
+
+class DownloadManager : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(DownloadStatus::Status)
+public:
+ static DownloadManager *instance();
+
+ bool existActiveTransfers();
+
+signals:
+ void downloadStarted();
+ void downloadStatusChanged(int downloadId, int status, QVariant info);
+ void allTransfersCompleted();
+
+public slots:
+ void cancelActiveTransfers();
+ void cancel(int downloadId);
+
+private slots:
+ void recvObserve(const QString message, const QVariant data);
+ void setPreferences();
+
+private:
+ explicit DownloadManager();
+ ~DownloadManager();
+
+ void checkAllTransfers();
+ bool moveMyAppPackage(const QString &path) const;
+
+ bool isMyApp(const QString &targetPath) const;
+ bool needPlatformTransfersUpdate(const QString &targetPath) const;
+ void finishMyAppDownload(const QString &targetPath) const;
+
+ void cancelTransfer(int transferId);
+ void restartTransfer(int transferId);
+
+ // TODO: unlike Gecko downloads and Sailfish transfers these mappings
+ // are not persistent -> after user has browser closed transfers can't be
+ // restarted.
+ QHash<qulonglong, int> m_download2transferMap;
+ QHash<int, qulonglong> m_transfer2downloadMap;
+ QHash<qulonglong, DownloadStatus::Status> m_statusCache;
+
+ TransferEngineInterface *m_transferClient;
+
+ friend class Browser;
+};
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/downloadmimetypehandler.cpp
^
|
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "downloadmimetypehandler.h"
+
+#include <QDebug>
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+#include <QTextStream>
+
+#define APTOIDE_MYAPP "application/vnd.cm.aptoide.pt myapp"
+
+void DownloadMimetypeHandler::update()
+{
+ QString mimeTypes = QString("%1/.mime.types").arg(QDir::homePath());
+ if (!QFileInfo(mimeTypes).exists()) {
+ appendDefaults(mimeTypes);
+ } else if (hasDefaults(mimeTypes) == 0) {
+ appendDefaults(mimeTypes);
+ }
+}
+
+void DownloadMimetypeHandler::appendDefaults(const QString &targetFile)
+{
+ QFile file(targetFile);
+ if (!file.open(QIODevice::Append | QIODevice::Text)) {
+ qWarning() << "Can't create file " << targetFile;
+ return;
+ }
+
+ QTextStream out(&file);
+ out << APTOIDE_MYAPP;
+ endl(out);
+ file.close();
+}
+
+int DownloadMimetypeHandler::hasDefaults(const QString &targetFile)
+{
+ QFile file(targetFile);
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ return -1;
+ }
+
+ QTextStream in(&file);
+
+ // Line can be commeted out and have a space as each line
+ // will be simplified.
+ QRegExp regExp(QString("^#?\\s?%1").arg(APTOIDE_MYAPP));
+
+ // With Qt5.5 change to use QTextStream::readlineInto
+ bool mimeTypeDefined = false;
+
+ while (!mimeTypeDefined && !in.atEnd()) {
+ // Remove spaces in between
+ QString line = in.readLine().simplified();
+
+ if (line.contains(regExp)) {
+ mimeTypeDefined = true;
+ }
+ }
+ return mimeTypeDefined ? 1 : 0;
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/downloadmimetypehandler.h
^
|
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DOWNLOAD_MIMETYPE_HANDLER_H
+#define DOWNLOAD_MIMETYPE_HANDLER_H
+
+#include <QString>
+
+class DownloadMimetypeHandler {
+public:
+ static void update();
+
+private:
+ static void appendDefaults(const QString &targetFile);
+ static int hasDefaults(const QString &targetFile);
+
+ friend class tst_downloadmimetypehandler;
+};
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/browser/downloadstatus.h
^
|
@@ -0,0 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DOWNLOAD_STATUS_H
+#define DOWNLOAD_STATUS_H
+
+#include <QObject>
+
+class DownloadStatus : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(Status)
+public:
+ enum Status {
+ Started,
+ Done,
+ Failed,
+ Canceled
+ };
+};
+
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/core/core.pri
^
|
@@ -1,7 +1,5 @@
INCLUDEPATH += $$PWD
-include(../../common/common.pri)
-
# C++ sources
SOURCES += \
$$PWD/declarativewebcontainer.cpp \
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/core/declarativewebcontainer.cpp
^
|
@@ -18,10 +18,9 @@
#include "declarativewebutils.h"
#include "webpagefactory.h"
#include "webpages.h"
+#include "browserpaths.h"
#include <QTimerEvent>
-#include <QDir>
-#include <QStandardPaths>
#include <QScreen>
#include <QMetaMethod>
#include <QOpenGLFunctions_ES2>
@@ -93,10 +92,8 @@
connect(QMozContext::GetInstance(), &QMozContext::lastViewDestroyed,
this, &DeclarativeWebContainer::onLastViewDestroyed);
- QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
- QDir dir(cacheLocation);
- if(!dir.exists() && !dir.mkpath(cacheLocation)) {
- qWarning() << "Can't create directory "+ cacheLocation;
+ QString cacheLocation = BrowserPaths::cacheLocation();
+ if (cacheLocation.isNull()) {
return;
}
@@ -380,6 +377,9 @@
}
if (m_webPage && m_webPage->completed()) {
+ if (m_loading) {
+ m_webPage->stop();
+ }
m_webPage->loadTab(url, force);
} else if (!canInitialize()) {
m_initialUrl = url;
@@ -519,6 +519,11 @@
if (event->type() == QEvent::Close && m_mozWindow) {
m_mozWindow->suspendRendering();
m_closing = true;
+
+ if (m_webPages->count() == 0) {
+ m_mozWindow.reset();
+ }
+
m_webPages->clear();
}
@@ -746,7 +751,7 @@
QString url = m_initialUrl.isEmpty() ? DeclarativeWebUtils::instance()->homePage() : m_initialUrl;
QString title = "";
m_model->newTab(url, title);
- } else if (m_model->count() > 0) {
+ } else if (m_model->count() > 0 && !m_webPage) {
Tab tab = m_model->activeTab();
if (!m_initialUrl.isEmpty()) {
tab.setUrl(m_initialUrl);
@@ -790,6 +795,11 @@
Q_UNUSED(title);
Tab tab;
tab.setTabId(m_model->nextTabId());
+ tab.setUrl(url);
+ if (!canInitialize()) {
+ m_initialUrl = url;
+ }
+
if (activatePage(tab, false, parentId)) {
m_webPage->loadTab(url, false);
}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/main.cpp
^
|
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2013-2016 Jolla Ltd.
+** Contact: Vesa-Matti Hartikainen <vesa-matti.hartikainen@jolla.com>
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <QGuiApplication>
+#include <QQuickView>
+#include <qqmldebug.h>
+#include <QtQml>
+#include <QTranslator>
+#include <QDBusConnection>
+#include <QDBusMessage>
+#include <QDBusPendingCall>
+
+#include "browser.h"
+// Registered QML types
+#include "declarativebookmarkmodel.h"
+#include "desktopbookmarkwriter.h"
+#include "downloadstatus.h"
+#include "browserservice.h"
+#include "persistenttabmodel.h"
+#include "privatetabmodel.h"
+#include "declarativehistorymodel.h"
+#include "declarativewebcontainer.h"
+#include "declarativewebpage.h"
+#include "declarativewebpagecreator.h"
+#include "declarativefileuploadmode.h"
+#include "declarativefileuploadfilter.h"
+#include "iconfetcher.h"
+#include "inputregion.h"
+
+#ifdef HAS_BOOSTER
+#include <MDeclarativeCache>
+#endif
+
+Q_DECL_EXPORT int main(int argc, char *argv[])
+{
+ QQuickWindow::setDefaultAlphaBuffer(true);
+
+ if (!qgetenv("QML_DEBUGGING_ENABLED").isEmpty()) {
+ QQmlDebuggingEnabler qmlDebuggingEnabler;
+ }
+
+#ifdef HAS_BOOSTER
+ QScopedPointer<QGuiApplication> app(MDeclarativeCache::qApplication(argc, argv));
+ QScopedPointer<QQuickView> view(MDeclarativeCache::qQuickView());
+#else
+ QScopedPointer<QGuiApplication> app(new QGuiApplication(argc, argv));
+ QScopedPointer<QQuickView> view(new QQuickView);
+#endif
+ app->setQuitOnLastWindowClosed(false);
+
+ BrowserService *service = new BrowserService(app.data());
+ // Handle command line launch
+ if (!service->registered()) {
+
+ QDBusMessage message;
+ if (app->arguments().contains("-dumpMemory")) {
+ int index = app->arguments().indexOf("-dumpMemory");
+ QString fileName;
+ if (index + 1 < app->arguments().size()) {
+ fileName = app->arguments().at(index + 1);
+ }
+
+ message = QDBusMessage::createMethodCall(service->serviceName(), "/",
+ service->serviceName(), "dumpMemoryInfo");
+ message.setArguments(QVariantList() << fileName);
+ } else {
+ message = QDBusMessage::createMethodCall(service->serviceName(), "/",
+ service->serviceName(), "openUrl");
+ QStringList args;
+ // Pass url argument if given
+ if (app->arguments().count() > 1) {
+ args << app->arguments().at(1);
+ }
+ message.setArguments(QVariantList() << args);
+ }
+
+ QDBusConnection::sessionBus().asyncCall(message);
+ if (QCoreApplication::hasPendingEvents()) {
+ QCoreApplication::processEvents();
+ }
+
+ return 0;
+ }
+
+ BrowserUIService *uiService = new BrowserUIService(app.data());
+
+ QString translationPath("/usr/share/translations/");
+ QTranslator engineeringEnglish;
+ engineeringEnglish.load("sailfish-browser_eng_en", translationPath);
+ qApp->installTranslator(&engineeringEnglish);
+
+ QTranslator translator;
+ translator.load(QLocale(), "sailfish-browser", "-", translationPath);
+ qApp->installTranslator(&translator);
+
+ //% "Browser"
+ view->setTitle(qtTrId("sailfish-browser-ap-name"));
+
+ app->setApplicationName(QString("sailfish-browser"));
+ app->setOrganizationName(QString("org.sailfishos"));
+
+ const char *uri = "Sailfish.Browser";
+
+ // Use QtQuick 2.1 for Sailfish.Browser imports
+ qmlRegisterRevision<QQuickItem, 1>(uri, 1, 0);
+ qmlRegisterRevision<QWindow, 1>(uri, 1, 0);
+
+ qmlRegisterType<DeclarativeBookmarkModel>(uri, 1, 0, "BookmarkModel");
+ qmlRegisterUncreatableType<DeclarativeTabModel>(uri, 1, 0, "TabModel", "TabModel is abstract!");
+ qmlRegisterUncreatableType<PersistentTabModel>(uri, 1, 0, "PersistentTabModel", "");
+ qmlRegisterUncreatableType<PrivateTabModel>(uri, 1, 0, "PrivateTabModel", "");
+ qmlRegisterUncreatableType<DownloadStatus>(uri, 1, 0, "DownloadStatus", "");
+ qmlRegisterType<DeclarativeHistoryModel>(uri, 1, 0, "HistoryModel");
+ qmlRegisterType<DeclarativeWebContainer>(uri, 1, 0, "WebContainer");
+ qmlRegisterType<DeclarativeWebPage>(uri, 1, 0, "WebPage");
+ qmlRegisterType<DeclarativeWebPageCreator>(uri, 1, 0, "WebPageCreator");
+ qmlRegisterType<DeclarativeFileUploadMode>(uri, 1, 0, "FileUploadMode");
+ qmlRegisterType<DeclarativeFileUploadFilter>(uri, 1, 0, "FileUploadFilter");
+ qmlRegisterType<DesktopBookmarkWriter>(uri, 1, 0, "DesktopBookmarkWriter");
+ qmlRegisterType<IconFetcher>(uri, 1, 0, "IconFetcher");
+ qmlRegisterType<InputRegion>(uri, 1, 0, "InputRegion");
+
+ Browser *browser = new Browser(view.data(), app.data());
+ browser->connect(service, SIGNAL(openUrlRequested(QString)),
+ browser, SLOT(openUrl(QString)));
+ browser->connect(service, SIGNAL(activateNewTabViewRequested()),
+ browser, SLOT(openNewTabView()));
+ browser->connect(service, SIGNAL(dumpMemoryInfoRequested(QString)),
+ browser, SLOT(dumpMemoryInfo(QString)));
+
+ browser->connect(uiService, SIGNAL(openUrlRequested(QString)),
+ browser, SLOT(openUrl(QString)));
+ browser->connect(uiService, SIGNAL(activateNewTabViewRequested()),
+ browser, SLOT(openNewTabView()));
+
+ browser->connect(service, SIGNAL(cancelTransferRequested(int)),
+ browser, SLOT(cancelDownload(int)));
+ browser->connect(service, SIGNAL(restartTransferRequested(int)),
+ browser, SLOT(restartDownload(int)));
+ browser->load();
+ return app->exec();
+}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/pages/BrowserPage.qml
^
|
@@ -319,8 +319,8 @@
webView.grabActivePage()
if (!webView.tabModel.activateTab(url)) {
- // Not found in tabs list, load it. A new tab will be created if no tabs exist.
- webView.load(url)
+ // Open new tab with empty title
+ webView.tabModel.newTab(url, "")
overlay.animator.showChrome(true)
}
bringToForeground(webView)
@@ -351,7 +351,7 @@
window.setBrowserCover(webView.tabModel)
}
- if (WebUtils.debugMode) {
+ if (Qt.application.arguments.indexOf("-debugMode") > 0) {
var component = Qt.createComponent(Qt.resolvedUrl("components/DebugOverlay.qml"))
if (component.status === Component.Ready) {
debug = component.createObject(browserPage)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/pages/components/ConfigWarning.qml
^
|
@@ -19,7 +19,6 @@
//: Warning of changing browser configurations.
//% "Changing these advanced settings can cause issues with stability, security and performance of Sailfish Browser. Continue ?"
text: qsTrId("sailfish_browser-la-config-warning");
- acceptDestinationAction: PageStackAction.Replace
acceptDestination: Component {
ConfigDialog {
// On accept pop back to browserPage
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/pages/components/Overlay.qml
^
|
@@ -265,7 +265,7 @@
onRemoveActivePageFromBookmarks: bookmarkModel.remove(webView.url)
}
- SearchField {
+ TextField {
id: searchField
readonly property bool requestingFocus: overlayAnimator.atTop && browserPage.active && !dragArea.moved
@@ -288,9 +288,19 @@
// On top of HistoryList and FavoriteGrid
z: 1
width: parent.width
+ height: Theme.itemSizeMedium
textLeftMargin: Theme.paddingLarge
textRightMargin: Theme.paddingLarge
+ focusOutBehavior: FocusBehavior.ClearPageFocus
+ font {
+ pixelSize: Theme.fontSizeLarge
+ family: Theme.fontFamilyHeading
+ }
+
+ textTopMargin: height/2 - _editor.implicitHeight/2
+ labelVisible: false
inputMethodHints: Qt.ImhUrlCharactersOnly
+ background: null
placeholderText: toolBar.findInPageActive ?
//: Placeholder text for finding text from the web page
@@ -299,6 +309,7 @@
//: Placeholder text for url typing and searching
//% "Type URL or search"
qsTrId("sailfish_browser-ph-type_url_or_search")
+
EnterKey.onClicked: {
if (!text) {
return
@@ -312,7 +323,6 @@
}
}
- background: null
opacity: toolBar.opacity * -1.0
visible: opacity > 0.0 && y >= -searchField.height
@@ -336,6 +346,7 @@
onFocusChanged: {
if (focus) {
+ cursorPosition = text.length
// Mark SearchField as edited if focused before url is resolved.
// Otherwise select all.
if (!text) {
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/pages/components/ResourceController.qml
^
|
@@ -17,7 +17,7 @@
// QtObject cannot have children
Item {
- property QtObject webView
+ property QtObject webPage
property bool videoActive
property bool audioActive
readonly property alias displayOff: screenBlanked.value
@@ -29,8 +29,6 @@
property bool _isAudioStream
property bool _isVideoStream
- signal webViewSuspended
-
function calculateStatus() {
var video = false
var audio = false
@@ -53,16 +51,15 @@
}
function resumeView() {
- if (webView) {
- webView.resumeView()
+ if (webPage) {
+ webPage.resumeView()
}
}
function suspendView() {
- if (webView) {
- webView.suspendView()
+ if (webPage) {
+ webPage.suspendView()
}
- webViewSuspended()
}
onAudioActiveChanged: {
@@ -131,6 +128,8 @@
} else {
resumeView()
}
+ // Reset suspend intention.
+ suspendIntention = false
}
onSuspendIntentionChanged: {
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/pages/components/WebPopupHandler.js
^
|
@@ -19,7 +19,6 @@
var pageStack
var auxTimer
var contextMenuComponent
-var resourceController
var tabModel
// TODO: WebUtils context property. Should be singleton.
var WebUtils
@@ -136,9 +135,16 @@
if (_contextMenu) {
_contextMenu.linkHref = linkHref
- _contextMenu.linkTitle = linkTitle.trim()
_contextMenu.imageSrc = imageSrc
+ _contextMenu.linkTitle = linkTitle.trim()
+ _contextMenu.linkProtocol = data.linkProtocol || ""
+ _contextMenu.contentType = contentType
_contextMenu.tabModel = tabModel
+ _contextMenu.viewId = webView.contentItem.uniqueID()
+ // PageStack and WebView are currently always the same but
+ // let's update them regardless so that they will remain correct.
+ _contextMenu.pageStack = pageStack
+ _contextMenu.webView = webView
_hideVirtualKeyboard()
_contextMenu.show()
} else {
@@ -149,6 +155,7 @@
"linkHref": linkHref,
"imageSrc": imageSrc,
"linkTitle": linkTitle.trim(),
+ "linkProtocol": data.linkProtocol,
"contentType": contentType,
"tabModel": tabModel,
"viewId": webView.contentItem.uniqueID(),
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/pages/components/WebView.qml
^
|
@@ -25,7 +25,7 @@
property bool findInPageHasResult
property var resourceController: ResourceController {
- webView: contentItem
+ webPage: contentItem
background: !webView.visible
}
@@ -66,8 +66,11 @@
function grabActivePage() {
if (webView.contentItem && webView.activeTabRendered) {
- webView.privateMode ? webView.contentItem.grabThumbnail(thumbnailCaptureSize())
- : webView.contentItem.grabToFile(thumbnailCaptureSize())
+ if (webView.privateMode) {
+ webView.contentItem.grabThumbnail(thumbnailCaptureSize())
+ } else {
+ webView.contentItem.grabToFile(thumbnailCaptureSize())
+ }
}
}
@@ -99,13 +102,17 @@
function grabItem() {
if (rendered && activeWebPage && active) {
- webView.privateMode ? grabThumbnail(thumbnailCaptureSize()) : grabToFile(thumbnailCaptureSize())
+ if (webView.privateMode) {
+ grabThumbnail(thumbnailCaptureSize())
+ } else {
+ grabToFile(thumbnailCaptureSize())
+ }
}
}
fullscreenHeight: container.fullscreenHeight
toolbarHeight: container.toolbarHeight
- throttlePainting: !foreground && !resourceController.videoActive && webView.visible || resourceController.displayOff
+ throttlePainting: !foreground && !resourceController.videoActive && webView.visible || !webView.visible
enabled: webView.enabled
// There needs to be enough content for enabling chrome gesture
@@ -353,7 +360,6 @@
PopupHandler.pageStack = pageStack
PopupHandler.webView = webView
PopupHandler.browserPage = browserPage
- PopupHandler.resourceController = resourceController
PopupHandler.WebUtils = WebUtils
PopupHandler.tabModel = tabModel
PopupHandler.pickerCreator = _pickerCreator
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/qtmozembed/declarativewebpage.cpp
^
|
@@ -12,11 +12,11 @@
#include "declarativewebpage.h"
#include "declarativewebcontainer.h"
#include "dbmanager.h"
+#include "browserpaths.h"
+#include <qmozwindow.h>
#include <QGuiApplication>
#include <QtConcurrent>
-#include <QStandardPaths>
-#include "qmozwindow.h"
static const QString gFullScreenMessage("embed:fullscreenchanged");
static const QString gDomContentLoadedMessage("embed:domcontentloaded");
@@ -401,7 +401,7 @@
}
// 75% quality jpg produces small and good enough capture.
- QString path = QString("%1/tab-%2-thumb.jpg").arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)).arg(tabId());
+ QString path = QString("%1/tab-%2-thumb.jpg").arg(BrowserPaths::cacheLocation()).arg(tabId());
return !allBlack(image) && image.save(path, "jpg", 75) ? path : "";
}
@@ -441,7 +441,7 @@
}
QSize size = page->mozWindow()->size();
- dbg.nospace() << "DeclarativeWebPage(url = " << page->url() << ", title = " << page->title() << ", width = " << size.width()
+ dbg.nospace() << "DeclarativeWebPage(tabId = " << page->tabId() << " url = " << page->url() << ", title = " << page->title() << ", width = " << size.width()
<< ", height = " << size.height() << ", completed = " << page->completed()
<< ", active = " << page->active() << ", enabled = " << page->enabled() << ")";
return dbg.space();
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/sailfish-browser.qrc
^
|
@@ -14,6 +14,7 @@
<file>pages/components/ConfigWarning.qml</file>
<file>pages/components/ConfirmDialog.qml</file>
<file>pages/components/DebugOverlay.qml</file>
+ <file>pages/components/DownloadMenuItem.qml</file>
<file>pages/components/DownloadRemorsePopup.qml</file>
<file>pages/components/FavoriteContextMenu.qml</file>
<file>pages/components/FavoriteGrid.qml</file>
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/src.pro
^
|
@@ -46,7 +46,10 @@
include(../translations/translations.pri)
include(../defaults.pri)
+include(../common/opensearchconfigs.pri)
+include(../common/paths.pri)
include(core/core.pri)
+include(browser/browser.pri)
include(history/history.pri)
include(bookmarks/bookmarks.pri)
include(qtmozembed/qtmozembed.pri)
@@ -54,20 +57,14 @@
# C++ sources
SOURCES += \
- sailfishbrowser.cpp \
+ main.cpp \
browserservice.cpp \
- dbusadaptor.cpp \
- closeeventfilter.cpp \
- downloadmanager.cpp \
- declarativewebutils.cpp
+ dbusadaptor.cpp
# C++ headers
HEADERS += \
browserservice.h \
- dbusadaptor.h \
- closeeventfilter.h \
- downloadmanager.h \
- declarativewebutils.h
+ dbusadaptor.h
OTHER_FILES = *.qml \
cover/*.qml \
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/storage/dbmanager.cpp
^
|
@@ -103,6 +103,12 @@
Q_ARG(int, tabId));
}
+void DBManager::removeAllTabs()
+{
+ QMetaObject::invokeMethod(worker, "removeAllTabs", Qt::BlockingQueuedConnection,
+ Q_ARG(bool, true));
+}
+
void DBManager::updateTitle(int tabId, QString url, QString title)
{
QMetaObject::invokeMethod(worker, "updateTitle", Qt::QueuedConnection,
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/storage/dbmanager.h
^
|
@@ -31,6 +31,7 @@
void createTab(const Tab &tab);
void getAllTabs();
void removeTab(int tabId);
+ void removeAllTabs();
void navigateTo(int tabId, QString url, QString title = "", QString path = "");
void goForward(int tabId);
void goBack(int tabId);
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/storage/dbworker.cpp
^
|
@@ -9,8 +9,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "dbworker.h"
-
#include <QSqlError>
#include <QSqlQuery>
#include <QSqlRecord>
@@ -22,6 +20,9 @@
#include <QFile>
#include <QDateTime>
+#include "dbworker.h"
+#include "browserpaths.h"
+
#ifndef DEBUG_LOGS
#define DEBUG_LOGS 0
#endif
@@ -86,14 +87,12 @@
void DBWorker::init()
{
- QString databaseDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
- const QString dbFileName = QLatin1String(DB_NAME);
- QDir dir(databaseDir);
-
- if(!dir.mkpath(databaseDir)) {
- qWarning() << "Can't create directory "+ databaseDir;
+ QString databaseDir = BrowserPaths::dataLocation();
+ if (databaseDir.isNull()) {
return;
}
+ QDir dir(databaseDir);
+ const QString dbFileName(QLatin1String(DB_NAME));
m_database = QSqlDatabase::addDatabase("QSQLITE");
m_database.setDatabaseName(dir.absoluteFilePath(dbFileName));
@@ -283,9 +282,14 @@
}
}
-void DBWorker::removeAllTabs()
+void DBWorker::removeAllTabs(bool noFeedback)
{
- int oldTabCount = tabCount();
+ int oldTabCount(0);
+
+ if (!noFeedback) {
+ oldTabCount = tabCount();
+ }
+
QSqlQuery query = prepare("DELETE FROM tab;");
execute(query);
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/src/storage/dbworker.h
^
|
@@ -38,6 +38,7 @@
void createTab(const Tab &tab);
void removeTab(int tabId);
void getAllTabs();
+ void removeAllTabs(bool noFeedback = false);
void navigateTo(int tabId, QString url, QString title, QString path);
int getMaxTabId();
@@ -73,7 +74,6 @@
int integerQuery(const QString &statement);
void migrateTo_1();
void setUserVersion(int userVersion);
- void removeAllTabs();
QSqlQuery prepare(const QString &statement);
bool execute(QSqlQuery &query);
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/auto.pro
^
|
@@ -4,6 +4,7 @@
tst_declarativebookmarkmodel \
tst_declarativehistorymodel \
tst_declarativewebcontainer \
+ tst_downloadmimetypehandler \
tst_persistenttabmodel \
tst_desktopbookmarkwriter \
tst_linkvalidator \
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/mocks/declarativewebutils/declarativewebutils.cpp
^
|
@@ -85,8 +85,3 @@
return gSingleton;
}
-QString DeclarativeWebUtils::downloadDir() const
-{
- QString dir;
- return dir;
-}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/mocks/declarativewebutils/declarativewebutils.h
^
|
@@ -35,7 +35,6 @@
bool firstUseDone() const;
void setFirstUseDone(bool firstUseDone);
qreal silicaPixelRatio() const;
- QString downloadDir() const;
signals:
void homePageChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/test_common.pri
^
|
@@ -6,6 +6,9 @@
include(../../defaults.pri)
+SRCDIR = $$PWD/../../src
+BROWSERSRCDIR = $$SRCDIR/browser
+
CONFIG(gcov) {
message("GCOV instrumentalization enabled")
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage -O0
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_dbmanager/tst_dbmanager.cpp
^
|
@@ -11,6 +11,7 @@
#include <QtTest>
#include "dbmanager.h"
+#include "browserpaths.h"
Q_DECLARE_METATYPE(QList<Tab>)
Q_DECLARE_METATYPE(QList<Link>)
@@ -28,6 +29,8 @@
void getAllTabs();
void removeTab_data();
void removeTab();
+ void removeAllTabs_data();
+ void removeAllTabs();
void clearHistory_data();
void clearHistory();
void navigateTo();
@@ -48,7 +51,7 @@
void tst_dbmanager::initTestCase()
{
mDbFile = QString("%1/%2")
- .arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation))
+ .arg(BrowserPaths::dataLocation())
.arg(QLatin1String(DB_NAME));
QFile dbFile(mDbFile);
dbFile.remove();
@@ -177,6 +180,46 @@
QCOMPARE(tabsAvailableSpy.count(), expectedTabsAvailable);
}
+void tst_dbmanager::removeAllTabs_data()
+{
+ QTest::addColumn<QList<Tab> >("initialTabs");
+
+ QList<Tab> emptyList;
+
+ QList<Tab> oneTab {
+ Tab(1, "http://example1.com", "Test title 1", "")
+ };
+
+ QList<Tab> threeTabs {
+ Tab(1, "http://example1.com", "Test title 1", ""),
+ Tab(2, "http://example2.com", "Test title 2", ""),
+ Tab(3, "http://example3.com", "Test title 3", "")
+ };
+
+ QTest::newRow("no_inital_tabs") << emptyList;
+ QTest::newRow("one_inital_tab") << oneTab;
+ QTest::newRow("three_initial_tabs") << threeTabs;
+}
+
+void tst_dbmanager::removeAllTabs()
+{
+ QFETCH(QList<Tab>, initialTabs);
+
+ // initialize the case
+ foreach (Tab tab, initialTabs) {
+ DBManager::instance()->createTab(tab);
+ }
+
+ QSignalSpy tabsAvailableSpy(DBManager::instance(),
+ SIGNAL(tabsAvailable(QList<Tab>)));
+
+ // actual test
+ DBManager::instance()->removeAllTabs();
+ tabsAvailableSpy.wait(1000);
+ // Make sure there is no feedback from dbworker thread
+ QCOMPARE(tabsAvailableSpy.count(), 0);
+}
+
void tst_dbmanager::clearHistory_data()
{
QTest::addColumn<QList<Tab> >("initialTabs");
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_dbmanager/tst_dbmanager.pro
^
|
@@ -3,6 +3,7 @@
QT += quick concurrent sql
include(../test_common.pri)
+include(../../../common/paths.pri)
include(../../../src/storage/storage.pri)
SOURCES += tst_dbmanager.cpp
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_declarativebookmarkmodel/tst_declarativebookmarkmodel.cpp
^
|
@@ -10,13 +10,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <QtTest>
-#include <QStandardPaths>
-#include <QDir>
#include <QFile>
#include <QTextStream>
#include "declarativebookmarkmodel.h"
#include "bookmarkmanager.h"
+#include "browserpaths.h"
static const QByteArray BOOKMARKS_JSON = \
"[{" \
@@ -55,13 +54,9 @@
void tst_declarativebookmarkmodel::initTestCase()
{
- QString settingsLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
- QDir dir(settingsLocation);
- if (!dir.exists()) {
- if (!dir.mkpath(settingsLocation)) {
- qWarning() << "Can't create directory " << settingsLocation;
- return;
- }
+ QString settingsLocation = BrowserPaths::dataLocation();
+ if (settingsLocation.isNull()) {
+ return;
}
m_bookmarksFile = settingsLocation + "/bookmarks.json";
}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_declarativebookmarkmodel/tst_declarativebookmarkmodel.pro
^
|
@@ -8,6 +8,7 @@
include(../test_common.pri)
include(../../../src/bookmarks/bookmarks.pri)
+include(../../../common/paths.pri)
# C++ sources
SOURCES += tst_declarativebookmarkmodel.cpp
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_declarativehistorymodel/tst_declarativehistorymodel.cpp
^
|
@@ -18,6 +18,7 @@
#include "declarativehistorymodel.h"
#include "testobject.h"
#include "dbmanager.h"
+#include "browserpaths.h"
static const QByteArray QML_SNIPPET = \
"import QtQuick 2.0\n" \
@@ -263,7 +264,7 @@
// Wait for event loop of db manager
QTest::qWait(1000);
QString dbFileName = QString("%1/%2")
- .arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation))
+ .arg(BrowserPaths::dataLocation())
.arg(QLatin1String(DB_NAME));
QFile dbFile(dbFileName);
QVERIFY(dbFile.remove());
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_declarativehistorymodel/tst_declarativehistorymodel.pro
^
|
@@ -8,6 +8,7 @@
include(../common/testobject.pri)
include(../mocks/declarativewebpage/declarativewebpage_mock.pri)
include(../mocks/declarativewebcontainer/declarativewebcontainer_mock.pri)
+include(../../../common/paths.pri)
include(../../../src/history/history.pri)
SOURCES += tst_declarativehistorymodel.cpp
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_declarativewebcontainer/tst_declarativewebcontainer.pro
^
|
@@ -16,6 +16,7 @@
include(../mocks/downloadmanager/downloadmanager_mock.pri)
include(../test_common.pri)
+include(../../../common/paths.pri)
include(../../../src/core/core.pri)
include(../../../src/history/history.pri)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_desktopbookmarkwriter/tst_desktopbookmarkwriter.cpp
^
|
@@ -10,6 +10,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "desktopbookmarkwriter.h"
+#include "browserpaths.h"
#include <MDesktopEntry>
#include <QtTest>
@@ -86,7 +87,7 @@
QTest::addColumn<QString>("outputIcon");
QTest::addColumn<QString>("savedDesktopFile");
- QString testPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+ QString testPath = BrowserPaths::dataLocation();
QTest::newRow("basic default icon") << "Jolla" << "Jolla"
<< "http://www.test1.jolla.com" << "http://www.test1.jolla.com"
<< "" << QString(DEFAULT_DESKTOP_BOOKMARK_ICON)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_desktopbookmarkwriter/tst_desktopbookmarkwriter.pro
^
|
@@ -4,6 +4,7 @@
include(../test_common.pri)
include(../../../src/bookmarks/bookmarks.pri)
+include(../../../common/paths.pri)
SOURCES += tst_desktopbookmarkwriter.cpp
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_downloadmimetypehandler/tst_downloadmimetypehandler.cpp
^
|
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Jolla Ltd.
+** Contact: Raine Makelainen <raine.makelainen@jolla.com>
+**
+****************************************************************************/
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "browserpaths.h"
+#include "downloadmimetypehandler.h"
+
+#include <QObject>
+#include <QByteArray>
+#include <QFile>
+#include <QStandardPaths>
+#include <QStringList>
+#include <QTextStream>
+#include <QtTest>
+
+#define APTOIDE_MYAPP "application/vnd.cm.aptoide.pt myapp"
+
+static const QByteArray COMMENTED_OUT = "foobar app\n" \
+ "#" APTOIDE_MYAPP "\n";
+
+static const QByteArray COMMENTED_OUT_WITH_SPACE = "foobar app\n" \
+ "#\t\n" APTOIDE_MYAPP "\t\t\n";
+
+static const QByteArray BROKEN_MIME_TYPE = "foobar app\n" \
+ "application / vnd.cm.aptoide.pt myapp\n";
+
+static const QByteArray HAS_CONTENT_TYPE = "foobar app\n" \
+ APTOIDE_MYAPP "\n";
+
+static const QByteArray NO_CONTENT_TYPE = "foobar app\n" \
+ "hello world\n";
+
+
+class tst_downloadmimetypehandler : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void defaultMimeTypes_data();
+ void defaultMimeTypes();
+
+private:
+ void writeTestFile(const QString &path, const QByteArray &data);
+
+ QMap<QString, QString> mTestFiles;
+};
+
+
+void tst_downloadmimetypehandler::initTestCase()
+{
+ QString fileName = QString("%1/commented_out").arg(BrowserPaths::dataLocation());
+ writeTestFile(fileName, COMMENTED_OUT);
+ mTestFiles.insert("commented_out", fileName);
+
+ fileName = QString("%1/commented_out_with_spaces").arg(BrowserPaths::dataLocation());
+ writeTestFile(fileName, COMMENTED_OUT_WITH_SPACE);
+ mTestFiles.insert("commented_out_with_spaces", fileName);
+
+ fileName = QString("%1/broken_mime_type").arg(BrowserPaths::dataLocation());
+ writeTestFile(fileName, BROKEN_MIME_TYPE);
+ mTestFiles.insert("broken_mime_type", fileName);
+
+ fileName = QString("%1/has_content_type").arg(BrowserPaths::dataLocation());
+ writeTestFile(fileName, HAS_CONTENT_TYPE);
+ mTestFiles.insert("has_content_type", fileName);
+
+ fileName = QString("%1/no_content_type").arg(BrowserPaths::dataLocation());
+ writeTestFile(fileName, NO_CONTENT_TYPE);
+ mTestFiles.insert("no_content_type", fileName);
+
+ mTestFiles.insert("unknown_file", QString("%1/unknown_file").arg(BrowserPaths::dataLocation()));
+}
+
+void tst_downloadmimetypehandler::cleanupTestCase()
+{
+ QDir dir(BrowserPaths::dataLocation());
+ dir.removeRecursively();
+}
+
+void tst_downloadmimetypehandler::defaultMimeTypes_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<int>("hasMimeTypes");
+
+ QTest::newRow("commented_out") << mTestFiles.value("commented_out") << 1;
+ QTest::newRow("commented_out_with_spaces") << mTestFiles.value("commented_out_with_spaces") << 1;
+ QTest::newRow("has_content_type") << mTestFiles.value("has_content_type") << 1;
+ QTest::newRow("no_content_type") << mTestFiles.value("no_content_type") << 0;
+ QTest::newRow("broken_mime_type") << mTestFiles.value("broken_mime_type") << 0;
+ QTest::newRow("unknown_file") << mTestFiles.value("unknown_file") << -1;
+}
+
+void tst_downloadmimetypehandler::defaultMimeTypes()
+{
+ QFETCH(QString, fileName);
+ QFETCH(int, hasMimeTypes);
+ QCOMPARE(DownloadMimetypeHandler::hasDefaults(fileName), hasMimeTypes);
+
+ if (hasMimeTypes < 1) {
+ DownloadMimetypeHandler::appendDefaults(fileName);
+ QCOMPARE(DownloadMimetypeHandler::hasDefaults(fileName), 1);
+ }
+}
+
+void tst_downloadmimetypehandler::writeTestFile(const QString &path, const QByteArray &data)
+{
+ QFile file(path);
+ QVERIFY(file.open(QIODevice::WriteOnly | QIODevice::Text));
+ QTextStream out(&file);
+ out << data;
+ endl(out);
+ file.close();
+}
+
+QTEST_GUILESS_MAIN(tst_downloadmimetypehandler)
+
+#include "tst_downloadmimetypehandler.moc"
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_downloadmimetypehandler/tst_downloadmimetypehandler.pro
^
|
@@ -0,0 +1,14 @@
+TARGET = tst_downloadmimetypehandler
+
+QT -= gui
+
+include(../test_common.pri)
+include(../../../common/paths.pri)
+
+INCLUDEPATH += $$BROWSERSRCDIR
+
+SOURCES += tst_downloadmimetypehandler.cpp \
+ $$BROWSERSRCDIR/downloadmimetypehandler.cpp
+
+HEADERS += \
+ $$BROWSERSRCDIR/downloadmimetypehandler.h
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_persistenttabmodel/tst_persistenttabmodel.cpp
^
|
@@ -15,6 +15,7 @@
#include "dbmanager.h"
#include "declarativewebpage.h"
#include "declarativewebcontainer.h"
+#include "browserpaths.h"
using ::testing::Return;
@@ -77,7 +78,7 @@
char* argv[0] = {};
::testing::InitGoogleMock(&argc, argv);
mDbFile = QString("%1/%2")
- .arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation))
+ .arg(BrowserPaths::dataLocation())
.arg(QLatin1String(DB_NAME));
QFile dbFile(mDbFile);
dbFile.remove();
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_persistenttabmodel/tst_persistenttabmodel.pro
^
|
@@ -8,6 +8,7 @@
include(../mocks/declarativewebpage/declarativewebpage_mock.pri)
include(../mocks/declarativewebcontainer/declarativewebcontainer_mock.pri)
+include(../../../common/paths.pri)
include(../../../src/history/history.pri)
SOURCES += tst_persistenttabmodel.cpp
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webpagefactory/tst_webpagefactory.pro
^
|
@@ -8,6 +8,7 @@
include(../mocks/declarativewebpage/declarativewebpage_mock.pri)
include(../test_common.pri)
+include(../../../common/paths.pri)
include(../../../src/storage/storage.pri)
include(../../../src/factories/factories.pri)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webpages/tst_webpages.pro
^
|
@@ -16,6 +16,7 @@
include(../mocks/downloadmanager/downloadmanager_mock.pri)
include(../test_common.pri)
+include(../../../common/paths.pri)
include(../../../src/core/core.pri)
include(../../../src/history/history.pri)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webutils/tst_webutils.cpp
^
|
@@ -10,7 +10,14 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <QtTest>
+#include <QDir>
+#include <QFile>
+#include <QTextStream>
+
#include "declarativewebutils.h"
+#include "browserpaths.h"
+
+static const QByteArray TEST_CONTENT = "Hello World!";
class tst_webutils : public QObject
{
@@ -22,6 +29,8 @@
private slots:
void displayableUrl_data();
void displayableUrl();
+ void uniquePictureName_data();
+ void uniquePictureName();
};
tst_webutils::tst_webutils(QObject *parent)
@@ -59,6 +68,75 @@
QCOMPARE(resultUrl, expectedUrl);
}
+void tst_webutils::uniquePictureName_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QList<QString> >("existingFiles");
+ QTest::addColumn<QString>("expectedName");
+
+ QList<QString> existingFiles;
+ QTest::newRow("new_file") << "some_picture.jpg" << existingFiles << "some_picture.jpg";
+
+ QTest::newRow("new_file_no_ext") << "some_file" << existingFiles << "some_file";
+
+ existingFiles << "some_picture.jpg";
+ QTest::newRow("file_exists") << "some_picture.jpg" << existingFiles << "some_picture(2).jpg";
+
+ QTest::newRow("new_file_2") << "some_picture.png" << existingFiles << "some_picture.png";
+
+ existingFiles << "some_picture(2).jpg" << "some_picture(3).jpg";
+ QTest::newRow("many_files_exist") << "some_picture.jpg" << existingFiles << "some_picture(4).jpg";
+
+ existingFiles.clear();
+ existingFiles << "some_picture.jpg" << "some_picture(3).jpg";
+ QTest::newRow("many_files_exist_2") << "some_picture.jpg" << existingFiles << "some_picture(2).jpg";
+
+ existingFiles.clear();
+ existingFiles << "some_picture(2).jpg" << "some_picture(3).jpg";
+ QTest::newRow("many_files_exist_3") << "some_picture.jpg" << existingFiles << "some_picture.jpg";
+
+ existingFiles.clear();
+ existingFiles << "and(2)_some(2).picture.jpg" << "and(2)_some(2)(2).picture.jpg";
+ QTest::newRow("complicated_case") << "and(2)_some(2).picture.jpg" << existingFiles << "and(2)_some(2)(3).picture.jpg";
+
+ existingFiles.clear();
+ existingFiles << "some_file";
+ QTest::newRow("file_exists_no_ext") << "some_file" << existingFiles << "some_file(2)";
+
+ existingFiles << "some_file(2)" << "some_file(3)";
+ QTest::newRow("many_files_exist_no_ext") << "some_file" << existingFiles << "some_file(4)";
+}
+
+void tst_webutils::uniquePictureName()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QList<QString>, existingFiles);
+ QFETCH(QString, expectedName);
+
+ // set up test case
+ QDir dir(BrowserPaths::dataLocation());
+ dir.removeRecursively();
+
+ foreach (const QString& existingFile, existingFiles) {
+ QFile file(BrowserPaths::dataLocation() + "/" + existingFile);
+ QVERIFY(file.open(QIODevice::WriteOnly | QIODevice::Text));
+ QTextStream out(&file);
+ out << TEST_CONTENT;
+ file.close();
+ }
+
+ QString targetPath = BrowserPaths::dataLocation();
+
+ // actual test
+ DeclarativeWebUtils *webUtils = DeclarativeWebUtils::instance();
+ QCOMPARE(webUtils->createUniqueFileUrl(fileName, targetPath), "file://" + targetPath + "/" + expectedName);
+
+ // tear down
+ // set up test case
+ dir.removeRecursively();
+ Q_UNUSED(BrowserPaths::dataLocation());
+}
+
QTEST_MAIN(tst_webutils)
#include "tst_webutils.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webutils/tst_webutils.pro
^
|
@@ -5,13 +5,15 @@
include(../mocks/qmozcontext/qmozcontext.pri)
include(../test_common.pri)
-include(../../../common/common.pri)
+include(../../../common/opensearchconfigs.pri)
+include(../../../common/paths.pri)
-INCLUDEPATH += ../../../src/
+INCLUDEPATH += $$SRCDIR \
+ $$BROWSERSRCDIR
SOURCES += tst_webutils.cpp \
- ../../../src/declarativewebutils.cpp
+ $$BROWSERSRCDIR/declarativewebutils.cpp
-HEADERS += ../../../src/declarativewebutils.h
+HEADERS += $$BROWSERSRCDIR/declarativewebutils.h
INCLUDEPATH -= $$absolute_path(../../../../qtmozembed/src)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webview/ResourceControllerMock.qml
^
|
@@ -18,8 +18,6 @@
property bool background
property bool displayOff
- signal webViewSuspended
-
function calculateStatus() {}
function resumeView() {}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webview/tst_webview.cpp
^
|
@@ -20,6 +20,7 @@
#include "declarativewebpagecreator.h"
#include "declarativewebutils.h"
#include "webpages.h"
+#include "browserpaths.h"
#include "testobject.h"
class tst_webview : public TestObject
@@ -755,7 +756,7 @@
QTest::qWait(1000);
QString dbFileName = QString("%1/%2")
- .arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation))
+ .arg(BrowserPaths::dataLocation())
.arg(QLatin1String(DB_NAME));
QFile dbFile(dbFileName);
QVERIFY(dbFile.remove());
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/auto/tst_webview/tst_webview.pro
^
|
@@ -15,6 +15,7 @@
include(../../../src/factories/factories.pri)
include(../../../src/bookmarks/bookmarks.pri)
include(../../../src/history/history.pri)
+include(../../../common/paths.pri)
SOURCES += tst_webview.cpp
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/manual/testgeolocation.html
^
|
@@ -0,0 +1,25 @@
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, user-scalable=false;">
+ <title>Simple Geolocation smoke test</title>
+ <script>
+ function outputData(position) {
+ // Write each attribute from position data.
+ var data = document.getElementById("data");
+ for (var i in position.coords) {
+ var dataRow = document.createElement("h2");
+ var positionData = document.createTextNode(i + " : " + position.coords[i]);
+ dataRow.appendChild(positionData);
+ data.appendChild(dataRow);
+ }
+ }
+ function init() {
+ navigator.geolocation.getCurrentPosition(outputData);
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h1>Geolocation data will be written below</h1>
+ <div id="data"></div>
+ </body>
+</html>
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-browser-1.14.14.tar.bz2/tests/manual/testpage.html
^
|
@@ -81,6 +81,9 @@
<a href="testfilepicker.html">File picker tests</a>
</div>
<div>
+ <a href="testgeolocation.html">Simple geolocation test</a>
+ </div>
+ <div>
<a href="testhtml5audio.html">HTML5 audio tag / audio download</a>
</div>
<div>
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-browser-1.14.8.tar.bz2/src/closeeventfilter.cpp
^
|
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com>
-**
-****************************************************************************/
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <QCoreApplication>
-#include "closeeventfilter.h"
-#include "qmozcontext.h"
-#include "declarativewebutils.h"
-
-CloseEventFilter::CloseEventFilter(DownloadManager *dlMgr, QObject *parent)
- : QObject(parent),
- m_downloadManager(dlMgr)
-{
- connect(QMozContext::GetInstance(), &QMozContext::lastWindowDestroyed,
- this, &CloseEventFilter::onLastWindowDestroyed);
- connect(QMozContext::GetInstance(), &QMozContext::destroyed,
- this, &CloseEventFilter::onContextDestroyed);
- connect(&m_shutdownWatchdog, &QTimer::timeout,
- this, &CloseEventFilter::onWatchdogTimeout);
-}
-
-void CloseEventFilter::stopApplication()
-{
- QMozContext::GetInstance()->stopEmbedding();
- // Give the engine 5 seconds to shut down. If it fails terminate
- // with a fatal error.
- m_shutdownWatchdog.start(5000);
-}
-
-void CloseEventFilter::onLastWindowDestroyed()
-{
- if (m_downloadManager->existActiveTransfers()) {
- connect(m_downloadManager, SIGNAL(allTransfersCompleted()),
- this, SLOT(stopApplication()));
- } else {
- stopApplication();
- }
-}
-
-void CloseEventFilter::onContextDestroyed()
-{
- qApp->exit();
-}
-
-void CloseEventFilter::onWatchdogTimeout()
-{
- qFatal("Browser failed to terminate in acceptable time!");
-}
-
-void CloseEventFilter::cancelStopApplication()
-{
- disconnect(m_downloadManager, SIGNAL(allTransfersCompleted()),
- this, SLOT(stopApplication()));
- m_shutdownWatchdog.stop();
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-browser-1.14.8.tar.bz2/src/declarativewebutils.cpp
^
|
@@ -1,472 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Vesa-Matti Hartikainen <vesa-matti.hartikainen@jollamobile.com>
-**
-****************************************************************************/
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <QLocale>
-#include <QStringList>
-#include <QVariant>
-#include <QVariantMap>
-#include <QGuiApplication>
-#include <QClipboard>
-#include <QFile>
-#include <QFileInfo>
-#include <QDir>
-#include <QDateTime>
-#include <QScreen>
-#include <QStandardPaths>
-#include <QtMath>
-#include <math.h>
-#include "declarativewebutils.h"
-#include "qmozcontext.h"
-#include "opensearchconfigs.h"
-
-static const QString gSystemComponentsTimeStamp("/var/lib/_MOZEMBED_CACHE_CLEAN_");
-static const QString gProfilePath("/.mozilla/mozembed");
-
-static DeclarativeWebUtils *gSingleton = 0;
-static const qreal gCssPixelRatioRoundingFactor = 0.5;
-static const qreal gCssDefaultPixelRatio = 1.5;
-
-
-bool testScreenDimensions(qreal pixelRatio) {
- QScreen *screen = QGuiApplication::primaryScreen();
- qreal w = screen->size().width() / pixelRatio;
- qreal h = screen->size().height() / pixelRatio;
-
- return fmod(w, 1.0) == 0 && fmod(h, 1.0) == 0;
-}
-
-DeclarativeWebUtils::DeclarativeWebUtils()
- : QObject()
- , m_homePage("/apps/sailfish-browser/settings/home_page", this)
- , m_debugMode(qApp->arguments().contains("-debugMode"))
- , m_silicaPixelRatio(1.0)
- , m_touchSideRadius(32.0)
- , m_touchTopRadius(48.0)
- , m_touchBottomRadius(16.0)
- , m_inputItemSize(28.0)
- , m_zoomMargin(14.0)
-{
- connect(QMozContext::GetInstance(), SIGNAL(onInitialized()),
- this, SLOT(updateWebEngineSettings()));
- connect(QMozContext::GetInstance(), SIGNAL(recvObserve(QString, QVariant)),
- this, SLOT(handleObserve(QString, QVariant)));
-
- QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QStringLiteral("/.firstUseDone");
- m_firstUseDone = fileExists(path);
-
- connect(&m_homePage, SIGNAL(valueChanged()), this, SIGNAL(homePageChanged()));
-}
-
-DeclarativeWebUtils::~DeclarativeWebUtils()
-{
- gSingleton = 0;
-}
-
-int DeclarativeWebUtils::getLightness(QColor color) const
-{
- return color.lightness();
-}
-
-bool DeclarativeWebUtils::fileExists(QString fileName) const
-{
- QFile file(fileName);
- return file.exists();
-}
-
-void DeclarativeWebUtils::clearStartupCacheIfNeeded()
-{
- QFileInfo systemStamp(gSystemComponentsTimeStamp);
- if (systemStamp.exists()) {
- QString mostProfilePath = QDir::homePath() + gProfilePath;
- QString localStampString(mostProfilePath + QString("/_CACHE_CLEAN_"));
- QFileInfo localStamp(localStampString);
- if (localStamp.exists() && systemStamp.lastModified() > localStamp.lastModified()) {
- QDir cacheDir(mostProfilePath + "/startupCache");
- cacheDir.removeRecursively();
- QFile(localStampString).remove();
- }
- }
-}
-
-void DeclarativeWebUtils::handleDumpMemoryInfoRequest(QString fileName)
-{
- if (m_debugMode) {
- emit dumpMemoryInfo(fileName);
- }
-}
-
-void DeclarativeWebUtils::updateWebEngineSettings()
-{
- // Infer and set Accept-Language header from the current system locale
- QString langs;
- QStringList locale = QLocale::system().name().split("_", QString::SkipEmptyParts);
- if (locale.size() > 1) {
- langs = QString("%1-%2,%3").arg(locale.at(0)).arg(locale.at(1)).arg(locale.at(0));
- } else {
- langs = locale.at(0);
- }
-
- QMozContext* mozContext = QMozContext::GetInstance();
- mozContext->setPref(QString("intl.accept_languages"), QVariant(langs));
-
- // these are magic numbers defining touch radius required to detect <image src=""> touch
- mozContext->setPref(QStringLiteral("browser.ui.touch.left"), QVariant(m_touchSideRadius));
- mozContext->setPref(QStringLiteral("browser.ui.touch.right"), QVariant(m_touchSideRadius));
- mozContext->setPref(QStringLiteral("browser.ui.touch.top"), QVariant(m_touchTopRadius));
- mozContext->setPref(QStringLiteral("browser.ui.touch.bottom"), QVariant(m_touchBottomRadius));
-
- // Install embedlite handlers for guestures
- mozContext->setPref(QString("embedlite.azpc.handle.singletap"), QVariant(false));
- mozContext->setPref(QString("embedlite.azpc.json.singletap"), QVariant(true));
- mozContext->setPref(QString("embedlite.azpc.handle.longtap"), QVariant(false));
- mozContext->setPref(QString("embedlite.azpc.json.longtap"), QVariant(true));
- mozContext->setPref(QString("embedlite.azpc.json.viewport"), QVariant(true));
-
- // Without this pref placeholders get cleaned as soon as a character gets committed
- // by VKB and that happens only when Enter is pressed or comma/space/dot is entered.
- mozContext->setPref(QString("dom.placeholder.show_on_focus"), QVariant(false));
-
- mozContext->setPref(QString("security.alternate_certificate_error_page"), QString("certerror"));
-
- // Use autodownload, never ask
- mozContext->setPref(QString("browser.download.useDownloadDir"), QVariant(true));
- mozContext->setPref(QString("browser.download.useJSTransfer"), QVariant(true));
- // see https://developer.mozilla.org/en-US/docs/Download_Manager_preferences
- // Use custom downloads location defined in browser.download.dir
- mozContext->setPref(QString("browser.download.folderList"), QVariant(2));
- mozContext->setPref(QString("browser.download.dir"), downloadDir());
- // Downloads should never be removed automatically
- mozContext->setPref(QString("browser.download.manager.retention"), QVariant(2));
- // Downloads will be canceled on quit
- // TODO: this doesn't really work. Instead the incomplete downloads get restarted
- // on browser launch.
- mozContext->setPref(QString("browser.download.manager.quitBehavior"), QVariant(2));
- // TODO: this doesn't really work too
- mozContext->setPref(QString("browser.helperApps.deleteTempFileOnExit"), QVariant(true));
- mozContext->setPref(QString("geo.wifi.scan"), QVariant(false));
- mozContext->setPref(QString("browser.enable_automatic_image_resizing"), QVariant(true));
-
- // Make long press timeout equal to the one in Qt
- mozContext->setPref(QString("ui.click_hold_context_menus.delay"), QVariant(800));
- mozContext->setPref(QString("apz.fling_stopped_threshold"), QString("0.13f"));
-
- // TODO: remove this line when the value adjusted for different DPIs makes
- // its way to Gecko's default prefs.
- mozContext->setPref(QString("apz.touch_start_tolerance"), QString("0.0555555f"));
-
- mozContext->setPref(QString("media.resource_handler_disabled"), QVariant(true));
-
- // Disable asmjs
- mozContext->setPref(QString("javascript.options.asmjs"), QVariant(false));
-
- // subscribe to gecko messages
- mozContext->addObservers(QStringList()
- << "clipboard:setdata"
- << "media-decoder-info"
- << "embed:download"
- << "embed:allprefs"
- << "embed:search");
-
- // Enable internet search
- mozContext->setPref(QString("keyword.enabled"), QVariant(true));
-
- // Scale up content size
- setContentScaling();
- setRenderingPreferences();
-
- // Theme.fontSizeSmall
- mozContext->setPref(QStringLiteral("embedlite.inputItemSize"), QVariant(m_inputItemSize));
- mozContext->setPref(QStringLiteral("embedlite.zoomMargin"), QVariant(m_zoomMargin));
-
- // Disable SSLv3
- mozContext->setPref(QString("security.tls.version.min"), QVariant(1));
-
- // Content Security Policy is enabled by default,
- // this enables the spec compliant mode.
- mozContext->setPref(QString("security.csp.speccompliant"), QVariant(true));
-}
-
-void DeclarativeWebUtils::setFirstUseDone(bool firstUseDone) {
- QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QStringLiteral("/.firstUseDone");
- if (m_firstUseDone != firstUseDone) {
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-browser-1.14.8.tar.bz2/src/declarativewebutils.h
^
|
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Vesa-Matti Hartikainen <vesa-matti.hartikainen@jollamobile.com>
-**
-****************************************************************************/
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef DECLARATIVEWEBUTILS_H
-#define DECLARATIVEWEBUTILS_H
-
-#include <QObject>
-#include <QUrl>
-#include <QColor>
-#include <QVariant>
-#include "browserservice.h"
-#include <QProcess>
-#include <MGConfItem>
-
-class DeclarativeWebUtils : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
- Q_PROPERTY(QString downloadDir READ downloadDir CONSTANT FINAL)
- Q_PROPERTY(QString picturesDir READ picturesDir CONSTANT FINAL)
- Q_PROPERTY(bool firstUseDone READ firstUseDone WRITE setFirstUseDone NOTIFY firstUseDoneChanged)
- Q_PROPERTY(bool debugMode READ debugMode CONSTANT FINAL)
- Q_PROPERTY(qreal cssPixelRatio READ cssPixelRatio NOTIFY cssPixelRatioChanged)
- Q_PROPERTY(qreal silicaPixelRatio READ silicaPixelRatio WRITE setSilicaPixelRatio NOTIFY silicaPixelRatioChanged)
- Q_PROPERTY(qreal touchSideRadius READ touchSideRadius WRITE setTouchSideRadius NOTIFY touchSideRadiusChanged)
- Q_PROPERTY(qreal touchTopRadius READ touchTopRadius WRITE setTouchTopRadius NOTIFY touchTopRadiusChanged)
- Q_PROPERTY(qreal touchBottomRadius READ touchBottomRadius WRITE setTouchBottomRadius NOTIFY touchBottomRadiusChanged)
- Q_PROPERTY(qreal inputItemSize READ inputItemSize WRITE setInputItemSize NOTIFY inputItemSizeChanged)
- Q_PROPERTY(qreal zoomMargin READ zoomMargin WRITE setZoomMargin NOTIFY zoomMarginChanged)
-
-public:
- static DeclarativeWebUtils *instance();
-
- QString downloadDir() const;
- QString picturesDir() const;
- bool firstUseDone() const;
- void setFirstUseDone(bool firstUseDone);
- bool debugMode() const;
- qreal cssPixelRatio() const;
- qreal silicaPixelRatio() const;
- void setSilicaPixelRatio(qreal silicaPixelRatio);
- qreal touchSideRadius() const;
- void setTouchSideRadius(qreal touchSideRadius);
- qreal touchTopRadius() const;
- void setTouchTopRadius(qreal touchTopRadius);
- qreal touchBottomRadius() const;
- void setTouchBottomRadius(qreal touchBottomRadius);
- qreal inputItemSize() const;
- void setInputItemSize(qreal inputItemSize);
- qreal zoomMargin() const;
- void setZoomMargin(qreal zoomMargin);
-
- Q_INVOKABLE int getLightness(QColor color) const;
- Q_INVOKABLE bool fileExists(QString fileName) const;
- Q_INVOKABLE QString displayableUrl(QString fullUrl) const;
-
-public slots:
- QString homePage() const;
- void clearStartupCacheIfNeeded();
- void handleDumpMemoryInfoRequest(QString fileName);
-
-signals:
- void homePageChanged();
- void openUrlRequested(QString url);
- void activateNewTabViewRequested();
- void firstUseDoneChanged();
- void dumpMemoryInfo(QString fileName);
- void cssPixelRatioChanged();
- void silicaPixelRatioChanged();
- void touchSideRadiusChanged();
- void touchTopRadiusChanged();
- void touchBottomRadiusChanged();
- void inputItemSizeChanged();
- void zoomMarginChanged();
-
-private slots:
- void updateWebEngineSettings();
- void handleObserve(const QString message, const QVariant data);
-
-private:
- explicit DeclarativeWebUtils();
- ~DeclarativeWebUtils();
- void setContentScaling();
- void setRenderingPreferences();
-
- MGConfItem m_homePage;
- bool m_firstUseDone;
- bool m_debugMode;
- qreal m_silicaPixelRatio;
- qreal m_touchSideRadius;
- qreal m_touchTopRadius;
- qreal m_touchBottomRadius;
- qreal m_inputItemSize;
- qreal m_zoomMargin;
-};
-#endif // DECLARATIVEWEBUTILS_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-browser-1.14.8.tar.bz2/src/downloadmanager.cpp
^
|
@@ -1,243 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com>
-**
-****************************************************************************/
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "downloadmanager.h"
-#include "qmozcontext.h"
-#include "declarativewebutils.h"
-
-#include <transferengineinterface.h>
-#include <transfertypes.h>
-#include <QDir>
-#include <QFile>
-#include <QDebug>
-
-#include <pwd.h>
-#include <grp.h>
-#include <unistd.h>
-
-static DownloadManager *gSingleton = 0;
-
-DownloadManager::DownloadManager()
- : QObject()
-{
- m_transferClient = new TransferEngineInterface("org.nemo.transferengine",
- "/org/nemo/transferengine",
- QDBusConnection::sessionBus(),
- this);
- connect(QMozContext::GetInstance(), SIGNAL(recvObserve(const QString, const QVariant)),
- this, SLOT(recvObserve(const QString, const QVariant)));
-}
-
-DownloadManager::~DownloadManager()
-{
- gSingleton = 0;
-}
-
-void DownloadManager::recvObserve(const QString message, const QVariant data)
-{
-
- if (message != "embed:download") {
- // here we are interested in download messages only
- return;
- }
-
- QVariantMap dataMap(data.toMap());
- QString msg(dataMap.value("msg").toString());
- qulonglong downloadId(dataMap.value("id").toULongLong());
-
- if (msg == "dl-start" && m_download2transferMap.contains(downloadId)) { // restart existing transfer
- m_transferClient->startTransfer(m_download2transferMap.value(downloadId));
- m_statusCache.insert(downloadId, DownloadStarted);
- } else if (msg == "dl-start") { // create new transfer
- emit downloadStarted();
- QStringList callback;
- callback << "org.sailfishos.browser" << "/" << "org.sailfishos.browser";
- QDBusPendingReply<int> reply = m_transferClient->createDownload(dataMap.value("displayName").toString(),
- QString("image://theme/icon-launcher-browser"),
- QString("image://theme/icon-launcher-browser"),
- dataMap.value("targetPath").toString(),
- dataMap.value("mimeType").toString(),
- dataMap.value("size").toULongLong(),
- callback,
- QString("cancelTransfer"),
- QString("restartTransfer"));
- reply.waitForFinished();
-
- if (reply.isError()) {
- qWarning() << "DownloadManager::recvObserve: failed to get transfer ID!" << reply.error();
- return;
- }
-
- int transferId(reply.value());
-
- m_download2transferMap.insert(downloadId, transferId);
- m_transfer2downloadMap.insert(transferId, downloadId);
-
- m_transferClient->startTransfer(transferId);
- m_statusCache.insert(downloadId, DownloadStarted);
- } else if (msg == "dl-progress") {
- qreal progress(dataMap.value("percent").toULongLong() / 100.0);
-
- m_transferClient->updateTransferProgress(m_download2transferMap.value(downloadId),
- progress);
- } else if (msg == "dl-done") {
- m_transferClient->finishTransfer(m_download2transferMap.value(downloadId),
- TransferEngineData::TransferFinished,
- QString("success"));
- m_statusCache.insert(downloadId, DownloadDone);
- checkAllTransfers();
-
- QString targetPath = dataMap.value("targetPath").toString();
- QFileInfo fileInfo(targetPath);
- if (fileInfo.completeSuffix() == QLatin1Literal("myapp")) {
- QString packageName("com.aptoide.partners");
- QString apkName = aptoideApk(packageName);
- if (apkName.isEmpty()) {
- qWarning() << "No aptoide client installed to handle package: " + targetPath;
- return;
- }
- if (moveMyAppPackage(targetPath)) {
- QProcess::execute("/usr/bin/apkd-launcher", QStringList() << apkName << QString("%1/%1.AptoideJollaSupport").arg(packageName));
- }
- }
- } else if (msg == "dl-fail") {
- m_transferClient->finishTransfer(m_download2transferMap.value(downloadId),
- TransferEngineData::TransferInterrupted,
- QString("browser failure"));
- m_statusCache.insert(downloadId, DownloadFailed);
- checkAllTransfers();
- } else if (msg == "dl-cancel") {
- m_transferClient->finishTransfer(m_download2transferMap.value(downloadId),
- TransferEngineData::TransferCanceled,
- QString("download canceled"));
- m_statusCache.insert(downloadId, DownloadCanceled);
- checkAllTransfers();
- }
-}
-
-bool DownloadManager::moveMyAppPackage(QString path)
-{
- QString aptoideDownloadPath = QString("%1/.aptoide/").arg(DeclarativeWebUtils::instance()->downloadDir());
- QDir dir(aptoideDownloadPath);
-
- if (!dir.exists()) {
- if (!dir.mkpath(aptoideDownloadPath)) {
- qWarning() << "Failed to create path for myapp download, aborting";
- return false;
- }
- uid_t uid = getuid();
- // assumes that correct groupname is same as username (e.g. nemo:nemo)
- int gid = getgrnam(getpwuid(uid)->pw_name)->gr_gid;
- int success = chown(aptoideDownloadPath.toLatin1().data(), uid, gid);
- Q_UNUSED(success);
- QFile::Permissions permissions(QFile::ExeOwner | QFile::ExeGroup | QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::WriteGroup);
- QFile::setPermissions(aptoideDownloadPath, permissions);
- }
-
- QFile file(path);
- QFileInfo fileInfo(file);
- QString newPath(aptoideDownloadPath + fileInfo.fileName());
- QFile obsoleteFile(newPath);
-
- if (obsoleteFile.exists() && !obsoleteFile.remove()) {
- qWarning() << "Failed to remove obsolete myapp file, aborting";
- return false;
- }
-
- if (!file.rename(newPath)) {
- qWarning() << "Failed to move myapp file to aptoide's folder, aborting";
- // Avoid generating ~/Downloads/<name>(2).myapp file in case user downloads the same file again
- file.remove();
- return false;
- }
-
- return true;
-}
-
-QString DownloadManager::aptoideApk(QString packageName)
-{
- QString apkPath("/data/app/");
- QString aptoideApk = QString("%1/%2.apk").arg(apkPath, packageName);
- if (!QFile(aptoideApk).exists()) {
- QDir apkDir(apkPath, QString("%1*.apk").arg(packageName));
- if (apkDir.count() > 0) {
- aptoideApk = QString("%1/%2").arg(apkPath, apkDir.entryList().last());
- } else {
- return QString();
- }
- }
- return aptoideApk;
-}
-
-void DownloadManager::cancelActiveTransfers()
-{
- foreach (qulonglong downloadId, m_statusCache.keys()) {
- if (m_statusCache.value(downloadId) == DownloadStarted) {
- cancelTransfer(m_download2transferMap.value(downloadId));
- }
- }
-}
-
-void DownloadManager::cancelTransfer(int transferId)
-{
- if (m_transfer2downloadMap.contains(transferId)) {
- QVariantMap data;
- data.insert("msg", "cancelDownload");
- data.insert("id", m_transfer2downloadMap.value(transferId));
- QMozContext::GetInstance()->sendObserve(QString("embedui:download"), QVariant(data));
- } else {
- m_transferClient->finishTransfer(transferId,
- TransferEngineData::TransferInterrupted,
- QString("Transfer got unavailable"));
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-browser-1.14.8.tar.bz2/src/downloadmanager.h
^
|
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com>
-**
-****************************************************************************/
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef DOWNLOADMANAGER_H
-#define DOWNLOADMANAGER_H
-
-#include <QObject>
-#include <QHash>
-#include <QString>
-#include <QVariant>
-
-class TransferEngineInterface;
-
-class DownloadManager : public QObject
-{
- Q_OBJECT
-
-public:
- static DownloadManager *instance();
-
- bool existActiveTransfers();
-
-signals:
- void downloadStarted();
- void allTransfersCompleted();
-
-public slots:
- void cancelActiveTransfers();
-
-private slots:
- void recvObserve(const QString message, const QVariant data);
- void cancelTransfer(int transferId);
- void restartTransfer(int transferId);
-
-private:
- explicit DownloadManager();
- ~DownloadManager();
-
- enum Status {
- DownloadStarted,
- DownloadDone,
- DownloadFailed,
- DownloadCanceled
- };
-
- void checkAllTransfers();
- QString aptoideApk(QString packageName);
- bool moveMyAppPackage(QString path);
-
- // TODO: unlike Gecko downloads and Sailfish transfers these mappings
- // are not persistent -> after user has browser closed transfers can't be
- // restarted.
- QHash<qulonglong, int> m_download2transferMap;
- QHash<int, qulonglong> m_transfer2downloadMap;
- QHash<qulonglong, Status> m_statusCache;
-
- TransferEngineInterface *m_transferClient;
-};
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-browser-1.14.8.tar.bz2/src/sailfishbrowser.cpp
^
|
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Vesa-Matti Hartikainen <vesa-matti.hartikainen@jollamobile.com>
-**
-****************************************************************************/
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <QGuiApplication>
-#include <QQuickView>
-#include <qqmldebug.h>
-#include <QQmlContext>
-#include <QQmlEngine>
-#include <QtQml>
-#include <QTimer>
-#include <QTranslator>
-#include <QDir>
-#include <QScreen>
-#include <QDBusConnection>
-#include <QDBusMessage>
-#include <QDBusPendingCall>
-
-#include "qmozcontext.h"
-
-#include "declarativebookmarkmodel.h"
-#include "desktopbookmarkwriter.h"
-#include "declarativewebutils.h"
-#include "browserservice.h"
-#include "downloadmanager.h"
-#include "closeeventfilter.h"
-#include "persistenttabmodel.h"
-#include "privatetabmodel.h"
-#include "declarativehistorymodel.h"
-#include "declarativewebcontainer.h"
-#include "declarativewebpage.h"
-#include "declarativewebpagecreator.h"
-#include "declarativefileuploadmode.h"
-#include "declarativefileuploadfilter.h"
-#include "iconfetcher.h"
-#include "inputregion.h"
-
-#ifdef HAS_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- setenv("USE_ASYNC", "1", 1);
- setenv("USE_NEMO_GSTREAMER", "1", 1);
- setenv("NO_LIMIT_ONE_GST_DECODER", "1", 1);
-
- // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=929879
- setenv("LC_NUMERIC", "C", 1);
- setlocale(LC_NUMERIC, "C");
-
- QQuickWindow::setDefaultAlphaBuffer(true);
-
- if (!qgetenv("QML_DEBUGGING_ENABLED").isEmpty()) {
- QQmlDebuggingEnabler qmlDebuggingEnabler;
- }
-
-#ifdef HAS_BOOSTER
- QScopedPointer<QGuiApplication> app(MDeclarativeCache::qApplication(argc, argv));
- QScopedPointer<QQuickView> view(MDeclarativeCache::qQuickView());
-#else
- QScopedPointer<QGuiApplication> app(new QGuiApplication(argc, argv));
- QScopedPointer<QQuickView> view(new QQuickView);
-#endif
- app->setQuitOnLastWindowClosed(false);
-
- // GRE_HOME must be set before QMozContext is initialized.
- // With invoker PWD is empty.
- QByteArray binaryPath = QCoreApplication::applicationDirPath().toLocal8Bit();
- setenv("GRE_HOME", binaryPath.constData(), 1);
-
- // Don't set custom user agent string when the environment already contains CUSTOM_UA.
- if (qgetenv("CUSTOM_UA").isEmpty()) {
- setenv("CUSTOM_UA", "Mozilla/5.0 (Maemo; Linux; U; Jolla; Sailfish; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0 SailfishBrowser/1.0", 1);
- }
-
- BrowserService *service = new BrowserService(app.data());
- // Handle command line launch
- if (!service->registered()) {
-
- QDBusMessage message;
- if (app->arguments().contains("-dumpMemory")) {
- int index = app->arguments().indexOf("-dumpMemory");
- QString fileName;
- if (index + 1 < app->arguments().size()) {
- fileName = app->arguments().at(index + 1);
- }
-
- message = QDBusMessage::createMethodCall(service->serviceName(), "/",
- service->serviceName(), "dumpMemoryInfo");
- message.setArguments(QVariantList() << fileName);
- } else {
- message = QDBusMessage::createMethodCall(service->serviceName(), "/",
- service->serviceName(), "openUrl");
- QStringList args;
- // Pass url argument if given
- if (app->arguments().count() > 1) {
- args << app->arguments().at(1);
- }
- message.setArguments(QVariantList() << args);
- }
-
- QDBusConnection::sessionBus().asyncCall(message);
- if (QCoreApplication::hasPendingEvents()) {
- QCoreApplication::processEvents();
- }
-
- return 0;
- }
-
- BrowserUIService *uiService = new BrowserUIService(app.data());
-
- QString translationPath("/usr/share/translations/");
- QTranslator engineeringEnglish;
- engineeringEnglish.load("sailfish-browser_eng_en", translationPath);
- qApp->installTranslator(&engineeringEnglish);
-
- QTranslator translator;
- translator.load(QLocale(), "sailfish-browser", "-", translationPath);
- qApp->installTranslator(&translator);
-
- //% "Browser"
- view->setTitle(qtTrId("sailfish-browser-ap-name"));
-
- // Use QtQuick 2.1 for Sailfish.Browser imports
- qmlRegisterRevision<QQuickItem, 1>("Sailfish.Browser", 1, 0);
- qmlRegisterRevision<QWindow, 1>("Sailfish.Browser", 1, 0);
-
- qmlRegisterType<DeclarativeBookmarkModel>("Sailfish.Browser", 1, 0, "BookmarkModel");
- qmlRegisterUncreatableType<DeclarativeTabModel>("Sailfish.Browser", 1, 0, "TabModel", "TabModel is abstract!");
- qmlRegisterUncreatableType<PersistentTabModel>("Sailfish.Browser", 1, 0, "PersistentTabModel", "");
- qmlRegisterUncreatableType<PrivateTabModel>("Sailfish.Browser", 1, 0, "PrivateTabModel", "");
- qmlRegisterType<DeclarativeHistoryModel>("Sailfish.Browser", 1, 0, "HistoryModel");
- qmlRegisterType<DeclarativeWebContainer>("Sailfish.Browser", 1, 0, "WebContainer");
- qmlRegisterType<DeclarativeWebPage>("Sailfish.Browser", 1, 0, "WebPage");
- qmlRegisterType<DeclarativeWebPageCreator>("Sailfish.Browser", 1, 0, "WebPageCreator");
- qmlRegisterType<DeclarativeFileUploadMode>("Sailfish.Browser", 1, 0, "FileUploadMode");
- qmlRegisterType<DeclarativeFileUploadFilter>("Sailfish.Browser", 1, 0, "FileUploadFilter");
- qmlRegisterType<DesktopBookmarkWriter>("Sailfish.Browser", 1, 0, "DesktopBookmarkWriter");
- qmlRegisterType<IconFetcher>("Sailfish.Browser", 1, 0, "IconFetcher");
- qmlRegisterType<InputRegion>("Sailfish.Browser", 1, 0, "InputRegion");
-
- QString componentPath(DEFAULT_COMPONENTS_PATH);
- QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components/EmbedLiteBinComponents.manifest"));
- QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components/EmbedLiteJSComponents.manifest"));
- QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome/EmbedLiteJSScripts.manifest"));
- QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome/EmbedLiteOverrides.manifest"));
-
- app->setApplicationName(QString("sailfish-browser"));
- app->setOrganizationName(QString("org.sailfishos"));
-
- DeclarativeWebUtils *utils = DeclarativeWebUtils::instance();
- utils->connect(service, SIGNAL(openUrlRequested(QString)),
- utils, SIGNAL(openUrlRequested(QString)));
- utils->connect(service, SIGNAL(activateNewTabViewRequested()),
- utils, SIGNAL(activateNewTabViewRequested()));
- utils->connect(service, SIGNAL(dumpMemoryInfoRequested(QString)),
- utils, SLOT(handleDumpMemoryInfoRequest(QString)));
-
- utils->connect(uiService, SIGNAL(openUrlRequested(QString)),
- utils, SIGNAL(openUrlRequested(QString)));
- utils->connect(uiService, SIGNAL(activateNewTabViewRequested()),
- utils, SIGNAL(activateNewTabViewRequested()));
-
- utils->clearStartupCacheIfNeeded();
- view->rootContext()->setContextProperty("WebUtils", utils);
- view->rootContext()->setContextProperty("MozContext", QMozContext::GetInstance());
- view->rootContext()->setContextProperty("Settings", SettingManager::instance());
-
- DownloadManager *dlMgr = DownloadManager::instance();
- dlMgr->connect(service, SIGNAL(cancelTransferRequested(int)),
- dlMgr, SLOT(cancelTransfer(int)));
- dlMgr->connect(service, SIGNAL(restartTransferRequested(int)),
- dlMgr, SLOT(restartTransfer(int)));
-
- QScopedPointer<CloseEventFilter> clsEventFilter(new CloseEventFilter(dlMgr, app.data()));
- QObject::connect(service, SIGNAL(openUrlRequested(QString)),
- clsEventFilter.data(), SLOT(cancelStopApplication()));
- QObject::connect(service, SIGNAL(activateNewTabViewRequested()),
- clsEventFilter.data(), SLOT(cancelStopApplication()));
-
- QObject::connect(uiService, SIGNAL(openUrlRequested(QString)),
- clsEventFilter.data(), SLOT(cancelStopApplication()));
- QObject::connect(uiService, SIGNAL(activateNewTabViewRequested()),
- clsEventFilter.data(), SLOT(cancelStopApplication()));
-
-#ifdef USE_RESOURCES
- view->setSource(QUrl("qrc:///browser.qml"));
-#else
- bool isDesktop = qApp->arguments().contains("-desktop");
-
- QString path;
|