1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-05-08 11:34:08 +02:00

Changes share link layout so it looks like the UI on the server.

- Adds icons to Share link and to save password on share dialog.
- Changes wording of the menu options for sharing link.
- Adds functionality to the new menu (mostly permissions).
- More widget size and size policy adjustments.

Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
Camila San 2018-07-26 14:43:21 +02:00
parent a19904657a
commit b14aa11c29
No known key found for this signature in database
GPG Key ID: 7A4A6121E88E2AD4
14 changed files with 662 additions and 689 deletions

View File

@ -30,6 +30,11 @@
<file>resources/state-error.svg</file>
<file>resources/state-warning.svg</file>
<file>resources/folder.svg</file>
<file>resources/network.svg</file>
<file>resources/settings.svg</file>
<file>resources/public-white.svg</file>
<file>resources/public.svg</file>
<file>resources/confirm.svg</file>
</qresource>
<qresource prefix="/"/>
</RCC>

1
resources/confirm.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path d="m8.5 0.5c-0.8974 0-1.3404 1.0909-0.6973 1.7168l4.7837 4.7832h-11.573c-1.3523-0.019125-1.3523 2.0191 0 2h11.572l-4.7832 4.7832c-0.98163 0.94251 0.47155 2.3957 1.4141 1.4141l6.4911-6.49c0.387-0.3878 0.391-1.0228 0-1.414l-6.4906-6.4903c-0.1883-0.1935-0.4468-0.30268-0.7168-0.3027z"/></svg>

After

(image error) Size: 393 B

1
resources/copy.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16"><path d="m13 15h-11l0.0005-10h11v3.0002l1-0.0004 0.0005-5.0001c0.000058-0.5834-0.4165-1.0002-1.0005-1.0001l-3.467 0.0005c0.0008-1.183-0.9492-2.0001-2.1325-2.0001s-2.1333 0.8171-2.1333 2.0004h-3.2c-0.5834 0-1.0662 0.4166-1.0662 0.9999l-0.0005 12c-0.0000243 0.584 0.4833 1 1.0667 1l10.933-0.0005c0.584-0.001 1-0.416 1-1v-3h-1zm-8.8005-12h1.0672c0.5833 0 1.0666-0.4162 1.0666-0.9996 0-0.5833 0.4834-0.9337 1.0667-0.9337s1.0667 0.3504 1.0667 0.9337c0 0.5834 0.5333 0.9996 1.0666 0.9996h1.2667c0.517 0 1.2 0.4166 1.2 1h-9c-0.0004-0.65 0.5988-1 1.1988-1zm-1.1995 8h2v-1h-2zm7.9998-2v-2l-4 3 3.9998 3v-2l5.0002-0.00005v-2l-4.9998-0.00005zm-8 4h4v-1h-4zm6-7h-6v1h6zm-3 2h-3v1h3z"/></svg>

After

(image error) Size: 777 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" height="16" width="16"><path fill="#fff" d="m9.2363 2.166-3.1816 3.1836c-0.7071 0.7072-1.0378 1.6182-0.9883 2.457 0.05 0.8389 0.4333 1.5841 0.9883 2.1387l1.4121-1.416c-0.5672-0.5672-0.5444-1.2192 0.002-1.7656l3.1812-3.1817c0.52536-0.52536 1.2507-0.52318 1.772-0.002 0.48245 0.5556 0.52732 1.2382-0.004 1.7695l-0.82 0.8203c0.555 0.785 0.645 1.3663 0.593 2.2344l1.641-1.6406c1.2374-1.2374 1.2371-3.3645 0-4.6016-1.236-1.2361-3.342-1.2113-4.5957 0.004zm0.7071 3.8848-1.4141 1.418c0 0 0.003-00 0.004 0 0.55 0.55 0.50736 1.2582-0.004 1.7695l-3.1816 3.1817c-0.696 0.59192-1.2985 0.47105-1.7696 0-0.62636-0.62636-0.5-1.2681 0-1.768l0.85-0.8473c-0.556-0.7835-0.6484-1.365-0.5976-2.2324l-1.666 1.666c-1.2393 1.2393-1.2357 3.36 0 4.5957 1.2353 1.2353 3.362 1.2356 4.5976 0l3.1817-3.182c0.7086-0.7083 1.0396-1.6184 0.9906-2.4586-0.048-0.8401-0.432-1.5864-0.9887-2.1407z"/></svg>

After

(image error) Size: 942 B

1
resources/public.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" height="16" width="16"><path d="m9.2363 2.166-3.1816 3.1836c-0.7071 0.7072-1.0378 1.6182-0.9883 2.457 0.05 0.8389 0.4333 1.5841 0.9883 2.1387l1.4121-1.416c-0.5672-0.5672-0.5444-1.2192 0.002-1.7656l3.1812-3.1817c0.52536-0.52536 1.2507-0.52318 1.772-0.002 0.48245 0.5556 0.52732 1.2382-0.004 1.7695l-0.82 0.8203c0.555 0.785 0.645 1.3663 0.593 2.2344l1.641-1.6406c1.2374-1.2374 1.2371-3.3645 0-4.6016-1.236-1.2361-3.342-1.2113-4.5957 0.004zm0.7071 3.8848-1.4141 1.418c0 0 0.003-00 0.004 0 0.55 0.55 0.50736 1.2582-0.004 1.7695l-3.1816 3.1817c-0.696 0.59192-1.2985 0.47105-1.7696 0-0.62636-0.62636-0.5-1.2681 0-1.768l0.85-0.8473c-0.556-0.7835-0.6484-1.365-0.5976-2.2324l-1.666 1.666c-1.2393 1.2393-1.2357 3.36 0 4.5957 1.2353 1.2353 3.362 1.2356 4.5976 0l3.1817-3.182c0.7086-0.7083 1.0396-1.6184 0.9906-2.4586-0.048-0.8401-0.432-1.5864-0.9887-2.1407z"/></svg>

After

(image error) Size: 930 B

View File

@ -29,7 +29,7 @@ namespace OCC {
* @brief The OcsShareJob class
* @ingroup gui
*
* Handle talking to the OCS Share API.
* Handle talking to the OCS Share API.
* For creation, deletion and modification of shares.
*/
class OcsShareJob : public OcsJob
@ -71,7 +71,7 @@ public:
/**
* Set the share to be public upload
*
*
* @param publicUpload Set or remove public upload
*/
void setPublicUpload(const QString &shareId, bool publicUpload);
@ -93,11 +93,9 @@ public:
* Create a new link share
*
* @param path The path of the file/folder to share
* @param name The name of the link share, empty name auto-generates one
* @param password Optionally a password for the share
*/
void createLinkShare(const QString &path,
const QString &name,
void createLinkShare(const QString &path, const QString &name,
const QString &password);
/**

View File

@ -198,7 +198,6 @@ void ShareDialog::showSharingUi()
if (userGroupSharing) {
_userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _privateLinkUrl, this);
connect(_userGroupWidget, &ShareUserGroupWidget::togglePublicLinkShare, this, &ShareDialog::slotTogglePublicLinkShareDisplay);
_ui->verticalLayout->insertWidget(1, _userGroupWidget);
_userGroupWidget->getShares();
}
@ -213,14 +212,6 @@ void ShareDialog::showSharingUi()
}
}
void ShareDialog::slotTogglePublicLinkShareDisplay(bool show)
{
if(show)
_linkWidget->toggleButton(true);
else
_linkWidget->toggleButton(false);
}
void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &reply)
{
if (statusCode != 200) {

View File

@ -55,7 +55,6 @@ private slots:
void slotPropfindError();
void slotThumbnailFetched(const int &statusCode, const QByteArray &reply);
void slotAccountStateChanged(int state);
void slotTogglePublicLinkShareDisplay(bool show);
private:
void showSharingUi();

View File

@ -6,20 +6,20 @@
<rect>
<x>0</x>
<y>0</y>
<width>380</width>
<height>150</height>
<width>370</width>
<height>100</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>380</width>
<height>150</height>
<width>370</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
@ -32,8 +32,26 @@
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>10</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,1" columnminimumwidth="0,0">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
@ -163,7 +181,7 @@
</property>
<property name="minimumSize">
<size>
<width>360</width>
<width>350</width>
<height>45</height>
</size>
</property>
@ -192,7 +210,7 @@
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">

View File

@ -32,8 +32,6 @@
namespace OCC {
const char propertyShareC[] = "oc_share";
ShareLinkWidget::ShareLinkWidget(AccountPtr account,
const QString &sharePath,
const QString &localPath,
@ -44,83 +42,67 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
, _account(account)
, _sharePath(sharePath)
, _localPath(localPath)
, _manager(0)
, _manager(nullptr)
, _linkShare(nullptr)
, _passwordRequired(false)
, _expiryRequired(false)
, _namesSupported(true)
, _linkContextMenu(nullptr)
, _copyLinkAction(nullptr)
, _readOnlyLinkAction(nullptr)
, _allowEditingLinkAction(nullptr)
, _allowUploadEditingLinkAction(nullptr)
, _allowUploadLinkAction(nullptr)
, _passwordProtectLinkAction(nullptr)
, _expirationDateLinkAction(nullptr)
, _unshareLinkAction(nullptr)
{
_ui->setupUi(this);
// _ui->linkShares->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
// _ui->linkShares->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
// _ui->linkShares->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
//Is this a file or folder?
QFileInfo fi(localPath);
_isFile = fi.isFile();
// Note: the share name cannot be longer than 64 characters
_ui->nameLineEdit->setText(tr("Public link"));
// the following progress indicator widgets are added to layouts which makes them
// automatically deleted once the dialog dies.
_pi_create = new QProgressIndicator();
_pi_password = new QProgressIndicator();
_pi_date = new QProgressIndicator();
_pi_editing = new QProgressIndicator();
//_ui->horizontalLayout_create->addWidget(_pi_create);
//_ui->horizontalLayout_password->addWidget(_pi_password);
//_ui->layout_editing->addWidget(_pi_editing, 0, 2);
//_ui->horizontalLayout_expire->insertWidget(_ui->horizontalLayout_expire->count() - 1, _pi_date);
_ui->createShareButton->hide();
_ui->verticalLayout->addWidget(_pi_create, Qt::AlignCenter);
_ui->verticalLayout->addWidget(_pi_password, Qt::AlignCenter);
_ui->verticalLayout->addWidget(_pi_editing, Qt::AlignCenter);
connect(_ui->nameLineEdit, &QLineEdit::returnPressed, this, &ShareLinkWidget::slotShareNameEntered);
connect(_ui->createShareButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotShareNameEntered);
connect(_ui->linkShares, &QTableWidget::itemSelectionChanged, this, &ShareLinkWidget::slotShareSelectionChanged);
connect(_ui->linkShares, &QTableWidget::itemChanged, this, &ShareLinkWidget::slotNameEdited);
connect(_ui->checkBox_password, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCheckBoxPasswordClicked);
connect(_ui->lineEdit_password, &QLineEdit::returnPressed, this, &ShareLinkWidget::slotPasswordReturnPressed);
connect(_ui->lineEdit_password, &QLineEdit::textChanged, this, &ShareLinkWidget::slotPasswordChanged);
connect(_ui->pushButton_setPassword, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPasswordReturnPressed);
connect(_ui->checkBox_expire, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCheckBoxExpireClicked);
connect(_ui->enableShareLink, &QCheckBox::toggled, this, &ShareLinkWidget::slotCreateorDeleteShareLink);
connect(_ui->lineEdit_password, &QLineEdit::returnPressed, this, &ShareLinkWidget::slotCreatePassword);
connect(_ui->confirmPassword, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCreatePassword);
connect(_ui->confirmExpirationDate, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCreatePassword);
connect(_ui->calendar, &QDateTimeEdit::dateChanged, this, &ShareLinkWidget::slotExpireDateChanged);
//connect(_ui->radio_readOnly, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsClicked);
//connect(_ui->radio_readWrite, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsClicked);
//connect(_ui->radio_uploadOnly, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPermissionsClicked);
_ui->errorLabel->hide();
bool sharingPossible = true;
if (!_account->capabilities().sharePublicLink()) {
displayError(tr("Link shares have been disabled"));
qCWarning(lcSharing) << "Link shares have been disabled";
sharingPossible = false;
} else if (!(maxSharingPermissions & SharePermissionShare)) {
displayError(tr("The file can not be shared because it was shared without sharing permission."));
qCWarning(lcSharing) << "The file can not be shared because it was shared without sharing permission.";
sharingPossible = false;
}
if (!sharingPossible) {
_ui->nameLineEdit->setEnabled(false);
_ui->createShareButton->setEnabled(false);
}
if (!sharingPossible)
_ui->shareLinkWidget->hide();
else
_ui->shareLinkWidget->show();
// Older servers don't support multiple public link shares
if (!_account->capabilities().sharePublicLinkMultiple()) {
_namesSupported = false;
_ui->createShareButton->setText(tr("Create public link share"));
_ui->nameLineEdit->hide();
_ui->nameLineEdit->clear(); // so we don't send a name
}
_ui->shareProperties->setEnabled(false);
_ui->shareProperties->setVisible(false);
_ui->pushButton_setPassword->setEnabled(false);
_ui->lineEdit_password->setEnabled(false);
_ui->pushButton_setPassword->setEnabled(false);
_ui->checkBox_password->setText(tr("P&assword protect"));
_ui->passwordShareProperty->hide();
_ui->expirationShareProperty->hide();
_ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
_ui->calendar->setEnabled(false);
// check if the file is already inside of a synced folder
if (sharePath.isEmpty()) {
@ -135,41 +117,13 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
}
// Parse capabilities
// If password is enforced then don't allow users to disable it
if (_account->capabilities().sharePublicLinkEnforcePassword()) {
_ui->checkBox_password->setEnabled(false);
_passwordRequired = true;
}
// If expiredate is enforced do not allow disable and set max days
if (_account->capabilities().sharePublicLinkEnforceExpireDate()) {
_ui->checkBox_expire->setEnabled(false);
_ui->calendar->setMaximumDate(QDate::currentDate().addDays(
_account->capabilities().sharePublicLinkExpireDateDays()));
_expiryRequired = true;
}
// TODO File Drop
// File can't have public upload set; we also hide it if the capability isn't there
// _ui->widget_editing->setVisible(
// !_isFile && _account->capabilities().sharePublicLinkAllowUpload());
//_ui->radio_uploadOnly->setVisible(
//_account->capabilities().sharePublicLinkSupportsUploadOnly());
// Prepare sharing menu
_linkContextMenu = new QMenu(this);
connect(_linkContextMenu, &QMenu::triggered,
this, &ShareLinkWidget::slotLinkContextMenuActionTriggered);
_openLinkAction = _linkContextMenu->addAction(tr("Open link in browser"));
_copyLinkAction = _linkContextMenu->addAction(tr("Copy link to clipboard"));
_copyDirectLinkAction = _linkContextMenu->addAction(tr("Copy link to clipboard (direct download)"));
_emailLinkAction = _linkContextMenu->addAction(tr("Send link by email"));
_emailDirectLinkAction = _linkContextMenu->addAction(tr("Send link by email (direct download)"));
_deleteLinkAction = _linkContextMenu->addAction(tr("Delete"));
/*
* Create the share manager and connect it properly
*/
@ -187,13 +141,6 @@ ShareLinkWidget::~ShareLinkWidget()
delete _ui;
}
void ShareLinkWidget::toggleButton(bool show){
if(show)
_ui->createShareButton->show();
else
_ui->createShareButton->hide();
}
void ShareLinkWidget::getShares()
{
if (_manager) {
@ -206,196 +153,194 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
const QString versionString = _account->serverVersion();
qCInfo(lcSharing) << versionString << "Fetched" << shares.count() << "shares";
// Select the share that was previously selected,
// except if an explicit override was asked for
QString reselectShareId = _selectedShareId;
if (!_newShareOverrideSelectionId.isEmpty()) {
reselectShareId = _newShareOverrideSelectionId;
_newShareOverrideSelectionId.clear();
}
auto table = _ui->linkShares;
// Wipe the table without updating the ui elements, we
// might want their state untouched if the same share ends
// up being selected
disconnect(table, &QTableWidget::itemSelectionChanged, this, &ShareLinkWidget::slotShareSelectionChanged);
table->clearContents();
table->setRowCount(0);
connect(table, &QTableWidget::itemSelectionChanged, this, &ShareLinkWidget::slotShareSelectionChanged);
auto deleteIcon = QIcon::fromTheme(QLatin1String("user-trash"),
QIcon(QLatin1String(":/client/resources/delete.png")));
foreach (auto share, shares) {
if (share->getShareType() != Share::TypeLink) {
continue;
}
auto linkShare = qSharedPointerDynamicCast<LinkShare>(share);
_linkShare = qSharedPointerDynamicCast<LinkShare>(share);
// Connect all shares signals to gui slots
connect(share.data(), &Share::serverError, this, &ShareLinkWidget::slotServerError);
connect(share.data(), &Share::shareDeleted, this, &ShareLinkWidget::slotDeleteShareFetched);
connect(share.data(), &Share::permissionsSet, this, &ShareLinkWidget::slotPermissionsSet);
connect(linkShare.data(), &LinkShare::expireDateSet, this, &ShareLinkWidget::slotExpireSet);
connect(linkShare.data(), &LinkShare::passwordSet, this, &ShareLinkWidget::slotPasswordSet);
connect(linkShare.data(), &LinkShare::passwordSetError, this, &ShareLinkWidget::slotPasswordSetError);
//TODO connect(_linkShare.data(), &LinkShare::expireDateSet, this, &ShareLinkWidget::slotExpireSet);
connect(_linkShare.data(), &LinkShare::passwordSet, this, &ShareLinkWidget::slotPasswordSet);
connect(_linkShare.data(), &LinkShare::passwordSetError, this, &ShareLinkWidget::slotPasswordSetError);
// Build the table row
auto row = table->rowCount();
table->insertRow(row);
// Prepare permissions check and create group action
bool checked = false;
SharePermissions perm = _linkShare->getPermissions();
QActionGroup *permissionsGroup = new QActionGroup(this);
auto nameItem = new QTableWidgetItem;
auto name = shareName(*linkShare);
if (!_namesSupported) {
nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
}
nameItem->setText(name);
nameItem->setData(Qt::UserRole, QVariant::fromValue(linkShare));
table->setItem(row, 0, nameItem);
// radio button style
permissionsGroup->setExclusive(true);
auto dotdotdotButton = new QToolButton;
dotdotdotButton->setText("...");
dotdotdotButton->setProperty(propertyShareC, QVariant::fromValue(linkShare));
connect(dotdotdotButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotContextMenuButtonClicked);
table->setCellWidget(row, 1, dotdotdotButton);
if(_isFile){
checked = perm.testFlag(SharePermissionRead) &&
perm.testFlag(SharePermissionUpdate) &&
perm.testFlag(SharePermissionDelete);
_allowEditingLinkAction = permissionsGroup->addAction(tr("Allow Editing"));
_allowEditingLinkAction->setCheckable(true);
_allowEditingLinkAction->setChecked(checked);
auto deleteButton = new QToolButton;
deleteButton->setIcon(deleteIcon);
deleteButton->setProperty(propertyShareC, QVariant::fromValue(linkShare));
deleteButton->setToolTip(tr("Delete link share"));
connect(deleteButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotDeleteShareClicked);
table->setCellWidget(row, 2, deleteButton);
// Reestablish the previous selection
if (reselectShareId == share->getId()) {
table->selectRow(row);
}
}
if (!selectedShare()) {
if (table->rowCount() != 0) {
// Select the first share by default
table->selectRow(0);
} else {
// explicitly note the deselection,
// since this was not triggered on table clear above
slotShareSelectionChanged();
}
}
checked = perm.testFlag(SharePermissionRead);
_readOnlyLinkAction = permissionsGroup->addAction(tr("Read only"));
_readOnlyLinkAction->setCheckable(true);
_readOnlyLinkAction->setChecked(checked);
if (!_namesSupported) {
_ui->createShareButton->setHidden(table->rowCount() == 0);
checked = perm.testFlag(SharePermissionRead) &&
perm.testFlag(SharePermissionCreate) &&
perm.testFlag(SharePermissionUpdate) &&
perm.testFlag(SharePermissionDelete);
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow Upload && Editing"));
_allowUploadEditingLinkAction->setCheckable(true);
_allowUploadEditingLinkAction->setChecked(checked);
checked = perm.testFlag(SharePermissionCreate);
_allowUploadLinkAction = permissionsGroup->addAction(tr("File Drop (Upload Only)"));
_allowUploadLinkAction->setCheckable(true);
_allowUploadLinkAction->setChecked(checked);
}
// Prepare sharing menu
_linkContextMenu = new QMenu(this);
// Add copy action (icon only)
_copyLinkAction = _linkContextMenu->addAction(QIcon(":/client/resources/copy.svg"),
tr("Copy link"));
// Adds permissions actions (radio button style)
if(_isFile){
_linkContextMenu->addAction(_allowEditingLinkAction);
} else {
_linkContextMenu->addAction(_readOnlyLinkAction);
_linkContextMenu->addAction(_allowUploadEditingLinkAction);
_linkContextMenu->addAction(_allowUploadLinkAction);
}
// Adds action to display password widget (check box)
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password Protect"));
_passwordProtectLinkAction->setCheckable(true);
if(_linkShare->isPasswordSet()){
_passwordProtectLinkAction->setChecked(true);
_ui->lineEdit_password->setPlaceholderText("********");
_ui->passwordShareProperty->show();
}
// If password is enforced then don't allow users to disable it
if (_account->capabilities().sharePublicLinkEnforcePassword()) {
_passwordProtectLinkAction->setChecked(true);
_passwordProtectLinkAction->setEnabled(false);
_passwordRequired = true;
}
// Adds action to display expiration date widget (check box)
_expirationDateLinkAction = _linkContextMenu->addAction(tr("Expiration Date"));
_expirationDateLinkAction->setCheckable(true);
if(_linkShare->getExpireDate().isValid()){
_expirationDateLinkAction->setChecked(true);
_ui->expirationShareProperty->show();
}
// If expiredate is enforced do not allow disable and set max days
if (_account->capabilities().sharePublicLinkEnforceExpireDate()) {
_ui->calendar->setMaximumDate(QDate::currentDate().addDays(
_account->capabilities().sharePublicLinkExpireDateDays()));
_expirationDateLinkAction->setChecked(true);
_expirationDateLinkAction->setEnabled(false);
_expiryRequired = true;
}
// Adds action to unshare widget (check box)
_unshareLinkAction = _linkContextMenu->addAction(QIcon(":/client/resources/delete.png"),
tr("Unshare"));
connect(_linkContextMenu, &QMenu::triggered,
this, &ShareLinkWidget::slotLinkContextMenuActionTriggered);
_ui->shareLinkToolButton->setMenu(_linkContextMenu);
_ui->shareLinkToolButton->setEnabled(true);
_ui->enableShareLink->setEnabled(true);
_ui->enableShareLink->setChecked(true);
}
if(table->rowCount() == 0)
_ui->linkShares->setHidden(true);
}
void ShareLinkWidget::slotShareSelectionChanged()
{
// Disable running progress indicators
_pi_create->stopAnimation();
_pi_editing->stopAnimation();
_pi_date->stopAnimation();
_pi_password->stopAnimation();
// TODO
//void ShareLinkWidget::slotShareSelectionChanged()
//{
// // Disable running progress indicators
// _pi_create->stopAnimation();
// _pi_editing->stopAnimation();
// _pi_date->stopAnimation();
// _pi_password->stopAnimation();
_ui->errorLabel->hide();
// _ui->errorLabel->hide();
// _ui->passwordShareProperty->show();
// _ui->expirationShareProperty->show();
auto share = selectedShare();
if (!share) {
_ui->shareProperties->setHidden(false);
_ui->shareProperties->setVisible(false);
//_ui->radio_readOnly->setChecked(false);
//_ui->radio_readWrite->setChecked(false);
//_ui->radio_uploadOnly->setChecked(false);
_ui->checkBox_expire->setChecked(false);
_ui->checkBox_password->setChecked(false);
return;
}
bool selectionUnchanged = _selectedShareId == share->getId();
_selectedShareId = share->getId();
_ui->shareProperties->setEnabled(true);
_ui->shareProperties->setVisible(true);
_ui->checkBox_password->setEnabled(!_passwordRequired);
_ui->checkBox_expire->setEnabled(!_expiryRequired);
// _ui->widget_editing->setEnabled(true);
// if (!_account->capabilities().sharePublicLinkAllowUpload()) {
// _ui->radio_readWrite->setEnabled(false);
// _ui->radio_uploadOnly->setEnabled(false);
// _allowUploadEditingLinkAction->setEnabled(false);
// _allowUploadLinkAction->setEnabled(false);
// }
// Password state
_ui->checkBox_password->setText(tr("P&assword protect"));
if (!selectionUnchanged) {
if (share->isPasswordSet()) {
_ui->checkBox_password->setChecked(true);
_ui->lineEdit_password->setPlaceholderText("********");
_ui->lineEdit_password->setEnabled(true);
} else {
_ui->checkBox_password->setChecked(false);
_ui->lineEdit_password->setPlaceholderText(QString());
_ui->lineEdit_password->setEnabled(false);
}
_ui->lineEdit_password->setText(QString());
_ui->pushButton_setPassword->setEnabled(false);
}
// // Password state
// _ui->lineEdit_password->setEnabled(_linkShare->isPasswordSet());
// if(_linkShare->isPasswordSet()) _ui->lineEdit_password->setPlaceholderText("********");
// _ui->lineEdit_password->setText(QString());
// _ui->lineEdit_password->setEnabled(_linkShare->isPasswordSet());
// _ui->confirmPassword->setEnabled(_linkShare->isPasswordSet());
// Expiry state
_ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
if (share->getExpireDate().isValid()) {
_ui->checkBox_expire->setChecked(true);
_ui->calendar->setDate(share->getExpireDate());
_ui->calendar->setEnabled(true);
} else {
_ui->checkBox_expire->setChecked(false);
_ui->calendar->setEnabled(false);
}
// Public upload state (box is hidden for files)
// // Expiry state
// _ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
// if (_linkShare->getExpireDate().isValid()) {
// _ui->calendar->setDate(_linkShare->getExpireDate());
// _ui->calendar->setEnabled(true);
// }
// // Public upload state (box is hidden for files)
// if (!_isFile) {
// if (share->getPublicUpload()) {
// if (share->getShowFileListing()) {
// //_ui->radio_readWrite->setChecked(true);
// if (_linkShare->getPublicUpload()) {
// if (_linkShare->getShowFileListing()) {
// _allowUploadEditingLinkAction->setChecked(true);
// } else {
// //_ui->radio_uploadOnly->setChecked(true);
// _allowUploadLinkAction->setChecked(true);
// }
// } else {
// //_ui->radio_readOnly->setChecked(true);
// _readOnlyLinkAction->setChecked(true);
// }
// }
}
//}
void ShareLinkWidget::setExpireDate(const QDate &date)
{
if (auto current = selectedShare()) {
if (_linkShare) {
_pi_date->startAnimation();
_ui->errorLabel->hide();
current->setExpireDate(date);
_linkShare->setExpireDate(date);
}
}
void ShareLinkWidget::slotExpireSet()
{
if (sender() == selectedShare().data()) {
slotShareSelectionChanged();
}
}
// TODO
//void ShareLinkWidget::slotExpireSet()
//{
// if (sender() == _linkShare.data()) {
// slotShareSelectionChanged();
// }
//}
void ShareLinkWidget::slotExpireDateChanged(const QDate &date)
{
if (_ui->checkBox_expire->isChecked()) {
setExpireDate(date);
}
setExpireDate(date);
}
void ShareLinkWidget::slotPasswordReturnPressed()
void ShareLinkWidget::slotCreatePassword()
{
if (!_manager) {
return;
}
if (!selectedShare()) {
if (!_linkShare) {
// If share creation requires a password, we'll be in this case
if (_ui->lineEdit_password->text().isEmpty()) {
_ui->lineEdit_password->setFocus();
@ -403,42 +348,39 @@ void ShareLinkWidget::slotPasswordReturnPressed()
}
_pi_create->startAnimation();
_manager->createLinkShare(_sharePath, _ui->nameLineEdit->text(), _ui->lineEdit_password->text());
_manager->createLinkShare(_sharePath, QString(), _ui->lineEdit_password->text());
} else {
setPassword(_ui->lineEdit_password->text());
}
_ui->lineEdit_password->clearFocus();
}
void ShareLinkWidget::slotPasswordChanged(const QString &newText)
void ShareLinkWidget::slotCreateorDeleteShareLink(bool checked)
{
// disable the set-password button
_ui->pushButton_setPassword->setEnabled(newText.length() > 0);
}
void ShareLinkWidget::slotNameEdited(QTableWidgetItem *item)
{
if (!_namesSupported) {
if (!_manager) {
qCWarning(lcSharing) << "No share manager set.";
return;
}
QString newName = item->text();
auto share = item->data(Qt::UserRole).value<QSharedPointer<LinkShare>>();
if (share && newName != share->getName() && newName != share->getToken()) {
share->setName(newName);
_pi_create->startAnimation();
if(checked){
_manager->createLinkShare(_sharePath, QString(), QString());
} else {
if (!_linkShare) {
qCWarning(lcSharing) << "No public link set.";
return;
}
confirmAndDeleteShare();
}
_ui->shareLinkToolButton->setEnabled(checked);
}
void ShareLinkWidget::setPassword(const QString &password)
{
if (auto current = selectedShare()) {
if (_linkShare) {
_pi_password->startAnimation();
_ui->errorLabel->hide();
_ui->checkBox_password->setEnabled(false);
_ui->lineEdit_password->setEnabled(false);
current->setPassword(password);
_linkShare->setPassword(password);
}
}
@ -469,48 +411,24 @@ void ShareLinkWidget::slotPasswordSet()
getShares();
}
void ShareLinkWidget::slotShareNameEntered()
{
if (!_manager) {
return;
}
_pi_create->startAnimation();
_manager->createLinkShare(_sharePath, _ui->nameLineEdit->text(), QString());
if(!_account->capabilities().sharePublicLinkMultiple())
_ui->createShareButton->setHidden(true);
_ui->linkShares->setHidden(false);
}
void ShareLinkWidget::slotDeleteShareFetched()
{
getShares();
}
void ShareLinkWidget::slotCreateShareFetched(const QSharedPointer<LinkShare> &share)
void ShareLinkWidget::slotCreateShareFetched()
{
_pi_create->stopAnimation();
_pi_password->stopAnimation();
_ui->nameLineEdit->clear();
_newShareOverrideSelectionId = share->getId();
getShares();
}
void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message)
{
// Deselect existing shares
_ui->linkShares->clearSelection();
// Prepare password entry
_pi_create->stopAnimation();
_pi_password->stopAnimation();
_ui->shareProperties->setEnabled(true);
_ui->shareProperties->setVisible(true);
_ui->checkBox_password->setChecked(true);
_ui->checkBox_password->setEnabled(false);
_ui->checkBox_password->setText(tr("Public sh&aring requires a password"));
_ui->checkBox_expire->setEnabled(false);
//_ui->widget_editing->setEnabled(false);
_ui->passwordShareProperty->show();
if (!message.isEmpty()) {
_ui->errorLabel->setText(message);
_ui->errorLabel->show();
@ -518,61 +436,34 @@ void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message)
_passwordRequired = true;
slotCheckBoxPasswordClicked();
togglePasswordOptions(true);
}
void ShareLinkWidget::slotCheckBoxPasswordClicked()
void ShareLinkWidget::togglePasswordOptions(bool enable)
{
if (_ui->checkBox_password->checkState() == Qt::Checked) {
_ui->lineEdit_password->setEnabled(true);
_ui->pushButton_setPassword->setEnabled(true);
_ui->lineEdit_password->setPlaceholderText(tr("Please Set Password"));
_ui->lineEdit_password->setFocus();
} else {
setPassword(QString());
_ui->lineEdit_password->setPlaceholderText(QString());
_pi_password->startAnimation();
_ui->lineEdit_password->setEnabled(false);
_ui->pushButton_setPassword->setEnabled(false);
}
_ui->passwordShareProperty->setVisible(enable);
if(enable) _ui->lineEdit_password->setFocus();
}
void ShareLinkWidget::slotCheckBoxExpireClicked()
void ShareLinkWidget::toggleExpireDateOptions(bool enable)
{
if (_ui->checkBox_expire->checkState() == Qt::Checked) {
_ui->expirationShareProperty->setVisible(enable);
if (enable) {
const QDate date = QDate::currentDate().addDays(1);
setExpireDate(date);
_ui->calendar->setDate(date);
_ui->calendar->setMinimumDate(date);
_ui->calendar->setEnabled(true);
} else {
setExpireDate(QDate());
_ui->calendar->setEnabled(false);
}
}
void ShareLinkWidget::emailShareLink(const QUrl &url)
{
QString fileName = _sharePath.mid(_sharePath.lastIndexOf('/') + 1);
Utility::openEmailComposer(
QString("I shared %1 with you").arg(fileName),
url.toString(),
this);
}
void ShareLinkWidget::openShareLink(const QUrl &url)
{
Utility::openBrowser(url, this);
}
void ShareLinkWidget::confirmAndDeleteShare(const QSharedPointer<LinkShare> &share)
void ShareLinkWidget::confirmAndDeleteShare()
{
auto messageBox = new QMessageBox(
QMessageBox::Question,
tr("Confirm Link Share Deletion"),
tr("<p>Do you really want to delete the public link share <i>%1</i>?</p>"
"<p>Note: This action cannot be undone.</p>")
.arg(shareName(*share)),
.arg(shareName()),
QMessageBox::NoButton,
this);
QPushButton *yesButton =
@ -580,91 +471,63 @@ void ShareLinkWidget::confirmAndDeleteShare(const QSharedPointer<LinkShare> &sha
messageBox->addButton(tr("Cancel"), QMessageBox::NoRole);
connect(messageBox, &QMessageBox::finished, this,
[messageBox, yesButton, share]() {
if (messageBox->clickedButton() == yesButton)
share->deleteShare();
[messageBox, yesButton, this]() {
if (messageBox->clickedButton() == yesButton){
this->_linkShare->deleteShare();
this->_ui->enableShareLink->setChecked(false);
this->_ui->shareLinkToolButton->setEnabled(false);
}
});
messageBox->open();
}
QString ShareLinkWidget::shareName(const LinkShare &share) const
QString ShareLinkWidget::shareName() const
{
QString name = share.getName();
QString name = _linkShare->getName();
if (!name.isEmpty())
return name;
if (!_namesSupported)
return tr("Public link");
return share.getToken();
return _linkShare->getToken();
}
void ShareLinkWidget::slotContextMenuButtonClicked()
{
auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>();
bool downloadEnabled = share->getShowFileListing();
_copyDirectLinkAction->setVisible(downloadEnabled);
_emailDirectLinkAction->setVisible(downloadEnabled);
_linkContextMenu->setProperty(propertyShareC, QVariant::fromValue(share));
_linkContextMenu->exec(QCursor::pos());
}
void ShareLinkWidget::slotLinkContextMenuActionTriggered(QAction *action)
{
auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>();
if (action == _deleteLinkAction) {
confirmAndDeleteShare(share);
} else if (action == _copyLinkAction) {
QApplication::clipboard()->setText(share->getLink().toString());
} else if (action == _copyDirectLinkAction) {
QApplication::clipboard()->setText(share->getDirectDownloadLink().toString());
} else if (action == _emailLinkAction) {
emailShareLink(share->getLink());
} else if (action == _emailDirectLinkAction) {
emailShareLink(share->getDirectDownloadLink());
} else if (action == _openLinkAction) {
openShareLink(share->getLink());
}
}
bool state = action->isChecked();
SharePermissions perm = SharePermissionRead;
void ShareLinkWidget::slotDeleteShareClicked()
{
auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>();
confirmAndDeleteShare(share);
}
if (action == _copyLinkAction) {
QApplication::clipboard()->setText(_linkShare->getLink().toString());
void ShareLinkWidget::slotPermissionsClicked()
{
if (auto current = selectedShare()) {
//_ui->widget_editing->setEnabled(false);
_pi_editing->startAnimation();
_ui->errorLabel->hide();
} else if (action == _readOnlyLinkAction && state) {
_linkShare->setPermissions(perm);
SharePermissions perm = SharePermissionRead;
// if (_ui->radio_readWrite->isChecked()) {
// perm = SharePermissionRead | SharePermissionCreate
// | SharePermissionUpdate | SharePermissionDelete;
// } else if (_ui->radio_uploadOnly->isChecked()) {
// perm = SharePermissionCreate;
// }
current->setPermissions(perm);
}
}
} else if (action == _allowEditingLinkAction && state) {
perm |= SharePermissionDelete | SharePermissionUpdate;
_linkShare->setPermissions(perm);
QSharedPointer<LinkShare> ShareLinkWidget::selectedShare() const
{
const auto items = _ui->linkShares->selectedItems();
if (items.isEmpty()) {
return QSharedPointer<LinkShare>();
}
} else if (action == _allowUploadEditingLinkAction && state) {
perm |= SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete;
_linkShare->setPermissions(perm);
return items.first()->data(Qt::UserRole).value<QSharedPointer<LinkShare>>();
}
} else if (action == _allowUploadLinkAction && state) {
perm = SharePermissionCreate;
_linkShare->setPermissions(perm);
void ShareLinkWidget::slotPermissionsSet()
{
if (sender() == selectedShare().data()) {
slotShareSelectionChanged();
} else if (action == _passwordProtectLinkAction) {
togglePasswordOptions(state);
} else if (action == _expirationDateLinkAction) {
toggleExpireDateOptions(state);
} else if (action == _unshareLinkAction) {
confirmAndDeleteShare();
}
}
@ -682,9 +545,6 @@ void ShareLinkWidget::slotServerError(int code, const QString &message)
void ShareLinkWidget::slotPasswordSetError(int code, const QString &message)
{
slotServerError(code, message);
_ui->checkBox_password->setEnabled(!_passwordRequired);
_ui->lineEdit_password->setEnabled(true);
_ui->lineEdit_password->setFocus();
}

View File

@ -59,27 +59,21 @@ public:
private slots:
void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
void slotShareSelectionChanged();
//void slotShareSelectionChanged();
void slotCreateorDeleteShareLink(bool checked);
void slotCreatePassword();
void slotShareNameEntered();
void slotDeleteShareClicked();
void slotCheckBoxPasswordClicked();
void slotCheckBoxExpireClicked();
void slotPasswordReturnPressed();
void slotPermissionsClicked();
void slotExpireDateChanged(const QDate &date);
void slotPasswordChanged(const QString &newText);
void slotNameEdited(QTableWidgetItem *item);
void slotContextMenuButtonClicked();
void slotLinkContextMenuActionTriggered(QAction *action);
void slotDeleteShareFetched();
void slotCreateShareFetched(const QSharedPointer<LinkShare> &share);
void slotCreateShareFetched();
void slotCreateShareRequiresPassword(const QString &message);
void slotPasswordSet();
void slotExpireSet();
void slotPermissionsSet();
//void slotExpireSet();
void slotServerError(int code, const QString &message);
void slotPasswordSetError(int code, const QString &message);
@ -87,23 +81,24 @@ private slots:
private:
void displayError(const QString &errMsg);
void togglePasswordOptions(bool enable);
void setPassword(const QString &password);
void toggleExpireDateOptions(bool enable);
void setExpireDate(const QDate &date);
void copyShareLink(const QUrl &url);
void emailShareLink(const QUrl &url);
void openShareLink(const QUrl &url);
/** Confirm with the user and then delete the share */
void confirmAndDeleteShare(const QSharedPointer<LinkShare> &share);
void confirmAndDeleteShare();
/** Retrieve a share's name, accounting for _namesSupported */
QString shareName(const LinkShare &share) const;
QString shareName() const;
/**
* Retrieve the selected share, returning 0 if none.
*/
QSharedPointer<LinkShare> selectedShare() const;
//QSharedPointer<LinkShare> selectedShare() const;
Ui::ShareLinkWidget *_ui;
AccountPtr _account;
@ -117,28 +112,22 @@ private:
QProgressIndicator *_pi_editing;
ShareManager *_manager;
QSharedPointer<LinkShare> _linkShare;
bool _isFile;
bool _passwordRequired;
bool _expiryRequired;
bool _namesSupported;
// For maintaining the selection and temporary ui state
// when getShares() finishes, but the selection didn't
// change.
QString _selectedShareId;
// When a new share is created, we want to select it
// the next time getShares() finishes. This stores its id.
QString _newShareOverrideSelectionId;
QMenu *_linkContextMenu = nullptr;
QAction *_deleteLinkAction = nullptr;
QAction *_openLinkAction = nullptr;
QAction *_copyLinkAction = nullptr;
QAction *_copyDirectLinkAction = nullptr;
QAction *_emailLinkAction = nullptr;
QAction *_emailDirectLinkAction = nullptr;
QMenu *_linkContextMenu;
QAction *_copyLinkAction;
QAction *_readOnlyLinkAction;
QAction *_allowEditingLinkAction;
QAction *_allowUploadEditingLinkAction;
QAction *_allowUploadLinkAction;
QAction *_passwordProtectLinkAction;
QAction *_expirationDateLinkAction;
QAction *_unshareLinkAction;
};
}

View File

@ -7,18 +7,18 @@
<x>0</x>
<y>0</y>
<width>350</width>
<height>238</height>
<height>124</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>340</width>
<width>350</width>
<height>0</height>
</size>
</property>
@ -33,7 +33,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>5</number>
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
@ -51,34 +51,12 @@
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="nameLineEdit">
<widget class="QWidget" name="shareLinkWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>26</height>
</size>
</property>
<property name="placeholderText">
<string>Enter a name to create a new public link...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createShareButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -89,114 +67,10 @@
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>&amp;Create new</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="linkShares">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>80</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="autoScrollMargin">
<number>10</number>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>80</number>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>40</number>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>30</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>20</number>
</attribute>
<column/>
<column/>
<column/>
</widget>
</item>
<item>
<widget class="QWidget" name="shareProperties" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0">
<layout class="QHBoxLayout" name="shareLinkLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
@ -212,99 +86,174 @@
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<item>
<widget class="QPushButton" name="createShareButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>240</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>26</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">text-align: left</string>
</property>
<property name="text">
<string>&amp;Share link</string>
</property>
<property name="icon">
<iconset resource="../../client.qrc">
<normaloff>:/client/resources/public.svg</normaloff>:/client/resources/public.svg</iconset>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableShareLink">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="shareLinkToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../client.qrc">
<normaloff>:/client/resources/more.png</normaloff>:/client/resources/more.png</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="passwordShareProperty" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="passwordHorizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>5</number>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_setPassword">
<property name="leftMargin">
<number>18</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<width>162</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Save</string>
<string>Password:</string>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_expire">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Expiration date</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_password">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Password</string>
</property>
</widget>
</item>
<item row="0" column="3">
<item>
<widget class="QLineEdit" name="lineEdit_password">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
<width>120</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
@ -321,18 +270,114 @@
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QDateEdit" name="calendar">
<item>
<widget class="QPushButton" name="confirmPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
<width>18</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../client.qrc">
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="expirationShareProperty" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<layout class="QHBoxLayout" name="expirationShareLayout" stretch="0,0,0">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>18</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="expirationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>162</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>Expiration date:</string>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="calendar">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
@ -346,13 +391,45 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="confirmExpirationDate">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>18</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../client.qrc">
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="errorLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -429,6 +506,8 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<resources>
<include location="../../client.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>350</width>
<height>56</height>
<height>54</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,7 +19,7 @@
<property name="minimumSize">
<size>
<width>350</width>
<height>54</height>
<height>52</height>
</size>
</property>
<property name="maximumSize">
@ -73,39 +73,14 @@
<item>
<widget class="QLineEdit" name="shareeLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="placeholderText">
<string>Share with users or groups ...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="permissionToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<width>250</width>
<height>26</height>
</size>
</property>
@ -115,8 +90,42 @@
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Share with users or groups ...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="permissionToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>98</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>...</string>
<string>can edit</string>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
@ -139,7 +148,7 @@
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
<height>26</height>
</size>
</property>
<property name="maximumSize">
@ -198,7 +207,7 @@
<bool>true</bool>
</property>
<property name="margin">
<number>5</number>
<number>0</number>
</property>
<property name="indent">
<number>0</number>

View File

@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<width>350</width>
<height>45</height>
</rect>
</property>
@ -21,7 +21,7 @@
</property>
<property name="minimumSize">
<size>
<width>340</width>
<width>350</width>
<height>45</height>
</size>
</property>
@ -39,22 +39,22 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,3,2,2,2">
<property name="spacing">
<number>3</number>
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>3</number>
<number>6</number>
</property>
<property name="topMargin">
<number>3</number>
<number>6</number>
</property>
<property name="rightMargin">
<number>3</number>
<number>6</number>
</property>
<property name="bottomMargin">
<number>3</number>
<number>6</number>
</property>
<item>
<widget class="QLabel" name="avatar">
@ -70,15 +70,30 @@
<height>40</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
@ -92,7 +107,7 @@
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
<height>26</height>
</size>
</property>
<property name="text">
@ -125,7 +140,7 @@
<item>
<widget class="QCheckBox" name="permissionsEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -144,34 +159,38 @@
<item>
<widget class="QToolButton" name="permissionToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>...</string>
<string/>
</property>
<property name="icon">
<iconset resource="../../client.qrc">
<normaloff>:/client/resources/more.png</normaloff>:/client/resources/more.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deleteShareButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="text">
@ -185,6 +204,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../client.qrc"/>
</resources>
<connections/>
</ui>