This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

#5629 Change activation failure to a QDialog

  • Loading branch information...
nlyan committed Oct 3, 2016
1 parent c799041 commit d6bcdcbea74da9db6f718e0a6e72e101f364cf57
View
@@ -18,7 +18,8 @@ FORMS += res/MainWindowBase.ui \
res/SetupWizardBase.ui \
res/AddClientDialogBase.ui \
res/ActivationDialog.ui \
- res/CancelActivationDialog.ui
+ res/CancelActivationDialog.ui \
+ res/FailedLoginDialog.ui
SOURCES += src/main.cpp \
src/MainWindow.cpp \
src/AboutDialog.cpp \
@@ -62,7 +63,8 @@ SOURCES += src/main.cpp \
src/SubscriptionManager.cpp \
src/ActivationNotifier.cpp \
src/ActivationDialog.cpp \
- src/CancelActivationDialog.cpp
+ src/CancelActivationDialog.cpp \
+ src/FailedLoginDialog.cpp
HEADERS += src/MainWindow.h \
src/AboutDialog.h \
src/ServerConfig.h \
@@ -109,7 +111,8 @@ HEADERS += src/MainWindow.h \
src/ActivationNotifier.h \
src/ElevateMode.h \
src/ActivationDialog.h \
- src/CancelActivationDialog.h
+ src/CancelActivationDialog.h \
+ src/FailedLoginDialog.h
RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc
macx {
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FailedLoginDialog</class>
+ <widget class="QDialog" name="FailedLoginDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>165</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Activation Error</string>
+ </property>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>120</y>
+ <width>341</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>90</y>
+ <width>382</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://symless.com/account/reset/?source=gui&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Forgotten your password?&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" name="messageLabel">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>382</width>
+ <height>72</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>An error occurred while trying to activate Synergy. The Symless server returned the following error:
+
+%1</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <zorder>label_2</zorder>
+ <zorder>messageLabel</zorder>
+ <zorder>buttonBox</zorder>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>FailedLoginDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>FailedLoginDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
@@ -8,6 +8,7 @@
#include "MainWindow.h"
#include "QUtility.h"
#include "SubscriptionManager.h"
+#include "FailedLoginDialog.h"
#include <QMessageBox>
#include <QThread>
@@ -116,9 +117,8 @@ void ActivationDialog::accept()
return;
}
else if (!webClient.getEdition (edition, error)) {
- message.critical (this, "Activation Error",
- tr("An error occurred while trying to activate Synergy. "
- "The Symless server returned the following error:\n\n%1").arg(error));
+ FailedLoginDialog failedLoginDialog (this, error);
+ failedLoginDialog.exec();
return;
}
@@ -0,0 +1,15 @@
+#include "FailedLoginDialog.h"
+#include "ui_FailedLoginDialog.h"
+
+FailedLoginDialog::FailedLoginDialog(QWidget *parent, QString message):
+ QDialog(parent),
+ ui(new Ui::FailedLoginDialog)
+{
+ ui->setupUi(this);
+ ui->messageLabel->setText(ui->messageLabel->text().arg(message));
+}
+
+FailedLoginDialog::~FailedLoginDialog()
+{
+ delete ui;
+}
@@ -0,0 +1,23 @@
+#ifndef FAILEDLOGINDIALOG_H
+#define FAILEDLOGINDIALOG_H
+
+#include <QDialog>
+#include <QString>
+
+namespace Ui {
+class FailedLoginDialog;
+}
+
+class FailedLoginDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit FailedLoginDialog(QWidget *parent = 0, QString message = "");
+ ~FailedLoginDialog();
+
+private:
+ Ui::FailedLoginDialog *ui;
+};
+
+#endif // FAILEDLOGINDIALOG_H
@@ -46,7 +46,7 @@ WebClient::getEdition (int& edition, QString& errorOut) {
throw std::runtime_error ("Unrecognised server response.");
}
} else {
- errorOut = tr("Login failed. Invalid email or password.");
+ errorOut = tr("Login failed. Invalid email address or password.");
return false;
}
} else {

0 comments on commit d6bcdcb

Please sign in to comment.