diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-12-24 10:08:47 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-12-24 11:00:04 (GMT) |
commit | 3e2a3a4cdb0b6bc0cf79423c48400c544830177a (patch) | |
tree | dcc53224fd0b0ed0bd704a4b097f5c425dbd672e /Swift/QtUI | |
parent | f69d027b7e3b4260e514a77f7195ec511977b63e (diff) | |
download | swift-contrib-3e2a3a4cdb0b6bc0cf79423c48400c544830177a.zip swift-contrib-3e2a3a4cdb0b6bc0cf79423c48400c544830177a.tar.bz2 |
Enable "Show notifications" toggle when Growl isn't installed.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 1 |
2 files changed, 10 insertions, 3 deletions
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; |