Commit 911780cc authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Fix bug 'Notes content is not persistent.'

The bug has been fixed by editing note widget text through the documentation window
instead of the special note widget dialog.

This commit open a way to use the documentation window as property editor.

BUG: 334380
FIXED-IN:4.13.1
GUI

(cherry picked from commit 0481912e)
parent ecc6fd8b
......@@ -196,7 +196,6 @@ set(libdialogs_SRCS
dialogs/dialogbase.cpp
dialogs/exportallviewsdialog.cpp
dialogs/generaloptionpage.cpp
dialogs/notedialog.cpp
dialogs/objectnodedialog.cpp
dialogs/overwritedialogue.cpp
dialogs/pkgcontentspage.cpp
......
/***************************************************************************
* 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-2013 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
// own header
#include "notedialog.h"
#include "notewidget.h"
// kde includes
#include <klocale.h>
#include <kmessagebox.h>
#include <ktextedit.h>
// qt includes
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
/**
* Constructs an NoteDialog.
*/
NoteDialog::NoteDialog(QWidget * parent, NoteWidget * pNote)
: KDialog(parent)
{
setCaption(i18n("Note Documentation"));
setButtons(Help | Ok | Cancel);
setDefaultButton(Ok);
setModal(true);
showButtonSeparator(true);
m_pNoteWidget = pNote;
int margin = fontMetrics().height();
QFrame *frame = new QFrame(this);
setMainWidget(frame);
m_docGB = new QGroupBox(i18n("Documentation"), frame);
QVBoxLayout * mainLayout = new QVBoxLayout(frame);
mainLayout->addWidget(m_docGB);
mainLayout->setSpacing(10);
mainLayout->setMargin(margin);
QHBoxLayout * docLayout = new QHBoxLayout(m_docGB);
docLayout->setSpacing(10);
docLayout->setMargin(margin);
m_docTE = new KTextEdit(m_docGB);
m_docTE->setFocus();
docLayout->addWidget(m_docTE);
m_docTE->setText(pNote->documentation());
setMinimumSize(330, 160);
connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
}
/**
* Standard destructor.
*/
NoteDialog::~NoteDialog()
{
}
void NoteDialog::slotOk()
{
m_pNoteWidget->setDocumentation(m_docTE->toPlainText());
accept();
}
#include "notedialog.moc"
/***************************************************************************
* 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-2013 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef NOTEDIALOG_H
#define NOTEDIALOG_H
// kde includes
#include <kdialog.h>
class NoteWidget;
class KTextEdit;
class QGroupBox;
/**
* @author Paul Hensgen
* Bugs and comments to umbrello-devel@kde.org or http://bugs.kde.org
*/
class NoteDialog : public KDialog
{
Q_OBJECT
public:
NoteDialog(QWidget * parent, NoteWidget * pNote);
~NoteDialog();
public slots:
void slotOk();
private:
QGroupBox * m_docGB; ///< GUI widget
KTextEdit * m_docTE; ///< GUI widget
NoteWidget * m_pNoteWidget; ///< note widget to show documentation for
};
#endif
......@@ -263,6 +263,12 @@ bool DocWindow::isTyping()
return false;
}
void DocWindow::setFocus()
{
parentWidget()->setVisible(true);
m_docTE->setFocus();
}
/**
* Checks if the user is typing in the documentation edit window.
*/
......
......@@ -42,6 +42,7 @@ public:
void reset();
bool isTyping();
void setFocus();
public slots:
void slotAssociationRemoved(AssociationWidget* association);
......
......@@ -15,7 +15,6 @@
#include "debug_utils.h"
#include "docwindow.h"
#include "listpopupmenu.h"
#include "notedialog.h"
#include "uml.h"
#include "umldoc.h"
#include "umlscene.h"
......@@ -230,15 +229,8 @@ void NoteWidget::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
*/
void NoteWidget::rename()
{
NoteDialog * dlg = 0;
UMLApp::app()->docWindow()->updateDocumentation(false);
dlg = new NoteDialog(umlScene()->activeView(), this);
if (dlg->exec()) {
UMLApp::app()->docWindow()->showDocumentation(this, true);
UMLApp::app()->document()->setModified(true);
update();
}
delete dlg;
UMLApp::app()->docWindow()->showDocumentation(this, true);
UMLApp::app()->docWindow()->setFocus();
}
/**
......
Supports Markdown
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