void UserWin::manageWin() { this->_serverText = "Serveur: "; this->_serverText.append(this->getServer()); this->_portText = " | Port: "; this->_portText.append(QString::number(this->getTcpPort())); this->_idText = "Identifiant: "; this->_idText.append(this->getClientId()); this->_call.setText("Appeler"); this->_mContact->addAction(this->_aAddContact); this->_mContact->addAction(this->_aDelContact); this->_mContact->addAction(this->_aSearchContact); this->_mContact->addAction(this->_aDisconnect); this->_mContact->addAction(this->_aQuit); this->_mAccount->addAction(this->_aProfile); this->_mHelp->addAction(this->_aHelp); this->_online.setText("Contacts en ligne"); this->_offline.setText("Contacts hors ligne"); this->_idLabel.setText(this->_idText); this->_infoLabel.setText(this->_serverText.append(this->_portText)); this->_call.setFont(QFont("Default", 14)); this->_call.setCursor(Qt::PointingHandCursor); this->_call.setIcon(QIcon(QCoreApplication::applicationDirPath() + "/ressources/Logo.png")); this->_modelOn.setStringList(this->getContactOn()); this->_modelOff.setStringList(this->getContactOff()); this->_viewOn.setModel(&this->_modelOn); this->_viewOn.setEditTriggers(QAbstractItemView::NoEditTriggers); this->_viewOff.setModel(&this->_modelOff); this->_viewOff.setEditTriggers(QAbstractItemView::NoEditTriggers); this->_viewOff.setSelectionMode(QAbstractItemView::NoSelection); this->_layout.addWidget(&this->_infoLabel); this->_layout.addWidget(&this->_idLabel); this->_layout.addWidget(&this->_online, Qt::AlignCenter); this->_layout.addWidget(&this->_viewOn); this->_layout.addWidget(&this->_offline, Qt::AlignCenter); this->_layout.addWidget(&this->_viewOff); this->_layout.addWidget(&this->_call); this->_core.setLayout(&this->_layout); this->getUdpSocket()->bind(this->getUdpPort()); this->setCentralWidget(&this->_core); this->setWindowIcon(QIcon(QCoreApplication::applicationDirPath() + "/ressources/babybel.png")); connect(&this->_call, SIGNAL(clicked()), this, SLOT(selectContact())); connect(this->_aQuit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(this->_aAddContact, SIGNAL(triggered()), this, SLOT(addContact())); connect(this->_aDelContact, SIGNAL(triggered()), this, SLOT(delContact())); connect(this->_aSearchContact, SIGNAL(triggered()), this, SLOT(searchContact())); connect(this->_aDisconnect, SIGNAL(triggered()), this, SLOT(aDisconnect())); connect(this->_aHelp, SIGNAL(triggered()), this, SLOT(showHelp())); connect(this->_aProfile, SIGNAL(triggered()), this, SLOT(showProfile())); connect(this->getTcpSocket(), SIGNAL(readyRead()), this, SLOT(receivedTcpData())); connect(this->getUdpSocket(), SIGNAL(readyRead()), this, SLOT(receivedUdpData())); }
AddressBook::AddressBook(QWidget *parent) : QWidget(parent) { QLabel *nameLabel = new QLabel(tr("Name:")); // создаем объект QLabel nameLabel nameLine = new QLineEdit; nameLine->setReadOnly(true); // устанавливаем в режим только для чтения QLabel *addressLabel = new QLabel(tr("Address:")); // создаем объект QLabel addressLabel addressText = new QTextEdit; addressText->setReadOnly(true); // устанавливаем в режим только для чтения addButton = new QPushButton(tr("&Add")); // создаем экземпляр кнопоки addButton->show(); // устанавливаем ее отображение на экране после вызова функции show submitButton = new QPushButton(tr("&Submit")); // создаем экземпляр кнопоки submitButton->hide(); // устанавливаем ее отображение на экране после вызова функции hide(после нажатия кнопки "Add") cancelButton = new QPushButton(tr("&Cancel")); // создаем экземпляр кнопоки cancelButton->hide(); // устанавливаем ее отображение на экране после вызова функции hide(после нажатия кнопки "Add") nextButton = new QPushButton(tr("&Next")); // создаем экземпляр кнопки nextButton->setEnabled(false); // отключаем ее previousButton = new QPushButton(tr("&Previous")); previousButton->setEnabled(false); connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); // connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); // Соединяем кнопки с соответствующими им слотами connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); // connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); QVBoxLayout *buttonLayout1 = new QVBoxLayout; // buttonLayout1->addWidget(addButton, Qt::AlignTop); // Расположение кнопок виджета buttonLayout1->addWidget(submitButton); // buttonLayout1->addWidget(cancelButton); // buttonLayout1->addStretch(); // чтобы расположить кнопки ближе к верхней части виджета QHBoxLayout *buttonLayout2 = new QHBoxLayout; buttonLayout2->addWidget(previousButton); buttonLayout2->addWidget(nextButton); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(nameLabel, 0, 0); mainLayout->addWidget(nameLine, 0, 1); mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop); mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); mainLayout->addLayout(buttonLayout2, 3, 1); setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); }
void Model::activated(const QModelIndex& index) { //TODO optimize QStandardItem* item = itemFromIndex(index); Q_ASSERT(item); Contact *contact = item->data().value<Contact*>(); if(!contact) return; if(!(item->parent() == m_metaRoot)) addContact(contact, m_metaRoot); item->parent()->removeRow(index.row()); }
bool StandardContactList::load_contacts(const QDomElement& contacts) { QDomNodeList list = contacts.elementsByTagName("contact"); for(int i = 0; i < list.size(); i++) { QDomElement el = list.at(i).toElement(); int id = el.attribute("id").toInt(); ContactPtr c = createContact(id); if(!c->deserialize(el)) return false; addContact(c); } return true; }
void JabberPlugin::showAddFriendDialog() { bool ok; QString id = QInputDialog::getText( 0, tr( "Add Friend" ), tr( "Enter Jabber ID:" ), QLineEdit::Normal, "", &ok ); if ( !ok ) return; qDebug() << "Attempting to add jabber contact to roster:" << id; addContact( id ); }
ICQSearch::ICQSearch(ICQClient *client) { m_client = client; m_result = NULL; m_wizard = NULL; m_bRandomSearch = false; m_randomUin = 0; initCombo(cmbGender, 0, p_genders); initCombo(cmbAge, 0, ages); initCombo(cmbCountry, 0, getCountries()); initCombo(cmbLang, 0, p_languages); connect(tabSearch, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentChanged(QWidget*))); connect(edtEmail, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbAge, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbGender, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbCountry, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbLang, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtCity, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtState, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtCompany, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtDepartment, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtInterests, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtFirst, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtLast, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtNick, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtUin, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtScreen, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtEmail, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtFirst, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtLast, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtNick, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtUin, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtCity, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtState, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtCompany, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtDepartment, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtInterests, SIGNAL(returnPressed()), this, SLOT(search())); edtUin->setValidator(new QIntValidator(10000, 0x7FFFFFFF, edtUin)); initCombo(cmbGroup, m_client->getRandomChatGroup(), p_chat_groups, false); connect(btnFind, SIGNAL(clicked()), this, SLOT(randomFind())); setFindText(); edtStatus->setReadOnly(true); edtInfo->setReadOnly(true); edtInfo->setTextFormat(QTextEdit::RichText); btnAdd->setEnabled(false); btnMsg->setEnabled(false); connect(btnAdd, SIGNAL(clicked()), this, SLOT(addContact())); connect(btnMsg, SIGNAL(clicked()), this, SLOT(sendMessage())); edtScreen->setValidator(new AIMValidator(edtScreen)); fillGroup(); }
//--------------------------------------------------------------------------- long SensorSystem::scanBattlefield (void) { //NOW returns size of largest contact! long currentLargest = -1; if (!owner) Fatal(0, " Sensor has no owner "); if (!master) Fatal(0, " Sensor has no master "); if ((masterIndex == -1) || (range < 0.0)) return(0); long numNewContacts = 0; long numMovers = ObjectManager->getNumMovers(); for (long i = 0; i < numMovers; i++) { MoverPtr mover = (MoverPtr)ObjectManager->getMover(i); if (mover->getExists() && (mover->getTeamId() != owner->getTeamId())) { long contactStatus = calcContactStatus(mover); if (isContact(mover)) { if (contactStatus == CONTACT_NONE) removeContact(mover); else { modifyContact(mover, contactStatus == CONTACT_VISUAL ? true : false); getLargest(currentLargest,mover,contactStatus); } } else { if (contactStatus != CONTACT_NONE) { addContact(mover, contactStatus == CONTACT_VISUAL ? true : false); getLargest(currentLargest,mover,contactStatus); numNewContacts++; } } } } totalContacts += numNewContacts; return(currentLargest); }
AddContactDialog::AddContactDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AddContactDialog) { ui->setupUi(this); // this->setAttribute(Qt::WA_DeleteOnClose); this->setWindowFlags( this->windowFlags() &~Qt::WindowContextHelpButtonHint); ui->lb_photo->installEventFilter(this); dbMrg = new DatabaseManager; dbMrg->setStatus(DatabaseManager::Write); connect( ui->buttonBox, SIGNAL(accepted()), this, SLOT(addContact()) ); connect( ui->btn_addGroup, SIGNAL(toggled(bool)), this, SLOT(addGroup(bool)) ); }
void RosterBox::refreshContext() { QString name; if( currentItem() ) name = currentItem()->text( 2 ); QListView::clear(); groupList.clear(); if( v_showOffline ) { for ( int n = 0; n < (int)roster_manager->roster.count(); ++n ) { if( roster_manager->roster[ n ].status == PresenceManager::Invisible || roster_manager->roster[ n ].status == PresenceManager::Unavailable ) addContact( roster_manager->roster[ n ].jid ); } } if( v_showAway ) { for ( int n = 0; n < (int)roster_manager->roster.count(); ++n ) { if( roster_manager->roster[ n ].status == PresenceManager::Away || roster_manager->roster[ n ].status == PresenceManager::ExtAway || roster_manager->roster[ n ].status == PresenceManager::Dnd ) addContact( roster_manager->roster[ n ].jid ); } } for ( int n = 0; n < (int)roster_manager->roster.count(); ++n ) { if( roster_manager->roster[ n ].status == PresenceManager::Available || roster_manager->roster[ n ].status == PresenceManager::Chat ) addContact( roster_manager->roster[ n ].jid ); } if( !name.isEmpty() ) setCurrentItem( QListView::findItem( name, 2 ) ); }
void ContactModel::addBot(MAGNORMOBOT *bot) { if (conduits.contains(bot)) { qWarning("ContactModel is already tracking %p\n", bot); return; } connect(bot, SIGNAL(contactPresenceUpdated(QString)), SLOT(updateContactPresence(QString))); connect(bot, SIGNAL(contactAdded(QString)), SLOT(addContact(QString))); connect(bot, SIGNAL(contactUpdated(QString)), SLOT(updateContact(QString))); connect(bot, SIGNAL(contactRemoved(QString)), SLOT(removeContact(QString))); connect(bot, SIGNAL(contactListReceived()), SLOT(receiveContactList())); connect(bot, SIGNAL(disconnected()), SLOT(botDisconnected()), Qt::QueuedConnection); connect(bot, SIGNAL(destroyed()), SLOT(botDestroyed())); refreshContacts(bot); }
AddressBook::AddressBook(QWidget *parent) : QWidget(parent) { QLabel *nameLabel = new QLabel(tr("Name:")); nameLine = new QLineEdit; nameLine->setReadOnly(true); QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; addressText->setReadOnly(true); addButton = new QPushButton(tr("&add")); addButton->show(); submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); cancelButton = new QPushButton(tr("&Cancel")); cancelButton->hide(); nextButton = new QPushButton(tr("&Next")); nextButton->setEnabled(false); previousButton = new QPushButton(tr("&Previous")); previousButton->setEnabled(false); connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton, Qt::AlignTop); buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); QHBoxLayout *buttonLayout2 = new QHBoxLayout; buttonLayout2->addWidget(previousButton); buttonLayout2->addWidget(nextButton); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(nameLabel, 0, 0); mainLayout->addWidget(nameLine, 0, 1); mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop); mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); mainLayout->addLayout(buttonLayout2, 2, 1); setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); }
void JabberRoomChat::participantChanged(const QString &id) { auto jid = Jid::parse(id); auto contact = m_contactManager->byId(m_chat.chatAccount(), id, ActionCreateAndAdd); auto buddy = m_buddyManager->byContact(contact, ActionCreateAndAdd); buddy.setDisplay(jid.resource()); buddy.setTemporary(true); auto status = m_presenceService->presenceToStatus(m_room->participantPresence(id)); contact.setCurrentStatus(status); auto details = static_cast<ChatDetailsRoom *>(m_chat.details()); if (status.isDisconnected()) details->removeContact(contact); else details->addContact(contact); }
bool StandardContactList::load_old() { QString cfgName = ProfileManager::instance()->profilePath() + QDir::separator() + "contacts.conf"; QFile f(cfgName); if (!f.open(QIODevice::ReadOnly)){ log(L_ERROR, "[2]Can't open %s", qPrintable(cfgName)); return false; } ParserState state; while(!f.atEnd()) { QString line = QString::fromLocal8Bit(f.readLine()); line = line.trimmed(); //log(L_DEBUG, "Line: %s", qPrintable(line)); if(line.startsWith("[Group=")) { state.nextSection = ParserState::Group; load_old_dispatch(state); resetState(state); state.groupId = line.mid(7, line.length() - 8).toInt(); if(state.groupId > 0) addGroup(createGroup(state.groupId)); } else if(line.startsWith("[Contact=")) { state.nextSection = ParserState::Contact; load_old_dispatch(state); resetState(state); state.contactId = line.mid(9, line.length() - 10).toInt(); if(state.contactId > 0) addContact(createContact(state.contactId)); } else if(line.startsWith("[")) { state.nextSection = ParserState::Client; load_old_dispatch(state); state.dataname = line.mid(1, line.length() - 2); } else { state.data.append(line + "\n"); } } return true; }
void Home::setStatus(void *cmdptr, void *idptr) { std::vector<const char *> *value = (std::vector<const char *> *)cmdptr; std::vector<int> *id = (std::vector<int> *)idptr; std::map<int, UserInfo *>::iterator it; static int tmp = 0; if ((it = _musers.find(id[0][0])) == _musers.end()) { UserInfo *info = new UserInfo; if (tmp == 0) _myid = id[0][0]; tmp++; info->set_id(id[0][0]); info->set_status((*value)[0][0]); _musers[id[0][0]] = info; addContact(_musers[id[0][0]]); } else { UserInfo *tmp = _musers[id[0][0]]; QPixmap *pixmap = NULL; QPalette palette; tmp->set_status((*value)[0][0]); int itmp = (*value)[0][0]; switch (itmp) { case 2: pixmap = new QPixmap("./Images/BabelHD_0001s_0005s_0002_status.png"); break; case 3: pixmap = new QPixmap("./Images/BabelHD_0001s_0003s_0000_status.png"); break; case 4: pixmap = new QPixmap("./Images/BabelHD_0001s_0000s_0000_status.png"); break; case 1: pixmap = new QPixmap("./Images/BabelHD_0001s_0002s_0000_status.png"); break; default: break; } if (pixmap != NULL) palette.setBrush(_bcontact[id[0][0]]->but->backgroundRole(), QBrush(*pixmap)); _bcontact[id[0][0]]->but->setPalette(palette); } }
int main(void) { int key; init(); while(1) { printf("\n 1.Add New Contact\n"); printf("\n 2.Find Contact\n"); printf("\n 3.Delete Contact\n"); printf("\n 3.Update Contact\n"); printf("\n Enter the choice\n"); scanf("%d",&key); switch(key) { case 1: addContact(); break; case 2: { char *p ="123"; Contact *a = findContact(p); if(a) { printf("%s \n %s\n%s \n%s",a->firstName,a->secondName,a->firstNumber,a->secondNumber); } break; } case 3: deleteContact(); break; case 4: updateContact(); break; case 0: default: { close(); printf("\n : Exitting\n"); } return 0; } } return 0; }
AddressBook::AddressBook(QWidget *parent) : QWidget(parent) { QLabel *nameLabel = new QLabel(tr("Name:")); nameLine = new QLineEdit; //! [setting readonly 1] nameLine->setReadOnly(true); //! [setting readonly 1] QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; //! [setting readonly 2] addressText->setReadOnly(true); //! [setting readonly 2] //! [pushbutton declaration] addButton = new QPushButton(tr("&Add")); addButton->show(); submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); cancelButton = new QPushButton(tr("&Cancel")); cancelButton->hide(); //! [pushbutton declaration] //! [connecting signals and slots] connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); //! [connecting signals and slots] //! [vertical layout] QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton, Qt::AlignTop); buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); //! [vertical layout] //! [grid layout] QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(nameLabel, 0, 0); mainLayout->addWidget(nameLine, 0, 1); mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop); mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); //! [grid layout] setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); }
Contact ContactManager::byId(Account *account, const QString &id) { if (id.isEmpty() || 0 == account) return Contact::null; ensureLoaded(); foreach (Contact contact, Contacts) { if (id == contact.id(account)) return contact; } Contact anonymous = account->createAnonymous(id); addContact(anonymous); return anonymous; }
int AddressBook::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: addContact(); break; case 1: submitContact(); break; case 2: cancel(); break; case 3: next(); break; case 4: previous(); break; default: ; } _id -= 5; } return _id; }
int main() { int command = 1; int const size = 30; Phone *list = NULL; open(list); setlocale (LC_ALL, "Rus"); while (command) { printf("Выберите операцию для выполнения:\n0 - выход\n1 - добавить запись\n2 - найти телефон по имени\n3 - найти имя по телефону\n4 - сохранить текущие данные в файл\n"); scanf("%d", &command); if (command == 1) { int number = 0; char name[size]; printf("Введите имя и номер\n"); scanf("%s %d", name, &number); addContact(name, number, list); } if (command == 2) { printf("Введите имя\n"); char name[size]; scanf("%s", name); searchByName(name, list); } if (command == 3) { printf("Введите номер телефона\n"); int number = 0; scanf("%d", &number); searchByNumber(number, list); } if (command == 4) { save(list); } } exit(list); return 0; }
void ContactManager::importConfiguration(XmlConfigFile *configurationStorage) { QDomElement contactsNode = configurationStorage->getNode("Contacts", XmlConfigFile::ModeFind); if (contactsNode.isNull()) return; QDomNodeList contactsNodes = configurationStorage->getNodes(contactsNode, "Contact"); int count = contactsNodes.count(); for (int i = 0; i < count; i++) { QDomElement contactElement = contactsNodes.item(i).toElement(); if (contactElement.isNull()) continue; Contact contact; contact.importConfiguration(configurationStorage, contactElement); addContact(contact); } }
void BE::Contacts::manageContact(const QString &mail, const QString &prettyName) { QStandardItemModel *model = m_abook->model(); for (int i = 0; i < model->rowCount(); ++i) { QStandardItem *item = model->item(i); if (QString::compare(item->data(Gui::AbookAddressbook::Mail).toString(), mail, Qt::CaseInsensitive) == 0) { setContact(model->index(i, 0)); return; } } // no match -> create one addContact(); m_ui2->mail->setText(mail); if (!prettyName.isEmpty()) { m_ui2->name->setText(prettyName); m_currentContact->setText(prettyName); } else { m_ui2->name->setText("[name]"); } }
int Contacts::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_actionButton_clicked(); break; case 1: on_listWidget_itemClicked((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; case 2: on_backButton_clicked(); break; case 3: addContact(); break; case 4: deleteContact(); break; case 5: loadPhoneContacts(); break; case 6: editContact(); break; case 7: aboutapp(); break; case 8: exitapp(); break; default: ; } _id -= 9; } return _id; }
void QNetsoul::connectActionsSignals(void) { // QNetsoul connect(actionConnect, SIGNAL(triggered()), SLOT(connectToServer())); connect(actionDisconnect, SIGNAL(triggered()), SLOT(disconnect())); connect(actionCheckForUpdates, SIGNAL(triggered()), this->_internUpdater, SLOT(startUpdater())); connect(actionQuit, SIGNAL(triggered()), SLOT(saveStateBeforeQuiting())); // Contacts connect(actionAddG, SIGNAL(triggered()), this->tree, SLOT(addGroup())); connect(actionAddC, SIGNAL(triggered()), this->tree, SLOT(addContact())); connect(actionRefresh, SIGNAL(triggered()), this->tree, SLOT(refreshContacts())); connect(actionLoadContacts, SIGNAL(triggered()), this->tree, SLOT(loadContacts())); connect(actionSaveContacts, SIGNAL(triggered()), this->tree, SLOT(saveContacts())); connect(actionSaveContactsAs, SIGNAL(triggered()), this->tree, SLOT(saveContactsAs())); // Plugins connect(actionPluginsManager, SIGNAL(triggered()), this->_pluginsManager, SLOT(show())); connect(actionVDM, SIGNAL(triggered()), this->_vdm, SLOT(getVdm())); connect(actionCNF, SIGNAL(triggered()), this->_cnf, SLOT(getFact())); connect(actionPastebin, SIGNAL(triggered()), this->_pastebin, SLOT(pastebinIt())); // Options connect(actionPreferences, SIGNAL(triggered()), SLOT(openOptionsDialog())); // Help connect(actionAbout_QNetSoul, SIGNAL(triggered()), SLOT(aboutQNetSoul())); connect(actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); // Status connect(statusComboBox, SIGNAL(currentIndexChanged(int)), this->_network, SLOT(sendStatus(const int&))); // From Option widget connect(this->_options->mainWidget, SIGNAL(loginPasswordFilled()), SLOT(connectToServer())); }
ContactUser *ContactsManager::createContactRequest(const QString &contactid, const QString &nickname, const QString &myNickname, const QString &message) { QString hostname = ContactIDValidator::hostnameFromID(contactid); if (hostname.isEmpty() || lookupHostname(contactid) || lookupNickname(nickname)) { return 0; } bool b = blockSignals(true); ContactUser *user = addContact(nickname); blockSignals(b); if (!user) return user; user->setHostname(ContactIDValidator::hostnameFromID(contactid)); OutgoingContactRequest::createNewRequest(user, myNickname, message); /* Signal deferred from addContact to avoid changing the status immediately */ Q_ASSERT(user->status() == ContactUser::RequestPending); emit contactAdded(user); return user; }
/** * @author Macai * @slot function: show dialog for add a contact * @brief MainWindow::showAddDlg */ void MainWindow::showAddContactDlg() { AddContactDialog* addDlg = new AddContactDialog(this); connect(addDlg, SIGNAL(updateGroup(QString)), ui->grouplistWidget, SLOT(updateGroup(QString)) ); connect(addDlg, SIGNAL(submitContact(QList<QVariant>)), ui->contactTableView, SLOT(addContact(QList<QVariant>)) ); QStringList list; int cnt = ui->grouplistWidget->count(); for( int i = 0; i < cnt; ++i) { QString text = ui->grouplistWidget->item(i)->text(); if( text == GROUP_ALL) continue; list.append(text); } int idx = ui->grouplistWidget->currentRow(); addDlg->initGroupCombobox(idx, list); int ret = addDlg->exec(); addDlg->deleteLater(); }
void GatewayTask::slotSubscription(const XMPP::Presence& p) { QString legacyNode = p.to().node(); if ( !p.to().node().isEmpty() ) { Jid user = p.from(); switch ( p.type() ) { case Presence::Subscribe: emit addContact(user, legacyNode); break; case Presence::Unsubscribe: emit deleteContact(user, legacyNode); break; case Presence::Subscribed: emit grantAuth(user, legacyNode); break; case Presence::Unsubscribed: emit denyAuth(user, legacyNode); break; default: break; } } }
AddressBook::AddressBook(QWidget *parent) : QWidget(parent), ui(new Ui::AddressBook) { ui->setupUi(this); ui->nameLine->setReadOnly(true); ui->addressText->setReadOnly(true); ui->submitButton->hide(); ui->cancelButton->hide(); ui->nextButton->setEnabled(false); ui->previousButton->setEnabled(false); //! [extract objects] ui->editButton->setEnabled(false); ui->removeButton->setEnabled(false); //! [extract objects] connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(ui->previousButton, SIGNAL(clicked()), this, SLOT(previous())); //! [signal slot] connect(ui->editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); //! [signal slot] setWindowTitle(tr("Simple Address Book")); }
void loadFile(contactList *contactList) { FILE *fp; int i=0; char *buffer; char *split; char *splitedInput[4]; fp = fopen("file.txt","r"); ; buffer = getFileInput(fp); split = strtok(buffer,"\n"); while(split) { splitedInput[i++] = split; split = strtok(NULL, "\n"); if(i==4) { i=0; addContact(contactList, splitedInput[0],splitedInput[1],splitedInput[2],splitedInput[3],1); } } free(buffer); }
void MultitouchPlugin::updateContact(TouchContact &c) { //update mouse, but only if this is the one we used as a mouse input if (_mode == MOUSE && c.id == _mouseID) { cover->handleMouseEvent(osgGA::GUIEventAdapter::DRAG, static_cast<int>(c.x), static_cast<int>(cover->frontWindowVerticalSize - c.y)); } // update contact std::list<TouchContact>::iterator it; for (it = _contacts.begin(); it != _contacts.end(); it++) { if (it->id == c.id) { (*it) = c; return; } } cerr << "EXCEPTION @MultitouchPlugin::changedContact: \n contact ID = " << c.id << " could not be updated" << endl; cerr << "removing and re-adding contact..." << endl; removeContact(c); addContact(c); }
AddressBook::AddressBook(QWidget *parent) : QWidget(parent) { QLabel *nameLabel = new QLabel(tr("Name:")); nameLine = new QLineEdit; nameLine->setReadOnly(true); QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; addressText->setReadOnly(true); addButton = new QPushButton(tr("&Add")); editButton = new QPushButton(tr("&Edit")); editButton->setEnabled(false); removeButton = new QPushButton(tr("&Remove")); removeButton->setEnabled(false); findButton = new QPushButton(tr("&Find")); findButton->setEnabled(false); submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); cancelButton = new QPushButton(tr("&Cancel")); cancelButton->hide(); nextButton = new QPushButton(tr("&Next")); nextButton->setEnabled(false); previousButton = new QPushButton(tr("&Previous")); previousButton->setEnabled(false); loadButton = new QPushButton(tr("&Load...")); //! [tooltip 1] loadButton->setToolTip(tr("Load contacts from a file")); //! [tooltip 1] saveButton = new QPushButton(tr("&Save...")); //! [tooltip 2] saveButton->setToolTip(tr("Save contacts to a file")); //! [tooltip 2] saveButton->setEnabled(false); dialog = new FindDialog; connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); connect(findButton, SIGNAL(clicked()), this, SLOT(findContact())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile())); QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); buttonLayout1->addWidget(removeButton); buttonLayout1->addWidget(findButton); buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addWidget(loadButton); buttonLayout1->addWidget(saveButton); buttonLayout1->addStretch(); QHBoxLayout *buttonLayout2 = new QHBoxLayout; buttonLayout2->addWidget(previousButton); buttonLayout2->addWidget(nextButton); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(nameLabel, 0, 0); mainLayout->addWidget(nameLine, 0, 1); mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop); mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); mainLayout->addLayout(buttonLayout2, 2, 1); setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); }