// SLOT ClientWindow::showUserSlot void ClientWindow::showUserSlot( SmartUtente su ) { if( profileWidget ) { contentLayout->removeWidget( profileWidget ); delete profileWidget; profileWidget = 0; } profileWidget = new OtherProfileWidget( su, client->user->getUserInfo(), client->user->isContact( su ), this ); connect( profileWidget, SIGNAL( addContactSignal( SmartUtente ) ), this, SLOT( addContactSlot( SmartUtente ) ) ); connect( profileWidget, SIGNAL( removeContactSignal( SmartUtente ) ), this, SLOT( removeContactSlot( SmartUtente ) ) ); connect( profileWidget, SIGNAL( showContactSignal( SmartUtente ) ), this, SLOT( showUserSlot( SmartUtente ) ) ); if( QVBoxLayout *auxLayout = dynamic_cast<QVBoxLayout *>( contentLayout ) ) auxLayout->insertWidget( 0, profileWidget ); // vista profilo contatto o altro utente homeButton->setVisible( false ); backButton->setVisible( true ); openSearchButton->setVisible( false ); setMenuButtonSelected( 0 ); menuWidget->setVisible( true ); searchWidget->setVisible( false ); profileWidget->setVisible( true ); if( searchResultsWidget ) // utente raggiunto dai risultati della ricerca searchResultsWidget->setVisible( false ); }
AddressBook::AddressBook(QWidget *parent) : addressText (new QTextEdit(this)), nameText (new QLineEdit(this)), nameLabel (new QLabel(tr("Name"), this)), addressLabel (new QLabel(tr("Address"), this)), addButton (new QPushButton(tr("&Add"), this)), submitButton (new QPushButton(tr("&Submit"), this)), cancelButton (new QPushButton(tr("&Cancel"), this)), editButton (new QPushButton(tr("&Edit"), this)), removeButton (new QPushButton(tr("&Remove"), this)), nextEntryButton (new QPushButton(tr("&Next"), this)), prevEntryButton (new QPushButton(tr("&Previous"), this)) { connect(addButton, SIGNAL(clicked()), this, SLOT(addContactSlot())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContactSlot())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelSlot())); connect(editButton, SIGNAL(clicked()), this, SLOT(editContactSlot())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContactSlot())); connect(prevEntryButton, SIGNAL(clicked()), this, SLOT(prevEntrySlot())); connect(nextEntryButton, SIGNAL(clicked()), this, SLOT(nextEntrySlot())); QVBoxLayout *buttonLayout = new QVBoxLayout(); buttonLayout->addWidget(addButton); buttonLayout->addWidget(submitButton); buttonLayout->addWidget(cancelButton); buttonLayout->addWidget(editButton); buttonLayout->addWidget(removeButton); buttonLayout->addStretch(); QHBoxLayout *navigationLayout = new QHBoxLayout(); navigationLayout->addWidget(prevEntryButton); navigationLayout->addWidget(nextEntryButton); QGridLayout *layout = new QGridLayout(); layout->addWidget(nameLabel, 0, 0); layout->addWidget(nameText, 0, 1); layout->addWidget(addressLabel, 1, 0, Qt::AlignTop); layout->addWidget(addressText, 1, 1); layout->addLayout(buttonLayout, 1 , 2, Qt::AlignTop); layout->addLayout(navigationLayout, 2, 1); setLayout(layout); setWindowTitle("Address book"); prepareWidgetsDefaultState(); editButton->setEnabled(false); removeButton->setEnabled(false); }