Skip to content

Commit

Permalink
Merge branch 'master' into rakekniven-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rakekniven authored May 25, 2022
2 parents 2528247 + 2f96f63 commit 792cdda
Show file tree
Hide file tree
Showing 120 changed files with 14,666 additions and 10,817 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/fixup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization

name: Pull request checks

on: pull_request

jobs:
commit-message-check:
name: Block fixup and squash commits

runs-on: ubuntu-latest

steps:
- name: Run check
uses: xt0rted/block-autosquash-commits-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion admin/win/msi/Nextcloud.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<Custom Action="RegistryCleanupCustomAction" After="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>

<!-- Schedule Reboot for the Shell Extensions (in silent installation mode only, or if SCHEDULE_REBOOT argument is set-->
<ScheduleReboot After="InstallFinalize">(SCHEDULE_REBOOT=1) OR NOT (UILevel=2)</ScheduleReboot>
<ScheduleReboot After="InstallFinalize">(SCHEDULE_REBOOT=1) OR (NOT (UILevel=2) AND NOT (DO_NOT_REBOOT_IN_SILENT=1))</ScheduleReboot>
</InstallExecuteSequence>

<!-- "Add or Remove" Programs Entries -->
Expand Down
16 changes: 13 additions & 3 deletions doc/autoupdate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@ itself. Should the silent update fail, the client offers a manual download.
macOS
^^^^^

There is no automatic updater on macOS. If a new update is available,
the Nextcloud client initializes a pop-up dialog to alert you of the
update and requesting that you update to the latest version manually.
The macOS client has an autoupdater which uses the Sparkle framework.
This autoupdater is bundled into the client App Bundle and checks for updates
on launch, notifying you if an update is available. This will present a pop-up
that can let you automatically download and install the latest client update
with one click.

In versions of the client where the Sparkle-based autoupdater is not bundled,
a clickable notification will appear informing of an update being available.
Upon clicking on said notification, the download page for the latest version
of the client will be opened in the system's web browser.

Like on other systems, you can view the update status under
``Settings -> General -> Updates`` in the Nextcloud client.

Linux
^^^^^
Expand Down
2 changes: 1 addition & 1 deletion doc/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ System Requirements
----------------------------------

- Windows 8.1+
- macOS 10.12+ (64-bit only)
- macOS 10.14+ (64-bit only)
- Linux
- FreeBSD

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,17 @@ - (void)restart
- (void)closeConnection
{
NSLog(@"Closing connection.");
dispatch_source_cancel(self.readSource);
dispatch_source_cancel(self.writeSource);
self.readSource = nil;
self.writeSource = nil;

if(self.readSource) {
dispatch_source_cancel(self.readSource);
self.readSource = nil;
}

if(self.writeSource) {
dispatch_source_cancel(self.writeSource);
self.writeSource = nil;
}

[self.inBuffer setLength:0];
[self.outBuffer setLength: 0];

Expand Down Expand Up @@ -200,9 +207,9 @@ - (void)writeToSocket
NSLog(@"About to write %li bytes from outbuffer to socket.", [self.outBuffer length]);

long bytesWritten = write(self.sock, [self.outBuffer bytes], [self.outBuffer length]);
char lineWritten[4096];
char lineWritten[[self.outBuffer length]];
memcpy(lineWritten, [self.outBuffer bytes], [self.outBuffer length]);
NSLog(@"Wrote %li bytes to socket. Line was: '%@'", bytesWritten, [NSString stringWithUTF8String:lineWritten]);
NSLog(@"Wrote %li bytes to socket. Line written was: '%@'", bytesWritten, [NSString stringWithUTF8String:lineWritten]);

if(bytesWritten == 0) {
// 0 means we reached "end of file" and thus the socket was closed. So let's restart it
Expand Down
20 changes: 10 additions & 10 deletions src/common/vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,24 @@ class OCSYNC_EXPORT Vfs : public QObject
* If the remote metadata changes, the local placeholder's metadata should possibly
* change as well.
*/
virtual Q_REQUIRED_RESULT Result<void, QString> updateMetadata(const QString &filePath, time_t modtime, qint64 size, const QByteArray &fileId) = 0;
Q_REQUIRED_RESULT virtual Result<void, QString> updateMetadata(const QString &filePath, time_t modtime, qint64 size, const QByteArray &fileId) = 0;

/// Create a new dehydrated placeholder. Called from PropagateDownload.
virtual Q_REQUIRED_RESULT Result<void, QString> createPlaceholder(const SyncFileItem &item) = 0;
Q_REQUIRED_RESULT virtual Result<void, QString> createPlaceholder(const SyncFileItem &item) = 0;

/** Convert a hydrated placeholder to a dehydrated one. Called from PropagateDownlaod.
*
* This is different from delete+create because preserving some file metadata
* (like pin states) may be essential for some vfs plugins.
*/
virtual Q_REQUIRED_RESULT Result<void, QString> dehydratePlaceholder(const SyncFileItem &item) = 0;
Q_REQUIRED_RESULT virtual Result<void, QString> dehydratePlaceholder(const SyncFileItem &item) = 0;

/** Discovery hook: even unchanged files may need UPDATE_METADATA.
*
* For instance cfapi vfs wants local hydrated non-placeholder files to
* become hydrated placeholder files.
*/
virtual Q_REQUIRED_RESULT bool needsMetadataUpdate(const SyncFileItem &item) = 0;
Q_REQUIRED_RESULT virtual bool needsMetadataUpdate(const SyncFileItem &item) = 0;

/** Convert a new file to a hydrated placeholder.
*
Expand All @@ -200,13 +200,13 @@ class OCSYNC_EXPORT Vfs : public QObject
* new placeholder shall supersede, for rename-replace actions with new downloads,
* for example.
*/
virtual Q_REQUIRED_RESULT Result<Vfs::ConvertToPlaceholderResult, QString> convertToPlaceholder(
Q_REQUIRED_RESULT virtual Result<Vfs::ConvertToPlaceholderResult, QString> convertToPlaceholder(
const QString &filename,
const SyncFileItem &item,
const QString &replacesFile = QString()) = 0;

/// Determine whether the file at the given absolute path is a dehydrated placeholder.
virtual Q_REQUIRED_RESULT bool isDehydratedPlaceholder(const QString &filePath) = 0;
Q_REQUIRED_RESULT virtual bool isDehydratedPlaceholder(const QString &filePath) = 0;

/** Similar to isDehydratedPlaceholder() but used from sync discovery.
*
Expand All @@ -215,7 +215,7 @@ class OCSYNC_EXPORT Vfs : public QObject
*
* Returning true means that type was fully determined.
*/
virtual Q_REQUIRED_RESULT bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) = 0;
Q_REQUIRED_RESULT virtual bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) = 0;

/** Sets the pin state for the item at a path.
*
Expand All @@ -226,7 +226,7 @@ class OCSYNC_EXPORT Vfs : public QObject
*
* folderPath is relative to the sync folder. Can be "" for root folder.
*/
virtual Q_REQUIRED_RESULT bool setPinState(const QString &folderPath, PinState state) = 0;
Q_REQUIRED_RESULT virtual bool setPinState(const QString &folderPath, PinState state) = 0;

/** Returns the pin state of an item at a path.
*
Expand All @@ -237,7 +237,7 @@ class OCSYNC_EXPORT Vfs : public QObject
*
* Returns none on retrieval error.
*/
virtual Q_REQUIRED_RESULT Optional<PinState> pinState(const QString &folderPath) = 0;
Q_REQUIRED_RESULT virtual Optional<PinState> pinState(const QString &folderPath) = 0;

/** Returns availability status of an item at a path.
*
Expand All @@ -246,7 +246,7 @@ class OCSYNC_EXPORT Vfs : public QObject
*
* folderPath is relative to the sync folder. Can be "" for root folder.
*/
virtual Q_REQUIRED_RESULT AvailabilityResult availability(const QString &folderPath) = 0;
Q_REQUIRED_RESULT virtual AvailabilityResult availability(const QString &folderPath) = 0;

public slots:
/** Update in-sync state based on SyncFileStatusTracker signal.
Expand Down
20 changes: 15 additions & 5 deletions src/csync/csync_exclude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
// as '.' is a separator that is not stored internally, so let's
// not allow to sync those to avoid file loss/ambiguities (#416)
if (blen > 1) {
if (bname.at(blen - 1) == QLatin1Char(' ')) {
return CSYNC_FILE_EXCLUDE_TRAILING_SPACE;
} else if (bname.at(blen - 1) == QLatin1Char('.')) {
if (bname.at(blen - 1) == QLatin1Char('.')) {
return CSYNC_FILE_EXCLUDE_INVALID_CHAR;
}
}
Expand Down Expand Up @@ -320,14 +318,26 @@ bool ExcludedFiles::reloadExcludeFiles()
bool success = true;
const auto keys = _excludeFiles.keys();
for (const auto& basePath : keys) {
for (const auto &excludeFile : _excludeFiles.value(basePath)) {
const auto itValue = _excludeFiles.find(basePath);
if (itValue == std::end(_excludeFiles)) {
continue;
}
auto &excludeFiles = *itValue;
for (auto excludeFileIt = std::begin(excludeFiles); excludeFileIt != std::end(excludeFiles); ) {
const auto &excludeFile = *excludeFileIt;
QFile file(excludeFile);
if (file.exists() && file.open(QIODevice::ReadOnly)) {
if (!file.exists()) {
excludeFileIt = excludeFiles.erase(excludeFileIt);
continue;
}

if (file.open(QIODevice::ReadOnly)) {
loadExcludeFilePatterns(basePath, file);
} else {
success = false;
qWarning() << "System exclude list file could not be opened:" << excludeFile;
}
++excludeFileIt;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/csync/csync_exclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ enum CSYNC_EXCLUDE_TYPE {
CSYNC_FILE_EXCLUDE_CONFLICT,
CSYNC_FILE_EXCLUDE_CANNOT_ENCODE,
CSYNC_FILE_EXCLUDE_SERVER_BLACKLISTED,
CSYNC_FILE_EXCLUDE_LEADING_SPACE,
CSYNC_FILE_EXCLUDE_LEADING_AND_TRAILING_SPACE,
};

class ExcludedFilesTest;
Expand Down
2 changes: 0 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ set(client_SRCS
tray/usermodel.cpp
tray/notificationhandler.h
tray/notificationhandler.cpp
tray/notificationcache.h
tray/notificationcache.cpp
creds/credentialsfactory.h
tray/talkreply.cpp
creds/credentialsfactory.cpp
Expand Down
8 changes: 8 additions & 0 deletions src/gui/accountstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "logger.h"
#include "configfile.h"
#include "ocsnavigationappsjob.h"
#include "ocsuserstatusconnector.h"
#include "pushnotifications.h"

#include <QSettings>
Expand Down Expand Up @@ -58,6 +59,8 @@ AccountState::AccountState(AccountPtr account)
this, &AccountState::slotCredentialsAsked);
connect(account.data(), &Account::pushNotificationsReady,
this, &AccountState::slotPushNotificationsReady);
connect(account.data(), &Account::serverUserStatusChanged, this,
&AccountState::slotServerUserStatusChanged);

connect(this, &AccountState::isConnectedChanged, [=]{
// Get the Apps available on the server if we're now connected.
Expand Down Expand Up @@ -558,6 +561,11 @@ void AccountState::slotPushNotificationsReady()
}
}

void AccountState::slotServerUserStatusChanged()
{
setDesktopNotificationsAllowed(_account->userStatusConnector()->userStatus().state() != UserStatus::OnlineStatus::DoNotDisturb);
}

void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int statusCode)
{
if(_account){
Expand Down
1 change: 1 addition & 0 deletions src/gui/accountstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ private Q_SLOTS:

void slotCheckConnection();
void slotPushNotificationsReady();
void slotServerUserStatusChanged();

private:
AccountPtr _account;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/creds/webflowcredentialsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ WebFlowCredentialsDialog::WebFlowCredentialsDialog(Account *account, bool useFlo
} else {
#ifdef WITH_WEBENGINE
_webView = new WebView();
_containerLayout->addWidget(_webView);
_containerLayout->addWidget(_webView, 1);

connect(_webView, &WebView::urlCatched, this, &WebFlowCredentialsDialog::urlCatched);
#endif // WITH_WEBENGINE
Expand Down
5 changes: 5 additions & 0 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,11 @@ void Folder::scheduleThisFolderSoon()
}
}

void Folder::acceptInvalidFileName(const QString &filePath)
{
_engine->addAcceptedInvalidFileName(filePath);
}

void Folder::setSaveBackwardsCompatible(bool save)
{
_saveBackwardsCompatible = save;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ class Folder : public QObject
*/
void scheduleThisFolderSoon();

void acceptInvalidFileName(const QString &filePath);

/**
* Migration: When this flag is true, this folder will save to
* the backwards-compatible 'Folders' section in the config file.
Expand Down
Loading

0 comments on commit 792cdda

Please sign in to comment.