Share dialog: a few layout adjustements

This commit is contained in:
Olivier Goffart 2015-11-09 15:58:50 +01:00
parent aa27b5db14
commit b74e812671
3 changed files with 73 additions and 61 deletions

View file

@ -60,7 +60,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
_manager = new ShareManager(_account, this);
connect(_manager, SIGNAL(sharesFetched(QList<QSharedPointer<Share>>)), SLOT(slotSharesFetched(QList<QSharedPointer<Share>>)));
connect(_manager, SIGNAL(shareCreated(QSharedPointer<Share>)), SLOT(getShares()));
connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(on_searchPushButton_clicked()));
// connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(on_searchPushButton_clicked()));
connect(_completer, SIGNAL(activated(QModelIndex)), SLOT(slotCompleterActivated(QModelIndex)));
}
@ -90,15 +90,13 @@ void ShareUserGroupWidget::on_searchPushButton_clicked()
QWidget *w = _ui->sharesLayout->itemAt(i)->widget();
if (w != NULL) {
const QSharedPointer<Sharee> x = dynamic_cast<ShareWidget *>(w)->share()->getShareWith();
const QSharedPointer<Sharee> x = static_cast<ShareWidget *>(w)->share()->getShareWith();
sharees.append(x);
}
}
_sharees.append(currentUser);
_completerModel = new ShareeModel(_account,
_ui->shareeLineEdit->text(),
_isFile ? QLatin1String("file") : QLatin1String("folder"),
@ -106,10 +104,11 @@ void ShareUserGroupWidget::on_searchPushButton_clicked()
_completer);
connect(_completerModel, SIGNAL(shareesReady()), SLOT(slotUpdateCompletion()));
_completerModel->fetch();
_completer->setModel(_completerModel);
}
void ShareUserGroupWidget::slotUpdateCompletion() {
_completer->setModel(_completerModel);
void ShareUserGroupWidget::slotUpdateCompletion()
{
_completer->complete();
}
@ -137,6 +136,8 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
ShareWidget *s = new ShareWidget(share, this);
_ui->sharesLayout->addWidget(s);
}
_ui->labelShares->setVisible(!shares.empty());
}
void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex & index) {

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>271</height>
<width>457</width>
<height>188</height>
</rect>
</property>
<property name="windowTitle">
@ -20,19 +20,26 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="shareeLineEdit"/>
<widget class="QLineEdit" name="shareeLineEdit">
<property name="placeholderText">
<string>Share with users, groups or remote users ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="searchPushButton">
<property name="text">
<string>Search</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelShares">
<property name="enabled">
<bool>true</bool>
</property>
@ -44,19 +51,6 @@
<item>
<layout class="QVBoxLayout" name="sharesLayout"/>
</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>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>

View file

@ -9,65 +9,82 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>376</width>
<height>128</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<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="sharedWith">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="sharedWith">
<property name="text">
<string>Permissions</string>
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionUpdate">
<widget class="QToolButton" name="deleteShareButton">
<property name="text">
<string>Update</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionCreate">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionDelete">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionShare">
<property name="text">
<string>Share</string>
<property name="icon">
<iconset theme="user-trash"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="deleteShareButton">
<property name="text">
<string>Delete</string>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Permissions</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="permissionDelete">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionCreate">
<property name="text">
<string>Create</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionUpdate">
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="permissionShare">
<property name="text">
<string>Share</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>