From: Claudio Cambra Date: Sun, 20 Oct 2024 09:36:20 +0000 (+0800) Subject: When handling fetched shares, record shared-with-me related information in sharemodel... X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~5^2~14^2~14 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4a1fa9228a17ef8c75ec16e73d5019bbacba4d3a;p=nextcloud-desktop.git When handling fetched shares, record shared-with-me related information in sharemodel properties Signed-off-by: Claudio Cambra --- diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index c8257e8df..3a2615963 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -492,10 +492,25 @@ void ShareModel::slotSharesFetched(const QList &shares) qCInfo(lcSharing) << "Fetched" << shares.count() << "shares"; for (const auto &share : shares) { - if (share.isNull() || - share->account().isNull() || - share->getUidOwner() != share->account()->davUser()) { - + if (share.isNull()) { + continue; + } else if (const auto selfUserId = _accountState->account()->davUser(); share->getUidOwner() != selfUserId) { + if (share->getShareType() == Share::TypeUser && + share->getShareWith() && + share->getShareWith()->shareWith() == selfUserId) + { + const auto userShare = share.objectCast(); + const auto expireDate = userShare->getExpireDate(); + const auto daysToExpire = QDate::currentDate().daysTo(expireDate); + _sharedWithMeExpires = expireDate.isValid(); + Q_EMIT sharedWithMeExpiresChanged(); + _sharedWithMeRemainingTimeString = daysToExpire > 1 + ? tr("%1 days").arg(daysToExpire) + : daysToExpire > 0 + ? tr("1 day") + : tr("Today"); + Q_EMIT sharedWithMeRemainingTimeStringChanged(); + } continue; }