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

List:       kde-devel
Subject:    QComboBox in KConfigDialogManager patch
From:       Petri Damsten <petri.damsten () iki ! fi>
Date:       2007-06-25 8:06:06
Message-ID: 200706251106.06727.petri.damsten () iki ! fi
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Hi,

This patch would enable classes derived from QComboBox that have USER property 
set to true to be used in KConfigDialog.

Index: kdeui/dialogs/kconfigdialogmanager.cpp
===================================================================
--- kdeui/dialogs/kconfigdialogmanager.cpp      (revision 679959)
+++ kdeui/dialogs/kconfigdialogmanager.cpp      (working copy)
@@ -82,6 +82,7 @@
   if ( s_propertyMap->isEmpty() ) {
     s_propertyMap->insert( "KButtonGroup", "current" );
     s_propertyMap->insert( "KColorButton", "color" );
+    s_propertyMap->insert( "KColorCombo", "color" );
     //s_propertyMap->insert( "KUrlRequester", "url" );
     //s_propertyMap->insert( "KUrlComboRequester", "url" );
   }
@@ -120,6 +121,7 @@
     s_changedMap->insert( "KFontRequester", SIGNAL(fontSelected(const QFont 
&)));
     s_changedMap->insert( "KFontChooser",  SIGNAL(fontSelected(const QFont 
&)));
     s_changedMap->insert( "KHistoryCombo", SIGNAL(activated (int)));
+    s_changedMap->insert( "KColorCombo", SIGNAL(activated (const QColor &)));

     s_changedMap->insert( "KColorButton", SIGNAL(changed(const QColor &)));
     s_changedMap->insert( "KDatePicker", SIGNAL(dateSelected (QDate)));
@@ -412,23 +414,22 @@
     return;
   }

-  QComboBox *cb = qobject_cast<QComboBox *>(w);
-  if (cb) {
-    if ( cb->isEditable() )
-    {
-      int i = cb->findText(v.toString());
-      if (i != -1)
-          cb->setCurrentIndex(i);
-      else
-          cb->setEditText(v.toString());
-    } else {
-      cb->setCurrentIndex( v.toInt() );
-    }
-    return;
-  }
-
   QByteArray userproperty = getUserProperty( w );
   if ( userproperty.isEmpty() ) {
+    QComboBox *cb = qobject_cast<QComboBox *>(w);
+    if (cb) {
+        if ( cb->isEditable() )
+        {
+            int i = cb->findText(v.toString());
+            if (i != -1)
+                cb->setCurrentIndex(i);
+            else
+                cb->setEditText(v.toString());
+        } else {
+            cb->setCurrentIndex( v.toInt() );
+        }
+        return;
+    }
     kWarning(178) << w->metaObject()->className() << " widget not handled!" 
<< endl;
     return;
   }
@@ -441,15 +442,15 @@
   if (bg && bg->checkedButton())
     return QVariant(bg->id(bg->checkedButton()));

-  QComboBox *cb = qobject_cast<QComboBox *>(w);
-  if (cb) {
-    if ( cb->isEditable() )
-      return QVariant(cb->currentText());
-    else
-      return QVariant(cb->currentIndex());
-  }
   QByteArray userproperty = getUserProperty( w );
   if ( userproperty.isEmpty() ) {
+    QComboBox *cb = qobject_cast<QComboBox *>(w);
+    if (cb) {
+        if ( cb->isEditable() )
+            return QVariant(cb->currentText());
+        else
+            return QVariant(cb->currentIndex());
+    }
     kWarning(178) << w->metaObject()->className() << " widget not handled!" 
<< endl;
     return QVariant();
   }

Petri

-- 
If you're not part of the solution, be part of the problem!

["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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