[Uml-devel] kdesdk/umbrello/umbrello

Luis De la Parra Blum lparrab at gmx.net
Mon Mar 31 16:01:04 UTC 2003


CVS commit by luis: 

Aha!, found where the context menu is handled...
I think this code was written for QT 1/2, where the QPopupMenu's selection had to be handled in a huge case instead of having the menu call the slot directly... that's why I couldn't find it.

Now you can call the RefactoringAssistant from the class widget's context menu.
->note:  There is a memory leak now (the assistant doesnt get deleted). will be fixed later.


  M +1 -0      listpopupmenu.cpp   1.19
  M +2 -0      listpopupmenu.h   1.14
  M +12 -0     umlwidget.cpp   1.26


--- kdesdk/umbrello/umbrello/listpopupmenu.h  #1.13:1.14
@@ -142,4 +142,6 @@ public:
                         mt_Expand_All,                     //Expand all items in the list
                         mt_Collapse_All,                   //Collapse all items in the list
+                        
+                mt_Refactoring,
 
             mt_Undefined  =  - 1

--- kdesdk/umbrello/umbrello/listpopupmenu.cpp  #1.18:1.19
@@ -229,4 +229,5 @@ ListPopupMenu::ListPopupMenu(QWidget * p
                         insertItem( SmallIcon( "charset"), i18n("Rename..."), mt_Rename);
                         insertItem( SmallIcon( "fonts"),  i18n( "Change Font..." ), mt_Change_Font );
+                        insertItem( SmallIcon( "unknown"), i18n("Refactor"),mt_Refactoring);
                         insertItem(SmallIcon( "info"), i18n("Properties"), mt_Properties);
                         break;

--- kdesdk/umbrello/umbrello/umlwidget.cpp  #1.25:1.26
@@ -17,4 +17,5 @@
 
 #include "umlobject.h"
+#include "class.h"
 #include "umlwidget.h"
 #include "uml.h"
@@ -32,4 +33,7 @@
 #include "clipboard/idchangelog.h"
 
+#include "refactoring/refactoringassistant.h"
+using Umbrello::RefactoringAssistant;
+
 UMLWidget::UMLWidget( UMLView * view, UMLObject * o, UMLWidgetData * pData ) 
         : QObject( view), QCanvasRectangle( view -> canvas() ), 
@@ -374,4 +378,12 @@ void UMLWidget::slotMenuSelection(int se
                         m_pView -> getDocument() -> editPaste();
                         break;
+                case ListPopupMenu::mt_Refactoring:
+                        //check if we are operating on a classifier, or some other kind of UMLObject
+                        if(dynamic_cast<UMLClass*>(m_pObject))
+                        {
+                                RefactoringAssistant *r = new RefactoringAssistant(m_pView -> getDocument(),
+                                                                 dynamic_cast<UMLClass*>(m_pObject));
+                                r->show( );
+                        }
         }
 }






More information about the umbrello-devel mailing list