Bug 130295 - CSS Stilvorlage doesnt support 0.xx cm by margin
Summary: CSS Stilvorlage doesnt support 0.xx cm by margin
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-05 14:30 UTC by Samuel Suther
Modified: 2006-09-08 16:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Suther 2006-07-05 14:30:34 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    SuSE RPMs

In CSS Style-Editor i choose margin-bottom.
The value of this tag should be 0.21cm. But the insertfield of the gui doesnt except numbers with a dot (.)
Comment 1 András Manţia 2006-09-08 16:37:40 UTC
SVN commit 582192 by amantia:

Accept float numbers for length values (use lineedit instead of spinbox).

BUG: 130295

 M  +1 -0      ChangeLog  
 M  +36 -12    components/csseditor/specialsb.cpp  
 M  +5 -2      components/csseditor/specialsb.h  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #582191:582192
@@ -18,6 +18,7 @@
       - fix crash when creating project through slow links [#133705]
       - really abort if a remote directory cannot be created [#117032]
       - fix automatic updating of closing tags [#132357]
+      - accept float numbers for length values [#130295]
 
 
 Version 3.5.4 (Release date: 02-08-2006; Started 24-06-2005):
--- branches/KDE/3.5/kdewebdev/quanta/components/csseditor/specialsb.cpp #582191:582192
@@ -19,16 +19,29 @@
 #include "propertysetter.h"
 #include "csseditor_globals.h"
 
-specialSB::specialSB(QWidget *parent, const char *name ) : miniEditor(parent,name) {
-  m_sb=new mySpinBox(this);
-  m_cb=new QComboBox(this);
+#include <klineedit.h>
+
+specialSB::specialSB(QWidget *parent, const char *name, bool useLineEdit ) : miniEditor(parent,name) {
+  if (useLineEdit)
+  {
+    m_lineEdit = new KLineEdit(this);
+    m_sb = 0L;
+    connect(m_lineEdit, SIGNAL(textChanged ( const QString & )), this, SLOT(lineEditValueSlot ( const QString & )));
+  }
+  else
+  {
+    m_sb=new mySpinBox(this);
+    connect(m_sb, SIGNAL(valueChanged ( const QString & )), this, SLOT(sbValueSlot(const QString&)));
+    m_lineEdit = 0L;
+  }
+  m_cb = new QComboBox(this);
   connect(m_cb, SIGNAL(activated ( const QString & )), this, SLOT(cbValueSlot(const QString&)));
-  connect(m_sb, SIGNAL(valueChanged ( const QString & )), this, SLOT(sbValueSlot(const QString&)));
 }
 
 specialSB::~specialSB(){
   delete m_cb;
   delete m_sb;
+  delete m_lineEdit;
 }
 
 void specialSB::connectToPropertySetter(propertySetter* p){
@@ -37,23 +50,33 @@
 
 
 void specialSB::cbValueSlot(const QString& s){
-  emit valueChanged( m_sb->text() +s );
+  if (m_sb)
+    emit valueChanged( m_sb->text() +s );
+  else
+    emit valueChanged( m_lineEdit->text() +s );
 }
 
 void specialSB::sbValueSlot(const QString& s){
   emit valueChanged( s + m_cb->currentText());
 }
 
+void specialSB::lineEditValueSlot(const QString& s){
+  emit valueChanged( s + m_cb->currentText());
+}
+
 void specialSB::setInitialValue(const QString& s){
 
   QRegExp pattern("\\d("+ cbValueList().join("|")+")");
 
-  if(s.contains(pattern)) {
-    QString temp1(s.stripWhiteSpace()),
-                 temp2(s.stripWhiteSpace());
+  if (pattern.search(s) != -1) {
+    QString temp(s.stripWhiteSpace());
+    QString cbValue = pattern.cap(1);
 
-    m_sb->setValue(temp1.remove(QRegExp("\\D")).toInt());
-    m_cb->setCurrentText(temp2.remove(QRegExp("\\d")));
+    if (m_sb)
+      m_sb->setValue(temp.remove(cbValue).toInt());
+    else
+      m_lineEdit->setText(temp.remove(cbValue));
+    m_cb->setCurrentText(cbValue);
   }
   else return;
 }
@@ -84,7 +107,7 @@
   m_sb->setMaxValue(99999);
 }
 
-lengthEditor::lengthEditor(QWidget *parent, const char *name ) : specialSB(parent,name) {
+lengthEditor::lengthEditor(QWidget *parent, const char *name ) : specialSB(parent,name, true) {
   m_cb->insertItem("px");
   m_cb->insertItem("em");
   m_cb->insertItem("ex");
@@ -93,7 +116,8 @@
   m_cb->insertItem("mm");
   m_cb->insertItem("pt");
   m_cb->insertItem("pc");
-  m_sb->setMaxValue(99999);
+  if (m_sb)
+    m_sb->setMaxValue(99999);
 }
 
 
--- branches/KDE/3.5/kdewebdev/quanta/components/csseditor/specialsb.h #582191:582192
@@ -21,6 +21,7 @@
 #include "minieditor.h"
 #include <qcombobox.h>
 class mySpinBox;
+class KLineEdit;
 
 /**
   *@author gulmini luciano
@@ -30,10 +31,11 @@
     Q_OBJECT
   protected:
     QComboBox *m_cb;
-    mySpinBox  *m_sb;
+    mySpinBox *m_sb;
+    KLineEdit *m_lineEdit;
 
    public:
-     specialSB(QWidget *parent=0, const char *name=0);
+     specialSB(QWidget *parent=0, const char *name=0, bool useLineEdit = false);
      ~specialSB();
      void insertItem(const QString& s){ m_cb->insertItem(s); }
      void setInitialValue(const QString& s);
@@ -43,6 +45,7 @@
    public slots:
      void cbValueSlot(const QString&);
      void sbValueSlot(const QString&);
+     void lineEditValueSlot(const QString&);
 
    signals:
      void valueChanged(const QString&);