void JabberBrowser::addHistory(const QString &str) { QStringList l; QString h = m_client->getBrowserHistory(); while (h.length()){ l.append(getToken(h, ';')); } QStringList::Iterator it; for (it = l.begin(); it != l.end(); ++it){ if (*it == str){ l.remove(it); break; } } l.prepend(str); QString res; 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) cmbUrl->clear(); unsigned i = 0; for (it = l.begin(); it != l.end(); ++it){ if (i++ > MAX_HISTORY) break; if (!res.isEmpty()) res += ";"; cmbUrl->insertItem(*it); res += quoteChars(*it, ";"); } m_client->setBrowserHistory(res); }
JabberBrowser::JabberBrowser(JabberClient *client) : QMainWindow(NULL, NULL, WDestructiveClose) { m_client = client; m_info = NULL; SET_WNDPROC("jbrowser") setIcon(Pict("Jabber_online")); setTitle(); m_status = statusBar(); m_list = new ListView(this); m_list->addColumn(i18n("Name")); m_list->addColumn(i18n("JID")); m_list->addColumn(i18n("Node")); m_list->setExpandingColumn(0); m_list->setMenu(0); connect(m_list, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(currentChanged(QListViewItem*))); connect(m_list, SIGNAL(dragStart()), this, SLOT(dragStart())); BarShow b; b.bar_id = BarBrowser; b.parent = this; Event e(EventShowBar, &b); m_bar = (CToolBar*)e.process(); m_bar->setParam(this); restoreToolbar(m_bar, m_client->data.browser_bar); m_bar->show(); setCentralWidget(m_list); m_historyPos = -1; Command cmd; cmd->id = CmdUrl; cmd->param = this; Event eWidget(EventCommandWidget, cmd); CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process()); if (cmbUrl){ QString h = m_client->getBrowserHistory(); while (h.length()) cmbUrl->insertItem(getToken(h, ';')); cmbUrl->setText(QString::null); } m_search = NULL; m_reg = NULL; m_config = NULL; m_bInProcess = false; }
JabberBrowser::JabberBrowser() { m_client = NULL; m_info = NULL; m_list = new ListView(this); m_list->addColumn(i18n("Name")); m_list->addColumn(i18n("JID")); m_list->addColumn(i18n("Node")); m_list->setExpandingColumn(0); m_list->setMenu(0); connect(m_list, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(currentChanged(QListViewItem*))); connect(m_list, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(m_list, SIGNAL(dragStart()), this, SLOT(dragStart())); BarShow b; b.bar_id = BarBrowser; b.parent = this; Event e(EventShowBar, &b); m_bar = (CToolBar*)e.process(); m_bar->setParam(this); restoreToolbar(m_bar, JabberPlugin::plugin->data.browser_bar); m_bar->show(); resize(qApp->desktop()->width(), qApp->desktop()->height()); setCentralWidget(m_list); m_historyPos = -1; Command cmd; cmd->id = CmdUrl; cmd->param = this; Event eWidget(EventCommandWidget, cmd); CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process()); if (cmbUrl){ QString h = JabberPlugin::plugin->getBrowserHistory(); while (h.length()) cmbUrl->insertItem(getToken(h, ';')); cmbUrl->setText(QString::null); } m_reg = NULL; m_config = NULL; m_search = NULL; m_bInProcess = false; m_list->setMenu(MenuSearchItem); }
HistoryWindow::HistoryWindow(unsigned long id) { m_history_page_count=CorePlugin::m_plugin->getHistoryPage(); setWFlags(WDestructiveClose); m_id = id; SET_WNDPROC("history") setIcon(Pict("history")); setName(); m_view = new MsgViewBase(this, NULL, id); setCentralWidget(m_view); BarShow b; b.bar_id = BarHistory; b.parent = this; Event e(EventShowBar, &b); m_bar = (CToolBar*)e.process(); m_bar->setParam((void*)m_id); restoreToolbar(m_bar, CorePlugin::m_plugin->data.historyBar); connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*))); m_status = statusBar(); m_progress = NULL; m_page = 0; Command cmd; cmd->id = CmdHistoryFind; cmd->param = (void*)m_id; Event eWidget(EventCommandWidget, cmd); CToolCombo *cmbFind = (CToolCombo*)(eWidget.process()); if (cmbFind){ QString history = CorePlugin::m_plugin->getHistorySearch(); while (history.length()){ cmbFind->insertItem(getToken(history, ';')); } cmbFind->setText(QString::null); } m_it = NULL; m_bDirection = CorePlugin::m_plugin->getHistoryDirection(); m_bar->checkState(); m_bar->show(); fill(); }