1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge branch 'master' of git://github.com/alexandre596/qupzilla

Conflicts:
	translations/pt_BR.ts
This commit is contained in:
nowrep 2012-08-14 11:52:06 +02:00
commit d4a884440c
7 changed files with 60 additions and 22 deletions

View File

@ -93,8 +93,10 @@ void DownloadFileHelper::handleUnsupportedContent(QNetworkReply* reply, bool ask
if (askWhatToDo) {
DownloadOptionsDialog* dialog = new DownloadOptionsDialog(m_h_fileName, m_fileIcon, mimeType, reply->url(), mApp->activeWindow());
dialog->showExternalManagerOption(m_manager->useExternalManager());
dialog->setLastDownloadOption(m_lastDownloadOption);
dialog->show();
connect(dialog, SIGNAL(dialogFinished(int)), this, SLOT(optionsDialogAccepted(int)));
}
else {
@ -106,7 +108,7 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
{
m_openFileChoosed = false;
switch (finish) {
case 0: //Cancelled
case 0: // Cancelled
if (m_timer) {
delete m_timer;
}
@ -115,15 +117,22 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
m_reply->deleteLater();
return;
break;
case 1: //Open
case 1: // Open
m_openFileChoosed = true;
m_lastDownloadOption = DownloadManager::OpenFile;
break;
case 2: //Save
case 2: // Save
m_lastDownloadOption = DownloadManager::SaveFile;
break;
case 3: // External manager
m_manager->startExternalManager(m_reply->url());
m_reply->abort();
m_reply->deleteLater();
return;
default:
qWarning() << "DownloadFileHelper::optionsDialogAccepted invalid return value!";
if (m_timer) {
@ -133,8 +142,6 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
m_reply->abort();
m_reply->deleteLater();
return;
break;
}
m_manager->setLastDownloadOption(m_lastDownloadOption);

View File

@ -111,6 +111,8 @@ void DownloadManager::startExternalManager(const QUrl &url)
QString info = "<ul><li><b>" + tr("Executable: ") + "</b>" + m_externalExecutable + "</li><li><b>" + tr("Arguments: ") + "</b>" + arguments.join(" ") + "</li></ul>";
QMessageBox::critical(this, tr("Cannot start external download manager"), tr("Cannot start external download manager! %1").arg(info));
}
m_lastDownloadOption = ExternalManager;
}
#ifdef W7TASKBAR
@ -212,12 +214,12 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, WebPage* pa
return;
}
if (fromPageDownload && m_useExternalManager) {
startExternalManager(reply->url());
reply->abort();
reply->deleteLater();
return;
}
// if (fromPageDownload && m_useExternalManager) {
// startExternalManager(reply->url());
// reply->abort();
// reply->deleteLater();
// return;
// }
reply->setProperty("downReply", QVariant(true));
@ -305,6 +307,11 @@ bool DownloadManager::canClose()
return !isDownloading;
}
bool DownloadManager::useExternalManager() const
{
return m_useExternalManager;
}
void DownloadManager::closeEvent(QCloseEvent* e)
{
if (mApp->windowCount() == 0) { // No main windows -> we are going to quit

View File

@ -42,7 +42,7 @@ class QT_QUPZILLA_EXPORT DownloadManager : public QWidget
{
Q_OBJECT
public:
enum DownloadOption { OpenFile, SaveFile };
enum DownloadOption { OpenFile, SaveFile, ExternalManager };
explicit DownloadManager(QWidget* parent = 0);
~DownloadManager();
@ -53,6 +53,10 @@ public:
void handleUnsupportedContent(QNetworkReply* reply, WebPage* page, bool fromPageDownload = true, const QString &suggestedFileName = QString());
bool canClose();
bool useExternalManager() const;
void startExternalManager(const QUrl &url);
void setLastDownloadPath(const QString &lastPath) { m_lastDownloadPath = lastPath; }
void setLastDownloadOption(const DownloadOption &option) { m_lastDownloadOption = option; }
@ -83,8 +87,6 @@ private:
void resizeEvent(QResizeEvent* e);
void keyPressEvent(QKeyEvent* e);
void startExternalManager(const QUrl &url);
Ui::DownloadManager* ui;
NetworkManager* m_networkManager;
QBasicTimer m_timer;

View File

@ -40,9 +40,20 @@ DownloadOptionsDialog::DownloadOptionsDialog(const QString &fileName, const QPix
connect(this, SIGNAL(finished(int)), this, SLOT(emitDialogFinished(int)));
}
void DownloadOptionsDialog::showExternalManagerOption(bool show)
{
ui->radioExternal->setVisible(show);
}
void DownloadOptionsDialog::setLastDownloadOption(const DownloadManager::DownloadOption &option)
{
switch (option) {
case DownloadManager::ExternalManager:
if (!ui->radioExternal->isHidden()) {
ui->radioExternal->setChecked(true);
break;
}
case DownloadManager::OpenFile:
ui->radioOpen->setChecked(true);
break;
@ -65,6 +76,9 @@ void DownloadOptionsDialog::emitDialogFinished(int status)
else if (ui->radioSave->isChecked()) {
status = 2;
}
else if (ui->radioExternal->isChecked()) {
status = 3;
}
}
m_signalEmited = true;

View File

@ -36,6 +36,7 @@ public:
explicit DownloadOptionsDialog(const QString &fileName, const QPixmap &fileIcon, const QString &mimeType, const QUrl &url, QWidget* parent = 0);
~DownloadOptionsDialog();
void showExternalManagerOption(bool show);
void setLastDownloadOption(const DownloadManager::DownloadOption &option);
private slots:

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>410</width>
<height>226</height>
<height>251</height>
</rect>
</property>
<property name="minimumSize">
@ -149,6 +149,13 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="radioExternal">
<property name="text">
<string>Download with External Manager</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -2146,27 +2146,27 @@ não foi encontrado!</translation>
<message>
<location filename="../src/lib/preferences/preferences.ui" line="784"/>
<source>Suggest when typing into address bar:</source>
<translation type="unfinished"></translation>
<translation>Sugerir enquanto estiver digitando na barra de endereço:</translation>
</message>
<message>
<location filename="../src/lib/preferences/preferences.ui" line="798"/>
<source>History and Bookmarks</source>
<translation type="unfinished"></translation>
<translation>Histórico e Favoritos</translation>
</message>
<message>
<location filename="../src/lib/preferences/preferences.ui" line="803"/>
<source>History</source>
<translation type="unfinished">Histórico</translation>
<translation>Histórico</translation>
</message>
<message>
<location filename="../src/lib/preferences/preferences.ui" line="808"/>
<source>Bookmarks</source>
<translation type="unfinished">Favoritos</translation>
<translation>Favoritos</translation>
</message>
<message>
<location filename="../src/lib/preferences/preferences.ui" line="813"/>
<source>Nothing</source>
<translation type="unfinished"></translation>
<translation>Nada</translation>
</message>
<message>
<location filename="../src/lib/preferences/preferences.ui" line="921"/>
@ -5068,7 +5068,7 @@ Após adicionar ou remover os caminhos dos certificados, você terá que reinici
<message>
<location filename="../src/lib/navigation/websearchbar.cpp" line="294"/>
<source>Show suggestions</source>
<translation type="unfinished"></translation>
<translation>Exibir Sugestões</translation>
</message>
<message>
<location filename="../src/lib/navigation/websearchbar.cpp" line="242"/>