[Pkg-owncloud-commits] [owncloud-client] 260/484: [Sharing] Reorganized sharedialog code

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:50 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 3e4612a1f0c66e522d84359a479c1fc0e2f2c85b
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date:   Thu Nov 5 09:58:16 2015 +0100

    [Sharing] Reorganized sharedialog code
    
    Now we have 1 simple dialog that includes 2 widgets.
    * ShareLinkWidget (for link shares)
    * ShareUserGroupWidget (for user/group shares)
    
    The ShareUserGroupWidget is only included if the server version is >=
    8.2.0
    
    For <8.2.0 the old behavior is preserved
---
 src/gui/CMakeLists.txt                             |   8 +-
 src/gui/application.cpp                            |   2 -
 src/gui/owncloudgui.cpp                            |  22 -
 src/gui/owncloudgui.h                              |   1 -
 src/gui/sharedialog.cpp                            | 521 ++-------------------
 src/gui/sharedialog.h                              |  76 +--
 src/gui/sharedialog.ui                             | 216 +--------
 src/gui/{sharedialog.cpp => sharelinkwidget.cpp}   | 144 ++----
 src/gui/{sharedialog.h => sharelinkwidget.h}       |  25 +-
 src/gui/{sharedialog.ui => sharelinkwidget.ui}     | 113 +----
 src/gui/shareusergroupdialog.ui                    | 133 ------
 ...sergroupdialog.cpp => shareusergroupwidget.cpp} |  48 +-
 ...areusergroupdialog.h => shareusergroupwidget.h} |  30 +-
 src/gui/shareusergroupwidget.ui                    |  65 +++
 src/gui/{sharedialogshare.ui => sharewidget.ui}    |   4 +-
 src/gui/socketapi.cpp                              |  45 --
 src/gui/socketapi.h                                |   1 -
 17 files changed, 246 insertions(+), 1208 deletions(-)

diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index f5939e9..1c7832d 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -23,8 +23,9 @@ set(client_UI
     protocolwidget.ui
     settingsdialog.ui
     sharedialog.ui
-    shareusergroupdialog.ui
-    sharedialogshare.ui
+    sharelinkwidget.ui
+    shareusergroupwidget.ui
+    sharewidget.ui
     sslerrordialog.ui
     owncloudsetuppage.ui
     addcertificatedialog.ui
@@ -63,7 +64,8 @@ set(client_SRCS
     settingsdialog.cpp
     share.cpp
     sharedialog.cpp
-    shareusergroupdialog.cpp
+    sharelinkwidget.cpp
+    shareusergroupwidget.cpp
     sharee.cpp
     socketapi.cpp
     sslbutton.cpp
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 41e72e2..add9add 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -174,8 +174,6 @@ Application::Application(int &argc, char **argv) :
 
     connect(FolderMan::instance()->socketApi(), SIGNAL(shareCommandReceived(QString, QString, bool)),
             _gui, SLOT(slotShowShareDialog(QString, QString, bool)));
-    connect(FolderMan::instance()->socketApi(), SIGNAL(shareUserGroupCommandReceived(QString, QString, bool)),
-            _gui, SLOT(slotShowShareUserGroupDialog(QString, QString, bool)));
 
     // startup procedure.
     connect(&_checkConnectionTimer, SIGNAL(timeout()), this, SLOT(slotCheckConnection()));
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 4a04598..4adaeaa 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -20,7 +20,6 @@
 #include "progressdispatcher.h"
 #include "owncloudsetupwizard.h"
 #include "sharedialog.h"
-#include "shareusergroupdialog.h"
 #if defined(Q_OS_MAC)
 #    include "settingsdialogmac.h"
 #    include "macwindow.h" // qtmacgoodies
@@ -781,26 +780,5 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l
     raiseDialog(w);
 }
 
-void ownCloudGui::slotShowShareUserGroupDialog(const QString &sharePath, const QString &localPath, bool resharingAllowed)
-{
-    const auto folder = FolderMan::instance()->folderForPath(localPath);
-    if (!folder) {
-        qDebug() << "Could not open share dialog for" << localPath << "no responsible folder found";
-        return;
-    }
-
-    // For https://github.com/owncloud/client/issues/3783
-    _settingsDialog->hide();
-
-    const auto accountState = folder->accountState();
-
-    qDebug() << Q_FUNC_INFO << "Opening share dialog" << sharePath << localPath;
-    ShareUserGroupDialog *w = new ShareUserGroupDialog(accountState->account(), sharePath, localPath, resharingAllowed);
-    w->getShares();
-    w->setAttribute( Qt::WA_DeleteOnClose, true );
-    raiseDialog(w);
-}
-
-
 
 } // end namespace
diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h
index 014c3b1..891bd74 100644
--- a/src/gui/owncloudgui.h
+++ b/src/gui/owncloudgui.h
@@ -77,7 +77,6 @@ public slots:
     void slotOpenPath(const QString& path);
     void slotAccountStateChanged();
     void slotShowShareDialog(const QString &sharePath, const QString &localPath, bool resharingAllowed);
-    void slotShowShareUserGroupDialog(const QString &sharePath, const QString &localPath, bool resharingAllowed);
 
 private slots:
     void slotDisplayIdle();
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index 3b47057..7be123e 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -1,6 +1,5 @@
 /*
  * Copyright (C) by Roeland Jago Douma <roeland at famdouma.nl>
- * Copyright (C) 2015 by Klaas Freitag <freitag at owncloud.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -13,91 +12,48 @@
  */
 
 #include "sharedialog.h"
+#include "sharelinkwidget.h"
+#include "shareusergroupwidget.h"
 #include "ui_sharedialog.h"
+
 #include "account.h"
-#include "json.h"
-#include "folderman.h"
-#include "folder.h"
-#include "accountmanager.h"
-#include "theme.h"
 #include "configfile.h"
-#include "capabilities.h"
-
+#include "theme.h"
 #include "thumbnailjob.h"
-#include "share.h"
 
-#include "QProgressIndicator.h"
-#include <QBuffer>
-#include <QFileIconProvider>
-#include <QClipboard>
 #include <QFileInfo>
+#include <QFileIconProvider>
+#include <QDebug>
+#include <QPushButton>
+#include <QFrame>
 
 namespace OCC {
 
 ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) :
-   QDialog(parent),
+    QDialog(parent),
     _ui(new Ui::ShareDialog),
     _account(account),
     _sharePath(sharePath),
     _localPath(localPath),
-    _passwordJobRunning(false),
-    _manager(NULL),
-    _share(NULL),
-    _resharingAllowed(resharingAllowed)
+    _resharingAllowed(resharingAllowed),
+    _linkWidget(NULL),
+    _userGroupWidget(NULL)
 {
     setAttribute(Qt::WA_DeleteOnClose);
     setObjectName("SharingDialog"); // required as group for saveGeometry call
 
     _ui->setupUi(this);
 
-    //Is this a file or folder?
-    _isFile = QFileInfo(localPath).isFile();
-
-    _ui->pushButton_copy->setIcon(QIcon::fromTheme("edit-copy"));
-    _ui->pushButton_copy->setEnabled(false);
-    connect(_ui->pushButton_copy, SIGNAL(clicked(bool)), SLOT(slotPushButtonCopyLinkPressed()));
-
     QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
-    if( closeButton ) {
-        connect( closeButton, SIGNAL(clicked()), this, SLOT(close()) );
-    }
-
-    // the following progress indicator widgets are added to layouts which makes them
-    // automatically deleted once the dialog dies.
-    _pi_link     = new QProgressIndicator();
-    _pi_password = new QProgressIndicator();
-    _pi_date     = new QProgressIndicator();
-    _pi_editing  = new QProgressIndicator();
-    _ui->horizontalLayout_shareLink->addWidget(_pi_link);
-    _ui->horizontalLayout_password->addWidget(_pi_password);
-    _ui->horizontalLayout_editing->addWidget(_pi_editing);
-    // _ui->horizontalLayout_expire->addWidget(_pi_date);
-
-    connect(_ui->checkBox_shareLink, SIGNAL(clicked()), this, SLOT(slotCheckBoxShareLinkClicked()));
-    connect(_ui->checkBox_password, SIGNAL(clicked()), this, SLOT(slotCheckBoxPasswordClicked()));
-    connect(_ui->lineEdit_password, SIGNAL(returnPressed()), this, SLOT(slotPasswordReturnPressed()));
-    connect(_ui->lineEdit_password, SIGNAL(textChanged(QString)), this, SLOT(slotPasswordChanged(QString)));
-    connect(_ui->pushButton_setPassword, SIGNAL(clicked(bool)), SLOT(slotPasswordReturnPressed()));
-    connect(_ui->checkBox_expire, SIGNAL(clicked()), this, SLOT(slotCheckBoxExpireClicked()));
-    connect(_ui->calendar, SIGNAL(dateChanged(QDate)), SLOT(slotCalendarClicked(QDate)));
-    connect(_ui->checkBox_editing, SIGNAL(clicked()), this, SLOT(slotCheckBoxEditingClicked()));
-
-    //Disable checkbox
-    _ui->checkBox_shareLink->setEnabled(false);
-    _pi_link->startAnimation();
-
-    _ui->pushButton_setPassword->setEnabled(false);
-    _ui->widget_shareLink->hide();
-    _ui->lineEdit_password->hide();
-    _ui->pushButton_setPassword->hide();
-
-    _ui->calendar->setEnabled(false);
+    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
 
+    // Set icon
     QFileInfo f_info(_localPath);
     QFileIconProvider icon_provider;
     QIcon icon = icon_provider.icon(f_info);
     _ui->label_icon->setPixmap(icon.pixmap(40,40));
 
+    // Set filename
     QFileInfo lPath(_localPath);
     QString fileName = lPath.fileName();
     _ui->label_name->setText(tr("%1").arg(fileName));
@@ -118,88 +74,22 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
     }
 
     this->setWindowTitle(tr("%1 Sharing").arg(Theme::instance()->appNameGUI()));
-    _ui->checkBox_password->setText(tr("P&assword protect"));
-    // check if the file is already inside of a synced folder
-    if( sharePath.isEmpty() ) {
-        // The file is not yet in an ownCloud synced folder. We could automatically
-        // copy it over, but that is skipped as not all questions can be answered that
-        // are involved in that, see https://github.com/owncloud/client/issues/2732
-        //
-        // _ui->checkBox_shareLink->setEnabled(false);
-        // uploadExternalFile();
-        qDebug() << Q_FUNC_INFO << "Unable to share files not in a sync folder.";
-        return;
-    }
-
-    // error label, red box and stuff
-    _ui->errorLabel->setLineWidth(1);
-    _ui->errorLabel->setFrameStyle(QFrame::Plain);
-
-    QPalette errPalette = _ui->errorLabel->palette();
-    errPalette.setColor(QPalette::Active, QPalette::Base, QColor(0xaa, 0x4d, 0x4d));
-    errPalette.setColor(QPalette::Active, QPalette::WindowText, QColor(0xaa, 0xaa, 0xaa));
 
-    _ui->errorLabel->setPalette(errPalette);
-    _ui->errorLabel->setFrameShape(QFrame::Box);
-    _ui->errorLabel->setContentsMargins(QMargins(12,12,12,12));
-    _ui->errorLabel->hide();
+    bool autoShare = true;
 
+    // We only do user/group sharing from 8.2.0
+    if (account->serverVersionInt() >= ((8 << 16) + (2 << 8))) {
+        _userGroupWidget = new ShareUserGroupWidget(account, sharePath, localPath, resharingAllowed, this);
+        _ui->shareWidgetsLayout->addWidget(_userGroupWidget);
 
-    // Parse capabilities
-
-    // If password is enforced then don't allow users to disable it
-    if (_account->capabilities().sharePublicLinkEnforcePassword()) {
-        _ui->checkBox_password->setEnabled(false);
+        QFrame *hline = new QFrame(this);
+        hline->setFrameShape(QFrame::HLine);
+        _ui->shareWidgetsLayout->addWidget(hline);
+        autoShare = false;
     }
 
-    // If expiredate is enforced do not allow disable and set max days
-    if (_account->capabilities().sharePublicLinkEnforceExpireDate()) {
-        _ui->checkBox_expire->setEnabled(false);
-        _ui->calendar->setMaximumDate(QDate::currentDate().addDays(
-            _account->capabilities().sharePublicLinkExpireDateDays()
-            ));
-    }
-
-    // File can't have public upload set.
-    if (_isFile) {
-        _ui->checkBox_editing->setEnabled(false);
-    } else {
-        if (!_account->capabilities().sharePublicLinkAllowUpload()) {
-            _ui->checkBox_editing->setEnabled(false);
-        }
-    }
-
-    /*
-     * Create the share manager and connect it properly
-     */
-    _manager = new ShareManager(_account, this);
-
-    connect(_manager, SIGNAL(sharesFetched(QList<QSharedPointer<Share>>)), SLOT(slotSharesFetched(QList<QSharedPointer<Share>>)));
-    connect(_manager, SIGNAL(linkShareCreated(QSharedPointer<LinkShare>)), SLOT(slotCreateShareFetched(const QSharedPointer<LinkShare>)));
-    connect(_manager, SIGNAL(linkShareRequiresPassword()), SLOT(slotCreateShareRequiresPassword()));
-    connect(_manager, SIGNAL(serverError(int, QString)), SLOT(displayError(int, QString)));
-}
-
-void ShareDialog::done( int r ) {
-    ConfigFile cfg;
-    cfg.saveGeometry(this);
-    QDialog::done(r);
-}
-
-void ShareDialog::setExpireDate(const QDate &date)
-{
-    _pi_date->startAnimation();
-    _share->setExpireDate(date);
-}
-
-void ShareDialog::slotExpireSet()
-{
-    _pi_date->stopAnimation();
-}
-
-void ShareDialog::slotCalendarClicked(const QDate &date)
-{
-    setExpireDate(date);
+    _linkWidget = new ShareLinkWidget(account, sharePath, localPath, resharingAllowed, autoShare, this);
+    _ui->shareWidgetsLayout->addWidget(_linkWidget);
 }
 
 ShareDialog::~ShareDialog()
@@ -207,362 +97,24 @@ ShareDialog::~ShareDialog()
     delete _ui;
 }
 
-void ShareDialog::slotPasswordReturnPressed()
-{
-    setPassword(_ui->lineEdit_password->text());
-    _ui->lineEdit_password->setText(QString());
-    _ui->lineEdit_password->setPlaceholderText(tr("Password Protected"));
-    _ui->lineEdit_password->clearFocus();
-}
-
-void ShareDialog::slotPasswordChanged(const QString& newText)
-{
-    // disable the set-password button
-    _ui->pushButton_setPassword->setEnabled( newText.length() > 0 );
-}
-
-void ShareDialog::setPassword(const QString &password)
-{
-    _pi_link->startAnimation();
-    _pi_password->startAnimation();
-
-    _ui->checkBox_password->setEnabled(false);
-    _ui->lineEdit_password->setEnabled(false);
-
-    if( !_share.isNull() ) {
-        _share->setPassword(password);
-    } else {
-        _ui->checkBox_shareLink->setEnabled(false);
-        _manager->createLinkShare(_sharePath, password);
-    }
-}
-
-void ShareDialog::slotPasswordSet()
-{
-    /*
-     * When setting/deleting a password from a share the old share is
-     * deleted and a new one is created. So we need to refetch the shares
-     * at this point.
-     */
-    getShares();
-
-    _pi_password->stopAnimation();
+void ShareDialog::done( int r ) {
+    ConfigFile cfg;
+    cfg.saveGeometry(this);
+    QDialog::done(r);
 }
 
 void ShareDialog::getShares()
 {
-    _manager->fetchShares(_sharePath);
-
     if (QFileInfo(_localPath).isFile()) {
-        ThumbnailJob *job2 = new ThumbnailJob(_sharePath, _account, this);
-        connect(job2, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray)));
-        job2->start();
-    }
-}
-
-void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
-{
-    const QString versionString = _account->serverVersion();
-    qDebug() << Q_FUNC_INFO << versionString << "Fetched" << shares.count() << "shares";
-
-    //Show link checkbox now
-    _ui->checkBox_shareLink->setEnabled(true);
-    _pi_link->stopAnimation();
-
-    Q_FOREACH(auto share, shares) {
-
-        if (share->getShareType() == Share::TypeLink) {
-            _share = qSharedPointerDynamicCast<LinkShare>(share);
-            _ui->pushButton_copy->show();
-
-            _ui->widget_shareLink->show();
-            _ui->checkBox_shareLink->setChecked(true);
-
-            _ui->checkBox_password->setEnabled(true);
-            if (_share->isPasswordSet()) {
-                _ui->lineEdit_password->setEnabled(true);
-                _ui->checkBox_password->setChecked(true);
-                _ui->lineEdit_password->setPlaceholderText("********");
-                _ui->lineEdit_password->show();
-                _ui->pushButton_setPassword->show();
-            } else {
-                _ui->checkBox_password->setChecked(false);
-                // _ui->lineEdit_password->setPlaceholderText("********");
-                _ui->lineEdit_password->hide();
-                _ui->pushButton_setPassword->hide();
-            }
-
-            _ui->checkBox_expire->setEnabled(true);
-            if (_share->getExpireDate().isValid()) {
-                _ui->calendar->setDate(_share->getExpireDate());
-                _ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
-                _ui->calendar->setEnabled(true);
-                _ui->checkBox_expire->setChecked(true);
-            } else {
-                _ui->calendar->setEnabled(false);
-                _ui->checkBox_expire->setChecked(false);
-            }
-
-            /*
-             * Only directories can have public upload set
-             * For public links the server sets CREATE and UPDATE permissions.
-             */
-            if (!_isFile) {
-                _ui->checkBox_editing->setEnabled(true);
-                if (_share->getPublicUpload()) {
-                    _ui->checkBox_editing->setChecked(true);
-                } else {
-                    _ui->checkBox_editing->setChecked(false);
-                }
-            }
-
-            setShareLink(_share->getLink().toString());
-            _ui->pushButton_copy->setEnabled(true);
-
-            // Connect all shares signals to gui slots
-            connect(_share.data(), SIGNAL(expireDateSet()), SLOT(slotExpireSet()));
-            connect(_share.data(), SIGNAL(publicUploadSet()), SLOT(slotPublicUploadSet()));
-            connect(_share.data(), SIGNAL(passwordSet()), SLOT(slotPasswordSet()));
-            connect(_share.data(), SIGNAL(shareDeleted()), SLOT(slotDeleteShareFetched()));
-            connect(_share.data(), SIGNAL(serverError(int, QString)), SLOT(displayError(int, QString)));
-
-            break;
-        }
-    }
-    if( !_share.isNull() ) {
-        setShareCheckBoxTitle(true);
-    } else {
-        // If there are no shares yet, check the checkbox to create a link automatically.
-        // If its clear that resharing is not allowed, display an error
-        if( !_resharingAllowed ) {
-            displayError(tr("The file can not be shared because it was shared without sharing permission."));
-            _ui->checkBox_shareLink->setEnabled(false);
-        } else {
-            _ui->checkBox_shareLink->setChecked(true);
-            slotCheckBoxShareLinkClicked();
-        }
-    }
-}
-
-void ShareDialog::resizeEvent(QResizeEvent *e)
-{
-    QDialog::resizeEvent(e);
-    redrawElidedUrl();
-}
-
-void ShareDialog::redrawElidedUrl()
-{
-    QString u;
-
-    if( !_shareUrl.isEmpty() ) {
-        QFontMetrics fm( _ui->_labelShareLink->font() );
-        int linkLengthPixel = _ui->_labelShareLink->width();
-
-        const QUrl realUrl(_shareUrl);
-        QString elidedUrl = fm.elidedText(_shareUrl, Qt::ElideRight, linkLengthPixel);
-
-        u = QString("<a href=\"%1\">%2</a>").arg(realUrl.toString(QUrl::None)).arg(elidedUrl);
+        ThumbnailJob *job = new ThumbnailJob(_sharePath, _account, this);
+        connect(job, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray)));
+        job->start();
     }
-    _ui->_labelShareLink->setText(u);
-}
 
-void ShareDialog::setShareLink( const QString& url )
-{
-    // FIXME: shorten the url for output.
-    const QUrl realUrl(url);
-    if( realUrl.isValid() ) {
-        _shareUrl = url;
-        _ui->pushButton_copy->setEnabled(true);
-    } else {
-        _shareUrl.clear();
-        _ui->_labelShareLink->setText(QString::null);
+    _linkWidget->getShares();
+    if (_userGroupWidget != NULL) {
+        _userGroupWidget->getShares();
     }
-    redrawElidedUrl();
-
-}
-
-void ShareDialog::slotDeleteShareFetched()
-{
-    _share.clear();
-    _pi_link->stopAnimation();
-    _ui->lineEdit_password->clear();
-    _ui->_labelShareLink->clear();
-    _ui->pushButton_copy->setEnabled(false);
-    _ui->widget_shareLink->hide();
-    _ui->lineEdit_password->hide();
-    _ui->pushButton_setPassword->setEnabled(false);
-    _ui->pushButton_setPassword->hide();
-    _ui->checkBox_expire->setChecked(false);
-    _ui->checkBox_password->setChecked(false);
-    _ui->calendar->setEnabled(false);
-
-    _shareUrl.clear();
-
-    setShareCheckBoxTitle(false);
-}
-
-void ShareDialog::slotCheckBoxShareLinkClicked()
-{
-    qDebug() << Q_FUNC_INFO <<( _ui->checkBox_shareLink->checkState() == Qt::Checked);
-    if (_ui->checkBox_shareLink->checkState() == Qt::Checked) {
-        _pi_link->startAnimation();
-
-        /*
-         * Check the capabilities if the server requires a password for a share
-         * Ask for it directly
-         */
-        if (_account->capabilities().sharePublicLinkEnforcePassword()) {
-            _pi_link->stopAnimation();
-            _ui->checkBox_password->setChecked(true);
-            _ui->checkBox_password->setEnabled(false);
-            _ui->checkBox_password->setText(tr("Public sh&aring requires a password"));
-            _ui->checkBox_expire->setEnabled(false);
-            _ui->checkBox_editing->setEnabled(false);
-            _ui->lineEdit_password->setFocus();
-            _ui->pushButton_copy->hide();
-            _ui->widget_shareLink->show();
-
-            slotCheckBoxPasswordClicked();
-            return;
-        }
-
-        _ui->checkBox_shareLink->setEnabled(false);
-        _manager->createLinkShare(_sharePath);
-    } else {
-
-        if (!_share.isNull()) {
-            // We have a share so delete it
-            _pi_link->startAnimation();
-            _share->deleteShare();
-        } else {
-            // No share object so we are deleting while a password is required
-            _ui->widget_shareLink->hide();
-        }
-
-        
-    }
-}
-
-void ShareDialog::slotCreateShareFetched(const QSharedPointer<LinkShare> share)
-{
-    _pi_link->stopAnimation();
-    _pi_password->stopAnimation();
-
-    _share = share;
-    getShares();
-}
-
-void ShareDialog::slotCreateShareRequiresPassword()
-{
-    // there needs to be a password
-    _ui->checkBox_password->setChecked(true);
-    _ui->checkBox_password->setEnabled(false);
-    _ui->checkBox_password->setText(tr("Public sh&aring requires a password"));
-    _ui->lineEdit_password->setFocus();
-    _ui->pushButton_copy->hide();
-    _ui->widget_shareLink->show();
-    _ui->checkBox_expire->setEnabled(false);
-    _ui->checkBox_editing->setEnabled(false);
-
-    slotCheckBoxPasswordClicked();
-}
-
-void ShareDialog::slotCheckBoxPasswordClicked()
-{
-    if (_ui->checkBox_password->checkState() == Qt::Checked) {
-        _ui->lineEdit_password->show();
-        _ui->pushButton_setPassword->show();
-        _ui->lineEdit_password->setPlaceholderText(tr("Please Set Password"));
-        _ui->lineEdit_password->setFocus();
-    } else {
-        setPassword(QString());
-        _ui->lineEdit_password->setPlaceholderText(QString());
-        _pi_password->startAnimation();
-        _ui->lineEdit_password->hide();
-        _ui->pushButton_setPassword->hide();
-    }
-}
-
-void ShareDialog::slotCheckBoxExpireClicked()
-{
-    if (_ui->checkBox_expire->checkState() == Qt::Checked)
-    {
-        const QDate date = QDate::currentDate().addDays(1);
-        setExpireDate(date);
-        _ui->calendar->setDate(date);
-        _ui->calendar->setMinimumDate(date);
-        _ui->calendar->setEnabled(true);
-    }
-    else
-    {
-        setExpireDate(QDate());
-        _ui->calendar->setEnabled(false);
-    }
-}
-
-#ifdef Q_OS_MAC
-extern void copyToPasteboard(const QString &string);
-#endif
-
-void ShareDialog::slotPushButtonCopyLinkPressed()
-{
-#ifdef Q_OS_MAC
-    copyToPasteboard(_shareUrl);
-#else
-    QClipboard *clipboard = QApplication::clipboard();
-    clipboard->setText(_shareUrl);
-#endif
-}
-
-void ShareDialog::slotCheckBoxEditingClicked()
-{
-    ShareDialog::setPublicUpload(_ui->checkBox_editing->checkState() == Qt::Checked);
-}
-
-void ShareDialog::setPublicUpload(bool publicUpload)
-{
-    _ui->checkBox_editing->setEnabled(false);
-    _pi_editing->startAnimation();
-
-    _share->setPublicUpload(publicUpload);
-}
-
-void ShareDialog::slotPublicUploadSet()
-{
-    _pi_editing->stopAnimation();
-    _ui->checkBox_editing->setEnabled(true);
-}
-
-void ShareDialog::setShareCheckBoxTitle(bool haveShares)
-{
-    const QString noSharesTitle(tr("&Share link"));
-    const QString haveSharesTitle(tr("&Share link"));
-
-    if( haveShares ) {
-        _ui->checkBox_shareLink->setText( haveSharesTitle );
-    } else {
-        _ui->checkBox_shareLink->setText( noSharesTitle );
-    }
-
-}
-
-void ShareDialog::displayError(int code, const QString &message)
-{
-    const QString arg = QString("%1, %2").arg(code).arg(message);
-    const QString errMsg = tr("OCS API error code: %1").arg(arg);
-    displayError(errMsg);
-}
-
-void ShareDialog::displayError(const QString& errMsg)
-{
-    _ui->errorLabel->setText( errMsg );
-    _ui->errorLabel->show();
-}
-
-void ShareDialog::displayError(int code)
-{
-    const QString errMsg = tr("OCS API error code: %1").arg(code);
-    displayError(errMsg);
 }
 
 void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &reply)
@@ -578,3 +130,4 @@ void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &
 }
 
 }
+
diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h
index 6b0c089..abf4ab4 100644
--- a/src/gui/sharedialog.h
+++ b/src/gui/sharedialog.h
@@ -1,6 +1,5 @@
 /*
  * Copyright (C) by Roeland Jago Douma <roeland at famdouma.nl>
- * Copyright (C) 2015 by Klaas Freitag <freitag at owncloud.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,11 +15,9 @@
 #define SHAREDIALOG_H
 
 #include "accountfwd.h"
-#include "QProgressIndicator.h"
+#include <QString>
 #include <QDialog>
-#include <QVariantMap>
-#include <QSharedPointer>
-#include <QList>
+#include <QWidget>
 
 namespace OCC {
 
@@ -28,82 +25,37 @@ namespace Ui {
 class ShareDialog;
 }
 
-class AbstractCredentials;
-class QuotaInfo;
-class SyncResult;
-class LinkShare;
-class Share;
-class ShareManager;
+class ShareLinkWidget;
+class ShareUserGroupWidget;
 
-/**
- * @brief The ShareDialog class
- * @ingroup gui
- */
 class ShareDialog : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit ShareDialog(AccountPtr account, const QString &sharePath, const QString &localPath,
-                         bool resharingAllowed, QWidget *parent = 0);
+    explicit ShareDialog(AccountPtr account,
+                         const QString &sharePath,
+                         const QString &localPath,
+                         bool resharingAllowed,
+                         QWidget *parent = 0);
     ~ShareDialog();
+
     void getShares();
 
 private slots:
-    void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
-    void slotCreateShareFetched(const QSharedPointer<LinkShare> share);
-    void slotCreateShareRequiresPassword();
-    void slotDeleteShareFetched();
-    void slotPasswordSet();
-    void slotExpireSet();
-    void slotCalendarClicked(const QDate &date);
-    void slotCheckBoxShareLinkClicked();
-    void slotCheckBoxPasswordClicked();
-    void slotCheckBoxExpireClicked();
-    void slotPasswordReturnPressed();
-    void slotPasswordChanged(const QString& newText);
-    void slotPushButtonCopyLinkPressed();
+    void done( int r );
     void slotThumbnailFetched(const int &statusCode, const QByteArray &reply);
-    void slotCheckBoxEditingClicked();
-    void slotPublicUploadSet();
 
-    void displayError(int code, const QString &message);
-
-    void done( int r );
 private:
-    void setShareCheckBoxTitle(bool haveShares);
-    void displayError(int code);
-    void displayError(const QString& errMsg);
-    void setShareLink( const QString& url );
-    void resizeEvent(QResizeEvent *e);
-    void redrawElidedUrl();
-    void setPublicUpload(bool publicUpload);
-
     Ui::ShareDialog *_ui;
     AccountPtr _account;
     QString _sharePath;
     QString _localPath;
-    QString _shareUrl;
-#if 0
-    QString _folderAlias;
-    int     _uploadFails;
-    QString _expectedSyncFile;
-#endif
-
-    bool _passwordJobRunning;
-    void setPassword(const QString &password);
-    void setExpireDate(const QDate &date);
-
-    QProgressIndicator *_pi_link;
-    QProgressIndicator *_pi_password;
-    QProgressIndicator *_pi_date;
-    QProgressIndicator *_pi_editing;
-
-    ShareManager *_manager;
-    QSharedPointer<LinkShare> _share;
 
     bool _resharingAllowed;
-    bool _isFile;
+
+    ShareLinkWidget *_linkWidget;
+    ShareUserGroupWidget *_userGroupWidget;
 };
 
 }
diff --git a/src/gui/sharedialog.ui b/src/gui/sharedialog.ui
index dab61b8..75359d4 100644
--- a/src/gui/sharedialog.ui
+++ b/src/gui/sharedialog.ui
@@ -6,23 +6,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>372</width>
-    <height>277</height>
+    <width>400</width>
+    <height>300</height>
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Share NewDocument.odt</string>
+   <string>Dialog</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_3">
-   <item row="0" column="0" colspan="2">
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
     <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="0" rowspan="2">
-      <widget class="QLabel" name="label_icon">
-       <property name="text">
-        <string>TextLabel</string>
-       </property>
-      </widget>
-     </item>
      <item row="0" column="1">
       <widget class="QLabel" name="label_name">
        <property name="sizePolicy">
@@ -42,9 +35,6 @@
        </property>
       </widget>
      </item>
-     <item row="0" column="2" rowspan="2">
-      <widget class="QProgressIndicator" name="pi_share" native="true"/>
-     </item>
      <item row="1" column="1">
       <widget class="QLabel" name="label_sharePath">
        <property name="sizePolicy">
@@ -64,176 +54,19 @@
        </property>
       </widget>
      </item>
-    </layout>
-   </item>
-   <item row="1" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout_shareLink">
-     <property name="topMargin">
-      <number>10</number>
-     </property>
-     <item>
-      <widget class="QCheckBox" name="checkBox_shareLink">
+     <item row="0" column="0" rowspan="2">
+      <widget class="QLabel" name="label_icon">
        <property name="text">
-        <string>Share link</string>
+        <string>TextLabel</string>
        </property>
       </widget>
      </item>
     </layout>
    </item>
-   <item row="2" column="0" colspan="2">
-    <widget class="QWidget" name="widget_shareLink" native="true">
-     <layout class="QGridLayout" name="gridLayout_2">
-      <property name="leftMargin">
-       <number>20</number>
-      </property>
-      <property name="topMargin">
-       <number>1</number>
-      </property>
-      <property name="rightMargin">
-       <number>0</number>
-      </property>
-      <item row="2" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout">
-        <property name="leftMargin">
-         <number>20</number>
-        </property>
-        <item>
-         <widget class="QLineEdit" name="lineEdit_password">
-          <property name="echoMode">
-           <enum>QLineEdit::Password</enum>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_setPassword">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="text">
-           <string>Set &password </string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="4" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_2">
-        <property name="leftMargin">
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QCheckBox" name="checkBox_expire">
-          <property name="text">
-           <string>Set &expiration date</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QDateEdit" name="calendar">
-          <property name="calendarPopup">
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="1" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_password">
-        <item>
-         <widget class="QCheckBox" name="checkBox_password">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="text">
-           <string>Set password</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <spacer name="horizontalSpacer_3">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-       </layout>
-      </item>
-      <item row="0" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <property name="sizeConstraint">
-         <enum>QLayout::SetDefaultConstraint</enum>
-        </property>
-        <item>
-         <widget class="QLabel" name="_labelShareLink">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="frameShape">
-           <enum>QFrame::NoFrame</enum>
-          </property>
-          <property name="text">
-           <string/>
-          </property>
-          <property name="textFormat">
-           <enum>Qt::RichText</enum>
-          </property>
-          <property name="openExternalLinks">
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_copy">
-          <property name="text">
-           <string>Copy &link</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="3" column="0">
-       <layout class="QHBoxLayout" name="horizontalLayout_editing">
-        <item>
-         <widget class="QCheckBox" name="checkBox_editing">
-          <property name="text">
-           <string>Allow editing</string>
-          </property>
-         </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>
-       </layout>
-      </item>
-     </layout>
-    </widget>
+   <item>
+    <layout class="QVBoxLayout" name="shareWidgetsLayout"/>
    </item>
-   <item row="3" column="1">
+   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -246,20 +79,7 @@
      </property>
     </spacer>
    </item>
-   <item row="4" column="0">
-    <widget class="QLabel" name="errorLabel">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>TextLabel</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0" colspan="2">
+   <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
@@ -273,19 +93,7 @@
     </widget>
    </item>
   </layout>
-  <zorder>errorLabel</zorder>
-  <zorder>widget_shareLink</zorder>
-  <zorder>buttonBox</zorder>
  </widget>
- <layoutdefault spacing="6" margin="11"/>
- <customwidgets>
-  <customwidget>
-   <class>QProgressIndicator</class>
-   <extends>QWidget</extends>
-   <header>QProgressIndicator.h</header>
-   <container>1</container>
-  </customwidget>
- </customwidgets>
  <resources/>
  <connections/>
 </ui>
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharelinkwidget.cpp
similarity index 79%
copy from src/gui/sharedialog.cpp
copy to src/gui/sharelinkwidget.cpp
index 3b47057..9c64dde 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharelinkwidget.cpp
@@ -12,42 +12,37 @@
  * for more details.
  */
 
-#include "sharedialog.h"
-#include "ui_sharedialog.h"
+#include "sharelinkwidget.h"
+#include "ui_sharelinkwidget.h"
 #include "account.h"
-#include "json.h"
-#include "folderman.h"
-#include "folder.h"
-#include "accountmanager.h"
-#include "theme.h"
-#include "configfile.h"
 #include "capabilities.h"
 
-#include "thumbnailjob.h"
 #include "share.h"
 
 #include "QProgressIndicator.h"
 #include <QBuffer>
-#include <QFileIconProvider>
 #include <QClipboard>
 #include <QFileInfo>
 
 namespace OCC {
 
-ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) :
-   QDialog(parent),
-    _ui(new Ui::ShareDialog),
+ShareLinkWidget::ShareLinkWidget(AccountPtr account,
+                                 const QString &sharePath,
+                                 const QString &localPath,
+                                 bool resharingAllowed,
+                                 bool autoShare,
+                                 QWidget *parent) :
+   QWidget(parent),
+    _ui(new Ui::ShareLinkWidget),
     _account(account),
     _sharePath(sharePath),
     _localPath(localPath),
     _passwordJobRunning(false),
     _manager(NULL),
     _share(NULL),
-    _resharingAllowed(resharingAllowed)
+    _resharingAllowed(resharingAllowed),
+    _autoShare(autoShare)
 {
-    setAttribute(Qt::WA_DeleteOnClose);
-    setObjectName("SharingDialog"); // required as group for saveGeometry call
-
     _ui->setupUi(this);
 
     //Is this a file or folder?
@@ -57,11 +52,6 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
     _ui->pushButton_copy->setEnabled(false);
     connect(_ui->pushButton_copy, SIGNAL(clicked(bool)), SLOT(slotPushButtonCopyLinkPressed()));
 
-    QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
-    if( closeButton ) {
-        connect( closeButton, SIGNAL(clicked()), this, SLOT(close()) );
-    }
-
     // the following progress indicator widgets are added to layouts which makes them
     // automatically deleted once the dialog dies.
     _pi_link     = new QProgressIndicator();
@@ -93,31 +83,6 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
 
     _ui->calendar->setEnabled(false);
 
-    QFileInfo f_info(_localPath);
-    QFileIconProvider icon_provider;
-    QIcon icon = icon_provider.icon(f_info);
-    _ui->label_icon->setPixmap(icon.pixmap(40,40));
-
-    QFileInfo lPath(_localPath);
-    QString fileName = lPath.fileName();
-    _ui->label_name->setText(tr("%1").arg(fileName));
-    QFont f( _ui->label_name->font());
-    f.setPointSize( f.pointSize() * 1.4 );
-    _ui->label_name->setFont( f );
-
-    _ui->label_sharePath->setWordWrap(true);
-    QString ocDir(_sharePath);
-    ocDir.truncate(ocDir.length()-fileName.length());
-
-    ocDir.replace(QRegExp("^/*"), "");
-    ocDir.replace(QRegExp("/*$"), "");
-    if( ocDir.isEmpty() ) {
-        _ui->label_sharePath->setText(QString());
-    } else {
-        _ui->label_sharePath->setText(tr("Folder: %2").arg(ocDir));
-    }
-
-    this->setWindowTitle(tr("%1 Sharing").arg(Theme::instance()->appNameGUI()));
     _ui->checkBox_password->setText(tr("P&assword protect"));
     // check if the file is already inside of a synced folder
     if( sharePath.isEmpty() ) {
@@ -180,34 +145,28 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
     connect(_manager, SIGNAL(serverError(int, QString)), SLOT(displayError(int, QString)));
 }
 
-void ShareDialog::done( int r ) {
-    ConfigFile cfg;
-    cfg.saveGeometry(this);
-    QDialog::done(r);
-}
-
-void ShareDialog::setExpireDate(const QDate &date)
+void ShareLinkWidget::setExpireDate(const QDate &date)
 {
     _pi_date->startAnimation();
     _share->setExpireDate(date);
 }
 
-void ShareDialog::slotExpireSet()
+void ShareLinkWidget::slotExpireSet()
 {
     _pi_date->stopAnimation();
 }
 
-void ShareDialog::slotCalendarClicked(const QDate &date)
+void ShareLinkWidget::slotCalendarClicked(const QDate &date)
 {
     setExpireDate(date);
 }
 
-ShareDialog::~ShareDialog()
+ShareLinkWidget::~ShareLinkWidget()
 {
     delete _ui;
 }
 
-void ShareDialog::slotPasswordReturnPressed()
+void ShareLinkWidget::slotPasswordReturnPressed()
 {
     setPassword(_ui->lineEdit_password->text());
     _ui->lineEdit_password->setText(QString());
@@ -215,13 +174,13 @@ void ShareDialog::slotPasswordReturnPressed()
     _ui->lineEdit_password->clearFocus();
 }
 
-void ShareDialog::slotPasswordChanged(const QString& newText)
+void ShareLinkWidget::slotPasswordChanged(const QString& newText)
 {
     // disable the set-password button
     _ui->pushButton_setPassword->setEnabled( newText.length() > 0 );
 }
 
-void ShareDialog::setPassword(const QString &password)
+void ShareLinkWidget::setPassword(const QString &password)
 {
     _pi_link->startAnimation();
     _pi_password->startAnimation();
@@ -237,7 +196,7 @@ void ShareDialog::setPassword(const QString &password)
     }
 }
 
-void ShareDialog::slotPasswordSet()
+void ShareLinkWidget::slotPasswordSet()
 {
     /*
      * When setting/deleting a password from a share the old share is
@@ -249,18 +208,12 @@ void ShareDialog::slotPasswordSet()
     _pi_password->stopAnimation();
 }
 
-void ShareDialog::getShares()
+void ShareLinkWidget::getShares()
 {
     _manager->fetchShares(_sharePath);
-
-    if (QFileInfo(_localPath).isFile()) {
-        ThumbnailJob *job2 = new ThumbnailJob(_sharePath, _account, this);
-        connect(job2, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray)));
-        job2->start();
-    }
 }
 
-void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
+void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
 {
     const QString versionString = _account->serverVersion();
     qDebug() << Q_FUNC_INFO << versionString << "Fetched" << shares.count() << "shares";
@@ -332,25 +285,24 @@ void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
     if( !_share.isNull() ) {
         setShareCheckBoxTitle(true);
     } else {
-        // If there are no shares yet, check the checkbox to create a link automatically.
         // If its clear that resharing is not allowed, display an error
         if( !_resharingAllowed ) {
             displayError(tr("The file can not be shared because it was shared without sharing permission."));
             _ui->checkBox_shareLink->setEnabled(false);
-        } else {
+        } else if (_autoShare) {
             _ui->checkBox_shareLink->setChecked(true);
             slotCheckBoxShareLinkClicked();
         }
     }
 }
 
-void ShareDialog::resizeEvent(QResizeEvent *e)
+void ShareLinkWidget::resizeEvent(QResizeEvent *e)
 {
-    QDialog::resizeEvent(e);
+    QWidget::resizeEvent(e);
     redrawElidedUrl();
 }
 
-void ShareDialog::redrawElidedUrl()
+void ShareLinkWidget::redrawElidedUrl()
 {
     QString u;
 
@@ -366,7 +318,7 @@ void ShareDialog::redrawElidedUrl()
     _ui->_labelShareLink->setText(u);
 }
 
-void ShareDialog::setShareLink( const QString& url )
+void ShareLinkWidget::setShareLink( const QString& url )
 {
     // FIXME: shorten the url for output.
     const QUrl realUrl(url);
@@ -381,7 +333,7 @@ void ShareDialog::setShareLink( const QString& url )
 
 }
 
-void ShareDialog::slotDeleteShareFetched()
+void ShareLinkWidget::slotDeleteShareFetched()
 {
     _share.clear();
     _pi_link->stopAnimation();
@@ -401,7 +353,7 @@ void ShareDialog::slotDeleteShareFetched()
     setShareCheckBoxTitle(false);
 }
 
-void ShareDialog::slotCheckBoxShareLinkClicked()
+void ShareLinkWidget::slotCheckBoxShareLinkClicked()
 {
     qDebug() << Q_FUNC_INFO <<( _ui->checkBox_shareLink->checkState() == Qt::Checked);
     if (_ui->checkBox_shareLink->checkState() == Qt::Checked) {
@@ -443,7 +395,7 @@ void ShareDialog::slotCheckBoxShareLinkClicked()
     }
 }
 
-void ShareDialog::slotCreateShareFetched(const QSharedPointer<LinkShare> share)
+void ShareLinkWidget::slotCreateShareFetched(const QSharedPointer<LinkShare> share)
 {
     _pi_link->stopAnimation();
     _pi_password->stopAnimation();
@@ -452,7 +404,7 @@ void ShareDialog::slotCreateShareFetched(const QSharedPointer<LinkShare> share)
     getShares();
 }
 
-void ShareDialog::slotCreateShareRequiresPassword()
+void ShareLinkWidget::slotCreateShareRequiresPassword()
 {
     // there needs to be a password
     _ui->checkBox_password->setChecked(true);
@@ -467,7 +419,7 @@ void ShareDialog::slotCreateShareRequiresPassword()
     slotCheckBoxPasswordClicked();
 }
 
-void ShareDialog::slotCheckBoxPasswordClicked()
+void ShareLinkWidget::slotCheckBoxPasswordClicked()
 {
     if (_ui->checkBox_password->checkState() == Qt::Checked) {
         _ui->lineEdit_password->show();
@@ -483,7 +435,7 @@ void ShareDialog::slotCheckBoxPasswordClicked()
     }
 }
 
-void ShareDialog::slotCheckBoxExpireClicked()
+void ShareLinkWidget::slotCheckBoxExpireClicked()
 {
     if (_ui->checkBox_expire->checkState() == Qt::Checked)
     {
@@ -504,7 +456,7 @@ void ShareDialog::slotCheckBoxExpireClicked()
 extern void copyToPasteboard(const QString &string);
 #endif
 
-void ShareDialog::slotPushButtonCopyLinkPressed()
+void ShareLinkWidget::slotPushButtonCopyLinkPressed()
 {
 #ifdef Q_OS_MAC
     copyToPasteboard(_shareUrl);
@@ -514,12 +466,12 @@ void ShareDialog::slotPushButtonCopyLinkPressed()
 #endif
 }
 
-void ShareDialog::slotCheckBoxEditingClicked()
+void ShareLinkWidget::slotCheckBoxEditingClicked()
 {
-    ShareDialog::setPublicUpload(_ui->checkBox_editing->checkState() == Qt::Checked);
+    ShareLinkWidget::setPublicUpload(_ui->checkBox_editing->checkState() == Qt::Checked);
 }
 
-void ShareDialog::setPublicUpload(bool publicUpload)
+void ShareLinkWidget::setPublicUpload(bool publicUpload)
 {
     _ui->checkBox_editing->setEnabled(false);
     _pi_editing->startAnimation();
@@ -527,13 +479,13 @@ void ShareDialog::setPublicUpload(bool publicUpload)
     _share->setPublicUpload(publicUpload);
 }
 
-void ShareDialog::slotPublicUploadSet()
+void ShareLinkWidget::slotPublicUploadSet()
 {
     _pi_editing->stopAnimation();
     _ui->checkBox_editing->setEnabled(true);
 }
 
-void ShareDialog::setShareCheckBoxTitle(bool haveShares)
+void ShareLinkWidget::setShareCheckBoxTitle(bool haveShares)
 {
     const QString noSharesTitle(tr("&Share link"));
     const QString haveSharesTitle(tr("&Share link"));
@@ -546,35 +498,23 @@ void ShareDialog::setShareCheckBoxTitle(bool haveShares)
 
 }
 
-void ShareDialog::displayError(int code, const QString &message)
+void ShareLinkWidget::displayError(int code, const QString &message)
 {
     const QString arg = QString("%1, %2").arg(code).arg(message);
     const QString errMsg = tr("OCS API error code: %1").arg(arg);
     displayError(errMsg);
 }
 
-void ShareDialog::displayError(const QString& errMsg)
+void ShareLinkWidget::displayError(const QString& errMsg)
 {
     _ui->errorLabel->setText( errMsg );
     _ui->errorLabel->show();
 }
 
-void ShareDialog::displayError(int code)
+void ShareLinkWidget::displayError(int code)
 {
     const QString errMsg = tr("OCS API error code: %1").arg(code);
     displayError(errMsg);
 }
 
-void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &reply)
-{
-    if (statusCode != 200) {
-        qDebug() << Q_FUNC_INFO << "Status code: " << statusCode;
-        return;
-    }
-
-    QPixmap p;
-    p.loadFromData(reply, "PNG");
-    _ui->label_icon->setPixmap(p);
-}
-
 }
diff --git a/src/gui/sharedialog.h b/src/gui/sharelinkwidget.h
similarity index 82%
copy from src/gui/sharedialog.h
copy to src/gui/sharelinkwidget.h
index 6b0c089..6fb78ff 100644
--- a/src/gui/sharedialog.h
+++ b/src/gui/sharelinkwidget.h
@@ -12,8 +12,8 @@
  * for more details.
  */
 
-#ifndef SHAREDIALOG_H
-#define SHAREDIALOG_H
+#ifndef SHARELINKWIDGET_H
+#define SHARELINKWIDGET_H
 
 #include "accountfwd.h"
 #include "QProgressIndicator.h"
@@ -25,7 +25,7 @@
 namespace OCC {
 
 namespace Ui {
-class ShareDialog;
+class ShareLinkWidget;
 }
 
 class AbstractCredentials;
@@ -39,14 +39,18 @@ class ShareManager;
  * @brief The ShareDialog class
  * @ingroup gui
  */
-class ShareDialog : public QDialog
+class ShareLinkWidget : public QWidget
 {
     Q_OBJECT
 
 public:
-    explicit ShareDialog(AccountPtr account, const QString &sharePath, const QString &localPath,
-                         bool resharingAllowed, QWidget *parent = 0);
-    ~ShareDialog();
+    explicit ShareLinkWidget(AccountPtr account,
+                             const QString &sharePath,
+                             const QString &localPath,
+                             bool resharingAllowed,
+                             bool autoShare = false,
+                             QWidget *parent = 0);
+    ~ShareLinkWidget();
     void getShares();
 
 private slots:
@@ -63,13 +67,11 @@ private slots:
     void slotPasswordReturnPressed();
     void slotPasswordChanged(const QString& newText);
     void slotPushButtonCopyLinkPressed();
-    void slotThumbnailFetched(const int &statusCode, const QByteArray &reply);
     void slotCheckBoxEditingClicked();
     void slotPublicUploadSet();
 
     void displayError(int code, const QString &message);
 
-    void done( int r );
 private:
     void setShareCheckBoxTitle(bool haveShares);
     void displayError(int code);
@@ -79,7 +81,7 @@ private:
     void redrawElidedUrl();
     void setPublicUpload(bool publicUpload);
 
-    Ui::ShareDialog *_ui;
+    Ui::ShareLinkWidget *_ui;
     AccountPtr _account;
     QString _sharePath;
     QString _localPath;
@@ -104,8 +106,9 @@ private:
 
     bool _resharingAllowed;
     bool _isFile;
+    bool _autoShare;
 };
 
 }
 
-#endif // SHAREDIALOG_H
+#endif // SHARELINKWIDGET_H
diff --git a/src/gui/sharedialog.ui b/src/gui/sharelinkwidget.ui
similarity index 71%
copy from src/gui/sharedialog.ui
copy to src/gui/sharelinkwidget.ui
index dab61b8..71aa051 100644
--- a/src/gui/sharedialog.ui
+++ b/src/gui/sharelinkwidget.ui
@@ -1,72 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>OCC::ShareDialog</class>
- <widget class="QDialog" name="OCC::ShareDialog">
+ <class>OCC::ShareLinkWidget</class>
+ <widget class="QWidget" name="OCC::ShareLinkWidget">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>372</width>
-    <height>277</height>
+    <height>212</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Share NewDocument.odt</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_3">
-   <item row="0" column="0" colspan="2">
-    <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="0" rowspan="2">
-      <widget class="QLabel" name="label_icon">
-       <property name="text">
-        <string>TextLabel</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QLabel" name="label_name">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string>share label</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="2" rowspan="2">
-      <widget class="QProgressIndicator" name="pi_share" native="true"/>
-     </item>
-     <item row="1" column="1">
-      <widget class="QLabel" name="label_sharePath">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <weight>50</weight>
-         <bold>false</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string>ownCloud Path:</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="1" column="0">
+   <item row="0" column="0">
     <layout class="QHBoxLayout" name="horizontalLayout_shareLink">
      <property name="topMargin">
       <number>10</number>
@@ -80,7 +28,20 @@
      </item>
     </layout>
    </item>
-   <item row="2" column="0" colspan="2">
+   <item row="3" column="0">
+    <widget class="QLabel" name="errorLabel">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>TextLabel</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" colspan="2">
     <widget class="QWidget" name="widget_shareLink" native="true">
      <layout class="QGridLayout" name="gridLayout_2">
       <property name="leftMargin">
@@ -233,7 +194,7 @@
      </layout>
     </widget>
    </item>
-   <item row="3" column="1">
+   <item row="2" column="1">
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -246,46 +207,12 @@
      </property>
     </spacer>
    </item>
-   <item row="4" column="0">
-    <widget class="QLabel" name="errorLabel">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>TextLabel</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Close</set>
-     </property>
-    </widget>
-   </item>
   </layout>
   <zorder>errorLabel</zorder>
   <zorder>widget_shareLink</zorder>
-  <zorder>buttonBox</zorder>
+  <zorder>verticalSpacer</zorder>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
- <customwidgets>
-  <customwidget>
-   <class>QProgressIndicator</class>
-   <extends>QWidget</extends>
-   <header>QProgressIndicator.h</header>
-   <container>1</container>
-  </customwidget>
- </customwidgets>
  <resources/>
  <connections/>
 </ui>
diff --git a/src/gui/shareusergroupdialog.ui b/src/gui/shareusergroupdialog.ui
deleted file mode 100644
index 99c337d..0000000
--- a/src/gui/shareusergroupdialog.ui
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>OCC::ShareUserGroupDialog</class>
- <widget class="QDialog" name="OCC::ShareUserGroupDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>372</width>
-    <height>505</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Share NewDocument.odt</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout_3">
-   <item row="0" column="0" colspan="2">
-    <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="0" rowspan="2">
-      <widget class="QLabel" name="label_icon">
-       <property name="text">
-        <string>TextLabel</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QLabel" name="label_name">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string>share label</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="2" rowspan="2">
-      <widget class="QProgressIndicator" name="pi_share" native="true"/>
-     </item>
-     <item row="1" column="1">
-      <widget class="QLabel" name="label_sharePath">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <weight>50</weight>
-         <bold>false</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string>ownCloud Path:</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="4" column="0">
-    <widget class="QLabel" name="errorLabel">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text">
-      <string>TextLabel</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Close</set>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0">
-    <layout class="QVBoxLayout" name="sharesLayout">
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Shares</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="1" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLineEdit" name="shareeLineEdit"/>
-     </item>
-     <item>
-      <widget class="QPushButton" name="searchPushButton">
-       <property name="text">
-        <string>Search</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <customwidgets>
-  <customwidget>
-   <class>QProgressIndicator</class>
-   <extends>QWidget</extends>
-   <header>QProgressIndicator.h</header>
-   <container>1</container>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/gui/shareusergroupdialog.cpp b/src/gui/shareusergroupwidget.cpp
similarity index 83%
rename from src/gui/shareusergroupdialog.cpp
rename to src/gui/shareusergroupwidget.cpp
index 0799869..d359fe9 100644
--- a/src/gui/shareusergroupdialog.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -11,9 +11,9 @@
  * for more details.
  */
 
-#include "shareusergroupdialog.h"
-#include "ui_shareusergroupdialog.h"
-#include "ui_sharedialogshare.h"
+#include "shareusergroupwidget.h"
+#include "ui_shareusergroupwidget.h"
+#include "ui_sharewidget.h"
 #include "account.h"
 #include "json.h"
 #include "folderman.h"
@@ -36,9 +36,9 @@
 
 namespace OCC {
 
-ShareUserGroupDialog::ShareUserGroupDialog(AccountPtr account, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) :
-   QDialog(parent),
-    _ui(new Ui::ShareUserGroupDialog),
+ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) :
+   QWidget(parent),
+    _ui(new Ui::ShareUserGroupWidget),
     _account(account),
     _sharePath(sharePath),
     _localPath(localPath),
@@ -64,18 +64,12 @@ ShareUserGroupDialog::ShareUserGroupDialog(AccountPtr account, const QString &sh
     connect(_completer, SIGNAL(activated(QModelIndex)), SLOT(slotCompleterActivated(QModelIndex)));
 }
 
-void ShareUserGroupDialog::done( int r ) {
-    ConfigFile cfg;
-    cfg.saveGeometry(this);
-    QDialog::done(r);
-}
-
-ShareUserGroupDialog::~ShareUserGroupDialog()
+ShareUserGroupWidget::~ShareUserGroupWidget()
 {
     delete _ui;
 }
 
-void ShareUserGroupDialog::on_shareeLineEdit_textChanged(const QString &text)
+void ShareUserGroupWidget::on_shareeLineEdit_textChanged(const QString &text)
 {
     if (text == "") {
         _ui->searchPushButton->setEnabled(false);
@@ -84,7 +78,7 @@ void ShareUserGroupDialog::on_shareeLineEdit_textChanged(const QString &text)
     }
 }
 
-void ShareUserGroupDialog::on_searchPushButton_clicked()
+void ShareUserGroupWidget::on_searchPushButton_clicked()
 {
     _completerModel = new ShareeModel(_account,
                                       _ui->shareeLineEdit->text(),
@@ -94,18 +88,18 @@ void ShareUserGroupDialog::on_searchPushButton_clicked()
     _completerModel->fetch();
 }
 
-void ShareUserGroupDialog::slotUpdateCompletion() {
+void ShareUserGroupWidget::slotUpdateCompletion() {
     _completer->setModel(_completerModel);
     _ui->shareeLineEdit->setCompleter(_completer);
     _completer->complete();
 }
 
-void ShareUserGroupDialog::getShares()
+void ShareUserGroupWidget::getShares()
 {
     _manager->fetchShares(_sharePath);
 }
 
-void ShareUserGroupDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
+void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
 {
     const QString versionString = _account->serverVersion();
     qDebug() << Q_FUNC_INFO << versionString << "Fetched" << shares.count() << "shares";
@@ -121,13 +115,13 @@ void ShareUserGroupDialog::slotSharesFetched(const QList<QSharedPointer<Share>>
             continue;
         }
 
-        ShareDialogShare *s = new ShareDialogShare(share, this);
+        ShareWidget *s = new ShareWidget(share, this);
         _ui->sharesLayout->addWidget(s);
     }
     _ui->sharesLayout->invalidate();
 }
 
-void ShareUserGroupDialog::slotCompleterActivated(const QModelIndex & index) {
+void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex & index) {
     auto sharee = _completerModel->getSharee(index.row());
 
     if (sharee.isNull()) {
@@ -140,10 +134,10 @@ void ShareUserGroupDialog::slotCompleterActivated(const QModelIndex & index) {
                           Share::PermissionRead);
 }
 
-ShareDialogShare::ShareDialogShare(QSharedPointer<Share> share,
+ShareWidget::ShareWidget(QSharedPointer<Share> share,
                                    QWidget *parent) :
   QWidget(parent),
-  _ui(new Ui::ShareDialogShare),
+  _ui(new Ui::ShareWidget),
   _share(share)
 {
     _ui->setupUi(this);
@@ -172,18 +166,18 @@ ShareDialogShare::ShareDialogShare(QSharedPointer<Share> share,
     connect(share.data(), SIGNAL(shareDeleted()), SLOT(slotShareDeleted()));
 }
 
-void ShareDialogShare::on_deleteShareButton_clicked()
+void ShareWidget::on_deleteShareButton_clicked()
 {
     setEnabled(false);
     _share->deleteShare();
 }
 
-ShareDialogShare::~ShareDialogShare()
+ShareWidget::~ShareWidget()
 {
     delete _ui;
 }
 
-void ShareDialogShare::slotPermissionsChanged()
+void ShareWidget::slotPermissionsChanged()
 {
     setEnabled(false);
     
@@ -208,12 +202,12 @@ void ShareDialogShare::slotPermissionsChanged()
     _share->setPermissions(permissions);
 }
 
-void ShareDialogShare::slotShareDeleted()
+void ShareWidget::slotShareDeleted()
 {
     deleteLater();
 }
 
-void ShareDialogShare::slotPermissionsSet()
+void ShareWidget::slotPermissionsSet()
 {
     setEnabled(true);
 }
diff --git a/src/gui/shareusergroupdialog.h b/src/gui/shareusergroupwidget.h
similarity index 78%
rename from src/gui/shareusergroupdialog.h
rename to src/gui/shareusergroupwidget.h
index 9a53432..b14896a 100644
--- a/src/gui/shareusergroupdialog.h
+++ b/src/gui/shareusergroupwidget.h
@@ -11,8 +11,8 @@
  * for more details.
  */
 
-#ifndef SHAREDIALOG_UG_H
-#define SHAREDIALOG_UG_H
+#ifndef SHAREUSERGROUPWIDGET_H
+#define SHAREUSERGROUPWIDGET_H
 
 #include "accountfwd.h"
 #include "QProgressIndicator.h"
@@ -28,8 +28,8 @@ class QCompleter;
 namespace OCC {
 
 namespace Ui {
-class ShareUserGroupDialog;
-class ShareDialogShare;
+class ShareUserGroupWidget;
+class ShareWidget;
 }
 
 class AbstractCredentials;
@@ -39,16 +39,16 @@ class Share;
 class ShareManager;
 class ShareeModel;
 
-class ShareDialogShare : public QWidget
+class ShareWidget : public QWidget
 {
     Q_OBJECT
 
 public:
-    explicit ShareDialogShare(QSharedPointer<Share> Share, QWidget *parent = 0);
-    ~ShareDialogShare();
+    explicit ShareWidget(QSharedPointer<Share> Share, QWidget *parent = 0);
+    ~ShareWidget();
 
 signals:
-    void shareDeleted(ShareDialogShare *share);
+    void shareDeleted(ShareWidget *share);
 
 private slots:
     void on_deleteShareButton_clicked();
@@ -58,7 +58,7 @@ private slots:
     void slotPermissionsSet();
 
 private:
-    Ui::ShareDialogShare *_ui;
+    Ui::ShareWidget *_ui;
     QSharedPointer<Share> _share;
 };
 
@@ -67,25 +67,23 @@ private:
  * @brief The ShareDialog (user/group) class
  * @ingroup gui
  */
-class ShareUserGroupDialog : public QDialog
+class ShareUserGroupWidget : public QWidget
 {
     Q_OBJECT
 
 public:
-    explicit ShareUserGroupDialog(AccountPtr account, 
+    explicit ShareUserGroupWidget(AccountPtr account, 
                                   const QString &sharePath,
                                   const QString &localPath,
                                   bool resharingAllowed,
                                   QWidget *parent = 0);
-    ~ShareUserGroupDialog();
+    ~ShareUserGroupWidget();
 
 public slots:
     void getShares();
 
 private slots:
     void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
-    void done( int r );
-
 
     void on_shareeLineEdit_textChanged(const QString &text);
     void on_searchPushButton_clicked();
@@ -94,7 +92,7 @@ private slots:
     void slotCompleterActivated(const QModelIndex & index);
 
 private:
-    Ui::ShareUserGroupDialog *_ui;
+    Ui::ShareUserGroupWidget *_ui;
     AccountPtr _account;
     QString _sharePath;
     QString _localPath;
@@ -110,4 +108,4 @@ private:
 
 }
 
-#endif // SHAREDIALOG_UG_H
+#endif // SHAREUSERGROUPWIDGET_H
diff --git a/src/gui/shareusergroupwidget.ui b/src/gui/shareusergroupwidget.ui
new file mode 100644
index 0000000..19c2926
--- /dev/null
+++ b/src/gui/shareusergroupwidget.ui
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OCC::ShareUserGroupWidget</class>
+ <widget class="QWidget" name="OCC::ShareUserGroupWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>372</width>
+    <height>271</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Share NewDocument.odt</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="sizeConstraint">
+    <enum>QLayout::SetDefaultConstraint</enum>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLineEdit" name="shareeLineEdit"/>
+     </item>
+     <item>
+      <widget class="QPushButton" name="searchPushButton">
+       <property name="text">
+        <string>Search</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
+     <property name="text">
+      <string>Shares</string>
+     </property>
+    </widget>
+   </item>
+   <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"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/gui/sharedialogshare.ui b/src/gui/sharewidget.ui
similarity index 94%
rename from src/gui/sharedialogshare.ui
rename to src/gui/sharewidget.ui
index 614dc94..0e323cc 100644
--- a/src/gui/sharedialogshare.ui
+++ b/src/gui/sharewidget.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>OCC::ShareDialogShare</class>
- <widget class="QWidget" name="OCC::ShareDialogShare">
+ <class>OCC::ShareWidget</class>
+ <widget class="QWidget" name="OCC::ShareWidget">
   <property name="enabled">
    <bool>true</bool>
   </property>
diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp
index 5b59bb9..a3ffa93 100644
--- a/src/gui/socketapi.cpp
+++ b/src/gui/socketapi.cpp
@@ -404,51 +404,6 @@ void SocketApi::command_SHARE(const QString& localFile, QIODevice* socket)
     }
 }
 
-void SocketApi::command_SHARE_USER_GROUP(const QString& localFile, QIODevice* socket)
-{
-    if (!socket) {
-        qDebug() << Q_FUNC_INFO << "No valid socket object.";
-        return;
-    }
-
-    qDebug() << Q_FUNC_INFO << localFile;
-
-    Folder *shareFolder = FolderMan::instance()->folderForPath(localFile);
-    if (!shareFolder) {
-        const QString message = QLatin1String("SHARE:NOP:")+QDir::toNativeSeparators(localFile);
-        // files that are not within a sync folder are not synced.
-        sendMessage(socket, message);
-    } else if (!shareFolder->accountState()->isConnected()) {
-        const QString message = QLatin1String("SHARE:NOTCONNECTED:")+QDir::toNativeSeparators(localFile);
-        // if the folder isn't connected, don't open the share dialog
-        sendMessage(socket, message);
-    } else {
-        const QString folderForPath = shareFolder->path();
-        const QString remotePath = shareFolder->remotePath() + localFile.right(localFile.count()-folderForPath.count()+1);
-
-        // Can't share root folder
-        if (QDir::cleanPath(remotePath) == "/") {
-           const QString message = QLatin1String("SHARE:CANNOTSHAREROOT:")+QDir::toNativeSeparators(localFile);
-            sendMessage(socket, message);
-            return;
-        }
-
-        SyncJournalFileRecord rec = dbFileRecord_capi(shareFolder, localFile);
-
-        bool allowReshare = true; // lets assume the good
-        if( rec.isValid() ) {
-            // check the permission: Is resharing allowed?
-            if( !rec._remotePerm.contains('R') ) {
-                allowReshare = false;
-            }
-        }
-        const QString message = QLatin1String("SHARE:OK:")+QDir::toNativeSeparators(localFile);
-        sendMessage(socket, message);
-
-        emit shareUserGroupCommandReceived(remotePath, localFile, allowReshare);
-    }
-}
-
 void SocketApi::command_VERSION(const QString&, QIODevice* socket)
 {
     sendMessage(socket, QLatin1String("VERSION:" MIRALL_VERSION_STRING ":" MIRALL_SOCKET_API_VERSION));
diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h
index 482f151..f17660e 100644
--- a/src/gui/socketapi.h
+++ b/src/gui/socketapi.h
@@ -75,7 +75,6 @@ private:
     Q_INVOKABLE void command_RETRIEVE_FOLDER_STATUS(const QString& argument, QIODevice* socket);
     Q_INVOKABLE void command_RETRIEVE_FILE_STATUS(const QString& argument, QIODevice* socket);
     Q_INVOKABLE void command_SHARE(const QString& localFile, QIODevice* socket);
-    Q_INVOKABLE void command_SHARE_USER_GROUP(const QString& localFile, QIODevice* socket);
 
     Q_INVOKABLE void command_VERSION(const QString& argument, QIODevice* socket);
 

-- 
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