Implemented waitForFinished() (fixes #28)
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QEventLoop>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
@@ -73,11 +72,7 @@ void AdvanvedViewDialog::contextMenuBooking(const QPoint &pos)
|
|||||||
dialog.getText()
|
dialog.getText()
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
{
|
{
|
||||||
@@ -123,11 +118,7 @@ void AdvanvedViewDialog::contextMenuBooking(const QPoint &pos)
|
|||||||
dialog.getText()
|
dialog.getText()
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
{
|
{
|
||||||
@@ -150,11 +141,7 @@ void AdvanvedViewDialog::contextMenuBooking(const QPoint &pos)
|
|||||||
{
|
{
|
||||||
auto reply = m_stripsWidget.mainWindow().erfassung().doDeleteBooking(booking.id);
|
auto reply = m_stripsWidget.mainWindow().erfassung().doDeleteBooking(booking.id);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
m_stripsWidget.refreshBookings();
|
m_stripsWidget.refreshBookings();
|
||||||
@@ -193,11 +180,7 @@ void AdvanvedViewDialog::contextMenuTimeAssignment(const QPoint &pos)
|
|||||||
dialog.getText()
|
dialog.getText()
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
{
|
{
|
||||||
@@ -248,11 +231,7 @@ void AdvanvedViewDialog::contextMenuTimeAssignment(const QPoint &pos)
|
|||||||
dialog.getText()
|
dialog.getText()
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
{
|
{
|
||||||
@@ -275,11 +254,7 @@ void AdvanvedViewDialog::contextMenuTimeAssignment(const QPoint &pos)
|
|||||||
{
|
{
|
||||||
auto reply = m_stripsWidget.mainWindow().erfassung().doDeleteTimeAssignment(timeAssignment.id);
|
auto reply = m_stripsWidget.mainWindow().erfassung().doDeleteTimeAssignment(timeAssignment.id);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QEventLoop>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSplashScreen>
|
#include <QSplashScreen>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
@@ -175,11 +174,7 @@ bool loadLoginPage(QSplashScreen &splashScreen, ZeiterfassungSettings &settings,
|
|||||||
again:
|
again:
|
||||||
auto reply = erfassung.doLoginPage();
|
auto reply = erfassung.doLoginPage();
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
QObject::connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
@@ -222,11 +217,7 @@ bool doAuthentication(QSplashScreen &splashScreen, ZeiterfassungSettings &settin
|
|||||||
again:
|
again:
|
||||||
auto reply = erfassung.doLogin(settings.username(), settings.password());
|
auto reply = erfassung.doLogin(settings.username(), settings.password());
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
QObject::connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
@@ -257,11 +248,7 @@ bool loadUserInfo(QSplashScreen &splashScreen, ZeiterfassungApi &erfassung, GetU
|
|||||||
{
|
{
|
||||||
auto reply = erfassung.doUserInfo();
|
auto reply = erfassung.doUserInfo();
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
QObject::connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QEventLoop>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
@@ -247,11 +246,7 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
timeNormalise(ui->timeEditTime->time()), QTime(0, 0),
|
timeNormalise(ui->timeEditTime->time()), QTime(0, 0),
|
||||||
QStringLiteral("K"), QStringLiteral(""));
|
QStringLiteral("K"), QStringLiteral(""));
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
@@ -277,11 +272,7 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
timeAssignment.project, timeAssignment.subproject,
|
timeAssignment.project, timeAssignment.subproject,
|
||||||
timeAssignment.workpackage, timeAssignment.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reply->success())
|
if(reply->success())
|
||||||
timeAssignmentTime = timeAdd(timeAssignmentTime, timespan);
|
timeAssignmentTime = timeAdd(timeAssignmentTime, timespan);
|
||||||
@@ -300,11 +291,7 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
ui->comboBoxProject->currentData().toString(), ui->comboBoxSubproject->currentText(),
|
ui->comboBoxProject->currentData().toString(), ui->comboBoxSubproject->currentText(),
|
||||||
ui->comboBoxWorkpackage->currentText(), ui->comboBoxText->currentText());
|
ui->comboBoxWorkpackage->currentText(), ui->comboBoxText->currentText());
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
@@ -350,11 +337,7 @@ void MainWindow::pushButtonEndPressed()
|
|||||||
timeAssignment.project, timeAssignment.subproject,
|
timeAssignment.project, timeAssignment.subproject,
|
||||||
timeAssignment.workpackage, timeAssignment.text);
|
timeAssignment.workpackage, timeAssignment.text);
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), SIGNAL(finished()), &eventLoop, SLOT(quit()));
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
@@ -369,11 +352,7 @@ void MainWindow::pushButtonEndPressed()
|
|||||||
timeNormalise(ui->timeEditTime->time()), QTime(0, 0),
|
timeNormalise(ui->timeEditTime->time()), QTime(0, 0),
|
||||||
QStringLiteral("G"), QStringLiteral(""));
|
QStringLiteral("G"), QStringLiteral(""));
|
||||||
|
|
||||||
{
|
reply->waitForFinished();
|
||||||
QEventLoop eventLoop;
|
|
||||||
connect(reply.get(), &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
eventLoop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!reply->success())
|
if(!reply->success())
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#include "zeiterfassungreply.h"
|
#include "zeiterfassungreply.h"
|
||||||
|
|
||||||
|
#include <QEventLoop>
|
||||||
|
|
||||||
#include "zeiterfassungapi.h"
|
#include "zeiterfassungapi.h"
|
||||||
|
|
||||||
ZeiterfassungReply::ZeiterfassungReply(ZeiterfassungApi *zeiterfassung) :
|
ZeiterfassungReply::ZeiterfassungReply(ZeiterfassungApi *zeiterfassung) :
|
||||||
@@ -20,6 +22,13 @@ const QString &ZeiterfassungReply::message() const
|
|||||||
return m_message;
|
return m_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZeiterfassungReply::waitForFinished()
|
||||||
|
{
|
||||||
|
QEventLoop eventLoop;
|
||||||
|
connect(this, &ZeiterfassungReply::finished, &eventLoop, &QEventLoop::quit);
|
||||||
|
eventLoop.exec();
|
||||||
|
}
|
||||||
|
|
||||||
ZeiterfassungApi *ZeiterfassungReply::zeiterfassung() const
|
ZeiterfassungApi *ZeiterfassungReply::zeiterfassung() const
|
||||||
{
|
{
|
||||||
return m_zeiterfassung;
|
return m_zeiterfassung;
|
||||||
|
@@ -17,6 +17,8 @@ public:
|
|||||||
bool success() const;
|
bool success() const;
|
||||||
const QString &message() const;
|
const QString &message() const;
|
||||||
|
|
||||||
|
void waitForFinished();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user