[Uml-devel] branches/KDE/3.5/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Mon Nov 27 21:34:44 UTC 2006


SVN commit 608556 by okellogg:

Apply AddStereotypeListSelectionToParamDlg.diff by Achim Spangler at
http://www.geeksoc.org/~jr/umbrello/uml-devel/9862.html
> the parameter dialog has until now only a raw input text (lineedit) field,
> so that the user might create some redundant new stereotypes just by
> differring writing.  I integrated the KComboBox implementation from the
> operation dialog to the parameter dialog.


 M  +6 -0      ChangeLog  
 M  +35 -6     umbrello/dialogs/parmpropdlg.cpp  
 M  +7 -2      umbrello/dialogs/parmpropdlg.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #608555:608556
@@ -3,6 +3,12 @@
 * Fixed save/reload of association widgets for collaboration diagrams
   http://www.geeksoc.org/~jr/umbrello/uml-devel/9825.html
   http://www.geeksoc.org/~jr/umbrello/uml-devel/9857.html
+* Fixed crash in ToolBarStateArrow destructor
+  http://www.geeksoc.org/~jr/umbrello/uml-devel/9861.html
+* Stereotype selection list for parameter properties dialog
+  http://www.geeksoc.org/~jr/umbrello/uml-devel/9862.html
+* Note widget is now always drawn on TOP of all widgets
+  http://www.geeksoc.org/~jr/umbrello/uml-devel/9863.html
 * Bugs/wishes from http://bugs.kde.org:
 * Artifacts of a component diagram are wrongly placed in Deployment View folder (137564)
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/parmpropdlg.cpp #608555:608556
@@ -27,6 +27,7 @@
 #include "../umldoc.h"
 #include "../dialog_utils.h"
 #include "../object_factory.h"
+#include "../stereotype.h"
 
 ParmPropDlg::ParmPropDlg(QWidget * parent, UMLDoc * doc, UMLAttribute * a)
         : KDialogBase(Plain, i18n("Parameter Properties"), Help | Ok | Cancel , Ok, parent, "_PARMPROPDLG_", true, true)
@@ -71,9 +72,10 @@
                                     m_pInitialL, i18n("&Initial value:"),
                                     m_pInitialLE, initialValue );
 
-    Dialog_Utils::makeLabeledEditField( m_pParmGB, propLayout, 3,
-                                    m_pStereoTypeL, i18n("&Stereotype name:"),
-                                    m_pStereoTypeLE, m_pAtt->getStereotype() );
+    m_pStereoTypeL = new QLabel( i18n("Stereotype name:"), m_pParmGB );
+    propLayout -> addWidget(m_pStereoTypeL, 3, 0);
+    m_pStereoTypeCB = new KComboBox(true, m_pParmGB );
+    propLayout -> addWidget(m_pStereoTypeCB, 3, 1);
 
     m_pKind =  new QButtonGroup(i18n("Passing Direction"), plainPage());
     m_pKind->setExclusive(true);
@@ -157,12 +159,33 @@
         m_pTypeCB->setCurrentItem(0);
     }
 
+    // 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
+    int defaultStereotype=0;
+    bool foundDefaultStereotype = false;
+    for (UMLStereotypeListIt it(m_pUmldoc->getStereotypes()); it.current(); ++it) {
+        if (!foundDefaultStereotype) {
+            if ( m_pAtt->getStereotype() == it.current()->getName()) {
+                foundDefaultStereotype = true;
+            }
+            defaultStereotype++;
+        }
+        insertStereotype (it.current()->getName());
+    }
+    // lookup for a default stereotype, if the operation doesn't have one
+    if (foundDefaultStereotype)
+        m_pStereoTypeCB->setCurrentItem(defaultStereotype);
+    else
+        m_pStereoTypeCB->setCurrentItem(-1);
+
     // set tab order
     setTabOrder(m_pKind, m_pTypeCB);
     setTabOrder(m_pTypeCB, m_pNameLE);
     setTabOrder(m_pNameLE, m_pInitialLE);
-    setTabOrder(m_pInitialLE, m_pStereoTypeLE);
-    setTabOrder(m_pStereoTypeLE, m_pIn);
+    setTabOrder(m_pInitialLE, m_pStereoTypeCB);
+    setTabOrder(m_pStereoTypeCB, m_pIn);
     setTabOrder(m_pIn, m_pDoc);
 
     m_pNameLE->setFocus();
@@ -174,6 +197,12 @@
     m_pTypeCB->completionObject()->addItem( type );
 }
 
+void ParmPropDlg::insertStereotype( const QString& type, int index )
+{
+    m_pStereoTypeCB->insertItem( type, index );
+    m_pStereoTypeCB->completionObject()->addItem( type );
+}
+
 Uml::Parameter_Direction ParmPropDlg::getParmKind() {
     Uml::Parameter_Direction pk = Uml::pd_In;
     if (m_pOut->isChecked())
@@ -186,7 +215,7 @@
 void ParmPropDlg::slotOk() {
     if (m_pAtt != NULL) {
         m_pAtt->setParmKind( getParmKind() );
-        m_pAtt->setStereotype( m_pStereoTypeLE->text() );
+        m_pAtt->setStereotype( m_pStereoTypeCB->currentText() );
         QString typeName = m_pTypeCB->currentText();
         UMLClassifier * pConcept = dynamic_cast<UMLClassifier*>( m_pAtt->parent()->parent() );
         if (pConcept == NULL) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/parmpropdlg.h #608555:608556
@@ -103,14 +103,19 @@
     */
     void insertType( const QString& type, int index = -1 );
 
+    /**
+     * Inserts @p type into the stereotype-combobox as well as its completion object.
+     */
+    void insertStereotype( const QString& type, int index = -1 );
 
+
 private:
     QGroupBox * m_pParmGB, * m_pDocGB;
     QButtonGroup *m_pKind;
     QRadioButton * m_pIn, * m_pOut, *m_pInOut;
     QLabel * m_pTypeL, * m_pNameL, * m_pInitialL, * m_pStereoTypeL;
-    KComboBox * m_pTypeCB;
-    QLineEdit * m_pNameLE, * m_pInitialLE, * m_pStereoTypeLE;
+    KComboBox * m_pTypeCB, * m_pStereoTypeCB;
+    QLineEdit * m_pNameLE, * m_pInitialLE;
     QMultiLineEdit * m_pDoc;
     UMLDoc * m_pUmldoc;
     UMLAttribute * m_pAtt;




More information about the umbrello-devel mailing list