/// Adds or removes a bookmark from a given address /// @param hwnd HWND of the emu window /// @param address Address of the bookmark int toggleBookmark(HWND hwnd, uint32 address) { int val = findBookmark(address); // If there's no bookmark at the given address add one. if (val == -1) { return addBookmark(hwnd, address); } else // else remove the bookmark { removeBookmark(val); return 0; } }
KFileBookmark *KFileBookmarkManager::findBookmark( KFileBookmark *parent, int id, int &currId ) { KFileBookmark *bm; for ( bm = parent->getChildren().first(); bm != NULL; bm = parent->getChildren().next() ) { if ( bm->getType() == KFileBookmark::URL ) { if ( currId == id ) return bm; currId++; } else { KFileBookmark *retbm; if ( ( retbm = findBookmark( bm, id, currId ) ) != NULL ) return retbm; } } return NULL; }
KFileBookmark *KFileBookmarkManager::getBookmark( int id ) { int currId = 0; return findBookmark( &root, id, currId ); }