[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:40 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=2d7dcdf
The following commit has been merged in the master branch:
commit 2d7dcdfc539276ccc0c407f184c7257008c3fda5
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Sun Oct 2 19:24:20 2011 +0200
Save group's expanded state and restore it upon contact list reopening
Reviewed-by: David Edmundson
REVIEW: 102728
FEATURE: 282206
CCBUG: 277216
---
main-widget.cpp | 41 +++++++++++++++++++++++++++++++++++++++++
main-widget.h | 1 +
2 files changed, 42 insertions(+)
diff --git a/main-widget.cpp b/main-widget.cpp
index aa93617..6294f69 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -318,6 +318,9 @@ void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
m_contactsListView->setSortingEnabled(true);
m_contactsListView->sortByColumn(0, Qt::AscendingOrder);
+ connect(m_groupsModel, SIGNAL(rowsInserted(QModelIndex, int, int)),
+ this, SLOT(onNewGroupModelItemsInserted(QModelIndex,int,int)));
+
connect(m_showOfflineAction, SIGNAL(toggled(bool)),
m_modelFilter, SLOT(setShowOfflineUsers(bool)));
@@ -469,11 +472,24 @@ void MainWidget::onContactListClicked(const QModelIndex& index)
if (index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<AccountsModelItem*>()
|| index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<GroupsModelItem*>()) {
+ KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+ KConfigGroup groupsConfig = config->group("GroupsState");
+
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);
+ }
} else {
m_contactsListView->expand(index);
+
+ if (index.data(AccountsModel::ItemRole).userType() == qMetaTypeId<GroupsModelItem*>()) {
+ groupsConfig.writeEntry(index.data(GroupsModel::GroupNameRole).toString(), true);
+ }
}
+
+ groupsConfig.config()->sync();
}
}
@@ -1463,4 +1479,29 @@ bool MainWidget::isAnyAccountOnline() const
return false;
}
+void MainWidget::onNewGroupModelItemsInserted(const QModelIndex& index, int start, int end)
+{
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+ if (!index.isValid()) {
+ return;
+ }
+
+ //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 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);
+ }
+ }
+ }
+}
+
#include "main-widget.moc"
diff --git a/main-widget.h b/main-widget.h
index 876ff92..e6cff85 100644
--- a/main-widget.h
+++ b/main-widget.h
@@ -117,6 +117,7 @@ private Q_SLOTS:
void onContactManagerStateChanged(const Tp::ContactManagerPtr &contactManager, Tp::ContactListState state);
void onSwitchToFullView();
void onSwitchToCompactView();
+ void onNewGroupModelItemsInserted(const QModelIndex &index, int start, int end);
void onGenericOperationFinished(Tp::PendingOperation *operation); /** called when a Tp::PendingOperation finishes. Used to check for errors */
void onOpenLinkTriggered(QAction *action); /** triggered from custom contact menu when user clicks contact link */
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list