Skip to content

Commit

Permalink
Allow branding to disable move-to-trash
Browse files Browse the repository at this point in the history
Fixes: #11378
  • Loading branch information
erikjv authored and TheOneRing committed Jan 5, 2024
1 parent ec3c924 commit b0b4911
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ GeneralSettings::GeneralSettings(QWidget *parent)

_ui->crashreporterCheckBox->setVisible(Theme::instance()->withCrashReporter());

_ui->moveToTrashCheckBox->setVisible(Theme::instance()->enableMoveToTrash());
connect(_ui->moveToTrashCheckBox, &QCheckBox::toggled, this, [this](bool checked) {
ConfigFile().setMoveToTrash(checked);
Q_EMIT syncOptionsChanged();
Expand Down
6 changes: 5 additions & 1 deletion src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,11 @@ void ConfigFile::setConfirmExternalStorage(bool isChecked)

bool ConfigFile::moveToTrash() const
{
return getValue(moveToTrashC(), QString(), false).toBool();
if (Theme::instance()->enableMoveToTrash()) {
return getValue(moveToTrashC(), QString(), false).toBool();
}

return false;
}

void ConfigFile::setMoveToTrash(bool isChecked)
Expand Down
5 changes: 5 additions & 0 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,11 @@ QVector<std::tuple<QString, QString, QUrl>> Theme::urlButtons() const
return {};
}

bool Theme::enableMoveToTrash() const
{
return true;
}

bool Theme::enableCernBranding() const
{
return false;
Expand Down
6 changes: 6 additions & 0 deletions src/libsync/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject
virtual QVector<std::tuple<QString, QString, QUrl>> urlButtons() const;


/**
* Whether or not to enable move-to-trash instead of deleting files that are gone from the server.
* Default: true
*/
virtual bool enableMoveToTrash() const;

/**
* Whether to enable the special code for cernbox
* This includes:
Expand Down

0 comments on commit b0b4911

Please sign in to comment.