summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-05 12:48:27 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-05 12:48:27 (GMT)
commitc88b7c5da8dde6c4f7bdd85743378ec46f3a30fc (patch)
tree56b4923b1bd0e1a2264531d207cfca1f09318a57 /Swift
parent559ab08f0a214f57cc84887eb65128519d1dc7f5 (diff)
downloadswift-contrib-c88b7c5da8dde6c4f7bdd85743378ec46f3a30fc.zip
swift-contrib-c88b7c5da8dde6c4f7bdd85743378ec46f3a30fc.tar.bz2
Merged roster status types for sorting in the same way as the status icons.
Resolves: #270
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp14
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.h2
2 files changed, 9 insertions, 7 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
index 5bd7d1e..c7d2ee6 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
@@ -34,12 +34,12 @@ void QtTreeWidgetItem::setStatusShow(StatusShow::Type show) {
statusShowType_ = show;
int color = 0;
switch (show) {
- case StatusShow::Online: color = 0x000000;break;
- case StatusShow::Away: color = 0x336699;break;
- case StatusShow::XA: color = 0x336699;break;
- case StatusShow::FFC: color = 0x000000;break;
- case StatusShow::DND: color = 0x990000;break;
- case StatusShow::None: color = 0x7F7F7F;break;
+ case StatusShow::Online: color = 0x000000; mergedShowType_ = StatusShow::Online; break;
+ case StatusShow::Away: color = 0x336699; mergedShowType_ = StatusShow::Away; break;
+ case StatusShow::XA: color = 0x336699; mergedShowType_ = StatusShow::Away; break;
+ case StatusShow::FFC: color = 0x000000; mergedShowType_ = StatusShow::Online; break;
+ case StatusShow::DND: color = 0x990000; mergedShowType_ = show; break;
+ case StatusShow::None: color = 0x7F7F7F; mergedShowType_ = show; break;
}
setTextColor(color);
emit changed(this);
@@ -220,7 +220,7 @@ bool QtTreeWidgetItem::operator<(const QtTreeWidgetItem& item) const {
if (!item.isContact()) {
return false;
}
- return getStatusShow() == item.getStatusShow() ? getLowerName() < item.getLowerName() : getStatusShow() < item.getStatusShow();
+ return getStatusShowMerged() == item.getStatusShowMerged() ? getLowerName() < item.getLowerName() : getStatusShowMerged() < item.getStatusShowMerged();
} else {
if (item.isContact()) {
return true;
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h
index 4f4e28f..00b7d9d 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.h
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h
@@ -53,6 +53,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem {
const QString& getName() const {return displayName_;};
const QString& getLowerName() const {return displayNameLower_;};
StatusShow::Type getStatusShow() const {return statusShowType_;};
+ StatusShow::Type getStatusShowMerged() const {return mergedShowType_;};
QWidget* getCollapsedRosterWidget();
QWidget* getExpandedRosterWidget();
@@ -76,6 +77,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem {
bool shown_;
bool expanded_;
StatusShow::Type statusShowType_;
+ StatusShow::Type mergedShowType_;
};
bool itemLessThan(QtTreeWidgetItem* left, QtTreeWidgetItem* right);