added uniqueptr and messagebox

pull/23/head
JuanJakobo 2020-11-07 11:19:19 +01:00
parent b292a0911c
commit 29ff3aa5bb
2 changed files with 7 additions and 7 deletions

View File

@ -17,12 +17,12 @@
using std::string; using std::string;
EventHandler *EventHandler::_eventHandlerStatic; std::unique_ptr<EventHandler>EventHandler::_eventHandlerStatic;
EventHandler::EventHandler() EventHandler::EventHandler()
{ {
//create a event to create handlers //create a event to create handlers
_eventHandlerStatic = this; _eventHandlerStatic = std::unique_ptr<EventHandler>(this);
_loginView = nullptr; _loginView = nullptr;
_listView = nullptr; _listView = nullptr;
@ -95,7 +95,6 @@ void EventHandler::mainMenuHandler(const int index)
//} //}
_nextcloud.logout(); _nextcloud.logout();
_listView.reset(); _listView.reset();
_loginView = std::unique_ptr<LoginView>(new LoginView(_menu.getContentRect())); _loginView = std::unique_ptr<LoginView>(new LoginView(_menu.getContentRect()));
FullUpdate(); FullUpdate();
break; break;
@ -154,7 +153,8 @@ int EventHandler::pointerHandler(const int type, const int par1, const int par2)
if (!_nextcloud.downloadItem(itemID)) if (!_nextcloud.downloadItem(itemID))
{ {
CloseProgressbar(); CloseProgressbar();
Message(ICON_WARNING, "Warning", "Could not download the file, please try again.", 600); if(!_nextcloud.isWorkOffline())
Message(ICON_WARNING, "Warning", "Could not download the file, please try again.", 600);
} }
else else
{ {

View File

@ -37,11 +37,11 @@ public:
int eventDistributor(const int type, const int par1, const int par2); int eventDistributor(const int type, const int par1, const int par2);
private: private:
static EventHandler *_eventHandlerStatic; static std::unique_ptr<EventHandler> _eventHandlerStatic;
MenuHandler _menu = MenuHandler("Nextcloud");
Nextcloud _nextcloud = Nextcloud();
std::unique_ptr<ListView> _listView; std::unique_ptr<ListView> _listView;
std::unique_ptr<LoginView> _loginView; std::unique_ptr<LoginView> _loginView;
MenuHandler _menu = MenuHandler("Nextcloud");
Nextcloud _nextcloud = Nextcloud();
/** /**
* Functions needed to call C function, redirects to real function * Functions needed to call C function, redirects to real function