diff --git a/client.qrc b/client.qrc index 194e227a8..3cc86157e 100644 --- a/client.qrc +++ b/client.qrc @@ -30,6 +30,12 @@ resources/state-error.svg resources/state-warning.svg resources/folder.svg + resources/network.svg + resources/settings.svg + resources/public-white.svg + resources/public.svg + resources/confirm.svg + resources/copy.svg diff --git a/resources/confirm.svg b/resources/confirm.svg new file mode 100644 index 000000000..42e302c4a --- /dev/null +++ b/resources/confirm.svg @@ -0,0 +1 @@ + diff --git a/resources/copy.svg b/resources/copy.svg new file mode 100644 index 000000000..0d2e6550e --- /dev/null +++ b/resources/copy.svg @@ -0,0 +1 @@ + diff --git a/resources/public-white.svg b/resources/public-white.svg new file mode 100644 index 000000000..d85defb6a --- /dev/null +++ b/resources/public-white.svg @@ -0,0 +1 @@ + diff --git a/resources/public.svg b/resources/public.svg new file mode 100644 index 000000000..6ed1ade02 --- /dev/null +++ b/resources/public.svg @@ -0,0 +1 @@ + diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index eaa6a22b7..7fcd24c63 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -20,6 +20,7 @@ set(client_UI_SRCS folderwizardsourcepage.ui folderwizardtargetpage.ui generalsettings.ui + legalnotice.ui ignorelisteditor.ui networksettings.ui activitywidget.ui @@ -56,6 +57,7 @@ set(client_SRCS folderwatcher.cpp folderwizard.cpp generalsettings.cpp + legalnotice.cpp ignorelisteditor.cpp lockwatcher.cpp logbrowser.cpp diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 419b5214b..4f9ec0d4c 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -29,6 +29,8 @@ #include "config.h" +#include "legalnotice.h" + #include #include #include @@ -53,14 +55,13 @@ GeneralSettings::GeneralSettings(QWidget *parent) // setup about section QString about = Theme::instance()->about(); - if (about.isEmpty()) { - _ui->aboutGroupBox->hide(); - } else { - _ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); - _ui->aboutLabel->setText(about); - _ui->aboutLabel->setWordWrap(true); - _ui->aboutLabel->setOpenExternalLinks(true); - } + _ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); + _ui->aboutLabel->setText(about); + _ui->aboutLabel->setWordWrap(true); + _ui->aboutLabel->setOpenExternalLinks(true); + + // About legal notice + connect(_ui->legalNoticeButton, &QPushButton::clicked, this, &GeneralSettings::slotShowLegalNotice); loadMiscSettings(); slotUpdateInfo(); @@ -192,4 +193,11 @@ void GeneralSettings::slotIgnoreFilesEditor() } } +void GeneralSettings::slotShowLegalNotice() +{ + auto notice = new LegalNotice(); + notice->exec(); + delete notice; +} + } // namespace OCC diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h index 74c6520f2..b73c2f13c 100644 --- a/src/gui/generalsettings.h +++ b/src/gui/generalsettings.h @@ -47,6 +47,7 @@ private slots: void slotUpdateInfo(); void slotIgnoreFilesEditor(); void loadMiscSettings(); + void slotShowLegalNotice(); private: Ui::GeneralSettings *_ui; diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui index abfdb92a9..34aa03510 100644 --- a/src/gui/generalsettings.ui +++ b/src/gui/generalsettings.ui @@ -14,6 +14,52 @@ Form + + + + About + + + + + + + 0 + 0 + + + + About + + + + + + + + + Legal notice + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + @@ -47,28 +93,6 @@ - - - - About - - - - - - - 0 - 0 - - - - About - - - - - - @@ -270,12 +294,12 @@ setEnabled(bool) - 225 - 231 + 247 + 188 - 587 - 230 + 497 + 190 diff --git a/src/gui/legalnotice.cpp b/src/gui/legalnotice.cpp new file mode 100644 index 000000000..4dbcc0666 --- /dev/null +++ b/src/gui/legalnotice.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) by Roeland Jago Douma + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "legalnotice.h" +#include "ui_legalnotice.h" + +namespace OCC { + + +LegalNotice::LegalNotice(QDialog *parent) + : QDialog(parent) + , _ui(new Ui::LegalNotice) +{ + _ui->setupUi(this); + + QString notice = tr("

Copyright 2017-2018 Nextcloud GmbH
" + "Copyright 2012-2018 ownCloud GmbH

"); + + notice += tr("

Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.

"); + + _ui->notice->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); + _ui->notice->setText(notice); + _ui->notice->setWordWrap(true); + + connect(_ui->closeButton, &QPushButton::clicked, this, &LegalNotice::accept); +} + +LegalNotice::~LegalNotice() +{ + delete _ui; +} + +} diff --git a/src/gui/legalnotice.h b/src/gui/legalnotice.h new file mode 100644 index 000000000..ba776a088 --- /dev/null +++ b/src/gui/legalnotice.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) by Roeland Jago Douma + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef LEGALNOTICE_H +#define LEGALNOTICE_H + +#include + +namespace OCC { +class IgnoreListEditor; +class SyncLogDialog; + +namespace Ui { + class LegalNotice; +} + +/** + * @brief The LegalNotice class + * @ingroup gui + */ +class LegalNotice : public QDialog +{ + Q_OBJECT + +public: + explicit LegalNotice(QDialog *parent = 0); + ~LegalNotice(); + +private: + Ui::LegalNotice *_ui; +}; + +} // namespace OCC +#endif // LEGALNOTICE_H diff --git a/src/gui/legalnotice.ui b/src/gui/legalnotice.ui new file mode 100644 index 000000000..be3c67ba6 --- /dev/null +++ b/src/gui/legalnotice.ui @@ -0,0 +1,68 @@ + + + OCC::LegalNotice + + + + 0 + 0 + 291 + 260 + + + + Dialog + + + + + + + Arabic Newspaper + 11 + + + + Legal notice + + + Qt::AlignCenter + + + + + + + TextLabel + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + + diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h index 5760085fc..97b840e53 100644 --- a/src/gui/ocssharejob.h +++ b/src/gui/ocssharejob.h @@ -29,7 +29,7 @@ namespace OCC { * @brief The OcsShareJob class * @ingroup gui * - * Handle talking to the OCS Share API. + * Handle talking to the OCS Share API. * For creation, deletion and modification of shares. */ class OcsShareJob : public OcsJob @@ -71,7 +71,7 @@ public: /** * Set the share to be public upload - * + * * @param publicUpload Set or remove public upload */ void setPublicUpload(const QString &shareId, bool publicUpload); @@ -93,11 +93,9 @@ public: * Create a new link share * * @param path The path of the file/folder to share - * @param name The name of the link share, empty name auto-generates one * @param password Optionally a password for the share */ - void createLinkShare(const QString &path, - const QString &name, + void createLinkShare(const QString &path, const QString &name, const QString &password); /** diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 1cca346f9..09c2e2e95 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -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, , _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, _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, 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, 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, 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, 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); } } diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h index 7aa93cfde..474ba51d9 100644 --- a/src/gui/sharedialog.h +++ b/src/gui/sharedialog.h @@ -60,6 +60,7 @@ private: void showSharingUi(); Ui::ShareDialog *_ui; + QPointer _accountState; QString _sharePath; QString _localPath; diff --git a/src/gui/sharedialog.ui b/src/gui/sharedialog.ui index 203dc9ea7..4191615d9 100644 --- a/src/gui/sharedialog.ui +++ b/src/gui/sharedialog.ui @@ -6,40 +6,81 @@ 0 0 - 408 - 281 + 360 + 120
+ + + 0 + 0 + + + + + 360 + 120 + + + + + 360 + 16777215 + + Dialog - + + + 10 + + + QLayout::SetFixedSize + + + 15 + + + 10 + + + 10 + + + 10 + - - - - - - 0 - 0 - - - - share label - - - Qt::PlainText - - - + + + QLayout::SetFixedSize + + + 0 + + + 0 + + + 0 + + + 10 + - + 0 0 + + + 210 + 0 + + 50 @@ -52,37 +93,175 @@ Qt::PlainText - - - - - - TextLabel + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + 0 - - - - - - - - - + + - + 0 0 - - QDialogButtonBox::Close + + + 210 + 0 + + + + 0 + + + share label + + + Qt::PlainText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + 0 + + + + + + + + 0 + 0 + + + + + 40 + 40 + + + + + 16777215 + 16777215 + + + + Icon + + + 0 + + + 0 + + + + + 0 + 0 + + + + + 350 + 45 + + + + + 16777215 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContentsOnFirstShow + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 340 + 45 + + + + + 0 + 0 + + + + + 340 + 45 + + + + + 16777215 + 16777215 + + + + + 0 + + + QLayout::SetFixedSize + + + 0 + + + 0 + + + 0 + + + 0 + + + + +
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index fee86964c..b316572a6 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -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> &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(share); + _linkShare = qSharedPointerDynamicCast(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>(); - 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 &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å 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 &share) +void ShareLinkWidget::confirmAndDeleteShare() { auto messageBox = new QMessageBox( QMessageBox::Question, tr("Confirm Link Share Deletion"), tr("

Do you really want to delete the public link share %1?

" "

Note: This action cannot be undone.

") - .arg(shareName(*share)), + .arg(shareName()), QMessageBox::NoButton, this); QPushButton *yesButton = @@ -564,91 +468,64 @@ void ShareLinkWidget::confirmAndDeleteShare(const QSharedPointer &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>(); - 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>(); - 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>(); - 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 ShareLinkWidget::selectedShare() const -{ - const auto items = _ui->linkShares->selectedItems(); - if (items.isEmpty()) { - return QSharedPointer(); - } + } else if (action == _allowUploadEditingLinkAction && state) { + perm |= SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete; + _linkShare->setPermissions(perm); - return items.first()->data(Qt::UserRole).value>(); -} + } 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(); } diff --git a/src/gui/sharelinkwidget.h b/src/gui/sharelinkwidget.h index 365c596b7..fc3c6d6f7 100644 --- a/src/gui/sharelinkwidget.h +++ b/src/gui/sharelinkwidget.h @@ -55,30 +55,25 @@ public: QWidget *parent = 0); ~ShareLinkWidget(); void getShares(); + void toggleButton(bool show); private slots: void slotSharesFetched(const QList> &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 &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 &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 selectedShare() const; + //QSharedPointer selectedShare() const; Ui::ShareLinkWidget *_ui; AccountPtr _account; @@ -116,28 +112,22 @@ private: QProgressIndicator *_pi_editing; ShareManager *_manager; + QSharedPointer _linkShare; bool _isFile; bool _passwordRequired; bool _expiryRequired; bool _namesSupported; - // For maintaining the selection and temporary ui state - // when getShares() finishes, but the selection didn't - // change. - QString _selectedShareId; - - // When a new share is created, we want to select it - // the next time getShares() finishes. This stores its id. - QString _newShareOverrideSelectionId; - - QMenu *_linkContextMenu = nullptr; - QAction *_deleteLinkAction = nullptr; - QAction *_openLinkAction = nullptr; - QAction *_copyLinkAction = nullptr; - QAction *_copyDirectLinkAction = nullptr; - QAction *_emailLinkAction = nullptr; - QAction *_emailDirectLinkAction = nullptr; + QMenu *_linkContextMenu; + QAction *_copyLinkAction; + QAction *_readOnlyLinkAction; + QAction *_allowEditingLinkAction; + QAction *_allowUploadEditingLinkAction; + QAction *_allowUploadLinkAction; + QAction *_passwordProtectLinkAction; + QAction *_expirationDateLinkAction; + QAction *_unshareLinkAction; }; } diff --git a/src/gui/sharelinkwidget.ui b/src/gui/sharelinkwidget.ui index 5c4b2e648..5b47b0cbf 100644 --- a/src/gui/sharelinkwidget.ui +++ b/src/gui/sharelinkwidget.ui @@ -6,82 +6,74 @@ 0 0 - 441 - 568 + 350 + 126 + + + 0 + 0 + + + + + 350 + 110 + + + + + 16777215 + 16777215 + + Share NewDocument.odt + + 10 + + + QLayout::SetFixedSize + + + 0 + + + 0 + + + 0 + + + 0 + - - - Anyone with the link has access to the file/folder - - - Qt::PlainText - - + + true - - - - - - - - Enter a name to create a new public link... - - - - - - - &Create new - - - - - - - - + 0 0 - - Qt::ScrollBarAlwaysOff + + + 350 + 0 + - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - 3 - - - false - - - false - - - - - - - - - + + + 3 + + + QLayout::SetFixedSize + 0 @@ -94,201 +86,341 @@ 0 - - - + + + + true + + + + 0 + 0 + + + + + 242 + 26 + + + + + 350 + 26 + + + + Qt::LeftToRight + + + false + + + text-align: left + + + &Share link + + + + :/client/resources/public.svg:/client/resources/public.svg + + + false + + + true + + + + + + + + 82 + 26 + + + + Enable + + + + + + + false + + + + 26 + 26 + + + + Qt::ActionsContextMenu + + + + + + + + + + :/client/resources/more.svg:/client/resources/more.svg + + + QToolButton::InstantPopup + + + Qt::ToolButtonIconOnly + + + + + + + + + + + 0 + 0 + + + + + 300 + 0 + + + + + 16777215 + 16777215 + + + + + 0 + + + QLayout::SetFixedSize + + + 18 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 162 + 0 + + + + Password: + + 0 - - - - Set &expiration date - - - - - - - true - - - - + - - - - 20 + + + + + 0 + 0 + - - - - QLineEdit::Password - - - - - - - - 0 - 0 - - - - Set &password - - - - + + + 120 + 26 + + + + + 100 + 16777215 + + + + QLineEdit::Password + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + - - - - - - - 0 - 0 - - - - Set password - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + + 0 + 0 + + + + + 18 + 26 + + + + + 16777215 + 16777215 + + + + false + + + background-color: rgba(255, 255, 255, 0); + + + + + + + :/client/resources/confirm.svg:/client/resources/confirm.svg + + + true + + - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Recipients can view or download contents. - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 6 - - - - - - - - Upload only (File Drop) - - - - - - - - 0 - 0 - - - - Receive files from others without revealing the contents of the folder. - - - true - - - - - - - Download / View - - - - - - - Download / View / Upload - - - - - - - - 0 - 0 - - - - Recipients can view, download, edit, delete and upload contents. - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 6 - - - - - + + +
+ + + + + 0 + 0 + + + + + 300 + 0 + + + + + 0 + + + QLayout::SetFixedSize + + + 18 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 162 + 26 + + + + Expiration date: + + + 0 + + + + + + + + 0 + 0 + + + + + 120 + 26 + + + + + 16777215 + 16777215 + + + + true + + + + + + + + 0 + 0 + + + + + 18 + 26 + + + + + 18 + 16777215 + + + + + + + + :/client/resources/confirm.svg:/client/resources/confirm.svg + + + true + @@ -297,11 +429,23 @@ - + 0 0 + + + 0 + 0 + + + + + 16777215 + 16777215 + + @@ -345,21 +489,25 @@ Qt::PlainText + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + 0 + + + 0 + - - nameLineEdit - createShareButton - linkShares - checkBox_password - lineEdit_password - pushButton_setPassword - checkBox_expire - calendar - - + + + diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 69336f013..d47e4fbf4 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -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 #include #include -#include #include #include #include @@ -44,6 +43,7 @@ #include #include #include +#include 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("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 currentUser(new Sharee(_account->credentials()->user(), "", Sharee::Type::User)); blacklist << currentUser; - foreach (auto sw, _ui->scrollArea->findChildren()) { + foreach (auto sw, _parentScrollArea->findChildren()) { blacklist << sw->share()->getShareWith(); } _ui->errorLabel->hide(); @@ -177,23 +182,20 @@ void ShareUserGroupWidget::getShares() void ShareUserGroupWidget::slotSharesFetched(const QList> &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> 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> void ShareUserGroupWidget::slotAdjustScrollWidgetSize() { - QScrollArea *scrollArea = _ui->scrollArea; - if (scrollArea->findChildren().count() <= 3) { + QScrollArea *scrollArea = _parentScrollArea; + if (scrollArea->findChildren().count() <= 3 && + scrollArea->findChildren().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>(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(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()) { + foreach (auto pi, _parentScrollArea->findChildren()) { delete pi; } @@ -356,60 +369,66 @@ ShareUserLine::ShareUserLine(QSharedPointer 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, 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); } } } diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h index e891359b9..3d4f94792 100644 --- a/src/gui/shareusergroupwidget.h +++ b/src/gui/shareusergroupwidget.h @@ -24,6 +24,7 @@ #include #include #include +#include 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; bool _isFile; + // _permissionEdit is a checkbox + QAction *_permissionReshare; QAction *_permissionCreate; - QAction *_permissionUpdate; + QAction *_permissionChange; QAction *_permissionDelete; }; } diff --git a/src/gui/shareusergroupwidget.ui b/src/gui/shareusergroupwidget.ui index 028d897ce..8d01fa966 100644 --- a/src/gui/shareusergroupwidget.ui +++ b/src/gui/shareusergroupwidget.ui @@ -6,27 +6,149 @@ 0 0 - 397 - 273 + 350 + 55 + + + 0 + 0 + + + + + 350 + 55 + + + + + 350 + 16777215 + + Share NewDocument.odt - + + + 0 + + + QLayout::SetFixedSize + + + 0 + + + 0 + + + 0 + + + 0 + - + + + 0 + + + QLayout::SetFixedSize + + + 0 + + + 0 + + + 0 + + + 0 + + + + 0 + 0 + + + + + 332 + 26 + + + + + 16777215 + 16777215 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Share with users or groups ... + + + + + 0 + 0 + + + + + 18 + 0 + + + + background-color: rgb(255, 255, 255); + + + + + + + :/client/resources/confirm.svg:/client/resources/confirm.svg + + + true + + + + + + 0 + 0 + + + + + 350 + 26 + + + + + 16777215 + 16777215 + + @@ -64,6 +186,9 @@ + + 0 + Placeholder for Error text @@ -73,48 +198,19 @@ true - - - - - - - 0 - 0 - + + 0 - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 377 - 169 - - - - - - - - - - <html><head/><body><p>You can direct people to this shared file or folder <a href="private link menu"><span style=" text-decoration: underline; color:#0000ff;">by giving them a private link</span></a>.</p></body></html> - - - true + + 0 - + + + diff --git a/src/gui/shareuserline.ui b/src/gui/shareuserline.ui index 62288a89d..4cab56839 100644 --- a/src/gui/shareuserline.ui +++ b/src/gui/shareuserline.ui @@ -9,85 +9,203 @@ 0 0 - 468 - 46 + 350 + 45 + + + 0 + 0 + + + + + 350 + 45 + + + + + 16777215 + 46 + + Form true - + + + 5 + + + QLayout::SetFixedSize + + + 5 + + + 5 + + + 5 + + + 5 + - - - - - TextLabel - - - - - - - TextLabel - - - Qt::PlainText - - - - - - - Qt::Horizontal - - - - 40 - 15 - - - - - - - - can share - - - - - - - can edit - - - - - - - ... - - - - - - - - - - - .. - - - - + + + + 0 + 0 + + + + + 40 + 40 + + + + + 0 + 0 + + + + false + + + + + + false + + + Qt::AlignCenter + + + true + + + 0 + + + + + + + + 0 + 0 + + + + + 100 + 26 + + + + User name + + + Qt::PlainText + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 50 + 15 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + can edit + + + + + + + + 0 + 0 + + + + + 26 + 26 + + + + + + + + :/client/resources/more.svg:/client/resources/more.svg + + + + + + + + 0 + 0 + + + + + 26 + 26 + + + + + + + + .. + + - + + + diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index a533f7e81..70a1d8b3b 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -338,14 +338,7 @@ QString Theme::about() const .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)); - devString += tr("

By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, " - "Olivier Goffart, Markus Götz and others.

"); - - devString += tr("

This release was supplied by the Nextcloud GmbH
" - "Copyright 2017-2018 Nextcloud GmbH
" - "Copyright 2012-2018 ownCloud GmbH

"); - - devString += tr("

Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.

"); + devString += tr("

This release was supplied by the Nextcloud GmbH

"); devString += gitSHA1();