From 9d1dc91e1e2c11ea6df8e163b0e43f1dd43655d5 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 8 Feb 2011 07:55:50 +0000 Subject: Fix 'freeze' (disabled mainwindow after server comm) bug. --- client/mainwindow.cc | 2 +- client/netcom.cc | 8 +++++--- client/netcom.h | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 97c143e..03087ad 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -63,7 +63,7 @@ public: MainWindow::MainWindow(QString cpr, QString templ, QString host, quint16 port, QString user) : QMainWindow(0, Qt::WindowContextHelpButtonHint), - netcom(host, port) + netcom(this, host, port) { isStored = false; diff --git a/client/netcom.cc b/client/netcom.cc index 2798a59..9d9a5bb 100644 --- a/client/netcom.cc +++ b/client/netcom.cc @@ -50,8 +50,10 @@ #endif #endif -NetCom::NetCom(QString host, quint16 port) +NetCom::NetCom(QWidget *wdg, QString host, quint16 port) { + this->wdg = wdg; + // // Setup connection // @@ -86,7 +88,7 @@ QDomDocument NetCom::makeTransfer(QDomDocument &doc, bool lockgui, { DEBUG(netcom, "Making transfer:\n%s", doc.toString().toStdString().c_str()); - if(lockgui && qApp->activeWindow()) qApp->activeWindow()->setEnabled(false); + if(lockgui && wdg) wdg->setEnabled(false); if(lockgui) QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); LOG(netcom, "SESSION ID: %s\n", sessionid.toStdString().c_str()); @@ -137,7 +139,7 @@ QDomDocument NetCom::makeTransfer(QDomDocument &doc, bool lockgui, } if(lockgui) QApplication::restoreOverrideCursor(); - if(lockgui && qApp->activeWindow()) qApp->activeWindow()->setEnabled(true); + if(lockgui && wdg) wdg->setEnabled(true); return res_doc; } diff --git a/client/netcom.h b/client/netcom.h index e6478a5..a8be6f6 100644 --- a/client/netcom.h +++ b/client/netcom.h @@ -34,6 +34,8 @@ #include #include +#include + //#define USE_SSL //#include "widgets/widget.h" @@ -49,7 +51,7 @@ typedef enum { class NetCom : public QObject { Q_OBJECT public: - NetCom(QString host, quint16 port); + NetCom(QWidget *wdg, QString host, quint16 port); ~NetCom(); QDomDocument send(QString templ, QString macro = "", bool lockgui = true); @@ -73,6 +75,7 @@ private: QNetworkRequest request; // QString sessionid; + QWidget *wdg; QMap finished; -- cgit v1.2.3