]> ruin.nu Git - adress.git/commitdiff
This class is made for adding and modify (actually delete the old contact and add...
authorMichael Andreen <harv@ruin.nu>
Sat, 2 Dec 2000 15:04:35 +0000 (15:04 +0000)
committerMichael Andreen <harv@ruin.nu>
Sat, 2 Dec 2000 15:04:35 +0000 (15:04 +0000)
Makefile
adress.pro
contactmodifyer.cpp [new file with mode: 0644]
contactmodifyer.h [new file with mode: 0644]

index 7d6e71737a486eb1827c6a93750b48dde4bf70af..75bb5b5a3778152d5ca9e7b556c9378b534be59e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building adress
 #############################################################################
 # Makefile for building adress
-# Generated by tmake at 15:20, 2000/12/02
+# Generated by tmake at 15:56, 2000/12/02
 #     Project: adress
 #    Template: app
 #############################################################################
 #     Project: adress
 #    Template: app
 #############################################################################
@@ -24,11 +24,14 @@ GZIP        =       gzip -9f
 ####### Files
 
 HEADERS =      contact.h \
 ####### Files
 
 HEADERS =      contact.h \
+               contactmodifyer.h \
                mainwindow.h
 SOURCES =      contact.cpp \
                mainwindow.h
 SOURCES =      contact.cpp \
+               contactmodifyer.cpp \
                main.cpp \
                mainwindow.cpp
 OBJECTS =      contact.o \
                main.cpp \
                mainwindow.cpp
 OBJECTS =      contact.o \
+               contactmodifyer.o \
                main.o \
                mainwindow.o \
                ui/contactmodifyerbase.o \
                main.o \
                mainwindow.o \
                ui/contactmodifyerbase.o \
@@ -43,11 +46,13 @@ UICDECLS =  ui/contactmodifyerbase.h \
 UICIMPLS =     ui/contactmodifyerbase.cpp \
                ui/mainwindowbase.cpp \
                ui/searchresultbase.cpp
 UICIMPLS =     ui/contactmodifyerbase.cpp \
                ui/mainwindowbase.cpp \
                ui/searchresultbase.cpp
-SRCMOC =       moc_mainwindow.cpp \
+SRCMOC =       moc_contactmodifyer.cpp \
+               moc_mainwindow.cpp \
                ui/moc_contactmodifyerbase.cpp \
                ui/moc_mainwindowbase.cpp \
                ui/moc_searchresultbase.cpp
                ui/moc_contactmodifyerbase.cpp \
                ui/moc_mainwindowbase.cpp \
                ui/moc_searchresultbase.cpp
-OBJMOC =       moc_mainwindow.o \
+OBJMOC =       moc_contactmodifyer.o \
+               moc_mainwindow.o \
                ui/moc_contactmodifyerbase.o \
                ui/moc_mainwindowbase.o \
                ui/moc_searchresultbase.o
                ui/moc_contactmodifyerbase.o \
                ui/moc_mainwindowbase.o \
                ui/moc_searchresultbase.o
@@ -107,6 +112,11 @@ clean:
 contact.o: contact.cpp \
                contact.h
 
 contact.o: contact.cpp \
                contact.h
 
+contactmodifyer.o: contactmodifyer.cpp \
+               contactmodifyer.h \
+               ui/contactmodifyerbase.h \
+               contact.h
+
 main.o: main.cpp \
                mainwindow.h \
                ui/mainwindowbase.h \
 main.o: main.cpp \
                mainwindow.h \
                ui/mainwindowbase.h \
@@ -150,6 +160,10 @@ ui/mainwindowbase.o: ui/mainwindowbase.cpp
 
 ui/searchresultbase.o: ui/searchresultbase.cpp
 
 
 ui/searchresultbase.o: ui/searchresultbase.cpp
 
+moc_contactmodifyer.o: moc_contactmodifyer.cpp \
+               contactmodifyer.h \
+               ui/contactmodifyerbase.h
+
 moc_mainwindow.o: moc_mainwindow.cpp \
                mainwindow.h \
                ui/mainwindowbase.h \
 moc_mainwindow.o: moc_mainwindow.cpp \
                mainwindow.h \
                ui/mainwindowbase.h \
@@ -164,6 +178,9 @@ ui/moc_mainwindowbase.o: ui/moc_mainwindowbase.cpp \
 ui/moc_searchresultbase.o: ui/moc_searchresultbase.cpp \
                ui/searchresultbase.h
 
 ui/moc_searchresultbase.o: ui/moc_searchresultbase.cpp \
                ui/searchresultbase.h
 
+moc_contactmodifyer.cpp: contactmodifyer.h
+       $(MOC) contactmodifyer.h -o moc_contactmodifyer.cpp
+
 moc_mainwindow.cpp: mainwindow.h
        $(MOC) mainwindow.h -o moc_mainwindow.cpp
 
 moc_mainwindow.cpp: mainwindow.h
        $(MOC) mainwindow.h -o moc_mainwindow.cpp
 
index b5978836a70ca9dc53aa9bc80d5988d2f3efa97c..5bb0a66fd8bee46634b594ece09e7465ae870224 100644 (file)
@@ -1,8 +1,10 @@
 TEMPLATE       = app
 CONFIG         = qt warn_on debug
 HEADERS                = contact.h \
 TEMPLATE       = app
 CONFIG         = qt warn_on debug
 HEADERS                = contact.h \
+                 contactmodifyer.h \
                  mainwindow.h
 SOURCES                = contact.cpp \
                  mainwindow.h
 SOURCES                = contact.cpp \
+                 contactmodifyer.cpp \
                  main.cpp \
                  mainwindow.cpp
 INTERFACES     = ui/contactmodifyerbase.ui \
                  main.cpp \
                  mainwindow.cpp
 INTERFACES     = ui/contactmodifyerbase.ui \
diff --git a/contactmodifyer.cpp b/contactmodifyer.cpp
new file mode 100644 (file)
index 0000000..da73481
--- /dev/null
@@ -0,0 +1,50 @@
+#include "contactmodifyer.h"
+#include "contact.h"
+
+
+//QT included
+#include <qlineedit.h>
+/* 
+ *  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();
+}
+
diff --git a/contactmodifyer.h b/contactmodifyer.h
new file mode 100644 (file)
index 0000000..df4d4a6
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef CONTACTMODIFIER_H
+#define CONTACTMODIFIER_H
+#include "ui/contactmodifyerbase.h"
+
+class CContact;
+
+class ContactModifier : public ContactModifierBase
+{ 
+    Q_OBJECT
+
+public:
+    ContactModifier(CContact* contact = 0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+    ~ContactModifier();
+
+
+public slots:
+    void slotOK();
+
+protected:
+               CContact* m_contact;
+
+};
+
+#endif // CONTACTMODIFIER_H