mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-19 22:49:06 -04:00
1. Prepare Pure and Bell specific `Application` classes and add them to `app` target: - `products/BellHybrid/apps/Application.cpp` - `products/PurePhone/apps/Application.cpp` 2. Update `CMakeLists.txt` files. 3. Move `ApplicationBell` implementation to Bell-specific `Application` class and remove `ApplicationBell` files. 4. Change Bell apps parent classes from `ApplicationBell` to Bell-specific `Application` class. 5. Rename `Application` to `ApplicationCommon` in the rest of the files.
75 lines
2.3 KiB
C++
75 lines
2.3 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "SimContactsImportWindowPresenter.hpp"
|
|
|
|
SimContactsImportWindowPresenter::SimContactsImportWindowPresenter(
|
|
app::ApplicationCommon *application, std::shared_ptr<SimContactsImportModel> simContactsProvider)
|
|
: application(application), simContactsProvider{std::move(simContactsProvider)}
|
|
{
|
|
onSave = [&]() {
|
|
this->simContactsProvider->clearData();
|
|
getView()->contactsImported();
|
|
this->application->refreshWindow(gui::RefreshModes::GUI_REFRESH_DEEP);
|
|
requestCompleted = true;
|
|
};
|
|
|
|
onDuplicatesCheck = [&](bool duplicatesFound) {
|
|
if (duplicatesFound) {
|
|
duplicatesChecked = true;
|
|
this->simContactsProvider->clearData();
|
|
getView()->displayDuplicatesCount(this->simContactsProvider->getDuplicatesCount());
|
|
this->application->refreshWindow(gui::RefreshModes::GUI_REFRESH_DEEP);
|
|
}
|
|
else {
|
|
this->simContactsProvider->saveData(onSave);
|
|
}
|
|
requestCompleted = true;
|
|
};
|
|
|
|
onSimContactsReady = [&]() {
|
|
this->simContactsProvider->createSimImported();
|
|
getView()->contactsReady();
|
|
this->application->refreshWindow(gui::RefreshModes::GUI_REFRESH_DEEP);
|
|
};
|
|
}
|
|
|
|
std::shared_ptr<gui::ListItemProvider> SimContactsImportWindowPresenter::getSimContactsProvider() const
|
|
{
|
|
return simContactsProvider;
|
|
}
|
|
|
|
void SimContactsImportWindowPresenter::eraseProviderData() const
|
|
{
|
|
simContactsProvider->eraseData();
|
|
}
|
|
|
|
void SimContactsImportWindowPresenter::saveImportedContacts()
|
|
{
|
|
this->application->refreshWindow(gui::RefreshModes::GUI_REFRESH_DEEP);
|
|
requestCompleted = false;
|
|
if (!duplicatesChecked) {
|
|
simContactsProvider->findDuplicates(onDuplicatesCheck);
|
|
}
|
|
else {
|
|
simContactsProvider->saveData(onSave);
|
|
}
|
|
}
|
|
|
|
bool SimContactsImportWindowPresenter::isRequestCompleted()
|
|
{
|
|
return requestCompleted;
|
|
}
|
|
|
|
void SimContactsImportWindowPresenter::requestSimContacts()
|
|
{
|
|
simContactsProvider->requestSimContacts(onSimContactsReady);
|
|
}
|
|
|
|
void SimContactsImportWindowPresenter::requestDuplicates()
|
|
{
|
|
this->simContactsProvider->createDuplicates();
|
|
getView()->displayDuplicates();
|
|
this->application->refreshWindow(gui::RefreshModes::GUI_REFRESH_DEEP);
|
|
}
|