[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:07:41 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=a8325f2
The following commit has been merged in the master branch:
commit a8325f242be5983a59997caa63677fa061dacdec
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Mon Oct 3 12:57:36 2011 +0100
save expanded state for all types
REVIEW: 102763
---
main-widget.cpp | 20 ++++++--------------
models/groups-model-item.cpp | 2 ++
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/main-widget.cpp b/main-widget.cpp
index 6294f69..6813c0d 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -318,7 +318,7 @@ void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
m_contactsListView->setSortingEnabled(true);
m_contactsListView->sortByColumn(0, Qt::AscendingOrder);
- connect(m_groupsModel, SIGNAL(rowsInserted(QModelIndex, int, int)),
+ connect(m_modelFilter, SIGNAL(rowsInserted(QModelIndex, int, int)),
this, SLOT(onNewGroupModelItemsInserted(QModelIndex,int,int)));
connect(m_showOfflineAction, SIGNAL(toggled(bool)),
@@ -477,16 +477,10 @@ void MainWidget::onContactListClicked(const QModelIndex& index)
if (m_contactsListView->isExpanded(index)) {
m_contactsListView->collapse(index);
-
- if (index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<GroupsModelItem*>()) {
- groupsConfig.writeEntry(index.data(GroupsModel::GroupNameRole).toString(), false);
- }
+ groupsConfig.writeEntry(index.data(AccountsModel::IdRole).toString(), false);
} else {
m_contactsListView->expand(index);
-
- if (index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<GroupsModelItem*>()) {
- groupsConfig.writeEntry(index.data(GroupsModel::GroupNameRole).toString(), true);
- }
+ groupsConfig.writeEntry(index.data(AccountsModel::IdRole).toString(), true);
}
groupsConfig.config()->sync();
@@ -1489,16 +1483,14 @@ void MainWidget::onNewGroupModelItemsInserted(const QModelIndex& index, int star
//if there is no parent, we deal with top-level item that we want to expand/collapse, ie. group or account
if (!index.parent().isValid()) {
- QModelIndex mappedIndex = m_modelFilter->mapFromSource(index);
-
KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
KConfigGroup groupsConfig = config->group("GroupsState");
//we're probably dealing with group item, so let's check if it is expanded first
- if (!m_contactsListView->isExpanded(mappedIndex)) {
+ if (!m_contactsListView->isExpanded(index)) {
//if it's not expanded, check the config if we should expand it or not
- if (groupsConfig.readEntry(index.data(GroupsModel::GroupNameRole).toString(), true)) {
- m_contactsListView->expand(mappedIndex);
+ if (groupsConfig.readEntry(index.data(AccountsModel::IdRole).toString(), false)) {
+ m_contactsListView->expand(index);
}
}
}
diff --git a/models/groups-model-item.cpp b/models/groups-model-item.cpp
index d441e9c..cbe3da2 100644
--- a/models/groups-model-item.cpp
+++ b/models/groups-model-item.cpp
@@ -70,6 +70,8 @@ QVariant GroupsModelItem::data(int role) const
switch (role) {
case AccountsModel::ItemRole:
return QVariant::fromValue((GroupsModelItem*)this);
+ case AccountsModel::IdRole:
+ /* drop through*/
case GroupsModel::GroupNameRole:
return mPriv->mGroupName;
case AccountsModel::TotalUsersCountRole:
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list