[umbrello] [Bug 427532] On changing Code -> Active Language the previous default data types are not removed

Oliver Kellogg bugzilla_noreply at kde.org
Sun Oct 11 21:57:22 BST 2020


https://bugs.kde.org/show_bug.cgi?id=427532

--- Comment #2 from Oliver Kellogg <okellogg at users.sourceforge.net> ---
Git commit 9817ffc9eeef527181ee40904e76352796f4955a by Oliver Kellogg.
Committed on 11/10/2020 at 20:54.
Pushed by okellogg into branch 'master'.

https://bugs.kde.org/show_bug.cgi?id=427532#c1
Remove default datatypes of previous Active Language:

umbrello/uml1model/datatype.{h,cpp}
- Add member variable m_isActive initialized to true by constructor.
- Add accessor functions setActive(bool active = true), isActive().
- Peripheral cleanup: Override function load1 in lieu of loadFromXMI1.

umbrello/uml1model/datatype.cpp
- In function load1, set m_isActive true if XMI attribute "isActive"
  does not exist or if its value is not "false".
- In function saveToXMI1, setAttribute "isActive" to "false" on the
  classifierElement if m_isActive is false.

umbrello/uml1model/package.{h,cpp}
- At function containedObjects add optional argument includeInactive
  of type bool defaulting to false.  If includeInactive is true then
  include datatypes with isActive() false in the returned list.

umbrello/uml1model/package.cpp
- In function removeObject do not delete a datatype from its package
  but just set its isActive flag false.

umbrello/uml1model/folder.cpp
- In function load1 avoid duplicate creation of datatype when its name
  already exists in m_objects.

umbrello/umldoc.{h,cpp}
- At function datatypes() add optional argument includeInactive of type
  bool defaulting to false.  If includeInactive is true then include
  datatypes which have isActive() == false in the returned list.
- New function removeDatatype(const QString &name) removes a datatype
  from m_datatypeRoot->containedObjects() by name.

umbrello/umldoc.cpp
- In function createDatatype,
  - at call to m_datatypeRoot->containedObjects() provide argument
    includeInactive = true;
  - if Model_Utils::findUMLObject() returns non null and the retuned
    object is a UMLDatatype then set its isActive flag to true and emit
    sigObjectCreated; do not call Object_Factory::createUMLObject().

umbrello/uml.cpp
- In function setGenerator, if m_codegen is non null on entry then query
  m_codegen->defaultDatatypes() and call m_doc->removeDatatype() for
  each name returned.

umbrello/umllistview.cpp
- In function slotObjectCreated, if object->baseType() is ot_Datatype
  then check that the isActive flag is true; else refuse to create the
  UMLListViewItem.

umbrello/main.cpp
- At function initDocument :
  - Add argument progLang of type Uml::ProgrammingLanguage::Enum.
  - If UMLApp::app()->newDocument() is called then follow it by
    UMLApp::app()->setActiveLanguage(progLang).
  - If a file shall be opened, the programming language set by the
    <XMI.extensions> <codegeneration> element in the file shall take
    precedence over the language set via command line parameter,
    therefore do not call UMLApp::app()->setActiveLanguage.
- Adjust main program to change of function initDocument.

umbrello/version.h
- Increase XMI_FILE_VERSION to "1.6.19" due to the <UML:DataType> new
  attribute "isActive".

M  +4    -4    umbrello/main.cpp
M  +5    -0    umbrello/uml.cpp
M  +29   -7    umbrello/uml1model/datatype.cpp
M  +5    -1    umbrello/uml1model/datatype.h
M  +17   -0    umbrello/uml1model/folder.cpp
M  +39   -4    umbrello/uml1model/package.cpp
M  +1    -1    umbrello/uml1model/package.h
M  +31   -5    umbrello/umldoc.cpp
M  +2    -1    umbrello/umldoc.h
M  +9    -1    umbrello/umllistview.cpp
M  +1    -1    umbrello/version.h

https://invent.kde.org/sdk/umbrello/commit/9817ffc9eeef527181ee40904e76352796f4955a

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list