Example #1
0
void BE::Contacts::closeEvent(QCloseEvent *)
{
    if (m_dirty) {
        if (QMessageBox::question(this, tr("Contacts"), tr("Save changes?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
            saveContacts();
        } else {
            m_abook->model()->removeRows(0, m_abook->model()->rowCount());
            m_abook->readAbook(false);
        }
    }
}
void PeopleInfoManager::removeFromContactList(qint32 id)
{
	ContactInfo *oldContact = contactMap[id];
	contactMap.remove(id);	

	if (oldContact != NULL)
		delete oldContact;

	saveContacts();

	PIMDEBUG("PeopleInfoManager::contact removed " << id);
	emit contactListChanged();
}
void PeopleInfoManager::addToContactList(const ContactInfo &contact)
{
	if (getContact(contact.getUserId()) == NULL)
	{
		ContactInfo *newContact = new ContactInfo();
		*newContact = contact;
		contactMap.insert(contact.getUserId(), newContact);

		saveContacts();

		PIMDEBUG("PeopleInfoManager::contact added " << contact.getUserId());
		emit contactListChanged();
	}
}
Example #4
0
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()));
}
void CWizEmailShareDialog::processReturnMessage(const QString& returnMessage, int& nCode, QString& message)
{
    rapidjson::Document d;
    d.Parse<0>(returnMessage.toUtf8().constData());

    if (d.FindMember("error_code")) {
        qDebug() << QString::fromUtf8(d.FindMember("error")->value.GetString());
        return;
    }

    if (d.FindMember("return_code")) {
        nCode = d.FindMember("return_code")->value.GetInt();
        if (nCode == 200) {
            qDebug() <<"[EmailShar]:send email successed!";
            saveContacts();
            return;
        } else {
            message = QString::fromUtf8(d.FindMember("return_message")->value.GetString());
            qDebug() << message << ", code = " << nCode;
            return;
        }
    }
}