]> ruin.nu Git - adress.git/blob - contactmodifyer.cpp
da7348164381bc4dc45b82ca292cc513a472064b
[adress.git] / contactmodifyer.cpp
1 #include "contactmodifyer.h"
2 #include "contact.h"
3
4
5 //QT included
6 #include <qlineedit.h>
7 /* 
8  *  Constructs a ContactModifier which is a child of 'parent', with the 
9  *  name 'name' and widget flags set to 'f' 
10  *
11  *  The dialog will by default be modeless, unless you set 'modal' to
12  *  TRUE to construct a modal dialog.
13  */
14 ContactModifier::ContactModifier(CContact* contact, QWidget* parent,  const char* name, bool modal, WFlags fl )
15     : ContactModifierBase( parent, name, modal, fl )
16 {
17         m_contact = contact;
18
19         if (m_contact != '\0')
20         {
21                 FirstnameLine->setText(contact->firstname());
22                 LastnameLine->setText(contact->lastname());
23                 AdressLine->setText(contact->adress());
24                 PhoneNumberLine->setText(contact->phoneNumber());
25         }
26 }
27
28 /*  
29  *  Destroys the object and frees any allocated resources
30  */
31 ContactModifier::~ContactModifier()
32 {
33     // no need to delete child widgets, Qt does it all for us
34 }
35
36 /* 
37  * public slot
38  */
39 void ContactModifier::slotOK()
40 {
41         (void) new CContact( FirstnameLine->text(), LastnameLine->text(), AdressLine->text(), PhoneNumberLine->text());
42         
43         if (m_contact != '\0')
44         {
45                 delete m_contact;
46         }
47
48         accept();
49 }
50