Skip to content

Commit

Permalink
[nextcloud] Remove unused old webengine integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasfella committed Sep 30, 2020
1 parent b951e9a commit 6036756
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 44 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion plugins/nextcloud-ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 0 additions & 36 deletions plugins/nextcloud-ui/nextcloudcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions plugins/nextcloud-ui/nextcloudcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

#include <QObject>
#include <QStringList>
#include <QtWidgets>
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QWebEngineHttpRequest>
#include <QWebEngineUrlRequestInterceptor>
#include <QQuickWebEngineProfile>

Expand Down Expand Up @@ -76,7 +72,6 @@ private Q_SLOTS:
void figureOutServer(const QUrl &url);
void setWorking(bool start);
void serverCheckResult();
void openWebView();
void wrongUrlDetected();

QByteArray m_json;
Expand All @@ -85,7 +80,6 @@ private Q_SLOTS:
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;
Expand Down

0 comments on commit 6036756

Please sign in to comment.