#include "showcontact.h" #include "virtualcard.h" ShowContact::ShowContact(VirtualCard *vc,QWidget *parent=0):QWidget(parent) { if(!staticInit()) if(!init()) { perror("Erreur d'initialisation"); qApp->quit(); } if(vc->show()!=NULL) { perror("Une erreur s'est produite, on ne devrait pas construire l'objet"); qApp->quit(); } vcard=vc; remplirChamps(); placerChamps(); } bool ShowContact::staticInit() {return StaticInit;} void ShowContact::setStaticInit(const bool val) {StaticInit=val;} bool ShowContact::init() { addressTypeChoices <name().split(";",QString::SkipEmptyParts).at(1)) ; // Prenom lastname = new QLineEdit(vcard->name().split(";",QString::SkipEmptyParts).at(0)); // Nom de famille nickname = new QLineEdit(vcard->nickname()); /* Dates */ birthday = new QDateEdit(vcard->birthday()); fete = new QDateEdit(vcard->xanniversary()); /* Addresses */ // Typical Address: ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America // That is to say: Complement;?;Street;City;District;Zip Code;Country addrStreet[VCAddr::HOME] = new QLineEdit(vcard->address(VCAddr::HOME).split(";",QString::KeepEmptyParts).at(2)); addrCompl[VCAddr::HOME] = new QLineEdit(vcard->address(VCAddr::HOME).split(";",QString::KeepEmptyParts).at(0)); addrZipCode[VCAddr::HOME] = new QLineEdit(vcard->address(VCAddr::HOME).split(";",QString::KeepEmptyParts).at(5)); addrCity[VCAddr::HOME] = new QLineEdit(vcard->address(VCAddr::HOME).split(";",QString::KeepEmptyParts).at(3)); addrCountry[VCAddr::HOME] = new QLineEdit(vcard->address(VCAddr::HOME).split(";",QString::KeepEmptyParts).at(6)); labelAddress[VCAddr::HOME] = new QTextEdit(vcard->labelAddress(VCAddr::HOME)); addrStreet[VCAddr::WORK] = new QLineEdit(vcard->address(VCAddr::WORK).split(";",QString::KeepEmptyParts).at(2)); addrCompl[VCAddr::WORK] = new QLineEdit(vcard->address(VCAddr::WORK).split(";",QString::KeepEmptyParts).at(0)); addrZipCode[VCAddr::WORK] = new QLineEdit(vcard->address(VCAddr::WORK).split(";",QString::KeepEmptyParts).at(5)); addrCity[VCAddr::WORK] = new QLineEdit(vcard->address(VCAddr::WORK).split(";",QString::KeepEmptyParts).at(3)); addrCountry[VCAddr::WORK] = new QLineEdit(vcard->address(VCAddr::WORK).split(";",QString::KeepEmptyParts).at(6)); labelAddress[VCAddr::WORK] = new QTextEdit(vcard->labelAddress(VCAddr::WORK)); addrStreet[VCAddr::OTHER] = new QLineEdit(vcard->address(VCAddr::OTHER).split(";",QString::KeepEmptyParts).at(2)); addrCompl[VCAddr::OTHER] = new QLineEdit(vcard->address(VCAddr::OTHER).split(";",QString::KeepEmptyParts).at(0)); addrZipCode[VCAddr::OTHER] = new QLineEdit(vcard->address(VCAddr::OTHER).split(";",QString::KeepEmptyParts).at(5)); addrCity[VCAddr::OTHER] = new QLineEdit(vcard->address(VCAddr::OTHER).split(";",QString::KeepEmptyParts).at(3)); addrCountry[VCAddr::OTHER] = new QLineEdit(vcard->address(VCAddr::OTHER).split(";",QString::KeepEmptyParts).at(6)); labelAddress[VCAddr::OTHER] = new QTextEdit(vcard->labelAddress(VCAddr::OTHER)); addressTypeChoose = new QComboBox(); addressTypeChoose->addItems(addressTypeChoices); /* Phone numbers */ tel[VCPhone::MOBILE] = new QLineEdit(vcard->tel(VCPhone::MOBILE)); tel[VCPhone::HOME] = new QLineEdit(vcard->tel(VCPhone::HOME)); tel[VCPhone::WORK] = new QLineEdit(vcard->tel(VCPhone::WORK)); tel[VCPhone::FAX] = new QLineEdit(vcard->tel(VCPhone::FAX)); tel[VCPhone::OTHER] = new QLineEdit(vcard->tel(VCPhone::OTHER)); phoneTypeChoose = new QComboBox(); phoneTypeChoose->addItems(phoneTypeChoices); /* Emails */ email[VCAddr::HOME] = new QLineEdit(vcard->email(VCAddr::HOME)); email[VCAddr::WORK] = new QLineEdit(vcard->email(VCAddr::WORK)); email[VCAddr::OTHER] = new QLineEdit(vcard->email(VCAddr::OTHER)); emailTypeChoose = new QComboBox(); emailTypeChoose->addItems(addressTypeChoices); msn = new QLineEdit(vcard->xmsn()); /* URLs */ url[VCAddr::HOME] = new QLineEdit(vcard->url(VCAddr::HOME)); url[VCAddr::WORK] = new QLineEdit(vcard->url(VCAddr::WORK)); url[VCAddr::OTHER] = new QLineEdit(vcard->url(VCAddr::OTHER)); urlTypeChoose = new QComboBox(); urlTypeChoose->addItems(addressTypeChoices); /* Network */ logo = new QLabel(vcard->logo()); // On utilisera un logo pour représenter le lien logo->setPixmap(QPixmap("images/"+vcard->logo()+".jpg")); /* Notes */ notes = new QTextEdit(vcard->note()); } void ShowContact::placerChamps() { } void ShowContact::modify(){} void ShowContact::cancel() {} void ShowContact::save() {}