mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Merge pull request #1429 from nextcloud/recipientnote
Finishing PR #1154
This commit is contained in:
commit
d18e2ba339
12 changed files with 582 additions and 374 deletions
|
@ -73,6 +73,17 @@ void OcsShareJob::setPassword(const QString &shareId, const QString &password)
|
|||
start();
|
||||
}
|
||||
|
||||
void OcsShareJob::setNote(const QString &shareId, const QString ¬e)
|
||||
{
|
||||
appendPath(shareId);
|
||||
setVerb("PUT");
|
||||
|
||||
addParam(QString::fromLatin1("note"), note);
|
||||
_value = note;
|
||||
|
||||
start();
|
||||
}
|
||||
|
||||
void OcsShareJob::setPublicUpload(const QString &shareId, bool publicUpload)
|
||||
{
|
||||
appendPath(shareId);
|
||||
|
|
|
@ -61,6 +61,14 @@ public:
|
|||
*/
|
||||
void setExpireDate(const QString &shareId, const QDate &date);
|
||||
|
||||
/**
|
||||
* Set note a share
|
||||
*
|
||||
* @param note The note to a share, if the note is empty the
|
||||
* share will be removed
|
||||
*/
|
||||
void setNote(const QString &shareId, const QString ¬e);
|
||||
|
||||
/**
|
||||
* Set the password of a share
|
||||
*
|
||||
|
|
|
@ -165,7 +165,7 @@ void ShareDialog::initLinkShareWidget(){
|
|||
_emptyShareLinkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this);
|
||||
_linkWidgetList.append(_emptyShareLinkWidget);
|
||||
|
||||
// connect(_emptyShareLinkWidget, &ShareLinkWidget::resizeRequested, this, &ShareDialog::slotAdjustScrollWidgetSize);
|
||||
connect(_emptyShareLinkWidget, &ShareLinkWidget::resizeRequested, this, &ShareDialog::slotAdjustScrollWidgetSize);
|
||||
// connect(this, &ShareDialog::toggleAnimation, _emptyShareLinkWidget, &ShareLinkWidget::slotToggleAnimation);
|
||||
connect(_emptyShareLinkWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
|
||||
|
||||
|
@ -206,7 +206,6 @@ void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
|
|||
emit toggleAnimation(false);
|
||||
}
|
||||
|
||||
// TODO
|
||||
void ShareDialog::slotAdjustScrollWidgetSize()
|
||||
{
|
||||
int count = this->findChildren<ShareLinkWidget *>().count();
|
||||
|
|
|
@ -6,28 +6,18 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>372</width>
|
||||
<width>385</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="shareDialogVerticalLayout">
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0">
|
||||
|
@ -43,6 +33,31 @@
|
|||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>315</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>share label</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_sharePath">
|
||||
<property name="sizePolicy">
|
||||
|
@ -64,32 +79,7 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ownCloud Path:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>315</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">share label</string>
|
||||
<string>Nextcloud Path:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
|
@ -120,7 +110,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Icon</string>
|
||||
<string>Icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -129,7 +119,7 @@
|
|||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -141,7 +131,7 @@
|
|||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
|
||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
|
@ -151,8 +141,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>367</width>
|
||||
<height>85</height>
|
||||
<width>69</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="scrollAreaVerticalLayout"/>
|
||||
|
@ -160,6 +150,8 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QTextEdit>
|
||||
#include <QToolButton>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
|
@ -46,6 +47,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
|||
, _localPath(localPath)
|
||||
, _linkShare(nullptr)
|
||||
, _passwordRequired(false)
|
||||
, _noteRequired(false)
|
||||
, _expiryRequired(false)
|
||||
, _namesSupported(true)
|
||||
, _linkContextMenu(nullptr)
|
||||
|
@ -54,14 +56,13 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
|||
, _allowUploadEditingLinkAction(nullptr)
|
||||
, _allowUploadLinkAction(nullptr)
|
||||
, _passwordProtectLinkAction(nullptr)
|
||||
, _noteLinkAction(nullptr)
|
||||
, _expirationDateLinkAction(nullptr)
|
||||
, _unshareLinkAction(nullptr)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
|
||||
QSizePolicy sp = _ui->shareLinkToolButton->sizePolicy();
|
||||
sp.setRetainSizeWhenHidden(true);
|
||||
_ui->shareLinkToolButton->setSizePolicy(sp);
|
||||
_ui->shareLinkToolButton->hide();
|
||||
|
||||
//Is this a file or folder?
|
||||
|
@ -71,6 +72,8 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
|||
connect(_ui->enableShareLink, &QPushButton::clicked, this, &ShareLinkWidget::slotCreateShareLink);
|
||||
connect(_ui->lineEdit_password, &QLineEdit::returnPressed, this, &ShareLinkWidget::slotCreatePassword);
|
||||
connect(_ui->confirmPassword, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCreatePassword);
|
||||
connect(_ui->textEdit_note, &QTextEdit::textChanged, this, &ShareLinkWidget::slotCreateNote);
|
||||
connect(_ui->confirmNote, &QAbstractButton::clicked, this, &ShareLinkWidget::slotCreateNote);
|
||||
connect(_ui->confirmExpirationDate, &QAbstractButton::clicked, this, &ShareLinkWidget::slotSetExpireDate);
|
||||
connect(_ui->calendar, &QDateTimeEdit::dateChanged, this, &ShareLinkWidget::slotSetExpireDate);
|
||||
|
||||
|
@ -96,6 +99,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
|||
|
||||
togglePasswordOptions(false);
|
||||
toggleExpireDateOptions(false);
|
||||
toggleNoteOptions(false);
|
||||
_ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
|
||||
|
||||
// check if the file is already inside of a synced folder
|
||||
|
@ -110,7 +114,8 @@ ShareLinkWidget::~ShareLinkWidget()
|
|||
delete _ui;
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotToggleAnimation(bool start){
|
||||
void ShareLinkWidget::slotToggleAnimation(bool start)
|
||||
{
|
||||
if (start) {
|
||||
if (!_ui->progressIndicator->isAnimated())
|
||||
_ui->progressIndicator->startAnimation();
|
||||
|
@ -119,16 +124,20 @@ void ShareLinkWidget::slotToggleAnimation(bool start){
|
|||
}
|
||||
}
|
||||
|
||||
void ShareLinkWidget::setLinkShare(QSharedPointer<LinkShare> linkShare){
|
||||
void ShareLinkWidget::setLinkShare(QSharedPointer<LinkShare> linkShare)
|
||||
{
|
||||
_linkShare = linkShare;
|
||||
}
|
||||
|
||||
QSharedPointer<LinkShare> ShareLinkWidget::getLinkShare(){
|
||||
QSharedPointer<LinkShare> ShareLinkWidget::getLinkShare()
|
||||
{
|
||||
return _linkShare;
|
||||
}
|
||||
|
||||
void ShareLinkWidget::setupUiOptions(){
|
||||
void ShareLinkWidget::setupUiOptions()
|
||||
{
|
||||
connect(_linkShare.data(), &LinkShare::expireDateSet, this, &ShareLinkWidget::slotExpireDateSet);
|
||||
connect(_linkShare.data(), &LinkShare::noteSet, this, &ShareLinkWidget::slotNoteSet);
|
||||
connect(_linkShare.data(), &LinkShare::passwordSet, this, &ShareLinkWidget::slotPasswordSet);
|
||||
connect(_linkShare.data(), &LinkShare::passwordSetError, this, &ShareLinkWidget::slotPasswordSetError);
|
||||
|
||||
|
@ -156,10 +165,7 @@ void ShareLinkWidget::setupUiOptions(){
|
|||
_readOnlyLinkAction->setCheckable(true);
|
||||
_readOnlyLinkAction->setChecked(checked);
|
||||
|
||||
checked = perm & (SharePermissionRead &
|
||||
SharePermissionCreate &
|
||||
SharePermissionUpdate &
|
||||
SharePermissionDelete);
|
||||
checked = perm & (SharePermissionRead & SharePermissionCreate & SharePermissionUpdate & SharePermissionDelete);
|
||||
_allowUploadEditingLinkAction = permissionsGroup->addAction(tr("Allow Upload && Editing"));
|
||||
_allowUploadEditingLinkAction->setCheckable(true);
|
||||
_allowUploadEditingLinkAction->setChecked(checked);
|
||||
|
@ -179,6 +185,16 @@ void ShareLinkWidget::setupUiOptions(){
|
|||
_linkContextMenu->addAction(_allowUploadLinkAction);
|
||||
}
|
||||
|
||||
// Adds action to display note widget (check box)
|
||||
_noteLinkAction = _linkContextMenu->addAction(tr("Add note to recipient"));
|
||||
_noteLinkAction->setCheckable(true);
|
||||
|
||||
if (_linkShare->getNote().isSimpleText()) {
|
||||
_ui->textEdit_note->setText(_linkShare->getNote());
|
||||
_noteLinkAction->setChecked(true);
|
||||
showNoteOptions(true);
|
||||
}
|
||||
|
||||
// Adds action to display password widget (check box)
|
||||
_passwordProtectLinkAction = _linkContextMenu->addAction(tr("Password Protect"));
|
||||
_passwordProtectLinkAction->setCheckable(true);
|
||||
|
@ -242,7 +258,27 @@ void ShareLinkWidget::setupUiOptions(){
|
|||
//startAnimation(0, height());
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCopyLinkShare(bool clicked){
|
||||
void ShareLinkWidget::setNote(const QString ¬e)
|
||||
{
|
||||
if (_linkShare) {
|
||||
slotToggleAnimation(true);
|
||||
_ui->errorLabel->hide();
|
||||
_linkShare->setNote(note);
|
||||
}
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCreateNote()
|
||||
{
|
||||
setNote(_ui->textEdit_note->toPlainText());
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotNoteSet()
|
||||
{
|
||||
slotToggleAnimation(false);
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCopyLinkShare(bool clicked)
|
||||
{
|
||||
Q_UNUSED(clicked);
|
||||
|
||||
QApplication::clipboard()->setText(_linkShare->getLink().toString());
|
||||
|
@ -295,8 +331,8 @@ void ShareLinkWidget::slotPasswordSet()
|
|||
slotToggleAnimation(false);
|
||||
}
|
||||
|
||||
void ShareLinkWidget::startAnimation(const int start, const int end){
|
||||
|
||||
void ShareLinkWidget::startAnimation(const int start, const int end)
|
||||
{
|
||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "maximumHeight", this);
|
||||
|
||||
animation->setDuration(500);
|
||||
|
@ -320,10 +356,32 @@ void ShareLinkWidget::slotDeleteShareFetched()
|
|||
|
||||
_linkShare.clear();
|
||||
togglePasswordOptions(false);
|
||||
toggleNoteOptions(false);
|
||||
toggleExpireDateOptions(false);
|
||||
emit deleteLinkShare();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::showNoteOptions(bool show)
|
||||
{
|
||||
_ui->noteLabel->setVisible(show);
|
||||
_ui->textEdit_note->setVisible(show);
|
||||
_ui->confirmNote->setVisible(show);
|
||||
}
|
||||
|
||||
|
||||
void ShareLinkWidget::toggleNoteOptions(bool enable)
|
||||
{
|
||||
showNoteOptions(enable);
|
||||
|
||||
if (enable) {
|
||||
_ui->textEdit_note->setFocus();
|
||||
} else {
|
||||
// 'deletes' note
|
||||
if (_linkShare)
|
||||
_linkShare->setNote(QString());
|
||||
}
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotAnimationFinished()
|
||||
{
|
||||
emit resizeRequested();
|
||||
|
@ -437,7 +495,6 @@ void ShareLinkWidget::slotContextMenuButtonClicked()
|
|||
|
||||
void ShareLinkWidget::slotLinkContextMenuActionTriggered(QAction *action)
|
||||
{
|
||||
|
||||
bool state = action->isChecked();
|
||||
SharePermissions perm = SharePermissionRead;
|
||||
|
||||
|
@ -465,6 +522,9 @@ void ShareLinkWidget::slotLinkContextMenuActionTriggered(QAction *action)
|
|||
} else if (action == _expirationDateLinkAction) {
|
||||
toggleExpireDateOptions(state);
|
||||
|
||||
} else if (action == _noteLinkAction) {
|
||||
toggleNoteOptions(state);
|
||||
|
||||
} else if (action == _unshareLinkAction) {
|
||||
confirmAndDeleteShare();
|
||||
}
|
||||
|
|
|
@ -73,6 +73,9 @@ private slots:
|
|||
void slotPasswordSet();
|
||||
void slotPasswordSetError(int code, const QString &message);
|
||||
|
||||
void slotCreateNote();
|
||||
void slotNoteSet();
|
||||
|
||||
void slotSetExpireDate();
|
||||
void slotExpireDateSet();
|
||||
|
||||
|
@ -94,6 +97,10 @@ private:
|
|||
void showPasswordOptions(bool show);
|
||||
void togglePasswordOptions(bool enable);
|
||||
|
||||
void showNoteOptions(bool show);
|
||||
void toggleNoteOptions(bool enable);
|
||||
void setNote(const QString ¬e);
|
||||
|
||||
void showExpireDateOptions(bool show);
|
||||
void toggleExpireDateOptions(bool enable);
|
||||
|
||||
|
@ -119,6 +126,7 @@ private:
|
|||
bool _passwordRequired;
|
||||
bool _expiryRequired;
|
||||
bool _namesSupported;
|
||||
bool _noteRequired;
|
||||
|
||||
QMenu *_linkContextMenu;
|
||||
QAction *_readOnlyLinkAction;
|
||||
|
@ -129,6 +137,7 @@ private:
|
|||
QAction *_expirationDateLinkAction;
|
||||
QAction *_unshareLinkAction;
|
||||
QAction *_addAnotherLinkAction;
|
||||
QAction *_noteLinkAction;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>160</height>
|
||||
<width>365</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -16,166 +16,26 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<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 row="2" column="1">
|
||||
<widget class="QDateEdit" name="calendar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="shareLinkToolButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/more.svg</normaloff>:/client/resources/more.svg</iconset>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>123</red>
|
||||
<green>121</green>
|
||||
<blue>134</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_password">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="confirmPassword">
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="confirmExpirationDate">
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="createShareButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">text-align: left</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="shareLinkIconLabel">
|
||||
<property name="text">
|
||||
<string>&Share link</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/public.svg</normaloff>:/client/resources/public.svg</iconset>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../client.qrc">:/client/resources/public.svg</pixmap>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="shareLinkLabel">
|
||||
<property name="text">
|
||||
<string>Share link</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -225,21 +85,243 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="shareLinkToolButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/more.svg</normaloff>:/client/resources/more.svg</iconset>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="expirationLabel">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="noteLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>78</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Note:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit_note">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="confirmNote">
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>78</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_password">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="confirmPassword">
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="expirationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>78</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Expiration date:</string>
|
||||
<string>Expires:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>20</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="calendar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="confirmExpirationDate">
|
||||
<property name="icon">
|
||||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/confirm.svg</normaloff>:/client/resources/confirm.svg</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>123</red>
|
||||
<green>121</green>
|
||||
<blue>134</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -200,6 +200,11 @@ QString LinkShare::getName() const
|
|||
return _name;
|
||||
}
|
||||
|
||||
QString LinkShare::getNote() const
|
||||
{
|
||||
return _note;
|
||||
}
|
||||
|
||||
void LinkShare::setName(const QString &name)
|
||||
{
|
||||
OcsShareJob *job = new OcsShareJob(_account);
|
||||
|
@ -208,6 +213,20 @@ void LinkShare::setName(const QString &name)
|
|||
job->setName(getId(), name);
|
||||
}
|
||||
|
||||
void LinkShare::setNote(const QString ¬e)
|
||||
{
|
||||
OcsShareJob *job = new OcsShareJob(_account);
|
||||
connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNoteSet);
|
||||
connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError);
|
||||
job->setNote(getId(), note);
|
||||
}
|
||||
|
||||
void LinkShare::slotNoteSet(const QJsonDocument &, const QVariant ¬e)
|
||||
{
|
||||
_note = note.toString();
|
||||
emit noteSet();
|
||||
}
|
||||
|
||||
QString LinkShare::getToken() const
|
||||
{
|
||||
return _token;
|
||||
|
|
|
@ -183,6 +183,12 @@ public:
|
|||
*/
|
||||
QString getName() const;
|
||||
|
||||
/*
|
||||
* Returns the note of the link share.
|
||||
*/
|
||||
|
||||
QString getNote() const;
|
||||
|
||||
/*
|
||||
* Set the name of the link share.
|
||||
*
|
||||
|
@ -190,6 +196,12 @@ public:
|
|||
*/
|
||||
void setName(const QString &name);
|
||||
|
||||
|
||||
/*
|
||||
* Set the note of the link share.
|
||||
*/
|
||||
void setNote(const QString ¬e);
|
||||
|
||||
/*
|
||||
* Returns the token of the link share.
|
||||
*/
|
||||
|
@ -224,11 +236,13 @@ public:
|
|||
signals:
|
||||
void expireDateSet();
|
||||
void passwordSet();
|
||||
void noteSet();
|
||||
void passwordSetError(int statusCode, const QString &message);
|
||||
void nameSet();
|
||||
|
||||
private slots:
|
||||
void slotPasswordSet(const QJsonDocument &, const QVariant &value);
|
||||
void slotNoteSet(const QJsonDocument &, const QVariant &value);
|
||||
void slotExpireDateSet(const QJsonDocument &reply, const QVariant &value);
|
||||
void slotSetPasswordError(int statusCode, const QString &message);
|
||||
void slotNameSet(const QJsonDocument &, const QVariant &value);
|
||||
|
@ -237,6 +251,7 @@ private:
|
|||
QString _name;
|
||||
QString _token;
|
||||
bool _passwordSet;
|
||||
QString _note;
|
||||
QDate _expireDate;
|
||||
QUrl _url;
|
||||
};
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include <QPainter>
|
||||
#include <QListWidget>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
|
||||
|
@ -203,7 +205,8 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
|
|||
}
|
||||
|
||||
// the owner of the file that shared it first
|
||||
if(x == 0 && !share->getUidOwner().isEmpty()){
|
||||
// leave out if it's the current user
|
||||
if(x == 0 && !share->getUidOwner().isEmpty() && !(share->getUidOwner() == _account->credentials()->user())) {
|
||||
_ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName()));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>55</height>
|
||||
<height>70</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -17,30 +17,24 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="mainOwnerLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="shareeHorizontalLayout">
|
||||
<layout class="QHBoxLayout" name="shareeHorizontalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -55,6 +49,12 @@
|
|||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="shareeLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Share with users or groups ...</string>
|
||||
</property>
|
||||
|
|
|
@ -6,35 +6,26 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>45</height>
|
||||
<width>360</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,2,2,2">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="avatar">
|
||||
<property name="sizePolicy">
|
||||
|
@ -57,7 +48,7 @@
|
|||
<item>
|
||||
<widget class="OCC::ElidedLabel" name="sharedWith">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Maximum">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -70,6 +61,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="permissionsEdit">
|
||||
<property name="sizePolicy">
|
||||
|
@ -89,6 +96,9 @@
|
|||
<iconset resource="../../client.qrc">
|
||||
<normaloff>:/client/resources/more.svg</normaloff>:/client/resources/more.svg</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue