mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
parent
cb50fae0a7
commit
681243277e
3 changed files with 32 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
|
@ -53,6 +54,10 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
|
||||||
_ui->pushButton_copy->setEnabled(false);
|
_ui->pushButton_copy->setEnabled(false);
|
||||||
connect(_ui->pushButton_copy, SIGNAL(clicked(bool)), SLOT(slotPushButtonCopyLinkPressed()));
|
connect(_ui->pushButton_copy, SIGNAL(clicked(bool)), SLOT(slotPushButtonCopyLinkPressed()));
|
||||||
|
|
||||||
|
_ui->pushButton_mail->setIcon(QIcon::fromTheme("mail-send"));
|
||||||
|
_ui->pushButton_mail->setEnabled(false);
|
||||||
|
connect(_ui->pushButton_mail, SIGNAL(clicked(bool)), SLOT(slotPushButtonMailLinkPressed()));
|
||||||
|
|
||||||
// the following progress indicator widgets are added to layouts which makes them
|
// the following progress indicator widgets are added to layouts which makes them
|
||||||
// automatically deleted once the dialog dies.
|
// automatically deleted once the dialog dies.
|
||||||
_pi_link = new QProgressIndicator();
|
_pi_link = new QProgressIndicator();
|
||||||
|
@ -224,6 +229,7 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
|
||||||
if (share->getShareType() == Share::TypeLink) {
|
if (share->getShareType() == Share::TypeLink) {
|
||||||
_share = qSharedPointerDynamicCast<LinkShare>(share);
|
_share = qSharedPointerDynamicCast<LinkShare>(share);
|
||||||
_ui->pushButton_copy->show();
|
_ui->pushButton_copy->show();
|
||||||
|
_ui->pushButton_mail->show();
|
||||||
|
|
||||||
_ui->widget_shareLink->show();
|
_ui->widget_shareLink->show();
|
||||||
_ui->checkBox_shareLink->setChecked(true);
|
_ui->checkBox_shareLink->setChecked(true);
|
||||||
|
@ -268,6 +274,7 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
|
||||||
}
|
}
|
||||||
|
|
||||||
setShareLink(_share->getLink().toString());
|
setShareLink(_share->getLink().toString());
|
||||||
|
_ui->pushButton_mail->setEnabled(true);
|
||||||
_ui->pushButton_copy->setEnabled(true);
|
_ui->pushButton_copy->setEnabled(true);
|
||||||
|
|
||||||
// Connect all shares signals to gui slots
|
// Connect all shares signals to gui slots
|
||||||
|
@ -324,6 +331,7 @@ void ShareLinkWidget::setShareLink( const QString& url )
|
||||||
if( realUrl.isValid() ) {
|
if( realUrl.isValid() ) {
|
||||||
_shareUrl = url;
|
_shareUrl = url;
|
||||||
_ui->pushButton_copy->setEnabled(true);
|
_ui->pushButton_copy->setEnabled(true);
|
||||||
|
_ui->pushButton_mail->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
_shareUrl.clear();
|
_shareUrl.clear();
|
||||||
_ui->_labelShareLink->setText(QString::null);
|
_ui->_labelShareLink->setText(QString::null);
|
||||||
|
@ -339,6 +347,7 @@ void ShareLinkWidget::slotDeleteShareFetched()
|
||||||
_ui->lineEdit_password->clear();
|
_ui->lineEdit_password->clear();
|
||||||
_ui->_labelShareLink->clear();
|
_ui->_labelShareLink->clear();
|
||||||
_ui->pushButton_copy->setEnabled(false);
|
_ui->pushButton_copy->setEnabled(false);
|
||||||
|
_ui->pushButton_mail->setEnabled(false);
|
||||||
_ui->widget_shareLink->hide();
|
_ui->widget_shareLink->hide();
|
||||||
_ui->lineEdit_password->hide();
|
_ui->lineEdit_password->hide();
|
||||||
_ui->pushButton_setPassword->setEnabled(false);
|
_ui->pushButton_setPassword->setEnabled(false);
|
||||||
|
@ -368,6 +377,7 @@ void ShareLinkWidget::slotCheckBoxShareLinkClicked()
|
||||||
_ui->checkBox_editing->setEnabled(false);
|
_ui->checkBox_editing->setEnabled(false);
|
||||||
_ui->lineEdit_password->setFocus();
|
_ui->lineEdit_password->setFocus();
|
||||||
_ui->pushButton_copy->hide();
|
_ui->pushButton_copy->hide();
|
||||||
|
_ui->pushButton_mail->hide();
|
||||||
_ui->widget_shareLink->show();
|
_ui->widget_shareLink->show();
|
||||||
|
|
||||||
slotCheckBoxPasswordClicked();
|
slotCheckBoxPasswordClicked();
|
||||||
|
@ -413,6 +423,7 @@ void ShareLinkWidget::slotCreateShareRequiresPassword(const QString& message)
|
||||||
_ui->lineEdit_password->setEnabled(true);
|
_ui->lineEdit_password->setEnabled(true);
|
||||||
_ui->lineEdit_password->setFocus();
|
_ui->lineEdit_password->setFocus();
|
||||||
_ui->pushButton_copy->hide();
|
_ui->pushButton_copy->hide();
|
||||||
|
_ui->pushButton_mail->hide();
|
||||||
_ui->widget_shareLink->show();
|
_ui->widget_shareLink->show();
|
||||||
_ui->checkBox_expire->setEnabled(false);
|
_ui->checkBox_expire->setEnabled(false);
|
||||||
_ui->checkBox_editing->setEnabled(false);
|
_ui->checkBox_editing->setEnabled(false);
|
||||||
|
@ -473,6 +484,19 @@ void ShareLinkWidget::slotPushButtonCopyLinkPressed()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShareLinkWidget::slotPushButtonMailLinkPressed()
|
||||||
|
{
|
||||||
|
QString fileName = _sharePath.mid(_sharePath.lastIndexOf('/') + 1);
|
||||||
|
|
||||||
|
QDesktopServices::openUrl(QUrl(QString(
|
||||||
|
"mailto: "
|
||||||
|
"?subject=I shared %1 with you"
|
||||||
|
"&body=%2").arg(
|
||||||
|
fileName,
|
||||||
|
_shareUrl),
|
||||||
|
QUrl::TolerantMode));
|
||||||
|
}
|
||||||
|
|
||||||
void ShareLinkWidget::slotCheckBoxEditingClicked()
|
void ShareLinkWidget::slotCheckBoxEditingClicked()
|
||||||
{
|
{
|
||||||
ShareLinkWidget::setPublicUpload(_ui->checkBox_editing->checkState() == Qt::Checked);
|
ShareLinkWidget::setPublicUpload(_ui->checkBox_editing->checkState() == Qt::Checked);
|
||||||
|
|
|
@ -68,6 +68,7 @@ private slots:
|
||||||
void slotPasswordReturnPressed();
|
void slotPasswordReturnPressed();
|
||||||
void slotPasswordChanged(const QString& newText);
|
void slotPasswordChanged(const QString& newText);
|
||||||
void slotPushButtonCopyLinkPressed();
|
void slotPushButtonCopyLinkPressed();
|
||||||
|
void slotPushButtonMailLinkPressed();
|
||||||
void slotCheckBoxEditingClicked();
|
void slotCheckBoxEditingClicked();
|
||||||
void slotPublicUploadSet();
|
void slotPublicUploadSet();
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_mail">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Mail link</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_copy">
|
<widget class="QPushButton" name="pushButton_copy">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
Loading…
Reference in a new issue