本文整理汇总了C++中KBookmark::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ KBookmark::isNull方法的具体用法?C++ KBookmark::isNull怎么用?C++ KBookmark::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KBookmark
的用法示例。
在下文中一共展示了KBookmark::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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: undo
void CreateCommand::undo()
{
KBookmark bk = m_model->bookmarkManager()->findByAddress(m_to);
Q_ASSERT(!bk.isNull() && !bk.parentGroup().isNull());
m_model->removeBookmark(bk);
}
示例5: rootGroup
QList<KBookmark> BookmarkManager::find(const QString &text)
{
QList<KBookmark> list;
KBookmarkGroup root = rootGroup();
if (!root.isNull())
for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
find(&list, bookmark, text);
return list;
}
示例6: 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>");
}
示例7: 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);
}
}
}
示例8: fillBookmarks
void KBookmarkMenu::fillBookmarks()
{
KBookmarkGroup parentBookmark = m_pManager->findByAddress(m_parentAddress).toGroup();
Q_ASSERT(!parentBookmark.isNull());
if (m_bIsRoot && !parentBookmark.first().isNull()) { // at least one bookmark
m_parentMenu->addSeparator();
}
for (KBookmark bm = parentBookmark.first(); !bm.isNull(); bm = parentBookmark.next(bm)) {
m_parentMenu->addAction(actionForBookmark(bm));
}
}
示例9: deleteAll
KEBMacroCommand* DeleteCommand::deleteAll(KBookmarkModel* model, const KBookmarkGroup & parentGroup)
{
KEBMacroCommand *cmd = new KEBMacroCommand(QString());
QStringList lstToDelete;
// we need to delete from the end, to avoid index shifting
for (KBookmark bk = parentGroup.first();
!bk.isNull(); bk = parentGroup.next(bk))
lstToDelete.prepend(bk.address());
for (QStringList::const_iterator it = lstToDelete.constBegin();
it != lstToDelete.constEnd(); ++it) {
new DeleteCommand(model, (*it), false, cmd);
}
return cmd;
}
示例10: slotEditButtonClicked
void BookmarksSettingsPage::slotEditButtonClicked()
{
QListViewItem* item = m_listView->selectedItem();
assert(item != 0); // 'edit' may not get invoked when having no items
KBookmark bookmark = EditBookmarkDialog::getBookmark(i18n("Edit Bookmark"),
item->text(NameIdx),
KURL(item->text(URLIdx)),
item->text(IconIdx));
if (!bookmark.isNull()) {
item->setPixmap(PixmapIdx, SmallIcon(bookmark.icon()));
item->setText(NameIdx, bookmark.text());
item->setText(URLIdx, bookmark.url().prettyURL());
item->setText(IconIdx, bookmark.icon());
}
}
示例11: updateBookmarks
void BookmarksSidebarPage::updateBookmarks()
{
m_bookmarksList->clear();
KIconLoader iconLoader;
KBookmarkGroup root = DolphinSettings::instance().bookmarkManager()->root();
KBookmark bookmark = root.first();
while (!bookmark.isNull()) {
m_bookmarksList->insertItem( BookmarkItem::fromKbookmark(bookmark, iconLoader) );
bookmark = root.next(bookmark);
}
connectToActiveView();
}
示例12: action
bool ClearFaviconsAction::action()
{
QDir favIconDir(KGlobal::dirs()->saveLocation( "cache", QLatin1String( "favicons/" ) ));
QStringList saveTheseFavicons;
KBookmarkManager* konqiBookmarkMgr;
konqiBookmarkMgr =
KBookmarkManager::managerForFile(KStandardDirs::locateLocal("data",
QLatin1String("konqueror/bookmarks.xml")), QLatin1String( "konqueror" ));
kDebug() << "saving the favicons that are in konqueror bookmarks" ;
kDebug() << "opened konqueror bookmarks at " << konqiBookmarkMgr->path() ;
// get the entire slew of bookmarks
KBookmarkGroup konqiBookmarks = konqiBookmarkMgr->root();
// walk through the bookmarks, if they have a favicon we should keep it
KBookmark bookmark = konqiBookmarks.first();
while (!bookmark.isNull()) {
if ((bookmark.icon()).startsWith(QLatin1String("favicons/"))) {
// pick out the name, throw .png on the end, and store the filename
QRegExp regex(QLatin1String( "favicons/(.*)" ));
regex.indexIn(bookmark.icon(), 0);
kDebug() << "will save " << (regex.cap(1) + QLatin1String( ".png" )) ;
saveTheseFavicons << (regex.cap(1) + QLatin1String( ".png" ));
}
bookmark = konqiBookmarks.next(bookmark);
}
favIconDir.setFilter( QDir::Files );
const QStringList entries = favIconDir.entryList();
// erase all files in favicon directory...
for( QStringList::const_iterator it = entries.begin() ; it != entries.end() ; ++it) {
// ...if we're not supposed to save them, of course
if (!saveTheseFavicons.contains(*it)) {
kDebug() << "removing " << *it ;
if(!favIconDir.remove(*it)) {
errMsg = i18n("A favicon could not be removed.");
return false;
}
}
}
return true;
}
示例13: addOpenFolderInTabs
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));
}
}
}
示例14: 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();
}
示例15: 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);
}