Example #1
0
icqAccount::icqAccount(QString string, const QString &profile_name, QObject *parent)
	: QObject(parent)
	, icqUin(string)
	, m_profile_name(profile_name)
	, m_icq_plugin_system(IcqPluginSystem::instance())
{
	currentTrayStatus = false;
	statusTrayMenuExist = false;
	deleteingAccount = false;
	menuExist = false;
	firsTrayMessageIsShown = false;
	positionInStack = 1;
	currentXstatus = 0;
	statusIconIndex = 0;
	iAmConnected = false;
	thisIcqProtocol = new oscarProtocol(icqUin, m_profile_name, this);
	connect(thisIcqProtocol, SIGNAL(statusChanged(accountStatus)),
			this, SLOT(setStatusIcon(accountStatus)));
	connect(thisIcqProtocol, SIGNAL(statusChanged(accountStatus)),
			this, SLOT(onOscarStatusChanged(accountStatus)));

	connect(thisIcqProtocol, SIGNAL(accountConnected(bool)),
			this, SLOT(accountConnected(bool)));
	connect(thisIcqProtocol, SIGNAL(systemMessage(const QString &)),
			this, SLOT(systemMessage(const QString &)));
	connect(thisIcqProtocol, SIGNAL(userMessage(const QString &, const QString &, const QString &, userMessageType, bool)),
				this, SLOT(userMessage(const QString &, const QString &, const QString &, userMessageType, bool)));
	connect(thisIcqProtocol, SIGNAL(getNewMessage()),
                this, SIGNAL(getNewMessage()));
	connect(thisIcqProtocol, SIGNAL(readAllMessages()),
						this, SIGNAL(readAllMessages()));

	connect(thisIcqProtocol->getContactListClass(), SIGNAL(updateStatusMenu(bool)),
						this, SLOT(updateStatusMenu(bool)));
	connect(this, SIGNAL(updateTranslation()),
		thisIcqProtocol, SIGNAL(updateTranslation()));


	createIcons();
	createStatusMenu();

	chooseStatus = new QAction(currentIcon, icqUin, this);
	chooseStatus->setCheckable(true);
	connect ( chooseStatus, SIGNAL(triggered()),
			this, SLOT(emitChangeStatus()));

	loadAccountSettings();
        QSettings settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name, "icqsettings");
	configPath = settings.fileName().section('/', 0, -2);
	
	createMenuAccount();

		m_restore_xstatus_num = -10;
		m_restore_status = restoreAccount;
}
void MainWindow::on_tabWidget_currentChanged(int index)
{
    Q_UNUSED(index);

    if (ui->tabWidget->currentWidget() == ui->tabMessaging) {
        if (ui->settingsReadMessages->isChecked()) {
            readAllMessages();
        }
    }
}