Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>2021-11-17 12:36:05 +0300
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>2021-11-22 15:21:58 +0300
commit12c6d6e3bdf3fa15c963630d6d7abd268476038f (patch)
treece00002e0ac183b3cc544b47b2a10f290d76992f /src/gui/systray.cpp
parent1d704d9352236d2361ab73ecdd3ec4eaf50eb60d (diff)
add a network access factory to qml engine
ensure network access made via qml are using our user agent Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Diffstat (limited to 'src/gui/systray.cpp')
-rw-r--r--src/gui/systray.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp
index 475367486..707609612 100644
--- a/src/gui/systray.cpp
+++ b/src/gui/systray.cpp
@@ -22,6 +22,7 @@
#include "wheelhandler.h"
#include "tray/unifiedsearchresultimageprovider.h"
#include "configfile.h"
+#include "accessmanager.h"
#include <QCursor>
#include <QGuiApplication>
@@ -59,6 +60,8 @@ void Systray::setTrayEngine(QQmlApplicationEngine *trayEngine)
{
_trayEngine = trayEngine;
+ _trayEngine->setNetworkAccessManagerFactory(&_accessManagerFactory);
+
_trayEngine->addImportPath("qrc:/qml/theme");
_trayEngine->addImageProvider("avatars", new ImageProvider);
_trayEngine->addImageProvider(QLatin1String("svgimage-custom-color"), new OCC::Ui::SvgImageProvider);
@@ -505,4 +508,14 @@ QPoint Systray::calcTrayIconCenter() const
#endif
}
+AccessManagerFactory::AccessManagerFactory()
+ : QQmlNetworkAccessManagerFactory()
+{
+}
+
+QNetworkAccessManager* AccessManagerFactory::create(QObject *parent)
+{
+ return new AccessManager(parent);
+}
+
} // namespace OCC