]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/mainwindow.cpp
Add ProxyType setting in preparation of SOCKS5 proxy support.
[toast/confclerk.git] / src / gui / mainwindow.cpp
index 9f04963af909687cbc048465ba95a989bc20c58d..dbbcb2f275dffa6ddb96301c0468c8530022b8fb 100644 (file)
@@ -82,7 +82,7 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
         AppSettings::setDirectConnection(true);
 
     QNetworkProxy proxy(
-            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
+            AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : (QNetworkProxy::ProxyType)AppSettings::proxyType(),
             AppSettings::proxyAddress(),
             AppSettings::proxyPort(),
             PROXY_USERNAME,
@@ -271,7 +271,7 @@ void MainWindow::onAlarmTimerTimeout() {
     // show message
     systemTrayIcon->show();
     // The next two lines are to prevent a very strange position of the message box the first time at X11/aweseome (not Win32/XP)
-    systemTrayIcon->showMessage("ConfClerk", "Your upcoming events", QSystemTrayIcon::Information);
+    systemTrayIcon->showMessage("ConfClerk", tr("Your upcoming events"), QSystemTrayIcon::Information);
     qApp->processEvents();
     systemTrayIcon->showMessage(title, message, QSystemTrayIcon::Information, 60*60*24*1000);
     QApplication::alert(this);
@@ -310,7 +310,8 @@ void MainWindow::useConference(int conferenceId)
 
         // end of optimization
         // initTabs();
-    } catch (OrmException& e) {
+    } catch (const OrmException& e) {
+        qDebug() << "OrmException:" << e.text();
         // cannon set an active conference
         unsetConference();   // TODO: as no active conference is now correctly managed this should be handled as a fatal error
         return;
@@ -362,7 +363,7 @@ void MainWindow::on_settingsAction_triggered()
     if (dialog.exec() == QDialog::Accepted) {
         dialog.saveDialogData();
         QNetworkProxy proxy(
-                AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
+                AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : (QNetworkProxy::ProxyType)AppSettings::proxyType(),
                 AppSettings::proxyAddress(),
                 AppSettings::proxyPort(),
                 PROXY_USERNAME,
@@ -405,7 +406,8 @@ void MainWindow::on_conferencesAction_triggered()
     // optimization, see useConference() code
     try {
         initTabs();
-    } catch (OrmException) {
+    } catch (const OrmException& e) {
+        qDebug() << "OrmException:" << e.text();
         clearTabs();
     }
 }
@@ -421,8 +423,8 @@ void MainWindow::sslErrors(QNetworkReply *aReply, const QList<QSslError> &errors
 
     if (QMessageBox::warning(
                 this,
-                QString("SSL errors"),
-                QString("One or more SSL errors have occurred: ") + errorString,
+                tr("SSL errors"),
+                tr("One or more SSL errors have occurred: %1", 0, errors.size()).arg(errorString),
                 QMessageBox::Ignore | QMessageBox::Cancel) == QMessageBox::Ignore) {
         aReply->ignoreSslErrors();
     } else {
@@ -432,7 +434,7 @@ void MainWindow::sslErrors(QNetworkReply *aReply, const QList<QSslError> &errors
 
 void MainWindow::networkQueryFinished(QNetworkReply *aReply) {
     if (aReply->error() != QNetworkReply::NoError) {
-        error_message(QString("Error occurred during download: ") + aReply->errorString());
+        error_message(tr("Error occurred during download: %1").arg(aReply->errorString()));
     } else {
         QUrl redirectUrl = aReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
         if (!redirectUrl.isEmpty()) {
@@ -440,7 +442,7 @@ void MainWindow::networkQueryFinished(QNetworkReply *aReply) {
                 importFromNetwork(redirectUrl.toString(), aReply->request().attribute(QNetworkRequest::User).toInt());
                 return; // don't enable controls
             } else {
-                error_message(QString("Error: Cyclic redirection from %1 to itself.").arg(redirectUrl.toString()));
+                error_message(tr("Error: Cyclic redirection from %1 to itself.").arg(redirectUrl.toString()));
             }
         } else {
             importData(aReply->readAll(), aReply->url().toEncoded(), aReply->request().attribute(QNetworkRequest::User).toInt());