From kde-commits Wed Oct 03 13:05:20 2007 From: Andras Mantia Date: Wed, 03 Oct 2007 13:05:20 +0000 To: kde-commits Subject: branches/KDE/3.5/kdewebdev/quanta Message-Id: <1191416720.934619.31335.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119141673732721 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 #include #include +#include #include #include @@ -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 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; }