예제 #1
0
void JabberBrowser::stop(const QString &err)
{
    Command cmd;
    cmd->id			 = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl;
    cmd->text		 = I18N_NOOP("JID");
    cmd->icon		 = "run";
    cmd->bar_grp	 = 0x2000;
    cmd->flags		 = BTN_COMBO_CHECK;
    cmd->param		 = this;
    Event e(EventCommandChange, cmd);
    e.process();
    cmd->id		= static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdInfo;
    cmd->flags	= (m_category.isEmpty() && m_type.isEmpty() && m_name.isEmpty() && m_features.isEmpty()) ? COMMAND_DISABLED : 0;
    cmd->param	= this;
    Event eNext(EventCommandDisabled, cmd);
    eNext.process();
    cmd->id		= static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdSearch;
    cmd->flags	= haveFeature("jabber:iq:search") ? 0 : COMMAND_DISABLED;
    eNext.process();
    cmd->id		= static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdRegister;
    cmd->flags	= haveFeature("jabber:iq:register") ? 0 : COMMAND_DISABLED;
    eNext.process();
    if (!err.isEmpty()) {
        Command cmd;
        cmd->id		= static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl;
        cmd->param	= this;
        Event eWidget(EventCommandWidget, cmd);
        QWidget *parent = (QWidget*)(eWidget.process());
        if (parent == NULL)
            parent = this;
        BalloonMsg::message(err, parent);
    }
    m_status->message(err);
}
예제 #2
0
bool JabberBrowser::haveFeature(const char *feature)
{
    QString features;
    if (m_list->currentItem())
        features = m_list->currentItem()->text(COL_FEATURES);
	return haveFeature(feature, features);
}
예제 #3
0
void JabberBrowser::loadItem(QListViewItem *item)
{
	bool bProcess = false;
	unsigned mode = atol(item->text(COL_MODE).latin1());
	if (m_client->getBrowseType() & BROWSE_DISCO){
		if (((mode & BROWSE_DISCO) == 0) && item->text(COL_ID_DISCO_ITEMS).isEmpty()){
            item->setText(COL_ID_DISCO_ITEMS, m_client->discoItems(item->text(COL_JID).utf8(), item->text(COL_NODE).utf8()).c_str());
			mode |= BROWSE_DISCO;
			bProcess = true;
		}
		if (((mode & BROWSE_INFO) == 0) && item->text(COL_ID_DISCO_INFO).isEmpty()){
            item->setText(COL_ID_DISCO_INFO, m_client->discoInfo(item->text(COL_JID).utf8(), item->text(COL_NODE).utf8()).c_str());
			mode |= BROWSE_INFO;
			bProcess = true;
		}
	}
	if (m_client->getBrowseType() & BROWSE_BROWSE){
		if (((mode & BROWSE_BROWSE) == 0) && item->text(COL_ID_BROWSE).isEmpty() && haveFeature("iq:id:browse", item->text(COL_FEATURES))){
            item->setText(COL_ID_BROWSE, m_client->browse(item->text(COL_JID).utf8()).c_str());
			mode |= BROWSE_BROWSE;
			bProcess = true;
		}
	}
	item->setText(COL_MODE, QString::number(mode));
	if (!m_bInProcess && bProcess){
		m_bInProcess = true;
		startProcess();
	}
}
예제 #4
0
void JabberBrowser::currentChanged(QListViewItem*)
{
    Command cmd;
    cmd->id		= CmdBrowseInfo;
    cmd->flags	= m_list->currentItem() ? 0 : COMMAND_DISABLED;
    cmd->param	= this;
    Event eNext(EventCommandDisabled, cmd);
    eNext.process();
    cmd->id		= CmdBrowseSearch;
    cmd->flags	= haveFeature("jabber:iq:search") ? 0 : COMMAND_DISABLED;
    eNext.process();
    cmd->id		= CmdRegister;
    cmd->flags	= haveFeature("jabber:iq:register") ? 0 : COMMAND_DISABLED;
    eNext.process();
    cmd->id		= CmdBrowseConfigure;
    cmd->flags	= haveFeature("jabber:iq:data") ? 0 : COMMAND_DISABLED;
    eNext.process();
	QListViewItem *item = m_list->currentItem();
	if (item == NULL)
		return;
	loadItem(item);
}