summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp42
-rw-r--r--Swift/QtUI/QtLoginWindow.h5
-rw-r--r--Swift/QtUI/QtSwift.cpp24
-rw-r--r--Swift/QtUI/QtUIFactory.cpp2
4 files changed, 35 insertions, 38 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 0db6071..87dd849 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -33,6 +33,7 @@
#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
#include "Swift/Controllers/UIEvents/ToggleNotificationsUIEvent.h"
#include "Swiften/Base/Platform.h"
+#include "Swiften/Base/Paths.h"
#include "QtAboutWidget.h"
#include "QtSwiftUtil.h"
@@ -41,7 +42,7 @@
namespace Swift{
-QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow(), forgetful_(false) {
+QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, bool eagleMode) : QMainWindow(), eagleMode_(eagleMode) {
uiEventStream_ = uiEventStream;
setWindowTitle("Swift");
@@ -202,18 +203,17 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow(), forg
setInitialMenus();
uiEventStream_->onUIEvent.connect(boost::bind(&QtLoginWindow::handleUIEvent, this, _1));
- this->show();
-}
-void QtLoginWindow::setRememberingAllowed(bool allowed) {
- forgetful_ = true;
- remember_->setEnabled(allowed);
- loginAutomatically_->setEnabled(allowed);
- xmlConsoleAction_->setEnabled(allowed);
- if (!allowed) {
+
+ remember_->setEnabled(!eagleMode_);
+ loginAutomatically_->setEnabled(!eagleMode_);
+ xmlConsoleAction_->setEnabled(!eagleMode_);
+ if (eagleMode_) {
remember_->setChecked(false);
loginAutomatically_->setChecked(false);
}
+
+ this->show();
}
bool QtLoginWindow::eventFilter(QObject *obj, QEvent *event) {
@@ -322,8 +322,30 @@ void QtLoginWindow::setIsLoggingIn(bool loggingIn) {
void QtLoginWindow::loginClicked() {
if (username_->isEnabled()) {
+ if (eagleMode_) {
+ QString clickThroughPath(P2QSTRING((Paths::getExecutablePath() / "eagle-banner.txt").string()));
+ QFile clickThroughFile(clickThroughPath);
+ if (clickThroughFile.exists() && clickThroughFile.open(QIODevice::ReadOnly)) {
+ QString banner;
+ while (!clickThroughFile.atEnd()) {
+ QByteArray line = clickThroughFile.readLine();
+ banner += line + "\n";
+ }
+ if (!banner.isEmpty()) {
+ QMessageBox msgBox;
+ msgBox.setWindowTitle(tr("Confirm terms of use"));
+ msgBox.setText("");
+ msgBox.setInformativeText(banner);
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ msgBox.setDefaultButton(QMessageBox::No);
+ if (msgBox.exec() != QMessageBox::Yes) {
+ return;
+ }
+ }
+ }
+ }
onLoginRequest(Q2PSTRING(username_->currentText()), Q2PSTRING(password_->text()), Q2PSTRING(certificateFile_), remember_->isChecked(), loginAutomatically_->isChecked());
- if (forgetful_) { /* Mustn't remember logins */
+ if (eagleMode_) { /* Mustn't remember logins */
username_->clearEditText();
password_->setText("");
}
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index 414bb20..acf327f 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -27,7 +27,7 @@ namespace Swift {
class QtLoginWindow : public QMainWindow, public LoginWindow {
Q_OBJECT
public:
- QtLoginWindow(UIEventStream* uiEventStream);
+ QtLoginWindow(UIEventStream* uiEventStream, bool eagleMode);
void morphInto(MainWindow *mainWindow);
virtual void loggedOut();
@@ -36,7 +36,6 @@ namespace Swift {
virtual void removeAvailableAccount(const std::string& jid);
virtual void setLoginAutomatically(bool loginAutomatically);
virtual void setIsLoggingIn(bool loggingIn);
- virtual void setRememberingAllowed(bool allowed);
void selectUser(const std::string& user);
bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate);
void hide();
@@ -87,7 +86,7 @@ namespace Swift {
QAction* toggleNotificationsAction_;
UIEventStream* uiEventStream_;
QPointer<QtAboutWidget> aboutDialog_;
- bool forgetful_;
+ bool eagleMode_;
QAction* xmlConsoleAction_;
QAction* fileTransferOverviewAction_;
};
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 7c0a2bd..7f11b5c 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -33,7 +33,6 @@
#include "Swift/Controllers/BuildVersion.h"
#include "SwifTools/AutoUpdater/AutoUpdater.h"
#include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h"
-#include "Swiften/Base/Paths.h"
#if defined(SWIFTEN_PLATFORM_WINDOWS)
#include "WindowsNotifier.h"
@@ -175,29 +174,6 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
mainControllers_.push_back(mainController);
}
- if (eagleMode) {
- QString clickThroughPath(P2QSTRING((Paths::getExecutablePath() / "eagle-banner.txt").string()));
- QFile clickThroughFile(clickThroughPath);
- if (clickThroughFile.exists() && clickThroughFile.open(QIODevice::ReadOnly)) {
- QString banner;
- while (!clickThroughFile.atEnd()) {
- QByteArray line = clickThroughFile.readLine();
- banner += line + "\n";
- }
- if (!banner.isEmpty()) {
- QMessageBox msgBox;
- msgBox.setWindowTitle(tr("Confirm terms of use"));
- msgBox.setText(tr("Do you agree to the terms of use?"));
- msgBox.setInformativeText(banner);
- msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- msgBox.setDefaultButton(QMessageBox::No);
- if (msgBox.exec() != QMessageBox::Yes) {
- exit(0);
- }
- }
- }
- }
-
// PlatformAutoUpdaterFactory autoUpdaterFactory;
// if (autoUpdaterFactory.isSupported()) {
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index faeebdc..5f55795 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -60,7 +60,7 @@ MainWindow* QtUIFactory::createMainWindow(UIEventStream* eventStream) {
}
LoginWindow* QtUIFactory::createLoginWindow(UIEventStream* eventStream) {
- loginWindow = new QtLoginWindow(eventStream);
+ loginWindow = new QtLoginWindow(eventStream, eagleMode);
if (netbookSplitter) {
netbookSplitter->insertWidget(0, loginWindow);
}