[Sharing] Files should not have create permissions

This commit is contained in:
Roeland Jago Douma 2015-11-30 15:47:10 +01:00
parent 0b5b4a5eea
commit b033a8e731

View file

@ -213,13 +213,17 @@ ShareWidget::ShareWidget(QSharedPointer<Share> share,
QMenu *menu = new QMenu(this);
_permissionCreate = new QAction(tr("create"), this);
_permissionCreate->setCheckable(true);
menu->addAction(_permissionCreate);
_permissionUpdate = new QAction(tr("change"), this);
_permissionUpdate->setCheckable(true);
menu->addAction(_permissionUpdate);
_permissionDelete = new QAction(tr("delete"), this);
_permissionDelete->setCheckable(true);
menu->addAction(_permissionUpdate);
/*
* Files can't have create or delete permissions
*/
if (!_isFile) {
menu->addAction(_permissionCreate);
menu->addAction(_permissionDelete);
}
_ui->permissionToolButton->setMenu(menu);
@ -266,10 +270,13 @@ void ShareWidget::slotEditPermissionsChanged()
}
if (_ui->permissionsEdit->checkState() == Qt::Checked) {
permissions |= Share::PermissionCreate;
permissions |= Share::PermissionUpdate;
/*
* Files can't have create or delete permisisons
*/
if (!_isFile) {
permissions |= Share::PermissionCreate;
permissions |= Share::PermissionDelete;
}
}
@ -350,7 +357,7 @@ void ShareWidget::displayPermissions()
_permissionUpdate->setChecked(true);
_ui->permissionsEdit->setCheckState(Qt::Checked);
}
if (_share->getPermissions() & Share::PermissionCreate) {
if (!_isFile && _share->getPermissions() & Share::PermissionCreate) {
_permissionCreate->setChecked(true);
_ui->permissionsEdit->setCheckState(Qt::Checked);
}