Added back-cycling option in Event::cycleFavourite.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 21 Jan 2017 22:19:49 +0000 (23:19 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 21 Jan 2017 22:22:39 +0000 (23:22 +0100)
src/mvc/event.cpp
src/mvc/event.h

index b00b1ab..d2075e7 100644 (file)
@@ -211,11 +211,11 @@ Favourite Event::timeConflict() const {
 
 }
 
-void Event::cycleFavourite() {
+void Event::cycleFavourite(bool back) {
     switch (favourite()) {
-        case Favourite_no: setFavourite(Favourite_strong); break;
-        case Favourite_strong: setFavourite(Favourite_weak); break;
-        case Favourite_weak: setFavourite(Favourite_no); break;
+        case Favourite_no: setFavourite(back ? Favourite_weak : Favourite_strong); break;
+        case Favourite_strong: setFavourite(back ? Favourite_no : Favourite_weak); break;
+        case Favourite_weak: setFavourite(back ? Favourite_strong : Favourite_no); break;
     }
 }
 
index 0d9b2a2..ea85a04 100644 (file)
@@ -86,7 +86,7 @@ public:
     void setType(const QString & type) { setValue("type", type); }
     void setLanguage(const QString & language) { setValue("language", language); }
     void setFavourite(Favourite favourite) { setValue("favourite", (int) favourite); }
-    void cycleFavourite();
+    void cycleFavourite(bool back = false);
     void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
     void setTag(const QString& tag) { setValue("tag", tag); }
     void setTitle(const QString& title) { setValue("title", title); }