Commit 60367561 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[nextcloud] Remove unused old webengine integration

parent b951e9a4
......@@ -16,7 +16,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_P
find_package(Intltool REQUIRED)
find_package(KAccounts REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core Qml WebEngineWidgets WebEngine)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core Qml WebEngine)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED KIO I18n Declarative Package)
include(KDEInstallDirs)
......
......@@ -9,7 +9,6 @@ add_library(nextcloud_plugin_kaccounts MODULE
target_link_libraries(nextcloud_plugin_kaccounts
Qt5::Core
Qt5::WebEngineWidgets
Qt5::WebEngine
KF5::KIOCore
KF5::I18n
......
......@@ -13,13 +13,6 @@
#include <KLocalizedString>
#include <QJsonDocument>
#include <QJsonObject>
#include <QtWidgets>
#include <QtNetwork>
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QWebEngineHttpRequest>
#include <QWebEngineProfile>
#include <QFileSystemWatcher>
#include <QDesktopServices>
// Document for login flow : https://docs.nextcloud.com/server/stable/developer_manual/client_apis/LoginFlow/index.html
......@@ -105,8 +98,6 @@ void NextcloudController::fileChecked(KJob* job)
m_state = WebLogin;
Q_EMIT stateChanged();
// Call webview for login
openWebView();
}
// When url entered by user is wrong
......@@ -119,36 +110,9 @@ void NextcloudController::wrongUrlDetected()
// Open Webview for nextcloud login.
// Document for login flow : https://docs.nextcloud.com/server/stable/developer_manual/client_apis/LoginFlow/index.html
void NextcloudController::openWebView()
{
QWebEngineHttpRequest request;
// set proper headers
request.setUrl(QUrl::fromUserInput(m_server + "/index.php/login/flow"));
request.setHeader(
QByteArray::fromStdString("USER_AGENT"),
QByteArray::fromStdString("Mozilla/5.0 nextcloud-ui-plugin")
);
request.setHeader(
QByteArray::fromStdString("OCS-APIREQUEST"),
QByteArray::fromStdString("true")
);
m_view->load(request);
// Delete cookies because it is a one time webview
m_view->page()->profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
// To catch the url of scheme *nc* on the final login
QDesktopServices::setUrlHandler("nc", this, "finalUrlHandler");
m_view->show();
m_view->resize(424, 650);
}
void NextcloudController::finalUrlHandler(const QUrl &url){
m_finalUrl = url;
m_view->close();
delete m_view;
// To fetch m_username and m_password from final url
QString finalURLtoString = m_finalUrl.toString();
......
......@@ -10,10 +10,6 @@
#include <QObject>
#include <QStringList>
#include <QtWidgets>
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QWebEngineHttpRequest>
#include <QWebEngineUrlRequestInterceptor>
#include <QQuickWebEngineProfile>
......@@ -76,7 +72,6 @@ private:
void figureOutServer(const QUrl &url);
void setWorking(bool start);
void serverCheckResult();
void openWebView();
void wrongUrlDetected();
QByteArray m_json;
......@@ -85,7 +80,6 @@ private:
QString m_username;
QString m_password;
QUrl m_finalUrl;
QWebEngineView * m_view = new QWebEngineView;
QStringList m_disabledServices;
bool m_isWorking = false;
bool m_isLoginComplete = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment