[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/pim/ksig
From:       Pino Toscano <pino () kde ! org>
Date:       2012-09-22 12:48:00
Message-ID: 20120922124800.29402AC7E8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1317257 by pino:

SigModel: properly insert when there are no elements


 M  +5 -2      sigmodel.cpp  


--- trunk/extragear/pim/ksig/sigmodel.cpp #1317256:1317257
@@ -78,9 +78,12 @@
     beginInsertRows(parent, row, row + count - 1);
     QDomNode node;
     // insert the first row distinguish whether it is in the middle
-    // or at the end
-    if(row < m_signatures.count()) {
+    // or at the end, and whether there are no elements
+    if(m_signatures.isEmpty()) {
 	QDomElement newElement = m_doc.createElement("signature");
+	node = m_rootElement.appendChild(newElement);
+    } else if(row < m_signatures.count()) {
+	QDomElement newElement = m_doc.createElement("signature");
 	node = m_signatures.at(row);
 	node = node.parentNode().insertBefore(newElement, node);
     } else {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic