[DeckStorage] Distinguish an inherited public state in the visibility column

The column reported the effective state while publishing toggles the node's
own bit, so a private deck inside a public folder already read 'Public' and
toggling appeared to do nothing (and toggling again silently unpublished
it). The cell now shows 'Public (inherited)' for that case and the tooltip
explains why.
This commit is contained in:
Lukas Brübach 2026-09-19 07:48:33 +02:00 committed by GitHub
parent 876e5e860e
commit 5e356ba4b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -135,7 +135,12 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
case 0:
return node->getName();
case 3:
return isEffectivelyPublic(node) ? tr("Public") : tr("Private");
// Report the node's own bit, not the inherited effective
// state, so it stays in step with what publishing toggles.
if (node->isPublic()) {
return tr("Public");
}
return isEffectivelyPublic(node) ? tr("Public (inherited)") : tr("Private");
default:
return QVariant();
}
@ -144,8 +149,12 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
return index.column() == 0 ? dirIcon : QVariant();
case Qt::ToolTipRole:
if (index.column() == 3) {
return isEffectivelyPublic(node) ? tr("This folder is visible to other users")
: tr("This folder is only visible to you");
if (node->isPublic()) {
return tr("This folder is visible to other users");
}
return isEffectivelyPublic(node)
? tr("This folder is private, but a parent folder is public (inherited).")
: tr("This folder is only visible to you");
}
return QVariant();
default:
@ -162,7 +171,12 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
case 2:
return file->getUploadTime();
case 3:
return isEffectivelyPublic(file) ? tr("Public") : tr("Private");
// Report the node's own bit, not the inherited effective
// state, so it stays in step with what publishing toggles.
if (file->isPublic()) {
return tr("Public");
}
return isEffectivelyPublic(file) ? tr("Public (inherited)") : tr("Private");
default:
return QVariant();
}
@ -173,8 +187,12 @@ QVariant RemoteDeckList_TreeModel::data(const QModelIndex &index, int role) cons
return index.column() == 1 ? Qt::AlignRight : Qt::AlignLeft;
case Qt::ToolTipRole:
if (index.column() == 3) {
return isEffectivelyPublic(file) ? tr("This deck is visible to other users")
: tr("This deck is only visible to you");
if (file->isPublic()) {
return tr("This deck is visible to other users");
}
return isEffectivelyPublic(file)
? tr("This deck is private, but a parent folder is public (inherited).")
: tr("This deck is only visible to you");
}
return QVariant();
default: