Skip to content

Commit

Permalink
Fix placeholders are reverted to OnlineOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Sep 14, 2020
1 parent f294fef commit a9b7815
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/7779
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Legacy config migration reverted files to only only

We fixed a legacy config migration which revertd all files to online only on
every start.

https://github.com/owncloud/client/issues/7779
11 changes: 0 additions & 11 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,6 @@ void Folder::setSupportsVirtualFiles(bool enabled)
}
}

bool Folder::newFilesAreVirtual() const
{
if (!supportsVirtualFiles())
return false;
auto pinState = _vfs->pinState(QString());
return pinState && *pinState == PinState::OnlineOnly;
}

void Folder::setRootPinState(PinState state)
{
_vfs->setPinState(QString(), state);
Expand Down Expand Up @@ -708,9 +700,6 @@ void Folder::saveToSettings() const
settings->beginGroup(FolderMan::escapeAlias(_definition.alias));
FolderDefinition::save(*settings, _definition);

// Technically redundant, just for older clients
settings->setValue(QLatin1String("usePlaceholders"), newFilesAreVirtual());

settings->sync();
qCInfo(lcFolder) << "Saved folder" << _definition.alias << "to settings, status" << settings->status();
}
Expand Down
6 changes: 0 additions & 6 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,6 @@ class Folder : public QObject
bool supportsVirtualFiles() const;
void setSupportsVirtualFiles(bool enabled);

/** whether new remote files shall become virtual locally
*
* This happens when the root folder pin state is OnlineOnly, but can be
* overridden by explicit subfolder pin states.
*/
bool newFilesAreVirtual() const;
void setRootPinState(PinState state);

/** Whether user desires a switch that couldn't be executed yet, see member */
Expand Down
2 changes: 2 additions & 0 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
// Migrate the old "usePlaceholders" setting to the root folder pin state
if (settings.value(QLatin1String(versionC), 1).toInt() == 1
&& settings.value(QLatin1String("usePlaceholders"), false).toBool()) {
qCInfo(lcFolderMan) << "Migrate: From usePlaceholders to PinState::OnlineOnly";
f->setRootPinState(PinState::OnlineOnly);
settings.remove(QStringLiteral("usePlaceholders"));
}

// Migration: Mark folders that shall be saved in a backwards-compatible way
Expand Down

0 comments on commit a9b7815

Please sign in to comment.