[Uml-devel] kdesdk/umbrello/umbrello

Brian Thomas thomas at mail630.gsfc.nasa.gov
Fri Sep 12 12:33:02 UTC 2003


CVS commit by thomas: 

bug fix: prevent users from 'viewing code' when they are using a simplecodegenerator based code generator


  M +18 -13    umlwidget.cpp   1.49


--- kdesdk/umbrello/umbrello/umlwidget.cpp  #1.48:1.49
@@ -25,4 +25,6 @@
 #include "umlview.h"
 
+#include "codegenerator.h"
+#include "codegenerators/simplecodegenerator.h"
 #include "listpopupmenu.h"
 #include "classifier.h"
@@ -679,24 +681,27 @@ void UMLWidget::startPopupMenu(QPoint At
         //a MessageWidget when selected will select its text widget and vice versa
         //so take that into account for popup menu.
-        if( m_bSelected ) {
+
+        // determine multi state
+        bool multi = false;
+        if( m_bSelected ) 
                 if( m_pView -> getType() == dt_Sequence ) {
                         if( getBaseType() == wt_Message && count == 2 ) {
-                                m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this);
+                                multi = false; 
                         } else if( getBaseType() == wt_Text &&
                                    ((FloatingText*)this) -> getRole() == tr_Seq_Message && count == 2 ) {
-                                m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this);
+                                multi = false; 
                         } else if( count > 1 ) {
-                                m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this, true );
-                        } else {
-                                m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this);
+                                multi = true;
                         }
                 } else if( count > 1 ) {
-                        m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this, true );
-                } else {
-                        m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this);
-                }
-        } else {
-                m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this);
+                        multi = true;
         }
+
+        m_pMenu = new ListPopupMenu(static_cast<QWidget*>(m_pView), this, multi);
+
+        // disable the "view code" menu for simple code generators
+        CodeGenerator * currentCG = m_pView->getDocument()->getCurrentCodeGenerator();
+        if(currentCG && dynamic_cast<SimpleCodeGenerator*>(currentCG))
+                        m_pMenu->setItemEnabled(ListPopupMenu::mt_ViewCode, false);
 
         m_pMenu->popup(At);






More information about the umbrello-devel mailing list