summaryrefslogtreecommitdiff
blob: 99fa30794590da433cadc8326da56424a52e42c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
commit ec91add0e6398ad20c7a8f14a1a08c5e3282c5bd
Author: Michail Pishchagin <mblsha@users.sourceforge.net>
Date:   Tue Oct 19 11:26:31 2010 +0400

    Fix crash in MUCAffiliationsModel on Qt 4.7 (closes #1087)
    Based on 1610-psi-fix-crash-in-muc-configurator.diff from Psi+

diff --git a/src/mucaffiliationsmodel.cpp b/src/mucaffiliationsmodel.cpp
index 722b762..fd0a830 100644
--- a/src/mucaffiliationsmodel.cpp
+++ b/src/mucaffiliationsmodel.cpp
@@ -150,15 +150,18 @@ void MUCAffiliationsModel::resetAffiliationLists()
 
 void MUCAffiliationsModel::resetAffiliationList(MUCItem::Affiliation a)
 {
+	emit layoutAboutToBeChanged();
 	enabled_[(AffiliationListIndex) affiliationToIndex(a)] = false;
 	QModelIndex index = affiliationListIndex(a);
 	if (hasChildren(index)) {
 		removeRows(0,rowCount(index),index);
 	}
+	emit layoutChanged();
 }
 
 void MUCAffiliationsModel::setAffiliationListEnabled(MUCItem::Affiliation a, bool b)
 {
+	emit layoutAboutToBeChanged();
 	QModelIndex index = affiliationListIndex(a);
 	enabled_[(AffiliationListIndex) index.row()] = b;
 	emit layoutChanged();
@@ -208,6 +211,9 @@ void MUCAffiliationsModel::addItems(const QList<MUCItem>& items)
 	foreach(MUCItem item, items) {
 		QModelIndex list = affiliationListIndex(item.affiliation());
 		if (list.isValid() && !item.jid().isEmpty()) {
+			if (!dirty) {
+				emit layoutAboutToBeChanged();
+			}
 			int row = rowCount(list);
 			if (row == 0) {
 				enabled_[(AffiliationListIndex) list.row()] = true;