My problem is when I connect one of my login dialog's slots, which is to
be executed when my Conn object has completed it's http request, however
all it does is; making my dialog return Accepted().
I have an object like this:
class Conn
: public QHttp {};
class Conn : public QHttp {};
To copy to clipboard, switch view to plain text mode
and a dialog like this:
class Login
: public QDialog,
private Ui
::login{
Conn conn;
...
private slot:
void HttpDone(bool err);
};
class Login : public QDialog, private Ui::login
{
Conn conn;
...
private slot:
void HttpDone(bool err);
};
To copy to clipboard, switch view to plain text mode
and in the Login's constructor I call this connect:
if(c==0) {
conn = new Conn;
} else {
conn = c;
}
connect(conn,SIGNAL(done(bool)),this,SLOT(HttpDone(bool)));
if(c==0) {
conn = new Conn;
} else {
conn = c;
}
connect(conn,SIGNAL(done(bool)),this,SLOT(HttpDone(bool)));
To copy to clipboard, switch view to plain text mode
Login::HttpDone looks like this:
void
Login::HttpDone(bool err)
{
if(err) { return; }
XmlHnd *hnd = new XmlHnd();
xml.setContentHandler(hnd);
if(conn->Data()->size() < 2)
{
file = conn->Data();
if(xml.parse(XFile))
{
if(hnd->srvErr())
{
mb->exec();
delete hnd;
return;
} else {
conn->setcid(hnd->getValue("cid"));
delete hnd;
accept();
}
}
}
}
void
Login::HttpDone(bool err)
{
if(err) { return; }
QTemporaryFile *file;
XmlHnd *hnd = new XmlHnd();
QXmlSimpleReader xml;
xml.setContentHandler(hnd);
if(conn->Data()->size() < 2)
{
file = conn->Data();
QXmlInputSource XFile(file);
if(xml.parse(XFile))
{
if(hnd->srvErr())
{
QMessageBox *mb = new QMessageBox("Helhed",
hnd->getValue("error"),QMessageBox::Critical,
QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
mb->exec();
delete hnd;
return;
} else {
conn->setcid(hnd->getValue("cid"));
delete hnd;
accept();
}
}
}
}
To copy to clipboard, switch view to plain text mode
To me it seems like the slot is called at the time it is being connected to the
http's done signal. Is this true, if so how can I make it behave different?
Bookmarks