[Uml-devel] branches/work/soc-umbrello (silent)
Gopala Krishna A
krishna.ggk at gmail.com
Sat Dec 20 18:03:24 UTC 2008
SVN commit 899417 by gopala:
SVN_SILENT:
Merged revisions 896752,896872 via svnmerge from
svn+ssh://svn.kde.org/home/kde/trunk/KDE/kdesdk/umbrello
........
r896752 | scripty | 2008-12-14 18:09:20 +0530 (Sun, 14 Dec 2008) | 1 line
SVN_SILENT made messages (.desktop file)
........
r896872 | sharan | 2008-12-14 21:33:41 +0530 (Sun, 14 Dec 2008) | 5 lines
1. Fix display of parameter names in the operation properties dialog.
2. Change interaction between the operation properties dialog box and
the param properties dialog.
........
_M . (directory)
M +30 -4 umbrello/dialogs/parmpropdlg.cpp
M +22 -4 umbrello/dialogs/parmpropdlg.h
M +32 -57 umbrello/dialogs/umloperationdialog.cpp
M +1 -0 umbrello/umbrello.desktop
** branches/work/soc-umbrello #property svnmerge-integrated
- /trunk/KDE/kdesdk/umbrello:1-854015,854687,854787,855207-866962,866965-870129,871091,872169-887978,889968-889981,890075-890805
+ /trunk/KDE/kdesdk/umbrello:1-854015,854687,854787,855207-866962,866965-870129,871091,872169-887978,889968-889981,890075-890805,896752-896872
--- branches/work/soc-umbrello/umbrello/dialogs/parmpropdlg.cpp #899416:899417
@@ -23,6 +23,7 @@
// kde includes
#include <klocale.h>
#include <kdebug.h>
+#include <kmessagebox.h>
// qt includes
#include <QtGui/QLayout>
@@ -243,11 +244,36 @@
return pk;
}
+bool ParmPropDlg::validate()
+{
+ // currently only validates whether the name is not null.
+ if ( getName().trimmed().length() == 0 ) {
+ KMessageBox::error(this, i18n("You have entered an invalid parameter name."),
+ i18n("Parameter Name Invalid"), false);
+ return false;
+ }
+ return true;
+}
+
+void ParmPropDlg::slotButtonClicked(int button)
+{
+ if ( button == KDialog::Ok ) {
+ if ( !validate() ) {
+ return;
+ }
+ }
+ KDialog::slotButtonClicked( button );
+}
+
void ParmPropDlg::slotOk()
{
if (m_pAtt != NULL) {
- m_pAtt->setParmKind( getParmKind() );
- m_pAtt->setStereotype( m_pStereoTypeCB->currentText() );
+
+ m_pAtt->setName( getName() ); // set the name
+ m_pAtt->setParmKind( getParmKind() ); // set the direction
+ m_pAtt->setStereotype( m_pStereoTypeCB->currentText() ); // set the stereotype
+
+ // set the type name
QString typeName = m_pTypeCB->currentText();
UMLClassifier * pConcept = dynamic_cast<UMLClassifier*>( m_pAtt->parent()->parent() );
if (pConcept == NULL) {
@@ -256,7 +282,6 @@
UMLTemplate *tmplParam = pConcept->findTemplate(typeName);
if (tmplParam) {
m_pAtt->setType(tmplParam);
- accept();
return;
}
}
@@ -280,8 +305,9 @@
m_pAtt->setType(newObj);
}
+ m_pAtt->setDoc( getDoc() ); // set the documentation
+ m_pAtt->setInitialValue( getInitialValue() ); // set the initial value
}
- accept();
}
#include "parmpropdlg.moc"
--- branches/work/soc-umbrello/umbrello/dialogs/parmpropdlg.h #899416:899417
@@ -50,6 +50,15 @@
*/
~ParmPropDlg();
+public slots:
+ void slotOk();
+
+protected:
+
+ /**
+ * Returns the documentation.
+ * @return Returns the documentation.
+ */
QString getDoc() {
return m_pDoc->toPlainText();
}
@@ -68,15 +77,24 @@
Uml::Parameter_Direction getParmKind();
-public slots:
- void slotOk();
-protected:
-
void insertTypesSorted(const QString& type = "");
void insertStereotypesSorted(const QString& type = "");
+ /**
+ * Validates the fields in the dialog box.
+ */
+ bool validate();
+
+protected slots:
+
+ /**
+ * Activated when a button is clicked
+ * @param button The button that was clicked
+ */
+ virtual void slotButtonClicked(int button);
+
private:
QGroupBox * m_pParmGB, * m_pDocGB;
QGroupBox *m_pKind;
--- branches/work/soc-umbrello/umbrello/dialogs/umloperationdialog.cpp #899416:899417
@@ -181,7 +181,7 @@
// fill in parm list box
UMLAttributeList list = m_operation->getParmList();
foreach (UMLAttribute* pAtt, list ) {
- m_pParmsLW->addItem( pAtt->getName() );
+ m_pParmsLW->addItem( pAtt->toString( Uml::st_SigNoVis ) );
}
// set scope
@@ -285,24 +285,14 @@
ParmPropDlg dlg(this, m_doc, newAttribute);
result = dlg.exec();
- QString name = dlg.getName();
- pAtt = m_operation -> findParm( name );
+
if ( result ) {
- if ( name.length() == 0 ) {
- KMessageBox::error(this, i18n("You have entered an invalid parameter name."),
- i18n("Parameter Name Invalid"), false);
- delete newAttribute;
- return;
- }
+ pAtt = m_operation -> findParm( newAttribute->getName() );
+
if ( !pAtt ) {
newAttribute->setID( UniqueID::gen() );
- newAttribute->setName( name );
- newAttribute->setTypeName( dlg.getTypeName() );
- newAttribute->setInitialValue( dlg.getInitialValue() );
- newAttribute->setDoc( dlg.getDoc() );
- newAttribute->setParmKind( dlg.getParmKind() );
m_operation->addParm( newAttribute );
- m_pParmsLW->addItem( name );
+ m_pParmsLW->addItem( newAttribute->toString( Uml::st_SigNoVis ) );
m_doc->setModified( true );
} else {
KMessageBox::sorry(this, i18n("The parameter name you have chosen\nis already being used in this operation."),
@@ -316,7 +306,7 @@
void UMLOperationDialog::slotDeleteParameter()
{
- UMLAttribute* pOldAtt = m_operation->findParm( m_pParmsLW->currentItem()->text() );
+ UMLAttribute* pOldAtt = m_operation->getParmList().at( m_pParmsLW->row( m_pParmsLW->currentItem() ) );
m_operation->removeParm( pOldAtt );
m_pParmsLW->takeItem( m_pParmsLW->currentRow() );
@@ -332,53 +322,41 @@
{
int result = 0;
UMLAttribute* pAtt = 0, * pOldAtt = 0;
- pOldAtt = m_operation->findParm( m_pParmsLW->currentItem()->text() );
+ int position = m_pParmsLW->row( m_pParmsLW->currentItem() );
+ pOldAtt = m_operation->getParmList().at( position );
if ( !pOldAtt ) {
uDebug() << "THE impossible has occurred for:" << m_pParmsLW->currentItem()->text();
return;
} // should never occur
- ParmPropDlg dlg(this, m_doc, pOldAtt);
+
+ QString oldAttName = pOldAtt->getName();
+ UMLAttribute* tempAttribute = static_cast<UMLAttribute*>( pOldAtt->clone() ); // create a clone of the parameter
+
+ ParmPropDlg dlg(this, m_doc, tempAttribute); // send the clone to the properties dialog box. it will fill in the new parameters.
result = dlg.exec();
- QString name = dlg.getName();
- pAtt = m_operation->findParm( name );
+
if ( result ) {
- if ( name.length() == 0 ) {
- KMessageBox::error(this, i18n("You have entered an invalid parameter name."),
- i18n("Parameter Name Invalid"), false);
- return;
- }
- if ( !pAtt || pOldAtt->getTypeName() != dlg.getTypeName() ||
- pOldAtt->getDoc() != dlg.getDoc() ||
- pOldAtt->getInitialValue() != dlg.getInitialValue() ) {
- pOldAtt->setName( name );
- QString typeName = dlg.getTypeName();
- if (pOldAtt->getTypeName() != typeName) {
- UMLClassifierList namesList( m_doc->getConcepts() );
- bool breakFlag = false;
- foreach (UMLObject* obj, namesList) {
- if (typeName == obj->getFullyQualifiedName()) {
- pOldAtt->setType(obj);
- breakFlag = true;
- break;
- }
- }
- if (!breakFlag) {
- // Nothing found: set type name directly. Bad.
- uDebug() << typeName << " not found.";
- pOldAtt->setTypeName( typeName ); // Bad.
- }
- }
- QListWidgetItem* item = m_pParmsLW->currentItem();
- item->setText( dlg.getName() );
- pOldAtt->setDoc( dlg.getDoc() );
- pOldAtt->setInitialValue( dlg.getInitialValue() );
- m_doc->setModified( true );
- } else if( pAtt != pOldAtt ) {
+ bool namingConflict = false;
+ QString newName = tempAttribute->getName();
+
+ pAtt = m_operation->findParm( newName ); // search whether a parameter with this name already exists
+ if( pAtt && pAtt != pOldAtt ) {
KMessageBox::error(this, i18n("The parameter name you have chosen is already being used in this operation."),
i18n("Parameter Name Not Unique"), false);
+ namingConflict = true;
}
+
+ tempAttribute->copyInto( pOldAtt ); // copy all attributes from the clone
+ if ( namingConflict ) {
+ pOldAtt->setName( oldAttName ); // reset the name if there was a naming conflict
+ }
+
+ QListWidgetItem* item = m_pParmsLW->currentItem();
+ item->setText( pOldAtt->toString(Uml::st_SigNoVis) );
+ m_doc->setModified( true );
}
+ delete tempAttribute;
}
void UMLOperationDialog::slotParameterUp()
@@ -386,7 +364,7 @@
int row = m_pParmsLW->currentRow();
QListWidgetItem* item = m_pParmsLW->currentItem();
if (item) {
- UMLAttribute* pOldAtt = m_operation->findParm(item->text());
+ UMLAttribute* pOldAtt = m_operation->getParmList().at( m_pParmsLW->row( item ) );
m_operation->moveParmLeft( pOldAtt );
m_pParmsLW->takeItem(row);
@@ -405,7 +383,7 @@
int row = m_pParmsLW->currentRow();
QListWidgetItem* item = m_pParmsLW->currentItem();
if (item) {
- UMLAttribute* pOldAtt = m_operation->findParm(item->text());
+ UMLAttribute* pOldAtt = m_operation->getParmList().at( m_pParmsLW->row( item ) );
m_operation->moveParmRight( pOldAtt );
m_pParmsLW->takeItem(row);
@@ -514,9 +492,6 @@
apply();
}
-/**
- * Used when the OK button is clicked. Calls apply().
- */
void UMLOperationDialog::slotOk()
{
if ( apply() ) {
--- branches/work/soc-umbrello/umbrello/umbrello.desktop #899416:899417
@@ -42,6 +42,7 @@
GenericName[pl]=Program do modelowania UML
GenericName[pt]=Modelador de UML
GenericName[pt_BR]=Modelador de UML
+GenericName[ro]=Modelator UML
GenericName[ru]=Средство UML моделирования
GenericName[sk]=Modelár UML
GenericName[sl]=Mofdelirnik UML
More information about the umbrello-devel
mailing list