Replaced Gotos #85

Closed
qohelet wants to merge 1 commits from master into master

View File

@@ -168,7 +168,11 @@ bool loadLoginPage(QSplashScreen &splashScreen, ZeiterfassungSettings &settings,
{ {
splashScreen.showMessage(QCoreApplication::translate("main", "Loading login page..."), Qt::AlignHCenter | Qt::AlignBottom); splashScreen.showMessage(QCoreApplication::translate("main", "Loading login page..."), Qt::AlignHCenter | Qt::AlignBottom);
again: bool b_do_it_again = false;
do{
b_do_it_again = false;
auto reply = erfassung.doLoginPage(); auto reply = erfassung.doLoginPage();
reply->waitForFinished(); reply->waitForFinished();
@@ -178,7 +182,10 @@ bool loadLoginPage(QSplashScreen &splashScreen, ZeiterfassungSettings &settings,
QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Could not access Zeiterfassung!"), QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Could not access Zeiterfassung!"),
QCoreApplication::translate("main", "Could not access Zeiterfassung!") % "\n\n" % reply->message()); QCoreApplication::translate("main", "Could not access Zeiterfassung!") % "\n\n" % reply->message());
inputAgain: bool b_inputAgain = false;
do{
b_inputAgain = true;
bool ok; bool ok;
auto text = QInputDialog::getText(&splashScreen, QCoreApplication::translate("main", "Base url"), auto text = QInputDialog::getText(&splashScreen, QCoreApplication::translate("main", "Base url"),
QCoreApplication::translate("main", "Please enter the base url to the Zeiterfassung:"), QCoreApplication::translate("main", "Please enter the base url to the Zeiterfassung:"),
@@ -192,14 +199,16 @@ bool loadLoginPage(QSplashScreen &splashScreen, ZeiterfassungSettings &settings,
{ {
QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Invalid url!"), QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Invalid url!"),
QCoreApplication::translate("main", "This url is not valid!")); QCoreApplication::translate("main", "This url is not valid!"));
goto inputAgain; b_inputAgain=true;
} }
}while(b_inputAgain);
settings.setUrl(url); settings.setUrl(url);
erfassung.setUrl(url); erfassung.setUrl(url);
goto again; b_do_it_again = true;
} }
}while (b_do_it_again);
return true; return true;
} }
@@ -375,3 +384,4 @@ int main(int argc, char *argv[])
return app.exec(); return app.exec();
} }