Unshare action transferred to 3 dot menu
authorivyclare <ivolinengong@gmail.com>
Tue, 28 May 2019 21:07:22 +0000 (00:07 +0300)
committerivyclare <ivolinengong@gmail.com>
Wed, 29 May 2019 17:54:53 +0000 (20:54 +0300)
Signed-off-by: ivyclare <ivolinengong@gmail.com>
src/gui/shareusergroupwidget.cpp
src/gui/shareusergroupwidget.h
src/gui/shareuserline.ui

index d576b1edb1678aa39dae7c8c8a53630792551520..28e180e031b94526fb41c9e83527f5deec14d5e8 100644 (file)
@@ -202,7 +202,6 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
         connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares);
         s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
         layout->addWidget(s);
-        s->setVisible(true);
 
         x++;
         if (x <= 3) {
@@ -368,6 +367,15 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
     menu->addAction(_permissionReshare);
     connect(_permissionReshare, &QAction::triggered, this, &ShareUserLine::slotPermissionsChanged);
 
+    menu->addSeparator();
+
+      // Adds action to delete share widget
+      QIcon deleteicon = QIcon::fromTheme(QLatin1String("user-trash"),QIcon(QLatin1String(":/client/resources/delete.png")));
+      _deleteShareButton= new QAction(deleteicon,tr("Unshare"), this);
+
+    menu->addAction(_deleteShareButton);
+    connect(_deleteShareButton, &QAction::triggered, this, &ShareUserLine::on_deleteShareButton_clicked);
+
     /*
      * Files can't have create or delete permissions
      */
@@ -414,20 +422,13 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
     connect(share.data(), &Share::permissionsSet, this, &ShareUserLine::slotPermissionsSet);
     connect(share.data(), &Share::shareDeleted, this, &ShareUserLine::slotShareDeleted);
 
-    _ui->deleteShareButton->setIcon(QIcon::fromTheme(QLatin1String("user-trash"),
-                                                     QIcon(QLatin1String(":/client/resources/delete.png"))));
+    // _ui->deleteShareButton->setIcon(QIcon::fromTheme(QLatin1String("user-trash"),
+    //                                                  QIcon(QLatin1String(":/client/resources/delete.png"))));
 
     if (!share->account()->capabilities().shareResharing()) {
         _permissionReshare->setVisible(false);
     }
 
-    //If the initiator is not you. And the recipient is not you. Show it without any options.
-    if(share->account()->id() != share->getId() && share->account()->davUser() != share->getShareWith()->shareWith()){
-        _ui->permissionsEdit->hide();
-        _ui->permissionToolButton->hide();
-        _ui->deleteShareButton->hide();
-    }
-
     loadAvatar();
 }
 
index be1e3c1119078f9eda8531e64ba89af3b7ffc2fd..a1f537f059e685c5cef5652bf0da7b97669ff67f 100644 (file)
@@ -148,6 +148,7 @@ private:
 
     // _permissionEdit is a checkbox
     QAction *_permissionReshare;
+    QAction *_deleteShareButton;
     QAction *_permissionCreate;
     QAction *_permissionChange;
     QAction *_permissionDelete;
index 0de300930055110f37b1e35db4c8cf61403abaf4..d586ef161a0d901a9c4b7c86e13678104bc54199 100644 (file)
      </property>
     </widget>
    </item>
-   <item>
-    <widget class="QToolButton" name="deleteShareButton">
-     <property name="icon">
-      <iconset theme="user-trash">
-       <normaloff>.</normaloff>.</iconset>
-     </property>
-    </widget>
-   </item>
-  </layout>
+    </layout>
  </widget>
  <customwidgets>
   <customwidget>