summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2016-09-02 10:35:01 (GMT)
committerRalf Habacker <ralf.habacker@freenet.de>2016-09-02 10:35:01 (GMT)
commite8126809c24240b36418d578dc7248d0495389e5 (patch)
treeaea010cbb81f45d3a82b6fde4da53278b7a5bb3a
parent98966230b2ff8e18f90402decb622ac96549c220 (diff)
Fix 'Operations property dialog do not show source code'.
BUG:368142 FIXED-IN:2.20.80 (KDE Applications 16.11.80)
-rw-r--r--umbrello/dialogs/widgets/documentationwidget.cpp27
-rw-r--r--umbrello/dialogs/widgets/documentationwidget.h2
2 files changed, 26 insertions, 3 deletions
diff --git a/umbrello/dialogs/widgets/documentationwidget.cpp b/umbrello/dialogs/widgets/documentationwidget.cpp
index 09cbe29..e36a0bf 100644
--- a/umbrello/dialogs/widgets/documentationwidget.cpp
+++ b/umbrello/dialogs/widgets/documentationwidget.cpp
@@ -10,9 +10,12 @@
#include "documentationwidget.h"
+#include "codetextedit.h"
+#include "operation.h"
#include "umlobject.h"
#include "umlwidget.h"
+#include <KTabWidget>
#include <KTextEdit>
#include <KLocalizedString>
@@ -48,8 +51,13 @@ DocumentationWidget::~DocumentationWidget()
*/
void DocumentationWidget::apply()
{
- if (m_object)
+ if (m_object) {
m_object->setDoc(m_editField->toPlainText());
+ if (m_object->isUMLOperation()) {
+ UMLOperation *o = m_object->asUMLOperation();
+ o->setSourceCode(m_codeEditField->toPlainText());
+ }
+ }
else if (m_widget)
m_widget->setDocumentation(m_editField->toPlainText());
}
@@ -68,9 +76,22 @@ void DocumentationWidget::init(const QString &text)
m_editField->setWordWrapMode(QTextOption::WordWrap);
m_editField->setText(text);
setFocusProxy(m_editField);
-
QHBoxLayout *layout = new QHBoxLayout(m_box);
- layout->addWidget(m_editField);
+ if (m_object && m_object->isUMLOperation()) {
+ UMLOperation *o = m_object->asUMLOperation();
+ m_codeEditField = new CodeTextEdit();
+ m_codeEditField->setPlainText(o->getSourceCode());
+#if QT_VERSION >= 0x050000
+ QTabWidget* tabWidget = new QTabWidget();
+#else
+ KTabWidget* tabWidget = new KTabWidget();
+#endif
+ tabWidget->addTab(m_editField, i18n("Comment"));
+ tabWidget->addTab(m_codeEditField, i18n("Source Code"));
+ layout->addWidget(tabWidget);
+ } else {
+ layout->addWidget(m_editField);
+ }
layout->setMargin(fontMetrics().height());
l->addWidget(m_box);
setLayout(l);
diff --git a/umbrello/dialogs/widgets/documentationwidget.h b/umbrello/dialogs/widgets/documentationwidget.h
index 279553e..d5c2f9c 100644
--- a/umbrello/dialogs/widgets/documentationwidget.h
+++ b/umbrello/dialogs/widgets/documentationwidget.h
@@ -13,6 +13,7 @@
#include <QWidget>
+class CodeTextEdit;
class UMLObject;
class UMLWidget;
@@ -34,6 +35,7 @@ public:
protected:
QGroupBox *m_box;
KTextEdit *m_editField;
+ CodeTextEdit *m_codeEditField;
UMLObject *m_object;
UMLWidget *m_widget;
void init(const QString &text);