Commit e2cb1434 authored by Ralf Habacker's avatar Ralf Habacker

Add property dialog for notes

- Add general properties page for note widgets
- Let class NoteDialog be a multi page dialog
- Added general, style and font page to note dialog

CCBUG:390886
parent 8cbeef8b
......@@ -222,6 +222,7 @@ set(libdialogs_SRCS
dialogs/umluniqueconstraintdialog.cpp
dialogs/umlviewdialog.cpp
dialogs/pages/activitypage.cpp
dialogs/pages/notepage.cpp
dialogs/pages/associationgeneralpage.cpp
dialogs/pages/associationrolepage.cpp
dialogs/pages/autolayoutoptionpage.cpp
......
......@@ -17,6 +17,7 @@
#include "associationwidget.h"
#include "debug_utils.h"
#include "icon_utils.h"
#include "notepage.h"
#include "uml.h"
#include "umlwidget.h"
#include "umlwidgetstylepage.h"
......@@ -47,6 +48,7 @@ DEBUG_REGISTER(MultiPageDialogBase)
MultiPageDialogBase::MultiPageDialogBase(QWidget *parent, bool withDefaultButton)
: QWidget(parent),
m_pAssocGeneralPage(0),
m_notePage(0),
m_pRolePage(0),
m_fontChooser(0),
m_pStylePage(0),
......@@ -80,6 +82,7 @@ MultiPageDialogBase::MultiPageDialogBase(QWidget *parent, bool withDefaultButton
MultiPageDialogBase::MultiPageDialogBase(QWidget *parent, bool withDefaultButton)
: QWidget(parent),
m_pAssocGeneralPage(0),
m_notePage(0),
m_pRolePage(0),
m_fontChooser(0),
m_pStylePage(0),
......@@ -124,6 +127,9 @@ void MultiPageDialogBase::apply()
if (m_pAssocGeneralPage)
m_pAssocGeneralPage->apply();
if (m_notePage)
m_notePage->apply();
if (m_pRolePage) {
applyAssociationRolePage();
}
......@@ -361,6 +367,18 @@ void MultiPageDialogBase::applyGeneralPage(AssociationWidget *widget)
m_pAssocGeneralPage->apply();
}
/**
* Sets up the general settings page.
* @param widget The widget to load the initial data from
*/
void MultiPageDialogBase::setupGeneralPage(NoteWidget *widget)
{
QFrame *page = createPage(i18nc("general settings", "General"), i18n("General Settings"), Icon_Utils::it_Properties_General);
QHBoxLayout *layout = new QHBoxLayout(page);
m_notePage = new NotePage (page, widget);
layout->addWidget(m_notePage);
}
/**
* Sets up the font selection page.
* @param font The font to load the initial data from
......
......@@ -27,6 +27,8 @@ class KFontChooser;
class KPageDialog;
class QAbstractButton;
class QFrame;
class NotePage;
class NoteWidget;
class UMLWidget;
class UMLWidgetStylePage;
class WidgetBase;
......@@ -92,6 +94,7 @@ private slots:
#endif
protected:
AssociationGeneralPage *m_pAssocGeneralPage;
NotePage *m_notePage;
AssociationRolePage *m_pRolePage;
KFontChooser *m_fontChooser;
UMLWidgetStylePage *m_pStylePage;
......@@ -108,6 +111,8 @@ protected:
void setupGeneralPage(AssociationWidget *widget);
void applyGeneralPage(AssociationWidget *widget);
void setupGeneralPage(NoteWidget *widget);
KPageWidgetItem *setupFontPage(const QFont &font);
KPageWidgetItem *setupFontPage(UMLWidget *widget);
KPageWidgetItem *setupFontPage(AssociationWidget *widget);
......
......@@ -4,51 +4,43 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2002-2015 *
* copyright (C) 2002-2018 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
// own header
#include "notedialog.h"
#include "notewidget.h"
#include "documentationwidget.h"
// kde includes
#include <KLocalizedString>
// qt includes
#include <QFrame>
#include <QVBoxLayout>
/**
* Constructs an NoteDialog.
*/
NoteDialog::NoteDialog(QWidget * parent, NoteWidget * pNote)
: SinglePageDialogBase(parent)
NoteDialog::NoteDialog(QWidget * parent, NoteWidget * widget)
: MultiPageDialogBase(parent),
m_widget(widget)
{
setCaption(i18n("Note Documentation"));
m_pNoteWidget = pNote;
QFrame *frame = new QFrame(this);
setMainWidget(frame);
m_docWidget = new DocumentationWidget(m_pNoteWidget);
QVBoxLayout *layout = new QVBoxLayout(frame);
layout->addWidget(m_docWidget, 10);
setMinimumSize(600, 250);
m_docWidget->setFocus();
setupPages();
connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()));
}
/**
* Standard destructor.
*/
NoteDialog::~NoteDialog()
void NoteDialog::setupPages()
{
setupGeneralPage(m_widget);
setupStylePage(m_widget);
setupFontPage(m_widget);
}
bool NoteDialog::apply()
void NoteDialog::slotOk()
{
m_docWidget->apply();
return true;
slotApply();
accept();
}
void NoteDialog::slotApply()
{
MultiPageDialogBase::apply();
if (m_widget) {
applyFontPage(m_widget);
}
}
......@@ -4,15 +4,14 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2002-2015 *
* copyright (C) 2002-2018 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef NOTEDIALOG_H
#define NOTEDIALOG_H
// kde includes
#include "singlepagedialogbase.h"
#include "multipagedialogbase.h"
class DocumentationWidget;
class NoteWidget;
......@@ -21,18 +20,19 @@ class NoteWidget;
* @author Paul Hensgen
* Bugs and comments to umbrello-devel@kde.org or http://bugs.kde.org
*/
class NoteDialog : public SinglePageDialogBase
class NoteDialog : public MultiPageDialogBase
{
Q_OBJECT
public:
NoteDialog(QWidget *parent, NoteWidget *pNote);
~NoteDialog();
NoteDialog(QWidget *parent, NoteWidget *widget);
protected:
DocumentationWidget *m_docWidget; ///< widget holding the documentation
NoteWidget *m_pNoteWidget; ///< note widget to show documentation for
public slots:
void slotOk();
void slotApply();
bool apply();
protected:
void setupPages();
NoteWidget *m_widget;
};
#endif
/***************************************************************************
* 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-2015 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
// own header
#include "notepage.h"
#include "notewidget.h"
#include "documentationwidget.h"
// kde includes
#include <KLocalizedString>
// qt includes
#include <QVBoxLayout>
/**
* Constructs an note page.
*/
NotePage::NotePage(QWidget *parent, NoteWidget *note)
: DialogPageBase(parent),
m_noteWidget(note)
{
QVBoxLayout *layout = new QVBoxLayout(this);
m_docWidget = new DocumentationWidget(m_noteWidget);
layout->addWidget(m_docWidget, 10);
setMinimumSize(600, 250);
m_docWidget->setFocus();
}
/**
* Standard destructor.
*/
NotePage::~NotePage()
{
}
bool NotePage::apply()
{
m_docWidget->apply();
return true;
}
/***************************************************************************
* 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-2018 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef NOTEPAGE_H
#define NOTEPAGE_H
#include "dialogpagebase.h"
class DocumentationWidget;
class NoteWidget;
/**
* @author Ralf Habacker
* Bugs and comments to umbrello-devel@kde.org or http://bugs.kde.org
*/
class NotePage : public DialogPageBase
{
Q_OBJECT
public:
NotePage(QWidget *parent, NoteWidget *note);
~NotePage();
bool apply();
protected:
DocumentationWidget *m_docWidget; ///< widget holding the documentation
NoteWidget *m_noteWidget; ///< note widget to show documentation for
};
#endif
......@@ -531,6 +531,7 @@ void ListPopupMenu::insertSingleSelectionMenu(WidgetBase* object)
insert(mt_Rename, i18n("Change Text..."));
insert(mt_Delete);
insert(mt_Change_Font);
insert(mt_Properties);
break;
case WidgetBase::wt_Box:
......
......@@ -267,6 +267,7 @@ void NoteWidget::slotMenuSelection(QAction* action)
ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(action);
switch(sel) {
case ListPopupMenu::mt_Rename:
case ListPopupMenu::mt_Properties:
showPropertiesDialog();
break;
......
......@@ -55,6 +55,7 @@ public:
Uml::ID::Type diagramLink() const;
void setDiagramLink(Uml::ID::Type viewID);
bool setDiagramLink(const QString &viewName);
void askForNoteType(UMLWidget* &targetWidget);
......
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