Merge pull request #344 from nextcloud/fix-share-dialog

Fix share dialog
This commit is contained in:
Roeland Jago Douma 2018-08-02 22:13:30 +02:00 committed by GitHub
commit 30fc87daea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1365 additions and 942 deletions

View file

@ -30,6 +30,12 @@
<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>
<file>resources/copy.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

Width:  |  Height:  |  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

Width:  |  Height:  |  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

Width:  |  Height:  |  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

Width:  |  Height:  |  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

@ -12,11 +12,11 @@
* for more details.
*/
#include "ui_sharedialog.h"
#include "sharedialog.h"
#include "sharee.h"
#include "sharelinkwidget.h"
#include "shareusergroupwidget.h"
#include "ui_sharedialog.h"
#include "account.h"
#include "accountstate.h"
@ -49,9 +49,9 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
, _maxSharingPermissions(maxSharingPermissions)
, _privateLinkUrl(accountState->account()->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded))
, _startPage(startPage)
, _linkWidget(NULL)
, _userGroupWidget(NULL)
, _progressIndicator(NULL)
, _linkWidget(nullptr)
, _userGroupWidget(nullptr)
, _progressIndicator(nullptr)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WA_DeleteOnClose);
@ -59,16 +59,9 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
_ui->setupUi(this);
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close);
// We want to act on account state changes
connect(_accountState.data(), &AccountState::stateChanged, this, &ShareDialog::slotAccountStateChanged);
// Because people press enter in the dialog and we don't want to close for that
closeButton->setDefault(false);
closeButton->setAutoDefault(false);
// Set icon
QFileInfo f_info(_localPath);
QFileIconProvider icon_provider;
@ -76,8 +69,6 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
auto pixmap = icon.pixmap(thumbnailSize, thumbnailSize);
if (pixmap.width() > 0) {
_ui->label_icon->setPixmap(pixmap);
} else {
_ui->label_icon->hide();
}
// Set filename
@ -88,7 +79,6 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
f.setPointSize(f.pointSize() * 1.4);
_ui->label_name->setFont(f);
_ui->label_sharePath->setWordWrap(true);
QString ocDir(_sharePath);
ocDir.truncate(ocDir.length() - fileName.length());
@ -111,11 +101,11 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
this->setWindowTitle(tr("%1 Sharing").arg(Theme::instance()->appNameGUI()));
if (!accountState->account()->capabilities().shareAPI()) {
auto label = new QLabel(tr("The server does not allow sharing"));
label->setWordWrap(true);
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout()->replaceWidget(_ui->shareWidgets, label);
_ui->shareWidgets->hide();
// TODO do we want to display it?
//auto label = new QLabel(tr("The server does not allow sharing"));
//label->setWordWrap(true);
//label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//layout()->replaceWidget(_ui->shareWidgets, label);
return;
}
@ -125,10 +115,11 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
job->start();
}
_progressIndicator = new QProgressIndicator(this);
_progressIndicator->startAnimation();
_progressIndicator->setToolTip(tr("Retrieving maximum possible sharing permissions from server..."));
_ui->buttonBoxLayout->insertWidget(0, _progressIndicator);
//TODO Progress Indicator where should it go?
// _progressIndicator = new QProgressIndicator(this);
// _progressIndicator->startAnimation();
// _progressIndicator->setToolTip(tr("Retrieving maximum possible sharing permissions from server..."));
// _ui->buttonBoxLayout->insertWidget(0, _progressIndicator);
// Server versions >= 9.1 support the "share-permissions" property
// older versions will just return share-permissions: ""
@ -187,7 +178,7 @@ void ShareDialog::slotPropfindError()
void ShareDialog::showSharingUi()
{
_progressIndicator->stopAnimation();
//_progressIndicator->stopAnimation();
auto theme = Theme::instance();
@ -199,8 +190,6 @@ void ShareDialog::showSharingUi()
auto label = new QLabel(this);
label->setText(tr("The file can not be shared because it was shared without sharing permission."));
label->setWordWrap(true);
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout()->replaceWidget(_ui->shareWidgets, label);
return;
}
@ -211,18 +200,17 @@ void ShareDialog::showSharingUi()
if (userGroupSharing) {
_userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _privateLinkUrl, this);
_ui->shareWidgets->addTab(_userGroupWidget, tr("Users and Groups"));
_ui->verticalLayout->insertWidget(1, _userGroupWidget);
_userGroupWidget->getShares();
}
if (theme->linkSharing()) {
_linkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this);
_linkWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
_ui->shareWidgets->addTab(_linkWidget, tr("Public Links"));
_ui->verticalLayout->insertWidget(2, _linkWidget);
_linkWidget->getShares();
if (_startPage == ShareDialogStartPage::PublicLinks)
_ui->shareWidgets->setCurrentWidget(_linkWidget);
_ui->verticalLayout->insertWidget(3, _linkWidget);
}
}
@ -245,11 +233,11 @@ void ShareDialog::slotAccountStateChanged(int state)
bool enabled = (state == AccountState::State::Connected);
qCDebug(lcSharing) << "Account connected?" << enabled;
if (_userGroupWidget != NULL) {
if (_userGroupWidget != nullptr) {
_userGroupWidget->setEnabled(enabled);
}
if (_linkWidget != NULL) {
if (_linkWidget != nullptr) {
_linkWidget->setEnabled(enabled);
}
}

View file

@ -60,6 +60,7 @@ private:
void showSharingUi();
Ui::ShareDialog *_ui;
QPointer<AccountState> _accountState;
QString _sharePath;
QString _localPath;

View file

@ -6,40 +6,81 @@
<rect>
<x>0</x>
<y>0</y>
<width>408</width>
<height>281</height>
<width>360</width>
<height>120</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>360</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>360</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>10</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>15</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">
<item row="0" column="1">
<widget class="QLabel" name="label_name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>share label</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0">
<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="spacing">
<number>10</number>
</property>
<item row="1" column="1">
<widget class="QLabel" name="label_sharePath">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>210</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
@ -52,37 +93,175 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_icon">
<property name="text">
<string>TextLabel</string>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="shareWidgets"/>
</item>
<item>
<layout class="QHBoxLayout" name="buttonBoxLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<item row="0" column="1">
<widget class="QLabel" name="label_name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
<property name="minimumSize">
<size>
<width>210</width>
<height>0</height>
</size>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string>share label</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Icon</string>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>45</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>340</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="scrollAreaVerticalLayout">
<property name="spacing">
<number>0</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>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>

View file

@ -13,8 +13,8 @@
* for more details.
*/
#include "sharelinkwidget.h"
#include "ui_sharelinkwidget.h"
#include "sharelinkwidget.h"
#include "account.h"
#include "capabilities.h"
@ -32,8 +32,6 @@
namespace OCC {
const char propertyShareC[] = "oc_share";
ShareLinkWidget::ShareLinkWidget(AccountPtr account,
const QString &sharePath,
const QString &localPath,
@ -44,81 +42,69 @@ 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);
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);
// TODO: where to loading should show up?
// _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->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()) {
@ -133,40 +119,12 @@ 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"));
// _ui->widget_editing->setVisible(
// !_isFile && _account->capabilities().sharePublicLinkAllowUpload());
//_ui->radio_uploadOnly->setVisible(
//_account->capabilities().sharePublicLinkSupportsUploadOnly());
/*
* Create the share manager and connect it properly
@ -197,193 +155,192 @@ 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 & (SharePermissionRead & SharePermissionUpdate);
_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 & SharePermissionRead;
_readOnlyLinkAction = permissionsGroup->addAction(tr("Read only"));
_readOnlyLinkAction->setCheckable(true);
_readOnlyLinkAction->setChecked(checked);
checked = perm & (SharePermissionRead &
SharePermissionCreate &
SharePermissionUpdate &
SharePermissionDelete);
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow Upload && Editing"));
_allowUploadEditingLinkAction->setCheckable(true);
_allowUploadEditingLinkAction->setChecked(checked);
checked = perm & SharePermissionCreate;
_allowUploadLinkAction = permissionsGroup->addAction(tr("File Drop (Upload Only)"));
_allowUploadLinkAction->setCheckable(true);
_allowUploadLinkAction->setChecked(checked);
}
}
if (!_namesSupported) {
_ui->createShareButton->setEnabled(table->rowCount() == 0);
}
}
// Prepare sharing menu
_linkContextMenu = new QMenu(this);
void ShareLinkWidget::slotShareSelectionChanged()
{
// Disable running progress indicators
_pi_create->stopAnimation();
_pi_editing->stopAnimation();
_pi_date->stopAnimation();
_pi_password->stopAnimation();
// Add copy action (icon only)
_copyLinkAction = _linkContextMenu->addAction(QIcon(":/client/resources/copy.svg"),
tr("Copy link"));
_ui->errorLabel->hide();
// Adds permissions actions (radio button style)
if(_isFile){
_linkContextMenu->addAction(_allowEditingLinkAction);
} else {
_linkContextMenu->addAction(_readOnlyLinkAction);
_linkContextMenu->addAction(_allowUploadEditingLinkAction);
_linkContextMenu->addAction(_allowUploadLinkAction);
}
auto share = selectedShare();
if (!share) {
_selectedShareId.clear();
_ui->shareProperties->setEnabled(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);
// Adds action to display password widget (check box)
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password Protect"));
_passwordProtectLinkAction->setCheckable(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);
}
// Password state
_ui->checkBox_password->setText(tr("P&assword protect"));
if (!selectionUnchanged) {
if (share->isPasswordSet()) {
_ui->checkBox_password->setChecked(true);
if(_linkShare->isPasswordSet()){
_passwordProtectLinkAction->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->passwordShareProperty->show();
}
_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);
}
// Public upload state (box is hidden for files)
if (!_isFile) {
if (share->getPublicUpload()) {
if (share->getShowFileListing()) {
_ui->radio_readWrite->setChecked(true);
} else {
_ui->radio_uploadOnly->setChecked(true);
}
} else {
_ui->radio_readOnly->setChecked(true);
// 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);
}
}
// TODO
//void ShareLinkWidget::slotShareSelectionChanged()
//{
// // Disable running progress indicators
// _pi_create->stopAnimation();
// _pi_editing->stopAnimation();
// _pi_date->stopAnimation();
// _pi_password->stopAnimation();
// _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 (_linkShare->getPublicUpload()) {
// if (_linkShare->getShowFileListing()) {
// _allowUploadEditingLinkAction->setChecked(true);
// } else {
// _allowUploadLinkAction->setChecked(true);
// }
// } else {
// _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();
@ -391,60 +348,54 @@ 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);
}
}
void ShareLinkWidget::slotPasswordSet()
{
auto share = selectedShare();
if (sender() != share.data())
if (!_linkShare)
return;
_pi_password->stopAnimation();
_ui->checkBox_password->setEnabled(true);
_ui->lineEdit_password->setText(QString());
if (share->isPasswordSet()) {
if (_linkShare->isPasswordSet()) {
_ui->lineEdit_password->setPlaceholderText("********");
_ui->lineEdit_password->setEnabled(true);
} else {
_ui->lineEdit_password->setPlaceholderText(QString());
_ui->lineEdit_password->setEnabled(false);
}
/*
@ -457,44 +408,24 @@ void ShareLinkWidget::slotPasswordSet()
getShares();
}
void ShareLinkWidget::slotShareNameEntered()
{
if (!_manager) {
return;
}
_pi_create->startAnimation();
_manager->createLinkShare(_sharePath, _ui->nameLineEdit->text(), QString());
}
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->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();
@ -502,61 +433,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 =
@ -564,91 +468,64 @@ 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){
// TODO: dlete is not hapenning correctly
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 |= 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();
}
}
@ -666,9 +543,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

@ -55,30 +55,25 @@ public:
QWidget *parent = 0);
~ShareLinkWidget();
void getShares();
void toggleButton(bool show);
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);
@ -86,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;
@ -116,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

@ -6,82 +6,74 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>568</height>
<width>350</width>
<height>126</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>110</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Share NewDocument.odt</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>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="QLabel" name="publicLinkWarningLabel">
<property name="text">
<string>Anyone with the link has access to the file/folder</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<widget class="QWidget" name="shareLinkWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_create">
<item>
<widget class="QLineEdit" name="nameLineEdit">
<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="text">
<string>&amp;Create new</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="linkShares">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</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="columnCount">
<number>3</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column/>
<column/>
<column/>
</widget>
</item>
<item>
<widget class="QWidget" name="shareProperties" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<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>
@ -94,201 +86,341 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_expire">
<property name="leftMargin">
<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>242</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>82</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.svg</normaloff>:/client/resources/more.svg</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="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="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>162</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Password:</string>
</property>
<property name="indent">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="checkBox_expire">
<property name="text">
<string>Set &amp;expiration date</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="calendar">
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>20</number>
<item>
<widget class="QLineEdit" name="lineEdit_password">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<widget class="QLineEdit" name="lineEdit_password">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_setPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Set &amp;password </string>
</property>
</widget>
</item>
</layout>
<property name="minimumSize">
<size>
<width>120</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</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>
</widget>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_password">
<item>
<widget class="QCheckBox" name="checkBox_password">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Set password</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<item>
<widget class="QPushButton" name="confirmPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" 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>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>
<item row="2" column="0">
<widget class="QWidget" name="widget_editing" native="true">
<layout class="QGridLayout" name="layout_editing">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Recipients can view or download contents.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<widget class="QRadioButton" name="radio_uploadOnly">
<property name="text">
<string>Upload only (File Drop)</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Receive files from others without revealing the contents of the folder.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="radio_readOnly">
<property name="text">
<string>Download / View</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="radio_readWrite">
<property name="text">
<string>Download / View / Upload</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Recipients can view, download, edit, delete and upload contents.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
</layout>
</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">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="calendarPopup">
<bool>true</bool>
</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>
@ -297,11 +429,23 @@
<item>
<widget class="QLabel" name="errorLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" 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>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="palette">
<palette>
<active>
@ -345,21 +489,25 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>nameLineEdit</tabstop>
<tabstop>createShareButton</tabstop>
<tabstop>linkShares</tabstop>
<tabstop>checkBox_password</tabstop>
<tabstop>lineEdit_password</tabstop>
<tabstop>pushButton_setPassword</tabstop>
<tabstop>checkBox_expire</tabstop>
<tabstop>calendar</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../client.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -12,9 +12,9 @@
* for more details.
*/
#include "shareusergroupwidget.h"
#include "ui_shareusergroupwidget.h"
#include "ui_shareuserline.h"
#include "shareusergroupwidget.h"
#include "account.h"
#include "folderman.h"
#include "folder.h"
@ -34,7 +34,6 @@
#include <QFileInfo>
#include <QAbstractProxyModel>
#include <QCompleter>
#include <qscrollarea.h>
#include <qlayout.h>
#include <QPropertyAnimation>
#include <QMenu>
@ -44,6 +43,7 @@
#include <QCryptographicHash>
#include <QColor>
#include <QPainter>
#include <QListWidget>
namespace OCC {
@ -87,7 +87,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
connect(_manager, &ShareManager::shareCreated, this, &ShareUserGroupWidget::getShares);
connect(_manager, &ShareManager::serverError, this, &ShareUserGroupWidget::displayError);
connect(_ui->shareeLineEdit, &QLineEdit::returnPressed, this, &ShareUserGroupWidget::slotLineEditReturn);
connect(_ui->privateLinkText, &QLabel::linkActivated, this, &ShareUserGroupWidget::slotPrivateLinkShare);
//TODO connect(_ui->privateLinkText, &QLabel::linkActivated, this, &ShareUserGroupWidget::slotPrivateLinkShare);
// By making the next two QueuedConnections we can override
// the strings the completer sets on the line edit.
@ -99,15 +99,18 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
// Queued connection so this signal is recieved after textChanged
connect(_ui->shareeLineEdit, &QLineEdit::textEdited,
this, &ShareUserGroupWidget::slotLineEditTextEdited, Qt::QueuedConnection);
_ui->shareeLineEdit->installEventFilter(this);
connect(&_completionTimer, &QTimer::timeout, this, &ShareUserGroupWidget::searchForSharees);
_completionTimer.setSingleShot(true);
_completionTimer.setInterval(600);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
_ui->errorLabel->hide();
// TODO Progress Indicator where should it go?
// Setup the sharee search progress indicator
_ui->shareeHorizontalLayout->addWidget(&_pi_sharee);
//_ui->shareeHorizontalLayout->addWidget(&_pi_sharee);
_parentScrollArea = parentWidget()->findChild<QScrollArea*>("scrollArea");
}
ShareUserGroupWidget::~ShareUserGroupWidget()
@ -118,6 +121,7 @@ ShareUserGroupWidget::~ShareUserGroupWidget()
void ShareUserGroupWidget::on_shareeLineEdit_textChanged(const QString &)
{
_completionTimer.stop();
emit togglePublicLinkShare(false);
}
void ShareUserGroupWidget::slotLineEditTextEdited(const QString &text)
@ -127,6 +131,7 @@ void ShareUserGroupWidget::slotLineEditTextEdited(const QString &text)
// Then we restart the timer here if the user touched a key
if (!text.isEmpty()) {
_completionTimer.start();
emit togglePublicLinkShare(true);
}
}
@ -163,7 +168,7 @@ void ShareUserGroupWidget::searchForSharees()
QSharedPointer<Sharee> currentUser(new Sharee(_account->credentials()->user(), "", Sharee::Type::User));
blacklist << currentUser;
foreach (auto sw, _ui->scrollArea->findChildren<ShareUserLine *>()) {
foreach (auto sw, _parentScrollArea->findChildren<ShareUserLine *>()) {
blacklist << sw->share()->getShareWith();
}
_ui->errorLabel->hide();
@ -177,23 +182,20 @@ void ShareUserGroupWidget::getShares()
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _ui->scrollArea;
QScrollArea *scrollArea = _parentScrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
layout->setMargin(0);
layout->setSpacing(0);
QSize minimumSize = newViewPort->sizeHint();
int x = 0;
foreach (const auto &share, shares) {
// We don't handle link shares
// We don't handle link shares, only TypeUser or TypeGroup
if (share->getShareType() == Share::TypeLink) {
continue;
}
ShareUserLine *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _ui->scrollArea);
ShareUserLine *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _parentScrollArea);
connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize);
connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares);
s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
@ -206,10 +208,12 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
}
}
if (layout->isEmpty()) {
layout->addWidget(new QLabel(tr("The item is not shared with any users or groups")));
} else {
if (!layout->isEmpty()) {
_parentScrollArea->setVisible(true);
layout->addStretch(1);
} else {
_parentScrollArea->setVisible(false);
}
minimumSize.rwidth() += layout->spacing();
@ -223,8 +227,9 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
void ShareUserGroupWidget::slotAdjustScrollWidgetSize()
{
QScrollArea *scrollArea = _ui->scrollArea;
if (scrollArea->findChildren<ShareUserLine *>().count() <= 3) {
QScrollArea *scrollArea = _parentScrollArea;
if (scrollArea->findChildren<ShareUserLine *>().count() <= 3 &&
scrollArea->findChildren<ShareUserLine *>().count() > 0) {
auto minimumSize = scrollArea->widget()->sizeHint();
auto spacing = scrollArea->widget()->layout()->spacing();
minimumSize.rwidth() += spacing;
@ -238,12 +243,9 @@ void ShareUserGroupWidget::slotPrivateLinkShare()
auto menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(tr("Open link in browser"),
this, SLOT(slotPrivateLinkOpenBrowser()));
menu->addAction(tr("Copy link to clipboard"),
menu->addAction(QIcon(":/client/resources/copy.svg"),
tr("Copy link"),
this, SLOT(slotPrivateLinkCopy()));
menu->addAction(tr("Send link by email"),
this, SLOT(slotPrivateLinkEmail()));
menu->exec(QCursor::pos());
}
@ -266,22 +268,25 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
// model proxying the _completerModel
auto sharee = qvariant_cast<QSharedPointer<Sharee>>(index.data(Qt::UserRole));
if (sharee.isNull()) {
_parentScrollArea->setVisible(false);
return;
}
/*
* Add spinner to the bottom of the widget list
*/
auto viewPort = _ui->scrollArea->widget();
auto viewPort = _parentScrollArea->widget();
auto layout = qobject_cast<QVBoxLayout *>(viewPort->layout());
auto indicator = new QProgressIndicator(viewPort);
indicator->startAnimation();
if (layout->count() == 1) {
// No shares yet! Remove the label, add some stretch.
delete layout->itemAt(0)->widget();
layout->addStretch(1);
}
layout->insertWidget(layout->count() - 1, indicator);
// TODO Progress Indicator where should it go?
// auto indicator = new QProgressIndicator(viewPort);
// indicator->startAnimation();
// if (layout->count() == 1) {
// // No shares yet! Remove the label, add some stretch.
// delete layout->itemAt(0)->widget();
// layout->addStretch(1);
// }
// layout->insertWidget(layout->count() - 1, indicator);
/*
* Don't send the reshare permissions for federated shares for servers <9.1
@ -297,12 +302,20 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), SharePermission(permissions));
} else {
// Default permissions on creation
int permissions = SharePermissionRead | SharePermissionUpdate;
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), SharePermissionDefault);
sharee->shareWith(), SharePermission(permissions));
}
_ui->shareeLineEdit->setEnabled(false);
_ui->shareeLineEdit->setText(QString());
if(layout->isEmpty())
_parentScrollArea->setVisible(false);
else
_parentScrollArea->setVisible(true);
}
void ShareUserGroupWidget::slotCompleterHighlighted(const QModelIndex &index)
@ -317,7 +330,7 @@ void ShareUserGroupWidget::displayError(int code, const QString &message)
_pi_sharee.stopAnimation();
// Also remove the spinner in the widget list, if any
foreach (auto pi, _ui->scrollArea->findChildren<QProgressIndicator *>()) {
foreach (auto pi, _parentScrollArea->findChildren<QProgressIndicator *>()) {
delete pi;
}
@ -356,60 +369,66 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
{
_ui->setupUi(this);
_ui->sharedWith->setText(share->getShareWith()->format());
QString sharedWithText(share->getShareWith()->format());
QFontMetrics metrics(_ui->sharedWith->font());
QString elidedText = metrics.elidedText(sharedWithText, Qt::ElideRight, _ui->sharedWith->width());
_ui->sharedWith->setText(elidedText);
// Create detailed permissions menu
// adds permissions
// can edit permission
bool enabled = maxSharingPermissions & (SharePermissionRead & SharePermissionUpdate);
if(!_isFile) enabled = enabled & (SharePermissionCreate & SharePermissionDelete);
_ui->permissionsEdit->setEnabled(enabled);
connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged);
// create menu with checkable permissions
QMenu *menu = new QMenu(this);
_permissionCreate = new QAction(tr("create"), this);
_permissionCreate->setCheckable(true);
_permissionCreate->setEnabled(maxSharingPermissions & SharePermissionCreate);
_permissionUpdate = new QAction(tr("change"), this);
_permissionUpdate->setCheckable(true);
_permissionUpdate->setEnabled(maxSharingPermissions & SharePermissionUpdate);
_permissionDelete = new QAction(tr("delete"), this);
_permissionDelete->setCheckable(true);
_permissionDelete->setEnabled(maxSharingPermissions & SharePermissionDelete);
_permissionReshare= new QAction(tr("Can reshare"));
_permissionReshare->setCheckable(true);
_permissionReshare->setEnabled(maxSharingPermissions & SharePermissionShare);
menu->addAction(_permissionReshare);
connect(_permissionReshare, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
menu->addAction(_permissionUpdate);
/*
* Files can't have create or delete permissions
*/
if (!_isFile) {
_permissionCreate = new QAction(tr("Can create"));
_permissionCreate->setCheckable(true);
_permissionCreate->setEnabled(maxSharingPermissions & SharePermissionCreate);
menu->addAction(_permissionCreate);
connect(_permissionCreate, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
_permissionChange = new QAction(tr("Can change"));
_permissionChange->setCheckable(true);
_permissionChange->setEnabled(maxSharingPermissions & SharePermissionUpdate);
menu->addAction(_permissionChange);
connect(_permissionChange, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
_permissionDelete = new QAction(tr("Can delete"));
_permissionDelete->setCheckable(true);
_permissionDelete->setEnabled(maxSharingPermissions & SharePermissionDelete);
menu->addAction(_permissionDelete);
connect(_permissionDelete, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
}
_ui->permissionToolButton->setMenu(menu);
_ui->permissionToolButton->setPopupMode(QToolButton::InstantPopup);
QIcon icon(QLatin1String(":/client/resources/more.svg"));
_ui->permissionToolButton->setIcon(icon);
// If there's only a single entry in the detailed permission menu, hide it
if (menu->actions().size() == 1) {
_ui->permissionToolButton->hide();
}
// Set the permissions checkboxes
displayPermissions();
_ui->permissionShare->setEnabled(maxSharingPermissions & SharePermissionShare);
_ui->permissionsEdit->setEnabled(maxSharingPermissions
& (SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete));
connect(_permissionUpdate, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
connect(_permissionCreate, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
connect(_permissionDelete, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
connect(_ui->permissionShare, &QAbstractButton::clicked, this, &ShareUserLine::slotPermissionsChanged);
connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged);
/*
* We don't show permssion share for federated shares with server <9.1
* We don't show permission share for federated shares with server <9.1
* https://github.com/owncloud/core/issues/22122#issuecomment-185637344
* https://github.com/owncloud/client/issues/4996
*/
if (share->getShareType() == Share::TypeRemote
&& share->account()->serverVersionInt() < Account::makeServerVersion(9, 1, 0)) {
_ui->permissionShare->setVisible(false);
_permissionReshare->setVisible(false);
_ui->permissionToolButton->setVisible(false);
}
@ -417,10 +436,10 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
connect(share.data(), &Share::shareDeleted, this, &ShareUserLine::slotShareDeleted);
_ui->deleteShareButton->setIcon(QIcon::fromTheme(QLatin1String("user-trash"),
QIcon(QLatin1String(":/client/resources/delete.png"))));
QIcon(QLatin1String(":/client/resources/delete.png"))));
if (!share->account()->capabilities().shareResharing()) {
_ui->permissionShare->hide();
_permissionReshare->setVisible(false);
}
loadAvatar();
@ -507,12 +526,12 @@ void ShareUserLine::slotEditPermissionsChanged()
Share::Permissions permissions = SharePermissionRead;
if (_ui->permissionShare->checkState() == Qt::Checked) {
if (_permissionReshare->isChecked()) {
permissions |= SharePermissionShare;
}
if (_ui->permissionsEdit->checkState() == Qt::Checked) {
if (_permissionUpdate->isEnabled())
if (_permissionChange->isEnabled())
permissions |= SharePermissionUpdate;
/*
@ -535,22 +554,24 @@ void ShareUserLine::slotPermissionsChanged()
Share::Permissions permissions = SharePermissionRead;
if (_permissionUpdate->isChecked()) {
permissions |= SharePermissionUpdate;
}
if (_permissionCreate->isChecked()) {
permissions |= SharePermissionCreate;
}
if (_permissionDelete->isChecked()) {
permissions |= SharePermissionDelete;
}
if (_ui->permissionShare->checkState() == Qt::Checked) {
if (_permissionReshare->isChecked()) {
permissions |= SharePermissionShare;
}
if (!_isFile) {
if (_permissionCreate->isChecked()) {
permissions |= SharePermissionCreate;
}
if (_permissionChange->isChecked()) {
permissions |= SharePermissionUpdate;
}
if (_permissionDelete->isChecked()) {
permissions |= SharePermissionDelete;
}
}
_share->setPermissions(permissions);
}
@ -595,19 +616,6 @@ void ShareUserLine::displayPermissions()
{
auto perm = _share->getPermissions();
_permissionUpdate->setChecked(false);
_permissionCreate->setChecked(false);
_permissionDelete->setChecked(false);
if (perm & SharePermissionUpdate) {
_permissionUpdate->setChecked(true);
}
if (!_isFile && perm & SharePermissionCreate) {
_permissionCreate->setChecked(true);
}
if (!_isFile && perm & SharePermissionDelete) {
_permissionDelete->setChecked(true);
}
if (perm & SharePermissionUpdate
&& (_isFile
|| (perm & SharePermissionCreate
@ -619,9 +627,15 @@ void ShareUserLine::displayPermissions()
_ui->permissionsEdit->setCheckState(Qt::Unchecked);
}
_ui->permissionShare->setCheckState(Qt::Unchecked);
if (_share->getPermissions() & SharePermissionShare) {
_ui->permissionShare->setCheckState(Qt::Checked);
_permissionReshare->setChecked(Qt::Unchecked);
if (perm & SharePermissionShare) {
_permissionReshare->setChecked(Qt::Checked);
}
if(!_isFile){
_permissionCreate->setChecked(perm & SharePermissionCreate);
_permissionChange->setChecked(perm & SharePermissionUpdate);
_permissionDelete->setChecked(perm & SharePermissionDelete);
}
}
}

View file

@ -24,6 +24,7 @@
#include <QList>
#include <QVector>
#include <QTimer>
#include <qscrollarea.h>
class QAction;
class QCompleter;
@ -61,6 +62,9 @@ public:
QWidget *parent = 0);
~ShareUserGroupWidget();
signals:
void togglePublicLinkShare(bool);
public slots:
void getShares();
@ -85,6 +89,7 @@ private slots:
private:
Ui::ShareUserGroupWidget *_ui;
QScrollArea *_parentScrollArea;
AccountPtr _account;
QString _sharePath;
QString _localPath;
@ -141,8 +146,10 @@ private:
QSharedPointer<Share> _share;
bool _isFile;
// _permissionEdit is a checkbox
QAction *_permissionReshare;
QAction *_permissionCreate;
QAction *_permissionUpdate;
QAction *_permissionChange;
QAction *_permissionDelete;
};
}

View file

@ -6,27 +6,149 @@
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>273</height>
<width>350</width>
<height>55</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>55</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Share NewDocument.odt</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
<property name="spacing">
<number>0</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>
<layout class="QHBoxLayout" name="shareeHorizontalLayout">
<layout class="QHBoxLayout" name="shareeHorizontalLayout" stretch="0,0">
<property name="spacing">
<number>0</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="QLineEdit" name="shareeLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>332</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<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="QPushButton" name="confirmShare">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</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>
</item>
<item>
<widget class="QLabel" name="errorLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="palette">
<palette>
<active>
@ -64,6 +186,9 @@
</disabled>
</palette>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string notr="true">Placeholder for Error text</string>
</property>
@ -73,48 +198,19 @@
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="margin">
<number>0</number>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>377</width>
<height>169</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3"/>
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="privateLinkText">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;You can direct people to this shared file or folder &lt;a href=&quot;private link menu&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;by giving them a private link&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<resources>
<include location="../../client.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -9,85 +9,203 @@
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>46</height>
<width>350</width>
<height>45</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>45</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>46</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,3,2,2,2">
<property name="spacing">
<number>5</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="avatar">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sharedWith">
<property name="text">
<string>TextLabel</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="permissionShare">
<property name="text">
<string>can share</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionsEdit">
<property name="text">
<string>can edit</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="permissionToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deleteShareButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="user-trash">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
</layout>
<widget class="QLabel" name="avatar">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<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>
<widget class="QLabel" name="sharedWith">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>User name</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="permissionsEdit">
<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="text">
<string>can edit</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>26</width>
<height>26</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../client.qrc">
<normaloff>:/client/resources/more.svg</normaloff>:/client/resources/more.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deleteShareButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="user-trash">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../client.qrc"/>
</resources>
<connections/>
</ui>