Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Sep 1, 2023
2 parents 9417872 + 745f12b commit 44fdf26
Show file tree
Hide file tree
Showing 59 changed files with 14,593 additions and 23,265 deletions.
2 changes: 1 addition & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions THEME.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/11157
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions changelog/unreleased/11162
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Hydration state of file after a directory was replaced with a file

If a synced directory was replaced with a file on the server, we downloaded it instead of
replacing the folder with a VirtualFile placeholder.

https://github.com/owncloud/client/pull/11162
2 changes: 0 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
16 changes: 10 additions & 6 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,9 @@ ownCloudGui *Application::gui() const

Application *Application::_instance = nullptr;

Application::Application(Platform *platform, bool debugMode, QObject *parent)
: QObject(parent)
, _debugMode(debugMode)
Application::Application(Platform *platform, bool debugMode)
: _debugMode(debugMode)
{
Q_ASSERT(!_instance);
_instance = this;

platform->migrate();

setupTranslations();
Expand Down Expand Up @@ -401,4 +397,12 @@ bool Application::eventFilter(QObject *obj, QEvent *event)
#endif
return QObject::eventFilter(obj, event);
}

std::unique_ptr<Application> Application::createInstance(Platform *platform, bool debugMode)
{
Q_ASSERT(!_instance);
_instance = new Application(platform, debugMode);
return std::unique_ptr<Application>(_instance);
}

} // namespace OCC
4 changes: 3 additions & 1 deletion src/gui/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Application : public QObject
{
Q_OBJECT
public:
explicit Application(Platform *platform, bool debugMode, QObject *parent);
static std::unique_ptr<Application> createInstance(Platform *platform, bool debugMode);
~Application();

bool debugMode();
Expand Down Expand Up @@ -83,6 +83,8 @@ protected slots:
void slotAccountStateRemoved() const;

private:
explicit Application(Platform *platform, bool debugMode);

QPointer<ownCloudGui> _gui = {};

const bool _debugMode = false;
Expand Down
61 changes: 40 additions & 21 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ Folder::~Folder()
_engine.reset();
}

Result<void, QString> Folder::checkPathLength(const QString &path)
{
#ifdef Q_OS_WIN
if (path.size() > MAX_PATH) {
if (!FileSystem::longPathsEnabledOnWindows()) {
return tr("The path '%1' is too long. Please enable long paths in the Windows settings or choose a different folder.").arg(path);
}
}
#endif
return {};
}

bool Folder::checkLocalPath()
{
#ifdef Q_OS_WIN
Expand All @@ -214,14 +226,10 @@ bool Folder::checkLocalPath()

QString error;
if (fi.isDir() && fi.isReadable() && fi.isWritable()) {
#ifdef Q_OS_WIN
if (_canonicalLocalPath.size() > MAX_PATH) {
if (!FileSystem::longPathsEnabledOnWindows()) {
error =
tr("The path '%1' is too long. Please enable long paths in the Windows settings or choose a different folder.").arg(_canonicalLocalPath);
}
auto pathLenghtCheck = checkPathLength(_canonicalLocalPath);
if (!pathLenghtCheck) {
error = pathLenghtCheck.error();
}
#endif

if (error.isEmpty()) {
qCDebug(lcFolder) << "Checked local path ok";
Expand Down Expand Up @@ -915,7 +923,12 @@ void Folder::startSync()
Q_ASSERT(_folderWatcher);

if (!OC_ENSURE(!isSyncRunning())) {
qCCritical(lcFolder) << "ERROR csync is still running and new sync requested.";
qCCritical(lcFolder) << "ERROR sync is still running and new sync requested.";
return;
}

if (!OC_ENSURE(canSync())) {
qCCritical(lcFolder) << "ERROR folder is currently not sync able.";
return;
}

Expand Down Expand Up @@ -1235,6 +1248,10 @@ bool Folder::virtualFilesEnabled() const

void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction)
{
if (_removeAllFilesDialog) {
ocApp()->gui()->raiseDialog(_removeAllFilesDialog);
return;
}
const QString msg = [direction] {
if (direction == SyncFileItem::Down) {
return tr("All files in the sync folder '%1' folder were deleted on the server.\n"
Expand All @@ -1249,16 +1266,16 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction)
"If this was an accident and you decide to keep your files, they will be re-synced from the server.");
}
}();
auto msgBox = new QMessageBox(QMessageBox::Warning, tr("Remove All Files?"),
msg.arg(shortGuiLocalPath()), QMessageBox::NoButton, ocApp()->gui()->settingsDialog());
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setWindowFlags(msgBox->windowFlags() | Qt::WindowStaysOnTopHint);
msgBox->addButton(tr("Remove all files"), QMessageBox::DestructiveRole);
QPushButton *keepBtn = msgBox->addButton(tr("Keep files"), QMessageBox::AcceptRole);
msgBox->setDefaultButton(keepBtn);
_removeAllFilesDialog =
new QMessageBox(QMessageBox::Warning, tr("Remove All Files?"), msg.arg(shortGuiLocalPath()), QMessageBox::NoButton, ocApp()->gui()->settingsDialog());
_removeAllFilesDialog->setAttribute(Qt::WA_DeleteOnClose);
_removeAllFilesDialog->setWindowFlags(_removeAllFilesDialog->windowFlags() | Qt::WindowStaysOnTopHint);
_removeAllFilesDialog->addButton(tr("Remove all files"), QMessageBox::DestructiveRole);
QPushButton *keepBtn = _removeAllFilesDialog->addButton(tr("Keep files"), QMessageBox::AcceptRole);
_removeAllFilesDialog->setDefaultButton(keepBtn);
setSyncPaused(true);
connect(msgBox, &QMessageBox::finished, this, [msgBox, keepBtn, this] {
if (msgBox->clickedButton() == keepBtn) {
connect(_removeAllFilesDialog, &QMessageBox::finished, this, [keepBtn, this] {
if (_removeAllFilesDialog->clickedButton() == keepBtn) {
// reset the db upload all local files or download all remote files
FileSystem::setFolderMinimumPermissions(path());
// will remove placeholders in the next sync
Expand All @@ -1270,11 +1287,13 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction)
_allowRemoveAllOnce = true;
// the only way we end up in here is that the folder was not paused
setSyncPaused(false);
FolderMan::instance()->scheduler()->enqueueFolder(this);
if (canSync()) {
FolderMan::instance()->scheduler()->enqueueFolder(this);
}
});
connect(this, &Folder::destroyed, msgBox, &QMessageBox::deleteLater);
msgBox->open();
ownCloudGui::raiseDialog(msgBox);
connect(this, &Folder::destroyed, _removeAllFilesDialog, &QMessageBox::deleteLater);
_removeAllFilesDialog->open();
ownCloudGui::raiseDialog(_removeAllFilesDialog);
}

FolderDefinition::FolderDefinition(const QByteArray &id, const QUrl &davUrl, const QString &spaceId, const QString &displayName)
Expand Down
4 changes: 4 additions & 0 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ class Folder : public QObject
return _definition.setPriority(p);
}

static Result<void, QString> checkPathLength(const QString &path);

signals:
void syncStateChange();
void syncStarted();
Expand Down Expand Up @@ -527,6 +529,8 @@ private slots:
*/
QSharedPointer<Vfs> _vfs;

QPointer<QMessageBox> _removeAllFilesDialog;

// allow that all files are removed in the next run
bool _allowRemoveAllOnce = false;

Expand Down
25 changes: 14 additions & 11 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,11 @@ const SyncResult &TrayOverallStatusResult::overallStatus() const

FolderMan *FolderMan::_instance = nullptr;

FolderMan::FolderMan(QObject *parent)
: QObject(parent)
, _lockWatcher(new LockWatcher)
FolderMan::FolderMan()
: _lockWatcher(new LockWatcher)
, _scheduler(new SyncScheduler(this))
, _appRestartRequired(false)
{
OC_ASSERT(!_instance);
_instance = this;

_socketApi.reset(new SocketApi);

connect(AccountManager::instance(), &AccountManager::accountRemoved,
Expand Down Expand Up @@ -736,13 +732,13 @@ QString FolderMan::checkPathValidityRecursive(const QString &path)

#ifdef Q_OS_WIN
Utility::NtfsPermissionLookupRAII ntfs_perm;
#endif

if (path.size() > MAX_PATH) {
if (!FileSystem::longPathsEnabledOnWindows()) {
return tr("The path '%1' is too long. Please enable long paths in the Windows settings or choose a different folder.").arg(path);
}
auto pathLenghtCheck = Folder::checkPathLength(path);
if (!pathLenghtCheck) {
return pathLenghtCheck.error();
}
#endif

const QFileInfo selFile(path);
if (numberOfSyncJournals(selFile.filePath()) != 0) {
return FolderMan::tr("The folder %1 is used in a folder sync connection!").arg(QDir::toNativeSeparators(selFile.filePath()));
Expand Down Expand Up @@ -955,4 +951,11 @@ bool FolderMan::prepareFolder(const QString &folder)
return true;
}

std::unique_ptr<FolderMan> FolderMan::createInstance()
{
OC_ASSERT(!_instance);
_instance = new FolderMan();
return std::unique_ptr<FolderMan>(_instance);
}

} // namespace OCC
4 changes: 3 additions & 1 deletion src/gui/folderman.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class FolderMan : public QObject

static QString checkPathValidityRecursive(const QString &path);

explicit FolderMan(QObject *parent = nullptr);
static std::unique_ptr<FolderMan> createInstance();
~FolderMan() override;

/**
Expand Down Expand Up @@ -277,6 +277,8 @@ private slots:
void slotServerVersionChanged(Account *account);

private:
explicit FolderMan();

/** Adds a new folder, does not add it to the account settings and
* does not set an account on the new folder.
*/
Expand Down
4 changes: 0 additions & 4 deletions src/gui/libcloudproviders/cloud-provider.ini.in

This file was deleted.

46 changes: 0 additions & 46 deletions src/gui/libcloudproviders/libcloudproviders.cmake

This file was deleted.

Loading

0 comments on commit 44fdf26

Please sign in to comment.