diff --git a/.drone.star b/.drone.star index dfda1078cef..54d5ca9e340 100644 --- a/.drone.star +++ b/.drone.star @@ -232,7 +232,7 @@ def gui_test_pipeline(ctx): return pipelines def build_client(image = OC_CI_CLIENT, ctest = True): - cmake_options = '-G"%s" -DCMAKE_C_COMPILER="%s" -DCMAKE_CXX_COMPILER="%s" -DCMAKE_BUILD_TYPE="%s" -DWITH_LIBCLOUDPROVIDERS=ON' + cmake_options = '-G"%s" -DCMAKE_C_COMPILER="%s" -DCMAKE_CXX_COMPILER="%s" -DCMAKE_BUILD_TYPE="%s"' cmake_options = cmake_options % (build_config["generator"], build_config["c_compiler"], build_config["cxx_compiler"], build_config["build_type"]) if ctest: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93acfc94afd..0536eaddc4b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,7 +93,6 @@ jobs: & "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c dev-utils/nsis } elseif($IsLinux) { & "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c dev-utils/linuxdeploy - & "${env:GITHUB_WORKSPACE}/.github/workflows/.craft.ps1" -c --set enableLibcloudproviders=true owncloud/owncloud-client } - name: Install dependencies diff --git a/THEME.cmake b/THEME.cmake index a90ac3c6d4d..047a719dfe1 100644 --- a/THEME.cmake +++ b/THEME.cmake @@ -17,18 +17,6 @@ if(NOT DEFINED APPLICATION_VIRTUALFILE_SUFFIX) set(APPLICATION_VIRTUALFILE_SUFFIX "${APPLICATION_SHORTNAME}_virtual" CACHE STRING "Virtual file suffix (not including the .)") endif() -# Default dbus name and path -if(NOT DEFINED APPLICATION_CLOUDPROVIDERS_DBUS_NAME) - set(APPLICATION_CLOUDPROVIDERS_DBUS_NAME ${APPLICATION_REV_DOMAIN}) -endif() -if(NOT DEFINED APPLICATION_CLOUDPROVIDERS_DBUS_PATH) - set(APPLICATION_CLOUDPROVIDERS_DBUS_PATH "/${APPLICATION_CLOUDPROVIDERS_DBUS_NAME}") - string(REPLACE "." "/" APPLICATION_CLOUDPROVIDERS_DBUS_PATH ${APPLICATION_CLOUDPROVIDERS_DBUS_PATH}) - # sanitize string to valid characters, see https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path - # note: as we just inserted some /, we may not replace them - string(REGEX REPLACE "[^a-zA-Z0-9_/]" "_" APPLICATION_CLOUDPROVIDERS_DBUS_PATH ${APPLICATION_CLOUDPROVIDERS_DBUS_PATH}) -endif() - # need this logic to not mess with re/uninstallations via macosx.pkgproj if(${APPLICATION_REV_DOMAIN} STREQUAL "com.owncloud.desktopclient") set(APPLICATION_REV_DOMAIN_INSTALLER "com.ownCloud.client") diff --git a/changelog/unreleased/11157 b/changelog/unreleased/11157 new file mode 100644 index 00000000000..b4078f95d72 --- /dev/null +++ b/changelog/unreleased/11157 @@ -0,0 +1,7 @@ +Change: Remove libcloudproviders integration + +Since its implementation in 2019 our support our for it was 'limited'. +Additionally as far as we can tell it was not picked up by any major Linux distribution. + +https://github.com/owncloud/client/issues/11148 +https://github.com/owncloud/client/pull/11157 diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 275ef4f1488..6aa25c49546 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -192,8 +192,6 @@ endif() install(TARGETS owncloud ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) if(UNIX AND NOT APPLE) - include(libcloudproviders/libcloudproviders.cmake) - configure_file(${CMAKE_SOURCE_DIR}/owncloud.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop DESTINATION ${KDE_INSTALL_DATADIR}/applications ) diff --git a/src/gui/libcloudproviders/cloud-provider.ini.in b/src/gui/libcloudproviders/cloud-provider.ini.in deleted file mode 100644 index 9809ce2191f..00000000000 --- a/src/gui/libcloudproviders/cloud-provider.ini.in +++ /dev/null @@ -1,4 +0,0 @@ -[Cloud Providers] -BusName=@APPLICATION_CLOUDPROVIDERS_DBUS_NAME@ -ObjectPath=@APPLICATION_CLOUDPROVIDERS_DBUS_PATH@ -Version=1 diff --git a/src/gui/libcloudproviders/libcloudproviders.cmake b/src/gui/libcloudproviders/libcloudproviders.cmake deleted file mode 100644 index 1090d2e5d47..00000000000 --- a/src/gui/libcloudproviders/libcloudproviders.cmake +++ /dev/null @@ -1,46 +0,0 @@ -find_package(PkgConfig REQUIRED) -pkg_check_modules(CLOUDPROVIDERS cloudproviders>=0.3 IMPORTED_TARGET) - -if(CLOUDPROVIDERS_FOUND) - pkg_check_modules(GIO REQUIRED gio-2.0 IMPORTED_TARGET) - pkg_check_modules(GLIB2 REQUIRED glib-2.0 IMPORTED_TARGET) -endif() - -set(LIBCLOUDPROVIDERS_POSSIBLE FALSE) -if (TARGET PkgConfig::CLOUDPROVIDERS) - set(LIBCLOUDPROVIDERS_POSSIBLE TRUE) -endif() - -option(WITH_LIBCLOUDPROVIDERS "Whether to bulid with libcloudproviders" ${LIBCLOUDPROVIDERS_POSSIBLE}) - -if(WITH_LIBCLOUDPROVIDERS AND NOT LIBCLOUDPROVIDERS_POSSIBLE) - message(FATAL_ERROR "Trying to enable libcloudproviders but dependencies are missing") -endif() - -if(WITH_LIBCLOUDPROVIDERS) - target_sources(owncloudCore PRIVATE - libcloudproviders/libcloudproviders.cpp - ) - set_source_files_properties( - libcloudproviders/libcloudproviders.cpp - PROPERTIES COMPILE_DEFINITIONS - "APPLICATION_CLOUDPROVIDERS_DBUS_NAME=\"${APPLICATION_CLOUDPROVIDERS_DBUS_NAME}\";APPLICATION_CLOUDPROVIDERS_DBUS_PATH=\"${APPLICATION_CLOUDPROVIDERS_DBUS_PATH}\"" - ) - target_link_libraries(owncloudCore PUBLIC - PkgConfig::CLOUDPROVIDERS - PkgConfig::GLIB2 - PkgConfig::GIO - ) - target_compile_definitions(owncloudCore PRIVATE WITH_LIBCLOUDPROVIDERS) - - configure_file(libcloudproviders/cloud-provider.ini.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_CLOUDPROVIDERS_DBUS_NAME}.ini) - install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_CLOUDPROVIDERS_DBUS_NAME}.ini - DESTINATION "${KDE_INSTALL_DATADIR}/cloud-providers") - - message("Building with libcloudproviders") -elseif(UNIX AND NOT APPLE) - message("Building without libcloudproviders") -endif() - -add_feature_info(Libcloudproviders WITH_LIBCLOUDPROVIDERS "Enable cloud provider integration") diff --git a/src/gui/libcloudproviders/libcloudproviders.cpp b/src/gui/libcloudproviders/libcloudproviders.cpp deleted file mode 100644 index 06bfd400b41..00000000000 --- a/src/gui/libcloudproviders/libcloudproviders.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (C) by Christian Kamm - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#include -#include -#include -#include - -#include "libcloudproviders.h" -#include "libcloudproviders_p.h" - -#include "account.h" -#include "accountmanager.h" -#include "accountstate.h" -#include "folder.h" -#include "folderman.h" - -#include "libsync/theme.h" - -#include - -// These must match the name and path defined in a file in $DATADIR/cloud-providers/ -const gchar dbusName[] = APPLICATION_CLOUDPROVIDERS_DBUS_NAME; -const gchar dbusPath[] = APPLICATION_CLOUDPROVIDERS_DBUS_PATH; - -namespace OCC { - -LibCloudProvidersPrivate::~LibCloudProvidersPrivate() -{ - for (const auto folder : _folderExports.keys()) - unexportFolder(folder); - g_clear_object(&_exporter); - if (_busOwnerId) - g_bus_unown_name(_busOwnerId); -} - -static void onBusAcquired(GDBusConnection *connection, const gchar *, gpointer userData) -{ - auto d = static_cast(userData); - - d->_exporter = cloud_providers_provider_exporter_new(connection, dbusName, dbusPath); - cloud_providers_provider_exporter_set_name(d->_exporter, Theme::instance()->appNameGUI().toUtf8().constData()); - - d->updateExportedFolderList(); -} - -static void onNameLost(GDBusConnection *, const gchar *, gpointer userData) -{ - auto d = static_cast(userData); - - d->_folderExports.clear(); - g_clear_object(&d->_exporter); -} - -void LibCloudProvidersPrivate::start() -{ - _busOwnerId = g_bus_own_name( - G_BUS_TYPE_SESSION, dbusName, G_BUS_NAME_OWNER_FLAGS_NONE, - &onBusAcquired, - nullptr, // onNameAcquired - &onNameLost, - this, // user data - nullptr // user data free func - ); - - auto folderMan = FolderMan::instance(); - connect(folderMan, &FolderMan::folderListChanged, - this, &LibCloudProvidersPrivate::updateExportedFolderList); - connect(folderMan, &FolderMan::folderSyncStateChange, - this, &LibCloudProvidersPrivate::updateFolderExport); -} - -void LibCloudProvidersPrivate::updateExportedFolderList() -{ - const auto newFolders = FolderMan::instance()->folders(); - const auto oldFolders = _folderExports.keys(); - - // Remove folders that are no longer exported - for (const auto old : oldFolders) { - if (!newFolders.contains(old)) - unexportFolder(old); - } - - // Add new folders - for (const auto n : newFolders) { - if (!oldFolders.contains(n)) - exportFolder(n); - } -} - -static void actionDispatcher(GSimpleAction *action, GVariant *, gpointer userData) -{ - gchar *strval; - g_object_get(action, "name", &strval, NULL); - QByteArray name(strval); - g_free(strval); - - auto d = static_cast(userData); - auto q = d->_q; - if (name == "settings") - q->showSettings(); - else - OC_ASSERT_X(false, "unknown action string"); -} - - -void LibCloudProvidersPrivate::exportFolder(Folder *folder) -{ - if (!_exporter) - return; - - GError *error = nullptr; - auto icon = g_icon_new_for_string(Theme::instance()->applicationIconName().toUtf8().constData(), &error); - if (error) { - qWarning() << "Could not create icon for" << Theme::instance()->applicationIconName() << "error" << error->message; - g_error_free(error); - } - - // DBus object paths must not contain characters other than [A-Z][a-z][0-9]_, see g_variant_is_object_path - const QByteArray dBusCompatibleFolderId = folder->id().replace('-', nullptr); - - auto exporter = cloud_providers_account_exporter_new(_exporter, dBusCompatibleFolderId.constData()); - cloud_providers_account_exporter_set_path(exporter, folder->path().toUtf8().constData()); - cloud_providers_account_exporter_set_icon(exporter, icon); - cloud_providers_account_exporter_set_status(exporter, CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE); - - auto menu = g_menu_new(); - // The "cloudprovider" scope is hardcoded into the gtk code that uses this data. - // Different scopes will not work. - g_menu_append(menu, tr("Settings").toUtf8().constData(), "cloudprovider.settings"); - - auto actionGroup = g_simple_action_group_new(); - const GActionEntry entries[] = { - { "settings", actionDispatcher, nullptr, nullptr, nullptr, {}}, - }; - g_action_map_add_action_entries(G_ACTION_MAP(actionGroup), entries, G_N_ELEMENTS(entries), this); - - cloud_providers_account_exporter_set_menu_model(exporter, G_MENU_MODEL(menu)); - cloud_providers_account_exporter_set_action_group(exporter, G_ACTION_GROUP(actionGroup)); - - // Currently there's no reason for us to keep these around: no further modifications are done - g_clear_object(&menu); - g_clear_object(&actionGroup); - - _folderExports[folder] = FolderExport{folder, exporter}; - updateFolderExport(); -} - -void LibCloudProvidersPrivate::unexportFolder(Folder *folder) -{ - if (!_folderExports.contains(folder)) - return; - auto folderExporter = _folderExports[folder]._exporter; - cloud_providers_provider_exporter_remove_account(_exporter, folderExporter); - // the remove_account already calls _unref - _folderExports.remove(folder); -} - -void LibCloudProvidersPrivate::updateFolderExport() -{ - for (auto folderExport : _folderExports) { - if (!folderExport._folder) - continue; - Folder *folder = folderExport._folder; - - // Update the name, may change if accounts are added/removed - QString displayName = folder->displayName(); - if (AccountManager::instance()->accounts().size() > 1) { - displayName = QStringLiteral("%1 (%2)").arg( - displayName, folder->accountState()->account()->displayName()); - } - cloud_providers_account_exporter_set_name(folderExport._exporter, displayName.toUtf8().constData()); - - CloudProvidersAccountStatus status = CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID; - auto syncResult = folder->syncResult(); - switch (syncResult.status()) { - case SyncResult::Undefined: - status = CLOUD_PROVIDERS_ACCOUNT_STATUS_INVALID; - break; - case SyncResult::NotYetStarted: - case SyncResult::Success: - case SyncResult::Problem: - status = CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE; - break; - case SyncResult::SyncPrepare: - case SyncResult::SyncRunning: - case SyncResult::SyncAbortRequested: - status = CLOUD_PROVIDERS_ACCOUNT_STATUS_SYNCING; - break; - case SyncResult::Error: - case SyncResult::SetupError: - status = CLOUD_PROVIDERS_ACCOUNT_STATUS_ERROR; - break; - case SyncResult::Paused: - [[fallthrough]]; - case SyncResult::Offline: - // There's no status that fits exactly. If our choice is only - // between IDLE And ERROR, let's go for ERROR to show that no - // syncing is happening. - status = CLOUD_PROVIDERS_ACCOUNT_STATUS_ERROR; - break; - } - - // Similarly to Paused: If disconnected, show something's wrong! - if (!folder->accountState()->isConnected()) - status = CLOUD_PROVIDERS_ACCOUNT_STATUS_ERROR; - - auto message = FolderMan::trayTooltipStatusString( - syncResult, - folder->syncPaused()); - - cloud_providers_account_exporter_set_status(folderExport._exporter, status); - cloud_providers_account_exporter_set_status_details(folderExport._exporter, message.toUtf8().constData()); - } -} - -LibCloudProviders::LibCloudProviders(QObject *parent) - : QObject(parent) - , d_ptr(new LibCloudProvidersPrivate) -{ - d_ptr->_q = this; -} - -void LibCloudProviders::start() -{ - d_ptr->start(); -} - -} // namespace OCC diff --git a/src/gui/libcloudproviders/libcloudproviders.h b/src/gui/libcloudproviders/libcloudproviders.h deleted file mode 100644 index 6f57b698530..00000000000 --- a/src/gui/libcloudproviders/libcloudproviders.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) by Christian Kamm - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#pragma once - -#include -#include - -namespace OCC { - -class LibCloudProvidersPrivate; - -/** Exports sync folders to dbus with libcloudproviders */ -class LibCloudProviders : public QObject -{ - Q_OBJECT - - QScopedPointer d_ptr; -public: - explicit LibCloudProviders(QObject *parent = nullptr); - - void start(); - -signals: - void showSettings(); -}; - -} // namespace OCC diff --git a/src/gui/libcloudproviders/libcloudproviders_p.h b/src/gui/libcloudproviders/libcloudproviders_p.h deleted file mode 100644 index cfd7db9ff2f..00000000000 --- a/src/gui/libcloudproviders/libcloudproviders_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) by Christian Kamm - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#pragma once - -#include -#include -#include -#include - -// Manual forward declares to avoid pulling in C headers that don't -// work well with moc (like due to use of "signals" as an identifier). -typedef struct _CloudProvidersProviderExporter CloudProvidersProviderExporter; -typedef struct _CloudProvidersAccountExporter CloudProvidersAccountExporter; - -// There's a naming mixup. -// What libcloudproviders calls "Provider" is not our Account, but "the ownCloud client" -// What libcloudproviders calls "Account" we call Folder - -namespace OCC { - -class LibCloudProviders; -class Folder; - -class LibCloudProvidersPrivate : public QObject -{ - Q_OBJECT -public: - ~LibCloudProvidersPrivate(); - - void start(); - - void exportFolder(Folder *folder); - void unexportFolder(Folder *folder); - - struct FolderExport - { - /** Can become zero when parent folder is removed, check before use */ - QPointer _folder; - - /** For updating exported folder information */ - CloudProvidersAccountExporter *_exporter; - }; - - /** DBus id so exporting can stop on error or destruction */ - uint _busOwnerId = 0; - - /** Exporter for the whole client. */ - CloudProvidersProviderExporter *_exporter = nullptr; - - /** Each folder's exporter for later updating. */ - QMap _folderExports; - - LibCloudProviders *_q = nullptr; - -public slots: - void updateExportedFolderList(); - void updateFolderExport(); -}; - -} // namespace OCC diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 9517fdb00b3..4bb75198df1 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -48,11 +48,6 @@ #include #include -#ifdef WITH_LIBCLOUDPROVIDERS -#include "libcloudproviders/libcloudproviders.h" -#endif - - #ifdef Q_OS_WIN #include #endif @@ -135,12 +130,6 @@ ownCloudGui::ownCloudGui(Application *parent) _tray->show(); -#ifdef WITH_LIBCLOUDPROVIDERS - auto exporter = new LibCloudProviders(this); - exporter->start(); - connect(exporter, &LibCloudProviders::showSettings, this, &ownCloudGui::slotShowSettings); -#endif - ProgressDispatcher *pd = ProgressDispatcher::instance(); connect(pd, &ProgressDispatcher::progressInfo, this, &ownCloudGui::slotUpdateProgress);