diff options
author | Camila San <hello@camila.codes> | 2018-07-26 15:43:21 +0300 |
---|---|---|
committer | Camila San <hello@camila.codes> | 2018-08-02 20:57:16 +0300 |
commit | b14aa11c290894d1f796be9b2ca54278e5d8ae78 (patch) | |
tree | cc671ce07deec787c60f101f5331ca49e507340d /src | |
parent | a19904657a87d5b6690b15b79f9385f8452310b8 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/ocssharejob.h | 8 | ||||
-rw-r--r-- | src/gui/sharedialog.cpp | 9 | ||||
-rw-r--r-- | src/gui/sharedialog.h | 1 | ||||
-rw-r--r-- | src/gui/sharedialog.ui | 34 | ||||
-rw-r--r-- | src/gui/sharelinkwidget.cpp | 604 | ||||
-rw-r--r-- | src/gui/sharelinkwidget.h | 57 | ||||
-rw-r--r-- | src/gui/sharelinkwidget.ui | 421 | ||||
-rw-r--r-- | src/gui/shareusergroupwidget.ui | 29 | ||||
-rw-r--r-- | src/gui/shareuserline.ui | 55 |
9 files changed, 591 insertions, 627 deletions
diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h index 5760085fc..97b840e53 100644 --- a/src/gui/ocssharejob.h +++ b/src/gui/ocssharejob.h @@ -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); /** diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 5efc35503..663993a8e 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -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) { diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h index ea0d45bb2..474ba51d9 100644 --- a/src/gui/sharedialog.h +++ b/src/gui/sharedialog.h @@ -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(); diff --git a/src/gui/sharedialog.ui b/src/gui/sharedialog.ui index 6e8a0a5ec..879a9948a 100644 --- a/src/gui/sharedialog.ui +++ b/src/gui/sharedialog.ui @@ -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"> diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 897a53df0..f5c6e8c43 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -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(); - - 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); + _ui->verticalLayout->addWidget(_pi_create, Qt::AlignCenter); + _ui->verticalLayout->addWidget(_pi_password, Qt::AlignCenter); + _ui->verticalLayout->addWidget(_pi_editing, Qt::AlignCenter); + + 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); - - // Build the table row - auto row = table->rowCount(); - table->insertRow(row); - - 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); - - auto dotdotdotButton = new QToolButton; - dotdotdotButton->setText("..."); - dotdotdotButton->setProperty(propertyShareC, QVariant::fromValue(linkShare)); - connect(dotdotdotButton, &QAbstractButton::clicked, this, &ShareLinkWidget::slotContextMenuButtonClicked); - table->setCellWidget(row, 1, dotdotdotButton); - - 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); + //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); + + // Prepare permissions check and create group action + bool checked = false; + SharePermissions perm = _linkShare->getPermissions(); + QActionGroup *permissionsGroup = new QActionGroup(this); + + // radio button style + permissionsGroup->setExclusive(true); + + if(_isFile){ + checked = perm.testFlag(SharePermissionRead) && + perm.testFlag(SharePermissionUpdate) && + perm.testFlag(SharePermissionDelete); + _allowEditingLinkAction = permissionsGroup->addAction(tr("Allow Editing")); + _allowEditingLinkAction->setCheckable(true); + _allowEditingLinkAction->setChecked(checked); + + } else { + checked = perm.testFlag(SharePermissionRead); + _readOnlyLinkAction = permissionsGroup->addAction(tr("Read only")); + _readOnlyLinkAction->setCheckable(true); + _readOnlyLinkAction->setChecked(checked); + + 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); } - } - if (!selectedShare()) { - if (table->rowCount() != 0) { - // Select the first share by default - table->selectRow(0); + // 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 { - // explicitly note the deselection, - // since this was not triggered on table clear above - slotShareSelectionChanged(); + _linkContextMenu->addAction(_readOnlyLinkAction); + _linkContextMenu->addAction(_allowUploadEditingLinkAction); + _linkContextMenu->addAction(_allowUploadLinkAction); } - } - if (!_namesSupported) { - _ui->createShareButton->setHidden(table->rowCount() == 0); - } - 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(); + // Adds action to display password widget (check box) + _passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password Protect")); + _passwordProtectLinkAction->setCheckable(true); - _ui->errorLabel->hide(); + if(_linkShare->isPasswordSet()){ + _passwordProtectLinkAction->setChecked(true); + _ui->lineEdit_password->setPlaceholderText("********"); + _ui->passwordShareProperty->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(); + // If password is enforced then don't allow users to disable it + if (_account->capabilities().sharePublicLinkEnforcePassword()) { + _passwordProtectLinkAction->setChecked(true); + _passwordProtectLinkAction->setEnabled(false); + _passwordRequired = true; + } - _ui->shareProperties->setEnabled(true); - _ui->shareProperties->setVisible(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(); + } - _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); -// } - // 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); + // 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; } - _ui->lineEdit_password->setText(QString()); - _ui->pushButton_setPassword->setEnabled(false); - } - // 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); + // 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); } +} + +// TODO +//void ShareLinkWidget::slotShareSelectionChanged() +//{ +// // Disable running progress indicators +// _pi_create->stopAnimation(); +// _pi_editing->stopAnimation(); +// _pi_date->stopAnimation(); +// _pi_password->stopAnimation(); - // Public upload state (box is hidden for files) +// _ui->errorLabel->hide(); +// _ui->passwordShareProperty->show(); +// _ui->expirationShareProperty->show(); + +// if (!_account->capabilities().sharePublicLinkAllowUpload()) { +// _allowUploadEditingLinkAction->setEnabled(false); +// _allowUploadLinkAction->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 (_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) -{ - // disable the set-password button - _ui->pushButton_setPassword->setEnabled(newText.length() > 0); } -void ShareLinkWidget::slotNameEdited(QTableWidgetItem *item) +void ShareLinkWidget::slotCreateorDeleteShareLink(bool checked) { - 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å 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()); - } -} -void ShareLinkWidget::slotDeleteShareClicked() -{ - auto share = sender()->property(propertyShareC).value<QSharedPointer<LinkShare>>(); - confirmAndDeleteShare(share); -} + bool state = action->isChecked(); + SharePermissions perm = SharePermissionRead; -void ShareLinkWidget::slotPermissionsClicked() -{ - if (auto current = selectedShare()) { - //_ui->widget_editing->setEnabled(false); - _pi_editing->startAnimation(); - _ui->errorLabel->hide(); + if (action == _copyLinkAction) { + QApplication::clipboard()->setText(_linkShare->getLink().toString()); - 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 == _readOnlyLinkAction && state) { + _linkShare->setPermissions(perm); -QSharedPointer<LinkShare> ShareLinkWidget::selectedShare() const -{ - const auto items = _ui->linkShares->selectedItems(); - if (items.isEmpty()) { - return QSharedPointer<LinkShare>(); - } + } else if (action == _allowEditingLinkAction && state) { + perm |= SharePermissionDelete | SharePermissionUpdate; + _linkShare->setPermissions(perm); - return items.first()->data(Qt::UserRole).value<QSharedPointer<LinkShare>>(); -} + } else if (action == _allowUploadEditingLinkAction && state) { + perm |= SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete; + _linkShare->setPermissions(perm); -void ShareLinkWidget::slotPermissionsSet() -{ - if (sender() == selectedShare().data()) { - slotShareSelectionChanged(); + } else if (action == _allowUploadLinkAction && state) { + perm = SharePermissionCreate; + _linkShare->setPermissions(perm); + + } 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(); } diff --git a/src/gui/sharelinkwidget.h b/src/gui/sharelinkwidget.h index 5ba11b85d..fc3c6d6f7 100644 --- a/src/gui/sharelinkwidget.h +++ b/src/gui/sharelinkwidget.h @@ -59,27 +59,21 @@ public: private slots: void slotSharesFetched(const QList<QSharedPointer<Share>> &shares); - void slotShareSelectionChanged(); - - void slotShareNameEntered(); - void slotDeleteShareClicked(); - void slotCheckBoxPasswordClicked(); - void slotCheckBoxExpireClicked(); - void slotPasswordReturnPressed(); - void slotPermissionsClicked(); + //void slotShareSelectionChanged(); + + void slotCreateorDeleteShareLink(bool checked); + void slotCreatePassword(); + 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; }; } diff --git a/src/gui/sharelinkwidget.ui b/src/gui/sharelinkwidget.ui index 90280074c..633b4bafc 100644 --- a/src/gui/sharelinkwidget.ui +++ b/src/gui/sharelinkwidget.ui @@ -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"> - <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> + <widget class="QWidget" name="shareLinkWidget" native="true"> + <property name="enabled"> + <bool>true</bool> </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,95 +67,122 @@ <height>0</height> </size> </property> - <property name="maximumSize"> - <size> - <width>350</width> - <height>26</height> - </size> - </property> - <property name="text"> - <string>&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/> + <layout class="QHBoxLayout" name="shareLinkLayout"> + <property name="spacing"> + <number>3</number> + </property> + <property name="sizeConstraint"> + <enum>QLayout::SetFixedSize</enum> + </property> + <property name="leftMargin"> + <number>0</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="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>&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="shareProperties" native="true"> + <widget class="QWidget" name="passwordShareProperty" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -186,22 +191,25 @@ </property> <property name="minimumSize"> <size> - <width>0</width> + <width>300</width> <height>0</height> </size> </property> <property name="maximumSize"> <size> - <width>350</width> + <width>16777215</width> <height>16777215</height> </size> </property> - <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0"> + <layout class="QHBoxLayout" name="passwordHorizontalLayout"> + <property name="spacing"> + <number>0</number> + </property> <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> <property name="leftMargin"> - <number>0</number> + <number>18</number> </property> <property name="topMargin"> <number>0</number> @@ -212,74 +220,68 @@ <property name="bottomMargin"> <number>0</number> </property> - <property name="horizontalSpacing"> - <number>0</number> - </property> - <property name="verticalSpacing"> - <number>5</number> - </property> - <item row="0" column="4"> - <widget class="QPushButton" name="pushButton_setPassword"> + <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"> + <item> + <widget class="QLineEdit" name="lineEdit_password"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>130</width> - <height>0</height> + <width>120</width> + <height>26</height> </size> </property> <property name="maximumSize"> <size> - <width>16777215</width> + <width>100</width> <height>16777215</height> </size> </property> - <property name="text"> - <string>&Expiration date</string> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QCheckBox" name="checkBox_password"> + <item> + <widget class="QPushButton" name="confirmPassword"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>130</width> - <height>0</height> + <width>18</width> + <height>26</height> </size> </property> <property name="maximumSize"> @@ -288,60 +290,135 @@ <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>&Password</string> + <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> - <item row="0" column="3"> - <widget class="QLineEdit" name="lineEdit_password"> + </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="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>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"> <size> - <width>100</width> + <width>16777215</width> <height>16777215</height> </size> </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + <property name="calendarPopup"> + <bool>true</bool> </property> </widget> </item> - <item row="4" column="4"> - <widget class="QDateEdit" name="calendar"> + <item> + <widget class="QPushButton" name="confirmExpirationDate"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Maximum"> + <sizepolicy hsizetype="Maximum" 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> + <width>18</width> <height>16777215</height> </size> </property> - <property name="calendarPopup"> + <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> @@ -352,7 +429,7 @@ <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> diff --git a/src/gui/shareusergroupwidget.ui b/src/gui/shareusergroupwidget.ui index bf3cc2af3..0ca85c7c9 100644 --- a/src/gui/shareusergroupwidget.ui +++ b/src/gui/shareusergroupwidget.ui @@ -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,15 +73,15 @@ <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> + <width>250</width> + <height>26</height> </size> </property> <property name="maximumSize"> @@ -90,6 +90,9 @@ <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> @@ -98,14 +101,14 @@ <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>130</width> + <width>98</width> <height>26</height> </size> </property> @@ -115,8 +118,14 @@ <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> diff --git a/src/gui/shareuserline.ui b/src/gui/shareuserline.ui index 7580882ad..e00b4bd86 100644 --- a/src/gui/shareuserline.ui +++ b/src/gui/shareuserline.ui @@ -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> |