本文整理汇总了C++中KBookmark::isGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ KBookmark::isGroup方法的具体用法?C++ KBookmark::isGroup怎么用?C++ KBookmark::isGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KBookmark
的用法示例。
在下文中一共展示了KBookmark::isGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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() );
}
}
示例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 = 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);
}
}
示例3: slotSort
void ActionsImpl::slotSort() {
KEBApp::self()->bkInfo()->commitChanges();
KBookmark bk = KEBApp::self()->firstSelected();
Q_ASSERT(bk.isGroup());
SortCommand *cmd = new SortCommand(m_model, i18nc("(qtundo-format)", "Sort Alphabetically"), bk.address());
commandHistory()->addCommand(cmd);
}
示例4: slotSetAsToolbar
void ActionsImpl::slotSetAsToolbar() {
KEBApp::self()->bkInfo()->commitChanges();
KBookmark bk = KEBApp::self()->firstSelected();
Q_ASSERT(bk.isGroup());
QUndoCommand *mcmd = CmdGen::setAsToolbar(m_model, bk);
commandHistory()->addCommand(mcmd);
}
示例5: slotProperties
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 );
}
示例6: startDrag
void BookmarkToolBar::startDrag()
{
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(m_dragAction);
if (action)
{
QMimeData *mimeData = new QMimeData;
KBookmark bookmark = action->bookmark();
QByteArray address = bookmark.address().toLatin1();
mimeData->setData(BookmarkManager::bookmark_mime_type(), address);
bookmark.populateMimeData(mimeData);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
if (bookmark.isGroup())
{
drag->setPixmap(KIcon(bookmark.icon()).pixmap(24, 24));
}
else
{
drag->setPixmap(IconManager::self()->iconForUrl(action->bookmark().url()).pixmap(24, 24));
}
drag->start(Qt::MoveAction);
connect(drag, SIGNAL(destroyed()), this, SLOT(dragDestroyed()));
}
}
示例7: slotDelete
void KonqSidebarBookmarkModule::slotDelete()
{
KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
if (!bi)
return;
KBookmark bookmark = bi->bookmark();
bool folder = bookmark.isGroup();
if (KMessageBox::warningYesNo(
tree(),
folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?").arg(bookmark.text())
: i18n("Are you sure you wish to remove the bookmark\n\"%1\"?").arg(bookmark.text()),
folder ? i18n("Bookmark Folder Deletion")
: i18n("Bookmark Deletion"),
KGuiItem( i18n("&Delete"), "editdelete"), KStdGuiItem::cancel())
!= KMessageBox::Yes
)
return;
KBookmarkGroup parentBookmark = bookmark.parentGroup();
parentBookmark.deleteBookmark( bookmark );
KonqBookmarkManager::self()->emitChanged( parentBookmark );
}
示例8: 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;
}
示例9: 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 );
}
}
}
示例10: 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);
}
}
}
示例11: 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);
}
示例12: slotPaste
void ActionsImpl::slotPaste() {
KEBApp::self()->bkInfo()->commitChanges();
QString addr;
KBookmark bk = KEBApp::self()->firstSelected();
if(bk.isGroup())
addr = bk.address() + "/0"; //FIXME internal
else
addr = bk.address();
QUndoCommand *mcmd = CmdGen::insertMimeSource( m_model, i18nc("(qtundo-format)", "Paste"), QApplication::clipboard()->mimeData(), addr);
commandHistory()->addCommand(mcmd);
}
示例13: slotCopyLocation
void KonqSidebarBookmarkModule::slotCopyLocation()
{
KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
if (!bi)
return;
KBookmark bookmark = bi->bookmark();
if ( !bookmark.isGroup() )
{
kapp->clipboard()->setData( KBookmarkDrag::newDrag(bookmark, 0),
QClipboard::Selection );
kapp->clipboard()->setData( KBookmarkDrag::newDrag(bookmark, 0),
QClipboard::Clipboard );
}
}
示例14: 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() );
}
示例15: 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 );
}