summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/UserSearch/QtContactListWidget.cpp')
-rw-r--r--Swift/QtUI/UserSearch/QtContactListWidget.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/Swift/QtUI/UserSearch/QtContactListWidget.cpp b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
index 6ad1169..4adc929 100644
--- a/Swift/QtUI/UserSearch/QtContactListWidget.cpp
+++ b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
@@ -20,19 +20,19 @@
#include <QHeaderView>
namespace Swift {
QtContactListWidget::QtContactListWidget(QWidget* parent, SettingsProvider* settings) : QTreeView(parent), settings_(settings), limited_(false) {
contactListModel_ = new ContactListModel(true);
setModel(contactListModel_);
- connect(contactListModel_, SIGNAL(onListChanged(std::vector<Contact>)), this, SIGNAL(onListChanged(std::vector<Contact>)));
+ connect(contactListModel_, SIGNAL(onListChanged(std::vector<Contact::ref>)), this, SIGNAL(onListChanged(std::vector<Contact::ref>)));
connect(contactListModel_, SIGNAL(onJIDsDropped(std::vector<JID>)), this, SIGNAL(onJIDsAdded(std::vector<JID>)));
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
setUniformRowHeights(true);
setAlternatingRowColors(true);
setIndentation(0);
setHeaderHidden(true);
@@ -55,35 +55,39 @@ QtContactListWidget::QtContactListWidget(QWidget* parent, SettingsProvider* sett
header()->setResizeMode(0, QHeaderView::Stretch);
#endif
}
QtContactListWidget::~QtContactListWidget() {
delete contactListDelegate_;
delete removableItemDelegate_;
}
-void QtContactListWidget::setList(const std::vector<Contact>& list) {
+void QtContactListWidget::setList(const std::vector<Contact::ref>& list) {
contactListModel_->setList(list);
}
-std::vector<Contact> QtContactListWidget::getList() const {
+std::vector<Contact::ref> QtContactListWidget::getList() const {
return contactListModel_->getList();
}
+Contact::ref QtContactListWidget::getContact(const size_t i) {
+ return contactListModel_->getContact(i);
+}
+
void QtContactListWidget::setMaximumNoOfContactsToOne(bool limited) {
limited_ = limited;
}
-void QtContactListWidget::updateContacts(const std::vector<Contact>& contactUpdates) {
- std::vector<Contact> contacts = contactListModel_->getList();
- foreach(const Contact& contactUpdate, contactUpdates) {
+void QtContactListWidget::updateContacts(const std::vector<Contact::ref>& contactUpdates) {
+ std::vector<Contact::ref> contacts = contactListModel_->getList();
+ foreach(const Contact::ref& contactUpdate, contactUpdates) {
for(size_t n = 0; n < contacts.size(); n++) {
- if (contactUpdate.jid == contacts[n].jid) {
+ if (contactUpdate->jid == contacts[n]->jid) {
contacts[n] = contactUpdate;
break;
}
}
}
contactListModel_->setList(contacts);
}
void QtContactListWidget::handleSettingsChanged(const std::string&) {