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


C++ KBookmark类代码示例

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


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

示例1: if

void KonqSidebarBookmarkModule::slotDropped(K3ListView *, QDropEvent *e, Q3ListViewItem *parent, Q3ListViewItem *after)
{
    if (!KBookmark::List::canDecode(e->mimeData()))
        return;

    KBookmark afterBookmark;
    KonqSidebarBookmarkItem *afterItem = dynamic_cast<KonqSidebarBookmarkItem*>(after);
    if (afterItem)
        afterBookmark = afterItem->bookmark();

    KBookmarkGroup parentGroup;
    // try to get the parent group...
    if (after) {
        parentGroup = afterBookmark.parentGroup();
    } else if (parent) {
        if(KonqSidebarBookmarkItem *p = dynamic_cast<KonqSidebarBookmarkItem*>(parent))
        {
            if (!p)
                return;
            KBookmark bm = p->bookmark();
            if (bm.isGroup())
                parentGroup = bm.toGroup();
            else
                return;
        } else if(parent == m_topLevelItem) {
            parentGroup = s_bookmarkManager->root();
        }
    } else {
        // it's most probably the root...
        parentGroup = s_bookmarkManager->root();
    }

    QDomDocument parentDocument;
    const KBookmark::List bookmarks = KBookmark::List::fromMimeData(e->mimeData(), parentDocument);

    // copy
    KBookmark::List::const_iterator it = bookmarks.constBegin();
    for (;it != bookmarks.constEnd(); ++it) {
        // insert new item.
        parentGroup.moveBookmark(*it, afterBookmark);
    }

    s_bookmarkManager->emitChanged( parentGroup );
}
开发者ID:blue-shell,项目名称:folderview,代码行数:44,代码来源:bookmark_module.cpp

示例2: manager

void BookmarkMenu::addOpenFolderInTabs()
{
    KBookmarkGroup group = manager()->findByAddress(parentAddress()).toGroup();

    if (!group.first().isNull())
    {
        KBookmark bookmark = group.first();

        while (bookmark.isGroup() || bookmark.isSeparator())
        {
            bookmark = group.next(bookmark);
        }

        if (!bookmark.isNull())
        {
            parentMenu()->addAction(rApp->bookmarkManager()->owner()->createAction(group, BookmarkOwner::OPEN_FOLDER));
        }
    }
}
开发者ID:Arakmar,项目名称:rekonq,代码行数:19,代码来源:bookmarkstoolbar.cpp

示例3: while

void BookmarkIterator::nextOne()
{
    // kDebug() << "BookmarkIterator::nextOne";

    // Look for an interesting bookmark
    while (!m_bookmarkList.isEmpty()) {
        KBookmark bk = m_bookmarkList.takeFirst();
        if (bk.hasParent() && isApplicable(bk)) {
            m_bk = bk;
            doAction();
            // Async action started, we'll have to come back later
            return;
        }
    }
    if (m_bookmarkList.isEmpty()) {
        holder()->removeIterator(this); // deletes "this"
        return;
    }
}
开发者ID:blue-shell,项目名称:folderview,代码行数:19,代码来源:bookmarkiterator.cpp

示例4: fillBookmarkMenu

void KHelpMain::fillBookmarkMenu(KBookmark *parent, QPopupMenu *menu, int &id)
{
	KBookmark *bm;

	for ( bm = parent->getChildren().first(); bm != NULL;
		bm = parent->getChildren().next() )
	{
		if ( bm->getType() == KBookmark::URL )
		{
			menu->insertItem( bm->getText(), id );
			id++;
		}
		else
		{
			QPopupMenu *subMenu = new QPopupMenu;
			menu->insertItem( bm->getText(), subMenu );
			fillBookmarkMenu( bm, subMenu, id );
		}
	}
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:20,代码来源:mainwidget.cpp

示例5: adjustSelection

void BookmarksSidebarPage::adjustSelection(const KURL& url)
{
    // TODO (remarked in dolphin/TODO): the following code is quite equal
    // to BookmarkSelector::updateSelection().

    KBookmarkGroup root = DolphinSettings::instance().bookmarkManager()->root();
    KBookmark bookmark = root.first();

    int maxLength = 0;
    int selectedIndex = -1;

    // Search the bookmark which is equal to the URL or at least is a parent URL.
    // If there are more than one possible parent URL candidates, choose the bookmark
    // which covers the bigger range of the URL.
    int i = 0;
    while (!bookmark.isNull()) {
        const KURL bookmarkURL = bookmark.url();
        if (bookmarkURL.isParentOf(url)) {
            const int length = bookmarkURL.prettyURL().length();
            if (length > maxLength) {
                selectedIndex = i;
                maxLength = length;
            }
        }
        bookmark = root.next(bookmark);
        ++i;
    }

    const bool block = m_bookmarksList->signalsBlocked();
    m_bookmarksList->blockSignals(true);
    if (selectedIndex < 0) {
        // no bookmark matches, hence deactivate any selection
        const int currentIndex = m_bookmarksList->index(m_bookmarksList->selectedItem());
        m_bookmarksList->setSelected(currentIndex, false);
    }
    else {
        // select the bookmark which is part of the current URL
        m_bookmarksList->setSelected(selectedIndex, true);
    }
    m_bookmarksList->blockSignals(block);
}
开发者ID:serghei,项目名称:kde3-apps-dolphin,代码行数:41,代码来源:bookmarkssidebarpage.cpp

示例6: writeFolder

// write the contents of a folder (recursive)
//
void KBookmarkManager::writeFolder( QTextStream &stream, KBookmark *parent )
{
	KBookmark *bm;

	for ( bm = parent->getChildren().first(); bm != NULL;
			bm = parent->getChildren().next() )
	{
		if ( bm->getType() == KBookmark::URL )
		{
			stream << "<DT><A HREF=\"" << bm->getURL() << "\">"
				<< bm->getText() << "</A>" << endl;
		}
		else
		{
			stream << "<DT><H3>" << bm->getText() << "</H3>" << endl;
			stream << "<DL><P>" << endl;
			writeFolder( stream, bm );
			stream << "</DL><P>" << endl;
		}
	}
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:23,代码来源:bookmark.cpp

示例7: kDebug

void EditCommand::undo()
{
    kDebug() << "Setting old value" << mOldValue << "in bk" << mAddress << "col" << mCol;
    KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
    if(mCol==-2)
    {
        bk.internalElement().setAttribute("toolbar", mOldValue);
    }
    else if(mCol==-1)
    {
        bk.setIcon(mOldValue);
    }
    else if(mCol==0)
    {
        bk.setFullText(mOldValue);
    }
    else if(mCol==1)
    {
        bk.setUrl(KUrl(mOldValue));
    }
    else if(mCol==2)
    {
        bk.setDescription(mOldValue);
    }
    m_model->emitDataChanged(bk);
}
开发者ID:luyikei,项目名称:kde-baseapps,代码行数:26,代码来源:commands.cpp

示例8: tree

void KonqSidebarBookmarkModule::slotProperties(KonqSidebarBookmarkItem *bi)
{
    if (!bi) {
        bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
        if (!bi)
            return;
    }

    KBookmark bookmark = bi->bookmark();

    QString folder = bookmark.isGroup() ? QString::null : bookmark.url().pathOrURL();
    BookmarkEditDialog dlg( bookmark.fullText(), folder, 0, 0,
                            i18n("Bookmark Properties") );
    if ( dlg.exec() != KDialogBase::Accepted )
        return;

    makeTextNodeMod(bookmark, "title", dlg.finalTitle());
    if ( !dlg.finalUrl().isNull() )
    {
        KURL u = KURL::fromPathOrURL(dlg.finalUrl());
        bookmark.internalElement().setAttribute("href", u.url(0, 106));
    }

    KBookmarkGroup parentBookmark = bookmark.parentGroup();
    KonqBookmarkManager::self()->emitChanged( parentBookmark );
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例9: findBookmark

KBookmark* KBookmark::findBookmark( const char *_url )
{
  if ( !strcmp ( url(), _url ))
    return this;

  KBookmark *bm;
  
  for ( bm = children()->first(); bm != NULL; bm = children()->next() )
  {
    if ( !strcmp ( bm->url(), _url ))
      return bm;
    
    if ( bm->type() == Folder )
    {
      KBookmark *b = bm->findBookmark( _url );
      if ( b )
	return b;
    }
  }

  return 0L;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:22,代码来源:bookmark.cpp

示例10: openBookmark

void GPSBookmarkOwner::openBookmark(const KBookmark& bookmark, Qt::MouseButtons, Qt::KeyboardModifiers)
{
    const QString url                         = bookmark.url().url().toLower();
    bool  okay                                = false;
    const GeoIface::GeoCoordinates coordinate = GeoIface::GeoCoordinates::fromGeoUrl(url, &okay);

    if (okay)
    {
        GPSDataContainer position;
        position.setCoordinates(coordinate);
        emit(positionSelected(position));
    }
}
开发者ID:KDE,项目名称:digikam,代码行数:13,代码来源:gpsbookmarkowner.cpp

示例11: bookmark

void BookmarksContextMenu::addFolderActions()
{
    KBookmarkGroup group = bookmark().toGroup();

    if (bookmark().internalElement().attributeNode("toolbar").value() == "yes")
    {
        addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::UNSET_TOOLBAR_FOLDER));
    }
    else
    {
        addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::SET_TOOLBAR_FOLDER));
    }

    if (!group.first().isNull())
    {
        KBookmark child = group.first();

        while (child.isGroup() || child.isSeparator())
        {
            child = group.next(child);
        }

        if (!child.isNull())
        {
            addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_FOLDER));
            addSeparator();
        }
    }

    addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
    addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER));
    addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR));

    addSeparator();

    addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::EDIT));
    addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE));
}
开发者ID:KDE,项目名称:rekonq,代码行数:38,代码来源:bookmarkscontextmenu.cpp

示例12: echo

void BookmarksProtocol::echoFolder( const KBookmarkGroup &folder )
{
  if (sizeOfGroup(folder.toGroup(), true) > 1)
  {
    QString descriptionAsTitle = folder.description();
    if (!descriptionAsTitle.isEmpty())
      descriptionAsTitle.prepend(QLatin1String("\" title=\""));

    if (folder.parentGroup() == tree)
    {
      if (config.readEntry("ShowBackgrounds", true))
        echo("<ul style=\"background-image: url(/background/" + folder.icon() + ")\">");
      else
        echo("<ul>");

      echo ("<li class=\"title" + descriptionAsTitle + "\">" + folder.fullText() + "</li>");
    }
    else
    {
      echo("<ul>");
      echo ("<li class=\"title" + descriptionAsTitle + "\"><img src=\"/icon/" + folder.icon() + "\"/>" + folder.text() + "</li>");
    }
    indent++;

    for (KBookmark bm = folder.first(); !bm.isNull(); bm = folder.next(bm))
    {
      if (bm.isGroup())
        echoFolder(bm.toGroup());
      else if (bm.isSeparator())
        echoSeparator();
      else
        echoBookmark(bm);
    }

    indent--;
    echo("</ul>");
  }
}
开发者ID:KDE,项目名称:kio-extras,代码行数:38,代码来源:kio_bookmarks_html.cpp

示例13: KonqSidebarBookmarkItem

void KonqSidebarBookmarkModule::fillGroup( KonqSidebarTreeItem * parentItem, KBookmarkGroup group )
{
    int n = 0;
    for ( KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk), ++n )
    {
            KonqSidebarBookmarkItem * item = new KonqSidebarBookmarkItem( parentItem, m_topLevelItem, bk, n );
            if ( bk.isGroup() )
            {
                KBookmarkGroup grp = bk.toGroup();
                fillGroup( item, grp );

                QString address(grp.address());
                if (m_folderOpenState.contains(address))
                    item->setOpen(m_folderOpenState[address]);
                else
                    item->setOpen(false);
            }
            else if ( bk.isSeparator() )
                item->setVisible( false );
            else
                item->setExpandable( false );
    }
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例14: applySettings

void BookmarksSettingsPage::applySettings()
{
    // delete all bookmarks
    KBookmarkManager* manager = DolphinSettings::instance().bookmarkManager();
    KBookmarkGroup root = manager->root();
    KBookmark bookmark = root.first();
    while (!bookmark.isNull()) {
        root.deleteBookmark(bookmark);
        bookmark = root.first();
    }

    // add all items as bookmarks
    QListViewItem* item = m_listView->firstChild();
    while (item != 0) {
        root.addBookmark(manager,
                         item->text(NameIdx),
                         KURL(item->text(URLIdx)),
                         item->text(IconIdx)); // hidden column
        item = item->itemBelow();
    }

    manager->emitChanged(root);
}
开发者ID:serghei,项目名称:kde3-apps-dolphin,代码行数:23,代码来源:bookmarkssettingspage.cpp

示例15: panelTreeView

void BookmarksPanel::loadFoldedState(const QModelIndex &root)
{
    QAbstractItemModel *model = panelTreeView()->model();
    if (!model)
        return;

    int count = model->rowCount(root);
    QModelIndex index;

    for (int i = 0; i < count; ++i)
    {
        index = model->index(i, 0, root);
        if (index.isValid())
        {
            KBookmark bm = bookmarkForIndex(index);
            if (bm.isGroup())
            {
                panelTreeView()->setExpanded(index, bm.toGroup().isOpen());
                loadFoldedState(index);
            }
        }
    }
}
开发者ID:KDE,项目名称:rekonq,代码行数:23,代码来源:bookmarkspanel.cpp


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