本文整理汇总了C++中KBookmark::toGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ KBookmark::toGroup方法的具体用法?C++ KBookmark::toGroup怎么用?C++ KBookmark::toGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KBookmark
的用法示例。
在下文中一共展示了KBookmark::toGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotRecursiveSort
void ActionsImpl::slotRecursiveSort() {
KEBApp::self()->bkInfo()->commitChanges();
KBookmark bk = KEBApp::self()->firstSelected();
Q_ASSERT(bk.isGroup());
KEBMacroCommand *mcmd = new KEBMacroCommand(i18nc("(qtundo-format)", "Recursive Sort"));
KBookmarkGroupList lister(GlobalBookmarkManager::self()->mgr());
QList<KBookmark> bookmarks = lister.getList(bk.toGroup());
bookmarks << bk.toGroup();
for (QList<KBookmark>::ConstIterator it = bookmarks.constBegin(); it != bookmarks.constEnd(); ++it) {
new SortCommand(m_model, "", (*it).address(), mcmd);
}
commandHistory()->addCommand(mcmd);
}
示例2: slotOpenTab
void KonqSidebarBookmarkModule::slotOpenTab()
{
KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
KBookmark bookmark;
if (bi)
{
bookmark = bi->bookmark();
}
else if(tree()->selectedItem() == m_topLevelItem)
bookmark = KonqBookmarkManager::self()->root();
else
return;
DCOPRef ref(kapp->dcopClient()->appId(), tree()->topLevelWidget()->name());
if (bookmark.isGroup()) {
KBookmarkGroup group = bookmark.toGroup();
bookmark = group.first();
while (!bookmark.isNull()) {
if (!bookmark.isGroup() && !bookmark.isSeparator())
ref.call( "newTab(QString)", bookmark.url().url() );
bookmark = group.next(bookmark);
}
} else {
ref.call( "newTab(QString)", bookmark.url().url() );
}
}
示例3: slotOpenTab
void KonqSidebarBookmarkModule::slotOpenTab()
{
KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
KBookmark bookmark;
if (bi)
{
bookmark = bi->bookmark();
}
else if(tree()->selectedItem() == m_topLevelItem)
bookmark = s_bookmarkManager->root();
else
return;
KParts::OpenUrlArguments args;
args.setActionRequestedByUser(true);
KParts::BrowserArguments browserArguments;
browserArguments.setNewTab(true);
if (bookmark.isGroup()) {
KBookmarkGroup group = bookmark.toGroup();
bookmark = group.first();
while (!bookmark.isNull()) {
if (!bookmark.isGroup() && !bookmark.isSeparator()) {
emit tree()->createNewWindow(bookmark.url(),
args,
browserArguments);
}
bookmark = group.next(bookmark);
}
} else {
emit tree()->createNewWindow(bookmark.url(),
args,
browserArguments);
}
}
示例4: bookmarkMatch
QList< BookmarkMatch > KDEBrowser::match(const QString& term, bool addEverything)
{
KBookmarkGroup bookmarkGroup = m_bookmarkManager->root();
QList< BookmarkMatch > matches;
QStack<KBookmarkGroup> groups;
KBookmark bookmark = bookmarkGroup.first();
while (!bookmark.isNull()) {
// if (!context.isValid()) {
// return;
// } TODO: restore?
if (bookmark.isSeparator()) {
bookmark = bookmarkGroup.next(bookmark);
continue;
}
if (bookmark.isGroup()) { // descend
//kDebug (kdbg_code) << "descending into" << bookmark.text();
groups.push(bookmarkGroup);
bookmarkGroup = bookmark.toGroup();
bookmark = bookmarkGroup.first();
while (bookmark.isNull() && !groups.isEmpty()) {
// if (!context.isValid()) {
// return;
// } TODO: restore?
bookmark = bookmarkGroup;
bookmarkGroup = groups.pop();
bookmark = bookmarkGroup.next(bookmark);
}
continue;
}
BookmarkMatch bookmarkMatch(m_favicon, term, bookmark.text(), bookmark.url().url() );
bookmarkMatch.addTo(matches, addEverything);
bookmark = bookmarkGroup.next(bookmark);
while (bookmark.isNull() && !groups.isEmpty()) {
// if (!context.isValid()) {
// return;
// } // TODO: restore?
bookmark = bookmarkGroup;
bookmarkGroup = groups.pop();
//kDebug(kdbg_code) << "ascending from" << bookmark.text() << "to" << bookmarkGroup.text();
bookmark = bookmarkGroup.next(bookmark);
}
}
return matches;
}
示例5: echoIndex
void BookmarksProtocol::echoIndex()
{
parseTree();
echoHead();
KBookmark bm = tree.first();
if(bm.isNull()) {
echo("<p class=\"message\">" + i18n("There are no bookmarks to display yet.") + "</p>");
}
else {
for (int i = 1; i <= columns; i++)
{
int size = 0;
echo("<div class=\"column\">");
indent++;
while(!bm.isNull() && (size + sizeOfGroup(bm.toGroup())*2/3 < (totalsize / columns) || size == 0))
{
echoFolder(bm.toGroup());
size += sizeOfGroup(bm.toGroup());
bm = tree.next(bm);
}
if (i == columns)
{
while(!bm.isNull())
{
echoFolder(bm.toGroup());
bm = tree.next(bm);
}
}
indent--;
echo("</div>");
}
}
indent--;
echo("</body>");
echo("</html>");
}
示例6: fillGroup
void KBookmarkDialogPrivate::fillGroup(QTreeWidgetItem *parentItem, const KBookmarkGroup &group, const KBookmarkGroup &selectGroup)
{
for (KBookmark bk = group.first(); !bk.isNull(); bk = group.next(bk)) {
if (bk.isGroup()) {
const KBookmarkGroup bkGroup = bk.toGroup();
QTreeWidgetItem* item = new KBookmarkTreeItem(parentItem, folderTree, bkGroup);
if (selectGroup == bkGroup) {
folderTree->setCurrentItem(item);
}
fillGroup(item, bkGroup, selectGroup);
}
}
}
示例7: slotCommandExecuted
void CmdHistory::slotCommandExecuted(KCommand *k) {
KEBApp::self()->notifyCommandExecuted();
IKEBCommand * cmd = dynamic_cast<IKEBCommand *>(k);
Q_ASSERT(cmd);
KBookmark bk = CurrentMgr::bookmarkAt(cmd->affectedBookmarks());
Q_ASSERT(bk.isGroup());
CurrentMgr::self()->notifyManagers(bk.toGroup());
// sets currentItem to something sensible
// if the currentItem was invalidated by executing
// CreateCommand or DeleteManyCommand
// otherwise does nothing
// sensible is either a already selected item or cmd->currentAddress()
ListView::self()->fixUpCurrent( cmd->currentAddress() );
}
示例8: slotDropped
void KonqSidebarBookmarkModule::slotDropped(KListView *, QDropEvent *e, QListViewItem *parent, QListViewItem *after)
{
if (!KBookmarkDrag::canDecode(e))
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 = KonqBookmarkManager::self()->root();
}
} else {
// it's most probably the root...
parentGroup = KonqBookmarkManager::self()->root();
}
QValueList<KBookmark> bookmarks = KBookmarkDrag::decode(e);
// copy
QValueList<KBookmark>::iterator it = bookmarks.begin();
for (;it != bookmarks.end(); ++it) {
// insert new item.
parentGroup.moveItem(*it, afterBookmark);
}
KonqBookmarkManager::self()->emitChanged( parentGroup );
}
示例9: slotDropped
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 );
}
示例10: redo
void DeleteCommand::redo()
{
KBookmark bk = m_model->bookmarkManager()->findByAddress(m_from);
Q_ASSERT(!bk.isNull());
if (m_contentOnly) {
QDomElement groupRoot = bk.internalElement();
QDomNode n = groupRoot.firstChild();
while (!n.isNull()) {
QDomElement e = n.toElement();
if (!e.isNull()) {
// kDebug() << e.tagName();
}
QDomNode next = n.nextSibling();
groupRoot.removeChild(n);
n = next;
}
return;
}
// TODO - bug - unparsed xml is lost after undo,
// we must store it all therefore
//FIXME this removes the comments, that's bad!
if (!m_cmd) {
if (bk.isGroup()) {
m_cmd = new CreateCommand(m_model,
m_from, bk.fullText(), bk.icon(),
bk.internalElement().attribute("folded") == "no");
m_subCmd = deleteAll(m_model, bk.toGroup());
m_subCmd->redo();
} else {
m_cmd = (bk.isSeparator())
? new CreateCommand(m_model, m_from)
: new CreateCommand(m_model, m_from, bk.fullText(),
bk.icon(), bk.url());
}
}
m_cmd->undo();
}
示例11: fillBookmarkBar
void KBookmarkBar::fillBookmarkBar(const KBookmarkGroup & parent)
{
if (parent.isNull())
return;
for (KBookmark bm = parent.first(); !bm.isNull(); bm = parent.next(bm))
{
// Filtered special cases
if(d->m_filteredToolbar)
{
if(bm.isGroup() && !bm.showInToolbar() )
fillBookmarkBar(bm.toGroup());
if(!bm.showInToolbar())
continue;
}
if (!bm.isGroup())
{
if ( bm.isSeparator() )
m_toolBar->addSeparator();
else
{
KAction *action = new KBookmarkAction( bm, m_pOwner, 0 );
m_toolBar->addAction(action);
d->m_actions.append( action );
}
}
else
{
KBookmarkActionMenu *action = new KBookmarkActionMenu(bm, 0);
action->setDelayed( false );
m_toolBar->addAction(action);
d->m_actions.append( action );
KBookmarkMenu *menu = new KonqBookmarkMenu(m_pManager, m_pOwner, action, bm.address());
m_lstSubMenus.append( menu );
}
}
}
示例12: echoFolder
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>");
}
}
示例13: fillGroup
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 );
}
}
示例14: loadFoldedState
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);
}
}
}
}
示例15: fillGroup
void WebBrowser::fillGroup(BookmarkItem *parentItem, const KBookmarkGroup &group)
{
KBookmark it = group.first();
while (!it.isNull()) {
BookmarkItem *bookmarkItem = new BookmarkItem(it);
bookmarkItem->setEditable(false);
if (it.isGroup()) {
KBookmarkGroup grp = it.toGroup();
fillGroup( bookmarkItem, grp );
}
if (parentItem) {
parentItem->appendRow(bookmarkItem);
} else {
m_bookmarkModel->appendRow(bookmarkItem);
}
it = m_bookmarkManager->root().next(it);
}
}