avoid displaying the same encryption error twice

remove duplicated handling of the same server error

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2024-11-19 11:42:48 +01:00
Родитель 587765d083
Коммит cb9a38fac1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7D0F74F05C22F553
2 изменённых файлов: 10 добавлений и 14 удалений

Просмотреть файл

@ -357,8 +357,12 @@ void ShareModel::initShareManager()
connect(_manager.data(), &ShareManager::linkShareCreated, this, &ShareModel::slotAddShare);
connect(_manager.data(), &ShareManager::linkShareRequiresPassword, this, &ShareModel::requestPasswordForLinkShare);
connect(_manager.data(), &ShareManager::serverError, this, [this](const int code, const QString &message) {
_hasInitialShareFetchCompleted = true;
Q_EMIT hasInitialShareFetchCompletedChanged();
if (!_hasInitialShareFetchCompleted) {
_hasInitialShareFetchCompleted = true;
Q_EMIT hasInitialShareFetchCompletedChanged();
}
qCWarning(lcShareModel) << "Error from server from ShareManager class and initShareManager" << code << message;
emit serverError(code, message);
});
@ -597,7 +601,10 @@ void ShareModel::slotAddShare(const SharePtr &share)
const QPersistentModelIndex sharePersistentIndex(shareModelIndex);
_shareIdIndexHash.insert(shareId, sharePersistentIndex);
connect(share.data(), &Share::serverError, this, &ShareModel::slotServerError);
connect(share.data(), &Share::serverError, this, [this] (int code, const QString &message) {
qCWarning(lcShareModel) << "Error from server from Share class" << code << message;
Q_EMIT serverError(code, message);
});
connect(share.data(), &Share::passwordSetError, this, [this, shareId](const int code, const QString &message) {
_shareIdRecentlySetPasswords.remove(shareId);
slotSharePasswordSet(shareId);
@ -620,10 +627,6 @@ void ShareModel::slotAddShare(const SharePtr &share)
connect(userGroupShare.data(), &UserGroupShare::expireDateSet, this, [this, shareId]{ slotShareExpireDateSet(shareId); });
}
if (_manager) {
connect(_manager.data(), &ShareManager::serverError, this, &ShareModel::slotServerError);
}
handleLinkShare();
Q_EMIT sharesChanged();
}
@ -672,12 +675,6 @@ void ShareModel::slotRemoveShareWithId(const QString &shareId)
Q_EMIT sharesChanged();
}
void ShareModel::slotServerError(const int code, const QString &message)
{
qCWarning(lcShareModel) << "Error from server" << code << message;
Q_EMIT serverError(code, message);
}
void ShareModel::slotAddSharee(const ShareePtr &sharee)
{
if(!sharee) {

Просмотреть файл

@ -200,7 +200,6 @@ private slots:
void setHideDownloadEnabledChangeInProgress(const QString &shareId, const bool isInProgress);
void slotPropfindReceived(const QVariantMap &result);
void slotServerError(const int code, const QString &message);
void slotAddShare(const OCC::SharePtr &share);
void slotRemoveShareWithId(const QString &shareId);
void slotSharesFetched(const QList<OCC::SharePtr> &shares);