From 03ac351f38316d8f923f3797aa7dd0deade7ed5d Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Sun, 24 Apr 2011 21:36:26 +0200 Subject: url status handling, 5sec delay before closing gui when exiting with failure (not actually returning 1 atm), lots of formatting... --- src/javascriptinterface.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/javascriptinterface.cpp') diff --git a/src/javascriptinterface.cpp b/src/javascriptinterface.cpp index 18949ae..b480635 100644 --- a/src/javascriptinterface.cpp +++ b/src/javascriptinterface.cpp @@ -178,10 +178,8 @@ void JavascriptInterface::reboot() { * * @todo add some more informations */ -void JavascriptInterface::downloadInfo(const QString& filename, - const double& filesize) { - QString code = QString("downloadInfo('\%1', \%2)").arg(filename).arg( - filesize); +void JavascriptInterface::downloadInfo(const QString& filename, const double& filesize) { + QString code = QString("downloadInfo('\%1', \%2)").arg(filename).arg(filesize); _parent->evaluateJavaScript(code); } //------------------------------------------------------------------------------------------------------- @@ -193,12 +191,11 @@ void JavascriptInterface::downloadInfo(const QString& filename, * * @todo add some more informations */ -void JavascriptInterface::updateProgressBar(const int& percent, - const double& speed, const QString& unit) { +void JavascriptInterface::updateProgressBar(const int& percent, const double& speed, + const QString& unit) { if (percent == 0) return; - QString code = QString("updateProgress(\%1, \%2, '\%3')").arg(percent).arg( - speed).arg(unit); + QString code = QString("updateProgress(\%1, \%2, '\%3')").arg(percent).arg(speed).arg(unit); _parent->evaluateJavaScript(code); } //------------------------------------------------------------------------------------------------------- @@ -223,7 +220,7 @@ void JavascriptInterface::callbackOnFinished() { //------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------- /** - * This method triggers the arriving of the IP address + * This method triggers the arriving of the IP address *FOR TESTING PURPOSES* * * Used for testing. This method triggers the arriving of the IP address. * Not needed in the final version since the here simulated event will be @@ -244,3 +241,8 @@ void JavascriptInterface::trigger() { } file.close(); } +//------------------------------------------------------------------------------------------------------- +void JavascriptInterface::alert(const QString& message) { + // expects a formatted message. + _parent->evaluateJavaScript(QString("alert(").append(message)); +} -- cgit v1.2.3-55-g7522