[Uml-devel] KDE/kdesdk/umbrello/umbrello/widgets
Andi Fischer
andi.fischer at hispeed.ch
Mon Apr 9 06:33:14 UTC 2012
SVN commit 1288607 by fischer:
Some functions reordered to reduce the differences to the gsoc-branch.
M +56 -48 statewidget.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/statewidget.cpp #1288606:1288607
@@ -321,43 +321,9 @@
}
/**
- * Captures any popup menu signals for menus it created.
+ * Adds an activity to this widget.
+ * @return true on success
*/
-void StateWidget::slotMenuSelection(QAction* action)
-{
- bool ok = false;
- QString nameNew = name();
-
- ListPopupMenu::MenuType sel = m_pMenu->getMenuType(action);
- switch( sel ) {
- case ListPopupMenu::mt_Rename:
- nameNew = KInputDialog::getText( i18n("Enter State Name"), i18n("Enter the name of the new state:"), name(), &ok );
- if( ok && nameNew.length() > 0 )
- setName( nameNew );
- break;
-
- case ListPopupMenu::mt_Properties:
- showPropertiesDialog();
- break;
-
- case ListPopupMenu::mt_New_Activity:
- nameNew = KInputDialog::getText( i18n("Enter Activity"), i18n("Enter the name of the new activity:"), i18n("new activity"), &ok );
- if( ok && nameNew.length() > 0 )
- addActivity( nameNew );
- break;
-
- case ListPopupMenu::mt_Flip:
- setDrawVertical(!m_drawVertical);
- break;
-
- default:
- UMLWidget::slotMenuSelection(action);
- }
-}
-
-/**
- * Adds the given activity to the state.
- */
bool StateWidget::addActivity(const QString &activity)
{
m_Activities.append( activity );
@@ -377,6 +343,18 @@
}
/**
+ * Renames the given activity.
+ */
+bool StateWidget::renameActivity(const QString &activity, const QString &newName)
+{
+ int index = - 1;
+ if( ( index = m_Activities.indexOf( activity ) ) == -1 )
+ return false;
+ m_Activities[ index ] = newName;
+ return true;
+}
+
+/**
* Sets the states activities to the ones given.
*/
void StateWidget::setActivities(const QStringList &list)
@@ -394,18 +372,6 @@
}
/**
- * Renames the given activity.
- */
-bool StateWidget::renameActivity(const QString &activity, const QString &newName)
-{
- int index = - 1;
- if( ( index = m_Activities.indexOf( activity ) ) == -1 )
- return false;
- m_Activities[ index ] = newName;
- return true;
-}
-
-/**
* Get whether to draw a fork or join vertically.
*/
bool StateWidget::drawVertical() const
@@ -497,4 +463,46 @@
return true;
}
+/**
+ * Captures any popup menu signals for menus it created.
+ */
+void StateWidget::slotMenuSelection(QAction* action)
+{
+ bool ok = false;
+ QString nameNew = name();
+
+ ListPopupMenu::MenuType sel = m_pMenu->getMenuType(action);
+ switch( sel ) {
+ case ListPopupMenu::mt_Rename:
+ nameNew = KInputDialog::getText( i18n("Enter State Name"),
+ i18n("Enter the name of the new state:"),
+ name(), &ok );
+ if ( ok && nameNew.length() > 0 ) {
+ setName( nameNew );
+ }
+ break;
+
+ case ListPopupMenu::mt_Properties:
+ showPropertiesDialog();
+ break;
+
+ case ListPopupMenu::mt_New_Activity:
+ nameNew = KInputDialog::getText( i18n("Enter Activity"),
+ i18n("Enter the name of the new activity:"),
+ i18n("new activity"), &ok );
+ if ( ok && nameNew.length() > 0 ) {
+ addActivity( nameNew );
+ }
+ break;
+
+ case ListPopupMenu::mt_Flip:
+ setDrawVertical(!m_drawVertical);
+ break;
+
+ default:
+ UMLWidget::slotMenuSelection(action);
+ break;
+ }
+}
+
#include "statewidget.moc"
More information about the umbrello-devel
mailing list