00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#include "newcontact.h"
00014
00015
#include <qlineedit.h>
00016
#include <qcombobox.h>
00017
00018
00019
00020
00021
00022
00023
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
00031
if ( Mode ==
"new" )
00032 {
00033
00034
m_phoneContactId =
"generate";
00035
00036
00037 setCaption(
"New Contact");
00038 }
00039
else if ( Mode ==
"edit" )
00040 {
00041
00042
m_phoneContactId = ContactId;
00043
m_phoneContactType = ContactType;
00044
m_phoneContactName = ContactName;
00045
m_phoneContactNumber = ContactNumber;
00046
00047
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
00064 setCaption(
"Edit Contact");
00065 }
00066 }
00067
00068
00069
00070
00071
00072 NewContact::~NewContact()
00073 {
00074 }
00075
00076
00077
00078
00079
00080 void NewContact::readContact()
00081 {
00082
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
00099 emit
transmitContact(
m_phoneContactId,
m_phoneContactType,
m_phoneContactName,
m_phoneContactNumber);
00100
00101
00102 emit
transmitLedStateGreen();
00103
00104 this->close();
00105 }
00106
00107
00108
00109
00110
00111 void NewContact::closeDialog()
00112 {
00113
00114 emit
transmitLedStateGreen();
00115
00116 this->close();
00117 }
00118
00119
00120
#include "newcontact.moc"
00121