Verified Commit 43a611c4 authored by ita1024's avatar ita1024

Add a new "Entity" shape for data models

parent ecf43eb8
......@@ -2,8 +2,9 @@ Semantik 1.2.0
--------------
* Add a system of references similar to what was present in Kdissert #91
* Add support for newlines in table attachments #89
* Add a new Entity shape
* Configure arrow colors on the main map
* Fix missing crossing lines when printing or exporting diagrams
* Configure arrow colors
Semantik 1.1.0
--------------
......
......@@ -26,7 +26,7 @@ Semantik will only work if installed, so make sure to install
after the configuration and builds are successful:
./waf install
Sometimes additional installation options may be necessary:
Sometimes additional installation options may be (un)necessary:
./waf install --nomimes --noldconfig --nogtkicons
The generic command for creating a package is the following (packagers):
......@@ -36,11 +36,10 @@ The generic command for creating a package is the following (packagers):
2. Getting started:
Consult the tips in the help menu!
Consult the tips in the help menu and/or the file named "example.sem"!
---------------------------------------------------
3. Document generators and pictures:
* For security reasons, only use documents that you have created yourself
......@@ -70,7 +69,6 @@ GPL V3
---------------------------------------------------
5. Quirks:
If screen artifacts are observed when dragging and selecting elements,
......@@ -85,4 +83,3 @@ font for this reason.
---------------------------------------------------
......@@ -50,6 +50,23 @@ void node::dump_xml(QStringList & other)
}
}
void data_box_entity_value::read_data(const QString& i_sName, const QXmlAttributes& i_oAttrs)
{
Q_ASSERT(i_sName == QString("box_entity_val"));
m_sName = i_oAttrs.value(notr("name"));
m_sType = i_oAttrs.value(notr("type"));
m_sKey = i_oAttrs.value(notr("key"));
}
void data_box_entity_value::dump_xml(QStringList& i_oS)
{
i_oS<<notr(" <box_entity_val name=\"%1\" type=\"%2\" key=\"%3\"/>\n").arg(
bind_node::protectXML(m_sName),
bind_node::protectXML(m_sType),
bind_node::protectXML(m_sKey)
);
}
data_item::data_item(int i_iId)
{
m_iDataType = VIEW_TEXT;
......@@ -192,14 +209,15 @@ data_box& data_box::operator=(const data_box & i_o)
m_iHH = i_o.m_iHH;
m_oCustom.m_oInnerColor = i_o.m_oCustom.m_oInnerColor;
m_oRowSizes = i_o.m_oRowSizes;
m_oColSizes = i_o.m_oColSizes;
m_oRowSizes = i_o.m_oRowSizes;
m_oColSizes = i_o.m_oColSizes;
m_bStatic = i_o.m_bStatic;
m_bAbstract = i_o.m_bAbstract;
m_sStereotype = i_o.m_sStereotype;
m_oMethods = i_o.m_oMethods;
m_oAttributes = i_o.m_oAttributes;
m_bStatic = i_o.m_bStatic;
m_bAbstract = i_o.m_bAbstract;
m_sStereotype = i_o.m_sStereotype;
m_oMethods = i_o.m_oMethods;
m_oAttributes = i_o.m_oAttributes;
m_oEntityValues = i_o.m_oEntityValues;
return *this;
}
......@@ -256,6 +274,15 @@ void data_box::dump_xml(QStringList & i_oS)
}
i_oS<<notr(" </box_class>\n");
}
else if (m_iType == data_box::ENTITY)
{
i_oS<<notr("<box_entity>\n");
foreach (data_box_entity_value l_oValue, m_oEntityValues)
{
l_oValue.dump_xml(i_oS);
}
i_oS<<notr("</box_entity>\n");
}
//node::dump_xml(i_oS);
i_oS<<notr("</itembox>\n");
......@@ -351,6 +378,14 @@ node& data_box::make_node(const QString& i_sName, const QXmlAttributes& i_oAttrs
m_bAbstract = i_oAttrs.value(notr("abstract")).toInt();
m_sStereotype = i_oAttrs.value(notr("stereotype"));
}
else if (i_sName == notr("box_entity_val"))
{
data_box_entity_value l_o;
l_o.read_data(i_sName, i_oAttrs);
m_oEntityValues.push_back(l_o);
return m_oEntityValues.last();
}
return *this;
// return node::make_node(i_sName, i_oAttrs);
}
......
......@@ -125,6 +125,17 @@ class data_box_attribute : public node
virtual void dump_xml(QStringList & other);
};
class data_box_entity_value : public node
{
public:
QString m_sName;
QString m_sType;
QString m_sKey;
virtual void read_data(const QString&, const QXmlAttributes&);
virtual void dump_xml(QStringList&);
};
class data_box : public diagram_item, public node
{
public:
......@@ -142,7 +153,7 @@ class data_box : public diagram_item, public node
int m_iHH;
enum IType { ACTIVITY=1, ACTIVITY_START=2, ACTIVITY_PARALLEL=3, LABEL=4, COMPONENT=5, NODE=6, \
ACTOR=7, USECASE=8, DECISION=9, MATRIX=10, FRAME=11, CLASS=12, CAPTION=13, DATABASE=14,
RECTANGLE=15, PIPE=16, SEQUENCE=17};
RECTANGLE=15, PIPE=16, SEQUENCE=17, ENTITY=18};
data_box::IType m_iType;
node& make_node(const QString&, const QXmlAttributes&);
......@@ -170,6 +181,9 @@ class data_box : public diagram_item, public node
QString m_sStereotype;
QList<data_box_method> m_oMethods;
QList<data_box_attribute> m_oAttributes;
// entity
QList<data_box_entity_value> m_oEntityValues;
};
class data_pic
......
......@@ -25,7 +25,7 @@ class mem_command {
enum IType {DELETE, ADD, LINK, UNLINK, SELECT, MOVE, COLOR, FLAG, EDIT, DATATYPE, TEXT, VARS, PIC, TABLE, SORT,
ADD_BOX, DEL_BOX, EDIT_BOX, LINK_BOX, UNLINK_BOX, PROP_BOX, POS_BOX, CHANGE_LINK_BOX, SIZE_BOX,
EDIT_LINK, IMPORT_BOX, SIZE_MATRIX, CHANGE_CLASS_BOX, DIAGRAM_PROPERTIES, SIZE_SEQUENCE, DOC,
TEXT_ALIGN_BOX, REF, UNREF, ALL_COLOR};
TEXT_ALIGN_BOX, REF, UNREF, ALL_COLOR, CHANGE_ENTITY_BOX};
virtual IType type() = 0;
};
......
......@@ -153,7 +153,7 @@ void box_class::paint(QPainter *i_oPainter, const QStyleOptionGraphicsItem *opti
i_oPainter->drawLine(l_oRect.topLeft() + QPointF(0, l_fHpos +1 + PAD), l_oRect.topRight() + QPointF(0, l_fHpos + 1 + PAD));
l_fHpos += 1 + PAD;
}
foreach (data_box_attribute l_o, m_oBox->m_oAttributes) {
foreach (const data_box_attribute &l_o, m_oBox->m_oAttributes) {
QRectF l_oR;
if (l_o.m_bStatic) {
l_oR = l_oUnderlineFm.boundingRect(l_o.m_sText);
......@@ -218,7 +218,7 @@ void box_class::paint(QPainter *i_oPainter, const QStyleOptionGraphicsItem *opti
l_fHpos += 1 + PAD;
}
foreach (data_box_method l_o, m_oBox->m_oMethods)
foreach (const data_box_method &l_o, m_oBox->m_oMethods)
{
QRectF l_oR;
if (l_o.m_bAbstract && l_o.m_bStatic)
......@@ -330,7 +330,7 @@ QSizeF box_class::size()
{
l_iHH += 2 * PAD + 1; // 1 for the line
}
foreach (data_box_method l_o, m_oBox->m_oMethods)
foreach (const data_box_method &l_o, m_oBox->m_oMethods)
{
QRectF l_oR;
......@@ -357,7 +357,7 @@ QSizeF box_class::size()
if (m_oBox->m_oAttributes.size() > 0) {
l_iHH += 2 * PAD + 1; // 1 for the line
}
foreach (data_box_attribute l_o, m_oBox->m_oAttributes) {
foreach (const data_box_attribute &l_o, m_oBox->m_oAttributes) {
QRectF l_oR;
if (l_o.m_bStatic) {
l_oR = l_oUnderlineFm.boundingRect(l_o.m_sText);
......@@ -419,21 +419,21 @@ void box_class::properties()
QStringList l_oS;
if (props.m_oClass->m_oBox->m_bStatic) {
l_oS<<notr("static\t");
l_oS<<notr("static ");
}
if (props.m_oClass->m_oBox->m_bAbstract) {
l_oS<<notr("abstract\t");
l_oS<<notr("abstract ");
}
l_oS<<notr("class\t");
l_oS<<notr("class ");
l_oS<<props.m_oClass->m_oBox->m_sText<<notr("\n");
if (!props.m_oClass->m_oBox->m_sStereotype.isEmpty()) {
l_oS<<notr("stereotype\t")<<props.m_oClass->m_oBox->m_sStereotype<<notr("\n");
l_oS<<notr("stereotype ")<<props.m_oClass->m_oBox->m_sStereotype<<notr("\n");
}
l_oS<<notr("\n");
foreach (data_box_attribute l_o, m_oBox->m_oAttributes) {
foreach (const data_box_attribute &l_o, m_oBox->m_oAttributes) {
if (l_o.m_oVisibility == visibility::PUBLIC) {
l_oS<<notr("public\t");
} else if (l_o.m_oVisibility == visibility::PROTECTED) {
......@@ -455,7 +455,7 @@ void box_class::properties()
l_oS<<notr("\n");
foreach (data_box_method l_o, m_oBox->m_oMethods) {
foreach (const data_box_method &l_o, m_oBox->m_oMethods) {
if (l_o.m_oVisibility == visibility::PUBLIC) {
l_oS<<notr("public\t");
} else if (l_o.m_oVisibility == visibility::PROTECTED) {
......
......@@ -30,11 +30,7 @@
class_editor::class_editor(QWidget *i_oParent) : QTextEdit(i_oParent)
{
new class_highlighter(document());
//setStyleSheet("font-family: \"DejaVu Sans Mono\", \"Courier New\", Courier, monospace;");
QFont l_oFont = currentFont();
l_oFont.setStyleHint(QFont::Monospace);
setFont(l_oFont);
setStyleSheet("QTextEdit { font-family: monospace;}");
m_oCompleter = NULL;
startup = true;
......@@ -299,7 +295,8 @@ void box_class_properties::apply() {
QRegExp rm("^(public|private|protected|package|derived)\\s*(static|abstract)?\\s*(static|abstract)?\\s*(\\w.*)");
QRegExp rs("^stereotype\\s*(\\w.*)");
for (int i=1; i < l_oTmp.size() - 1; ++i) {
for (int i=1; i < l_oTmp.size(); ++i)
{
QString l_s = l_oTmp[i];
if (rm.indexIn(l_s) >= 0) {
QString l_sData = rm.cap(4);
......
// Thomas Nagy 2007-2018 GPLV3
#include <QApplication>
#include <QAbstractTextDocumentLayout>
#include <QTextDocument>
#include <QTextDocumentFragment>
#include <QTextList>
#include <QClipboard>
#include <QPainter>
#include <QtDebug>
#include <QAction>
#include <QTextEdit>
#include <QStringList>
#include <QTextDocument>
#include "box_entity.h"
#include "data_item.h"
#include "res:zable.h"
#include "box_view.h"
#include "box_link.h"
#include "sem_mediator.h"
#include "mem_box.h"
#include "box_entity_properties.h"
#include "math.h"
#include <QFont>
#define PAD 0.5
#define MIN_FORK_SIZE 30
//#define DEBUG
int fceil(qreal l_fInput, int l_iBase)
{
int l_iCal = ceil(l_fInput);
if (l_iCal % l_iBase == 0)
{
return l_iCal;
}
return l_iBase * (1 + l_iCal / l_iBase);
}
box_entity::box_entity(box_view* view, int id) : box_item(view, id)
{
setZValue(80);
update_size();
}
void box_entity::force_size()
{
QSizeF l_o = size();
int l_iWW = fceil(l_o.width(), GRID);
int l_iHH = fceil(l_o.height(), GRID);
setRect(0, 0, l_iWW, l_iHH);
m_iWW = m_oBox->m_iWW = l_iWW;
m_iHH = m_oBox->m_iHH = l_iHH;
}
void box_entity::paint(QPainter *i_oPainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen l_oPen;
l_oPen.setCosmetic(false);
l_oPen.setWidthF(0.01 + 1);
if (isSelected()) l_oPen.setStyle(Qt::DotLine);
else l_oPen.setStyle(Qt::SolidLine);
i_oPainter->setPen(l_oPen);
qreal pad = l_oPen.width() / 2.;
QRectF l_oRect = rect().adjusted(pad, pad, -pad, -pad);
QColor bc = m_oBox->getColor(m_oView->m_oMediator);
i_oPainter->setBrush(bc);
i_oPainter->drawRect(l_oRect);
l_oPen.setStyle(Qt::SolidLine);
QRectF l_oInnerRect = l_oRect.adjusted(1 + PAD, 1 + PAD, -1 - PAD, -1 - PAD);
#ifdef DEBUG
i_oPainter->save();
QColor bic("#00ffff");
i_oPainter->setBrush(bic);
i_oPainter->drawRect(l_oInnerRect);
i_oPainter->restore();
#endif
qreal l_fHpos = 0;
{
QFont l_oBoldFont(scene()->font());
l_oBoldFont.setBold(true);
i_oPainter->setFont(l_oBoldFont);
QFontMetricsF l_oFm(l_oBoldFont);
QString l_sText = m_oBox->m_sText;
if (l_sText.isEmpty()) {
l_sText = notr(" ");
}
QRectF l_oR = l_oFm.boundingRect(l_sText);
l_oR.setWidth(l_oInnerRect.width());
l_oR.moveTo(l_oInnerRect.topLeft() + QPointF(0, l_fHpos));
l_oR.adjust(-1, 0, 1, 0);
#ifdef DEBUG
i_oPainter->save();
QColor bc("#ffff00");
i_oPainter->setBrush(bc);
i_oPainter->drawRect(l_oR);
i_oPainter->restore();
#endif
i_oPainter->drawText(l_oR, Qt::AlignCenter | Qt::TextSingleLine | Qt::AlignVCenter, l_sText);
l_fHpos += l_oR.height();
}
QFont l_oNormalFont(scene()->font());
i_oPainter->setFont(l_oNormalFont);
QFontMetricsF l_oNormalFm(l_oNormalFont);
if (m_oBox->m_oEntityValues.size() > 0)
{
l_fHpos += PAD;
i_oPainter->drawLine(l_oRect.topLeft() + QPointF(0, l_fHpos +1 + PAD), l_oRect.topRight() + QPointF(0, l_fHpos + 1 + PAD));
l_fHpos += 1 + PAD;
}
qreal l_fSizeAttr = 0;
qreal l_fSizeType = 0;
qreal l_fSizeKey = 0;
foreach (const data_box_entity_value &l_o, m_oBox->m_oEntityValues)
{
QRectF l_oR = l_oNormalFm.boundingRect(l_o.m_sName);
l_fSizeAttr = qMax(l_fSizeAttr, l_oR.width() + 2);
if (!l_o.m_sType.isEmpty())
{
l_oR = l_oNormalFm.boundingRect(l_o.m_sType);
l_fSizeType = qMax(l_fSizeType, l_oR.width() + 2);
}
if (!l_o.m_sKey.isEmpty())
{
l_oR = l_oNormalFm.boundingRect(l_o.m_sKey);
l_fSizeKey = qMax(l_fSizeKey, l_oR.width() + 2);
}
}
qreal l_fSpacer = l_oNormalFm.boundingRect(notr(" ")).width() / 2.;
qreal l_fLeftPad = PAD;
if (l_oInnerRect.width() > l_fSpacer * 2 + l_fSizeAttr + l_fSizeType + l_fSizeKey)
{
l_fLeftPad = (l_oInnerRect.width() - l_fSpacer * 2 - l_fSizeAttr - l_fSizeType - l_fSizeKey) / 2.;
}
foreach (const data_box_entity_value &l_o, m_oBox->m_oEntityValues)
{
QRectF l_oR = l_oNormalFm.boundingRect(l_o.m_sName + l_o.m_sType + l_o.m_sKey);
l_oR.moveTo(l_oInnerRect.topLeft() + QPointF(l_fLeftPad, l_fHpos));
l_oR.setWidth(l_fSizeAttr);
#ifdef DEBUG
i_oPainter->save();
QColor bc("#ff0000");
i_oPainter->setBrush(bc);
i_oPainter->drawRect(l_oR);
i_oPainter->restore();
#endif
i_oPainter->drawText(l_oR, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignTop, l_o.m_sName);
if (!l_o.m_sType.isEmpty())
{
l_oR.setWidth(l_fSizeType);
l_oR.translate(l_fSizeAttr + l_fSpacer, 0);
#ifdef DEBUG
i_oPainter->save();
QColor bc("#ff0000");
i_oPainter->setBrush(bc);
i_oPainter->drawRect(l_oR);
i_oPainter->restore();
#endif
i_oPainter->drawText(l_oR, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignTop, l_o.m_sType);
}
if (!l_o.m_sType.isEmpty())
{
l_oR.translate(l_fSizeType + l_fSpacer, 0);
l_oR.setWidth(l_fSizeKey);
#ifdef DEBUG
i_oPainter->save();
QColor bc("#ff0000");
i_oPainter->setBrush(bc);
i_oPainter->drawRect(l_oR);
i_oPainter->restore();
#endif
i_oPainter->drawText(l_oR, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignTop, l_o.m_sKey);
}
l_fHpos += l_oR.height();
}
}
QSizeF box_entity::size()
{
QFont l_oNormalFont(scene()->font());
QFontMetricsF l_oNormalFm(l_oNormalFont);
qreal l_iWW = 0, l_iHH = 2 * PAD;
if (m_oBox->m_oEntityValues.size() > 0) {
l_iHH += 2 * PAD + 1; // 1 for the line
}
qreal l_fSizeAttr = 0;
qreal l_fSizeType = 0;
qreal l_fSizeKey = 0;
foreach (const data_box_entity_value &l_o, m_oBox->m_oEntityValues)
{
QRectF l_oR = l_oNormalFm.boundingRect(l_o.m_sName);
l_fSizeAttr = qMax(l_fSizeAttr, l_oR.width());
if (!l_o.m_sType.isEmpty())
{
l_oR = l_oNormalFm.boundingRect(l_o.m_sType);
l_fSizeType = qMax(l_fSizeType, l_oR.width());
}
if (!l_o.m_sKey.isEmpty())
{
l_oR = l_oNormalFm.boundingRect(l_o.m_sKey);
l_fSizeKey = qMax(l_fSizeKey, l_oR.width());
}
QRectF l_oVer = l_oNormalFm.boundingRect(l_o.m_sName + l_o.m_sType + l_o.m_sKey);
l_iHH += l_oVer.height();
}
qreal l_fSpacer = l_oNormalFm.boundingRect(notr(" ")).width() / 2.;
l_iWW = qMax(l_iWW, l_fSizeAttr + l_fSizeType + l_fSizeKey + 4 * l_fSpacer + 2 * PAD);
l_oNormalFont.setBold(true);
{
QFontMetricsF l_oFm(l_oNormalFont);
QString l_sText = m_oBox->m_sText;
if (l_sText.isEmpty()) {
l_sText = notr(" ");
}
QRectF l_oR = l_oFm.boundingRect(l_sText);
l_iWW = qMax(l_oR.width() + 2 * l_fSpacer, l_iWW);
l_iHH += l_oR.height();
}
// +2 for the border width
int l_iWWN = (int) (l_iWW + 2 + 2 * PAD);
int l_iHHN = (int) (l_iHH + 2 * PAD);
return QSizeF(l_iWWN, l_iHHN); // adjusted
}
void box_entity::properties()
{
box_entity_properties props(m_oView, this);
QStringList l_oS;
l_oS<<notr("entity ")<<props.m_oEntity->m_oBox->m_sText<<"\n";
int l_oSizeName = 0;
int l_oSizeType = 0;
foreach (const data_box_entity_value &l_o, m_oBox->m_oEntityValues)
{
l_oSizeName = qMax(l_o.m_sName.size(), l_oSizeName);
l_oSizeType = qMax(l_o.m_sType.size(), l_oSizeType);
}
foreach (const data_box_entity_value &l_o, m_oBox->m_oEntityValues)
{
l_oS<<l_o.m_sName.leftJustified(l_oSizeName);
if (!l_o.m_sType.isEmpty())
{
l_oS<<" "<<l_o.m_sType.leftJustified(l_oSizeType);
}
if (!l_o.m_sKey.isEmpty())
{
l_oS<<" ("<<l_o.m_sKey<<")";
}
l_oS<<notr("\n");
}
l_oS<<notr("\n");
props.m_oEntityDefinition->setText(l_oS.join(notr("")));
props.exec();
}
// Thomas Nagy 2018 GPLV3
#ifndef BOX_ENTITY_H
#define BOX_ENTITY_H
#include <QGraphicsRectItem>
#include <QBrush>
#include "res:zable.h"
#include "ed:table.h"
#include "box_item.h"
#include "CON.h"
#include "con.h"
#define OFF 3
class box_entity : public box_item
{
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *);
box_entity(box_view*, int i_iId);
QSizeF size();
void force_size();
void properties();
};
#endif // BOX_CLASS_H
// Thomas Nagy 2014-2018 GPLV3
#include <KMessageBox>
#include <QSpinBox>
#include <QComboBox>
#include <QTreeWidget>
#include <QTextEdit>
#include <QAction>
#include <KDE/KDialog>
#include <QGridLayout>
#include <QLabel>
#include <QHeaderView>
#include <QDirModel>
#include <QLineEdit>
#include <QTextEdit>
#include <QRegExp>
#include <QTreeView>
#include <QStandardItem>
#include <QKeyEvent>
#include <QFont>
#include "mem_box.h"
#include "box_view.h"
#include <QtDebug>
#include "box_entity_properties.h"
entity_editor::entity_editor(QWidget *i_oParent) : QTextEdit(i_oParent)
{
new entity_highlighter(document());
setStyleSheet("QTextEdit { font-family: monospace;}");
}
entity_highlighter::entity_highlighter(QTextDocument *p): QSyntaxHighlighter(p)
{
entity_highlighter_rule l_oRule;
QTextCharFormat l_oSingle;
l_oSingle.setForeground(Qt::darkGreen);
l_oRule.m_oPattern = QRegExp("^\\s*entity\\s+");
l_oSingle.setFontWeight(QFont::Bold);
l_oRule.m_oFormat = l_oSingle;
m_oRules.append(l_oRule);
QTextCharFormat l_oKeyword;
l_oKeyword.setForeground(Qt::darkGreen);
l_oKeyword.setFontWeight(QFont::Bold);
l_oRule.m_oPattern = QRegExp("\\s\\([a-zA-Z0-9_- /|]+\\)\\s*$");
l_oRule.m_oFormat = l_oKeyword;
m_oRules.append(l_oRule);
}
void entity_highlighter::highlightBlock(const QString &i_sText)
{
foreach (entity_highlighter_rule l_oRule, m_oRules)
{
QRegExp l_oExp(l_oRule.m_oPattern);
int i = i_sText.indexOf(l_oExp);
while (i >= 0)
{
int l_iLen = l_oExp.matchedLength();
if (i_sText[i+l_iLen-1]==QChar('=')) l_iLen--;
setFormat(i, l_iLen, l_oRule.m_oFormat);
i = i_sText.indexOf(l_oExp, i + l_iLen);
}
}
}
box_entity_properties::box_entity_properties(QWidget *i_oParent, box_entity *i_oEntity):
KDialog(i_oParent), m_oEntity(i_oEntity)
{
QWidget *widget = new QWidget(this);
setCaption(i18n("Entity properties"));
setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
enableButtonApply(false);
m_oEntity = i_oEntity;
QGridLayout *l_oGridLayout = new QGridLayout(widget);
m_oEntityDefinition = new entity_editor(widget);
l_oGridLayout->addWidget(m_oEntityDefinition, 0, 0);
setMainWidget(widget);
QSize size(700, 320);
resize(size.expandedTo(minimumSizeHint()));
connect(m_oEntityDefinition, SIGNAL(textChanged()), this, SLOT(enable_apply()));
connect(this, SIGNAL(applyClicked()), this, SLOT(apply()));
connect(this, SIGNAL(okClicked()), this, SLOT(apply()));
m_oEntityDefinition->setFocus();
}
void box_entity_properties::enable_apply(int) {
enableButtonApply(true);
}
void box_entity_properties::enable_apply() {
enableButtonApply(true);
}
void box_entity_properties::apply() {
if (!isButtonEnabled(KDialog::Apply)) {
return;
}
QStringList l_oTmp = m_oEntityDefinition->toPlainText().split(notr("\n"));
if (l_oTmp.size() < 1) {
KMessageBox::sorry(this, i18n("No entity name given"), i18n("Missing entity name"));
return;
}
QRegExp rx("entity\\s+(\\w.*)");
if (rx.indexIn(l_oTmp[0]) != -1)
{
mem_entity *mem = new mem_entity(m_oEntity->m_oView->m_oMediator, m_oEntity->m_oView->m_iId);
mem->init(m_oEntity->m_oBox);
mem->m_oNewBox.m_sText = rx.cap(1);
mem->m_oNewBox.m_oEntityValues.clear();
QRegExp l_oRegName("^(\\S+)");
QRegExp l_oRegKey("\\s+\\(([a-zA-Z0-9_- /|]+)\\)\\s*$");
for (int i=1; i < l_oTmp.size(); ++i)
{</