From fafe2570bb52a3c36f95f4df6d6bc6993a826cb6 Mon Sep 17 00:00:00 2001 From: Christian Schuett Date: Mon, 16 Mar 2015 11:57:22 +0100 Subject: [PATCH] bookmark manager: only add bookmark if OK pressed Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/14999c7015f7f3e6a90439b3a9487223997ca9e3 Author: Christian Schuett Date: 2015-03-16 (Mon, 16 Mar 2015) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bookmarkmanager.cpp | 21 +++++++++++++++++---- src/gui/bookmarkmanager.h | 4 +++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 2707bd9c4..edb31ac47 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -84,11 +84,14 @@ inline int CBookmarkManager::createBookmark (const std::string & name, const std int CBookmarkManager::createBookmark (const std::string & url, const std::string & time) { std::string bookmarkname; - CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, &bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_"); + CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, &bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_", this); bookmarkname_input.exec(NULL, ""); - // TODO: return -1 if no name was entered - if (bookmarkname.empty()) return -1; - return createBookmark(bookmarkname, url, time); + if (bookmarkname_entered) + { + bookmarkname_entered = false; + return createBookmark(bookmarkname, url, time); + } + return -1; } //------------------------------------------------------------------------ @@ -166,6 +169,7 @@ void CBookmarkManager::writeBookmarkFile() { CBookmarkManager::CBookmarkManager() : bookmarkfile ('\t') { + bookmarkname_entered = false; bookmarksmodified = false; readBookmarkFile(); } @@ -177,6 +181,15 @@ CBookmarkManager::~CBookmarkManager () { } //------------------------------------------------------------------------ + +bool CBookmarkManager::changeNotify(const neutrino_locale_t, void *) +{ + bookmarkname_entered = true; + return false; +} + +//------------------------------------------------------------------------ + #if 0 //never used int CBookmarkManager::getBookmarkCount(void) const { diff --git a/src/gui/bookmarkmanager.h b/src/gui/bookmarkmanager.h index 1e4a921a5..9003c71ca 100644 --- a/src/gui/bookmarkmanager.h +++ b/src/gui/bookmarkmanager.h @@ -63,7 +63,7 @@ class CBookmark //----------------------------------------- -class CBookmarkManager +class CBookmarkManager : public CChangeObserver { private: std::vector bookmarks; @@ -84,6 +84,7 @@ class CBookmarkManager //int bookmarkCount; + bool bookmarkname_entered; bool bookmarksmodified; void readBookmarkFile(); void writeBookmarkFile(); @@ -101,6 +102,7 @@ class CBookmarkManager public: CBookmarkManager(); ~CBookmarkManager(); + bool changeNotify(const neutrino_locale_t, void *); int createBookmark(const std::string & name, const std::string & url, const std::string & time); int createBookmark(const std::string & url, const std::string & time); void removeBookmark(unsigned int index);