diff --git a/resources/text/UPDATES b/resources/text/UPDATES
index db17ca746..a98c95133 100644
--- a/resources/text/UPDATES
+++ b/resources/text/UPDATES
@@ -1,6 +1,6 @@
- https://bitbucket.org/skunkos/rssguard/downloads/rssguard-3.2.4-win32.exe
+ https://bitbucket.org/skunkos/rssguard/downloads/rssguard-3.2.4-win32.zip
diff --git a/src/gui/dialogs/formupdate.cpp b/src/gui/dialogs/formupdate.cpp
index 98ae0db89..5ab514e83 100755
--- a/src/gui/dialogs/formupdate.cpp
+++ b/src/gui/dialogs/formupdate.cpp
@@ -30,15 +30,11 @@
#include
#include
-#if defined(Q_OS_WIN)
-#include
-#endif
-
FormUpdate::FormUpdate(QWidget *parent)
: QDialog(parent), m_downloader(NULL), m_readyToInstall(false), m_ui(new Ui::FormUpdate) {
m_ui->setupUi(this);
- m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
+ m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Download update"), QDialogButtonBox::ActionRole);
m_btnUpdate->setToolTip(tr("Download new installation files."));
m_ui->m_lblCurrentRelease->setText(STRFY(APP_VERSION));
@@ -89,7 +85,7 @@ void FormUpdate::checkForUpdates() {
if (SystemFactory::isVersionNewer(update.first.m_availableVersion, STRFY(APP_VERSION))) {
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok,
tr("New release available."),
- tr("This is new version which can be\ndownloaded and installed."));
+ tr("This is new version which can be\ndownloaded."));
m_btnUpdate->setEnabled(true);
m_btnUpdate->setToolTip(is_self_update_for_this_system ?
tr("Download installation file for your OS.") :
@@ -157,8 +153,8 @@ void FormUpdate::updateCompleted(QNetworkReply::NetworkError status, QByteArray
switch (status) {
case QNetworkReply::NoError:
saveUpdateFile(contents);
- m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok, tr("Downloaded successfully"), tr("Package was downloaded successfully."));
- m_btnUpdate->setText(tr("Install update"));
+ m_ui->m_lblStatus->setStatus(WidgetWithStatus::Ok, tr("Downloaded successfully"), tr("Package was downloaded successfully.\nYou must install it manually."));
+ m_btnUpdate->setText(tr("Go to update file"));
m_btnUpdate->setEnabled(true);
break;
@@ -180,32 +176,15 @@ void FormUpdate::startUpdate() {
url_file = STRFY(APP_URL);
}
- if (m_readyToInstall) {
- // Some package is downloaded and it can be installed
- // via self-update feature.
- close();
-
- qDebug("Preparing to launch external installer '%s'.", qPrintable(QDir::toNativeSeparators(m_updateFilePath)));
-
-#if defined(Q_OS_WIN)
- HINSTANCE exec_result = ShellExecute(NULL,
- NULL,
- reinterpret_cast(QDir::toNativeSeparators(m_updateFilePath).utf16()),
- NULL,
- NULL,
- SW_NORMAL);
-
- if (((int)exec_result) <= 32) {
- qDebug("External updater was not launched due to error.");
-
- qApp->showGuiMessage(tr("Cannot update application"),
- tr("Cannot launch external updater. Update application manually."),
- QSystemTrayIcon::Warning, this);
+ if (m_readyToInstall) {
+ if (!SystemFactory::openFolderFile(m_updateFilePath)) {
+ MessageBox::show(this,
+ QMessageBox::Warning,
+ tr("Cannot open directory"),
+ tr("Cannot open output directory. Open it manually."),
+ QString(),
+ m_updateFilePath);
}
- else {
- qApp->quit();
- }
-#endif
}
else if (update_for_this_system) {
// Nothing is downloaded yet, but update for this system
diff --git a/src/miscellaneous/systemfactory.cpp b/src/miscellaneous/systemfactory.cpp
index e70a7cd76..129a32a59 100755
--- a/src/miscellaneous/systemfactory.cpp
+++ b/src/miscellaneous/systemfactory.cpp
@@ -27,6 +27,7 @@
#endif
#include
+#include
#include
#include
#include
@@ -240,6 +241,15 @@ bool SystemFactory::isVersionEqualOrNewer(const QString &new_version, const QStr
return new_version == base_version || isVersionNewer(new_version, base_version);
}
+bool SystemFactory::openFolderFile(const QString &file_path) {
+#if defined(Q_OS_WIN32)
+ return QProcess::startDetached(QString("explorer.exe /select, \"") + QDir::toNativeSeparators(file_path) + "\"");
+#else
+ const QString folder = QDir::toNativeSeparators(QFileInfo(file_path).absoluteDir().absolutePath());
+ return QDesktopServices::openUrl(QUrl::fromLocalFile(folder));
+#endif
+}
+
UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const QByteArray &changelog) const {
UpdateInfo update;
QDomDocument document; document.setContent(updates_file, false);
diff --git a/src/miscellaneous/systemfactory.h b/src/miscellaneous/systemfactory.h
index e5a127fb1..3a74424fb 100755
--- a/src/miscellaneous/systemfactory.h
+++ b/src/miscellaneous/systemfactory.h
@@ -90,6 +90,8 @@ class SystemFactory : public QObject {
static bool isVersionNewer(const QString &new_version, const QString &base_version);
static bool isVersionEqualOrNewer(const QString &new_version, const QString &base_version);
+ static bool openFolderFile(const QString &file_path);
+
public slots:
void checkForUpdatesOnStartup();
diff --git a/src/network-web/downloadmanager.cpp b/src/network-web/downloadmanager.cpp
index 253a8fbae..56a89bcc0 100755
--- a/src/network-web/downloadmanager.cpp
+++ b/src/network-web/downloadmanager.cpp
@@ -213,19 +213,14 @@ void DownloadItem::openFile() {
void DownloadItem::openFolder() {
if (m_output.exists()) {
- const QString folder = QDir::toNativeSeparators(QFileInfo(m_output.fileName()).absoluteDir().absolutePath());
-
-#if defined(Q_OS_WIN32)
- const QString file = QDir::toNativeSeparators(m_output.fileName());
-
- if (!QProcess::startDetached(QString("explorer.exe /select, \"") + file + "\"")) {
- MessageBox::show(this, QMessageBox::Warning, tr("Cannot open directory"), tr("Cannot open output directory. Open it manually."), QString(), folder);
+ if (!SystemFactory::openFolderFile(m_output.fileName())) {
+ MessageBox::show(this,
+ QMessageBox::Warning,
+ tr("Cannot open directory"),
+ tr("Cannot open output directory. Open it manually."),
+ QString(),
+ m_output.fileName());
}
-#else
- if (!QDesktopServices::openUrl(QUrl::fromLocalFile(folder))) {
- MessageBox::show(this, QMessageBox::Warning, tr("Cannot open directory"), tr("Cannot open output directory. Open it manually."), QString(), folder);
- }
-#endif
}
}