[Uml-devel] KDE/kdesdk/umbrello/umbrello/dialogs

Sharan Rao sharanrao at gmail.com
Tue Nov 20 16:28:29 UTC 2007


SVN commit 739153 by sharan:

fix improper behaviour of stereotypes in Properties Dialog of Classifiers



 M  +7 -8      classgenpage.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classgenpage.cpp #739152:739153
@@ -239,24 +239,23 @@
     // manage stereotypes
     m_pStereoTypeCB -> setDuplicatesEnabled(false);//only allow one of each type in box
     m_pStereoTypeCB->setCompletionMode( KGlobalSettings::CompletionPopup );
-    insertStereotype (QString()); // an empty stereotype is the default
+    insertStereotype (QString(), 0); // an empty stereotype is the default
     int defaultStereotype=0;
     bool foundDefaultStereotype = false;
+    // start with 1 as first entry is blank string
+    int counter = 1;
     foreach (UMLStereotype* ust, m_pUmldoc->getStereotypes()) {
         if (!foundDefaultStereotype) {
             if ( m_pObject->getStereotype() == ust->getName()) {
                 foundDefaultStereotype = true;
+                defaultStereotype = counter;
             }
-            defaultStereotype++;
         }
-        insertStereotype (ust->getName());
+        insertStereotype (ust->getName(), counter++);
     }
-    // lookup for a default stereotype, if the operation doesn't have one
-    if (foundDefaultStereotype)
-        m_pStereoTypeCB -> setCurrentIndex(defaultStereotype);
-    else
-        m_pStereoTypeCB -> setCurrentIndex(-1);
 
+    m_pStereoTypeCB -> setCurrentIndex(defaultStereotype);
+
     ///////////
     m_pDoc->setWordWrap(Q3MultiLineEdit::WidgetWidth);
     //////////




More information about the umbrello-devel mailing list