SVN commit 587568 by okellogg:
sync with branches/KDE/3.5 up to commit 587279
M +2 -2 codegenerators/cppwriter.cpp =20
M +5 -6 folder.cpp =20
M +6 -6 folder.h =20
M +6 -0 listpopupmenu.cpp =20
M +1 -0 uml.cpp =20
M +30 -40 umldoc.cpp =20
M +0 -12 umldoc.h =20
M +2 -3 umllistview.cpp =20
M +0 -7 umllistview.h =20
M +9 -15 umlobject.cpp =20
M +7 -2 umlobject.h =20
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppwriter.cpp #5875=
67:587568
@@ -227,7 +227,7 @@
// Q: Why all utils? Isnt just List and Vector the only classes we a=
re using?
// Our import *should* also look at operations, and check that objec=
ts being
// used arent in another package (and thus need to be explicitly imp=
orted here).
- cpp << "#include \"" << (m_classifierInfo->className).lower() << ".h=
\"" << m_endl;
+ cpp << "#include \"" << m_classifierInfo->className << ".h\"" << m_e=
ndl;
writeBlankLine(cpp);
=20
if (c->getVisibility() =3D=3D Uml::Visibility::Implementation) {
@@ -1231,7 +1231,7 @@
if( !isFirstClass && !a->getRoleName(Uml::A).isEmpty() && !a=
->getRoleName(Uml::B).isEmpty())
stream << "class " << current->getName() << ";" << m_end=
l; // special case: use forward declaration
else
- stream << "#include \"" << current->getName().lower() <<=
".h\"" << m_endl; // just the include statement
+ stream << "#include \"" << current->getName() << ".h\"" =
<< m_endl; // just the include statement
}
}
=20
--- trunk/KDE/kdesdk/umbrello/umbrello/folder.cpp #587567:587568
@@ -35,7 +35,6 @@
=20
void UMLFolder::init() {
m_BaseType =3D Uml::ot_Folder;
- m_bPredefined =3D false;
m_diagrams.setAutoDelete(true);
UMLObject::setStereotype("folder");
}
@@ -46,12 +45,12 @@
return clone;
}
=20
-void UMLFolder::markPredefined() {
- m_bPredefined =3D true;
+void UMLFolder::setLocalName(QString localName) {
+ m_localName =3D localName;
}
=20
-bool UMLFolder::isPredefined() {
- return m_bPredefined;
+QString UMLFolder::getLocalName() {
+ return m_localName;
}
=20
void UMLFolder::addView(UMLView *view) {
@@ -370,7 +369,7 @@
UMLFolder *logicalView =3D umldoc->getRootFolder(Uml::mt_Logical=
);
if (this =3D=3D logicalView && Uml::tagEq(type, "Package")) {
QString thisName =3D tempElement.attribute("name", "");
- if (thisName =3D=3D umldoc->datatypeFolderName()) {
+ if (thisName =3D=3D "Datatypes") {
UMLFolder *datatypeFolder =3D umldoc->getDatatypeFolder(=
);
if (!datatypeFolder->loadFromXMI(tempElement))
totalSuccess =3D false;
--- trunk/KDE/kdesdk/umbrello/umbrello/folder.h #587567:587568
@@ -59,18 +59,18 @@
virtual UMLObject* clone() const;
=20
/**
- * Mark this folder as being for Umbrello special use.
+ * Set the localized name of this folder.
* This is set for the predefined root views (Logical,
* UseCase, Component, Deployment, EntityRelationship,
* and the Datatypes folder inside the Logical View.)
*/
- void markPredefined();
+ void setLocalName(QString localName);
=20
/**
- * Return whther this folder is one of the Umbrello special
- * folders.
+ * Return the localized name of this folder.
+ * Only useful for the predefined root folders.
*/
- bool isPredefined();
+ QString getLocalName();
=20
/**
* Add a view to the diagram list.
@@ -184,7 +184,7 @@
bool load(QDomElement & element);
=20
private:
- bool m_bPredefined;
+ QString m_localName; ///< i18n name, only used for predefined root =
folders
/**
* If m_folderFile is not empty then it contains a file name to whic=
h
* this folder is saved.
--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.cpp #587567:587568
@@ -772,6 +772,12 @@
case mt_Activity_Diagram:
type =3D Uml::dt_Activity;
break;
+ case mt_Component_Diagram:
+ type =3D Uml::dt_Component;
+ break;
+ case mt_Deployment_Diagram:
+ type =3D Uml::dt_Deployment;
+ break;
case mt_EntityRelationship_Diagram:
type =3D Uml::dt_EntityRelationship;
break;
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #587567:587568
@@ -1662,6 +1662,7 @@
if (m_viewStack =3D=3D NULL)
return;
m_viewStack->setCurrentWidget(view);
+ kapp->processEvents();
if (view) {
slotStatusMsg(view->getName());
}
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #587567:587568
@@ -84,7 +84,6 @@
UMLDoc::UMLDoc() {
m_Name =3D i18n("UML Model");
m_modelID =3D "m1";
- m_datatypeFolderName =3D i18n("Datatypes");
m_count =3D 0;
m_pChangeLog =3D 0;
m_Doc =3D "";
@@ -99,7 +98,14 @@
=20
void UMLDoc::init() {
// Initialize predefined folders.
- const QString predefinedName[Uml::N_MODELTYPES] =3D {
+ const QString nativeRootName[Uml::N_MODELTYPES] =3D {
+ "Logical View",
+ "Use Case View",
+ "Component View",
+ "Deployment View",
+ "Entity Relationship Model"
+ };
+ const QString localizedRootName[Uml::N_MODELTYPES] =3D {
i18n("Logical View"),
i18n("Use Case View"),
i18n("Component View"),
@@ -107,11 +113,11 @@
i18n("Entity Relationship Model")
};
for (int i =3D 0; i < Uml::N_MODELTYPES; i++) {
- m_root[i] =3D new UMLFolder(predefinedName[i]);
- m_root[i]->markPredefined();
+ m_root[i] =3D new UMLFolder(nativeRootName[i]);
+ m_root[i]->setLocalName(localizedRootName[i]);
}
- m_datatypeRoot =3D new UMLFolder(m_datatypeFolderName);
- m_datatypeRoot->markPredefined();
+ m_datatypeRoot =3D new UMLFolder("Datatypes");
+ m_datatypeRoot->setLocalName(i18n("Datatypes"));
m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]);
m_root[Uml::mt_Logical]->addObject(m_datatypeRoot);
=20
@@ -291,8 +297,8 @@
for (int i =3D 0; i < Uml::N_MODELTYPES; i++)
m_root[i]->removeAllObjects();
// Restore the datatype folder, it has been deleted above.
- m_datatypeRoot =3D new UMLFolder(m_datatypeFolderName);
- m_datatypeRoot->markPredefined();
+ m_datatypeRoot =3D new UMLFolder("Datatypes");
+ m_datatypeRoot->setLocalName(i18n("Datatypes"));
m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]);
m_root[Uml::mt_Logical]->addObject(m_datatypeRoot);
listView->theDatatypeFolder()->setUMLObject(m_datatypeRoot);
@@ -1044,10 +1050,10 @@
temp->setType( type );
temp->setID( UniqueID::gen() );
addView(temp);
- emit sigDiagramCreated( UniqueID::get() );
+ emit sigDiagramCreated( temp->getID() );
setModified(true, false);
UMLApp::app()->enablePrint(true);
- changeCurrentView( UniqueID::get() );
+ changeCurrentView( temp->getID() );
break;
} else {
KMessageBox::error(0, i18n("A diagram is already using that =
name."), i18n("Not a Unique Name"));
@@ -1133,7 +1139,7 @@
void UMLDoc::changeCurrentView(Uml::IDType id) {
UMLApp* pApp =3D UMLApp::app();
UMLView* w =3D findView(id);
- if (w !=3D pApp->getCurrentView() && w) {
+ if (w) {
pApp->setCurrentView(w);
emit sigDiagramChanged(w->getType());
pApp->setDiagramMenuItemsState( true );
@@ -1168,7 +1174,7 @@
if (currentView =3D=3D NULL) {
if (m_pCurrentRoot)
return m_pCurrentRoot;
- kError() << "UMLDoc::currentRoot: currentView is NULL, assuming =
Logical View"
+ kDebug() << "UMLDoc::currentRoot: currentView is NULL, assuming =
Logical View"
<< endl;
return m_root[Uml::mt_Logical];
}
@@ -1712,13 +1718,6 @@
emit sigWriteToStatusBar( i18n("Loading UML elements...") );
=20
bool bNativityIsDetermined =3D false;
- const QString nativeRootName[Uml::N_MODELTYPES] =3D {
- "Logical View",
- "Use Case View",
- "Component View",
- "Deployment View",
- "Entity Relationship Model"
- };
for (QDomNode node =3D element.firstChild(); !node.isNull();
node =3D node.nextSibling()) {
if (node.isComment())
@@ -1729,8 +1728,7 @@
bool foundUmbrelloRootFolder =3D false;
QString name =3D tempElement.attribute("name");
for (int i =3D 0; i < Uml::N_MODELTYPES; i++) {
- if (name =3D=3D m_root[i]->getName() ||
- name =3D=3D nativeRootName[i]) { // @todo checking =
for name creates i18n problem
+ if (name =3D=3D m_root[i]->getName()) {
m_pCurrentRoot =3D m_root[i];
m_root[i]->loadFromXMI(tempElement);
foundUmbrelloRootFolder =3D true;
@@ -1781,35 +1779,27 @@
QString xmiId =3D tempElement.attribute("xmi.id", "");
bNativityIsDetermined =3D determineNativity(xmiId);
}
+ Uml::Object_Type ot =3D pObject->getBaseType();
+ // Set the parent root folder.
+ UMLPackage *pkg =3D NULL;
+ if (ot =3D=3D Uml::ot_Datatype) {
+ pkg =3D m_datatypeRoot;
+ } else {
+ Uml::Model_Type guess =3D Model_Utils::guessContainer(pObjec=
t);
+ pkg =3D m_root[guess];
+ }
+ pObject->setUMLPackage(pkg);
+
bool status =3D pObject -> loadFromXMI( tempElement );
if ( !status ) {
delete pObject;
return false;
}
- Uml::Object_Type ot =3D pObject->getBaseType();
if (ot =3D=3D ot_Stereotype) {
UMLStereotype *s =3D static_cast<UMLStereotype*>(pObject);
addStereotype(s);
continue;
}
- UMLPackage *pkg =3D pObject->getUMLPackage();
- if (pkg =3D=3D NULL) {
- if (ot =3D=3D Uml::ot_Datatype) {
- pkg =3D m_datatypeRoot;
- } else {
- Uml::Model_Type guess =3D Model_Utils::guessContainer(pO=
bject);
- pkg =3D m_root[guess];
- /* Associations:
- "Association"
- "AssociationClass"
- "Generalization"
- "Realization"
- "Abstraction"
- "Dependency"
- */
- }
- pObject->setUMLPackage(pkg);
- }
pkg->addObject(pObject);
=20
/* FIXME see comment at loadUMLObjectsFromXMI
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.h #587567:587568
@@ -513,13 +513,6 @@
}
=20
/**
- * Return the name of the predefined Datatypes folder in the Logical=
View.
- */
- QString datatypeFolderName() const {
- return m_datatypeFolderName;
- }
-
- /**
* Returns a list of the concepts in this UMLDoc.
*
* @param includeNested Whether to include the concepts =
from
@@ -814,11 +807,6 @@
UMLFolder *m_datatypeRoot;
=20
/**
- * Name of the predefined Datatypes folder in the Logical View
- */
- QString m_datatypeFolderName;
-
- /**
* The UMLDoc is the sole owner of all stereotypes.
* UMLStereotype instances are reference counted.
* When an UMLStereotype is no longer referenced anywhere,
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #587567:587568
@@ -216,7 +216,6 @@
// Switch to diagram on mouse release - not on mouse press
// because the user might intend a drag-to-note.
m_doc->changeCurrentView( item->getID() );
- emit diagramSelected( item->getID() );
UMLApp::app()->getDocWindow()->showDocumentation(m_doc->findView(ite=
m->getID()), false);
this->K3ListView::contentsMouseReleaseEvent(me);
}
@@ -1014,14 +1013,14 @@
Uml::Model_Type mt =3D (Uml::Model_Type)i;
UMLFolder *sysFolder =3D m_doc->getRootFolder(mt);
Uml::ListView_Type lvt =3D Model_Utils::convert_MT_LVT(mt);
- m_lv[i] =3D new UMLListViewItem(m_rv, sysFolder->getName(), =
lvt, sysFolder);
+ m_lv[i] =3D new UMLListViewItem(m_rv, sysFolder->getLocalNam=
e(), lvt, sysFolder);
}
} else {
for (int i =3D 0; i < Uml::N_MODELTYPES; i++)
deleteChildrenOf(m_lv[i]);
}
UMLFolder *datatypeFolder =3D m_doc->getDatatypeFolder();
- m_datatypeFolder =3D new UMLListViewItem(m_lv[Uml::mt_Logical], data=
typeFolder->getName(),
+ m_datatypeFolder =3D new UMLListViewItem(m_lv[Uml::mt_Logical], data=
typeFolder->getLocalName(),
Uml::lvt_Datatype_Folder, dat=
atypeFolder);
m_rv->setOpen(true);
for (int i =3D 0; i < Uml::N_MODELTYPES; i++)
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.h #587567:587568
@@ -467,13 +467,6 @@
*/
void slotCutSuccessful();
=20
-signals:
-
- /**
- * change the current view
- */
- void diagramSelected(Uml::IDType);
-
private:
/**
* Searches the tree for a diagram (view).
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #587567:587568
@@ -343,29 +343,23 @@
return name;
}
=20
-QString UMLObject::getPackage(QString separator) {
- if (m_pUMLPackage =3D=3D NULL)
+QString UMLObject::getPackage(QString separator, bool includeRoot) {
+ QString fqn =3D getFullyQualifiedName(separator, includeRoot);
+ if (!fqn.contains(separator))
return "";
- UMLPackageList pkgList;
- QStringList pkgNames;
- UMLPackage* pkg =3D m_pUMLPackage;
- do {
- pkgList.prepend(pkg);
- pkgNames.prepend(pkg->getName());
- pkg =3D pkg->getUMLPackage();
- } while (pkg !=3D NULL && !pkgList.containsRef(pkg));
- if (separator.isEmpty())
- separator =3D UMLApp::app()->activeLanguageScopeSeparator();
- return pkgNames.join(separator);
+ QString scope =3D fqn.left(fqn.length() - separator.length() - m_Nam=
e.length());
+ return scope;
}
=20
-UMLPackageList UMLObject::getPackages() const {
+UMLPackageList UMLObject::getPackages(bool includeRoot) const {
UMLPackageList pkgList;
UMLPackage* pkg =3D m_pUMLPackage;
while (pkg !=3D NULL) {
pkgList.prepend(pkg);
pkg =3D pkg->getUMLPackage();
}
+ if (!includeRoot)
+ pkgList.removeFirst();
return pkgList;
}
=20
@@ -755,7 +749,7 @@
} else if (m_pUMLPackage) {
m_pUMLPackage->addObject(this);
} else if (umldoc->rootFolderType(this) =3D=3D Uml::N_MODELTYPES=
) {
- kError() << "UMLObject::loadFromXMI(" << m_Name << "): m_pUM=
LPackage is not set"
+ kDebug() << "UMLObject::loadFromXMI(" << m_Name << "): m_pUM=
LPackage is not set"
<< endl;
}
}
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.h #587567:587568
@@ -192,17 +192,22 @@
* individual package prefixes (optional.)
* If no separator is given then the separator
* of the currently selected language is used.
+ * @param includeRoot Whether to prefix the root folder name.
+ * Default: false.
* @return The UMLObject's enclosing package(s) as a text.
*/
- QString getPackage(QString separator =3D QString::null);
+ QString getPackage(QString separator =3D QString::null,
+ bool includeRoot =3D false);
=20
/**
* Return a list of the packages in which this class is embedded.
* The outermost package is first in the list.
*
+ * @param includeRoot Whether to prefix the root folder name.
+ * Default: false.
* @return UMLPackageList of the containing packages.
*/
- UMLPackageList getPackages() const;
+ UMLPackageList getPackages(bool includeRoot =3D false) const;
=20
/**
* Returns the UMLPackage that this class is located in.
|