Commit 693d7361 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Restore kio-webdav plugin

Summary:
It wasn't build at all.

Port to new Plugin system from D27633 and fix path reading

BUG: 413888

Reviewers: bshah, leinir, #frameworks

Reviewed By: leinir

Differential Revision: https://phabricator.kde.org/D27635
parent 2566f3b8
......@@ -19,7 +19,7 @@ set(SIGNONQT_DEP_VERSION "8.55")
set(ACCOUNTSGLIB_DEP_VERSION "1.21")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core Widgets)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED KCMUtils I18n CoreAddons DBusAddons Declarative)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED KCMUtils I18n CoreAddons DBusAddons Declarative Wallet KIO)
find_package(AccountsQt5 ${ACCOUNTSQT_DEP_VERSION} CONFIG)
set_package_properties(AccountsQt5 PROPERTIES DESCRIPTION "Accounts management library for Qt applications"
......
add_subdirectory(kio-webdav)
set(kio-webdav_SRCS
kioservices.cpp
createnetattachjob.cpp
......@@ -6,23 +5,22 @@ set(kio-webdav_SRCS
createkioservice.cpp
removekioservice.cpp)
add_library(kaccounts_kio_webdav_plugin MODULE ${kio-webdav_SRCS})
kcoreaddons_add_plugin(kaccounts_kio_webdav_plugin
SOURCES ${kio-webdav_SRCS}
JSON "kio-webdav.json"
INSTALL_NAMESPACE "kaccounts/daemonplugins"
)
target_link_libraries(kaccounts_kio_webdav_plugin
Qt5::Core
# Qt5::Xml
# Qt5::Widgets
# KF5::CoreAddons
# KF5::ConfigCore
# KF5::Wallet
# KF5::KIOCore
# KF5::I18n
Qt5::Widgets
KF5::CoreAddons
KF5::ConfigCore
KF5::Wallet
KF5::KIOCore
KF5::I18n
KF5::DBusAddons
kaccounts
${ACCOUNTSQT_LIBRARIES}
${SIGNONQT_LIBRARIES}
)
install (TARGETS kaccounts_carddav_plugin
DESTINATION ${PLUGIN_INSTALL_DIR}/kaccounts/daemonplugins
)
......@@ -66,6 +66,7 @@ void CreateKioService::gotCredentials(KJob *job)
Accounts::Service service = m_manager->service(m_serviceName);
QString host = m_account->value("dav/host").toString();
QString path = m_account->value("dav/storagePath").toString();
m_account->selectService(service);
QString username = data["UserName"].toString();
......@@ -73,7 +74,7 @@ void CreateKioService::gotCredentials(KJob *job)
connect(netJob, &CreateNetAttachJob::finished, this, &CreateKioService::netAttachCreated);
netJob->setHost(host);
netJob->setPath(m_account->value("dav/path").toString());
netJob->setPath(path);
netJob->setUsername(username);
netJob->setPassword(data["Secret"].toString());
netJob->setIcon(service.iconName());
......
......@@ -21,7 +21,7 @@
#include <Accounts/Manager>
#include <KDirNotify>
#include <KWallet/KWallet>
#include <KWallet>
#include <KConfig>
#include <KIO/Job>
#include <KConfigGroup>
......@@ -83,8 +83,7 @@ void CreateNetAttachJob::getRealm()
url.setHost(m_host);
url.setUserName(m_username);
url.setScheme("webdav");
url = url.adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + m_path);
url.setPath(m_path);
if (!m_realm.isEmpty()) {
createDesktopFile(url);
......
{
"KPlugin": {
"Description": "Mount WebDAV shares with KIO",
"EnabledByDefault": true,
"Icon": "system-file-manager",
"Id": "kaccounts_kio_webdav",
"License": "GPL",
"Name": "KIO WebDAV",
"Version": "0.1"
}
}
......@@ -26,11 +26,17 @@
#include <QStandardPaths>
#include <QDebug>
KIOServices::KIOServices(QObject *parent)
: KAccountsDPlugin(parent)
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(KIOServices, "kio-webdav.json")
KIOServices::KIOServices(QObject *parent, const QVariantList &args)
: KAccountsDPlugin(parent, args)
{
}
KIOServices::~KIOServices() = default;
void KIOServices::onAccountCreated(const Accounts::AccountId accId, const Accounts::ServiceList &serviceList)
{
qDebug();
......@@ -126,3 +132,5 @@ bool KIOServices::isEnabled(const Accounts::AccountId accId, const QString &serv
return QFile::exists(path);
}
#include "kioservices.moc"
......@@ -40,7 +40,8 @@ class KIOServices : public KAccountsDPlugin
Q_OBJECT
public:
explicit KIOServices(QObject* parent =nullptr);
KIOServices(QObject* parent, const QVariantList &args);
~KIOServices() override;
public Q_SLOTS:
void onAccountCreated(const Accounts::AccountId accId, const Accounts::ServiceList &serviceList);
......
......@@ -22,8 +22,6 @@
#include <QFile>
#include <QDebug>
#include <KDirNotify>
RemoveKioService::RemoveKioService(QObject *parent)
: KJob(parent)
{
......
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