From 038de1a143b9775f37d4848f52c59af7cee66e36 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Sun, 10 Feb 2013 10:18:21 +0000 Subject: Imported Upstream version 0.8.3 --- src/favorites.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/favorites.cpp') 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; -- cgit v1.2.3