[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Oct 28 08:34:11 UTC 2006


SVN commit 599696 by okellogg:

merge from branches/KDE/3.5 (r597266:599346)

 M  +2 -0      ChangeLog  
 M  +1 -1      VERSION  
 M  +51 -35    make-umbrello-release.sh  
 M  +1 -1      umbrello/object_factory.cpp  
 M  +13 -4     umbrello/package.cpp  
 M  +31 -2     umbrello/uml.cpp  
 M  +21 -9     umbrello/umlcanvasobject.cpp  
 M  +2 -0      umbrello/umlcanvasobject.h  
 M  +9 -5      umbrello/umldoc.cpp  
 M  +11 -8     umbrello/umllistview.cpp  
 M  +7 -7      umbrello/umllistview.h  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #599695:599696
@@ -2,6 +2,8 @@
 
 * Bugs/wishes from http://bugs.kde.org:
 * Accessor methods are private instead of public (85553)
+* Crash when opening a document (135749)
+* Shift + Left and Shift+Right causes SIGSEGV (136288)
 
 Version 1.5.5
 
--- trunk/KDE/kdesdk/umbrello/VERSION #599695:599696
@@ -1 +1 @@
-1.5.5
+1.5.52
--- trunk/KDE/kdesdk/umbrello/make-umbrello-release.sh #599695:599696
@@ -1,40 +1,56 @@
-#!/bin/bash
-export CVSROOT=:ext:jriddell at cvs.kde.org:/home/kde
-export KDETAG=KDE_3_4_0_ALPHA_1
-export UMBRELLO_VERSION=1.4.0alpha1
-cvs export -l -r $KDETAG kdesdk
-cvs export -l -r $KDETAG kdesdk/doc
-cvs export -r $KDETAG kdesdk/doc/umbrello 
-cvs export -r $KDETAG kdesdk/umbrello 
-
-mv kdesdk umbrello-${UMBRELLO_VERSION}
-cd umbrello-${UMBRELLO_VERSION}
-cp -r ~/devel/kdesdk/admin .
+#!/bin/sh
+#
+# Make a release from the current branches/KDE/3.5/kdesdk/umbrello
+#
+# Run this script as follows:
+#   . make-umbrello-release.sh VERSION [KDEUSER]
+# where VERSION is to be replaced by the version to release
+# and KDEUSER is to be replaced by your KDE SVN user name
+# (only required if you're not jriddell.)
+#
+# The release tarfile will be placed in /tmp/kdesdk.
+# 
+version=$1
+user=$2
+if [ "X$user" = "X" ]; then
+  user=jriddell
+fi
+origdir=`pwd`
+udir=umbrello-$version
+cd /tmp
+svn co -N svn+ssh://${user}@svn.kde.org:/home/kde/branches/KDE/3.5/kdesdk
+cd kdesdk
+svn co svn+ssh://${user}@svn.kde.org:/home/kde/branches/KDE/3.5/kdesdk/scripts
+svn co svn+ssh://${user}@svn.kde.org:/home/kde/branches/KDE/3.5/kdesdk/umbrello $udir
+svn co svn+ssh://${user}@svn.kde.org:/home/kde/branches/KDE/3.5/kde-common/admin $udir/admin
+svn co -N svn+ssh://${user}@svn.kde.org:/home/kde/branches/KDE/3.5/kdesdk/doc $udir/doc
+svn co    svn+ssh://${user}@svn.kde.org:/home/kde/branches/KDE/3.5/kdesdk/doc/umbrello $udir/doc/umbrello
+find . -type d -a -name .svn -exec /bin/rm -rf {} \;
+cp -p Makefile.cvs $udir/
+cd $udir
+mv configure.in.in configure.in.in.orig
+echo '#MIN_CONFIG'                  > configure.in.in
+echo 'KDE_ENABLE_HIDDEN_VISIBILITY' >> configure.in.in
+echo 'CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"' >> configure.in.in
+echo ''                                           >> configure.in.in
+cat configure.in.in.orig                          >> configure.in.in
+rm configure.in.in.orig
+perl -p -e 's at umbrello/VERSION at VERSION@g' -i `find umbrello -name Makefile.am`
+cd /tmp
+kdesdk/scripts/svn2dist kdesdk $udir -n umbrello --admin-dir kdesdk/$udir/admin -o
+mv umbrello/po kdesdk/$udir/
+rm -rf umbrello
+cd kdesdk/$udir
 make -f Makefile.cvs
-
-cp umbrello/README .
-cp umbrello/AUTHORS .
-cp umbrello/INSTALL .
-cp umbrello/TODO .
-#KDE 3.4 cp umbrello/THANKS .
-rm kdesdk.lsm
-cp umbrello/uml.lsm .
-cp umbrello/ChangeLog .
-
 cd ..
-tar cfvj umbrello-${UMBRELLO_VERSION}.tar.bz2 umbrello-${UMBRELLO_VERSION}
+tarfile=${udir}.tar.bz2
+tar cfvj $tarfile $udir
+mv $tarfile $origdir/
+cd $origdir
+# rm -rf /tmp/kdesdk
 
-#test
-rm -rf umbrello-${UMBRELLO_VERSION}
-tar xfvj umbrello-${UMBRELLO_VERSION}.tar.bz2
-cd umbrello-${UMBRELLO_VERSION}
-./configure --prefix=/usr
-make
-cd umbrello/umbrello
-./umbrello
-
-cd ../../..
-echo upload to upload.sf.net
-echo wput umbrello-${UMBRELLO_VERSION}.tar.bz2 ftp://upload.sf.net/incoming/
+echo upload $tarfile to upload.sf.net
+echo wput $tarfile ftp://upload.sf.net/incoming/
 echo update uml.sf.net including uploading ChangeLog
 echo advertise on freshmeat and kde-apps
+
--- trunk/KDE/kdesdk/umbrello/umbrello/object_factory.cpp #599695:599696
@@ -244,7 +244,7 @@
         if (!stereoID.isEmpty()) {
             UMLDoc *doc = UMLApp::app()->getDocument();
             UMLObject *stereo = doc->findStereotypeById(STR2ID(stereoID));
-            if (stereo->getName() == "folder")
+            if (stereo && stereo->getName() == "folder")
                 pObject = new UMLFolder();
         }
         if (pObject == NULL)
--- trunk/KDE/kdesdk/umbrello/umbrello/package.cpp #599695:599696
@@ -76,17 +76,24 @@
 }
 
 void UMLPackage::removeObject(const UMLObject *pObject) {
-    m_objects.remove( pObject );
+    if (pObject->getBaseType() == Uml::ot_Association) {
+        UMLObject *o = const_cast<UMLObject*>(pObject);
+        UMLAssociation *assoc = static_cast<UMLAssociation*>(o);
+        UMLCanvasObject::removeAssociation(assoc);
+        delete assoc;
+    } else {
+        m_objects.remove(pObject);
+    }
 }
 
 void UMLPackage::removeAllObjects() {
-    UMLCanvasObject::removeAllAssociations();
+    UMLCanvasObject::removeAllChildObjects();
     UMLObject *o;
     for (UMLObjectListIt oit(m_objects); (o = oit.current()) != NULL; ++oit) {
         UMLPackage *pkg = dynamic_cast<UMLPackage*>(o);
         if (pkg)
             pkg->removeAllObjects();
-        //delete o;
+        delete o;
     }
     m_objects.clear();
 }
@@ -184,8 +191,10 @@
     bool overallSuccess = UMLCanvasObject::resolveRef();
     for (UMLObjectListIt oit(m_objects); oit.current(); ++oit) {
         UMLObject *obj = oit.current();
-        if (! obj->resolveRef())
+        if (! obj->resolveRef()) {
+            m_objects.remove(obj);
             overallSuccess = false;
+        }
     }
     return overallSuccess;
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #599695:599696
@@ -1665,6 +1665,9 @@
     kapp->processEvents();
     if (view) {
         slotStatusMsg(view->getName());
+        UMLListViewItem* lvitem = m_listView->findView(view);
+        if (lvitem)
+            m_listView->setCurrentItem(lvitem);
     }
 }
 
@@ -1697,11 +1700,37 @@
 }
 
 void UMLApp::slotChangeTabLeft() {
-    m_tabWidget->setCurrentPage( m_tabWidget->currentPageIndex() - 1 );
+    if (m_tabWidget) {
+        m_tabWidget->setCurrentPage( m_tabWidget->currentPageIndex() - 1 );
+        return;
+    }
+    UMLViewList views = m_doc->getViewIterator();
+    UMLView *currView = m_view;
+    if (views.find(currView) < 0) {
+        kError() << "UMLApp::slotChangeTabLeft(): currView not found in viewlist" << endl;
+        return;
+    }
+    if ((currView = views.prev()) != NULL)
+        setCurrentView(currView);
+    else
+        setCurrentView(views.last());
 }
 
 void UMLApp::slotChangeTabRight() {
-    m_tabWidget->setCurrentPage( m_tabWidget->currentPageIndex() + 1 );
+    if (m_tabWidget) {
+        m_tabWidget->setCurrentPage( m_tabWidget->currentPageIndex() + 1 );
+        return;
+    }
+    UMLViewList views = m_doc->getViewIterator();
+    UMLView *currView = m_view;
+    if (views.find(currView) < 0) {
+        kError() << "UMLApp::slotChangeTabRight(): currView not found in viewlist" << endl;
+        return;
+    }
+    if ((currView = views.next()) != NULL)
+        setCurrentView(currView);
+    else
+        setCurrentView(views.first());
 }
 
 void UMLApp::slotMoveTabLeft() {
--- trunk/KDE/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #599695:599696
@@ -85,7 +85,7 @@
 int UMLCanvasObject::removeAssociation(UMLAssociation * assoc) {
     if(!hasAssociation(assoc) || !m_List.remove(assoc)) {
         kWarning() << "UMLCanvasObject::removeAssociation: "
-            << "can't find assoc given in list" << endl;
+            << "can't find given assoc in list" << endl;
         return -1;
     }
     emit modified();
@@ -95,17 +95,19 @@
 
 void UMLCanvasObject::removeAllAssociations() {
     UMLObject *o;
-    for (UMLObjectListIt oit(m_List); (o = oit.current()) != NULL; ++oit) {
-        if (o->getBaseType() != Uml::ot_Association)
+    for (UMLObjectListIt oit(m_List); (o = oit.current()) != NULL; ) {
+        if (o->getBaseType() != Uml::ot_Association) {
+            ++oit;
             continue;
+        }
         UMLAssociation *assoc = static_cast<UMLAssociation*>(o);
         //umldoc->slotRemoveUMLObject(assoc);
         UMLObject* objA = assoc->getObject(Uml::A);
         UMLObject* objB = assoc->getObject(Uml::B);
         UMLCanvasObject *roleAObj = dynamic_cast<UMLCanvasObject*>(objA);
-        if (roleAObj)
+        if (roleAObj) {
             roleAObj->removeAssociation(assoc);
-        else if (objA)
+        } else if (objA)
             kDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name
                 << "): objA " << objA->getName() << " is not a UMLCanvasObject"
                 << endl;
@@ -113,19 +115,27 @@
             kDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name
                 << "): objA is NULL" << endl;
         UMLCanvasObject *roleBObj = dynamic_cast<UMLCanvasObject*>(objB);
-        if (roleBObj)
+        if (roleBObj) {
             roleBObj->removeAssociation(assoc);
-        else if (objB)
+        } else if (objB)
             kDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name
                 << "): objB " << objB->getName() << " is not a UMLCanvasObject"
                 << endl;
         else
             kDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name
                 << "): objB is NULL" << endl;
-        //delete assoc;  should not do this here, we are only a CLIENT of the assoc
+        m_List.remove(assoc);
+        //delete assoc;  //CHECK: Apparently we crash if doing this. WHY?
     }
 }
 
+void UMLCanvasObject::removeAllChildObjects() {
+    removeAllAssociations();
+    m_List.setAutoDelete(true);
+    m_List.clear();
+    m_List.setAutoDelete(false);
+}
+
 QString UMLCanvasObject::uniqChildName( const Uml::Object_Type type,
                                         bool seekStereo /* = false */ ) {
     QString currentName;
@@ -289,8 +299,10 @@
     bool overallSuccess = UMLObject::resolveRef();
     for (UMLObjectListIt ait(m_List); ait.current(); ++ait) {
         UMLObject *obj = ait.current();
-        if (! obj->resolveRef())
+        if (! obj->resolveRef()) {
+            m_List.remove(obj);
             overallSuccess = false;
+        }
     }
     return overallSuccess;
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/umlcanvasobject.h #599695:599696
@@ -188,6 +188,8 @@
     virtual QString uniqChildName(const Uml::Object_Type type,
                                   bool seekStereo = false);
 
+    virtual void removeAllChildObjects();
+
     /**
      * Return the list of subordinate items.
      */
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #599695:599696
@@ -113,10 +113,10 @@
         i18n("Entity Relationship Model")
     };
     for (int i = 0; i < Uml::N_MODELTYPES; i++) {
-        m_root[i] = new UMLFolder(nativeRootName[i]);
+        m_root[i] = new UMLFolder(nativeRootName[i], STR2ID(nativeRootName[i]));
         m_root[i]->setLocalName(localizedRootName[i]);
     }
-    m_datatypeRoot = new UMLFolder("Datatypes");
+    m_datatypeRoot = new UMLFolder("Datatypes", "Datatypes");
     m_datatypeRoot->setLocalName(i18n("Datatypes"));
     m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]);
     m_root[Uml::mt_Logical]->addObject(m_datatypeRoot);
@@ -297,7 +297,7 @@
         for (int i = 0; i < Uml::N_MODELTYPES; i++)
             m_root[i]->removeAllObjects();
         // Restore the datatype folder, it has been deleted above.
-        m_datatypeRoot = new UMLFolder("Datatypes");
+        m_datatypeRoot = new UMLFolder("Datatypes", "Datatypes");
         m_datatypeRoot->setLocalName(i18n("Datatypes"));
         m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]);
         m_root[Uml::mt_Logical]->addObject(m_datatypeRoot);
@@ -831,7 +831,8 @@
 }
 
 UMLStereotype* UMLDoc::findStereotype(const QString &name) {
-    for (UMLStereotype *s = m_stereoList.first(); s; s = m_stereoList.next() ) {
+    UMLStereotype *s;
+    for (UMLStereotypeListIt it(m_stereoList); (s = it.current()) != NULL; ++it) {
         if (s->getName() == name)
             return s;
     }
@@ -1781,7 +1782,10 @@
         }
         if (ot == ot_Stereotype) {
             UMLStereotype *s = static_cast<UMLStereotype*>(pObject);
-            addStereotype(s);
+            if (findStereotype(s->getName()) != NULL)
+                delete s;
+            else
+                addStereotype(s);
             continue;
         }
         pkg->addObject(pObject);
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #599695:599696
@@ -135,6 +135,7 @@
     m_rv = NULL;
     for (int i = 0; i < Uml::N_MODELTYPES; i++)
         m_lv[i] = NULL;
+    m_datatypeFolder = NULL;
     //setup slots/signals
     connect(this, SIGNAL(dropped(QDropEvent *, Q3ListViewItem *, Q3ListViewItem *)),
             this, SLOT(slotDropped(QDropEvent *, Q3ListViewItem *, Q3ListViewItem *)));
@@ -1808,13 +1809,10 @@
 }
 
 void UMLListView::addNewItem(UMLListViewItem *parentItem, Uml::ListView_Type type) {
-    QString name;
+     if (type == Uml::lvt_Datatype) {
+         parentItem = m_datatypeFolder;
+     }
 
-    //// CHECK: Why?
-    // if (type == Uml::lvt_Datatype) {
-    //     parentItem = m_datatypeFolder;
-    // }
-
     UMLPackage *parentPkg = dynamic_cast<UMLPackage*>(parentItem->getUMLObject());
     if (parentPkg == NULL)
         kError() << "UMLListView::addNewItem(type " << type
@@ -1824,6 +1822,7 @@
 
     Uml::Icon_Type icon = Model_Utils::convert_LVT_IT(type);
 
+    QString name;
     if (Model_Utils::typeIsDiagram(type)) {
         Uml::Diagram_Type dt = Model_Utils::convert_LVT_DT(type);
         name = getUniqueDiagramName(dt);
@@ -2351,6 +2350,7 @@
                 if (parentPkg == NULL) {
                     kError() << pfx << "umlParent(" << umlParent << ") is not a UMLPackage"
                         << endl;
+                    domElement = node.toElement();
                     continue;
                 }
                 UMLFolder *f = new UMLFolder(label, nID);
@@ -2431,10 +2431,12 @@
                 // one of the default predefined folders, but the actual
                 // listview item might be located in a user created folder.
                 // Thanks to Achim Spangler for spotting the problem.
+                UMLListViewItem *itmParent = dynamic_cast<UMLListViewItem*>(item->parent());
+                kDebug() << pfx << parent->getText() << " (" << parent << ") != "
+                    << itmParent->getText() << " (" << itmParent << ")" << endl;
                 UMLListViewItem *newItem = moveObject(nID, lvType, parent);
                 item = newItem;
                 if (item) {
-                    UMLListViewItem *itmParent = dynamic_cast<UMLListViewItem*>(item->parent());
                     kDebug() << pfx << "Attempted reparenting of " << item->getText()
                         << "(current parent: " << (itmParent ? itmParent->getText() : "NULL")
                         << ", new parent: " << parent->getText() << ")" << endl;
@@ -2581,7 +2583,8 @@
     if ( !parent ) {
         return;
     }
-
+    if (parent == m_lv[Uml::mt_Logical])
+        m_datatypeFolder = NULL;
     while ( parent->firstChild() ) {
         delete parent->firstChild();
     }
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.h #599695:599696
@@ -190,6 +190,13 @@
     UMLListViewItem * findUMLObject(const UMLObject *p) const;
 
     /**
+     * Searches through the tree for the item which represents the diagram given
+     * @param the diagram to search for
+     * @return the item which represents the diagram
+     */
+    UMLListViewItem * findView(UMLView *v);
+
+    /**
      * Searches through the tree for the item with the given ID.
      *
      * @param id                The ID to search for.
@@ -332,13 +339,6 @@
     UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *item, UMLObject *o);
 
     /**
-     * Searches through the tree for the item which represents the diagram given
-     * @param the diagram to search for
-     * @return the item which represents the diagram
-     */
-    UMLListViewItem * findView(UMLView *v);
-
-    /**
      * Return true if the given list view type can be expanded/collapsed.
      */
     static bool isExpandable(Uml::ListView_Type lvt);




More information about the umbrello-devel mailing list