mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Show message if the updater times out
This commit is contained in:
parent
58fd57fdcd
commit
a22884d164
2 changed files with 15 additions and 1 deletions
|
@ -39,6 +39,7 @@ OCUpdater::OCUpdater(const QUrl &url, QObject *parent) :
|
|||
, _updateUrl(url)
|
||||
, _state(Unknown)
|
||||
, _accessManager(new MirallAccessManager(this))
|
||||
, _timer(new QTimer(this))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -73,6 +74,8 @@ QString OCUpdater::statusString() const
|
|||
return tr("Version %1 available. Restart application to start the update.").arg(updateVersion);
|
||||
case DownloadFailed:
|
||||
return tr("Could not download update. Please click <a href='%1'>here</a> %2 to download the update manually.").arg(_updateInfo.web(), updateVersion);
|
||||
case DownloadTimedOut:
|
||||
return tr("Could not check for new updates.");
|
||||
case UpdateOnlyAvailableThroughSystem:
|
||||
return tr("New version %1 available. Please use the systems update tool to install it.").arg(updateVersion);
|
||||
case Unknown:
|
||||
|
@ -129,6 +132,8 @@ void OCUpdater::checkForUpdate()
|
|||
url.addQueryItem( QLatin1String("oem"), theme->appName() );
|
||||
|
||||
QNetworkReply *reply = _accessManager->get( QNetworkRequest(url) );
|
||||
connect(_timer, SIGNAL(timeout()), this, slot(slotTimedOut()));
|
||||
_timer->start(30*1000);
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(slotVersionInfoArrived()));
|
||||
}
|
||||
|
||||
|
@ -201,6 +206,11 @@ void OCUpdater::slotVersionInfoArrived()
|
|||
}
|
||||
}
|
||||
|
||||
void OCUpdater::slotTimedOut()
|
||||
{
|
||||
setDownloadState(DownloadTimedOut);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NSISUpdater::NSISUpdater(const QUrl &url, QObject *parent)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QTimer;
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
|
@ -33,7 +34,8 @@ class OCUpdater : public QObject, public Updater
|
|||
Q_OBJECT
|
||||
public:
|
||||
enum DownloadState { Unknown = 0, UpToDate, Downloading, DownloadComplete,
|
||||
DownloadFailed, UpdateOnlyAvailableThroughSystem };
|
||||
DownloadFailed, DownloadTimedOut,
|
||||
UpdateOnlyAvailableThroughSystem };
|
||||
explicit OCUpdater(const QUrl &url, QObject *parent = 0);
|
||||
|
||||
void performUpdate();
|
||||
|
@ -55,6 +57,7 @@ private slots:
|
|||
void slotOpenUpdateUrl();
|
||||
void slotSetVersionSeen();
|
||||
void slotVersionInfoArrived();
|
||||
void slotTimedOut();
|
||||
|
||||
protected:
|
||||
virtual void versionInfoArrived(const UpdateInfo &info) = 0;
|
||||
|
@ -67,6 +70,7 @@ private:
|
|||
QUrl _updateUrl;
|
||||
int _state;
|
||||
QNetworkAccessManager *_accessManager;
|
||||
QTimer *_timer;
|
||||
UpdateInfo _updateInfo;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue