1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Added option to copy download link in download options dialog.

Closes #1056
This commit is contained in:
nowrep 2013-10-17 17:20:01 +02:00
parent ee24e7a25b
commit ea7720e64b
4 changed files with 96 additions and 50 deletions

View File

@ -18,11 +18,12 @@
#include "downloadoptionsdialog.h"
#include "ui_downloadoptionsdialog.h"
#include <QUrl>
#include <QClipboard>
DownloadOptionsDialog::DownloadOptionsDialog(const QString &fileName, const QPixmap &fileIcon, const QString &mimeType, const QUrl &url, QWidget* parent)
: QDialog(parent)
, ui(new Ui::DownloadOptionsDialog)
, m_url(url)
, m_signalEmited(false)
{
ui->setupUi(this);
@ -37,6 +38,7 @@ DownloadOptionsDialog::DownloadOptionsDialog(const QString &fileName, const QPix
ui->buttonBox->setFocus();
connect(ui->copyDownloadLink, SIGNAL(clicked(QPoint)), this, SLOT(copyDownloadLink()));
connect(this, SIGNAL(finished(int)), this, SLOT(emitDialogFinished(int)));
}
@ -91,6 +93,12 @@ int DownloadOptionsDialog::exec()
return status;
}
void DownloadOptionsDialog::copyDownloadLink()
{
QApplication::clipboard()->setText(m_url.toString());
ui->copyDownloadLink->setText(tr("Download link copied."));
}
void DownloadOptionsDialog::emitDialogFinished(int status)
{
if (status != 0) {

View File

@ -19,6 +19,7 @@
#define DOWNLOADOPTIONSDIALOG_H
#include <QDialog>
#include <QUrl>
#include "qz_namespace.h"
#include "downloadmanager.h"
@ -44,6 +45,7 @@ public:
int exec();
private slots:
void copyDownloadLink();
void emitDialogFinished(int status);
signals:
@ -51,6 +53,8 @@ signals:
private:
Ui::DownloadOptionsDialog* ui;
QUrl m_url;
bool m_signalEmited;
};

View File

@ -26,36 +26,6 @@
<string>Opening</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>You have chosen to open</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3">
<widget class="QLabel" name="fileIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="SqueezeLabelV2" name="fileName">
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -83,7 +53,7 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="3">
<item row="5" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>What should QupZilla do with this file?</string>
@ -132,16 +102,6 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QFrame" name="fromFrame">
<layout class="QHBoxLayout" name="horizontalLayout_2">
@ -163,6 +123,68 @@
</item>
<item>
<widget class="QLabel" name="fromServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="ClickableLabel" name="copyDownloadLink">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Copy download link</string>
</property>
<property name="html-link-look" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label">
<property name="text">
<string>You have chosen to open</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3">
<widget class="QLabel" name="fileIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="SqueezeLabelV2" name="fileName">
<property name="text">
<string/>
</property>
@ -173,15 +195,17 @@
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>SqueezeLabelV2</class>
<extends>QLabel</extends>
<header>squeezelabelv2.h</header>
</customwidget>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickablelabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>

View File

@ -1756,45 +1756,55 @@ Please install latest version of QupZilla.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="32"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="146"/>
<source>Copy download link</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="169"/>
<source>You have chosen to open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="70"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="40"/>
<source>which is a:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="89"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="59"/>
<source>What should QupZilla do with this file?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="111"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="81"/>
<source>Open...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="118"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="88"/>
<source>Save File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="128"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="98"/>
<source>Download with External Manager</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="160"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.ui" line="120"/>
<source>from:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.cpp" line="34"/>
<location filename="../src/lib/downloads/downloadoptionsdialog.cpp" line="35"/>
<source>Opening %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lib/downloads/downloadoptionsdialog.cpp" line="99"/>
<source>Download link copied.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSearchEngine</name>