MoreInfo::MoreInfo(QWidget *parent, struct ICQUserData *data, ICQClient *client) : MoreInfoBase(parent) { m_data = data; m_client = client; btnHomePage->setPixmap(Pict("home")); connect(btnHomePage, SIGNAL(clicked()), this, SLOT(goUrl())); QDate now = QDate::currentDate(); spnAge->setSpecialValueText(" "); spnAge->setRange(0, 100); connect(cmbLang1, SIGNAL(activated(int)), this, SLOT(setLang(int))); connect(cmbLang2, SIGNAL(activated(int)), this, SLOT(setLang(int))); connect(cmbLang3, SIGNAL(activated(int)), this, SLOT(setLang(int))); connect(edtDate, SIGNAL(changed()), this, SLOT(birthDayChanged())); if (m_data){ disableWidget(spnAge); edtHomePage->setReadOnly(true); disableWidget(cmbGender); disableWidget(edtDate); disableWidget(cmbLang1); disableWidget(cmbLang2); disableWidget(cmbLang3); }else{ connect(edtHomePage, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&))); } fill(); }
DiscoInfo::DiscoInfo(JabberBrowser *browser) : DiscoInfoBase(browser, NULL, false, WDestructiveClose) { m_browser = browser; SET_WNDPROC("jbrowser") setIcon(Pict("Jabber_online")); setTitle(); setButtonsPict(this); connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply())); m_bVersion = true; m_bTime = true; m_bLast = true; m_bStat = true; m_bVCard = true; m_about = NULL; load_data(jabberUserData, &m_data, NULL); disableWidget(edtJName); disableWidget(edtType); disableWidget(edtCategory); edtNameSpace->setReadOnly(true); disableWidget(edtName); disableWidget(edtVersion); disableWidget(edtSystem); disableWidget(edtTime); disableWidget(edtLast); lstStat->addColumn(i18n("Name")); lstStat->addColumn(i18n("Units")); lstStat->addColumn(i18n("Value")); lstStat->setExpandingColumn(2); btnUrl->setPixmap(Pict("home")); connect(btnUrl, SIGNAL(clicked()), this, SLOT(goUrl())); connect(edtUrl, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&))); }
void JabberBrowser::setClient(JabberClient *client) { if (m_client == client) return; m_client = client; QString url; if (m_client->getUseVHost()) url = QString::fromUtf8(m_client->getVHost()); if (url.isEmpty()) url = QString::fromUtf8(m_client->getServer()); goUrl(url, ""); }
WorkInfo::WorkInfo(QWidget *p, bool readOnly) : WorkInfoBase(p) { btnSite->setPixmap(Pict("home")); connect(btnSite, SIGNAL(clicked()), this, SLOT(goUrl())); if (!readOnly) { load(pClient->owner); return; } edtAddress->setReadOnly(true); edtCity->setReadOnly(true); edtState->setReadOnly(true); edtZip->setReadOnly(true); disableWidget(cmbCountry); disableWidget(cmbOccupation); edtName->setReadOnly(true); edtDept->setReadOnly(true); edtPosition->setReadOnly(true); edtSite->setReadOnly(true); }
DiscoInfo::DiscoInfo(JabberBrowser *browser, const QString &features, const QString &name, const QString &type, const QString &category) : QDialog( NULL) { setAttribute( Qt::WA_DeleteOnClose); setupUi( this); m_browser = browser; SET_WNDPROC("jbrowser") setIcon(Pict("Jabber_online").pixmap()); setTitle(); setButtonsPict(this); connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply())); m_bVersion = true; m_bTime = true; m_bLast = true; m_bStat = true; m_bVCard = true; m_about = NULL; m_features = features; m_name = name; m_type = type; m_category = category; load_data(jabberUserData, &m_data, NULL); disableWidget(edtJName); disableWidget(edtType); disableWidget(edtCategory); edtNameSpace->setReadOnly(true); disableWidget(edtName); disableWidget(edtVersion); disableWidget(edtSystem); disableWidget(edtTime); disableWidget(edtLast); lstStat->addColumn(i18n("Name")); lstStat->addColumn(i18n("Units")); lstStat->addColumn(i18n("Value")); lstStat->setExpandingColumn(2); btnUrl->setPixmap(Pict("home").pixmap()); connect(btnUrl, SIGNAL(clicked()), this, SLOT(goUrl())); connect(edtUrl, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&))); }
JabberInfo::JabberInfo(QWidget *parent, struct JabberUserData *data, JabberClient *client) : JabberInfoBase(parent) { m_client = client; m_data = data; btnUrl->setPixmap(Pict("home")); connect(btnUrl, SIGNAL(clicked()), this, SLOT(goUrl())); edtOnline->setReadOnly(true); edtNA->setReadOnly(true); edtResource->setReadOnly(true); edtID->setReadOnly(true); if (m_data){ edtFirstName->setReadOnly(true); edtNick->setReadOnly(true); edtBirthday->setReadOnly(true); edtUrl->setReadOnly(true); edtAutoReply->setReadOnly(true); }else{ connect(edtUrl, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&))); edtAutoReply->hide(); } fill(); }
WorkInfo::WorkInfo(QWidget *parent, struct ICQUserData *data, ICQClient *client) : WorkInfoBase(parent) { m_data = data; m_client = client; btnSite->setPixmap(Pict("home")); connect(btnSite, SIGNAL(clicked()), this, SLOT(goUrl())); if (m_data){ edtAddress->setReadOnly(true); edtCity->setReadOnly(true); edtState->setReadOnly(true); edtZip->setReadOnly(true); disableWidget(cmbCountry); disableWidget(cmbOccupation); edtName->setReadOnly(true); edtDept->setReadOnly(true); edtPosition->setReadOnly(true); edtSite->setReadOnly(true); }else{ connect(edtSite, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&))); } fill(); }
void JabberBrowser::clickItem(QListViewItem *item) { goUrl(item->text(COL_JID), item->text(COL_NODE)); }
void *JabberBrowser::processEvent(Event *e) { if (e->type() == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->EventAgentInfo){ JabberAgentInfo *data = (JabberAgentInfo*)(e->param()); if (m_search_id == data->ReqID.ptr){ if (data->Type.ptr == NULL){ if (data->nOptions.value){ QString err; if (data->Label.ptr && *data->Label.ptr) err = i18n(data->Label.ptr); if (err.isEmpty()) err = i18n("Error %1") .arg(data->nOptions.value); m_search_id = ""; delete m_search; m_search = NULL; Command cmd; cmd->id = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdSearch; cmd->param = this; Event eWidget(EventCommandWidget, cmd); QWidget *parent = (QWidget*)(eWidget.process()); if (parent == NULL) parent = this; BalloonMsg::message(err, parent); }else{ m_search->m_search->addWidget(data); QTimer::singleShot(0, this, SLOT(showSearch())); } m_search_id = ""; return e->param(); } m_search->m_search->addWidget(data); return e->param(); } if (m_reg_id == data->ReqID.ptr){ if (data->Type.ptr == NULL){ if (data->nOptions.value){ QString err; if (data->Label.ptr && *data->Label.ptr) err = i18n(data->Label.ptr); if (err.isEmpty()) err = i18n("Error %1") .arg(data->nOptions.value); m_reg_id = ""; delete m_reg; m_reg = NULL; Command cmd; cmd->id = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdRegister; cmd->param = this; Event eWidget(EventCommandWidget, cmd); QWidget *parent = (QWidget*)(eWidget.process()); if (parent == NULL) parent = this; BalloonMsg::message(err, parent); }else{ m_reg->m_search->addWidget(data); QTimer::singleShot(0, this, SLOT(showReg())); } m_reg_id = ""; return e->param(); } m_reg->m_search->addWidget(data); return e->param(); } if (m_config_id == data->ReqID.ptr){ if (data->Type.ptr == NULL){ if (data->nOptions.value){ QString err; if (data->Label.ptr && *data->Label.ptr) err = i18n(data->Label.ptr); if (err.isEmpty()) err = i18n("Error %1") .arg(data->nOptions.value); m_config_id = ""; delete m_config; m_config = NULL; Command cmd; cmd->id = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdConfigure; cmd->param = this; Event eWidget(EventCommandWidget, cmd); QWidget *parent = (QWidget*)(eWidget.process()); if (parent == NULL) parent = this; BalloonMsg::message(err, parent); }else{ m_config->m_search->addWidget(data); QTimer::singleShot(0, this, SLOT(showConfig())); } m_config_id = ""; return e->param(); } m_config->m_search->addWidget(data); return e->param(); } } if (e->type() == EventCommandExec){ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->param != this) return NULL; if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdSearch){ if (m_search) delete m_search; m_search = new JabberWizard(this, I18N_NOOP("%1 Search"), "find", m_client, m_history[m_historyPos].c_str(), m_nodes[m_historyPos].c_str(), "search"); m_search_id = m_client->get_agent_info(m_history[m_historyPos].c_str(), m_nodes[m_historyPos].c_str(), "search"); return e->param(); } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdRegister){ if (m_reg) delete m_reg; m_reg = new JabberWizard(this, I18N_NOOP("%1 Register"), "reg", m_client, m_history[m_historyPos].c_str(), m_nodes[m_historyPos].c_str(), "register"); m_reg_id = m_client->get_agent_info(m_history[m_historyPos].c_str(), m_nodes[m_historyPos].c_str(), "register"); return e->param(); } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdConfigure){ if (m_config) delete m_config; m_config = new JabberWizard(this, I18N_NOOP("%1 Configure"), "configure", m_client, m_history[m_historyPos].c_str(), m_nodes[m_historyPos].c_str(), "data"); m_config_id = m_client->get_agent_info(m_history[m_historyPos].c_str(), m_nodes[m_historyPos].c_str(), "data"); return e->param(); } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdBack){ if (m_historyPos){ m_historyPos--; QString url = QString::fromUtf8(m_history[m_historyPos].c_str()); QString node; if (!m_nodes[m_historyPos].empty()) node = QString::fromUtf8(m_nodes[m_historyPos].c_str()); go(url, node); } } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdForward){ if (m_historyPos + 1 < (int)(m_history.size())){ m_historyPos++; QString url = QString::fromUtf8(m_history[m_historyPos].c_str()); QString node; if (!m_nodes[m_historyPos].empty()) node = QString::fromUtf8(m_nodes[m_historyPos].c_str()); go(url, node); } } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl){ if (!m_id1.empty() || !m_id2.empty()){ stop(""); return e->param(); } QString jid; QString node; Command cmd; cmd->id = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl; cmd->param = this; Event eWidget(EventCommandWidget, cmd); CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process()); if (cmbUrl) jid = cmbUrl->lineEdit()->text(); cmd->id = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdNode; CToolCombo *cmbNode = (CToolCombo*)(eWidget.process()); if (cmbNode) node = cmbNode->lineEdit()->text(); if (!jid.isEmpty()){ addHistory(jid); goUrl(jid, node); } return e->param(); } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdInfo){ if (m_category.isEmpty() && m_type.isEmpty() && m_name.isEmpty() && m_features.isEmpty()) return e->param(); if (m_info == NULL) m_info = new DiscoInfo(this); m_info->reset(); raiseWindow(m_info); return e->param(); } } if (e->type() == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->EventDiscoItem){ JabberDiscoItem *item = (JabberDiscoItem*)(e->param()); if (m_id1 == item->id){ if (item->jid.empty()){ m_id1 = ""; m_list->adjustColumn(); QString err; if (!item->name.empty()){ err = QString::fromUtf8(item->name.c_str()); }else if (!item->node.empty()){ err = i18n("Error %1") .arg(atol(item->node.c_str())); } if (err.isEmpty() || m_id2.empty()) stop(err); return e->param(); } QListViewItem *i = new QListViewItem(m_list); i->setText(COL_JID, QString::fromUtf8(item->jid.c_str())); i->setText(COL_NAME, QString::fromUtf8(item->name.c_str())); i->setText(COL_NODE, QString::fromUtf8(item->node.c_str())); return e->param(); } if (m_id2 == item->id){ if (item->jid.empty()){ m_id2 = ""; m_list->adjustColumn(); QString err; if (!item->name.empty()){ err = QString::fromUtf8(item->name.c_str()); }else if (!item->node.empty()){ err = i18n("Error %1") .arg(atol(item->node.c_str())); } if (m_id1.empty()) stop(err); return e->param(); } if (item->jid == "feature"){ if (!m_features.isEmpty()) m_features += "\n"; m_features += QString::fromUtf8(item->name.c_str()); }else{ m_category = QString::fromUtf8(item->jid.c_str()); m_type = QString::fromUtf8(item->node.c_str()); m_name = QString::fromUtf8(item->name.c_str()); } return e->param(); } } return NULL; }
void *JabberBrowser::processEvent(Event *e) { if (e->type() == EventAgentInfo){ JabberAgentInfo *data = (JabberAgentInfo*)(e->param()); if (m_search_id == data->ReqID.ptr){ if (data->Type.ptr == NULL){ if (data->nOptions.value){ QString err; if (data->Label.ptr && *data->Label.ptr) err = i18n(data->Label.ptr); if (err.isEmpty()) err = i18n("Error %1") .arg(data->nOptions.value); m_search_id = ""; delete m_search; m_search = NULL; Command cmd; cmd->id = CmdBrowseSearch; cmd->param = this; Event eWidget(EventCommandWidget, cmd); QWidget *parent = (QWidget*)(eWidget.process()); if (parent == NULL) parent = this; BalloonMsg::message(err, parent); }else{ m_search->m_search->addWidget(data); QTimer::singleShot(0, this, SLOT(showSearch())); } m_search_id = ""; return e->param(); } m_search->m_search->addWidget(data); return e->param(); } if (m_reg_id == data->ReqID.ptr){ if (data->Type.ptr == NULL){ if (data->nOptions.value){ QString err; if (data->Label.ptr && *data->Label.ptr) err = i18n(data->Label.ptr); if (err.isEmpty()) err = i18n("Error %1") .arg(data->nOptions.value); m_reg_id = ""; delete m_reg; m_reg = NULL; Command cmd; cmd->id = CmdRegister; cmd->param = this; Event eWidget(EventCommandWidget, cmd); QWidget *parent = (QWidget*)(eWidget.process()); if (parent == NULL) parent = this; BalloonMsg::message(err, parent); }else{ m_reg->m_search->addWidget(data); QTimer::singleShot(0, this, SLOT(showReg())); } m_reg_id = ""; return e->param(); } m_reg->m_search->addWidget(data); return e->param(); } if (m_config_id == data->ReqID.ptr){ if (data->Type.ptr == NULL){ if (data->nOptions.value){ QString err; if (data->Label.ptr && *data->Label.ptr) err = i18n(data->Label.ptr); if (err.isEmpty()) err = i18n("Error %1") .arg(data->nOptions.value); m_config_id = ""; delete m_config; m_config = NULL; Command cmd; cmd->id = CmdBrowseConfigure; cmd->param = this; Event eWidget(EventCommandWidget, cmd); QWidget *parent = (QWidget*)(eWidget.process()); if (parent == NULL) parent = this; BalloonMsg::message(err, parent); }else{ m_config->m_search->addWidget(data); QTimer::singleShot(0, this, SLOT(showConfig())); } m_config_id = ""; return e->param(); } m_config->m_search->addWidget(data); return e->param(); } } if (e->type() == EventCheckState){ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->param != this) return NULL; if (cmd->menu_id != MenuBrowser) return NULL; cmd->flags &= ~COMMAND_CHECKED; switch (cmd->id){ case CmdOneLevel: if (!m_client->getAllLevels()) cmd->flags |= COMMAND_CHECKED; return e->param(); case CmdAllLevels: if (m_client->getAllLevels()) cmd->flags |= COMMAND_CHECKED; return e->param(); case CmdModeDisco: if (m_client->getBrowseType() & BROWSE_DISCO) cmd->flags |= COMMAND_CHECKED; return e->param(); case CmdModeBrowse: if (m_client->getBrowseType() & BROWSE_BROWSE) cmd->flags |= COMMAND_CHECKED; return e->param(); case CmdModeAgents: if (m_client->getBrowseType() & BROWSE_AGENTS) cmd->flags |= COMMAND_CHECKED; return e->param(); } } if (e->type() == EventCommandExec){ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->param != this) return NULL; QListViewItem *item = m_list->currentItem(); if (cmd->menu_id == MenuBrowser){ cmd->flags &= ~COMMAND_CHECKED; unsigned mode = m_client->getBrowseType(); switch (cmd->id){ case CmdOneLevel: m_client->setAllLevels(false); changeMode(); return e->param(); case CmdAllLevels: m_client->setAllLevels(true); changeMode(); return e->param(); case CmdModeDisco: mode ^= BROWSE_DISCO; m_client->setBrowseType(mode); changeMode(); return e->param(); case CmdModeBrowse: mode ^= BROWSE_BROWSE; m_client->setBrowseType(mode); changeMode(); return e->param(); case CmdModeAgents: mode ^= BROWSE_AGENTS; m_client->setBrowseType(mode); changeMode(); return e->param(); } return NULL; } if (item){ if (cmd->id == CmdBrowseSearch){ if (m_search) delete m_search; m_search = new JabberWizard(this, i18n("%1 Search") .arg(item->text(COL_NAME).utf8()), "find", m_client, item->text(COL_JID).utf8(), item->text(COL_NODE).utf8(), "search"); m_search_id = m_client->get_agent_info(item->text(COL_JID).utf8(), item->text(COL_NODE).utf8(), "search"); return e->param(); } if (cmd->id == CmdRegister){ if (m_reg) delete m_reg; m_reg = new JabberWizard(this, i18n("%1 Register") .arg(item->text(COL_NAME).utf8()), "reg", m_client, item->text(COL_JID).utf8(), item->text(COL_NODE).utf8(), "register"); m_reg_id = m_client->get_agent_info(item->text(COL_JID).utf8(), item->text(COL_NODE).utf8(), "register"); return e->param(); } if (cmd->id == CmdBrowseConfigure){ if (m_config) delete m_config; m_config = new JabberWizard(this, i18n("%1 Configure") .arg(item->text(COL_NAME).utf8()), "configure", m_client, item->text(COL_JID).utf8(), item->text(COL_NODE).utf8(), "data"); m_config_id = m_client->get_agent_info(item->text(COL_JID).utf8(), item->text(COL_NODE).utf8(), "data"); return e->param(); } if (cmd->id == CmdBrowseInfo){ if (m_info == NULL) m_info = new DiscoInfo(this, m_list->currentItem()->text(COL_FEATURES), item->text(COL_NAME), item->text(COL_TYPE), item->text(COL_CATEGORY)); m_info->reset(); raiseWindow(m_info); return e->param(); } } if (cmd->id == CmdBack){ if (m_historyPos){ m_historyPos--; QString url = QString::fromUtf8(m_history[m_historyPos].c_str()); QString node; if (!m_nodes[m_historyPos].empty()) node = QString::fromUtf8(m_nodes[m_historyPos].c_str()); go(url, node); } } if (cmd->id == CmdForward){ if (m_historyPos + 1 < (int)(m_history.size())){ m_historyPos++; QString url = QString::fromUtf8(m_history[m_historyPos].c_str()); QString node; if (!m_nodes[m_historyPos].empty()) node = QString::fromUtf8(m_nodes[m_historyPos].c_str()); go(url, node); } } if (cmd->id == CmdUrl){ if (m_bInProcess){ stop(""); return e->param(); } QString jid; QString node; Command cmd; cmd->id = CmdUrl; cmd->param = this; Event eWidget(EventCommandWidget, cmd); CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process()); if (cmbUrl) jid = cmbUrl->lineEdit()->text(); cmd->id = CmdNode; CToolCombo *cmbNode = (CToolCombo*)(eWidget.process()); if (cmbNode) node = cmbNode->lineEdit()->text(); if (!jid.isEmpty()){ addHistory(jid); goUrl(jid, node); } return e->param(); } } if (e->type() == EventDiscoItem){ if (!m_bInProcess) return NULL; DiscoItem *item = (DiscoItem*)(e->param()); QListViewItem *it = findItem(COL_ID_DISCO_ITEMS, item->id.c_str()); if (it){ if (item->jid.empty()){ it->setText(COL_ID_DISCO_ITEMS, ""); if (it != m_list->firstChild()){ checkDone(); adjustColumn(it); return e->param(); } QString err; if (!item->name.empty()){ err = QString::fromUtf8(item->name.c_str()); }else if (!item->node.empty()){ err = i18n("Error %1") .arg(atol(item->node.c_str())); } if (!err.isEmpty()){ unsigned mode = atol(it->text(COL_MODE).latin1()); if (((mode & BROWSE_BROWSE) == 0) || (it->text(COL_ID_BROWSE).isEmpty() & m_bError)) stop(err); m_bError = true; } checkDone(); adjustColumn(it); return e->param(); } if (it->firstChild() == NULL){ it->setExpandable(true); if ((it == m_list->firstChild()) || (it == m_list->currentItem())) it->setOpen(true); } QListViewItem *i; for (i = it->firstChild(); i; i = i->nextSibling()){ if ((i->text(COL_JID) == QString::fromUtf8(item->jid.c_str())) && (i->text(COL_NODE) == QString::fromUtf8(item->node.c_str()))) return e->param(); } i = new QListViewItem(it); i->setText(COL_JID, QString::fromUtf8(item->jid.c_str())); i->setText(COL_NAME, item->name.empty() ? QString::fromUtf8(item->jid.c_str()) : QString::fromUtf8(item->name.c_str())); i->setText(COL_NODE, QString::fromUtf8(item->node.c_str())); int mode = 0; if (m_client->getBrowseType() & BROWSE_DISCO){ i->setText(COL_ID_DISCO_INFO, m_client->discoInfo(item->jid.c_str(), item->node.c_str()).c_str()); mode |= BROWSE_INFO; } i->setText(COL_MODE, QString::number(mode)); if (m_client->getAllLevels()) loadItem(i); return e->param(); } it = findItem(COL_ID_DISCO_INFO, item->id.c_str()); if (it){ if (item->jid.empty()){ it->setText(COL_ID_DISCO_INFO, ""); checkDone(); adjustColumn(it); return e->param(); } if (it->text(COL_NAME) == it->text(COL_JID)) it->setText(COL_NAME, QString::fromUtf8(item->name.c_str())); it->setText(COL_CATEGORY, QString::fromUtf8(item->category.c_str())); it->setText(COL_TYPE, QString::fromUtf8(item->type.c_str())); it->setText(COL_FEATURES, QString::fromUtf8(item->features.c_str())); if ((m_client->getAllLevels()) || (it == m_list->currentItem())) loadItem(it); setItemPict(it); if (it == m_list->currentItem()) currentChanged(it); return e->param(); } it = findItem(COL_ID_BROWSE, item->id.c_str()); if (it){ if (item->jid.empty()){ it->setText(COL_ID_BROWSE, ""); if (it != m_list->firstChild()){ checkDone(); adjustColumn(it); return e->param(); } QString err; if (!item->name.empty()){ err = QString::fromUtf8(item->name.c_str()); }else if (!item->node.empty()){ err = i18n("Error %1") .arg(atol(item->node.c_str())); } if (!err.isEmpty()){ unsigned mode = atol(it->text(COL_MODE).latin1()); if (((mode & BROWSE_DISCO) == 0) || (it->text(COL_ID_DISCO_ITEMS).isEmpty() & m_bError)) stop(err); m_bError = true; } checkDone(); adjustColumn(it); return e->param(); } if (it->text(COL_JID) != QString::fromUtf8(item->jid.c_str())){ QListViewItem *i; for (i = it->firstChild(); i; i = i->nextSibling()){ if ((i->text(COL_JID) == QString::fromUtf8(item->jid.c_str())) && (i->text(COL_NODE) == QString::fromUtf8(item->node.c_str()))) break; } if (i){ it = i; }else{ if (it->firstChild() == NULL){ it->setExpandable(true); if ((it == m_list->firstChild()) || (it == m_list->currentItem())) it->setOpen(true); } it = new QListViewItem(it); it->setText(COL_JID, QString::fromUtf8(item->jid.c_str())); if (m_client->getAllLevels()) loadItem(it); } } if (it->text(COL_NAME) == it->text(COL_JID)) it->setText(COL_NAME, QString::fromUtf8(item->name.c_str())); it->setText(COL_CATEGORY, QString::fromUtf8(item->category.c_str())); it->setText(COL_TYPE, QString::fromUtf8(item->type.c_str())); it->setText(COL_FEATURES, QString::fromUtf8(item->features.c_str())); if (m_client->getAllLevels() || (it == m_list->currentItem())) loadItem(it); setItemPict(it); return e->param(); } } return NULL; }
void *JabberBrowser::processEvent(Event *e) { if (e->type() == EventCommandExec) { CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->param != this) return NULL; if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdBack) { if (m_historyPos) { QString url = QString::fromUtf8(m_history[--m_historyPos].c_str()); go(url); } } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdForward) { if (m_historyPos + 1 < (int)(m_history.size())) { QString url = QString::fromUtf8(m_history[++m_historyPos].c_str()); go(url); } } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl) { if (!m_id1.empty() || !m_id2.empty()) { stop(""); return e->param(); } Command cmd; cmd->id = static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdUrl; cmd->param = this; Event eWidget(EventCommandWidget, cmd); CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process()); if (cmbUrl) { QString text = cmbUrl->lineEdit()->text(); if (!text.isEmpty()) { addHistory(text); goUrl(text); } } return e->param(); } if (cmd->id == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->CmdInfo) { if (m_category.isEmpty() && m_type.isEmpty() && m_name.isEmpty() && m_features.isEmpty()) return e->param(); if (m_info == NULL) m_info = new DiscoInfo(this); m_info->reset(); raiseWindow(m_info); return e->param(); } } if (e->type() == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->EventDiscoItem) { JabberDiscoItem *item = (JabberDiscoItem*)(e->param()); if (m_id1 == item->id) { if (item->jid.empty()) { m_id1 = ""; m_list->adjustColumn(); QString err; if (!item->name.empty()) { err = QString::fromUtf8(item->name.c_str()); } else if (!item->node.empty()) { err = i18n("Error %1") .arg(atol(item->node.c_str())); } if (err.isEmpty() || m_id2.empty()) stop(err); return e->param(); } QListViewItem *i = new QListViewItem(m_list); i->setText(COL_JID, QString::fromUtf8(item->jid.c_str())); i->setText(COL_NAME, QString::fromUtf8(item->name.c_str())); i->setText(COL_NODE, QString::fromUtf8(item->node.c_str())); return e->param(); } if (m_id2 == item->id) { if (item->jid.empty()) { m_id2 = ""; m_list->adjustColumn(); QString err; if (!item->name.empty()) { err = QString::fromUtf8(item->name.c_str()); } else if (!item->node.empty()) { err = i18n("Error %1") .arg(atol(item->node.c_str())); } if (m_id1.empty()) stop(err); return e->param(); } if (item->jid == "feature") { if (!m_features.isEmpty()) m_features += "\n"; m_features += QString::fromUtf8(item->name.c_str()); } else { m_category = QString::fromUtf8(item->jid.c_str()); m_type = QString::fromUtf8(item->node.c_str()); m_name = QString::fromUtf8(item->name.c_str()); } return e->param(); } } return NULL; }