[Uml-devel] KDE/kdesdk/umbrello/umbrello/dialogs
Sharan Rao
sharanrao at gmail.com
Sat Aug 4 18:59:57 UTC 2007
SVN commit 696420 by sharan:
prevent crashes due to some mad code I had written earlier :)
M +22 -23 classgenpage.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classgenpage.cpp #696419:696420
@@ -398,43 +398,42 @@
if(m_pObject) {
QString name = m_pClassNameLE -> text();
- // set name first. We'll check for clashes later.
- m_pObject->setName( name );
-
m_pObject -> setDoc(m_pDoc -> text());
if(m_pStereoTypeCB)
m_pObject -> setStereotype(m_pStereoTypeCB->currentText());
- QString packageName = m_pPackageCB->currentText().trimmed();
- UMLObject* newPackage = NULL;
+ Uml::Object_Type t = m_pObject->getBaseType();
+ if (t == Uml::ot_Class || t == Uml::ot_Interface) {
+ QString packageName = m_pPackageCB->currentText().trimmed();
+ UMLObject* newPackage = NULL;
- if ( !packageName.isEmpty()) {
+ if ( !packageName.isEmpty()) {
if ( ( newPackage = m_pUmldoc->findUMLObject(packageName, Uml::ot_Package) ) == NULL )
newPackage = Import_Utils::createUMLObject(Uml::ot_Package, packageName);
- } else {
- newPackage = m_pUmldoc->getRootFolder( Uml::mt_Logical );
- }
+ } else {
+ newPackage = m_pUmldoc->getRootFolder( Uml::mt_Logical );
+ }
- // adjust list view items
- UMLListView *lv = UMLApp::app()->getListView();
- UMLListViewItem *newLVParent = lv->findUMLObject(newPackage);
- lv->moveObject(m_pObject->getID(),
+ // adjust list view items
+ UMLListView *lv = UMLApp::app()->getListView();
+ UMLListViewItem *newLVParent = lv->findUMLObject(newPackage);
+ lv->moveObject(m_pObject->getID(),
Model_Utils::convert_OT_LVT(m_pObject),
newLVParent);
- // the name may have changed when the class was added to the package
- name = m_pObject->getName();
+ }
if( m_pAbstractCB )
m_pObject -> setAbstract( m_pAbstractCB -> isChecked() );
-// //make sure unique name
-// UMLObject *o = m_pUmldoc -> findUMLObject(name);
-// if(o && m_pObject != o) {
-// KMessageBox::sorry(this, i18n("The name you have chosen\nis already being used.\nThe name has been reset."),
-// i18n("Name is Not Unique"), false);
-// m_pClassNameLE -> setText( m_pObject -> getName() );
-// } else
-// m_pObject -> setName(name);
+
+ //make sure unique name
+ UMLObject *o = m_pUmldoc -> findUMLObject(name);
+ if(o && m_pObject != o) {
+ KMessageBox::sorry(this, i18n("The name you have chosen\nis already being used.\nThe name has been reset."),
+ i18n("Name is Not Unique"), false);
+ m_pClassNameLE -> setText( m_pObject -> getName() );
+ } else
+ m_pObject -> setName(name);
Uml::Visibility s;
if(m_pPublicRB -> isChecked())
s = Uml::Visibility::Public;
More information about the umbrello-devel
mailing list