w = _shareDialogs[localPath];
} else {
qCInfo(lcApplication) << "Opening share dialog" << sharePath << localPath << maxSharingPermissions;
- w = new ShareDialog(accountState, sharePath, localPath, maxSharingPermissions, fileRecord.numericFileId(), startPage);
+ w = new ShareDialog(accountState, sharePath, localPath, maxSharingPermissions, fileRecord.numericFileId(), fileRecord._lockstate, startPage);
w->setAttribute(Qt::WA_DeleteOnClose, true);
_shareDialogs[localPath] = w;
const QString &localPath,
SharePermissions maxSharingPermissions,
const QByteArray &numericFileId,
+ SyncJournalFileLockInfo filelockState,
ShareDialogStartPage startPage,
QWidget *parent)
: QDialog(parent)
, _sharePath(sharePath)
, _localPath(localPath)
, _maxSharingPermissions(maxSharingPermissions)
+ , _filelockState(std::move(filelockState))
, _privateLinkUrl(accountState->account()->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded))
, _startPage(startPage)
{
f.setPointSize(qRound(f.pointSize() * 1.4));
_ui->label_name->setFont(f);
+ if (_filelockState._locked) {
+ static constexpr auto SECONDS_PER_MINUTE = 60;
+ const auto lockExpirationTime = _filelockState._lockTime + _filelockState._lockTimeout;
+ const auto remainingTime = QDateTime::currentDateTime().secsTo(QDateTime::fromSecsSinceEpoch(lockExpirationTime));
+ const auto remainingTimeInMinute = static_cast<int>(remainingTime > 0 ? remainingTime / SECONDS_PER_MINUTE : 0);
+ _ui->label_lockinfo->setText(tr("Locked by %1 - Expire in %2 minutes", "remaining time before lock expire", remainingTimeInMinute).arg(_filelockState._lockOwnerDisplayName).arg(remainingTimeInMinute));
+ }
+
QString ocDir(_sharePath);
ocDir.truncate(ocDir.length() - fileName.length());
#include "accountstate.h"
#include "sharepermissions.h"
#include "owncloudgui.h"
+#include "common/syncjournalfilerecord.h"
#include <QSharedPointer>
#include <QPointer>
const QString &localPath,
SharePermissions maxSharingPermissions,
const QByteArray &numericFileId,
+ SyncJournalFileLockInfo filelockState,
ShareDialogStartPage startPage,
QWidget *parent = nullptr);
~ShareDialog() override;
QString _localPath;
SharePermissions _maxSharingPermissions;
QByteArray _numericFileId;
+ SyncJournalFileLockInfo _filelockState;
QString _privateLinkUrl;
ShareDialogStartPage _startPage;
ShareManager *_manager = nullptr;
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="QLabel" name="label_sharePath">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_lockinfo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>315</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>