Apply the attached patch to kdedsk to fix the problem cd kdedsk-3.5.6/umbrello patch -p1 -i attached_patch
So you see, not only it is easy but it took me around an hour home to provide a useable umbrello to users -- eric
diff -u -r -N umbrello-1.5.6/umbrello/clipboard/umlclipboard.cpp umbrello-1.5.61/umbrello/clipboard/umlclipboard.cpp --- umbrello-1.5.6/umbrello/clipboard/umlclipboard.cpp 2006-11-18 22:20:36.000000000 +0100 +++ umbrello-1.5.61/umbrello/clipboard/umlclipboard.cpp 2007-02-04 15:53:04.000000000 +0100 @@ -579,31 +579,45 @@ return false; } - bool objectAlreadyExists = false; UMLObject *obj = 0; - UMLObjectListIt object_it(objects); doc->setModified(true); idchanges = doc->getChangeLog(); + // Assume success if at least one child object could be pasted + if (objects.count()) + result = false; - while ( (obj=object_it.current()) != 0 ) { + for (UMLObjectListIt it(objects); (obj = it.current()) != NULL; ++it) { obj->setID(doc->assignNewID(obj->getID())); switch(obj->getBaseType()) { case Uml::ot_Attribute : { - if (parent->addAttribute(dynamic_cast<UMLAttribute*>(obj), idchanges)) { - //FIXME doc -> signalChildUMLObjectCreated(obj); + UMLObject *exist = parent->findChildObject(obj->getName(), Uml::ot_Attribute); + if (exist) { + QString newName = parent->uniqChildName(Uml::ot_Attribute, obj->getName()); + obj->setName(newName); + } + UMLAttribute *att = static_cast<UMLAttribute*>(obj); + if (parent->addAttribute(att, idchanges)) { + result = true; } else { - objectAlreadyExists = true; + kError() << "UMLClipboard::pasteClip5: " << parent->getName() + << "->addAttribute(" << att->getName() << ") failed" << endl; } break; } case Uml::ot_Operation : { - UMLClassifier * parent = dynamic_cast<UMLClassifier *>(lvitem -> getUMLObject()); - if (parent -> addOperation(dynamic_cast<UMLOperation*>(obj), idchanges)) { - //FIXME doc -> signalChildUMLObjectCreated(obj); + UMLOperation *op = static_cast<UMLOperation*>(obj); + UMLOperation *exist = parent->checkOperationSignature(op->getName(), op->getParmList()); + if (exist) { + QString newName = parent->uniqChildName(Uml::ot_Operation, obj->getName()); + op->setName(newName); + } + if (parent->addOperation(op, idchanges)) { + result = true; } else { - objectAlreadyExists = true; + kError() << "UMLClipboard::pasteClip5: " << parent->getName() + << "->addOperation(" << op->getName() << ") failed" << endl; } break; } @@ -611,11 +625,6 @@ kWarning() << "pasteing unknown children type in clip type 5" << endl; return false; } - ++object_it; - } - - if (objectAlreadyExists) { - pasteItemAlreadyExists(); } return result; diff -u -r -N umbrello-1.5.6/umbrello/codeimport/adaimport.cpp umbrello-1.5.61/umbrello/codeimport/adaimport.cpp --- umbrello-1.5.6/umbrello/codeimport/adaimport.cpp 2007-01-14 20:31:51.000000000 +0100 +++ umbrello-1.5.61/umbrello/codeimport/adaimport.cpp 2007-02-03 10:45:42.000000000 +0100 @@ -167,7 +167,7 @@ bool AdaImport::parseStmt() { const uint srcLength = m_source.count(); - const QString& keyword = m_source[m_srcIndex]; + QString keyword = m_source[m_srcIndex]; UMLDoc *umldoc = UMLApp::app()->getDocument(); //kDebug() << '"' << keyword << '"' << endl; if (keyword == "with") { @@ -258,7 +258,8 @@ } if (keyword == "type") { QString name = advance(); - if (advance() == "(") { + QString next = advance(); + if (next == "(") { kDebug() << "AdaImport::parseStmt(" << name << "): " << "discriminant handling is not yet implemented" << endl; // @todo Find out how to map discriminated record to UML. @@ -266,30 +267,30 @@ Import_Utils::createUMLObject(Uml::ot_Class, name, m_scope[m_scopeIndex], m_comment, "record"); skipStmt("end"); - if (m_source[++m_srcIndex] == "case") + if ((next = advance()) == "case") m_srcIndex += 2; // skip "case" ";" - // we are now positioned on "end" - m_srcIndex += 2; // skip "end" "record" - // we are now positioned on ";" + skipStmt(); return true; } - if (m_source[m_srcIndex] == ";") { + if (next == ";") { // forward declaration Import_Utils::createUMLObject(Uml::ot_Class, name, m_scope[m_scopeIndex], m_comment); return true; } - if (m_source[m_srcIndex] != "is") { + if (next != "is") { kError() << "AdaImport::parseStmt: expecting \"is\"" << endl; return false; } - if (advance() == "(") { + next = advance(); + if (next == "(") { // enum type UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Enum, name, m_scope[m_scopeIndex], m_comment); UMLEnum *enumType = static_cast<UMLEnum*>(ns); - while (++m_srcIndex < srcLength && m_source[m_srcIndex] != ")") { - Import_Utils::addEnumLiteral(enumType, m_source[m_srcIndex]); + while ((next = advance()) != ")") { + Import_Utils::addEnumLiteral(enumType, next, m_comment); + m_comment = QString(); if (advance() != ",") break; } @@ -297,24 +298,38 @@ return true; } bool isTaggedType = false; - if (m_source[m_srcIndex] == "abstract") { + if (next == "abstract") { m_isAbstract = true; - m_srcIndex++; + next = advance(); } - if (m_source[m_srcIndex] == "tagged") { + if (next == "tagged") { isTaggedType = true; - m_srcIndex++; - } - if (m_source[m_srcIndex] == "limited") { - m_srcIndex++; // we can't (yet?) represent that + next = advance(); } - if (m_source[m_srcIndex] == "private" || - m_source[m_srcIndex] == "record" || - (m_source[m_srcIndex] == "null" && + if (next == "limited" || + next == "task" || + next == "protected" || + next == "synchronized") { + next = advance(); // we can't (yet?) represent that + } + if (next == "private" || + next == "interface" || + next == "record" || + (next == "null" && m_source[m_srcIndex+1] == "record")) { - UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Class, - name, m_scope[m_scopeIndex], m_comment); - ns->setAbstract(m_isAbstract); + Uml::Object_Type t = (next == "interface" ? Uml::ot_Interface : Uml::ot_Class); + UMLObject *ns = Import_Utils::createUMLObject(t, name, m_scope[m_scopeIndex], m_comment); + if (t == Uml::ot_Interface) { + while ((next = advance()) == "and") { + UMLClassifier *klass = static_cast<UMLClassifier*>(ns); + QString base = expand(advance()); + UMLObject *p = Import_Utils::createUMLObject(Uml::ot_Interface, base, m_scope[m_scopeIndex]); + UMLClassifier *parent = static_cast<UMLClassifier*>(p); + Import_Utils::createGeneralization(klass, parent); + } + } else { + ns->setAbstract(m_isAbstract); + } m_isAbstract = false; if (isTaggedType) { if (! m_classesDefinedInThisScope.contains(ns)) @@ -322,15 +337,19 @@ } else { ns->setStereotype("record"); } - if (m_source[m_srcIndex] == "record") + if (next == "record") m_klass = static_cast<UMLClassifier*>(ns); else skipStmt(); return true; } - if (m_source[m_srcIndex] == "new") { + if (next == "new") { QString base = expand(advance()); - const bool isExtension = (advance() == "with"); + QStringList baseInterfaces; + while ((next = advance()) == "and") { + baseInterfaces.append(expand(advance())); + } + const bool isExtension = (next == "with"); Uml::Object_Type t; if (isExtension || m_isAbstract) { t = Uml::ot_Class; @@ -343,14 +362,23 @@ UMLClassifier *parent = static_cast<UMLClassifier*>(ns); ns = Import_Utils::createUMLObject(t, name, m_scope[m_scopeIndex], m_comment); if (isExtension) { - QString nextLexeme = advance(); - if (nextLexeme == "null" || nextLexeme == "record") { + next = advance(); + if (next == "null" || next == "record") { UMLClassifier *klass = static_cast<UMLClassifier*>(ns); Import_Utils::createGeneralization(klass, parent); - if (nextLexeme == "record") { + if (next == "record") { // Set the m_klass for attributes. m_klass = klass; } + if (baseInterfaces.count()) { + t = Uml::ot_Interface; + QStringList::Iterator end(baseInterfaces.end()); + for (QStringList::Iterator bi(baseInterfaces.begin()); bi != end; ++bi) { + ns = Import_Utils::createUMLObject(t, *bi, m_scope[m_scopeIndex]); + parent = static_cast<UMLClassifier*>(ns); + Import_Utils::createGeneralization(klass, parent); + } + } } } skipStmt(); @@ -385,6 +413,11 @@ skipStmt(); return true; } + // subprogram + if (keyword == "not") + keyword = advance(); + if (keyword == "overriding") + keyword = advance(); if (keyword == "function" || keyword == "procedure") { const QString& name = advance(); QString returnType; @@ -503,7 +536,7 @@ skipStmt(); return true; } - if (keyword == "for") { // rep spec (yuck) + if (keyword == "for") { // rep spec QString typeName = advance(); QString next = advance(); if (next == "'") { @@ -532,7 +565,10 @@ skipStmt(); return true; } - QString typeName = expand(advance()); + QString nextToken = advance(); + if (nextToken == "aliased") + nextToken = advance(); + QString typeName = expand(nextToken); QString initialValue; if (advance() == ":=") { initialValue = advance(); diff -u -r -N umbrello-1.5.6/umbrello/codeimport/import_utils.cpp umbrello-1.5.61/umbrello/codeimport/import_utils.cpp --- umbrello-1.5.6/umbrello/codeimport/import_utils.cpp 2007-01-14 15:05:00.000000000 +0100 +++ umbrello-1.5.61/umbrello/codeimport/import_utils.cpp 2007-02-03 21:41:26.000000000 +0100 @@ -344,8 +344,9 @@ return attr; } -void addEnumLiteral(UMLEnum *enumType, const QString &literal) { - enumType->addEnumLiteral( literal ); +void addEnumLiteral(UMLEnum *enumType, const QString &literal, const QString &comment) { + UMLObject *el = enumType->addEnumLiteral(literal); + el->setDoc(comment); } void createGeneralization(UMLClassifier *child, UMLClassifier *parent) { diff -u -r -N umbrello-1.5.6/umbrello/codeimport/import_utils.h umbrello-1.5.61/umbrello/codeimport/import_utils.h --- umbrello-1.5.6/umbrello/codeimport/import_utils.h 2006-12-17 23:56:13.000000000 +0100 +++ umbrello-1.5.61/umbrello/codeimport/import_utils.h 2007-02-03 21:41:26.000000000 +0100 @@ -107,7 +107,8 @@ /** * Add an enum literal to an UMLEnum. */ - void addEnumLiteral(UMLEnum *enumType, const QString &literal); + void addEnumLiteral(UMLEnum *enumType, const QString &literal, + const QString &comment = QString()); /** * Create a generalization from the given child classifier to the given diff -u -r -N umbrello-1.5.6/umbrello/dialogs/activitydialog.h umbrello-1.5.61/umbrello/dialogs/activitydialog.h --- umbrello-1.5.6/umbrello/dialogs/activitydialog.h 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/dialogs/activitydialog.h 2007-01-20 18:03:01.000000000 +0100 @@ -52,7 +52,7 @@ return m_bChangesMade; } -protected: +protected slots: enum Page { @@ -70,7 +70,7 @@ * Entered when Apply button pressed. */ void slotApply(); - +protected: /** * Sets up the pages of the dialog. */ diff -u -r -N umbrello-1.5.6/umbrello/dialogs/pkgcontentspage.cpp umbrello-1.5.61/umbrello/dialogs/pkgcontentspage.cpp --- umbrello-1.5.6/umbrello/dialogs/pkgcontentspage.cpp 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/dialogs/pkgcontentspage.cpp 2007-02-09 17:53:01.000000000 +0100 @@ -64,14 +64,16 @@ if (!i) return; int item = m_pContentLB -> currentItem(); - UMLObject *o = m_pPackage->containedObjects().at(item); + UMLObjectList contents = m_pPackage->containedObjects(); + UMLObject *o = contents.at(item); ClassPropDlg dlg(this, o, item, true); dlg.exec(); } void PkgContentsPage::fillListBox() { m_pContentLB->clear(); - UMLObjectListIt objList_it(m_pPackage->containedObjects()); + UMLObjectList contents = m_pPackage->containedObjects(); + UMLObjectListIt objList_it(contents); UMLObject* umlo = NULL; int i = 0; while ((umlo = objList_it.current()) != NULL) { @@ -107,8 +109,8 @@ switch(id) { case ListPopupMenu::mt_Delete: { - UMLObject *o = m_pPackage->containedObjects().at( - m_pContentLB->currentItem() ); + UMLObjectList contents = m_pPackage->containedObjects(); + UMLObject *o = contents.at( m_pContentLB->currentItem() ); UMLApp::app()->getDocument()->removeUMLObject(o); fillListBox(); } diff -u -r -N umbrello-1.5.6/umbrello/dialogs/settingsdlg.h umbrello-1.5.61/umbrello/dialogs/settingsdlg.h --- umbrello-1.5.6/umbrello/dialogs/settingsdlg.h 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/dialogs/settingsdlg.h 2007-01-20 18:03:01.000000000 +0100 @@ -165,9 +165,6 @@ KConfig * m_pCfg; bool m_bChangesApplied; - //signals -signals: - //slots private slots: void slotApply(); void slotOk(); diff -u -r -N umbrello-1.5.6/umbrello/dialogs/statedialog.h umbrello-1.5.61/umbrello/dialogs/statedialog.h --- umbrello-1.5.6/umbrello/dialogs/statedialog.h 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/dialogs/statedialog.h 2007-01-20 18:03:01.000000000 +0100 @@ -51,7 +51,7 @@ return m_bChangesMade; } -protected: +protected slots: enum Page { @@ -70,7 +70,7 @@ * Entered when Apply button pressed. */ void slotApply(); - +protected: /** * Sets up the pages of the dialog. */ diff -u -r -N umbrello-1.5.6/umbrello/objectwidget.cpp umbrello-1.5.61/umbrello/objectwidget.cpp --- umbrello-1.5.6/umbrello/objectwidget.cpp 2006-11-18 22:20:36.000000000 +0100 +++ umbrello-1.5.61/umbrello/objectwidget.cpp 2007-02-03 23:25:34.000000000 +0100 @@ -5,7 +5,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * copyright (C) 2002-2006 * + * copyright (C) 2002-2007 * * Umbrello UML Modeller Authors <[EMAIL PROTECTED]> * ***************************************************************************/ @@ -181,8 +181,13 @@ void ObjectWidget::moveEvent(QMoveEvent */*m*/) { emit sigWidgetMoved( m_nLocalID ); - if( m_pLine ) - m_pLine -> setStartPoint( getX() + width() / 2, getY() + height() ); + if (m_pLine) { + const int x = getX(); // for debugging: gdb has a problem evaluating getX() etc + const int w = width(); + const int y = getY(); + const int h = height(); + m_pLine->setStartPoint(x + w / 2, y + h); + } } void ObjectWidget::slotColorChanged(Uml::IDType /*viewID*/) { @@ -364,6 +369,10 @@ return false; } +SeqLineWidget *ObjectWidget::getSeqLine() { + return m_pLine; +} + void ObjectWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) { QDomElement objectElement = qDoc.createElement( "objectwidget" ); UMLWidget::saveToXMI( qDoc, objectElement ); diff -u -r -N umbrello-1.5.6/umbrello/objectwidget.h umbrello-1.5.61/umbrello/objectwidget.h --- umbrello-1.5.6/umbrello/objectwidget.h 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/objectwidget.h 2007-02-03 23:25:34.000000000 +0100 @@ -5,7 +5,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * copyright (C) 2002-2006 * + * copyright (C) 2002-2007 * * Umbrello UML Modeller Authors <[EMAIL PROTECTED]> * ***************************************************************************/ @@ -225,6 +225,13 @@ bool messageOverlap(int y, MessageWidget* messageWidget); /** + * Return the SeqLineWidget. + * Returns a non NULL pointer if this ObjectWidget is part of a + * sequence diagram. + */ + SeqLineWidget *getSeqLine(); + + /** * Saves to the <objectwidget> XMI element. */ void saveToXMI( QDomDocument & qDoc, QDomElement & qElement ); diff -u -r -N umbrello-1.5.6/umbrello/seqlinewidget.cpp umbrello-1.5.61/umbrello/seqlinewidget.cpp --- umbrello-1.5.6/umbrello/seqlinewidget.cpp 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/seqlinewidget.cpp 2007-02-03 23:25:34.000000000 +0100 @@ -5,7 +5,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * copyright (C) 2002-2006 * + * copyright (C) 2002-2007 * * Umbrello UML Modeller Authors <[EMAIL PROTECTED]> * ***************************************************************************/ @@ -27,10 +27,9 @@ setPen( QPen( m_pObject->getLineColor(), 0, Qt::DashLine ) ); setZ( 0 ); setVisible( true ); - m_pDestructionBox.line1 = 0; + m_DestructionBox.line1 = 0; m_nLengthY = 250; setupDestructionBox(); - m_pView -> addSeqLine( this ); } SeqLineWidget::~SeqLineWidget() {} @@ -51,7 +50,6 @@ void SeqLineWidget::cleanup() { cleanupDestructionBox(); - m_pView->removeSeqLine( this ); } void SeqLineWidget::setStartPoint( int startX, int startY ) { @@ -62,11 +60,11 @@ } void SeqLineWidget::cleanupDestructionBox() { - if ( m_pDestructionBox.line1 ) { - delete m_pDestructionBox.line1; - m_pDestructionBox.line1 = 0; - delete m_pDestructionBox.line2; - m_pDestructionBox.line2 = 0; + if ( m_DestructionBox.line1 ) { + delete m_DestructionBox.line1; + m_DestructionBox.line1 = 0; + delete m_DestructionBox.line2; + m_DestructionBox.line2 = 0; } } @@ -81,22 +79,21 @@ rect.setWidth( 14 ); rect.setHeight( 14 ); - m_pDestructionBox.line1 = new QCanvasLine( m_pView->canvas() ); - m_pDestructionBox.line1->setPoints( rect.x(), rect.y(), - rect.x() + rect.width(), rect.y() + rect.height() ); - m_pDestructionBox.line1->setVisible( true ); - m_pDestructionBox.line1->setPen( QPen(m_pObject->getLineColor(), 2) ); - m_pDestructionBox.line1->setZ( 3 ); - - m_pDestructionBox.line2 = new QCanvasLine( m_pView -> canvas() ); - m_pDestructionBox.line2->setPoints( rect.x(), rect.y() + rect.height(), rect.x() + rect.width(), rect.y() ); - m_pDestructionBox.line2->setVisible( true ); - m_pDestructionBox.line2->setPen( QPen(m_pObject->getLineColor(), 2) ); - m_pDestructionBox.line2->setZ( 3 ); + m_DestructionBox.line1 = new QCanvasLine( m_pView->canvas() ); + m_DestructionBox.setLine1Points(rect); + m_DestructionBox.line1->setVisible( true ); + m_DestructionBox.line1->setPen( QPen(m_pObject->getLineColor(), 2) ); + m_DestructionBox.line1->setZ( 3 ); + + m_DestructionBox.line2 = new QCanvasLine( m_pView -> canvas() ); + m_DestructionBox.setLine2Points(rect); + m_DestructionBox.line2->setVisible( true ); + m_DestructionBox.line2->setPen( QPen(m_pObject->getLineColor(), 2) ); + m_DestructionBox.line2->setZ( 3 ); } void SeqLineWidget::moveDestructionBox() { - if( !m_pDestructionBox.line1 ) { + if( !m_DestructionBox.line1 ) { return; } QRect rect; @@ -104,10 +101,8 @@ rect.setY( m_pObject->getY() + m_pObject->getHeight() + m_nLengthY - 7 ); rect.setWidth( 14 ); rect.setHeight( 14 ); - m_pDestructionBox.line1->setPoints( rect.x(), rect.y(), - rect.x() + rect.width(), rect.y() + rect.height() ); - m_pDestructionBox.line2->setPoints( rect.x(), rect.y() + rect.height(), - rect.x() + rect.width(), rect.y() ); + m_DestructionBox.setLine1Points(rect); + m_DestructionBox.setLine2Points(rect); } void SeqLineWidget::setEndOfLine(int yPosition) { diff -u -r -N umbrello-1.5.6/umbrello/seqlinewidget.h umbrello-1.5.61/umbrello/seqlinewidget.h --- umbrello-1.5.6/umbrello/seqlinewidget.h 2006-11-13 06:47:10.000000000 +0100 +++ umbrello-1.5.61/umbrello/seqlinewidget.h 2007-02-03 23:25:34.000000000 +0100 @@ -5,14 +5,14 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * copyright (C) 2002-2006 * + * copyright (C) 2002-2007 * * Umbrello UML Modeller Authors <[EMAIL PROTECTED]> * ***************************************************************************/ - #ifndef SEQLINEWIDGET_H #define SEQLINEWIDGET_H -//app includes + +#include <qcanvas.h> class UMLView; class ObjectWidget; @@ -108,11 +108,18 @@ UMLView * m_pView; /// The destruction box. - struct { - QCanvasRectangle * rect; + struct DestructionBox { QCanvasLine * line1; QCanvasLine * line2; - } m_pDestructionBox; + void setLine1Points(QRect rect) { + line1->setPoints( rect.x(), rect.y(), + rect.x() + rect.width(), rect.y() + rect.height() ); + } + void setLine2Points(QRect rect) { + line2->setPoints( rect.x(), rect.y() + rect.height(), + rect.x() + rect.width(), rect.y() ); + } + } m_DestructionBox; /** * The length of the line. diff -u -r -N umbrello-1.5.6/umbrello/toolbarstateassociation.cpp umbrello-1.5.61/umbrello/toolbarstateassociation.cpp --- umbrello-1.5.6/umbrello/toolbarstateassociation.cpp 2006-12-31 18:18:57.000000000 +0100 +++ umbrello-1.5.61/umbrello/toolbarstateassociation.cpp 2007-01-26 18:25:37.000000000 +0100 @@ -208,6 +208,10 @@ if (m_pUMLView->addAssociation(a, false)) { // if view went ok, then append in document UMLAssociation *umla = a->getAssociation(); + if (umla == NULL) { + // association without model representation in UMLDoc + return; + } Uml::Model_Type m = Model_Utils::convert_DT_MT(m_pUMLView->getType()); UMLDoc *umldoc = UMLApp::app()->getDocument(); umla->setUMLPackage(umldoc->getRootFolder(m)); diff -u -r -N umbrello-1.5.6/umbrello/umbrello.desktop umbrello-1.5.61/umbrello/umbrello.desktop --- umbrello-1.5.6/umbrello/umbrello.desktop 2007-01-18 07:58:35.000000000 +0100 +++ umbrello-1.5.61/umbrello/umbrello.desktop 2007-01-30 08:05:38.000000000 +0100 @@ -28,7 +28,7 @@ GenericName[hi]=यà¥à¤à¤®à¤à¤² मà¥à¤¡à¤²à¤° GenericName[hu]=UML-modellezÅ GenericName[it]=Modellatore UML -GenericName[ja]=UML ã¢ãã© +GenericName[ja]=UML ã¢ãã©ã¼ GenericName[ms]=Pemodel UML GenericName[nb]=UML-modelleringsprogram GenericName[nds]=UML-Modellmaker diff -u -r -N umbrello-1.5.6/umbrello/umlcanvasobject.cpp umbrello-1.5.61/umbrello/umlcanvasobject.cpp --- umbrello-1.5.6/umbrello/umlcanvasobject.cpp 2006-12-31 15:29:14.000000000 +0100 +++ umbrello-1.5.61/umbrello/umlcanvasobject.cpp 2007-02-04 13:34:17.000000000 +0100 @@ -136,25 +136,32 @@ } QString UMLCanvasObject::uniqChildName( const Uml::Object_Type type, - bool seekStereo /* = false */ ) { - QString currentName; - if (seekStereo) { - currentName = i18n("new_stereotype"); - } else if (type == Uml::ot_Association) { - currentName = i18n("new_association"); - } else if (type == Uml::ot_Attribute) { - currentName = i18n("new_attribute"); - } else if (type == Uml::ot_Template) { - currentName = i18n("new_template"); - } else if (type == Uml::ot_Operation) { - currentName = i18n("new_operation"); - } else if (type == Uml::ot_EnumLiteral) { - currentName = i18n("new_literal"); - } else if (type == Uml::ot_EntityAttribute) { - currentName = i18n("new_field"); - } else { - kWarning() << "uniqChildName() called for unknown child type " << type << endl; - return "ERROR_in_UMLCanvasObject_uniqChildName"; + const QString &prefix /* = QString() */ ) { + QString currentName = prefix; + if (currentName.isEmpty()) { + switch (type) { + case Uml::ot_Association: + currentName = i18n("new_association"); + break; + case Uml::ot_Attribute: + currentName = i18n("new_attribute"); + break; + case Uml::ot_Template: + currentName = i18n("new_template"); + break; + case Uml::ot_Operation: + currentName = i18n("new_operation"); + break; + case Uml::ot_EnumLiteral: + currentName = i18n("new_literal"); + break; + case Uml::ot_EntityAttribute: + currentName = i18n("new_field"); + break; + default: + kWarning() << "uniqChildName() called for unknown child type " << type << endl; + return "ERROR_in_UMLCanvasObject_uniqChildName"; + } } QString name = currentName; diff -u -r -N umbrello-1.5.6/umbrello/umlcanvasobject.h umbrello-1.5.61/umbrello/umlcanvasobject.h --- umbrello-1.5.6/umbrello/umlcanvasobject.h 2006-11-05 15:12:14.000000000 +0100 +++ umbrello-1.5.61/umbrello/umlcanvasobject.h 2007-02-04 13:34:17.000000000 +0100 @@ -172,7 +172,7 @@ /** * Find an association. * - * @param id The id of the object to find. + * @param id The id of the object to find. * @return Pointer to the object found (NULL if not found.) */ virtual UMLObject *findChildObjectById(Uml::IDType id, bool considerAncestors = false); @@ -182,13 +182,14 @@ * or attribute appended with a number if the default name is * taken e.g. new_association, new_association_1 etc. * - * @param type The object type for which to make a name. - * @param seekStereo Set this true if we should look at the object's - * stereotype instead of its name. + * @param type The object type for which to make a name. + * @param prefix Optional prefix to use for the name. + * If not given then uniqChildName() will choose the prefix + * internally based on the object type. * @return Unique name string for the Object_Type given. */ virtual QString uniqChildName(const Uml::Object_Type type, - bool seekStereo = false); + const QString &prefix = QString()); virtual void removeAllChildObjects(); diff -u -r -N umbrello-1.5.6/umbrello/umldoc.cpp umbrello-1.5.61/umbrello/umldoc.cpp --- umbrello-1.5.6/umbrello/umldoc.cpp 2007-01-13 22:07:41.000000000 +0100 +++ umbrello-1.5.61/umbrello/umldoc.cpp 2007-02-09 17:39:40.000000000 +0100 @@ -147,15 +147,10 @@ if ( pApp->getListView() ) connect(this, SIGNAL(sigObjectRemoved(UMLObject *)), view, SLOT(slotObjectRemoved(UMLObject *))); - UMLView * previousView = pApp->getCurrentView(); pApp->setCurrentView(view); if ( ! m_bLoading ) { - if (previousView == NULL) { - view -> show(); - emit sigDiagramChanged(view ->getType()); - } else { - view -> hide(); - } + view -> show(); + emit sigDiagramChanged(view ->getType()); } Settings::OptionState optionState = Settings::getOptionState(); @@ -1875,10 +1870,10 @@ } UMLClassifierList UMLDoc::getDatatypes() { + UMLObjectList objects = m_datatypeRoot->containedObjects(); UMLClassifierList datatypeList; UMLObject *obj; - for (UMLObjectListIt oit(m_datatypeRoot->containedObjects()); - (obj = oit.current()) != NULL; ++oit) { + for (UMLObjectListIt oit(objects); (obj = oit.current()) != NULL; ++oit) { if (obj->getBaseType() == ot_Datatype) { datatypeList.append(static_cast<UMLClassifier*>(obj)); } @@ -1889,9 +1884,9 @@ UMLAssociationList UMLDoc::getAssociations() { UMLAssociationList associationList; for (int i = 0; i < Uml::N_MODELTYPES; i++) { + UMLAssociationList assocs = m_root[i]->getAssociations(); UMLAssociation *a; - for (UMLAssociationListIt ait(m_root[i]->getAssociations()); - (a = ait.current()) != NULL; ++ait) + for (UMLAssociationListIt ait(assocs); (a = ait.current()) != NULL; ++ait) associationList.append(a); } return associationList; diff -u -r -N umbrello-1.5.6/umbrello/umlobject.cpp umbrello-1.5.61/umbrello/umlobject.cpp --- umbrello-1.5.6/umbrello/umlobject.cpp 2006-12-22 23:08:32.000000000 +0100 +++ umbrello-1.5.61/umbrello/umlobject.cpp 2007-02-07 21:54:48.000000000 +0100 @@ -414,10 +414,13 @@ } } if (m_SecondaryFallback.isEmpty()) { - kError() << "UMLObject::resolveRef(" << m_Name - << "): cannot find type with id " - << m_SecondaryId << endl; - return false; + if (m_SecondaryId.isEmpty()) { + kError() << "UMLObject::resolveRef(" << m_Name + << "): both m_SecondaryId and m_SecondaryFallback are empty" + << endl; + return false; + } + m_SecondaryFallback = m_SecondaryId; } #ifdef VERBOSE_DEBUGGING kDebug() << "UMLObject::resolveRef(" << m_Name @@ -435,7 +438,6 @@ maybeSignalObjectCreated(); return true; } - //pDoc->setIsOldFile(true); // Work around Object_Factory::createUMLObject()'s incapability // of on-the-fly scope creation: if (m_SecondaryId.contains("::")) { @@ -458,8 +460,7 @@ << "failed to create a new type for " << m_SecondaryId << endl; return false; } - kDebug() << "UMLObject::resolveRef: Creating new type for " - << m_SecondaryId << endl; + kDebug() << "UMLObject::resolveRef: Creating new type for " << m_SecondaryId << endl; // This is very C++ specific - we rely on some '*' or // '&' to decide it's a ref type. Plus, we don't recognize // typedefs of ref types. @@ -594,12 +595,14 @@ if (!stereo.isEmpty()) { Uml::IDType stereoID = STR2ID(stereo); m_pStereotype = umldoc->findStereotypeById(stereoID); - if (m_pStereotype) + if (m_pStereotype) { m_pStereotype->incrRefCount(); - else - kError() << "UMLObject::loadFromXMI(" << m_Name << "): " + } else { + kDebug() << "UMLObject::loadFromXMI(" << m_Name << "): " << "UMLStereotype " << ID2STR(stereoID) - << " not found" << endl; + << " not found, creating now." << endl; + setStereotype(stereo); + } } if( element.hasAttribute("abstract") ) { // for bkwd compat. diff -u -r -N umbrello-1.5.6/umbrello/umlview.cpp umbrello-1.5.61/umbrello/umlview.cpp --- umbrello-1.5.6/umbrello/umlview.cpp 2007-01-13 22:07:41.000000000 +0100 +++ umbrello-1.5.61/umbrello/umlview.cpp 2007-02-03 23:25:34.000000000 +0100 @@ -452,6 +452,14 @@ newWidget->setFont( getFont() ); newWidget->slotColorChanged( getID() ); newWidget->slotLineWidthChanged( getID() ); + newWidget->updateComponentSize(); + if (m_Type == Uml::dt_Sequence) { + // Set proper position on the sequence line widget which is + // attached to the object widget. + ObjectWidget *ow = dynamic_cast<ObjectWidget*>(newWidget); + if (ow) + ow->moveEvent(NULL); + } m_bCreateObject = false; m_WidgetList.append(newWidget); switch (o->getBaseType()) { @@ -634,11 +642,19 @@ } ObjectWidget * UMLView::onWidgetLine( const QPoint &point ) { - SeqLineWidget * pLine = 0; - for( pLine = m_SeqLineList.first(); pLine; pLine = m_SeqLineList.next() ) { - if( pLine -> onWidget( point ) ) { - return pLine -> getObjectWidget(); + UMLWidget *obj; + for (UMLWidgetListIt it(m_WidgetList); (obj = it.current()) != NULL; ++it) { + ObjectWidget *ow = dynamic_cast<ObjectWidget*>(obj); + if (ow == NULL) + continue; + SeqLineWidget *pLine = ow->getSeqLine(); + if (pLine == NULL) { + kError() << "UMLView::onWidgetLine: SeqLineWidget of " << ow->getName() + << " (id=" << ID2STR(ow->getLocalID()) << ") is NULL" << endl; + continue; } + if (pLine->onWidget(point)) + return ow; } return 0; } @@ -874,13 +890,15 @@ endy = objEndY; } //if seq. diagram, make sure print all of the lines - if(getType() == dt_Sequence ) { - SeqLineWidget * pLine = 0; - for( pLine = m_SeqLineList.first(); pLine; pLine = m_SeqLineList.next() ) { - int y = pLine -> getObjectWidget() -> getEndLineY(); - endy = endy < y?y:endy; + if (getType() == dt_Sequence ) { + for (UMLWidgetListIt it(m_WidgetList); (obj = it.current()) != NULL; ++it) { + ObjectWidget *ow = dynamic_cast<ObjectWidget*>(obj); + if (ow == NULL) + continue; + int y = ow->getEndLineY(); + if (endy < y) + endy = y; } - } /* now we need another look at the associations, because they are no diff -u -r -N umbrello-1.5.6/umbrello/umlview.h umbrello-1.5.61/umbrello/umlview.h --- umbrello-1.5.6/umbrello/umlview.h 2006-12-03 18:53:01.000000000 +0100 +++ umbrello-1.5.61/umbrello/umlview.h 2007-02-03 23:25:34.000000000 +0100 @@ -5,7 +5,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * copyright (C) 2002-2006 * + * copyright (C) 2002-2007 * * Umbrello UML Modeller Authors <[EMAIL PROTECTED]> * ***************************************************************************/ @@ -34,7 +34,6 @@ class IDChangeLog; class ListPopupMenu; class FloatingTextWidget; -class SeqLineWidget; class ObjectWidget; class UMLFolder; class UMLApp; @@ -768,20 +767,6 @@ bool checkUniqueSelection(); /** - * Adds a sequence line to the list. - */ - void addSeqLine( SeqLineWidget * pLine ) { - m_SeqLineList.append( pLine ); - } - - /** - * Removes a sequence line from the list. - */ - void removeSeqLine(SeqLineWidget* pLine) { - m_SeqLineList.remove(pLine); - } - - /** * Asks for confirmation and clears everything on the diagram. * Called from menus. */ @@ -1165,11 +1150,6 @@ QPoint m_PastePoint; /** - * Holds a list of all the sequence lines on a sequence diagram. - */ - QPtrList<SeqLineWidget> m_SeqLineList; - - /** * Pointer to the UMLDoc */ UMLDoc* m_pDoc; diff -u -r -N umbrello-1.5.6/VERSION umbrello-1.5.61/VERSION --- umbrello-1.5.6/VERSION 2006-11-19 15:56:07.000000000 +0100 +++ umbrello-1.5.61/VERSION 2007-01-26 18:25:37.000000000 +0100 @@ -1 +1 @@ -1.5.6 +1.5.61