Replaced Gotos #85
@@ -168,38 +168,47 @@ 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;
|
||||||
auto reply = erfassung.doLoginPage();
|
|
||||||
|
|
||||||
reply->waitForFinished();
|
do{
|
||||||
|
b_do_it_again = false;
|
||||||
|
|
||||||
if(!reply->success())
|
auto reply = erfassung.doLoginPage();
|
||||||
{
|
|
||||||
QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Could not access Zeiterfassung!"),
|
|
||||||
QCoreApplication::translate("main", "Could not access Zeiterfassung!") % "\n\n" % reply->message());
|
|
||||||
|
|
||||||
inputAgain:
|
reply->waitForFinished();
|
||||||
bool ok;
|
|
||||||
auto text = QInputDialog::getText(&splashScreen, QCoreApplication::translate("main", "Base url"),
|
|
||||||
QCoreApplication::translate("main", "Please enter the base url to the Zeiterfassung:"),
|
|
||||||
QLineEdit::Normal, settings.url().toString(), &ok);
|
|
||||||
|
|
||||||
if(!ok)
|
if(!reply->success())
|
||||||
return false;
|
|
||||||
|
|
||||||
auto url = QUrl::fromUserInput(text);
|
|
||||||
if(!url.isValid())
|
|
||||||
{
|
{
|
||||||
QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Invalid url!"),
|
QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Could not access Zeiterfassung!"),
|
||||||
QCoreApplication::translate("main", "This url is not valid!"));
|
QCoreApplication::translate("main", "Could not access Zeiterfassung!") % "\n\n" % reply->message());
|
||||||
goto inputAgain;
|
|
||||||
|
bool b_inputAgain = false;
|
||||||
|
|
||||||
|
do{
|
||||||
|
b_inputAgain = true;
|
||||||
|
bool ok;
|
||||||
|
auto text = QInputDialog::getText(&splashScreen, QCoreApplication::translate("main", "Base url"),
|
||||||
|
QCoreApplication::translate("main", "Please enter the base url to the Zeiterfassung:"),
|
||||||
|
QLineEdit::Normal, settings.url().toString(), &ok);
|
||||||
|
|
||||||
|
if(!ok)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
auto url = QUrl::fromUserInput(text);
|
||||||
|
if(!url.isValid())
|
||||||
|
{
|
||||||
|
QMessageBox::warning(&splashScreen, QCoreApplication::translate("main", "Invalid url!"),
|
||||||
|
QCoreApplication::translate("main", "This url is not valid!"));
|
||||||
|
b_inputAgain=true;
|
||||||
|
}
|
||||||
|
}while(b_inputAgain);
|
||||||
|
|
||||||
|
settings.setUrl(url);
|
||||||
|
erfassung.setUrl(url);
|
||||||
|
|
||||||
|
b_do_it_again = true;
|
||||||
}
|
}
|
||||||
|
}while (b_do_it_again);
|
||||||
settings.setUrl(url);
|
|
||||||
erfassung.setUrl(url);
|
|
||||||
|
|
||||||
goto again;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -375,3 +384,4 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user