Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCamila San <hello@camila.codes>2018-03-15 21:43:26 +0300
committerCamila San <hello@camila.codes>2018-08-02 20:52:27 +0300
commit55b0b46bb6a3cfc1daf4186c50f5e37c5d9f62f1 (patch)
tree8fcc7e3abce3543dd8d59a931c68ba1f2c74af0e /src
parent4ecfab4bf38c541d2c2d849c36a0b9c94733d202 (diff)
Changes size, size policy, content and margins of the share dialog and its widgets.
- Adds select with permissions to share dialog on the user/group search. - Changes order of widgets, removes excess of text and do not display empty widgets. - Share user/group widget: replaces combo box for tool button with permissions. - Using Fixed as size policy it gives a much smoother user experience when windows size dinamically changes. Signed-off-by: Camila San <hello@camila.codes>
Diffstat (limited to 'src')
-rw-r--r--src/gui/sharedialog.cpp53
-rw-r--r--src/gui/sharedialog.h1
-rw-r--r--src/gui/sharedialog.ui166
-rw-r--r--src/gui/sharelinkwidget.cpp104
-rw-r--r--src/gui/sharelinkwidget.h1
-rw-r--r--src/gui/sharelinkwidget.ui520
-rw-r--r--src/gui/shareusergroupwidget.cpp149
-rw-r--r--src/gui/shareusergroupwidget.h3
-rw-r--r--src/gui/shareusergroupwidget.ui199
-rw-r--r--src/gui/shareuserline.ui232
10 files changed, 948 insertions, 480 deletions
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index 0355665ff..5efc35503 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -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,9 +101,10 @@ 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);
+ //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;
}
@@ -123,10 +114,10 @@ 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);
+// _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: ""
@@ -185,7 +176,7 @@ void ShareDialog::slotPropfindError()
void ShareDialog::showSharingUi()
{
- _progressIndicator->stopAnimation();
+ //_progressIndicator->stopAnimation();
auto theme = Theme::instance();
@@ -197,8 +188,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;
}
@@ -209,14 +198,14 @@ void ShareDialog::showSharingUi()
if (userGroupSharing) {
_userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _privateLinkUrl, this);
- _ui->verticalLayout->addWidget(_userGroupWidget);
+ connect(_userGroupWidget, &ShareUserGroupWidget::togglePublicLinkShare, this, &ShareDialog::slotTogglePublicLinkShareDisplay);
+ _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->verticalLayout->addWidget(_linkWidget);
+ _ui->verticalLayout->insertWidget(2, _linkWidget);
_linkWidget->getShares();
if (_startPage == ShareDialogStartPage::PublicLinks)
@@ -224,6 +213,14 @@ 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) {
@@ -243,11 +240,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);
}
}
diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h
index 7aa93cfde..742b39e43 100644
--- a/src/gui/sharedialog.h
+++ b/src/gui/sharedialog.h
@@ -55,6 +55,7 @@ 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 e7c178848..94694ff23 100644
--- a/src/gui/sharedialog.ui
+++ b/src/gui/sharedialog.ui
@@ -6,88 +6,166 @@
<rect>
<x>0</x>
<y>0</y>
- <width>408</width>
- <height>281</height>
+ <width>380</width>
+ <height>150</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>380</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>380</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0">
+ <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">
- <item row="0" column="1">
- <widget class="QLabel" name="label_name">
+ <layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,1" columnminimumwidth="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>
+ <bold>false</bold>
+ </font>
+ </property>
<property name="text">
- <string>share label</string>
+ <string>ownCloud Path:</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="1" column="1">
- <widget class="QLabel" name="label_sharePath">
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_name">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="font">
- <font>
- <weight>50</weight>
- <bold>false</bold>
- </font>
+ <property name="minimumSize">
+ <size>
+ <width>210</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
</property>
<property name="text">
- <string>ownCloud Path:</string>
+ <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="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="buttonBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
+ <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>
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp
index fee86964c..897a53df0 100644
--- a/src/gui/sharelinkwidget.cpp
+++ b/src/gui/sharelinkwidget.cpp
@@ -51,9 +51,9 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
{
_ui->setupUi(this);
- _ui->linkShares->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
- _ui->linkShares->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
- _ui->linkShares->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
+// _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);
@@ -68,10 +68,11 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
_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->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);
@@ -83,9 +84,9 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
connect(_ui->pushButton_setPassword, &QAbstractButton::clicked, this, &ShareLinkWidget::slotPasswordReturnPressed);
connect(_ui->checkBox_expire, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCheckBoxExpireClicked);
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);
+ //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();
@@ -111,6 +112,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
}
_ui->shareProperties->setEnabled(false);
+ _ui->shareProperties->setVisible(false);
_ui->pushButton_setPassword->setEnabled(false);
_ui->lineEdit_password->setEnabled(false);
@@ -150,10 +152,10 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
}
// 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());
+// _ui->widget_editing->setVisible(
+// !_isFile && _account->capabilities().sharePublicLinkAllowUpload());
+ //_ui->radio_uploadOnly->setVisible(
+ //_account->capabilities().sharePublicLinkSupportsUploadOnly());
// Prepare sharing menu
@@ -185,6 +187,13 @@ ShareLinkWidget::~ShareLinkWidget()
delete _ui;
}
+void ShareLinkWidget::toggleButton(bool show){
+ if(show)
+ _ui->createShareButton->show();
+ else
+ _ui->createShareButton->hide();
+}
+
void ShareLinkWidget::getShares()
{
if (_manager) {
@@ -276,8 +285,10 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
}
if (!_namesSupported) {
- _ui->createShareButton->setEnabled(table->rowCount() == 0);
+ _ui->createShareButton->setHidden(table->rowCount() == 0);
}
+ if(table->rowCount() == 0)
+ _ui->linkShares->setHidden(true);
}
void ShareLinkWidget::slotShareSelectionChanged()
@@ -292,11 +303,11 @@ void ShareLinkWidget::slotShareSelectionChanged()
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->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;
@@ -305,14 +316,15 @@ void ShareLinkWidget::slotShareSelectionChanged()
_selectedShareId = share->getId();
_ui->shareProperties->setEnabled(true);
+ _ui->shareProperties->setVisible(true);
_ui->checkBox_password->setEnabled(!_passwordRequired);
_ui->checkBox_expire->setEnabled(!_expiryRequired);
- _ui->widget_editing->setEnabled(true);
- if (!_account->capabilities().sharePublicLinkAllowUpload()) {
- _ui->radio_readWrite->setEnabled(false);
- _ui->radio_uploadOnly->setEnabled(false);
- }
+// _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"));
@@ -342,17 +354,17 @@ void ShareLinkWidget::slotShareSelectionChanged()
}
// 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 (!_isFile) {
+// if (share->getPublicUpload()) {
+// if (share->getShowFileListing()) {
+// //_ui->radio_readWrite->setChecked(true);
+// } else {
+// //_ui->radio_uploadOnly->setChecked(true);
+// }
+// } else {
+// //_ui->radio_readOnly->setChecked(true);
+// }
+// }
}
void ShareLinkWidget::setExpireDate(const QDate &date)
@@ -464,6 +476,9 @@ void ShareLinkWidget::slotShareNameEntered()
}
_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()
@@ -490,11 +505,12 @@ void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message)
_pi_create->stopAnimation();
_pi_password->stopAnimation();
_ui->shareProperties->setEnabled(true);
+ _ui->shareProperties->setVisible(true);
_ui->checkBox_password->setChecked(true);
_ui->checkBox_password->setEnabled(false);
_ui->checkBox_password->setText(tr("Public sh&aring requires a password"));
_ui->checkBox_expire->setEnabled(false);
- _ui->widget_editing->setEnabled(false);
+ //_ui->widget_editing->setEnabled(false);
if (!message.isEmpty()) {
_ui->errorLabel->setText(message);
_ui->errorLabel->show();
@@ -620,17 +636,17 @@ void ShareLinkWidget::slotDeleteShareClicked()
void ShareLinkWidget::slotPermissionsClicked()
{
if (auto current = selectedShare()) {
- _ui->widget_editing->setEnabled(false);
+ //_ui->widget_editing->setEnabled(false);
_pi_editing->startAnimation();
_ui->errorLabel->hide();
SharePermissions perm = SharePermissionRead;
- if (_ui->radio_readWrite->isChecked()) {
- perm = SharePermissionRead | SharePermissionCreate
- | SharePermissionUpdate | SharePermissionDelete;
- } else if (_ui->radio_uploadOnly->isChecked()) {
- perm = SharePermissionCreate;
- }
+// if (_ui->radio_readWrite->isChecked()) {
+// perm = SharePermissionRead | SharePermissionCreate
+// | SharePermissionUpdate | SharePermissionDelete;
+// } else if (_ui->radio_uploadOnly->isChecked()) {
+// perm = SharePermissionCreate;
+// }
current->setPermissions(perm);
}
}
diff --git a/src/gui/sharelinkwidget.h b/src/gui/sharelinkwidget.h
index 365c596b7..5ba11b85d 100644
--- a/src/gui/sharelinkwidget.h
+++ b/src/gui/sharelinkwidget.h
@@ -55,6 +55,7 @@ public:
QWidget *parent = 0);
~ShareLinkWidget();
void getShares();
+ void toggleButton(bool show);
private slots:
void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
diff --git a/src/gui/sharelinkwidget.ui b/src/gui/sharelinkwidget.ui
index e8f7905ef..90280074c 100644
--- a/src/gui/sharelinkwidget.ui
+++ b/src/gui/sharelinkwidget.ui
@@ -6,54 +6,137 @@
<rect>
<x>0</x>
<y>0</y>
- <width>441</width>
- <height>568</height>
+ <width>350</width>
+ <height>238</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>340</width>
+ <height>0</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>5</number>
+ </property>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
<property name="leftMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="topMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="rightMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
- <number>6</number>
+ <number>0</number>
</property>
<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>
+ <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>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="createShareButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>350</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>350</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Create new</string>
+ </property>
+ </widget>
</item>
<item>
<widget class="QTableWidget" name="linkShares">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
+ <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::ScrollBarAlwaysOff</enum>
+ <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>
@@ -64,15 +147,30 @@
<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/>
@@ -80,7 +178,28 @@
</item>
<item>
<widget class="QWidget" name="shareProperties" native="true">
- <layout class="QGridLayout" name="gridLayout_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>350</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
<property name="leftMargin">
<number>0</number>
</property>
@@ -93,202 +212,139 @@
<property name="bottomMargin">
<number>0</number>
</property>
- <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>
+ <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">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ </widget>
</item>
<item row="4" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>20</number>
+ <widget class="QCheckBox" name="checkBox_expire">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>0</height>
+ </size>
</property>
- <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="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Expiration date</string>
+ </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>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="checkBox_password">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Password</string>
+ </property>
</widget>
</item>
- <item row="6" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_expire">
- <property name="leftMargin">
- <number>0</number>
+ <item row="0" column="3">
+ <widget class="QLineEdit" name="lineEdit_password">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
</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>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="4">
+ <widget class="QDateEdit" name="calendar">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="calendarPopup">
+ <bool>true</bool>
+ </property>
+ </widget>
</item>
</layout>
</widget>
@@ -296,11 +352,23 @@
<item>
<widget class="QLabel" name="errorLabel">
<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>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="palette">
<palette>
<active>
@@ -344,21 +412,23 @@
<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>5</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/>
<connections/>
</ui>
diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index a1b9536ec..3983b5a82 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -66,6 +66,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
setObjectName("SharingDialogUG"); // required as group for saveGeometry call
_ui->setupUi(this);
+ _ui->scrollArea->setVisible(false);
//Is this a file or folder?
_isFile = QFileInfo(localPath).isFile();
@@ -99,15 +100,48 @@ 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);
+ //setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
_ui->errorLabel->hide();
// Setup the sharee search progress indicator
_ui->shareeHorizontalLayout->addWidget(&_pi_sharee);
+
+ // adds permissions
+ QMenu *menu = new QMenu(this);
+ QAction *canShare = new QAction(tr("can share"));
+ canShare->setCheckable(true);
+ canShare->setEnabled(true);
+ canShare->setData(QVariant(SharePermissionShare));
+ QAction *canEdit = new QAction(tr("can edit"));
+ canEdit->setCheckable(true);
+ canEdit->setEnabled(true);
+ canEdit->setData(QVariant(SharePermissionUpdate));
+
+ menu->addAction(canShare);
+ menu->addAction(canEdit);
+ /*
+ * Files can't have create or delete permissions
+ */
+ if (!_isFile) {
+ QAction *canCreate= new QAction(tr("can create"));
+ canCreate->setCheckable(true);
+ canCreate->setEnabled(true);
+ canCreate->setData(QVariant(SharePermissionCreate));
+ QAction *canDelete = new QAction(tr("can delete"));
+ canDelete->setCheckable(true);
+ canDelete->setEnabled(true);
+ canDelete->setData(QVariant(SharePermissionDelete));
+ menu->addAction(canCreate);
+ menu->addAction(canDelete);
+ }
+ _ui->permissionToolButton->setDefaultAction(canShare);
+ _ui->permissionToolButton->setMenu(menu);
+ _ui->permissionToolButton->setPopupMode(QToolButton::InstantPopup);
}
ShareUserGroupWidget::~ShareUserGroupWidget()
@@ -118,15 +152,18 @@ ShareUserGroupWidget::~ShareUserGroupWidget()
void ShareUserGroupWidget::on_shareeLineEdit_textChanged(const QString &)
{
_completionTimer.stop();
+ emit togglePublicLinkShare(false);
}
void ShareUserGroupWidget::slotLineEditTextEdited(const QString &text)
{
+ qDebug() << "EDITING!!!!";
_disableCompleterActivated = false;
// First textChanged is called first and we stopped the timer when the text is changed, programatically or not
// Then we restart the timer here if the user touched a key
if (!text.isEmpty()) {
_completionTimer.start();
+ emit togglePublicLinkShare(true);
}
}
@@ -177,57 +214,56 @@ void ShareUserGroupWidget::getShares()
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
- QScrollArea *scrollArea = _ui->scrollArea;
-
- auto newViewPort = new QWidget(scrollArea);
- auto layout = new QVBoxLayout(newViewPort);
- layout->setMargin(0);
- layout->setSpacing(0);
- layout->setAlignment(Qt::AlignVCenter);
-
- QSize minimumSize = newViewPort->sizeHint();
- int x = 0;
-
- foreach (const auto &share, shares) {
- // We don't handle link shares
- if (share->getShareType() == Share::TypeLink) {
- continue;
+ //if(shares.size() > 0){
+ QScrollArea *scrollArea = _ui->scrollArea;
+
+ auto newViewPort = new QWidget(scrollArea);
+ auto layout = new QVBoxLayout(newViewPort);
+ QSize minimumSize = newViewPort->sizeHint();
+ int x = 0;
+
+ foreach (const auto &share, shares) {
+ // We don't handle link shares
+ if (share->getShareType() == Share::TypeLink) {
+ continue;
+ }
+
+ ShareUserLine *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _ui->scrollArea);
+ connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize);
+ connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares);
+ s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
+ layout->addWidget(s);
+
+ x++;
+ if (x <= 3) {
+ minimumSize = newViewPort->sizeHint();
+ } else {
+ minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
+ }
}
- ShareUserLine *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _ui->scrollArea);
- connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize);
- connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares);
- s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
- layout->addWidget(s);
-
- x++;
- if (x <= 3) {
- minimumSize = newViewPort->sizeHint();
- } else {
- minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
+ if (!layout->isEmpty()) {
+ layout->addStretch(1);
}
- }
- if (layout->isEmpty()) {
- QLabel *notSharedYetLabel = new QLabel(tr("The item is not shared with any users or groups"));
- notSharedYetLabel->setAlignment(Qt::AlignHCenter);
- layout->addWidget(notSharedYetLabel);
- } else {
- layout->addStretch(1);
- }
- minimumSize.rwidth() += layout->spacing();
- minimumSize.rheight() += layout->spacing();
- scrollArea->setMinimumSize(minimumSize);
- scrollArea->setWidget(newViewPort);
+ minimumSize.rwidth() += layout->spacing();
+ minimumSize.rheight() += layout->spacing();
+ scrollArea->setMinimumSize(minimumSize);
+ scrollArea->setWidget(newViewPort);
- _disableCompleterActivated = false;
- _ui->shareeLineEdit->setEnabled(true);
+ _disableCompleterActivated = false;
+ _ui->shareeLineEdit->setEnabled(true);
+
+// } else {
+// _ui->scrollArea->setVisible(false);
+// }
}
void ShareUserGroupWidget::slotAdjustScrollWidgetSize()
{
QScrollArea *scrollArea = _ui->scrollArea;
- if (scrollArea->findChildren<ShareUserLine *>().count() <= 3) {
+ 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;
@@ -269,6 +305,7 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
// model proxying the _completerModel
auto sharee = qvariant_cast<QSharedPointer<Sharee>>(index.data(Qt::UserRole));
if (sharee.isNull()) {
+ _ui->scrollArea->setVisible(false);
return;
}
@@ -277,14 +314,14 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
*/
auto viewPort = _ui->scrollArea->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);
+// 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
@@ -300,12 +337,22 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), SharePermission(permissions));
} else {
+ int permissions = SharePermissionRead;
+ foreach (QAction *permission, _ui->permissionToolButton->menu()->actions()) {
+ if(permission->isChecked())
+ permissions |= permission->data().toInt();
+ }
_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())
+ _ui->scrollArea->setVisible(false);
+ else
+ _ui->scrollArea->setVisible(true);
}
void ShareUserGroupWidget::slotCompleterHighlighted(const QModelIndex &index)
diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h
index e891359b9..68d0f47df 100644
--- a/src/gui/shareusergroupwidget.h
+++ b/src/gui/shareusergroupwidget.h
@@ -61,6 +61,9 @@ public:
QWidget *parent = 0);
~ShareUserGroupWidget();
+signals:
+ void togglePublicLinkShare(bool);
+
public slots:
void getShares();
diff --git a/src/gui/shareusergroupwidget.ui b/src/gui/shareusergroupwidget.ui
index 5b9b3e24e..dbf65d291 100644
--- a/src/gui/shareusergroupwidget.ui
+++ b/src/gui/shareusergroupwidget.ui
@@ -6,48 +6,148 @@
<rect>
<x>0</x>
<y>0</y>
- <width>397</width>
- <height>273</height>
+ <width>350</width>
+ <height>120</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>120</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,0">
<property name="spacing">
- <number>6</number>
+ <number>0</number>
+ </property>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="topMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="rightMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
- <number>6</number>
+ <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::SetMaximumSize</enum>
+ <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="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>220</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="placeholderText">
<string>Share with users or groups ...</string>
</property>
</widget>
</item>
+ <item>
+ <widget class="QToolButton" name="permissionToolButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextOnly</enum>
+ </property>
+ <property name="arrowType">
+ <enum>Qt::DownArrow</enum>
+ </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>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="palette">
<palette>
<active>
@@ -85,6 +185,9 @@
</disabled>
</palette>
</property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
<property name="text">
<string notr="true">Placeholder for Error text</string>
</property>
@@ -94,46 +197,100 @@
<property name="wordWrap">
<bool>true</bool>
</property>
+ <property name="margin">
+ <number>5</number>
+ </property>
+ <property name="indent">
+ <number>0</number>
+ </property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <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>
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="widgetResizable">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="alignment">
- <set>Qt::AlignCenter</set>
+ <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>383</width>
- <height>201</height>
+ <width>340</width>
+ <height>45</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
+ <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>6</number>
+ <number>0</number>
</property>
<property name="topMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="rightMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
- <number>6</number>
+ <number>0</number>
</property>
</layout>
</widget>
diff --git a/src/gui/shareuserline.ui b/src/gui/shareuserline.ui
index 8709f3626..1d82f0cba 100644
--- a/src/gui/shareuserline.ui
+++ b/src/gui/shareuserline.ui
@@ -9,17 +9,41 @@
<rect>
<x>0</x>
<y>0</y>
- <width>468</width>
- <height>46</height>
+ <width>330</width>
+ <height>40</height>
</rect>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>330</width>
+ <height>40</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="1,1,1,0,0,0,0">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
<property name="leftMargin">
<number>3</number>
</property>
@@ -33,70 +57,144 @@
<number>3</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="text">
+ <string/>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="sharedWith">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Maximum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>30</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="permissionShare">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <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 share</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="permissionsEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <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="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="deleteShareButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="user-trash">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ </widget>
</item>
</layout>
</widget>