|
|
@ -514,20 +514,16 @@ void UBApplicationController::checkUpdate() |
|
|
|
|
|
|
|
|
|
|
|
void UBApplicationController::ftpCommandFinished(int id, bool error) |
|
|
|
void UBApplicationController::ftpCommandFinished(int id, bool error) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
qDebug() << id; |
|
|
|
if (error){ |
|
|
|
if (error){ |
|
|
|
qWarning() << "ftp command id" << id << "return the error: " << mFtp->errorString(); |
|
|
|
qWarning() << "ftp command id" << id << "return the error: " << mFtp->errorString(); |
|
|
|
mFtp->close(); |
|
|
|
mFtp->close(); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
// 3 stand for the third command we have sent
|
|
|
|
QString responseString = QString(mFtp->readAll()); |
|
|
|
// in our case
|
|
|
|
if (!responseString.isEmpty() && responseString.contains("version:") && responseString.contains("url:")){ |
|
|
|
// 1->connect
|
|
|
|
|
|
|
|
// 2->login
|
|
|
|
|
|
|
|
// 3->get
|
|
|
|
|
|
|
|
if (id == 3){ |
|
|
|
|
|
|
|
QString updateString = QString(mFtp->readAll()); |
|
|
|
|
|
|
|
mFtp->close(); |
|
|
|
mFtp->close(); |
|
|
|
downloadJsonFinished(updateString); |
|
|
|
downloadJsonFinished(responseString); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|