mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Account Settings: Add a context menu entry to enable or disable virtual files
Issue #6725
This commit is contained in:
parent
a7a7fc2a03
commit
6ca5facbaf
@ -33,6 +33,7 @@
|
||||
#include "creds/httpcredentialsgui.h"
|
||||
#include "tooltipupdater.h"
|
||||
#include "filesystem.h"
|
||||
#include "wizard/owncloudwizard.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -306,7 +307,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
|
||||
|
||||
if (!folderPaused) {
|
||||
ac = menu->addAction(tr("Force sync now"));
|
||||
if (folderMan->currentSyncFolder() == folderMan->folder(alias)) {
|
||||
if (folderMan->currentSyncFolder() == folder) {
|
||||
ac->setText(tr("Restart sync"));
|
||||
}
|
||||
ac->setEnabled(folderConnected);
|
||||
@ -318,6 +319,29 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
|
||||
|
||||
ac = menu->addAction(tr("Remove folder sync connection"));
|
||||
connect(ac, &QAction::triggered, this, &AccountSettings::slotRemoveCurrentFolder);
|
||||
|
||||
if (ConfigFile().showExperimentalOptions() || folder->useVirtualFiles()) {
|
||||
ac = menu->addAction(tr("Create virtual files for new files (Experimental)"));
|
||||
ac->setCheckable(true);
|
||||
ac->setChecked(folder->useVirtualFiles());
|
||||
connect(ac, &QAction::toggled, this, [folder, this](bool checked) {
|
||||
if (!checked) {
|
||||
if (folder)
|
||||
folder->setUseVirtualFiles(false);
|
||||
// Make sure the size is recomputed as the virtual file indicator changes
|
||||
ui->_folderList->doItemsLayout();
|
||||
return;
|
||||
}
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature([folder, this](bool enable) {
|
||||
if (enable && folder)
|
||||
folder->setUseVirtualFiles(enable);
|
||||
// Make sure the size is recomputed as the virtual file indicator changes
|
||||
ui->_folderList->doItemsLayout();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
menu->popup(tv->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
|
||||
@ -534,6 +534,13 @@ void Folder::downloadVirtualFile(const QString &_relativepath)
|
||||
slotScheduleThisFolder();
|
||||
}
|
||||
|
||||
|
||||
void Folder::setUseVirtualFiles(bool enabled)
|
||||
{
|
||||
_definition.useVirtualFiles = enabled;
|
||||
saveToSettings();
|
||||
}
|
||||
|
||||
void Folder::saveToSettings() const
|
||||
{
|
||||
// Remove first to make sure we don't get duplicates
|
||||
|
||||
@ -244,6 +244,7 @@ public:
|
||||
|
||||
/** new files are downloaded as virtual files */
|
||||
bool useVirtualFiles() { return _definition.useVirtualFiles; }
|
||||
void setUseVirtualFiles(bool enabled);
|
||||
|
||||
signals:
|
||||
void syncStateChange();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user