[Pkg-owncloud-commits] [owncloud-client] 316/484: [Sharedialog] Fix UI stuff

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit d423cf2c7f5d8b6a584db7b1464a9ac8b1f55043
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date:   Fri Nov 13 10:27:26 2015 +0100

    [Sharedialog] Fix UI stuff
    
    Implemented suggestions form
    https://github.com/owncloud/client/issues/3737#issuecomment-156036279
    
    * Removed Shares text
    * Permissions now next to username
    * Simplified permissions by default
    * Button to get more detailed permissions
---
 src/gui/shareusergroupwidget.cpp |  86 +++++++++++++++++++++++++------
 src/gui/shareusergroupwidget.h   |   5 ++
 src/gui/shareusergroupwidget.ui  |  10 ----
 src/gui/sharewidget.ui           | 108 ++++++++++++++++++++++++---------------
 4 files changed, 144 insertions(+), 65 deletions(-)

diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index 6fe79db..4233a4f 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -63,6 +63,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
     connect(_manager, SIGNAL(shareCreated(QSharedPointer<Share>)), SLOT(getShares()));
 //    connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(on_searchPushButton_clicked()));
     connect(_completer, SIGNAL(activated(QModelIndex)), SLOT(slotCompleterActivated(QModelIndex)));
+
 }
 
 ShareUserGroupWidget::~ShareUserGroupWidget()
@@ -137,8 +138,6 @@ 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)
@@ -163,29 +162,26 @@ ShareWidget::ShareWidget(QSharedPointer<Share> share,
                                    QWidget *parent) :
   QWidget(parent),
   _ui(new Ui::ShareWidget),
-  _share(share)
+  _share(share),
+  _showDetailedPermissions(false)
 {
     _ui->setupUi(this);
 
     _ui->sharedWith->setText(share->getShareWith()->format());
 
-    if (share->getPermissions() & Share::PermissionUpdate) {
-        _ui->permissionUpdate->setCheckState(Qt::Checked);
-    }
-    if (share->getPermissions() & Share::PermissionCreate) {
-        _ui->permissionCreate->setCheckState(Qt::Checked);
-    }
-    if (share->getPermissions() & Share::PermissionDelete) {
-        _ui->permissionDelete->setCheckState(Qt::Checked);
-    }
-    if (share->getPermissions() & Share::PermissionShare) {
-        _ui->permissionShare->setCheckState(Qt::Checked);
-    }
+    // Set the permissions checkboxes
+    displayPermissions();
+
+    // Hide "detailed permissions" by default
+    _ui->permissionDelete->setHidden(true);
+    _ui->permissionUpdate->setHidden(true);
+    _ui->permissionCreate->setHidden(true);
 
     connect(_ui->permissionUpdate, SIGNAL(clicked(bool)), SLOT(slotPermissionsChanged()));
     connect(_ui->permissionCreate, SIGNAL(clicked(bool)), SLOT(slotPermissionsChanged()));
     connect(_ui->permissionDelete, SIGNAL(clicked(bool)), SLOT(slotPermissionsChanged()));
     connect(_ui->permissionShare,  SIGNAL(clicked(bool)), SLOT(slotPermissionsChanged()));
+    connect(_ui->permissionsEdit,  SIGNAL(clicked(bool)), SLOT(slotEditPermissionsChanged()));
 
     connect(share.data(), SIGNAL(permissionsSet()), SLOT(slotPermissionsSet()));
     connect(share.data(), SIGNAL(shareDeleted()), SLOT(slotShareDeleted()));
@@ -197,11 +193,45 @@ void ShareWidget::on_deleteShareButton_clicked()
     _share->deleteShare();
 }
 
+void ShareWidget::on_permissionToggleButton_clicked()
+{
+    _showDetailedPermissions = !_showDetailedPermissions;
+    _ui->permissionDelete->setVisible(_showDetailedPermissions);
+    _ui->permissionUpdate->setVisible(_showDetailedPermissions);
+    _ui->permissionCreate->setVisible(_showDetailedPermissions);
+
+    if (_showDetailedPermissions) {
+        _ui->permissionToggleButton->setText("Hide");
+    } else {
+        _ui->permissionToggleButton->setText("More");
+    }
+
+}
+
 ShareWidget::~ShareWidget()
 {
     delete _ui;
 }
 
+void ShareWidget::slotEditPermissionsChanged()
+{
+    setEnabled(false);
+
+    Share::Permissions permissions = Share::PermissionRead;
+
+    if (_ui->permissionShare->checkState() == Qt::Checked) {
+        permissions |= Share::PermissionUpdate;
+    }
+    
+    if (_ui->permissionsEdit->checkState() == Qt::Checked) {
+        permissions |= Share::PermissionCreate;
+        permissions |= Share::PermissionUpdate;
+        permissions |= Share::PermissionDelete;
+    }
+
+    _share->setPermissions(permissions);
+}
+
 void ShareWidget::slotPermissionsChanged()
 {
     setEnabled(false);
@@ -234,6 +264,7 @@ void ShareWidget::slotShareDeleted()
 
 void ShareWidget::slotPermissionsSet()
 {
+    displayPermissions();
     setEnabled(true);
 }
 
@@ -242,4 +273,29 @@ QSharedPointer<Share> ShareWidget::share() const
     return _share;
 }
 
+void ShareWidget::displayPermissions()
+{
+    _ui->permissionCreate->setCheckState(Qt::Unchecked);
+    _ui->permissionsEdit->setCheckState(Qt::Unchecked);
+    _ui->permissionDelete->setCheckState(Qt::Unchecked);
+    _ui->permissionShare->setCheckState(Qt::Unchecked);
+    _ui->permissionUpdate->setCheckState(Qt::Unchecked);
+
+    if (_share->getPermissions() & Share::PermissionUpdate) {
+        _ui->permissionUpdate->setCheckState(Qt::Checked);
+        _ui->permissionsEdit->setCheckState(Qt::Checked);
+    }
+    if (_share->getPermissions() & Share::PermissionCreate) {
+        _ui->permissionCreate->setCheckState(Qt::Checked);
+        _ui->permissionsEdit->setCheckState(Qt::Checked);
+    }
+    if (_share->getPermissions() & Share::PermissionDelete) {
+        _ui->permissionDelete->setCheckState(Qt::Checked);
+        _ui->permissionsEdit->setCheckState(Qt::Checked);
+    }
+    if (_share->getPermissions() & Share::PermissionShare) {
+        _ui->permissionShare->setCheckState(Qt::Checked);
+    }
+}
+
 }
diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h
index dec6b63..58247c3 100644
--- a/src/gui/shareusergroupwidget.h
+++ b/src/gui/shareusergroupwidget.h
@@ -57,13 +57,18 @@ signals:
 private slots:
     void on_deleteShareButton_clicked();
     void slotPermissionsChanged();
+    void slotEditPermissionsChanged();
+    void on_permissionToggleButton_clicked();
 
     void slotShareDeleted();
     void slotPermissionsSet();
 
 private:
+    void displayPermissions();
+
     Ui::ShareWidget *_ui;
     QSharedPointer<Share> _share;
+    bool _showDetailedPermissions;
 };
 
 
diff --git a/src/gui/shareusergroupwidget.ui b/src/gui/shareusergroupwidget.ui
index a6b3a35..b872fb5 100644
--- a/src/gui/shareusergroupwidget.ui
+++ b/src/gui/shareusergroupwidget.ui
@@ -39,16 +39,6 @@
     </layout>
    </item>
    <item>
-    <widget class="QLabel" name="labelShares">
-     <property name="enabled">
-      <bool>true</bool>
-     </property>
-     <property name="text">
-      <string>Shares</string>
-     </property>
-    </widget>
-   </item>
-   <item>
     <layout class="QVBoxLayout" name="sharesLayout"/>
    </item>
   </layout>
diff --git a/src/gui/sharewidget.ui b/src/gui/sharewidget.ui
index 84c3d91..66d53d4 100644
--- a/src/gui/sharewidget.ui
+++ b/src/gui/sharewidget.ui
@@ -9,8 +9,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>376</width>
-    <height>128</height>
+    <width>474</width>
+    <height>108</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -39,54 +39,82 @@
       </widget>
      </item>
      <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QGroupBox" name="groupBox">
+       <property name="title">
+        <string>Permissions</string>
+       </property>
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QCheckBox" name="permissionShare">
+          <property name="text">
+           <string>Can Share</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QCheckBox" name="permissionsEdit">
+          <property name="text">
+           <string>Can Edit</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QCheckBox" name="permissionCreate">
+          <property name="text">
+           <string>Create</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QCheckBox" name="permissionUpdate">
+          <property name="text">
+           <string>Change</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QCheckBox" name="permissionDelete">
+          <property name="text">
+           <string>Delete</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2">
+         <widget class="QPushButton" name="permissionToggleButton">
+          <property name="text">
+           <string>More</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
       <widget class="QToolButton" name="deleteShareButton">
        <property name="text">
         <string/>
        </property>
        <property name="icon">
-        <iconset theme="user-trash"/>
+        <iconset theme="user-trash">
+         <normaloff>.</normaloff>.</iconset>
        </property>
       </widget>
      </item>
     </layout>
    </item>
-   <item>
-    <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>
  </widget>
  <resources/>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list