Esempio n. 1
0
void MainWindow::on_btnDeleteAccount_clicked()
{
    QString selectedAccountName = getAccountName();
    QString warningMessage = qApp->tr("This will delete account ");
    warningMessage.append(selectedAccountName);
    if (QMessageBox::warning(0,qApp->tr("Delete Account"),
                         warningMessage,
                         QMessageBox::Ok | QMessageBox::Cancel)
            == QMessageBox::Ok)
    {
        int accountId = getAccountId();

        //remove any transactions associated with this account
        QSqlQuery q;
        q.prepare("DELETE FROM trans WHERE id_account = ?");
        q.addBindValue(accountId);
        if(!q.exec())
        {
            transactionFailedError(qApp->tr("Could not delete account"));
        }

        //remove the account
        q.clear();
        q.prepare("DELETE FROM account WHERE pk_uid = ?");
        q.addBindValue(accountId);
        if(!q.exec())
        {
            transactionFailedError(qApp->tr("Could not delete account"));
        }
    }
    refreshAccountTree();
}
Esempio n. 2
0
void jAccount::showChangeResourceDialog()
{
	changeResource changeResourceDialog;
	changeResourceDialog.setWindowTitle(tr("Change resource/priority on") + " " + getAccountName());
	changeResourceDialog.setResource(m_jabber_protocol->getResource());
	changeResourceDialog.setPriority(m_jabber_protocol->getPriority());
	if (changeResourceDialog.exec())
		m_jabber_protocol->setResource(changeResourceDialog.getResource(), changeResourceDialog.getPriority());
}
Esempio n. 3
0
void jAccount::showAddDialog(const QString &jid, const QString &nick)
{
	QStringList groups;
	groups = m_jabber_roster->getGroups();
        groups.removeAll(tr("Services"));
        jAddContact *jadduser = new jAddContact(groups, jid, nick);
	jPluginSystem plugin = jPluginSystem::instance();
	jadduser->setIcons(plugin.getIcon("search"), plugin.getIcon("contactinfo"), plugin.getIcon("apply"));
	jadduser->setWindowIcon(plugin.getIcon("add_user"));
	jadduser->setWindowTitle(tr("Add new contact on") + " " + getAccountName());
	connect(jadduser, SIGNAL(showInformation(const QString&)), this, SLOT(showInformation(const QString&)));
	connect(jadduser, SIGNAL(addContact(const QString&, const QString&, const QString&, bool)), this, SLOT(addContact(const QString&, const QString&, const QString&, bool)));
	jadduser->show();
}
Esempio n. 4
0
	/*
		Summary: returns a string representation of the account object
				that allows the object to be persisted in a text file
		Pre: none
		Post: string representation (std::string) is returned										
	*/
	std::string toString()
	{
		stringstream ss;
		ss << getAccountId() << ", ";
		ss << getCustomerId() << ", ";
		ss << getAccountName() << ", ";
		ss << getInterestRate() << ", ";
		ss << getBalance();

		std::string str;
		getline(ss, str);

		return str;
	}
Esempio n. 5
0
void Session::Request::onAccountPageResult() {
    QNetworkReply *reply = qobject_cast<QNetworkReply*>(QObject::sender());
    if (reply->error()) {
        qDebug() << "Network error in " << __FUNCTION__ << ": " << reply->errorString();
    }
    else {
        // Regexp for getting last visited, guild, etc
        // <strong>(?<attr>.+?):<\/strong><br\/>\s+?(<a href=\"(?<url>.+?)\">(?<content1>.+?)<\/a>|\s+(?<content2>[A-Za-z0-9 ]+?)\s+<\/p>)


        const QByteArray data = reply->readAll();
        const QString avatar = getAccountAvatar(data);
        const QString name = getAccountName(data);
        const auto badges = getAccountBadges(data);
        const int messages = getAccountMessagesUnread(data);

        // Store the account name
        _accountName = name;

        QJsonObject object;
        object.insert("name", name);
        object.insert("avatar_url", avatar);
        object.insert("messages", messages);
        object.insert("badges", QJsonArray::fromStringList(badges.keys()));
        QJsonDocument temp(object);
        emit profileData(temp.toJson());

        // Request Avatar
        if (!avatar.isEmpty()) {
            if (!_avatars.contains(avatar))
                _avatars.append(avatar);
            fetchImage(avatar);
        }
        // Request Badges
        for (const QString &key : badges.uniqueKeys()){
            const QString url = badges.value(key);
            if (url.isEmpty()) continue;
            fetchAccountBadge(key, url);
        }
    }
    reply->deleteLater();
}
Esempio n. 6
0
void ServerController::processClient(sf::Packet &packet, sf::TcpSocket &client)
{
	std::string protocol;
		
	packet >> protocol;
		
	std::cout << "Interpreting Packet Protocol: " << protocol << std::endl;
		
	if(protocol=="LOGIN"){
		loginAccount(packet, client);
	}
	else if(protocol=="REGISTER"){
		registerAccount(packet, client);
	}
	else if(protocol=="CONFERENCE_LIST"){
		getConferences(packet, client);
	}
	else if(protocol=="CONFERENCE_ACCESS"){
		getAccess(packet, client);
	}
	else if(protocol=="VIEW_SUBMISSIONS"){
		getSubmissions(packet, client);
	}
	else if(protocol=="SUBMIT_PAPER"){
		paperSubmission(packet, client);
	}
	else if (protocol=="ADMIN_STATUS"){
		getAdminStatus(packet, client);
	}
	else if (protocol=="CREATE_CONFERENCE"){
		createConference(packet, client);
	}
	else if (protocol=="GET_NOTIFICATIONS"){
		getNotifications(packet, client);
	}
	else if (protocol=="CHECK_PHASE"){
		checkPhase(packet, client);
	}
	else if (protocol=="BID_LIST"){
		bidList(packet, client);
	}
	else if (protocol=="BID_PAPER"){
		bidPaper(packet, client);
	}
	else if (protocol=="ADVANCE_PHASE"){
		advancePhase(packet, client);
	}
	else if(protocol=="BYE"){
		logoutUser(packet, client);
	}
	else if(protocol=="GET_ALLOCATIONS"){
		getAllocations(packet, client);
	}
	else if(protocol=="CONFERENCE_SUBMISSIONS"){
		getConferenceSubs(packet, client);
	}
	else if(protocol=="REVIEW_LIST"){
		getReviewList(packet, client, true);
	}
	else if (protocol=="SUB_DETAIL"){
		sendSubDetail(packet, client);
	}
	else if (protocol=="SUBMIT_REVIEW"){
		submitReview(packet, client);
	}
	else if (protocol=="GET_COMMENTS"){
		getComments(packet, client);
	}
	else if (protocol=="SEND_COMMENT"){
		sendComments(packet, client);
	}
	else if (protocol=="ADD_REVIEWER"){
		addMember(packet, client, Account::Access_Reviewer);
	}
	else if (protocol=="ADD_AUTHOR"){
		addMember(packet, client, Account::Access_Author);
	}
	else if (protocol=="CHANGE_MAX_ALLOCATED_CONF"){
		changeLimit(packet, client, "ALLOCATED");
	}
	else if (protocol=="CHANGE_MAX_PAPERREVIEWERS_CONF"){
		changeLimit(packet, client, "PAPERREV");
	}
	else if (protocol=="GET_MAX_ALLOCATED_CONF"){
		getLimit(packet, client, "ALLOCATED");
	}
	else if (protocol=="GET_MAX_PAPERREVIEWERS_CONF"){
		getLimit(packet, client, "PAPERREV");
	}
	else if (protocol=="GET_FULLNAME"){
		getAccountName(packet, client);
	}
	else if (protocol=="VIEW_REVIEW"){
		getReview(packet, client);
	}
	else if (protocol=="NOTIFY_COUNT"){
		checkNotifyCount(packet, client);
	}
	else if (protocol=="APPROVE_PAPER"){
		decidePaper(packet, client, true);
	}
	else if (protocol=="REJECT_PAPER"){
		decidePaper(packet, client, false);
	}
	else if (protocol=="MY_REVIEWS"){
		getReviewList(packet, client, false);
	}
	else if (protocol=="DID_REVIEW"){
		checkReviewed(packet, client);
	}
	else if (protocol=="FINAL_REVIEW"){
		getFinalReview(packet, client);
	}
	else if (protocol=="CONF_REVIEWERS"){
		getReviewers(packet, client);
	}
	else if (protocol=="CONF_SUBMISSIONS"){
		getConfSubmissions(packet, client);
	}
	else if (protocol=="FILLED_ALLOCATION"){
		checkPaperAlloc(packet, client);
	}
	else if (protocol=="GET_FREE_REVIEWERS"){
		getFreeReviewers(packet, client);
	}
	else if (protocol=="ASSIGN_REVIEWER"){
		assignReviewer(packet, client);
	}
	else if (protocol=="CHANGE_PASSWORD"){
		changePassword(packet, client);
	}
	else {
		std::cout << "Unrecognised protocol" << std::endl;
	}
}