From e7aadb2d03be6dc10a258f8ca0cca7e62c0c4efd Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Tue, 7 Apr 2015 17:19:15 -0400
Subject: [PATCH] contactmodel: fix faulty rowsInserted() signal

Refs #70320
---
 src/categorizedcontactmodel.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/categorizedcontactmodel.cpp b/src/categorizedcontactmodel.cpp
index 121e5619..588fe93f 100644
--- a/src/categorizedcontactmodel.cpp
+++ b/src/categorizedcontactmodel.cpp
@@ -283,16 +283,16 @@ void CategorizedContactModelPrivate::slotContactAdded(const Person* c)
       item->m_lChildren << contactNode;
    } q_ptr->endInsertRows();
 
-   q_ptr->beginInsertRows(q_ptr->createIndex(contactNode->m_Index,0,contactNode),0,c->phoneNumbers().size());
    if (c->phoneNumbers().size() > 1) {
+      q_ptr->beginInsertRows(q_ptr->createIndex(contactNode->m_Index,0,contactNode),0,c->phoneNumbers().size() - 1);
       for (ContactMethod* m : c->phoneNumbers() ) {
          ContactTreeNode* n2 = new ContactTreeNode(m,q_ptr);
          n2->m_Index = contactNode->m_lChildren.size();
          n2->m_pParent = contactNode;
          contactNode->m_lChildren << n2;
       }
+      q_ptr->endInsertRows();
    }
-   q_ptr->endInsertRows();
 
    //emit layoutChanged();
 }
-- 
GitLab