Commit 739d8c06 authored by Ralf Habacker's avatar Ralf Habacker

Fix 'No documentation edit possible in class attribute, operation and template dialog'.

This commit introduces a new class DocumentationWidget in sub directory dialogs/widgets
to prepare properties window support.

BUG:342330
FIXED-IN:2.15.1 (KDE 14.12.1)
parent 4a7aee8f
......@@ -51,6 +51,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/debug/
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/pages/
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/widgets/
${CMAKE_CURRENT_SOURCE_DIR}/docgenerators/
${CMAKE_CURRENT_SOURCE_DIR}/finder/
${CMAKE_CURRENT_SOURCE_DIR}/refactoring/
......@@ -222,6 +223,7 @@ set(libdialogs_SRCS
dialogs/pages/diagramprintpage.cpp
dialogs/pages/umlroleproperties.cpp
dialogs/pages/umlwidgetstylepage.cpp
dialogs/widgets/documentationwidget.cpp
)
kde4_add_ui_files( libdialogs_SRCS
......
......@@ -14,6 +14,7 @@
// app includes
#include "attribute.h"
#include "classifier.h"
#include "documentationwidget.h"
#include "template.h"
#include "umldoc.h"
#include "uml.h"
......@@ -136,6 +137,9 @@ void UMLAttributeDialog::setupDialog()
//now add the Concepts
insertTypesSorted(m_pAttribute->getTypeName());
m_docWidget = new DocumentationWidget(m_pAttribute, this);
mainLayout->addWidget(m_docWidget);
m_pNameLE->setFocus();
connect(m_pNameLE, SIGNAL(textChanged(QString)), SLOT(slotNameChanged(QString)));
slotNameChanged(m_pNameLE->text());
......@@ -229,6 +233,8 @@ bool UMLAttributeDialog::apply()
classifier = static_cast<UMLClassifier*>(obj);
}
m_pAttribute->setType(classifier);
m_docWidget->apply();
return true;
}
......
......@@ -13,6 +13,7 @@
#include <kdialog.h>
class DocumentationWidget;
class QCheckBox;
class QGroupBox;
class QRadioButton;
......@@ -53,6 +54,7 @@ protected:
KComboBox * m_pTypeCB;
KLineEdit * m_pNameLE, * m_pInitialLE, * m_pStereoTypeLE;
QCheckBox* m_pStaticCB;
DocumentationWidget *m_docWidget;
public slots:
......
......@@ -21,6 +21,7 @@
#include "listpopupmenu.h"
#include "umlattributelist.h"
#include "classifierlistitem.h"
#include "documentationwidget.h"
#include "umlclassifierlistitemlist.h"
#include "dialog_utils.h"
#include "parameterpropertiesdialog.h"
......@@ -137,6 +138,8 @@ void UMLOperationDialog::setupDialog()
m_pImplementationRB = new QRadioButton(i18n("I&mplementation"), m_pScopeGB);
scopeLayout->addWidget(m_pImplementationRB);
m_docWidget = new DocumentationWidget(m_operation, this);
m_pParmsGB = new QGroupBox(i18n("Parameters"), frame);
QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB);
parmsLayout->setMargin(margin);
......@@ -176,6 +179,7 @@ void UMLOperationDialog::setupDialog()
topLayout->addWidget(m_pGenGB);
topLayout->addWidget(m_pScopeGB);
topLayout->addWidget(m_docWidget);
topLayout->addWidget(m_pParmsGB);
m_pDeleteButton->setEnabled(false);
......@@ -485,6 +489,7 @@ bool UMLOperationDialog::apply()
}
m_operation->setStatic(m_pStaticCB->isChecked());
m_operation->setConst(m_pQueryCB->isChecked());
m_docWidget->apply();
return true;
}
......
......@@ -17,6 +17,7 @@
//qt includes
#include <QListWidgetItem>
class DocumentationWidget;
class UMLOperation;
class ListPopupMenu;
class QGroupBox;
......@@ -77,6 +78,7 @@ protected:
QPushButton* m_pPropertiesButton;
QToolButton* m_pUpButton;
QToolButton* m_pDownButton;
DocumentationWidget* m_docWidget;
public slots:
void slotParmRightButtonPressed(const QPoint &p);
......
......@@ -14,6 +14,7 @@
// app includes
#include "template.h"
#include "classifier.h"
#include "documentationwidget.h"
#include "umldoc.h"
#include "uml.h"
#include "dialog_utils.h"
......@@ -83,6 +84,9 @@ void UMLTemplateDialog::setupDialog()
mainLayout->addWidget(m_pValuesGB);
m_docWidget = new DocumentationWidget(m_pTemplate, this);
mainLayout->addWidget(m_docWidget);
m_pTypeCB->setEditable(true);
m_pTypeCB->setDuplicatesEnabled(false); // only allow one of each type in box
m_pTypeCB->setCompletionMode(KGlobalSettings::CompletionPopup);
......@@ -164,6 +168,7 @@ bool UMLTemplateDialog::apply()
m_pTemplate->setName(name);
m_pTemplate->setStereotype(m_pStereoTypeLE->text());
m_docWidget->apply();
return true;
}
......
......@@ -13,6 +13,7 @@
#include <kdialog.h>
class DocumentationWidget;
class KComboBox;
class KLineEdit;
class QGroupBox;
......@@ -48,6 +49,7 @@ protected:
QLabel *m_pTypeL, *m_pNameL, *m_pStereoTypeL;
KComboBox *m_pTypeCB;
KLineEdit *m_pNameLE, *m_pStereoTypeLE;
DocumentationWidget *m_docWidget;
public slots:
......
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2002-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#include "documentationwidget.h"
#include "umlobject.h"
#include <KTextEdit>
#include <KLocalizedString>
#include <QGroupBox>
#include <QHBoxLayout>
DocumentationWidget::DocumentationWidget(UMLObject *o, QWidget *parent) :
QWidget(parent),
m_object(o)
{
Q_ASSERT(o);
QVBoxLayout *l = new QVBoxLayout;
m_box = new QGroupBox;
m_box->setTitle(i18n("Documentation"));
m_editField = new KTextEdit(m_box);
m_editField->setText(o->doc());
QVBoxLayout *layout = new QVBoxLayout(m_box);
layout->addWidget(m_editField);
l->addWidget(m_box);
setLayout(l);
}
DocumentationWidget::~DocumentationWidget()
{
delete m_editField;
delete m_box;
}
/**
* Apply changes to the related UMLObject.
*/
void DocumentationWidget::apply()
{
m_object->setDoc(m_editField->toPlainText());
}
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2002-2014 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef DOCUMENTATIONWIDGET_H
#define DOCUMENTATIONWIDGET_H
#include <QWidget>
class UMLObject;
class KTextEdit;
class QGridLayout;
class QGroupBox;
class DocumentationWidget : public QWidget
{
Q_OBJECT
public:
DocumentationWidget(UMLObject *o, QWidget *parent = 0);
~DocumentationWidget();
void apply();
protected:
QGroupBox *m_box;
KTextEdit *m_editField;
UMLObject *m_object;
};
#endif // DOCUMENTATIONWIDGET_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment