Sharedialog: add copy button text and actually connect the button

This commit is contained in:
Roeland Jago Douma 2015-02-03 13:02:52 +01:00
parent 9d93642102
commit 48254579a2
2 changed files with 10 additions and 0 deletions

View file

@ -11,6 +11,7 @@
#include "QProgressIndicator.h" #include "QProgressIndicator.h"
#include <QBuffer> #include <QBuffer>
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QClipboard>
namespace { namespace {
int SHARETYPE_PUBLIC = 3; int SHARETYPE_PUBLIC = 3;
@ -28,6 +29,8 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
_ui->setupUi(this); _ui->setupUi(this);
_ui->pushButton_copy->setIcon(QIcon::fromTheme("edit-copy")); _ui->pushButton_copy->setIcon(QIcon::fromTheme("edit-copy"));
_ui->pushButton_copy->setText("Copy URL");
connect(_ui->pushButton_copy, SIGNAL(clicked(bool)), SLOT(slotPushButtonCopyLinkPressed()));
// 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.
@ -321,6 +324,12 @@ void ShareDialog::slotCheckBoxExpireClicked()
} }
} }
void ShareDialog::slotPushButtonCopyLinkPressed()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(_ui->lineEdit_shareLink->text());
}
int ShareDialog::checkJsonReturnCode(const QString &reply, QString &message) int ShareDialog::checkJsonReturnCode(const QString &reply, QString &message)
{ {
bool success; bool success;

View file

@ -70,6 +70,7 @@ private slots:
void slotCheckBoxPasswordClicked(); void slotCheckBoxPasswordClicked();
void slotCheckBoxExpireClicked(); void slotCheckBoxExpireClicked();
void slotPasswordReturnPressed(); void slotPasswordReturnPressed();
void slotPushButtonCopyLinkPressed();
private: private:
void displayError(int code); void displayError(int code);
void displayInfo( const QString& msg ); void displayInfo( const QString& msg );