summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-03-06 15:37:53 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-03-06 16:48:25 (GMT)
commit3f5f23dcf7a07638c04accd86c06a70c22dd9e8d (patch)
tree3994c36ffe906e71499131c97356d2c6ae4cd5f7 /Swift
parent6e219bf4a63459461a0a6009b1e3dafedda9e033 (diff)
downloadswift-3f5f23dcf7a07638c04accd86c06a70c22dd9e8d.zip
swift-3f5f23dcf7a07638c04accd86c06a70c22dd9e8d.tar.bz2
Load 'show offline' for new sessions
Diffstat (limited to 'Swift')
-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_;
};