mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge pull request #2723 from rullzer/filebrowser_integration
Sharedialog: link sharing from desktop
This commit is contained in:
commit
bd80c034ba
@ -147,8 +147,8 @@ Application::Application(int &argc, char **argv) :
|
||||
slotAccountStateAdded(ai);
|
||||
}
|
||||
|
||||
connect(FolderMan::instance()->socketApi(), SIGNAL(shareCommandReceived(QString)),
|
||||
_gui, SLOT(slotShowShareDialog(QString)));
|
||||
connect(FolderMan::instance()->socketApi(), SIGNAL(shareCommandReceived(QString, QString)),
|
||||
_gui, SLOT(slotShowShareDialog(QString, QString)));
|
||||
|
||||
// startup procedure.
|
||||
connect(&_checkConnectionTimer, SIGNAL(timeout()), this, SLOT(slotCheckConnection()));
|
||||
|
||||
@ -642,12 +642,12 @@ void ownCloudGui::raiseDialog( QWidget *raiseWidget )
|
||||
}
|
||||
|
||||
|
||||
void ownCloudGui::slotShowShareDialog(const QString &path)
|
||||
void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &localPath)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Opening share dialog";
|
||||
ShareDialog *w = new ShareDialog;
|
||||
ShareDialog *w = new ShareDialog(sharePath, localPath);
|
||||
w->getShares();
|
||||
w->setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
w->setPath(path);
|
||||
w->show();
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ public slots:
|
||||
void slotHelp();
|
||||
void slotOpenPath(const QString& path);
|
||||
void slotAccountStateChanged();
|
||||
void slotShowShareDialog(const QString &path);
|
||||
void slotShowShareDialog(const QString &sharePath, const QString &localPath);
|
||||
|
||||
private slots:
|
||||
void slotDisplayIdle();
|
||||
|
||||
@ -4,8 +4,11 @@
|
||||
#include "account.h"
|
||||
#include "json.h"
|
||||
#include "folderman.h"
|
||||
#include "QProgressIndicator.h"
|
||||
#include <QBuffer>
|
||||
#include <QMovie>
|
||||
#include <QMessageBox>
|
||||
#include <QFileIconProvider>
|
||||
|
||||
namespace {
|
||||
int SHARETYPE_PUBLIC = 3;
|
||||
@ -13,51 +16,64 @@ namespace {
|
||||
|
||||
namespace OCC {
|
||||
|
||||
ShareDialog::ShareDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
_ui(new Ui::ShareDialog)
|
||||
ShareDialog::ShareDialog(const QString &sharePath, const QString &localPath, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
_ui(new Ui::ShareDialog),
|
||||
_sharePath(sharePath),
|
||||
_localPath(localPath)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
_ui->setupUi(this);
|
||||
_ui->pushButton_copy->setIcon(QIcon::fromTheme("edit-copy"));
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
QMovie *movie = new QMovie("/home/azelphur/ownCloud-share-tools/loading-icon.gif");
|
||||
movie->start();
|
||||
_ui->labelShareSpinner->setMovie(movie);
|
||||
_ui->labelShareSpinner->hide();
|
||||
|
||||
_ui->labelPasswordSpinner->setMovie(movie);
|
||||
_ui->labelPasswordSpinner->hide();
|
||||
_pi_link = new QProgressIndicator();
|
||||
_pi_password = new QProgressIndicator();
|
||||
_pi_date = new QProgressIndicator();
|
||||
_ui->horizontalLayout_shareLink->addWidget(_pi_link);
|
||||
_ui->horizontalLayout_password->addWidget(_pi_password);
|
||||
_ui->horizontalLayout_expire->addWidget(_pi_date);
|
||||
|
||||
_ui->labelCalendarSpinner->setMovie(movie);
|
||||
_ui->labelCalendarSpinner->hide();
|
||||
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->checkBox_expire, SIGNAL(clicked()), this, SLOT(slotCheckBoxExpireClicked()));
|
||||
connect(_ui->calendar, SIGNAL(clicked(QDate)), SLOT(slotCalendarClicked(QDate)));
|
||||
|
||||
_ui->labelShareSpinner->hide();
|
||||
_ui->lineEdit_shareLink->hide();
|
||||
_ui->pushButton_copy->hide();
|
||||
_ui->widget_shareLink->hide();
|
||||
_ui->lineEdit_password->hide();
|
||||
_ui->checkBox_password->hide();
|
||||
_ui->checkBox_expire->hide();
|
||||
_ui->calendar->hide();
|
||||
_ui->lineEdit_shareGroup->setPlaceholderText(tr("Share with group..."));
|
||||
_ui->lineEdit_shareUser->setPlaceholderText(tr("Share with user..."));
|
||||
_ui->lineEdit_password->setPlaceholderText(tr("Choose a password for the public link"));
|
||||
|
||||
QFileInfo f_info(_localPath);
|
||||
QFileIconProvider icon_provider;
|
||||
QIcon icon = icon_provider.icon(f_info);
|
||||
_ui->label_icon->setPixmap(icon.pixmap(40,40));
|
||||
if (f_info.isDir()) {
|
||||
_ui->lineEdit_name->setText(f_info.dir().dirName());
|
||||
_ui->lineEdit_type->setText("Directory");
|
||||
} else {
|
||||
_ui->lineEdit_name->setText(f_info.fileName());
|
||||
_ui->lineEdit_type->setText("File");
|
||||
}
|
||||
_ui->lineEdit_localPath->setText(_localPath);
|
||||
_ui->lineEdit_sharePath->setText(_sharePath);
|
||||
}
|
||||
|
||||
void ShareDialog::setExpireDate(const QString &date)
|
||||
void ShareDialog::setExpireDate(const QDate &date)
|
||||
{
|
||||
_ui->labelCalendarSpinner->show();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/").append(QString::number(_public_share_id)));
|
||||
_pi_date->startAnimation();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/%1").arg(_public_share_id));
|
||||
QUrl postData;
|
||||
QList<QPair<QString, QString> > getParams;
|
||||
QList<QPair<QString, QString> > postParams;
|
||||
getParams.append(qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json")));
|
||||
postParams.append(qMakePair(QString::fromLatin1("expireDate"), date));
|
||||
|
||||
if (date.isValid()) {
|
||||
postParams.append(qMakePair(QString::fromLatin1("expireDate"), date.toString("yyyy-MM-dd")));
|
||||
} else {
|
||||
postParams.append(qMakePair(QString::fromLatin1("expireDate"), QString()));
|
||||
}
|
||||
|
||||
url.setQueryItems(getParams);
|
||||
postData.setQueryItems(postParams);
|
||||
OcsShareJob *job = new OcsShareJob("PUT", url, postData, AccountManager::instance()->account(), this);
|
||||
@ -65,25 +81,25 @@ void ShareDialog::setExpireDate(const QString &date)
|
||||
job->start();
|
||||
}
|
||||
|
||||
void ShareDialog::slotExpireSet(const QString & /* reply */)
|
||||
void ShareDialog::slotExpireSet(const QString &reply)
|
||||
{
|
||||
_ui->labelCalendarSpinner->hide();
|
||||
QString message;
|
||||
int code = checkJsonReturnCode(reply, message);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Status code: " << code;
|
||||
if (code != 100) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message);
|
||||
msgBox.setWindowTitle(QString("Server replied with code %1").arg(code));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
_pi_date->stopAnimation();
|
||||
}
|
||||
|
||||
void ShareDialog::slotCalendarClicked(const QDate &date)
|
||||
{
|
||||
ShareDialog::setExpireDate(date.toString("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
QString ShareDialog::getPath()
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
void ShareDialog::setPath(const QString &path)
|
||||
{
|
||||
_path = path;
|
||||
ShareDialog::getShares();
|
||||
ShareDialog::setExpireDate(date);
|
||||
}
|
||||
|
||||
ShareDialog::~ShareDialog()
|
||||
@ -94,14 +110,15 @@ ShareDialog::~ShareDialog()
|
||||
void ShareDialog::slotPasswordReturnPressed()
|
||||
{
|
||||
ShareDialog::setPassword(_ui->lineEdit_password->text());
|
||||
_ui->lineEdit_password->setPlaceholderText(tr("Password Protected"));
|
||||
_ui->lineEdit_password->setText(QString());
|
||||
_ui->lineEdit_password->setPlaceholderText(tr("Password Protected"));
|
||||
_ui->lineEdit_password->clearFocus();
|
||||
}
|
||||
|
||||
void ShareDialog::setPassword(QString password)
|
||||
void ShareDialog::setPassword(const QString &password)
|
||||
{
|
||||
_ui->labelPasswordSpinner->show();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/").append(QString::number(_public_share_id)));
|
||||
_pi_password->startAnimation();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/%1").arg(_public_share_id));
|
||||
QUrl postData;
|
||||
QList<QPair<QString, QString> > getParams;
|
||||
QList<QPair<QString, QString> > postParams;
|
||||
@ -114,18 +131,37 @@ void ShareDialog::setPassword(QString password)
|
||||
job->start();
|
||||
}
|
||||
|
||||
void ShareDialog::slotPasswordSet(const QString & /* reply */)
|
||||
void ShareDialog::slotPasswordSet(const QString &reply)
|
||||
{
|
||||
_ui->labelPasswordSpinner->hide();
|
||||
QString message;
|
||||
int code = checkJsonReturnCode(reply, message);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Status code: " << code;
|
||||
|
||||
if (code != 100) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message);
|
||||
msgBox.setWindowTitle(QString("Server replied with code %1").arg(code));
|
||||
msgBox.exec();
|
||||
} else {
|
||||
/*
|
||||
* 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::getShares()
|
||||
{
|
||||
this->setWindowTitle(tr("Sharing %1").arg(_path));
|
||||
this->setWindowTitle(tr("Sharing %1").arg(_sharePath));
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QLatin1String("ocs/v1.php/apps/files_sharing/api/v1/shares"));
|
||||
QList<QPair<QString, QString> > params;
|
||||
params.append(qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json")));
|
||||
params.append(qMakePair(QString::fromLatin1("path"), _path));
|
||||
params.append(qMakePair(QString::fromLatin1("path"), _sharePath));
|
||||
url.setQueryItems(params);
|
||||
OcsShareJob *job = new OcsShareJob("GET", url, QUrl(), AccountManager::instance()->account(), this);
|
||||
connect(job, SIGNAL(jobFinished(QString)), this, SLOT(slotSharesFetched(QString)));
|
||||
@ -134,34 +170,42 @@ void ShareDialog::getShares()
|
||||
|
||||
void ShareDialog::slotSharesFetched(const QString &reply)
|
||||
{
|
||||
QString message;
|
||||
int code = checkJsonReturnCode(reply, message);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Status code: " << code;
|
||||
if (code != 100) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message);
|
||||
msgBox.setWindowTitle(QString("Server replied with code %1").arg(code));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
QVariantMap json = QtJson::parse(reply, success).toMap();
|
||||
ShareDialog::_shares = json.value("ocs").toMap().values("data")[0].toList();
|
||||
for(int i = 0; i < ShareDialog::_shares.count(); i++)
|
||||
Q_FOREACH(auto share, ShareDialog::_shares)
|
||||
{
|
||||
QVariantMap data = ShareDialog::_shares[i].toMap();
|
||||
QVariantMap data = share.toMap();
|
||||
|
||||
if (data.value("share_type").toInt() == SHARETYPE_PUBLIC)
|
||||
{
|
||||
_public_share_id = data.value("id").toULongLong();
|
||||
|
||||
_ui->lineEdit_shareLink->show();
|
||||
_ui->pushButton_copy->show();
|
||||
_ui->checkBox_password->show();
|
||||
_ui->checkBox_expire->show();
|
||||
_ui->pushButton_copy->show();
|
||||
_ui->widget_shareLink->show();
|
||||
_ui->checkBox_shareLink->setChecked(true);
|
||||
|
||||
if (data.value("share_with").isValid())
|
||||
{
|
||||
_ui->checkBox_password->setChecked(true);
|
||||
_ui->lineEdit_password->setText("********");
|
||||
_ui->lineEdit_password->setPlaceholderText("********");
|
||||
_ui->lineEdit_password->show();
|
||||
}
|
||||
|
||||
if (data.value("expiration").isValid())
|
||||
{
|
||||
_ui->calendar->setSelectedDate(QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00"));
|
||||
_ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
|
||||
_ui->calendar->show();
|
||||
_ui->checkBox_expire->setChecked(true);
|
||||
}
|
||||
@ -172,14 +216,22 @@ void ShareDialog::slotSharesFetched(const QString &reply)
|
||||
}
|
||||
}
|
||||
|
||||
void ShareDialog::slotDeleteShareFetched(const QString & /* reply */)
|
||||
void ShareDialog::slotDeleteShareFetched(const QString &reply)
|
||||
{
|
||||
_ui->labelShareSpinner->hide();
|
||||
_ui->lineEdit_shareLink->hide();
|
||||
_ui->pushButton_copy->hide();
|
||||
QString message;
|
||||
int code = checkJsonReturnCode(reply, message);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "Status code: " << code;
|
||||
if (code != 100) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message);
|
||||
msgBox.setWindowTitle(QString("Server replied with code %1").arg(code));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
_pi_link->stopAnimation();
|
||||
_ui->widget_shareLink->hide();
|
||||
_ui->lineEdit_password->hide();
|
||||
_ui->checkBox_password->hide();
|
||||
_ui->checkBox_expire->hide();
|
||||
_ui->calendar->hide();
|
||||
}
|
||||
|
||||
@ -187,13 +239,13 @@ void ShareDialog::slotCheckBoxShareLinkClicked()
|
||||
{
|
||||
if (_ui->checkBox_shareLink->checkState() == Qt::Checked)
|
||||
{
|
||||
_ui->labelShareSpinner->show();
|
||||
_pi_link->startAnimation();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QLatin1String("ocs/v1.php/apps/files_sharing/api/v1/shares"));
|
||||
QUrl postData;
|
||||
QList<QPair<QString, QString> > getParams;
|
||||
QList<QPair<QString, QString> > postParams;
|
||||
getParams.append(qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json")));
|
||||
postParams.append(qMakePair(QString::fromLatin1("path"), _path));
|
||||
postParams.append(qMakePair(QString::fromLatin1("path"), _sharePath));
|
||||
postParams.append(qMakePair(QString::fromLatin1("shareType"), QString::number(SHARETYPE_PUBLIC)));
|
||||
url.setQueryItems(getParams);
|
||||
postData.setQueryItems(postParams);
|
||||
@ -203,8 +255,8 @@ void ShareDialog::slotCheckBoxShareLinkClicked()
|
||||
}
|
||||
else
|
||||
{
|
||||
_ui->labelShareSpinner->show();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/").append(QString::number(_public_share_id)));
|
||||
_pi_link->startAnimation();
|
||||
QUrl url = Account::concatUrlPath(AccountManager::instance()->account()->url(), QString("ocs/v1.php/apps/files_sharing/api/v1/shares/%1").arg(_public_share_id));
|
||||
QList<QPair<QString, QString> > getParams;
|
||||
getParams.append(qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json")));
|
||||
url.setQueryItems(getParams);
|
||||
@ -216,18 +268,25 @@ void ShareDialog::slotCheckBoxShareLinkClicked()
|
||||
|
||||
void ShareDialog::slotCreateShareFetched(const QString &reply)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << reply;
|
||||
_ui->labelShareSpinner->hide();
|
||||
QString message;
|
||||
int code = checkJsonReturnCode(reply, message);
|
||||
|
||||
if (code != 100) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message);
|
||||
msgBox.setWindowTitle(QString("Server replied with code %1").arg(code));
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
_pi_link->stopAnimation();
|
||||
bool success;
|
||||
QVariantMap json = QtJson::parse(reply, success).toMap();
|
||||
_public_share_id = json.value("ocs").toMap().values("data")[0].toMap().value("id").toULongLong();
|
||||
QString url = json.value("ocs").toMap().values("data")[0].toMap().value("url").toString();
|
||||
_ui->lineEdit_shareLink->setText(url);
|
||||
_ui->lineEdit_shareLink->show();
|
||||
_ui->pushButton_copy->show();
|
||||
_ui->checkBox_password->show();
|
||||
_ui->checkBox_expire->show();
|
||||
_ui->pushButton_copy->show();
|
||||
|
||||
_ui->widget_shareLink->show();
|
||||
}
|
||||
|
||||
void ShareDialog::slotCheckBoxPasswordClicked()
|
||||
@ -235,11 +294,13 @@ void ShareDialog::slotCheckBoxPasswordClicked()
|
||||
if (_ui->checkBox_password->checkState() == Qt::Checked)
|
||||
{
|
||||
_ui->lineEdit_password->show();
|
||||
_ui->lineEdit_password->setPlaceholderText(tr("Choose a password for the public link"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShareDialog::setPassword(QString());
|
||||
_ui->labelPasswordSpinner->show();
|
||||
_ui->lineEdit_password->setPlaceholderText(QString());
|
||||
_pi_password->startAnimation();
|
||||
_ui->lineEdit_password->hide();
|
||||
}
|
||||
}
|
||||
@ -248,18 +309,36 @@ void ShareDialog::slotCheckBoxExpireClicked()
|
||||
{
|
||||
if (_ui->checkBox_expire->checkState() == Qt::Checked)
|
||||
{
|
||||
QDate date = QDate::currentDate().addDays(1);
|
||||
ShareDialog::setExpireDate(date.toString("dd-MM-yyyy"));
|
||||
const QDate date = QDate::currentDate().addDays(1);
|
||||
ShareDialog::setExpireDate(date);
|
||||
_ui->calendar->setSelectedDate(date);
|
||||
_ui->calendar->setMinimumDate(date);
|
||||
_ui->calendar->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShareDialog::setExpireDate(QString());
|
||||
ShareDialog::setExpireDate(QDate());
|
||||
_ui->calendar->hide();
|
||||
}
|
||||
}
|
||||
|
||||
int ShareDialog::checkJsonReturnCode(const QString &reply, QString &message)
|
||||
{
|
||||
bool success;
|
||||
QVariantMap json = QtJson::parse(reply, success).toMap();
|
||||
|
||||
if (!success) {
|
||||
qDebug() << Q_FUNC_INFO << "Failed to parse reply";
|
||||
}
|
||||
|
||||
//TODO proper checking
|
||||
int code = json.value("ocs").toMap().value("meta").toMap().value("statuscode").toInt();
|
||||
message = json.value("ocs").toMap().value("meta").toMap().value("message").toString();
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
OcsShareJob::OcsShareJob(const QByteArray &verb, const QUrl &url, const QUrl &postData, AccountPtr account, QObject* parent)
|
||||
: AbstractNetworkJob(account, "", parent),
|
||||
_verb(verb),
|
||||
|
||||
@ -15,7 +15,9 @@
|
||||
#define SHAREDIALOG_H
|
||||
|
||||
#include "networkjobs.h"
|
||||
#include "QProgressIndicator.h"
|
||||
#include <QDialog>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@ -49,11 +51,9 @@ class ShareDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ShareDialog(QWidget *parent = 0);
|
||||
explicit ShareDialog(const QString &sharePath, const QString &localPath, QWidget *parent = 0);
|
||||
~ShareDialog();
|
||||
void getShares();
|
||||
void setPath(const QString &path);
|
||||
QString getPath();
|
||||
private slots:
|
||||
void slotSharesFetched(const QString &reply);
|
||||
void slotCreateShareFetched(const QString &reply);
|
||||
@ -67,11 +67,17 @@ private slots:
|
||||
void slotPasswordReturnPressed();
|
||||
private:
|
||||
Ui::ShareDialog *_ui;
|
||||
QString _path;
|
||||
QString _sharePath;
|
||||
QString _localPath;
|
||||
QList<QVariant> _shares;
|
||||
qulonglong _public_share_id;
|
||||
void setPassword(QString password);
|
||||
void setExpireDate(const QString &date);
|
||||
void setPassword(const QString &password);
|
||||
void setExpireDate(const QDate &date);
|
||||
int checkJsonReturnCode(const QString &reply, QString &message);
|
||||
|
||||
QProgressIndicator *_pi_link;
|
||||
QProgressIndicator *_pi_password;
|
||||
QProgressIndicator *_pi_date;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>535</height>
|
||||
<width>454</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -20,72 +20,120 @@
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gridGroupBox">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Share with</string>
|
||||
<string>Share Info</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_shareUser"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="userLabel">
|
||||
<property name="text">
|
||||
<string>User:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_shareGroup"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="groupLabel">
|
||||
<property name="text">
|
||||
<string>Group</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_icon">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_name">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_type">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_type">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_localPath">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_localPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_sharePath">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OwnCloud Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_sharePath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_shareLink">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_shareLink">
|
||||
<property name="text">
|
||||
@ -93,85 +141,73 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelShareSpinner">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_shareLink">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_copy">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_password">
|
||||
<property name="text">
|
||||
<string>Set password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelPasswordSpinner">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_expire">
|
||||
<property name="text">
|
||||
<string>Set expiry date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCalendarSpinner">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCalendarWidget" name="calendar"/>
|
||||
<widget class="QWidget" name="widget_shareLink" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_shareLink">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_copy">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_password">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_password">
|
||||
<property name="text">
|
||||
<string>Set password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_expire">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_expire">
|
||||
<property name="text">
|
||||
<string>Set expiry date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCalendarWidget" name="calendar"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
@ -414,9 +414,10 @@ void SocketApi::command_SHARE(const QString& argument, SocketType* socket)
|
||||
} else {
|
||||
const QString message = QLatin1String("SHARE:OK:")+QDir::toNativeSeparators(argument);
|
||||
sendMessage(socket, message);
|
||||
|
||||
const QString folderForPath = shareFolder->path();
|
||||
const QString path = shareFolder->remotePath() + argument.right(argument.count()-folderForPath.count()+1);
|
||||
emit shareCommandReceived(path);
|
||||
emit shareCommandReceived(path, argument);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ public slots:
|
||||
void slotClearExcludesList();
|
||||
|
||||
signals:
|
||||
void shareCommandReceived(const QString &path);
|
||||
void shareCommandReceived(const QString &sharePath, const QString &localPath);
|
||||
|
||||
private slots:
|
||||
void slotNewConnection();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user