summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/enumliteral.cpp
blob: 95060e74ad1776a44686871385f3958212ef282b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/***************************************************************************
 *                                                                         *
 *   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) 2003-2006                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

#include "enumliteral.h"

#include <kinputdialog.h>
#include <kdebug.h>
#include <tdelocale.h>

UMLEnumLiteral::UMLEnumLiteral(const UMLObject *parent,
                               const TQString& name, Uml::IDType id)
        : UMLClassifierListItem(parent, name, id) {
    m_BaseType = Uml::ot_EnumLiteral;
}

UMLEnumLiteral::UMLEnumLiteral(const UMLObject *parent) : UMLClassifierListItem(parent) {
    m_BaseType = Uml::ot_EnumLiteral;
}

UMLEnumLiteral::~UMLEnumLiteral() { }

bool UMLEnumLiteral::operator==(UMLEnumLiteral& rhs) {
    if ( this == &rhs )  {
        return true;
    }
    if ( !UMLObject::operator==( rhs ) )  {
        return false;
    }
    return true;
}

void UMLEnumLiteral::copyInto(UMLEnumLiteral *rhs) const
{
    UMLClassifierListItem::copyInto(rhs);
}

UMLObject* UMLEnumLiteral::clone() const
{
    UMLEnumLiteral *clone = new UMLEnumLiteral((UMLObject *) parent());
    copyInto(clone);

    return clone;
}


void UMLEnumLiteral::saveToXMI(TQDomDocument& qDoc, TQDomElement& qElement) {
    TQDomElement attributeElement = UMLObject::save("UML:EnumerationLiteral", qDoc);
    qElement.appendChild( attributeElement );
}

bool UMLEnumLiteral::load(TQDomElement& ) {
    return true;
}

bool UMLEnumLiteral::showPropertiesDialog(TQWidget* parent) {
    bool ok;
    TQString name = KInputDialog::getText(i18n("Name"), i18n("Enter name:"), getName(), &ok, parent);
    if ( ok && !name.isEmpty() )  {
        setName(name);
        return true;
    } else {
        return false;
    }
}