[psi] - Don't crash in chat room configuration dialog (rhbz #668850)
Sven Lankes
slankes at fedoraproject.org
Mon Jan 17 20:20:03 UTC 2011
commit 1fe1266795e2d80bf491f8579b9cb287658b744c
Author: Sven Lankes <sven at lank.es>
Date: Mon Jan 17 21:19:43 2011 +0100
- Don't crash in chat room configuration dialog (rhbz #668850)
psi-0.14-affiliationlistconfigmuc.patch | 92 +++++++++++++++++++++++++++++++
psi-0.14-configureroomcrash.patch | 40 +++++++++++++
psi-0.14-enchant.patch | 11 ----
psi.spec | 11 +++-
4 files changed, 142 insertions(+), 12 deletions(-)
---
diff --git a/psi-0.14-affiliationlistconfigmuc.patch b/psi-0.14-affiliationlistconfigmuc.patch
new file mode 100644
index 0000000..dd9119e
--- /dev/null
+++ b/psi-0.14-affiliationlistconfigmuc.patch
@@ -0,0 +1,92 @@
+commit ef1df7a42e7aa7b6bfb1dca5b86b303f71739fc4
+Author: Rion <rion4ik at gmail.com>
+Date: Fri Dec 3 16:39:56 2010 +0500
+
+ Fixed changing affiliations list from muc config dialog
+
+diff --git a/src/mucaffiliationsview.cpp b/src/mucaffiliationsview.cpp
+index 8632c43..94adcec 100644
+--- a/src/mucaffiliationsview.cpp
++++ b/src/mucaffiliationsview.cpp
+@@ -33,30 +33,6 @@ MUCAffiliationsView::MUCAffiliationsView(QWidget* parent) : QTreeView(parent)
+ setDropIndicatorShown(true);
+ }
+
+-bool MUCAffiliationsView::addToCurrent(const QString& j)
+-{
+- QModelIndex index = currentIndex();
+- if (!index.isValid())
+- return false;
+-
+- if (index.parent().isValid())
+- index = index.parent();
+-
+- if (!index.parent().isValid()) {
+- XMPP::Jid jid(j);
+- if (!jid.isValid())
+- return false;
+-
+- // TODO: Check if the user is already in the list
+-
+- int row = model()->rowCount(index);
+- model()->insertRows(row,1,index);
+- model()->setData(model()->index(row,0,index),QVariant(jid.bare()));
+- return true;
+- }
+- return false;
+-}
+-
+ void MUCAffiliationsView::removeCurrent()
+ {
+ QModelIndex index = currentIndex();
+diff --git a/src/mucaffiliationsview.h b/src/mucaffiliationsview.h
+index 11f1446..54ee0ff 100644
+--- a/src/mucaffiliationsview.h
++++ b/src/mucaffiliationsview.h
+@@ -32,7 +32,6 @@ public:
+
+ public slots:
+ void removeCurrent();
+- bool addToCurrent(const QString&);
+
+ signals:
+ void addEnabled(bool);
+diff --git a/src/mucconfigdlg.cpp b/src/mucconfigdlg.cpp
+index a10f14e..dcf4a35 100644
+--- a/src/mucconfigdlg.cpp
++++ b/src/mucconfigdlg.cpp
+@@ -158,9 +158,31 @@ void MUCConfigDlg::add()
+ {
+ bool ok;
+ QString text = QInputDialog::getText(this, tr("Add affiliation"), tr("Enter the JID of the user:"), QLineEdit::Normal, "", &ok);
+- if (ok) {
+- if (text.isEmpty() || !ui_.tv_affiliations->addToCurrent(text))
+- QMessageBox::critical(this, tr("Error"), tr("You have entered an invalid JID."));
++ if (ok && ui_.tv_affiliations->currentIndex().isValid()) {
++ if (!text.isEmpty()) {
++
++ QModelIndex index = affiliations_proxy_model_->mapToSource(ui_.tv_affiliations->currentIndex());
++
++ if (index.parent().isValid())
++ index = index.parent();
++
++ if (!index.parent().isValid()) {
++ XMPP::Jid jid(text);
++ if (jid.isValid()) {
++
++ // TODO: Check if the user is already in the list
++
++ int row = affiliations_model_->rowCount(index);
++ affiliations_model_->insertRows(row,1,index);
++ QModelIndex newIndex = affiliations_model_->index(row,0,index);
++ affiliations_model_->setData(newIndex, QVariant(jid.bare()));
++ ui_.tv_affiliations->setCurrentIndex(affiliations_proxy_model_->mapFromSource(newIndex));
++ return;
++ }
++ }
++ }
++
++ QMessageBox::critical(this, tr("Error"), tr("You have entered an invalid JID."));
+ }
+ }
+
diff --git a/psi-0.14-configureroomcrash.patch b/psi-0.14-configureroomcrash.patch
new file mode 100644
index 0000000..99fa307
--- /dev/null
+++ b/psi-0.14-configureroomcrash.patch
@@ -0,0 +1,40 @@
+commit ec91add0e6398ad20c7a8f14a1a08c5e3282c5bd
+Author: Michail Pishchagin <mblsha at 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;
diff --git a/psi.spec b/psi.spec
index d330267..7db667e 100644
--- a/psi.spec
+++ b/psi.spec
@@ -1,12 +1,16 @@
Name: psi
Version: 0.14
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Jabber client based on Qt
License: GPLv2+
Group: Applications/Internet
URL: http://psi-im.org
Source0: http://dl.sf.net/psi/psi-%{version}.tar.bz2
Patch0: psi-0.12-qca.patch
+# The following two patches are from the git version - they can
+# be dropped on the next upstream release
+Patch1: psi-0.14-configureroomcrash.patch
+Patch2: psi-0.14-affiliationlistconfigmuc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -68,6 +72,8 @@ More icons can be found on http://jisp.netflint.net
%prep
%setup -q
%patch0 -p1 -b .qca
+%patch1 -p1 -b .configureroom
+%patch2 -p1 -b .affiliationlistmuc
%build
unset QTDIR
@@ -152,6 +158,9 @@ fi
%changelog
+* Mon Jan 17 2011 Sven Lankes <sven at lank.es> 0.14-4
+- Don't crash in chat room configuration dialog (rhbz #668850)
+
* Thu Apr 08 2010 Aurelien Bompard <abompard at fedoraproject.org> - 0.14-3
- disable debug, but don't break the -debuginfo pkg (rhbz#579131)
More information about the scm-commits
mailing list