diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 1 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/LoginWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 1 |
4 files changed, 12 insertions, 3 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 7ed53a2..046120d 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -130,18 +130,19 @@ MainController::MainController( dock_ = dock; uiEventStream_ = new UIEventStream(); notifier_ = new TogglableNotifier(notifier); eventController_ = new EventController(); eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1)); systemTrayController_ = new SystemTrayController(eventController_, systemTray); loginWindow_ = uiFactory_->createLoginWindow(uiEventStream_); + loginWindow_->setShowNotificationToggle(!notifier->isExternallyConfigured()); soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings, uiEventStream_); xmppURIController_ = new XMPPURIController(uriHandler_, uiEventStream_); std::string selectedLoginJID = settings_->getStringSetting("lastLoginJID"); bool loginAutomatically = settings_->getBoolSetting("loginAutomatically", false); std::string cachedPassword; std::string cachedCertificate; if (!eagleMode_) { diff --git a/Swift/Controllers/UIInterfaces/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h index 61fcaa1..a8ee5a4 100644 --- a/Swift/Controllers/UIInterfaces/LoginWindow.h +++ b/Swift/Controllers/UIInterfaces/LoginWindow.h @@ -14,18 +14,19 @@ namespace Swift { class MainWindow; class LoginWindow { public: virtual ~LoginWindow() {}; virtual void selectUser(const std::string&) = 0; virtual void morphInto(MainWindow *mainWindow) = 0; virtual void loggedOut() = 0; + virtual void setShowNotificationToggle(bool) = 0; virtual void setMessage(const std::string&) = 0; virtual void setIsLoggingIn(bool loggingIn) = 0; virtual void addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate) = 0; virtual void removeAvailableAccount(const std::string& jid) = 0; boost::signal<void (const std::string&, const std::string&, const std::string& /* certificateFile */, bool /* remember password*/, bool /* login automatically */)> onLoginRequest; virtual void setLoginAutomatically(bool loginAutomatically) = 0; virtual void quit() = 0; /** Blocking request whether a cert should be permanently trusted.*/ virtual bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref) = 0; diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 5a8b9ab..43abd91 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -179,21 +179,18 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, bool eagleMode) : QMa toggleSoundsAction_->setCheckable(true); toggleSoundsAction_->setChecked(true); connect(toggleSoundsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleSounds(bool))); generalMenu_->addAction(toggleSoundsAction_); toggleNotificationsAction_ = new QAction(tr("Display Pop-up &Notifications"), this); toggleNotificationsAction_->setCheckable(true); toggleNotificationsAction_->setChecked(true); connect(toggleNotificationsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleNotifications(bool))); -#if defined(SWIFTEN_PLATFORM_LINUX) || defined(SWIFTEN_PLATFORM_WINDOWS) - generalMenu_->addAction(toggleNotificationsAction_); -#endif #ifndef SWIFTEN_PLATFORM_MACOSX swiftMenu_->addSeparator(); #endif #ifdef SWIFTEN_PLATFORM_MACOSX QAction* quitAction = new QAction("&Quit", this); #else QAction* quitAction = new QAction(tr("&Quit"), this); @@ -210,18 +207,27 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, bool eagleMode) : QMa xmlConsoleAction_->setEnabled(!eagleMode_); if (eagleMode_) { remember_->setChecked(false); loginAutomatically_->setChecked(false); } this->show(); } +void QtLoginWindow::setShowNotificationToggle(bool toggle) { + if (toggle) { + generalMenu_->addAction(toggleNotificationsAction_); + } + else { + generalMenu_->removeAction(toggleNotificationsAction_); + } +} + bool QtLoginWindow::eventFilter(QObject *obj, QEvent *event) { if (obj == username_->view() && event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); if (keyEvent->key() == Qt::Key_Delete || keyEvent->key() == Qt::Key_Backspace) { QString jid(username_->view()->currentIndex().data().toString()); int result = QMessageBox::question(this, tr("Remove profile"), tr("Remove the profile '%1'?").arg(jid), QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::Yes) { onPurgeSavedLoginRequest(Q2PSTRING(jid)); } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index a830af5..df133b1 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -32,18 +32,19 @@ namespace Swift { QMenu* swiftMenu; QMenu* generalMenu; }; public: QtLoginWindow(UIEventStream* uiEventStream, bool eagleMode); void morphInto(MainWindow *mainWindow); virtual void loggedOut(); + virtual void setShowNotificationToggle(bool); virtual void setMessage(const std::string& message); virtual void addAvailableAccount(const std::string& defaultJID, const std::string& defaultPassword, const std::string& defaultCertificate); virtual void removeAvailableAccount(const std::string& jid); virtual void setLoginAutomatically(bool loginAutomatically); virtual void setIsLoggingIn(bool loggingIn); void selectUser(const std::string& user); bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref certificate); void hide(); QtMenus getMenus() const; |