summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-09-30 13:39:26 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-09-30 13:39:26 (GMT)
commit6385ba952548b098348f3ab1002437d516b29e5c (patch)
tree639f14702ab1fdb51eff84f86e79b6f6ec0ef9cb /Swift/QtUI
parentd6ca3cac8a2e00a3b68ae34d53412bbd0e9920d2 (diff)
downloadswift-6385ba952548b098348f3ab1002437d516b29e5c.zip
swift-6385ba952548b098348f3ab1002437d516b29e5c.tar.bz2
Slightly neaten code
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 90be786..d3a5676 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -110,18 +110,16 @@ void QtChatTabs::handleWantsToActivate() {
void QtChatTabs::handleTabClosing() {
QWidget* widget = qobject_cast<QWidget*>(sender());
- if (!widget) {
- return;
- }
- int index = tabs_->indexOf(widget);
- if (index < 0) {
- return;
- }
- tabs_->removeTab(index);
- if (tabs_->count() == 0) {
- hide();
+ int index;
+ if (widget && ((index = tabs_->indexOf(widget)) >= 0)) {
+ tabs_->removeTab(index);
+ if (tabs_->count() == 0) {
+ hide();
+ }
+ else {
+ handleTabTitleUpdated(tabs_->currentWidget());
+ }
}
- handleTabTitleUpdated(tabs_->currentWidget());
}
void QtChatTabs::handleRequestedPreviousTab() {