[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sun Feb 12 21:49:01 UTC 2006
SVN commit 508928 by okellogg:
SQLWriter::defaultDatatypes(): New. Extracted from UMLEntityAttributeDialog::setupDialog().
M +29 -0 codegenerators/sqlwriter.cpp
M +5 -0 codegenerators/sqlwriter.h
M +13 -26 dialogs/umlentityattributedialog.cpp
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/sqlwriter.cpp #508927:508928
@@ -199,6 +199,35 @@
return Uml::pl_SQL;
}
+QStringList SQLWriter::defaultDatatypes() {
+ QStringList l;
+ l.append("varchar");
+ l.append("tinyint");
+ l.append("smallint");
+ l.append("mediumint");
+ l.append("bigint");
+ l.append("float");
+ l.append("double");
+ l.append("decimal");
+ l.append("date");
+ l.append("datetime");
+ l.append("time");
+ l.append("timestamp");
+ l.append("year");
+ l.append("char");
+ l.append("tinyblob");
+ l.append("blob");
+ l.append("mediumblob");
+ l.append("longblob");
+ l.append("tinytext");
+ l.append("text");
+ l.append("mediumtext");
+ l.append("longtext");
+ l.append("enum");
+ l.append("set");
+ return l;
+}
+
const QStringList SQLWriter::reservedKeywords() const {
static QStringList keywords;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/sqlwriter.h #508927:508928
@@ -46,6 +46,11 @@
virtual Uml::Programming_Language getLanguage();
/**
+ * Reimplement method from CodeGenerator.
+ */
+ virtual QStringList defaultDatatypes();
+
+ /**
* get list of reserved keywords
*/
virtual const QStringList reservedKeywords() const;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/umlentityattributedialog.cpp #508927:508928
@@ -36,6 +36,7 @@
#include "../classifier.h"
#include "../umldoc.h"
#include "../uml.h"
+#include "../codegenerator.h"
#include "../dialog_utils.h"
#include "../object_factory.h"
@@ -48,7 +49,7 @@
UMLEntityAttributeDialog::~UMLEntityAttributeDialog() {}
void UMLEntityAttributeDialog::setupDialog() {
- UMLDoc * pDoc = UMLApp::app()->getDocument();
+ //UMLDoc * pDoc = UMLApp::app()->getDocument();
int margin = fontMetrics().height();
QVBoxLayout * mainLayout = new QVBoxLayout( plainPage() );
@@ -134,31 +135,17 @@
m_pTypeCB->setDuplicatesEnabled(false);//only allow one of each type in box
- //now add the Concepts
- insertType("varchar");
- insertType("tinyint");
- insertType("smallint");
- insertType("mediumint");
- insertType("bigint");
- insertType("float");
- insertType("double");
- insertType("decimal");
- insertType("date");
- insertType("datetime");
- insertType("time");
- insertType("timestamp");
- insertType("year");
- insertType("char");
- insertType("tinyblob");
- insertType("blob");
- insertType("mediumblob");
- insertType("longblob");
- insertType("tinytext");
- insertType("text");
- insertType("mediumtext");
- insertType("longtext");
- insertType("enum");
- insertType("set");
+ // Add the data types.
+ QStringList dataTypes = UMLApp::app()->getGenerator()->defaultDatatypes();
+ if (dataTypes.count() == 0) {
+ // Switch to SQL as the active language if not datatypes are set.
+ UMLApp::app()->setActiveLanguage("SQL");
+ dataTypes = UMLApp::app()->getGenerator()->defaultDatatypes();
+ }
+ QStringList::Iterator dend(dataTypes.end());
+ for (QStringList::Iterator dit = dataTypes.begin(); dit != dend; ++dit) {
+ insertType(*dit);
+ }
//work out which one to select
int typeBoxCount = 0;
More information about the umbrello-devel
mailing list