Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

newcontact.cpp

00001 /*! 00002 @class NewContact 00003 @brief Zeigt einen "NewContact" Dialog. 00004 @author Thomas Gemperli, <bluephone@gemperli.net> 00005 @version 1.0 00006 @date 2004-08-05 00007 @par This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License. 00009 @file newcontact.cpp 00010 */ 00011 00012 00013 #include "newcontact.h" 00014 00015 #include <qlineedit.h> 00016 #include <qcombobox.h> 00017 00018 00019 /** 00020 * NewContact Konstruktor 00021 * Erstellt einen NewContactDlg. 00022 * Falle editiert wird, erwartet der Konstruktor die Daten des selektierten Eintrages. 00023 * Meine Parameter: QString Mode, ContactId, ContactType, ContactName, ContactNumber 00024 * 00025 */ 00026 NewContact::NewContact(QWidget* parent, const char* name, bool modal, WFlags fl, const QString& Mode, 00027 const QString& ContactId, const QString& ContactType, const QString& ContactName, const QString& ContactNumber) 00028 : FormNewContactDlg(parent,name, modal,fl) 00029 { 00030 /* wird ein bestehenden Kontakt editiert oder ein neuer erstellt? */ 00031 if ( Mode == "new" ) 00032 { 00033 /* Es wird ein neuer Kontakt hinzugefuegt, die Id des Eintrages generiert das Telephon. */ 00034 m_phoneContactId = "generate"; 00035 00036 /* setze den Titel des Dialoges */ 00037 setCaption("New Contact"); 00038 } 00039 else if ( Mode == "edit" ) 00040 { 00041 /* Parameter in die privaten Variablen abspeichern. */ 00042 m_phoneContactId = ContactId; 00043 m_phoneContactType = ContactType; 00044 m_phoneContactName = ContactName; 00045 m_phoneContactNumber = ContactNumber; 00046 00047 /* fuelle die Werte in den NewContactDlg ab. */ 00048 00049 if ( m_phoneContactType == "Home" ) 00050 { comboBoxNewContactType->setCurrentItem(0); } 00051 else if ( m_phoneContactType == "Work" ) 00052 { comboBoxNewContactType->setCurrentItem(1); } 00053 else if ( m_phoneContactType == "Mobile" ) 00054 { comboBoxNewContactType->setCurrentItem(2); } 00055 else if ( m_phoneContactType == "Fax" ) 00056 { comboBoxNewContactType->setCurrentItem(3); } 00057 else 00058 { comboBoxNewContactType->setCurrentItem(4); } 00059 00060 lineEditNewContactName->setText(m_phoneContactName); 00061 lineEditNewContactNumber->setText(m_phoneContactNumber); 00062 00063 /* setze den Titel des Dialoges */ 00064 setCaption("Edit Contact"); 00065 } 00066 } 00067 00068 00069 /** 00070 * NewContact Destruktor 00071 */ 00072 NewContact::~NewContact() 00073 { 00074 } 00075 00076 00077 /** 00078 * Dieser Slot liest die Eingabefelder des Dialoges ein und sendet das Resultat via transmitContact an Bluephone. 00079 */ 00080 void NewContact::readContact() 00081 { 00082 /* lese die restlichen Eingabefelder ein */ 00083 m_phoneContactType = comboBoxNewContactType->currentText(); 00084 m_phoneContactName = lineEditNewContactName->text(); 00085 m_phoneContactNumber = lineEditNewContactNumber->text(); 00086 00087 if ( m_phoneContactType == "Home" ) 00088 { m_phoneContactType = "H"; } 00089 else if ( m_phoneContactType == "Work" ) 00090 { m_phoneContactType = "W"; } 00091 else if ( m_phoneContactType == "Mobile" ) 00092 { m_phoneContactType = "M"; } 00093 else if ( m_phoneContactType == "Fax" ) 00094 { m_phoneContactType = "F"; } 00095 else 00096 { m_phoneContactType = "O"; } 00097 00098 /* sende das Resultat an Bluephone */ 00099 emit transmitContact(m_phoneContactId, m_phoneContactType, m_phoneContactName, m_phoneContactNumber); 00100 00101 /* Setzte die LED auf gruen zurueck */ 00102 emit transmitLedStateGreen(); 00103 00104 this->close(); 00105 } 00106 00107 00108 /** 00109 * Dieser Slot schliesst den Dialog. 00110 */ 00111 void NewContact::closeDialog() 00112 { 00113 /* Setzte die LED auf gruen zurueck */ 00114 emit transmitLedStateGreen(); 00115 00116 this->close(); 00117 } 00118 00119 00120 #include "newcontact.moc" 00121

Generated on Tue Aug 17 14:42:27 2004 for BluePhone by doxygen 1.3.7