Files
MuditaOS/module-apps/application-notes/presenter/NoteEditWindowPresenter.hpp
Marcin Zieliński 660c2211e2 [MOS-23] Back button works as save button in Notes
Removed the auto-save facility from Notes as it was lacking any
configuration and worked in unwanted moment(s).
2022-06-30 10:32:24 +02:00

45 lines
1.2 KiB
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <apps-common/BasePresenter.hpp>
#include <module-apps/application-notes/model/NotesRepository.hpp>
namespace app::notes
{
class NoteEditWindowContract
{
public:
class View
{
public:
virtual ~View() noexcept = default;
virtual bool isNoteEmpty() const noexcept = 0;
};
class Presenter : public BasePresenter<NoteEditWindowContract::View>
{
public:
virtual ~Presenter() noexcept = default;
virtual void onNoteChanged() = 0;
virtual void save(std::shared_ptr<NotesRecord> &note) = 0;
};
};
class NoteEditWindowPresenter : public NoteEditWindowContract::Presenter
{
public:
explicit NoteEditWindowPresenter(std::unique_ptr<AbstractNotesRepository> &&notesRepository);
void onNoteChanged() override;
void save(std::shared_ptr<NotesRecord> &note) override;
private:
std::unique_ptr<AbstractNotesRepository> notesRepository;
bool noteChanged = false;
};
} // namespace app::notes