зеркало из https://github.com/nextcloud/desktop.git
Merge branch 'master' of github.com:owncloud/mirall
This commit is contained in:
Коммит
8852911f67
|
@ -89,6 +89,7 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
|
|||
}
|
||||
|
||||
_linkWidget = new ShareLinkWidget(account, sharePath, localPath, resharingAllowed, autoShare, this);
|
||||
_linkWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
_ui->shareWidgetsLayout->addWidget(_linkWidget);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,19 +66,6 @@
|
|||
<item>
|
||||
<layout class="QVBoxLayout" name="shareWidgetsLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <QFileInfo>
|
||||
#include <QAbstractProxyModel>
|
||||
#include <QCompleter>
|
||||
#include <qscrollarea.h>
|
||||
#include <qlayout.h>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
namespace OCC {
|
||||
|
@ -77,6 +79,8 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
|
|||
connect(&_completionTimer, SIGNAL(timeout()), this, SLOT(on_searchPushButton_clicked()));
|
||||
_completionTimer.setSingleShot(true);
|
||||
_completionTimer.setInterval(600);
|
||||
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
||||
}
|
||||
|
||||
ShareUserGroupWidget::~ShareUserGroupWidget()
|
||||
|
@ -113,11 +117,8 @@ void ShareUserGroupWidget::on_searchPushButton_clicked()
|
|||
QSharedPointer<Sharee> currentUser(new Sharee(_account->credentials()->user(), "", Sharee::Type::User));
|
||||
blacklist << currentUser;
|
||||
|
||||
for(int i = 0; i < _ui->sharesLayout->count(); i++) {
|
||||
QWidget *w = _ui->sharesLayout->itemAt(i)->widget();
|
||||
if (auto sw = qobject_cast<ShareWidget *>(w)) {
|
||||
blacklist << sw->share()->getShareWith();
|
||||
}
|
||||
foreach (auto sw, _ui->scrollArea->findChildren<ShareWidget*>()) {
|
||||
blacklist << sw->share()->getShareWith();
|
||||
}
|
||||
|
||||
_completerModel->fetch(_ui->shareeLineEdit->text(), blacklist);
|
||||
|
@ -131,13 +132,14 @@ void ShareUserGroupWidget::getShares()
|
|||
|
||||
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
|
||||
{
|
||||
/*
|
||||
* Delete all current widgets
|
||||
*/
|
||||
QLayoutItem *child;
|
||||
while ((child = _ui->sharesLayout->takeAt(0)) != 0) {
|
||||
delete child->widget();
|
||||
}
|
||||
QScrollArea *scrollArea = _ui->scrollArea;
|
||||
|
||||
|
||||
auto newViewPort = new QWidget(scrollArea);
|
||||
auto layout = new QVBoxLayout(newViewPort);
|
||||
|
||||
QSize minimumSize = newViewPort->sizeHint();
|
||||
int x = 0;
|
||||
|
||||
foreach(const auto &share, shares) {
|
||||
// We don't handle link shares
|
||||
|
@ -145,9 +147,20 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
|
|||
continue;
|
||||
}
|
||||
|
||||
ShareWidget *s = new ShareWidget(share, this);
|
||||
_ui->sharesLayout->addWidget(s);
|
||||
ShareWidget *s = new ShareWidget(share, _ui->scrollArea);
|
||||
layout->addWidget(s);
|
||||
|
||||
x++;
|
||||
if (x <= 3) {
|
||||
minimumSize = newViewPort->sizeHint();
|
||||
}
|
||||
}
|
||||
|
||||
minimumSize.rwidth() += layout->spacing();
|
||||
minimumSize.rheight() += layout->spacing();
|
||||
scrollArea->setMinimumSize(minimumSize);
|
||||
scrollArea->setVisible(!shares.isEmpty());
|
||||
scrollArea->setWidget(newViewPort);
|
||||
}
|
||||
|
||||
void ShareUserGroupWidget::slotShareesReady()
|
||||
|
|
|
@ -39,7 +39,34 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="sharesLayout"/>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>124</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
Загрузка…
Ссылка в новой задаче