Exemplo n.º 1
0
ProcessResult MucBookmarks::blockArrived( JabberDataBlockRef block, const ResourceContextRef rc ) {
    std::string &type=block->getAttribute("type");
    if (type=="error") {
        return LAST_BLOCK_PROCESSED;
    }

    bookmarksAvailable=true;
    if (type=="result") {
        JabberDataBlockRef pvt=block->findChildNamespace("query","jabber:iq:private");
        if (!pvt) return LAST_BLOCK_PROCESSED;
        JabberDataBlockRef storage=pvt->findChildNamespace("storage","storage:bookmarks");

        JabberDataBlockRefList::iterator i=storage->getChilds()->begin();
        while (i!=storage->getChilds()->end()) {
            JabberDataBlockRef item=*(i++);
            const std::string &tagName=item->getTagName();

            MucBookmarkItem::ref b=addNewBookmark();
            b->name=item->getAttribute("name");

            if (tagName=="url") {
                b->url=item->getAttribute("url");
                if (b->name.empty()) b->name=b->url;
            }

            if (tagName=="conference") {
                b->jid=item->getAttribute("jid");
                b->nick=item->getChildText("nick");
                b->password=item->getChildText("password");
                const std::string &autoJoin=item->getAttribute("autojoin");
                b->autoJoin=(autoJoin=="1" || autoJoin=="true"); 
            }
        }
        std::stable_sort(bookmarks.begin(), bookmarks.end(), MucBookmarkItem::compare);
    }
    Log::getInstance()->msg("Bookmarks received successfully", Log::info);
    return LAST_BLOCK_PROCESSED;
}
Exemplo n.º 2
0
void MainWindow::createConnections()
{

    connect(view, SIGNAL(loadProgress(int)), progressBar, SLOT(setValue(int)));
    connect(view, SIGNAL(titleChanged(QString)), SLOT(setBrowserTitle()));
    connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int)));
    connect(view, SIGNAL(loadFinished(bool)), SLOT(finishedLoading(bool)));
    connect(locationEdit, SIGNAL(returnPressed()), SLOT(changePage()));
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
    connect(pageHistoryMenu, SIGNAL(aboutToShow()), SLOT(setWebHistory()));
    connect(pageTimer, SIGNAL(timeout()), SLOT(networkTimeOut()));
    connect(hostInfoAction, SIGNAL(triggered()), this, SLOT(showHostInfo()));
    connect(showHistoryAction, SIGNAL(triggered()), this,
            SLOT(showWebHistory()));
    connect(clearHistoryAction, SIGNAL(triggered()), this,
            SLOT(clearWebHistory()));
    /*
    connect(view->pageAction(QWebPage::Back), SIGNAL(triggered()), this,
            SLOT(getBackPageUrl()));
    connect(view->pageAction(QWebPage::Forward), SIGNAL(triggered()), this,
            SLOT(getForwardPageUrl()));
    */
    connect(addNewBookmarkAction, SIGNAL(triggered()), SLOT(addNewBookmark()));
}