[Uml-devel] KDE/kdesdk/umbrello/umbrello/dialogs

Sharan Rao sharanrao at gmail.com
Sat Jul 21 18:14:02 UTC 2007


SVN commit 690654 by sharan:

Moving common parts of ctor to init().
Also added an extra initialisation of pointer to 0 to prevent crash on pressing Ok in some property dialogs.


 M  +24 -43    classpropdlg.cpp  
 M  +4 -0      classpropdlg.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classpropdlg.cpp #690653:690654
@@ -41,23 +41,10 @@
 
 ClassPropDlg::ClassPropDlg(QWidget *parent, UMLObject * c, int pageNum, bool assoc)
         : KPageDialog(parent) {
-    setCaption( i18n("Properties") );
-    setButtons( Ok | Apply | Cancel | Help );
-    setDefaultButton( Ok );
-    setModal( true );
-    showButtonSeparator( true );
-    setFaceType( KPageDialog::List );
+    init();
     m_pWidget = 0;
-    m_pGenPage = 0;
-    m_pAttPage = 0;
-    m_pOpsPage = 0;
-    m_pTemplatePage = 0;
-    m_pEnumLiteralPage = 0;
-    m_pEntityAttributePage = 0;
-    m_pOptionsPage = 0;
-    m_pColorPage = 0;
     m_Type = pt_Object;
-    m_pDoc = UMLApp::app()->getDocument();
+
     m_pObject = c;
     setupPages(c, assoc);
 #ifdef __GNUC__
@@ -70,20 +57,8 @@
 
 ClassPropDlg::ClassPropDlg(QWidget *parent, ObjectWidget * o)
         : KPageDialog(parent) {
-    setCaption( i18n("Properties") );
-    setButtons( Ok | Apply | Cancel | Help );
-    setDefaultButton(Ok );
-    setModal( true );
-    showButtonSeparator( true );
-    setFaceType( KPageDialog::List );
+    init();
     m_pWidget = o;
-    m_pGenPage = 0;
-    m_pAttPage = 0;
-    m_pOpsPage = 0;
-    m_pTemplatePage = 0;
-    m_pEnumLiteralPage = 0;
-    m_pEntityAttributePage = 0;
-    m_pOptionsPage = 0;
     m_Type = pt_ObjectWidget;
     m_pObject = m_pWidget->getUMLObject();
     m_pDoc = UMLApp::app()->getDocument();
@@ -119,23 +94,10 @@
 
 ClassPropDlg::ClassPropDlg(QWidget *parent, UMLWidget * w)
         : KPageDialog(parent) {
-    setCaption( i18n("Properties") );
-    setButtons( Ok | Apply | Cancel | Help );
-    setDefaultButton(Ok );
-    setModal( true );
-    showButtonSeparator( true );
-    setFaceType( KPageDialog::List );
+    init();
     m_pWidget = w;
-    m_pGenPage = 0;
-    m_pAttPage = 0;
-    m_pOpsPage = 0;
-    m_pTemplatePage = 0;
-    m_pEnumLiteralPage = 0;
-    m_pEntityAttributePage = 0;
-    m_pOptionsPage = 0;
     m_Type = pt_Widget;
     m_pObject = w -> getUMLObject();
-    m_pDoc = ((UMLApp *)parent) -> getDocument();
 
     if (w->getBaseType() == Uml::wt_Class
             || w->getBaseType() == Uml::wt_Interface
@@ -180,6 +142,26 @@
     connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
 }
 
+
+void ClassPropDlg::init() {
+    setCaption( i18n("Properties") );
+    setButtons( Ok | Apply | Cancel | Help );
+    setDefaultButton( Ok );
+    setModal( true );
+    showButtonSeparator( true );
+    setFaceType( KPageDialog::List );
+    m_pGenPage = 0;
+    m_pAttPage = 0;
+    m_pOpsPage = 0;
+    m_pTemplatePage = 0;
+    m_pEnumLiteralPage = 0;
+    m_pEntityAttributePage = 0;
+    m_pEntityConstraintPage = 0;
+    m_pOptionsPage = 0;
+    m_pColorPage = 0;
+    m_pDoc = UMLApp::app()->getDocument();
+}
+
 ClassPropDlg::~ClassPropDlg() {}
 
 void ClassPropDlg::slotOk() {
@@ -355,5 +337,4 @@
 }
 
 
-
 #include "classpropdlg.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/classpropdlg.h #690653:690654
@@ -122,6 +122,10 @@
                      pt_Widget         //Shows pages needed for any other widget
                   };
     Page_Type m_Type;
+
+private:
+
+    void init();
 };
 
 #endif




More information about the umbrello-devel mailing list