]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/mainwindow.cpp
Used tr() for some more GUI strings (there are plenty more that should be treated...
[toast/confclerk.git] / src / gui / mainwindow.cpp
index a2e28d12ff2b059830f329b723b4eb8852215d1b..98a45c8e47a39b352ef554434cd1a502a531dc76 100644 (file)
@@ -131,6 +131,7 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
         clearTabs();
     }
 
+    connect(mNetworkAccessManager, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), SLOT(sslErrors(QNetworkReply*, QList<QSslError>)));
     connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), SLOT(networkQueryFinished(QNetworkReply*)));
     connect(mXmlParser, SIGNAL(parsingScheduleBegin()), conferenceModel, SLOT(newConferenceBegin()));
     connect(mXmlParser, SIGNAL(parsingScheduleEnd(int)), conferenceModel, SLOT(newConferenceEnd(int)));
@@ -270,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);
@@ -409,9 +410,29 @@ void MainWindow::on_conferencesAction_triggered()
     }
 }
 
+void MainWindow::sslErrors(QNetworkReply *aReply, const QList<QSslError> &errors) {
+    QString errorString;
+    foreach (const QSslError &error, errors) {
+        if (!errorString.isEmpty()) {
+            errorString += ", ";
+        }
+        errorString += error.errorString();
+    }
+
+    if (QMessageBox::warning(
+                this,
+                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 {
+        aReply->abort();
+    }
+}
+
 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()) {
@@ -419,7 +440,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());