当前位置: 首页>>代码示例>>C++>>正文


C++ BookmarkItem::updateVisitCount方法代码示例

本文整理汇总了C++中BookmarkItem::updateVisitCount方法的典型用法代码示例。如果您正苦于以下问题:C++ BookmarkItem::updateVisitCount方法的具体用法?C++ BookmarkItem::updateVisitCount怎么用?C++ BookmarkItem::updateVisitCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BookmarkItem的用法示例。


在下文中一共展示了BookmarkItem::updateVisitCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createLoadRequest

LoadRequest LocationCompleter::createLoadRequest(const QModelIndex &index)
{
    LoadRequest request;
    BookmarkItem *bookmark = nullptr;

    if (index.data(LocationCompleterModel::HistoryRole).toBool()) {
        request = index.data(LocationCompleterModel::UrlRole).toUrl();
    } else if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
    } else if (index.data(LocationCompleterModel::SearchSuggestionRole).toBool()) {
        const QString text = index.data(LocationCompleterModel::TitleRole).toString();
        request = mApp->searchEnginesManager()->searchResult(LocationBar::searchEngine(), text);
    } else if (index.data(LocationCompleterModel::VisitSearchItemRole).toBool()) {
        const auto action = LocationBar::loadAction(m_originalText);
        switch (action.type) {
        case LocationBar::LoadAction::Url:
        case LocationBar::LoadAction::Search:
            request = action.loadRequest;
            break;
        case LocationBar::LoadAction::Bookmark:
            bookmark = action.bookmark;
            break;
        default:
            break;
        }
    }

    if (bookmark) {
        bookmark->updateVisitCount();
        request = bookmark->url();
    }

    return request;
}
开发者ID:Martii,项目名称:qupzilla,代码行数:34,代码来源:locationcompleter.cpp

示例2: createLoadRequest

LoadRequest LocationBar::createLoadRequest() const
{
    LoadRequest req;

    // Check for Search Engine shortcut
    int firstSpacePos = text().indexOf(QLatin1Char(' '));
    if (firstSpacePos != -1) {
        const QString shortcut = text().left(firstSpacePos);
        const QString searchedString = text().mid(firstSpacePos).trimmed();

        SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
        if (!en.name.isEmpty()) {
            req = mApp->searchEnginesManager()->searchResult(en, searchedString);
        }
    }

    // Check for Bookmark keyword
    QList<BookmarkItem*> items = mApp->bookmarks()->searchKeyword(text());
    if (!items.isEmpty()) {
        BookmarkItem* item = items.first();
        item->updateVisitCount();
        req.setUrl(item->url());
    }

    if (req.isEmpty()) {
        const QUrl guessedUrl = WebView::guessUrlFromString(text());
        if (!guessedUrl.isEmpty())
            req.setUrl(guessedUrl);
        else
            req.setUrl(QUrl::fromEncoded(text().toUtf8()));
    }

    return req;
}
开发者ID:rmohammadhakimzakaria,项目名称:qupzilla,代码行数:34,代码来源:locationbar.cpp

示例3: indexShiftActivated

void LocationCompleter::indexShiftActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();

    // Load url (instead of switching to tab) with shift activation
    if (tabPos > -1) {
        loadUrl(url);
        return;
    }

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    // Open new window
    mApp->createWindow(Qz::BW_NewWindow, url);
}
开发者ID:593in,项目名称:qupzilla,代码行数:26,代码来源:locationcompleter.cpp

示例4: createLoadRequest

LoadRequest LocationBar::createLoadRequest() const
{
    LoadRequest req;

    const QString &t = text().trimmed();

    // Check for Search Engine shortcut
    int firstSpacePos = t.indexOf(QLatin1Char(' '));
    if (firstSpacePos != -1) {
        const QString shortcut = t.left(firstSpacePos);
        const QString searchedString = t.mid(firstSpacePos).trimmed();

        SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
        if (!en.name.isEmpty()) {
            req = mApp->searchEnginesManager()->searchResult(en, searchedString);
        }
    }

    // Check for Bookmark keyword
    QList<BookmarkItem*> items = mApp->bookmarks()->searchKeyword(t);
    if (!items.isEmpty()) {
        BookmarkItem* item = items.at(0);
        item->updateVisitCount();
        req.setUrl(item->url());
    }

    if (req.isEmpty()) {
        // One word needs special handling, because QUrl::fromUserInput
        // would convert it to QUrl("http://WORD")
        if (!t.contains(QL1C(' ')) && !t.contains(QL1C('.'))) {
            req.setUrl(QUrl(t));
        }
        else {
            const QUrl &guessed = QUrl::fromUserInput(t);
            if (!guessed.isEmpty())
                req.setUrl(guessed);
            else
                req.setUrl(QUrl::fromEncoded(t.toUtf8()));
        }
    }

    return req;
}
开发者ID:kkofler,项目名称:qupzilla,代码行数:43,代码来源:locationbar.cpp

示例5: indexCtrlActivated

void LocationCompleter::indexCtrlActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());
    Q_ASSERT(m_window);

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const QString title = index.data(LocationCompleterModel::TitleRole).toString();

    closePopup();

    // Clear locationbar
    emit clearCompletion();

    // Open url in new tab
    m_window->tabWidget()->addView(url, title, Qz::NT_CleanSelectedTab);
}
开发者ID:593in,项目名称:qupzilla,代码行数:21,代码来源:locationcompleter.cpp

示例6: indexActivated

void LocationCompleter::indexActivated(const QModelIndex &index)
{
    Q_ASSERT(index.isValid());

    const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
    const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();

    // Switch to tab with simple index activation
    if (tabPos > -1) {
        BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
        Q_ASSERT(window);
        switchToTab(window, tabPos);
        return;
    }

    if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
        BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
        bookmark->updateVisitCount();
    }

    loadUrl(url);
}
开发者ID:593in,项目名称:qupzilla,代码行数:22,代码来源:locationcompleter.cpp


注:本文中的BookmarkItem::updateVisitCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。