X-Git-Url: https://ruin.nu/git/?p=adress.git;a=blobdiff_plain;f=contactmodifyer.cpp;fp=contactmodifyer.cpp;h=da7348164381bc4dc45b82ca292cc513a472064b;hp=0000000000000000000000000000000000000000;hb=1197b29fa2d68f604352fe6eef3e9776a63bb87b;hpb=97d32657e457f990452112c648912cd192b35891 diff --git a/contactmodifyer.cpp b/contactmodifyer.cpp new file mode 100644 index 0000000..da73481 --- /dev/null +++ b/contactmodifyer.cpp @@ -0,0 +1,50 @@ +#include "contactmodifyer.h" +#include "contact.h" + + +//QT included +#include +/* + * Constructs a ContactModifier which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +ContactModifier::ContactModifier(CContact* contact, QWidget* parent, const char* name, bool modal, WFlags fl ) + : ContactModifierBase( parent, name, modal, fl ) +{ + m_contact = contact; + + if (m_contact != '\0') + { + FirstnameLine->setText(contact->firstname()); + LastnameLine->setText(contact->lastname()); + AdressLine->setText(contact->adress()); + PhoneNumberLine->setText(contact->phoneNumber()); + } +} + +/* + * Destroys the object and frees any allocated resources + */ +ContactModifier::~ContactModifier() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * public slot + */ +void ContactModifier::slotOK() +{ + (void) new CContact( FirstnameLine->text(), LastnameLine->text(), AdressLine->text(), PhoneNumberLine->text()); + + if (m_contact != '\0') + { + delete m_contact; + } + + accept(); +} +