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


C++ BookmarkItem类代码示例

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


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

示例1: Q_ASSERT

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

示例2: stream

bool
BookmarkModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
    int row, int column, const QModelIndex &parent)
{
    if (action == Qt::IgnoreAction)
        return true;

    if (!data->hasFormat(MIMETYPE) || column > 0)
        return false;

    QByteArray ba = data->data(MIMETYPE);
    QDataStream stream(&ba, QIODevice::ReadOnly);
    while (stream.atEnd())
        return false;

    qint32 depth;
    bool expanded;
    QString name, url;
    while (!stream.atEnd()) {
        stream >> depth >> name >> url >> expanded;
        if (insertRow(qMax(0, row), parent)) {
            const QModelIndex &current = index(qMax(0, row), 0, parent);
            if (current.isValid()) {
                BookmarkItem* item = itemFromIndex(current);
                item->setData(DataVector() << name << url << expanded);
            }
        }
    }
    return true;
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:30,代码来源:bookmarkmodel.cpp

示例3: removeBookmarkMessageButtonPressed

void WebBrowser::removeBookmarkMessageButtonPressed(const Plasma::MessageButton button)
{  
    if (button == Plasma::ButtonNo){
        return;
    }
    
    const QModelIndexList list = m_bookmarkModel->match(m_bookmarkModel->index(0,0), BookmarkItem::UrlRole, m_url.prettyUrl());

    if (!list.isEmpty()) {
        const QModelIndex &index = list.first();
        BookmarkItem *item = dynamic_cast<BookmarkItem *>(m_bookmarkModel->itemFromIndex(index));
        
        if (item) {
            KBookmark bookmark = item->bookmark();
            
            bookmark.parentGroup().deleteBookmark(bookmark);
            m_bookmarkManager->save();
        }
        
        if (item && item->parent()) {
            item->parent()->removeRow(index.row());
        } else {
            m_bookmarkModel->removeRow(index.row());
        }
    }
    
    m_addBookmark->setAction(m_addBookmarkAction);
}
开发者ID:mleduque,项目名称:kwin-tiling,代码行数:28,代码来源:webbrowser.cpp

示例4: if

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

示例5: text

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

示例6: editBookmark

void MainWindow::editBookmark()
{
    // search the model for the closest bookmark
    BookmarkItem * bookmarkItem = 0;
    QModelIndex bookmarkIndex = currentTreeItem;
    do
    {

        bookmarkItem = 0; // qobject_cast<BookmarkItem *>(static_cast<TreeItem *>(bookmarkIndex.internalPointer()));

        if (bookmarkItem)
            break; // we found one!

        // up one level
        bookmarkIndex = bookmarkIndex.parent();
    } while (bookmarkIndex.isValid());

    // we found no bookmark!
    if (!bookmarkItem)
        return;

    EditBookmarkDialog dlg(this);
    dlg.setDir(bookmarkItem->name());
    dlg.setAlias(bookmarkItem->alias());

    if (dlg.exec())
        model.updateBookmark(bookmarkIndex, dlg.dir(), dlg.alias());
}
开发者ID:XelaRellum,项目名称:RapidGIT,代码行数:28,代码来源:MainWindow.cpp

示例7: addBookmark

void BookmarkEditDlg::OnItemModify(void) 
{
    if (mListCtrl.GetSelectedCount() > 0)
    {
        xpr_sint_t sIndex = mListCtrl.GetSelectionMark();
        BookmarkItem *sBookmarkItem = (BookmarkItem *)mListCtrl.GetItemData(sIndex);

        BookmarkItemEditDlg sDlg;
        sDlg.add(sBookmarkItem);
        if (sDlg.DoModal() == IDOK)
        {
            if (sDlg.mBookmark.mPath.empty() == XPR_FALSE)
            {
                sDlg.copyBookmark(sBookmarkItem);

                sBookmarkItem->newSignature();
                sBookmarkItem->destroyIcon();

                mListCtrl.SetItemData(sIndex, XPR_NULL);
                mListCtrl.DeleteItem(sIndex);
                addBookmark(sBookmarkItem, IconReqShellIcon, sIndex);

                setItemFocus(sIndex);
            }
        }
    }

    updateStatus();
}
开发者ID:3rdexp,项目名称:fxfile,代码行数:29,代码来源:bookmark_edit_dlg.cpp

示例8: GetCursorPos

xpr_bool_t BookmarkToolBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
    NMHDR *pnmhdr = (NMHDR *)lParam;

    if (pnmhdr->code == TTN_GETDISPINFO)
    {
        if (gOpt->mConfig.mBookmarkTooltip == XPR_TRUE)
        {
            LPNMTTDISPINFO sNmTtDispInfo = (LPNMTTDISPINFO)pnmhdr;

            CPoint sPoint;
            GetCursorPos(&sPoint);
            ScreenToClient(&sPoint);

            xpr_sint_t sIndex = GetToolBarCtrl().HitTest(&sPoint);

            BookmarkItem *sBookmarkItem = BookmarkMgr::instance().getBookmark(sIndex);
            if (sBookmarkItem == XPR_NULL)
                return XPR_FALSE;

            sBookmarkItem->getTooltip(mToolTipText, !gOpt->mMain.mBookmarkBarText, XPR_TRUE);

            sNmTtDispInfo->lpszText = mToolTipText;
        }
    }

    return super::OnNotify(wParam, lParam, pResult);
}
开发者ID:fxfile,项目名称:fxfile,代码行数:28,代码来源:bookmark_toolbar.cpp

示例9: Q_ASSERT

void ChromeImporter::readBookmarks(const QVariantList &list, BookmarkItem* parent)
{
    Q_ASSERT(parent);

    foreach (const QVariant &entry, list) {
        const QVariantMap map = entry.toMap();
        const QString typeString = map.value("type").toString();
        BookmarkItem::Type type;

        if (typeString == QLatin1String("url")) {
            type = BookmarkItem::Url;
        }
        else if (typeString == QLatin1String("folder")) {
            type = BookmarkItem::Folder;
        }
        else {
            continue;
        }

        BookmarkItem* item = new BookmarkItem(type, parent);
        item->setTitle(map.value("name").toString());

        if (item->isUrl()) {
            item->setUrl(QUrl::fromEncoded(map.value("url").toByteArray()));
        }

        if (map.contains("children")) {
            readBookmarks(map.value("children").toList(), item);
        }
    }
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:31,代码来源:chromeimporter.cpp

示例10: BookmarkItem

void BookmarksManager::addBookmark()
{
    BookmarkItem* item = new BookmarkItem(BookmarkItem::Url);
    item->setTitle(tr("New Bookmark"));
    item->setUrl(QUrl("http://"));
    addBookmark(item);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例11: slotExecuted

void BookmarkList::slotExecuted( QTreeWidgetItem * item )
{
    BookmarkItem* bmItem = dynamic_cast<BookmarkItem*>( item );
    if ( !bmItem || !bmItem->viewport().isValid() )
        return;

    goTo( bmItem );
}
开发者ID:Axure,项目名称:okular,代码行数:8,代码来源:bookmarklist.cpp

示例12: item

int BookmarksModel::rowCount(const QModelIndex &parent) const
{
    if (parent.column() > 0) {
        return 0;
    }

    BookmarkItem* itm = item(parent);
    return itm->children().count();
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:9,代码来源:bookmarksmodel.cpp

示例13: Q_ASSERT

void BookmarksManager::bookmarkEdited()
{
    Q_ASSERT(ui->tree->selectedBookmarks().count() == 1);

    BookmarkItem* item = ui->tree->selectedBookmarks().first();
    item->setTitle(ui->title->text());
    item->setUrl(QUrl::fromEncoded(ui->address->text().toUtf8()));
    item->setKeyword(ui->keyword->text());
    item->setDescription(ui->description->toPlainText());

    m_bookmarks->changeBookmark(item);
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例14: startDrag

void BookmarksListBox::startDrag()
{
    int currentItem = QListBox::currentItem();
    if (currentItem != -1) {
        BookmarkItem* bookmark = (BookmarkItem*)item(currentItem);
	if (bookmark!=0){
            KURL::List lst;
            lst.append( bookmark->url() );
            KURLDrag *drag = new KURLDrag(lst, this);
            drag->drag();
        }
    }
}
开发者ID:serghei,项目名称:kde3-apps-dolphin,代码行数:13,代码来源:bookmarkssidebarpage.cpp

示例15: BookmarkItem

BookmarkItem* IeImporter::importBookmarks()
{
    BookmarkItem* root = new BookmarkItem(BookmarkItem::Folder);
    root->setTitle("Internet Explorer Import");

    foreach (QFileInfo file, urls) {
        QSettings urlFile(file.absoluteFilePath(), QSettings::IniFormat, this);

        QUrl url = urlFile.value("InternetShortcut/URL").toUrl();

        BookmarkItem* b = new BookmarkItem(BookmarkItem::Url, root);
        b->setTitle(file.baseName());
        b->setUrl(url);
    }
开发者ID:AwkwardDev,项目名称:qupzilla,代码行数:14,代码来源:ieimporter.cpp


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