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

View File

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

View File

@ -26,36 +26,6 @@
<string>Opening</string> <string>Opening</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <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"> <item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -83,7 +53,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0" colspan="3"> <item row="5" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>What should QupZilla do with this file?</string> <string>What should QupZilla do with this file?</string>
@ -132,16 +102,6 @@
</layout> </layout>
</widget> </widget>
</item> </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"> <item row="3" column="1" colspan="2">
<widget class="QFrame" name="fromFrame"> <widget class="QFrame" name="fromFrame">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
@ -163,6 +123,68 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="fromServer"> <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"> <property name="text">
<string/> <string/>
</property> </property>
@ -173,15 +195,17 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
</layout>
</widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>SqueezeLabelV2</class> <class>SqueezeLabelV2</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>squeezelabelv2.h</header> <header>squeezelabelv2.h</header>
</customwidget> </customwidget>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickablelabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections>

View File

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