[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs
Oliver Kellogg
okellogg at users.sourceforge.net
Mon Feb 20 14:08:27 UTC 2006
SVN commit 511785 by okellogg:
I got a strange crash on one machine while adding a new entity attribute
which went away after these changes. (Not that I knew what I'm doing...)
M +23 -13 umlentityattributedialog.cpp
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/umlentityattributedialog.cpp #511784:511785
@@ -1,8 +1,3 @@
-/*
- * copyright (C) 2002-2005
- * Umbrello UML Modeller Authors <uml-devel@ uml.sf.net>
- */
-
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@@ -10,6 +5,8 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
+ * copyright (C) 2002-2006 *
+ * Umbrello UML Modeller Authors <uml-devel@ uml.sf.net> *
***************************************************************************/
// own header
@@ -29,6 +26,7 @@
#include <kcompletion.h>
#include <klocale.h>
#include <kmessagebox.h>
+#include <kapplication.h>
#include <kdebug.h>
// app includes
@@ -39,6 +37,8 @@
#include "../codegenerator.h"
#include "../dialog_utils.h"
#include "../object_factory.h"
+#include "../datatype.h"
+#include "../umldatatypelist.h"
UMLEntityAttributeDialog::UMLEntityAttributeDialog( QWidget * pParent, UMLEntityAttribute * pEntityAttribute )
: KDialogBase( Plain, i18n("Entity Attribute Properties"), Help | Ok | Cancel , Ok, pParent, "_UMLENTITYATTRIBUTEDLG_", true, true) {
@@ -49,7 +49,7 @@
UMLEntityAttributeDialog::~UMLEntityAttributeDialog() {}
void UMLEntityAttributeDialog::setupDialog() {
- //UMLDoc * pDoc = UMLApp::app()->getDocument();
+ UMLDoc * pDoc = UMLApp::app()->getDocument();
int margin = fontMetrics().height();
QVBoxLayout * mainLayout = new QVBoxLayout( plainPage() );
@@ -136,15 +136,17 @@
m_pTypeCB->setDuplicatesEnabled(false);//only allow one of each type in box
// Add the data types.
- QStringList dataTypes = UMLApp::app()->getGenerator()->defaultDatatypes();
+ UMLDatatypeList dataTypes = pDoc->getDatatypes();
if (dataTypes.count() == 0) {
- // Switch to SQL as the active language if not datatypes are set.
+ // Switch to SQL as the active language if no datatypes are set.
UMLApp::app()->setActiveLanguage("SQL");
- dataTypes = UMLApp::app()->getGenerator()->defaultDatatypes();
+ pDoc->addDefaultDatatypes();
+ kapp->processEvents();
+ dataTypes = pDoc->getDatatypes();
}
- QStringList::Iterator dend(dataTypes.end());
- for (QStringList::Iterator dit = dataTypes.begin(); dit != dend; ++dit) {
- insertType(*dit);
+ UMLDatatype *dat;
+ for (UMLDatatypeListIt dit(dataTypes); (dat = dit.current()) != NULL; ++dit) {
+ insertType(dat->getName());
}
//work out which one to select
@@ -210,7 +212,15 @@
}
QString typeName = m_pTypeCB->currentText();
- UMLDoc * pDoc = UMLApp::app()->getDocument();
+ UMLDoc *pDoc = UMLApp::app()->getDocument();
+ UMLDatatypeList dataTypes = pDoc->getDatatypes();
+ UMLDatatype *dat;
+ for (UMLDatatypeListIt dit(dataTypes); (dat = dit.current()) != NULL; ++dit) {
+ if (typeName == dat->getName()) {
+ m_pEntityAttribute->setType(dat);
+ return true;
+ }
+ }
UMLObject *obj = pDoc->findUMLObject(typeName);
UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(obj);
if (classifier == NULL) {
More information about the umbrello-devel
mailing list