summaryrefslogtreecommitdiff
path: root/src/favorites.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/favorites.cpp')
-rw-r--r--src/favorites.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/favorites.cpp b/src/favorites.cpp
index 7c344f5..e3b30d2 100644
--- a/src/favorites.cpp
+++ b/src/favorites.cpp
@@ -174,9 +174,25 @@ int Favorites::findFile(QString filename) {
return -1;
}
+bool Favorites::anyItemAvailable() {
+ if (f_list.isEmpty()) return false;
+
+ bool item_available = false;
+ for (int n = 0; n < f_list.count(); n++) {
+ if (!f_list[n].isSubentry()) {
+ item_available = true;
+ break;
+ }
+ }
+
+ return item_available;
+}
+
void Favorites::next() {
qDebug("Favorites::next");
+ if (!anyItemAvailable()) return;
+
int current = findFile(current_file);
int i = current;
@@ -197,6 +213,8 @@ void Favorites::next() {
void Favorites::previous() {
qDebug("Favorites::previous");
+ if (!anyItemAvailable()) return;
+
int current = findFile(current_file);
int i = current;