[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun Dec 3 19:00:19 UTC 2006


SVN commit 610205 by okellogg:

Merge r607502:610188 from branches/KDE/3.5/kdesdk.
Use QComboBox::setCurrentIndex() in lieu of setCurrentItem.


 M  +1 -1      AUTHORS  
 M  +7 -0      ChangeLog  
 M  +24 -11    umbrello/codegenerators/sqlwriter.cpp  
 M  +3 -3      umbrello/dialogs/codegenerationoptionspage.cpp  
 M  +36 -7     umbrello/dialogs/parmpropdlg.cpp  
 M  +7 -2      umbrello/dialogs/parmpropdlg.h  
 M  +2 -2      umbrello/dialogs/settingsdlg.cpp  
 M  +1 -1      umbrello/dialogs/umlattributedialog.cpp  
 M  +1 -1      umbrello/dialogs/umlentityattributedialog.cpp  
 M  +1 -1      umbrello/dialogs/umloperationdialog.cpp  
 M  +1 -1      umbrello/dialogs/umltemplatedialog.cpp  
 M  +3 -0      umbrello/model_utils.cpp  
 M  +3 -1      umbrello/notewidget.cpp  
 M  +0 -1      umbrello/toolbarstatearrow.cpp  
 M  +10 -6     umbrello/uml.cpp  
 M  +0 -2      umbrello/umldoc.cpp  
 M  +3 -0      umbrello/umlview.cpp  
 M  +6 -6      umbrello/umlview.h  
 M  +1 -1      umbrello/umlwidget.cpp  


--- trunk/KDE/kdesdk/umbrello/AUTHORS #610204:610205
@@ -11,4 +11,4 @@
 * Brian Thomas (advanced code generators, associations, various)
 * Oliver Kellogg (many areas)
 * Daniel Calviño Sánchez (refactoring, UI behavior)
-
+* Achim Spangler (countless bugfixes)
--- trunk/KDE/kdesdk/umbrello/ChangeLog #610204:610205
@@ -3,8 +3,15 @@
 * 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)
+* Incorrect export to SQL (138139)
 
 Version 1.5.52
 
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/sqlwriter.cpp #610204:610205
@@ -83,6 +83,9 @@
     if (isClass)
         writeAttributes(c, sql);
 
+    sql << m_endl << ");" << m_endl;
+
+    QMap<UMLAssociation*,UMLAssociation*> constraintMap; // so we don't repeat constraint
     UMLAssociationList aggregations = c->getAggregations();
     if( forceSections() || !aggregations.isEmpty() ) {
         for(UMLAssociation* a = aggregations.first(); a; a = aggregations.next()) {
@@ -90,18 +93,20 @@
             UMLObject *objB = a->getObject(Uml::B);
             if (objA->getID() == c->getID() && objB->getID() != c->getID())
                 continue;
-            QString roleNameA = a->getRoleName(Uml::A);
-            QString roleNameB = a->getRoleName(Uml::B);
-            if (roleNameA.isEmpty() || roleNameB.isEmpty())
-                continue;
-            sql << m_indentation << "," << m_endl;
-            sql << m_indentation << "CONSTRAINT " << a->getName()
-                << " FOREIGN KEY (" << roleNameB << ") REFERENCES "
-                << objA->getName() << " (" << roleNameA << ")";
+	    constraintMap[a] = a;
         }
     }
+    
+    QMap<UMLAssociation*,UMLAssociation*>::Iterator itor = constraintMap.begin();
+    for (;itor != constraintMap.end();itor++) {
+	UMLAssociation* a = itor.data();
+	sql << "ALTER TABLE "<< classname
+            << " ADD CONSTRAINT " << a->getName() << " FOREIGN KEY ("
+            << a->getRoleName(Uml::B) << ") REFERENCES "
+            << a->getObject(Uml::A)->getName()
+            << " (" << a->getRoleName(Uml::A) << ");" << m_endl;
+    }
 
-    sql << m_endl << ");" << m_endl;
 
     file.close();
     emit codeGenerated(c, true);
@@ -109,10 +114,11 @@
 
 
 void SQLWriter::writeAttributes(UMLClassifier *c, QTextStream &sql) {
-    UMLAttributeList atpub, atprot, atpriv;
+    UMLAttributeList atpub, atprot, atpriv, atimp;
     atpub.setAutoDelete(false);
     atprot.setAutoDelete(false);
     atpriv.setAutoDelete(false);
+    atimp.setAutoDelete(false);
 
     //sort attributes by scope and see if they have a default value
     UMLAttributeList atl = c->getAttributeList();
@@ -127,7 +133,8 @@
           case Uml::Visibility::Private:
             atpriv.append(at);
             break;
-          default:
+          case Uml::Visibility::Implementation:
+            atimp.append(at);
             break;
         }
     }
@@ -155,6 +162,12 @@
         first = false;
     }
 
+    if (atimp.count() > 0)
+    {
+        printAttributes(sql, atimp, first);
+        first = false;
+    }
+
     return;
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/codegenerationoptionspage.cpp #610204:610205
@@ -61,8 +61,8 @@
     m_headingsDir->setText(policy->getHeadingFileDir());
     m_overwriteGroup->setButton(overwriteToInteger(policy->getOverwritePolicy()));
 
-    m_SelectEndLineCharsBox->setCurrentItem(newLineToInteger(policy->getLineEndingType()));
-    m_SelectIndentationTypeBox->setCurrentItem(indentTypeToInteger(policy->getIndentationType()));
+    m_SelectEndLineCharsBox->setCurrentIndex(newLineToInteger(policy->getLineEndingType()));
+    m_SelectIndentationTypeBox->setCurrentIndex(indentTypeToInteger(policy->getIndentationType()));
     m_SelectIndentationNumber->setValue(policy->getIndentationAmount());
 
     connect(this,SIGNAL(syncCodeDocumentsToParent()),gen,SLOT(syncCodeToDocument()));
@@ -81,7 +81,7 @@
         m_SelectLanguageBox->insertItem(language, indexCounter);
         indexCounter++;
     }
-    m_SelectLanguageBox->setCurrentItem(UMLApp::app()->getActiveLanguage());
+    m_SelectLanguageBox->setCurrentIndex(UMLApp::app()->getActiveLanguage());
 }
 
 int CodeGenerationOptionsPage::indentTypeToInteger(CodeGenerationPolicy::IndentationType value) {
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/parmpropdlg.cpp #610204:610205
@@ -32,6 +32,7 @@
 #include "../umldoc.h"
 #include "../dialog_utils.h"
 #include "../object_factory.h"
+#include "../stereotype.h"
 
 ParmPropDlg::ParmPropDlg(QWidget * parent, UMLDoc * doc, UMLAttribute * a)
         : KDialog(parent)
@@ -84,9 +85,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 Q3ButtonGroup(i18n("Passing Direction"), frame);
     m_pKind->setExclusive(true);
@@ -167,15 +169,36 @@
 
     if (!foundType) {
         insertType( type, 0 );
-        m_pTypeCB->setCurrentItem(0);
+        m_pTypeCB->setCurrentIndex(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->setCurrentIndex(defaultStereotype);
+    else
+        m_pStereoTypeCB->setCurrentIndex(-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();
@@ -187,6 +210,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())
@@ -199,7 +228,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) {
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/parmpropdlg.h #610204:610205
@@ -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:
     Q3GroupBox * m_pParmGB, * m_pDocGB;
     Q3ButtonGroup *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;
     Q3MultiLineEdit * m_pDoc;
     UMLDoc * m_pUmldoc;
     UMLAttribute * m_pAtt;
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/settingsdlg.cpp #610204:610205
@@ -380,7 +380,7 @@
         m_GeneralWidgets.logoCB -> setChecked( true );
         m_GeneralWidgets.tipCB -> setChecked( true );
         m_GeneralWidgets.loadlastCB -> setChecked( true );
-        m_GeneralWidgets.diagramKB -> setCurrentItem( 0 );
+        m_GeneralWidgets.diagramKB -> setCurrentIndex( 0 );
     }
     else if ( current == pageFont )
     {
@@ -403,7 +403,7 @@
         m_ClassWidgets.showOpSigCB -> setChecked( false );
         m_ClassWidgets.showPackageCB -> setChecked( false );
         m_ClassWidgets.m_pAttribScopeCB->setCurrentIndex(1); // Private
-        m_ClassWidgets.m_pOperationScopeCB->setCurrentItem(0); // Public
+        m_ClassWidgets.m_pOperationScopeCB->setCurrentIndex(0); // Public
     }
     else if (  current == pageCodeGen || current == pageCodeViewer )
     {
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umlattributedialog.cpp #610204:610205
@@ -146,7 +146,7 @@
 
     if (!foundType) {
         insertType( m_pAttribute->getTypeName(), 0 );
-        m_pTypeCB->setCurrentItem(0);
+        m_pTypeCB->setCurrentIndex(0);
     }
 
     m_pNameLE->setFocus();
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umlentityattributedialog.cpp #610204:610205
@@ -176,7 +176,7 @@
 
     if (!foundType) {
         insertType( m_pEntityAttribute->getTypeName(), 0 );
-        m_pTypeCB->setCurrentItem(0);
+        m_pTypeCB->setCurrentIndex(0);
     }
 
     m_pNameLE->setFocus();
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umloperationdialog.cpp #610204:610205
@@ -198,7 +198,7 @@
 
     if (!foundReturnType) {
         insertType( m_pOperation->getTypeName(), 0 );
-        m_pRtypeCB->setCurrentItem(0);
+        m_pRtypeCB->setCurrentIndex(0);
     }
 
     //fill in parm list box
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umltemplatedialog.cpp #610204:610205
@@ -107,7 +107,7 @@
 
     if (!foundType) {
         insertType( m_pTemplate->getTypeName(), 0 );
-        m_pTypeCB->setCurrentItem(0);
+        m_pTypeCB->setCurrentIndex(0);
     }
 
     m_pNameLE->setFocus();
--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.cpp #610204:610205
@@ -1071,6 +1071,9 @@
         case Uml::lvt_EntityAttribute:
             icon = Uml::it_Private_Attribute;
             break;
+        case Uml::lvt_EnumLiteral:
+            icon = Uml::it_Public_Attribute;
+            break;
         case Uml::lvt_Operation:
             icon = Uml::it_Public_Method;
             break;
--- trunk/KDE/kdesdk/umbrello/umbrello/notewidget.cpp #610204:610205
@@ -36,6 +36,7 @@
         : UMLWidget(view, id, new NoteWidgetController(this)) {
     init();
     setSize(100,80);
+    setZ( 20 ); //make sure always on top.
 #ifdef NOTEWIDGET_EMBED_EDITOR
     // NB: This code is currently deactivated because
     // Zoom does not yet work with the embedded text editor.
@@ -237,7 +238,7 @@
         } else {
             // all chars of text have been handled already ->
             // perform this last run to spool current content of "word"
-            c = returnChar; 
+            c = returnChar;
         }
         if (c == returnChar || c.isSpace()) {
             // new word delimiter found -> its time to decide on word wrap
@@ -304,6 +305,7 @@
 bool NoteWidget::loadFromXMI( QDomElement & qElement ) {
     if( !UMLWidget::loadFromXMI( qElement ) )
         return false;
+    setZ( 20 ); //make sure always on top.
     setDoc( qElement.attribute("text", "") );
     QString diagramlink = qElement.attribute("diagramlink", "");
     if (!diagramlink.isEmpty())
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatearrow.cpp #610204:610205
@@ -28,7 +28,6 @@
 }
 
 ToolBarStateArrow::~ToolBarStateArrow() {
-    m_selectionRect.clear();
 }
 
 void ToolBarStateArrow::init() {
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #610204:610205
@@ -1666,14 +1666,18 @@
     m_view = view;
     if (m_viewStack == NULL)
         return;
+    if (view == NULL) {
+        kError() << "UMLApp::setCurrentView: view is NULL" << endl;
+        return;
+    }
+    if (m_viewStack->indexOf(view) < 0)
+        m_viewStack->addWidget(view);
     m_viewStack->setCurrentWidget(view);
     kapp->processEvents();
-    if (view) {
-        slotStatusMsg(view->getName());
-        UMLListViewItem* lvitem = m_listView->findView(view);
-        if (lvitem)
-            m_listView->setCurrentItem(lvitem);
-    }
+    slotStatusMsg(view->getName());
+    UMLListViewItem* lvitem = m_listView->findView(view);
+    if (lvitem)
+        m_listView->setCurrentItem(lvitem);
 }
 
 UMLView* UMLApp::getCurrentView() {
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #610204:610205
@@ -1562,7 +1562,6 @@
         UMLApp::app()->setGenerator(UMLApp::app()->getDefaultLanguage());
     emit sigWriteToStatusBar( i18n("Setting up the document...") );
     kapp->processEvents();  // give UI events a chance
-    UMLApp::app()->setCurrentView(NULL);
     activateAllViews();
 
     UMLView *viewToBeSet = NULL;
@@ -1840,7 +1839,6 @@
 void UMLDoc::removeAllViews() {
     for (int i = 0; i < Uml::N_MODELTYPES; i++)
         m_root[i]->removeAllViews();
-    UMLApp::app()->setCurrentView(NULL);
     emit sigDiagramChanged(dt_Undefined);
     UMLApp::app()->setDiagramMenuItemsState(false);
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/umlview.cpp #610204:610205
@@ -199,6 +199,9 @@
     blockSignals( true );
     removeAllWidgets();
 
+    delete m_pToolBarStateFactory;
+    m_pToolBarStateFactory = NULL;
+
     // Qt Doc for QCanvasView::~QCanvasView () states:
     // "Destroys the canvas view. The associated canvas is not deleted."
     // we should do it now
--- trunk/KDE/kdesdk/umbrello/umbrello/umlview.h #610204:610205
@@ -53,12 +53,12 @@
 class ToolBarState;
 class ToolBarStateFactory;
 
-/** The UMLView class provides the view widget for the UMLApp
- * instance.  The View instance inherits QWidget as a base class and
- * represents the view object of a KMainWindow. As UMLView is part of
- * the document-view model, it needs a reference to the document
- * object connected with it by the UMLApp class to manipulate and
- * display the document structure provided by the UMLDoc class.
+/**
+ * UMLView instances represent diagrams.
+ * The UMLApp instance manages a QWidgetStack of UMLView instances.
+ * The visible diagram is at the top of stack.
+ * The UMLView class inherits from QCanvasView and it owns the
+ * objects displayed on its related QCanvas (see m_WidgetList.)
  *
  * @author Paul Hensgen <phensgen at techie.com>
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidget.cpp #610204:610205
@@ -706,7 +706,7 @@
             << bkgnd->getZ() + 1 << ", SelectState: " << _select << endl;
         setZ( bkgnd->getZ() + 1 );
     } else {
-        setZ( 0 );
+        setZ( m_origZ );
     }
 
     update();




More information about the umbrello-devel mailing list