summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorme_laptop <me_laptop@fb96df88-216d-11de-830c-f3023f12d8ac>2012-07-26 10:54:30 +0000
committerme_laptop <me_laptop@fb96df88-216d-11de-830c-f3023f12d8ac>2012-07-26 10:54:30 +0000
commit97193b2a96803e2106d00450bd27c85e508253e5 (patch)
treeaa6b3f496a53eb1aa81fc908404e37a3150f9cb4
parent9d70c13411d4544f346dd3462c0f94a7a7ff3450 (diff)
downloadpica-pica-97193b2a96803e2106d00450bd27c85e508253e5.tar.gz
pica-pica-97193b2a96803e2106d00450bd27c85e508253e5.zip
handling connection errors in RegisterAccountDialog
git-svn-id: svn://localhost/project_picapica/trunk@152 fb96df88-216d-11de-830c-f3023f12d8ac
-rw-r--r--pica-client/dialogs/registeraccountdialog.cpp14
-rw-r--r--pica-client/dialogs/registeraccountdialog.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/pica-client/dialogs/registeraccountdialog.cpp b/pica-client/dialogs/registeraccountdialog.cpp
index 1ce1cdb..bc723f7 100644
--- a/pica-client/dialogs/registeraccountdialog.cpp
+++ b/pica-client/dialogs/registeraccountdialog.cpp
@@ -96,9 +96,10 @@ void RegisterAccountDialog::stageConnect(int retval,QProcess::ExitStatus)
lbStatus->setText(tr("3) Connecting to server..."));
- sock.connectToHost(registrar_hosts[(registrar_index++)%(sizeof(registrar_hosts)/sizeof(char*))], 2299);
-
connect(&sock, SIGNAL(connected()), this, SLOT(stageGetCert()));
+ connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(showError()));
+
+ sock.connectToHost(registrar_hosts[(registrar_index++)%(sizeof(registrar_hosts)/sizeof(char*))], 2299);
}
void RegisterAccountDialog::stageGetCert()
@@ -124,6 +125,8 @@ void RegisterAccountDialog::stageReadCert()
if (cert_buf.contains("-----END CERTIFICATE-----") || cert_buf.contains("-----END X509 CERTIFICATE-----"))
{
+ disconnect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), 0, 0);
+
QFile cert(config_dir + QDir::separator() + "cert.pem");
cert.open(QIODevice::WriteOnly | QIODevice::Truncate);
cert.write(cert_buf.data(),cert_buf.size());
@@ -147,3 +150,10 @@ QString RegisterAccountDialog::GetPkeyFilename()
{
return PkeyFilename_;
}
+
+void RegisterAccountDialog::showError()
+{
+ QMessageBox mbx;
+ mbx.setText(sock.errorString());
+ mbx.exec();
+}
diff --git a/pica-client/dialogs/registeraccountdialog.h b/pica-client/dialogs/registeraccountdialog.h
index 696f1ee..38f23c9 100644
--- a/pica-client/dialogs/registeraccountdialog.h
+++ b/pica-client/dialogs/registeraccountdialog.h
@@ -41,6 +41,7 @@ public slots:
void stageConnect(int,QProcess::ExitStatus);
void stageGetCert();
void stageReadCert();
+ void showError();
};
#endif // REGISTERACCOUNTDIALOG_H