Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
69ff0eeb
Commit
69ff0eeb
authored
Jun 17, 2009
by
dt
Browse files
Switching sessions didn't clear the bookmark list from old bookmarks.
Task-Nr: 255922
parent
2d65dec3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/bookmarks/bookmarkmanager.cpp
View file @
69ff0eeb
...
...
@@ -415,8 +415,34 @@ void BookmarkManager::updateBookmark(Bookmark *bookmark)
saveBookmarks
();
}
void
BookmarkManager
::
removeAllBookmarks
()
{
if
(
m_bookmarksList
.
isEmpty
())
return
;
beginRemoveRows
(
QModelIndex
(),
0
,
m_bookmarksList
.
size
()
-
1
);
DirectoryFileBookmarksMap
::
const_iterator
it
,
end
;
end
=
m_bookmarksMap
.
constEnd
();
for
(
it
=
m_bookmarksMap
.
constBegin
();
it
!=
end
;
++
it
)
{
FileNameBookmarksMap
*
files
=
it
.
value
();
FileNameBookmarksMap
::
const_iterator
jt
,
jend
;
jend
=
files
->
constEnd
();
for
(
jt
=
files
->
constBegin
();
jt
!=
jend
;
++
jt
)
{
delete
jt
.
value
();
}
files
->
clear
();
delete
files
;
}
m_bookmarksMap
.
clear
();
m_bookmarksList
.
clear
();
endRemoveRows
();
}
void
BookmarkManager
::
removeBookmark
(
Bookmark
*
bookmark
)
{
int
idx
=
m_bookmarksList
.
indexOf
(
bookmark
);
beginRemoveRows
(
QModelIndex
(),
idx
,
idx
);
const
QFileInfo
fi
(
bookmark
->
filePath
()
);
FileNameBookmarksMap
*
files
=
m_bookmarksMap
.
value
(
fi
.
path
());
...
...
@@ -434,8 +460,7 @@ void BookmarkManager::removeBookmark(Bookmark *bookmark)
delete
files
;
}
int
idx
=
m_bookmarksList
.
indexOf
(
bookmark
);
beginRemoveRows
(
QModelIndex
(),
idx
,
idx
);
m_bookmarksList
.
removeAt
(
idx
);
endRemoveRows
();
...
...
@@ -700,6 +725,7 @@ void BookmarkManager::saveBookmarks()
/* Loads the bookmarks from the session settings. */
void
BookmarkManager
::
loadBookmarks
()
{
removeAllBookmarks
();
SessionManager
*
s
=
sessionManager
();
if
(
!
s
)
return
;
...
...
src/plugins/bookmarks/bookmarkmanager.h
View file @
69ff0eeb
...
...
@@ -67,6 +67,7 @@ public:
~
BookmarkManager
();
void
updateBookmark
(
Bookmark
*
bookmark
);
void
removeBookmark
(
Bookmark
*
bookmark
);
// Does not remove the mark
void
removeAllBookmarks
();
Bookmark
*
bookmarkForIndex
(
QModelIndex
index
);
enum
State
{
NoBookMarks
,
HasBookMarks
,
HasBookmarksInDocument
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment