diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 2a314c3fa..1e34d44fc 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -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) { diff --git a/src/gui/filedetails/sharemodel.h b/src/gui/filedetails/sharemodel.h index 09d136f1e..83192f2cf 100644 --- a/src/gui/filedetails/sharemodel.h +++ b/src/gui/filedetails/sharemodel.h @@ -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 &shares);