summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp6
-rw-r--r--Swift/QtUI/QtMainWindow.cpp10
-rw-r--r--Swift/QtUI/QtMainWindow.h1
3 files changed, 5 insertions, 12 deletions
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index d3a00dd..170bfd0 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -59,7 +59,6 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata
eventController_ = eventController;
settings_ = settings;
expandiness_ = new RosterGroupExpandinessPersister(roster_, settings);
- roster_->addFilter(offlineFilter_);
mainWindow_->setRosterModel(roster_);
changeStatusConnection_ = mainWindow_->onChangeStatusRequest.connect(boost::bind(&RosterController::handleChangeStatusRequest, this, _1, _2));
@@ -83,8 +82,10 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata
settings_->onSettingChanged.connect(boost::bind(&RosterController::handleSettingChanged, this, _1));
+ handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
}
+
RosterController::~RosterController() {
settings_->onSettingChanged.disconnect(boost::bind(&RosterController::handleSettingChanged, this, _1));
nickManager_->onOwnNickChanged.disconnect(boost::bind(&MainWindow::setMyNick, mainWindow_, _1));
@@ -107,9 +108,6 @@ void RosterController::setEnabled(bool enabled) {
}
void RosterController::handleShowOfflineToggled(bool state) {
- if (state != settings_->getSetting(SettingConstants::SHOW_OFFLINE)) {
- settings_->storeSetting(SettingConstants::SHOW_OFFLINE, state);
- }
if (state) {
roster_->removeFilter(offlineFilter_);
} else {
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index 18fb43c..ea888d5 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -89,6 +89,7 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr
showOfflineAction_->setChecked(false);
connect(showOfflineAction_, SIGNAL(toggled(bool)), SLOT(handleShowOfflineToggled(bool)));
viewMenu->addAction(showOfflineAction_);
+ handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
//QAction* compactRosterAction_ = new QAction(tr("&Compact Roster"), this);
//compactRosterAction_->setCheckable(true);
@@ -135,8 +136,6 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr
serverAdHocMenu_->addAction(adHocAction);
serverAdHocCommandActions_.append(adHocAction);
- lastOfflineState_ = false;
-
settings_->onSettingChanged.connect(boost::bind(&QtMainWindow::handleSettingChanged, this, _1));
}
@@ -227,11 +226,8 @@ void QtMainWindow::handleSettingChanged(const std::string& settingPath) {
}
void QtMainWindow::handleShowOfflineToggled(bool state) {
- if (state != lastOfflineState_) {
- lastOfflineState_ = state;
- showOfflineAction_->setChecked(state);
- settings_->storeSetting(SettingConstants::SHOW_OFFLINE, state);
- }
+ settings_->storeSetting(SettingConstants::SHOW_OFFLINE, state);
+ showOfflineAction_->setChecked(settings_->getSetting(SettingConstants::SHOW_OFFLINE));
}
void QtMainWindow::setMyNick(const std::string& nick) {
diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h
index 44f8a25..bef483d 100644
--- a/Swift/QtUI/QtMainWindow.h
+++ b/Swift/QtUI/QtMainWindow.h
@@ -83,7 +83,6 @@ namespace Swift {
QtEventWindow* eventWindow_;
QtChatListWindow* chatListWindow_;
UIEventStream* uiEventStream_;
- bool lastOfflineState_;
std::vector<DiscoItems::Item> serverAdHocCommands_;
QList<QAction*> serverAdHocCommandActions_;
};