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

List:       kde-commits
Subject:    branches/KDE/3.5/kdewebdev/quanta
From:       Andras Mantia <amantia () kde ! org>
Date:       2007-10-03 13:05:20
Message-ID: 1191416720.934619.31335.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 720675 by amantia:

Do not lose CSS selectors after editing inside the dialog if they are repeated. 
Note: preview for the further instance of the same selector will most probably not work correctly.

BUG: 145413


 M  +2 -0      ChangeLog  
 M  +6 -3      components/csseditor/cssselector.cpp  
 M  +12 -0     components/csseditor/stylesheetparser.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #720674:720675
@@ -4,6 +4,8 @@
  - bugfixes:
       - fix recursive symlink handling [#145651]
       - fix add to project when saving a new file into a symlinked directory [#148529]
+      - do not lose CSS selectors after editing inside the dialog if they are
+        repeated [#145413]
 
 
 Version 3.5.7 (Release date: xx-xx-2006; Started 06-02-2006)
--- branches/KDE/3.5/kdewebdev/quanta/components/csseditor/cssselector.cpp #720674:720675
@@ -26,6 +26,7 @@
 #include <qobjectlist.h>
 #include <qfileinfo.h>
 #include <qlabel.h>
+#include <qregexp.h>
 #include <qwhatsthis.h>
 
 #include <kstandarddirs.h>
@@ -352,13 +353,15 @@
                       indentDisplacement = 2;
   for ( unsigned int i=0;i<=m_orderNumber;i++ ) {
     for ( it = m_currentStylesheetStructure.begin(); it != m_currentStylesheetStructure.end(); ++it ) {
+      QString key = it.key();
       if(it.data().second == i){
-       if(it.key().startsWith("@rule"))
+       if(key.startsWith("@rule"))
          styleSection += it.data().first;
-       else if(it.key().startsWith("/*"))
+       else if(key.startsWith("/*"))
                  styleSection += it.data().first;
                else {
-                  styleSection += "\n" + it.key() + " {\n";
+                  key.remove(QRegExp("-v[\\d]+$"));
+                  styleSection += "\n" + key + " {\n";
                   indentWidth = indentDisplacement + 2;
                   QStringList props = QStringList::split(";",it.data().first.simplifyWhiteSpace());
                   QString indentStr;
--- branches/KDE/3.5/kdewebdev/quanta/components/csseditor/stylesheetparser.cpp #720674:720675
@@ -160,6 +160,18 @@
       selectorName.remove("\n").remove("\t");
       selectorValue.remove("\n").remove("\t");
       QPair<QString,unsigned int> tmp(selectorValue,++m_orderNumber);
+            
+      if (m_stylesheetStructure.contains(selectorName))
+      {
+        uint i = 2;
+        QString s = selectorName + QString("-v%1").arg(i);
+        while (m_stylesheetStructure.contains(s))
+        {          
+         i++;
+         s = selectorName + QString("-v%1").arg(i);
+        }
+        selectorName = s;
+      }
       m_stylesheetStructure[selectorName]=tmp; 
       break;
     } 
[prev in list] [next in list] [prev in thread] [next in thread] 

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