void BabelWindow::addNewContact(QString name) { int nbRow = ui->_contactsTable->rowCount(); QTableWidgetItem *row = new QTableWidgetItem; row->setText(name); ui->_contactsTable->verticalHeader()->hide(); ui->_contactsTable->insertRow(nbRow); ui->_contactsTable->setItem(nbRow, 0, row); setContactStatus(nbRow, true); }
ContactInfoWindow::ContactInfoWindow(Contact *contact, QWidget *parent) : QMainWindow(parent), ui(new Ui::ContactInfoWindow) { this->contact = contact; ui->setupUi(this); ui->phoneNumberLabel->setText(contact->phone); setContactPhoto(); setContactName(); setContactStatus(); connect(ui->contactPhotoButton,SIGNAL(clicked()), this,SLOT(showPhoto())); connect(ui->copyButton,SIGNAL(clicked()), this,SLOT(copyPhoneToClipboard())); connect(ui->dialButton,SIGNAL(clicked()), this,SLOT(dialPhone())); QDir home = QDir::home(); QString fileName = home.path() + CACHE_DIR"/"PHOTOS_DIR"/" + contact->jid + "/" + contact->photoId + ".png"; QFile file(fileName); photoDownloaded = (file.exists()); isDownloading = false; connect(Client::mainWin,SIGNAL(previewPhotoReceived(QString)), this,SLOT(previewPhotoReceived(QString))); connect(Client::mainWin,SIGNAL(largePhotoReceived(QString,QImage,QString)), this,SLOT(photoReceived(QString,QImage,QString))); connect(Client::mainWin,SIGNAL(onlineStatusChanged(QString)), this,SLOT(onlineStatusChanged(QString))); connect(Client::mainWin,SIGNAL(userStatusUpdated(QString)), this,SLOT(userStatusUpdated(QString))); connect(this,SIGNAL(photoUpdate(QString,QString,bool)), Client::mainWin,SLOT(requestPhotoUpdate(QString,QString,bool))); }
void ContactInfoWindow::userStatusUpdated(QString jid) { if (contact->jid == jid) setContactStatus(); }