./rework/interface/page.cpp
./rework/interface/internal/encrypt-device.cpp
./rework/interface/internal/decrypt-device.cpp
+ ./rework/interface/external/encrypt-sdcard.cpp
+ ./rework/interface/external/decrypt-sdcard.cpp)
+
+SET(EXTERNAL_LOCKTYPE_SRC
+ ./rework/interface/external-locktype/password.cpp
+ ./rework/interface/external-locktype/create.cpp
+ ./rework/interface/external-locktype/change.cpp
+ ./rework/interface/external-locktype/confirm.cpp
+ ./rework/interface/external-locktype/delete.cpp)
+
+SET(REWORK_TOOLS_SRC
./rework/interface/tools/vconf.cpp
./rework/interface/tools/encryption.cpp
./rework/interface/tools/locktype.cpp
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
-ADD_EXECUTABLE(${PKG_NAME} ${REWORK_SRC} ${WIDGET_SRC})
+ADD_EXECUTABLE(${PKG_NAME} ${REWORK_SRC} ${REWORK_TOOLS_SRC} ${EXTERNAL_LOCKTYPE_SRC} ${WIDGET_SRC})
INSTALL(TARGETS ${PKG_NAME} DESTINATION ${APP_INSTALL_PREFIX}/${PKG_NAME}/bin)
TARGET_LINK_LIBRARIES(${PKG_NAME} ${EFL_APP_LIBRARIES} ${tools_pkgs_LIBRARIES} ode)
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+group {"external_info";
+ parts {
+ rect { "bg";
+ scale: 1;
+ desc { "default";
+ rel1 {relative: 0.0 0.0;}
+ rel2 {relative: 1.0 1.0;}
+ visible: 0;
+ fixed: 0 0;
+ }
+ }
+ textblock { "msg_content";
+ scale: 1;
+ desc { "default";
+ text { style: "info_text";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ rel1 {relative: 0.0 0.0; offset: 22 22; to: "bg";}
+ rel2 {relative: 1.0 1.0; offset: -22 -22; to: "bg";}
+ }
+ }
+ swallow { "password_button";
+ scale: 1;
+ desc { "default";
+ min: 280 24;
+ max: 280 24;
+ fixed: 1 1;
+ rel1 { relative: 0.0 0.3; offset: 0 0; to: "bg";}
+ rel2 { relative: 1.0 1.0; offset: -32 0; to: "bg";}
+ align: 1.0 0.0;
+ }
+ }
+ }
+}
+
+group {"external_check_status";
+ parts {
+ rect { "bg";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ visible: 0;
+ fixed: 1 1;
+ }
+ }
+ textblock { "msg_content";
+ scale: 1;
+ desc { "default";
+ fixed: 1 1;
+ text { style: "info_text";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ rel1 {relative: 0.0 0.0; offset: 32 24; to: "bg";}
+ rel2 {relative: 1.0 0.5; offset: -32 0; to: "bg";}
+ }
+ }
+ swallow { "group_index";
+ scale: 1;
+ desc { "default";
+ min: 0 54;
+ max: -1 54;
+ rel1 {relative: 0.0 1.0; offset: -32 24; to: "msg_content";}
+ rel2 {relative: 1.0 1.0;}
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ rect { "opt_bg";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 1.0; to: "group_index";}
+ rel2 { relative: 1.0 1.0;}
+ fixed: 1 1;
+ color: 245 245 245 245;
+ }
+ }
+ rect { "check_area";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 1.0; offset: 0 24; to: "group_index";}
+ rel2 { relative: 1.0 1.0; offset: 0 156; to: "group_index";}
+ align: 0.0 0.0;
+ visible: 0;
+ fixed: 1 1;
+ }
+ }
+ table { "check_list";
+ scale: 1;
+ desc { "default";
+ rel1 {relative: 0.0 0.0; offset: 32 0; to: "check_area";}
+ rel2 {relative: 1.0 1.0; to: "check_area";}
+ }
+ table {
+ #define ITEM(source_name, part_name, x, y) \
+ item { \
+ source: source_name; \
+ name: part_name; \
+ position: x y; \
+ weight: 1.0 1.0; \
+ span: 1 1; \
+ align: -1.0 -1.0; \
+ }
+ items {
+ ITEM("check_item", "check_sd_card", 1, 1);
+ ITEM("check_item", "check_password", 1, 2);
+ }
+ }
+ }
+ spacer { "padding.checklist";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 1.0; offset: 0 0; to: "check_area";}
+ rel2 { relative: 1.0 1.0; offset: 0 24; to: "check_area";}
+ fixed: 1 1;
+ }
+ }
+ swallow { "create_button";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 1.0; offset: 110 22; to: "padding.checklist";}
+ rel2 { relative: 1.0 1.0; offset: -110 80; to: "padding.checklist";}
+ align: 0.5 0.5;
+ fixed: 1 1;
+ visible: 1;
+ }
+ desc { "set";
+ inherit: "default";
+ visible: 0;
+ }
+ }
+ swallow { "change_button";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 1.0; offset: 22 22; to: "padding.checklist";}
+ rel2 { relative: 0.5 1.0; offset: -22 80; to: "padding.checklist";}
+ align: 0.5 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ desc { "set";
+ inherit: "default";
+ visible: 1;
+ }
+ }
+ swallow { "delete_button";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.5 1.0; offset: 0 22; to: "padding.checklist";}
+ rel2 { relative: 1.0 1.0; offset: -22 80; to: "padding.checklist";}
+ align: 0.5 0.5;
+ fixed: 1 1;
+ visible: 0;
+ }
+ desc { "set";
+ inherit: "default";
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "setpwd,effect";
+ action: STATE_SET "set" 0.0;
+ source: "";
+ target: "create_button";
+ target: "change_button";
+ target: "delete_button";
+ }
+ program {
+ signal: "unsetpwd,effect";
+ action: STATE_SET "default" 0.0;
+ source: "";
+ target: "create_button";
+ target: "change_button";
+ target: "delete_button";
+ }
+ }
+}
+
+group { "external_confirm"
+ parts {
+ rect { "bg";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ visible: 0;
+ }
+ }
+ textblock { "msg_content";
+ scale: 1;
+ desc { "default";
+ fixed: 1 1;
+ text { style: "info_text";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ rel1 {relative: 0.0 0.0; offset: 32 24; to: "bg";}
+ rel2 {relative: 1.0 0.5; offset: -32 0; to: "bg";}
+ }
+ }
+ swallow { "option_list";
+ scale: 1;
+ desc { "default";
+ rel1 { relative: 0.0 1.0; offset: -32 24; to: "msg_content";}
+ rel2 { relative: 1.0 1.0;}
+ fixed: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+}
#include "./edc_resource/encryption_device.edc"
#include "./edc_resource/check-item.edc"
#include "./edc_resource/internal.edc"
+ #include "./edc_resource/external.edc"
#include "./edc_resource/entry-popup.edc"
}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "password.h"
+
+PasswordChange::PasswordChange(Widget *parent)
+ : confirmPassword(parent),
+ createPassword(parent),
+ prevData("")
+{
+ confirmPassword.onResult.connect(this, &PasswordChange::onConfirmed);
+ createPassword.setMode(PasswordCreate::Type::ChangePassword);
+ createPassword.onResult.connect(this, &PasswordChange::onCreated);
+}
+
+PasswordChange::~PasswordChange()
+{
+}
+
+void PasswordChange::show()
+{
+ confirmPassword.show();
+}
+
+void PasswordChange::dispose()
+{
+}
+
+void PasswordChange::onConfirmed(int ret, const std::string &data)
+{
+ if (ret == -1) {
+ onResult.emit(0, data);
+ } else if (ret == 1) {
+ prevData = data;
+ createPassword.show();
+ }
+}
+
+void PasswordChange::onCreated(int ret, const std::string &data)
+{
+ encryption.changePassword(prevData, data);
+ onResult.emit(ret, data);
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "password.h"
+
+PasswordConfirm::PasswordConfirm(Widget *parent)
+ : confirmPopup(parent, dgetText("IDS_ST_HEADER_USE_ENCRYPTED_SD_CARD"), dgetText("IDS_LCKSCN_NPBODY_ENTER_PASSWORD"), ""),
+ resetStoragePopup(parent, dgetText("IDS_ST_HEADER_COULDNT_USE_SD_CARD"), ""),
+ vconf(VCONFKEY_SYSMAN_MMC_STATUS),
+ attempt(0),
+ timeCount(0),
+ data("")
+{
+ setConfirmPopup();
+}
+
+PasswordConfirm::~PasswordConfirm()
+{
+}
+
+void PasswordConfirm::show()
+{
+ confirmPopup.show();
+}
+
+void PasswordConfirm::dispose()
+{
+ confirmPopup.dispose();
+ resetStoragePopup.dispose();
+ onResult.emit(result, data);
+}
+
+void PasswordConfirm::addTimerEvent()
+{
+ timer.add(1);
+ timer.onTimer = [this]() {
+ timeCount = (timeCount+1) % 6;
+ updateTitleText();
+
+ if (timeCount == 0) {
+ confirmPopup.rightButton.setDisabled(false);
+ timer.dispose();
+ return ECORE_CALLBACK_DONE;
+ }
+ return ECORE_CALLBACK_PASS_ON;
+ };
+}
+
+void PasswordConfirm::updateTitleText()
+{
+ if (timeCount != 0) {
+ confirmPopup.entryLayout.setText("title", formatString("IDS_ST_BODY_ENTER_PASSWORD_IN_PD_SECONDS", 6-timeCount));
+ } else {
+ confirmPopup.entryLayout.setText("title", dgetText("IDS_LCKSCN_NPBODY_ENTER_PASSWORD"));
+ }
+}
+
+void PasswordConfirm::updateContentText()
+{
+ std::string text("");
+ attempt++;
+ text.append(dgetText("IDS_LCKSCN_NPBODY_INCORRECT_PASSWORD_ENTERED"));
+ text.append("</br>");
+ if (attempt < 10) {
+ text.append(formatString("IDS_ST_BODY_YOU_HAVE_PD_ATTEMPTS_LEFT", 15-attempt));
+ } else {
+ text.append(formatString("IDS_ST_BODY_IF_AN_INCORRECT_PASSWORD_IS_ENTERED_PD_MORE_TIMES_YOU_WILL_NO_LONGER_BE_ABLE_MSG", 15-attempt));
+ }
+ confirmPopup.entryLayout.setText("content", text);
+
+ if (attempt > 5) {
+ confirmPopup.rightButton.setDisabled(true);
+ addTimerEvent();
+ }
+}
+
+void PasswordConfirm::setConfirmPopup()
+{
+ confirmPopup.setButton(dgetText("IDS_ST_BUTTON_CANCEL"),
+ [this](void *) {
+ dispose();
+ },
+ dgetText("IDS_ST_BUTTON_DONE"),
+ [this](void *) {
+ if (attempt == 14) {
+ confirmPopup.hide();
+ setResetStoragePopup();
+ resetStoragePopup.show();
+ return;
+ }
+ result = encryption.verifyPassword(confirmPopup.getEntryData());
+ if (!result) {
+ updateContentText();
+ } else {
+ data = confirmPopup.getEntryData();
+ dispose();
+ }
+ });
+
+ confirmPopup.onBackKeyEvent = [this]() {
+ dispose();
+ };
+}
+
+void PasswordConfirm::setResetStoragePopup()
+{
+ if (vconf.getInt() != VCONFKEY_SYSMAN_MMC_MOUNTED) {
+ resetStoragePopup.setContentText(dgetText("IDS_ST_POP_TAP_RESET_TO_DELETE_THE_PASSWORD_YOU_CAN_USE_SD_CARDS_THAT_WERE_ENCRYPTED_BY_THIS_PHONE_MSG"));
+ } else {
+ resetStoragePopup.setContentText(dgetText("IDS_ST_POP_AN_INCORRECT_PASSWORD_HAS_BEEN_ENTERED_15_TIMES_YOU_CAN_NO_LONGER_ACCESS_DATA_ON_ANY_MSG"));
+ }
+ resetStoragePopup.setButton(dgetText("IDS_ST_BUTTON_CANCEL"),
+ [this](void *) {
+ dispose();
+ },
+ dgetText("IDS_ST_BUTTON_OK"),
+ [this](void *) {
+ encryption.recovery();
+ result = -1;
+ dispose();
+ });
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "password.h"
+
+PasswordCreate::PasswordCreate(Widget *parent)
+ : rememberPopup(parent, dgetText("IDS_ST_HEADER_REMEMBER_PASSWORD"), dgetText("IDS_ST_POP_MAKE_SURE_YOU_REMEMBER_YOUR_PASSWORD_IF_YOU_FORGET_IT_YOU_WILL_NO_LONGER_BE_ABLE_TO_USE_ANY_MSG")),
+ enterPopup(parent, dgetText("IDS_ST_BODY_PASSWORD"), dgetText("IDS_ST_HEADER_ENTER_NEW_PASSWORD_ABB"), formatString("IDS_LCKSCN_BODY_THE_PASSWORD_MUST_CONSIST_OF_AT_LEAST_PD_ALPHANUMERIC_CHARACTERS_INCLUDING_AT_LEAST_1_LETTER", 4)),
+ confirmPopup(parent, dgetText("IDS_ST_BODY_PASSWORD"), dgetText("IDS_ST_POP_CONFIRM_PASSWORD"), dgetText("IDS_ST_BODY_MAKE_SURE_YOU_REMEMBER_YOUR_PASSWORD")),
+ mode(InitPassword),
+ data("")
+{
+ setRememberPopup();
+ setEnterPopup();
+ setConfirmPopup();
+}
+
+PasswordCreate::~PasswordCreate()
+{
+}
+
+void PasswordCreate::show()
+{
+ rememberPopup.show();
+}
+
+void PasswordCreate::dispose()
+{
+ confirmPopup.dispose();
+ enterPopup.dispose();
+ rememberPopup.dispose();
+ onResult.emit(result, data);
+}
+
+bool PasswordCreate::isMatched()
+{
+ std::string enterData("");
+ enterData = enterPopup.getEntryData();
+ if (enterData.compare(confirmPopup.getEntryData())) {
+ return false;
+ }
+ return true;
+}
+
+void PasswordCreate::setMode(int type)
+{
+ mode = type;
+}
+
+void PasswordCreate::setRememberPopup()
+{
+ rememberPopup.setButton(dgetText("IDS_ST_BUTTON_CANCEL"),
+ [this](void *) {
+ dispose();
+ },
+ dgetText("IDS_ST_BUTTON_OK"),
+ [this](void *) {
+ rememberPopup.hide();
+ enterPopup.show();
+ });
+ rememberPopup.onBackKeyEvent = [this]() {
+ dispose();
+ };
+}
+
+void PasswordCreate::setEnterPopup()
+{
+ enterPopup.setButton(dgetText("IDS_ST_BUTTON_CANCEL"),
+ [this](void *) {
+ enterPopup.hide();
+ rememberPopup.show();
+ },
+ dgetText("IDS_ST_BUTTON_DONE"),
+ [this](void *) {
+ enterPopup.hide();
+ confirmPopup.show();
+ });
+ enterPopup.onBackKeyEvent = [this]() {
+ enterPopup.hide();
+ rememberPopup.show();
+ };
+}
+
+void PasswordCreate::setConfirmPopup()
+{
+ confirmPopup.setButton(dgetText("IDS_ST_BUTTON_CANCEL"),
+ [this](void *) {
+ confirmPopup.hide();
+ enterPopup.show();
+ },
+ dgetText("IDS_ST_BUTTON_DONE"),
+ [this](void *) {
+ if (!isMatched()) {
+ return;
+ }
+ if (mode == InitPassword)
+ encryption.initPassword(confirmPopup.getEntryData());
+ data = confirmPopup.getEntryData();
+ result = 1;
+ dispose();
+ });
+ confirmPopup.onBackKeyEvent = [this]() {
+ confirmPopup.hide();
+ enterPopup.show();
+ };
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "password.h"
+
+PasswordDelete::PasswordDelete(Widget *parent)
+ : deletePopup(parent, dgetText("IDS_ST_HEADER_DELETE_SD_CARD_PASSWORD"), dgetText("IDS_ST_POP_YOUR_DEVICE_WILL_FORGET_ALL_SD_CARDS_THAT_HAVE_PREVIOUSLY_BEEN_ENCRYPTED_BY_THIS_DEVICE_MSG")),
+ confirmPassword(parent)
+{
+ setDeletePopup();
+ confirmPassword.onResult.connect(this, &PasswordDelete::onDeleted);
+}
+
+PasswordDelete::~PasswordDelete()
+{
+}
+
+void PasswordDelete::show()
+{
+ deletePopup.show();
+}
+
+void PasswordDelete::dispose()
+{
+}
+
+void PasswordDelete::setDeletePopup()
+{
+ deletePopup.setButton(dgetText("IDS_ST_BUTTON_CANCEL"),
+ [this](void *) {
+ deletePopup.dispose();
+ },
+ dgetText("IDS_ST_BUTTON_DELETE_ABB3"),
+ [this](void *) {
+ deletePopup.dispose();
+ confirmPassword.show();
+ });
+
+ deletePopup.onBackKeyEvent = [this]() {
+ deletePopup.dispose();
+ };
+}
+
+void PasswordDelete::onDeleted(int ret, const std::string &data)
+{
+ if (ret == -1) {
+ onResult.emit(1, data);
+ } else if (ret == 1) {
+ encryption.cleanPassword(data);
+ onResult.emit(0, data);
+ }
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "password.h"
+
+EntryPopup::EntryPopup(Widget *parent, const std::string &title, const std::string &header, const std::string &content)
+ : MobileDefaultPopup(parent),
+ entryLayout(parent, "/usr/apps/org.tizen.ode/res/org.tizen.ode.edj", "entry_popup"),
+ entry(&entryLayout, Entry::Config::SetSingleLine | Entry::Config::SetPassword | Entry::Config::SetAlignCenter)
+{
+ setTitleText(title);
+ entryLayout.setText("title", header);
+ entryLayout.setContent("entry", &entry);
+ entryLayout.setText("content", content);
+ setContent(&entryLayout);
+}
+
+EntryPopup::~EntryPopup()
+{
+}
+
+const std::string EntryPopup::getEntryData()
+{
+ return entry.get();
+}
+
+TextPopup::TextPopup(Widget *parent, const std::string &title, const std::string &content)
+ : MobileDefaultPopup(parent)
+{
+ setTitleText(title);
+ setContentText(content);
+}
+
+TextPopup::~TextPopup()
+{
+}
+
+PasswordInterface::PasswordInterface()
+ : result(0)
+{
+}
+
+PasswordInterface::~PasswordInterface()
+{
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __ODE_PASSWORD_H__
+#define __ODE_PASSWORD_H__
+
+#include "../tools/encryption.h"
+#include "../tools/vconf.h"
+#include "../../widgets/popup.h"
+#include "../../widgets/entry.h"
+#include "../../widgets/timer.h"
+#include "../../language.h"
+
+class EntryPopup : public MobileDefaultPopup {
+public:
+ EntryPopup(Widget *parent, const std::string &title, const std::string &header, const std::string &content);
+ virtual ~EntryPopup();
+
+ const std::string getEntryData();
+
+public:
+ Layout entryLayout;
+private:
+ Entry entry;
+ Signal<> onEntryEvent;
+};
+
+class TextPopup : public MobileDefaultPopup {
+public:
+ TextPopup(Widget *parent, const std::string &title, const std::string &content);
+ virtual ~TextPopup();
+};
+
+class PasswordInterface {
+public:
+ PasswordInterface();
+ virtual ~PasswordInterface();
+
+ virtual void show() = 0;
+ virtual void dispose() = 0;
+public:
+ Signal<int, const std::string&> onResult;
+protected:
+ ExternalEncryption encryption; /*TBD*/
+ int result;
+};
+
+class PasswordCreate : public PasswordInterface {
+public:
+ enum Type {
+ InitPassword,
+ ChangePassword,
+ };
+
+ PasswordCreate(Widget *parent);
+ ~PasswordCreate();
+
+ void show();
+ void dispose();
+ void setMode(int type);
+private:
+ bool isMatched();
+ void setRememberPopup();
+ void setEnterPopup();
+ void setConfirmPopup();
+private:
+ TextPopup rememberPopup;
+ EntryPopup enterPopup;
+ EntryPopup confirmPopup;
+
+ int mode;
+ std::string data;
+};
+
+class PasswordConfirm : public PasswordInterface {
+public:
+ PasswordConfirm(Widget *parent);
+ ~PasswordConfirm();
+
+ void show();
+ void dispose();
+private:
+ void addTimerEvent();
+ void updateTitleText();
+ void updateContentText();
+ void setConfirmPopup();
+ void setResetStoragePopup();
+
+private:
+ EntryPopup confirmPopup;
+ TextPopup resetStoragePopup;
+ Vconf vconf;
+ int attempt;
+ int timeCount;
+ Timer timer;
+
+ std::string data;
+};
+
+class PasswordChange : public PasswordInterface {
+public:
+ PasswordChange(Widget *parent);
+ ~PasswordChange();
+
+ void show();
+ void dispose();
+
+ void onConfirmed(int ret, const std::string &data);
+ void onCreated(int ret, const std::string &data);
+private:
+ PasswordConfirm confirmPassword;
+ PasswordCreate createPassword;
+ std::string prevData;
+};
+
+class PasswordDelete : public PasswordInterface {
+public:
+ PasswordDelete(Widget *parent);
+ ~PasswordDelete();
+
+ void show();
+ void dispose();
+
+ void onDeleted(int ret, const std::string &data);
+private:
+ void setDeletePopup();
+private:
+ TextPopup deletePopup;
+ PasswordConfirm confirmPassword;
+};
+
+#endif
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "decrypt-sdcard.h"
+
+DecryptSDCardInfo::DecryptSDCardInfo(Widget *parent)
+ : Page(parent, "external_info", Page::Type::SetOneButton),
+ passwordChange(nullptr),
+ changePasswordButton(content.get())
+{
+ setPartContent();
+}
+
+DecryptSDCardInfo::~DecryptSDCardInfo()
+{
+}
+
+void DecryptSDCardInfo::setPartContent()
+{
+ std::string info("");
+ info.append(dgetText("IDS_ST_BODY_THE_DECRYPTION_PROCESS_MAY_TAKE_A_LONG_TIME_MSG"));
+ content->setText("msg_content", info);
+
+ changePasswordButton.setText(dgetText("IDS_ST_BUTTON_CHANGE_PASSWORD_ABB2"));
+ changePasswordButton.onClick = [this](void *) {
+ passwordChange.reset(new PasswordChange(this));
+ passwordChange->show();
+ };
+ content->setContent("password_button", &changePasswordButton);
+}
+
+DecryptSDCardConfirm::DecryptSDCardConfirm(Widget *parent)
+ : Page(parent, "external_info", Page::Type::SetOneButton)
+{
+ setPartContent();
+}
+
+DecryptSDCardConfirm::~DecryptSDCardConfirm()
+{
+}
+
+void DecryptSDCardConfirm::setPartContent()
+{
+ nextButton->setText(dgetText("IDS_ST_HEADER_DECRYPT_SD_CARD"));
+ std::string info("");
+ info.append(dgetText("IDS_ST_BODY_TAP_DECRYPT_TO_START_THE_DECRYPTION_PROCESS"));
+ info.append("</br>");
+ info.append(dgetText("IDS_ST_BODY_ALL_OPEN_FILES_ON_SD_CARD_WILL_BE_CLOSED"));
+ info.append("</br></br>");
+ info.append(dgetText("IDS_ST_BODY_THE_DECRYPTION_CANT_BE_CANCELLED_AND_DATA_WILL_BE_LOST_IF_THE_PROCESS_IS_INTERRUPTED_MSG"));
+ content->setText("msg_content", info);
+}
+
+DecryptSDCardInterface::DecryptSDCardInterface()
+ : exitButton(naviframe), infoPage(nullptr), confirmPage(nullptr), passwordConfirm(nullptr)
+{
+ setNaviframe();
+}
+
+DecryptSDCardInterface::~DecryptSDCardInterface()
+{
+}
+
+void DecryptSDCardInterface::onConfirmed(int result, const std::string &data)
+{
+ /* TBD : result == -1 In case of reset SD card */
+ if (result == 1) {
+ encryption.decrypt(data);
+ dispose();
+ }
+}
+
+void DecryptSDCardInterface::checkPassword()
+{
+ passwordConfirm.reset(new PasswordConfirm(naviframe));
+ passwordConfirm->onResult.connect(this, &DecryptSDCardInterface::onConfirmed);
+ passwordConfirm->show();
+}
+
+void DecryptSDCardInterface::createConfirmPage()
+{
+ confirmPage.reset(nullptr);
+ confirmPage.reset(new DecryptSDCardConfirm(naviframe));
+ confirmPage->nextButton->onClickSignal.connect(this, &DecryptSDCardInterface::checkPassword);
+ naviframe->pushPage(dgetText("IDS_ST_HEADER_CONFIRM_DECRYPTION"), confirmPage.get(), nullptr);
+}
+
+void DecryptSDCardInterface::create()
+{
+ NaviframeItem *item = nullptr;
+ exitButton.setStyle("naviframe/back_btn/default");
+ exitButton.onClick = [this](void *) {
+ naviframe->popItem();
+ };
+
+ infoPage.reset(new DecryptSDCardInfo {naviframe});
+ infoPage->nextButton->onClickSignal.connect(this, &DecryptSDCardInterface::createConfirmPage);
+ item = naviframe->pushPage(dgetText("IDS_ST_HEADER_DECRYPT_SD_CARD"), infoPage.get(), &exitButton);
+ item->pagePopEvent.connect(this, &DecryptSDCardInterface::dispose);
+}
+
+void DecryptSDCardInterface::dispose()
+{
+ ::ui_app_exit();
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __ODE_DECRYPT_SD_CARD_H__
+#define __ODE_DECRYPT_SD_CARD_H__
+
+#include "../interface.h"
+#include "../../widgets/button.h"
+#include "../tools/encryption.h"
+#include "../external-locktype/password.h"
+
+class DecryptSDCardInfo : public Page {
+public:
+ DecryptSDCardInfo(Widget *parent);
+ ~DecryptSDCardInfo();
+
+ void setPartContent();
+
+ std::unique_ptr<PasswordChange> passwordChange;
+ Button changePasswordButton;
+};
+
+class DecryptSDCardConfirm : public Page {
+public:
+ DecryptSDCardConfirm(Widget *parent);
+ ~DecryptSDCardConfirm();
+
+ void setPartContent();
+};
+
+class DecryptSDCardInterface : public ODEInterface {
+public:
+ DecryptSDCardInterface();
+ ~DecryptSDCardInterface();
+
+ void create();
+ void dispose();
+
+ void createCheckPage();
+ void createConfirmPage();
+ void onConfirmed(int result, const std::string &data);
+ void checkPassword();
+
+private:
+ Button exitButton;
+ std::unique_ptr<DecryptSDCardInfo> infoPage;
+ std::unique_ptr<DecryptSDCardConfirm> confirmPage;
+ std::unique_ptr<PasswordConfirm> passwordConfirm;
+ ExternalEncryption encryption;
+};
+
+#endif
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "encrypt-sdcard.h"
+
+EncryptSDCardInfo::EncryptSDCardInfo(Widget *parent)
+ : Page(parent, "external_info", Page::Type::SetOneButton)
+{
+ setPartContent();
+}
+
+EncryptSDCardInfo::~EncryptSDCardInfo()
+{
+}
+
+void EncryptSDCardInfo::setPartContent()
+{
+ std::string info("");
+ info.append(dgetText("IDS_ST_BODY_ENCRYPTING_YOUR_SD_CARD_WILL_PROTECT_ITS_DATA_IF_ITS_LOST_OR_STOLEN_ENCRYPTED_SD_CARDS_CAN_ONLY_MSG"));
+ info.append("<br><br>");
+ info.append(dgetText("IDS_ST_BODY_ONCE_THE_SD_CARD_IS_ENCRYPTED_A_PASSWORD_IS_REQUIRED_TO_USE_IT_THE_SAME_PASSWORD_MUST_MSG"));
+
+ content->setText("msg_content", info);
+}
+
+EncryptSDCardCheck::EncryptSDCardCheck(Widget *parent)
+ : Page(parent, "external_check_status", Page::Type::SetTwoButton),
+ genlist(nullptr),
+ createButton(content.get()),
+ changeButton(content.get()),
+ deleteButton(content.get()),
+ password(nullptr),
+ vconf(VCONFKEY_SYSMAN_MMC_STATUS),
+ mmcStatus(false), pwdStatus(false),
+ groupIndex(dgetText("IDS_ST_BODY_TO_ENCRYPT_YOUR_SD_CARD_C"))
+{
+ vconf.addChangedCallback();
+ vconf.onKeyChanged.connect(this, &EncryptSDCardCheck::checkMMCStatus);
+ setPartContent();
+}
+
+EncryptSDCardCheck::~EncryptSDCardCheck()
+{
+ vconf.removeChangedCallback();
+}
+
+void EncryptSDCardCheck::updateNextButton()
+{
+ if (mmcStatus && pwdStatus)
+ nextButton->setDisabled(false);
+ else
+ nextButton->setDisabled(true);
+}
+
+char *EncryptSDCardCheck::getLabel(const std::string &part, Evas_Object *obj, std::string *data)
+{
+ if (part == "elm.text") {
+ return ::strdup(dgetText(*data));
+ }
+ return nullptr;
+}
+
+void EncryptSDCardCheck::addItems(Genlist<std::string> *genlist)
+{
+ genlist->append("group_index", &groupIndex);
+}
+
+void EncryptSDCardCheck::setPartContent()
+{
+ checkMMCStatus();
+ passwordResultCallback(0, "");
+
+ std::string info("");
+ info.append(dgetText("IDS_ST_BODY_THE_ENCRYPTION_PROCESS_MAY_TAKE_A_LONG_TIME_DEPENDING_ON_THE_AMOUNT_OF_DATA_MSG"));
+ info.append("</br>");
+ info.append(dgetText("IDS_ST_BODY_MAKE_SURE_THAT_THE_BATTERY_IS_CHARGED_AND_KEEP_THE_PHONE_PLUGGED_IN_UNTIL_ENCRYPTION_IS_COMPLETE"));
+
+ content->setText("msg_content", info);
+
+ genlist.reset(new Genlist<std::string>(content.get(), 0));
+ genlist->setContentProvider(this);
+ content->setContent("group_index", genlist.get());
+
+ info.clear();
+ info.append(dgetText("IDS_ST_BODY_INSERT_THE_SD_CARD_ABB"));
+ content->setPartTableChildText("check_list", 1, 1, "check_text", info);
+
+ info.clear();
+ info.append(dgetText("IDS_ST_BODY_CREATE_AN_SD_CARD_PASSWORD"));
+ content->setPartTableChildText("check_list", 1, 2, "check_text", info);
+
+ createButton.setText(dgetText("IDS_ST_BUTTON_CREATE_PASSWORD"));
+ createButton.setStyle("auto_expand");
+ createButton.onClick = [this](void *) {
+ password.reset(new PasswordCreate(this));
+ password->onResult.connect(this, &EncryptSDCardCheck::passwordResultCallback);
+ password->show();
+ };
+ content->setContent("create_button", &createButton);
+
+ changeButton.setText(dgetText("IDS_ST_BUTTON_CHANGE_PW_ABB"));
+ changeButton.onClick = [this](void *) {
+ password.reset(new PasswordChange(this));
+ password->onResult.connect(this, &EncryptSDCardCheck::passwordResultCallback);
+ password->show();
+ };
+ content->setContent("change_button", &changeButton);
+
+ deleteButton.setText(dgetText("IDS_ST_BUTTON_DELETE_PW_ABB"));
+ deleteButton.onClick = [this](void *) {
+ password.reset(new PasswordDelete(this));
+ password->onResult.connect(this, &EncryptSDCardCheck::passwordResultCallback);
+ password->show();
+ };
+ content->setContent("delete_button", &deleteButton);
+}
+
+void EncryptSDCardCheck::checkMMCStatus()
+{
+ int state = 0;
+ state = vconf.getInt();
+ if (state != VCONFKEY_SYSMAN_MMC_MOUNTED) {
+ mmcStatus = false;
+ content->emitSignal("unchecked,effect", "", "check_list", 1, 1);
+ } else {
+ mmcStatus = true;
+ content->emitSignal("checked,effect", "", "check_list", 1, 1);
+ }
+ updateNextButton();
+}
+
+void EncryptSDCardCheck::passwordResultCallback(int status, const std::string &data)
+{
+ if (!status) {
+ pwdStatus = false;
+ content->emitSignal("unsetpwd,effect", "");
+ content->emitSignal("unchecked,effect", "", "check_list", 1, 2);
+ } else {
+ pwdStatus = true;
+ content->emitSignal("setpwd,effect", "");
+ content->emitSignal("checked,effect", "", "check_list", 1, 2);
+ }
+ updateNextButton();
+}
+
+EncryptSDCardConfirm::EncryptSDCardConfirm(Widget *parent)
+ : Page(parent, "external_confirm", Page::Type::SetTwoButton),
+ genlist(nullptr),
+ radioGroup(nullptr),
+ option(false)
+{
+ setPartContent();
+}
+
+EncryptSDCardConfirm::~EncryptSDCardConfirm()
+{
+ optionList.clear();
+ radioList.clear();
+}
+
+char *EncryptSDCardConfirm::getLabel(const std::string &part, Evas_Object *obj, EncryptSDCardOption *data)
+{
+ if (part == "elm.text") {
+ return ::strdup(dgetText(data->header));
+ } else if (part == "elm.text.multiline") {
+ return ::strdup(dgetText(data->multiline));
+ }
+ return nullptr;
+}
+
+Evas_Object *EncryptSDCardConfirm::getObject(const std::string &part, Evas_Object *obj, EncryptSDCardOption *data)
+{
+ if (data->index < 0) {
+ return nullptr;
+ }
+
+ Radio *radio = new Radio(genlist.get(), radioGroup.get(), data->index);
+ radio->setPropagateEvent(true);
+ radio->setRepeatEvent(true);
+ radio->onChanged.connect(this, &EncryptSDCardConfirm::setOption);
+ radioList.push_back(radio);
+
+ if (part == "elm.swallow.end") {
+ return Widget::evasObject(radio);
+ }
+
+ return nullptr;
+}
+
+void EncryptSDCardConfirm::setOption(int opt)
+{
+ option = opt == 0 ? false : true;
+ Vconf optionVconf(VCONFKEY_SDE_ENCRYPT_NEWFILE);
+ optionVconf.setBool(option);
+}
+
+bool EncryptSDCardConfirm::getOption()
+{
+ return option;
+}
+
+void EncryptSDCardConfirm::addItems(Genlist<EncryptSDCardOption> *genlist)
+{
+ for (EncryptSDCardOption * elem : optionList) {
+ if (elem == optionList[0]) {
+ genlist->append("group_index", elem);
+ } else {
+ genlist->append("multiline", elem).setSelectMode(ELM_OBJECT_SELECT_MODE_NONE);
+ }
+ }
+}
+
+void EncryptSDCardConfirm::setPartContent()
+{
+ nextButton->setText("Encrypt");
+ std::string info("");
+ info.append(dgetText("IDS_ST_BODY_TAP_ENCRYPT_SD_CARD_TO_START_THE_ENCRYPTION_PROCESS"));
+ info.append("</br>");
+ info.append(dgetText("IDS_ST_BODY_ALL_OPEN_FILES_ON_SD_CARD_WILL_BE_CLOSED"));
+ info.append("</br></br>");
+ info.append(dgetText("IDS_ST_BODY_THE_ENCRYPTION_CANT_BE_CANCELLED_AND_DATA_WILL_BE_LOST_IF_THE_PROCESS_IS_INTERRUPTED_DURING_THE_MSG"));
+
+ content->setText("msg_content", info);
+
+ genlist.reset(new Genlist<EncryptSDCardOption>(content.get(), Genlist<EncryptSDCardOption>::Flags::setCompressMode));
+ genlist->setStyle("solid/default");
+
+ radioGroup.reset(new Radio(genlist.get(), nullptr, 0));
+
+ optionList.push_back(new EncryptSDCardOption(dgetText("IDS_ST_HEADER_ENCRYPTION_OPTIONS_ABB"), "", -1));
+ optionList.push_back(new EncryptSDCardOption(dgetText("IDS_ST_MBODY_ENCRYPT_ALL_FILES"),
+ dgetText("IDS_ST_SBODY_ENCRYPT_ALL_FILES_SAVED_ON_THE_SD_CARD_NEW_FILES_WILL_ALSO_BE_ENCRYPTED"),
+ 0));
+ optionList.push_back(new EncryptSDCardOption(dgetText("IDS_ST_MBODY_ENCRYPT_NEW_FILES"),
+ dgetText("IDS_ST_BODY_ENCRYPT_ALL_NEW_FILES_SAVED_ON_THIS_SD_CARD_EXISTING_FILES_WILL_NOT_BE_ENCRYPTED"),
+ 1));
+
+ genlist->setContentProvider(this);
+
+ content->setContent("option_list", genlist.get());
+}
+
+EncryptSDCardInterface::EncryptSDCardInterface()
+ : exitButton(nullptr), infoPage(nullptr), checkPage(nullptr), confirmPage(nullptr), passwordConfirm(nullptr)
+{
+ setNaviframe();
+}
+
+EncryptSDCardInterface::~EncryptSDCardInterface()
+{
+}
+
+void EncryptSDCardInterface::onConfirmed(int result, const std::string &data)
+{
+ if (result == -1) {
+ confirmPage->nextButton->setDisabled(true);
+ checkPage->passwordResultCallback(0, data);
+ } else if (result == 1) {
+ encryption.encrypt(data, confirmPage->getOption());
+ dispose();
+ }
+}
+
+void EncryptSDCardInterface::checkPassword()
+{
+ passwordConfirm.reset(new PasswordConfirm(naviframe));
+ passwordConfirm->onResult.connect(this, &EncryptSDCardInterface::onConfirmed);
+ passwordConfirm->show();
+}
+
+void EncryptSDCardInterface::createConfirmPage()
+{
+ confirmPage.reset(nullptr);
+ confirmPage.reset(new EncryptSDCardConfirm {naviframe});
+ confirmPage->nextButton->onClickSignal.connect(this, &EncryptSDCardInterface::checkPassword);
+ confirmPage->prevButton->onClick = [this](void *) {
+ naviframe->popItem();
+ };
+ naviframe->pushPage(dgetText("IDS_ST_HEADER_ENCRYPT_SD_CARD"), confirmPage.get(), nullptr);
+}
+
+void EncryptSDCardInterface::createCheckPage()
+{
+ checkPage.reset(nullptr);
+ checkPage.reset(new EncryptSDCardCheck {naviframe});
+ checkPage->nextButton->onClickSignal.connect(this, &EncryptSDCardInterface::createConfirmPage);
+ checkPage->prevButton->onClick = [this](void *) {
+ naviframe->popItem();
+ };
+
+ naviframe->pushPage(dgetText("IDS_ST_HEADER_ENCRYPT_SD_CARD"), checkPage.get(), nullptr);
+}
+
+void EncryptSDCardInterface::create()
+{
+ NaviframeItem *item = nullptr;
+
+ exitButton.reset(new Button{naviframe});
+ exitButton->setStyle("naviframe/back_btn/default");
+ exitButton->onClick = [this](void *) {
+ naviframe->popItem();
+ };
+
+ infoPage.reset(new EncryptSDCardInfo {naviframe});
+ infoPage->nextButton->onClickSignal.connect(this, &EncryptSDCardInterface::createCheckPage);
+ item = naviframe->pushPage(dgetText("IDS_ST_HEADER_ENCRYPT_SD_CARD"), infoPage.get(), exitButton.get());
+ item->pagePopEvent.connect(this, &EncryptSDCardInterface::dispose);
+}
+
+void EncryptSDCardInterface::dispose()
+{
+ ::ui_app_exit();
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __ODE_ENCRYPT_SD_CARD_H__
+#define __ODE_ENCRYPT_SD_CARD_H__
+
+#include "../interface.h"
+#include "../tools/vconf.h"
+#include "../tools/encryption.h"
+#include "../../widgets/genlist.h"
+#include "../../widgets/button.h"
+#include "../../widgets/radio.h"
+#include "../external-locktype/password.h"
+
+class EncryptSDCardInfo : public Page {
+public:
+ EncryptSDCardInfo(Widget *parent);
+ ~EncryptSDCardInfo();
+
+ void setPartContent();
+};
+
+class EncryptSDCardCheck : public Page, public GenlistContentProvider<std::string> {
+public:
+ EncryptSDCardCheck(Widget *parent);
+ ~EncryptSDCardCheck();
+
+ void setPartContent();
+ void checkMMCStatus();
+ void passwordResultCallback(int status, const std::string &data);
+ void updateNextButton();
+
+ char *getLabel(const std::string &part, Evas_Object *obj, std::string *data);
+ void addItems(Genlist<std::string> *genlist);
+public:
+ std::unique_ptr<Genlist<std::string>> genlist;
+ Button createButton;
+ Button changeButton;
+ Button deleteButton;
+ std::unique_ptr<PasswordInterface> password;
+
+ Vconf vconf;
+ bool mmcStatus;
+ bool pwdStatus;
+ std::string groupIndex;
+};
+
+struct EncryptSDCardOption {
+public:
+ EncryptSDCardOption(const std::string &h, const std::string &m, int i) : header(h), multiline(m), index(i) {}
+ std::string header;
+ std::string multiline;
+ int index;
+};
+
+class EncryptSDCardConfirm : public Page, public GenlistContentProvider<EncryptSDCardOption> {
+public:
+ EncryptSDCardConfirm(Widget *parent);
+ ~EncryptSDCardConfirm();
+
+ void setPartContent();
+
+ char *getLabel(const std::string &part, Evas_Object *obj, EncryptSDCardOption *data);
+ Evas_Object *getObject(const std::string &part, Evas_Object *obj, EncryptSDCardOption *data);
+ void addItems(Genlist<EncryptSDCardOption> *genlist);
+
+ void setOption(int opt);
+ bool getOption();
+
+public:
+ std::unique_ptr<Genlist<EncryptSDCardOption>> genlist;
+ std::unique_ptr<Radio> radioGroup;
+ bool option;
+
+ std::vector<EncryptSDCardOption *> optionList;
+ std::vector<Radio *> radioList;
+};
+
+class EncryptSDCardInterface : public ODEInterface {
+public:
+ EncryptSDCardInterface();
+ ~EncryptSDCardInterface();
+
+ void create();
+ void dispose();
+
+ void createCheckPage();
+ void createConfirmPage();
+ void onConfirmed(int result, const std::string &data);
+ void checkPassword();
+
+private:
+ std::unique_ptr<Button> exitButton;
+ std::unique_ptr<EncryptSDCardInfo> infoPage;
+ std::unique_ptr<EncryptSDCardCheck> checkPage;
+ std::unique_ptr<EncryptSDCardConfirm> confirmPage;
+ std::unique_ptr<PasswordConfirm> passwordConfirm;
+ ExternalEncryption encryption;
+};
+
+#endif
interface = new DecryptDeviceInterface{};
break;
case Type::ENCRYPT_SD_CARD:
- /* TBD create interface */
+ interface = new EncryptSDCardInterface{};
break;
case Type::DECRYPT_SD_CARD:
- /* TBD create interface */
+ interface = new DecryptSDCardInterface{};
break;
case Type::INSERT_SD_CARD:
/* TBD create interface */
#include "interface/interface.h"
#include "interface/internal/encrypt-device.h"
#include "interface/internal/decrypt-device.h"
+#include "interface/external/encrypt-sdcard.h"
+#include "interface/external/decrypt-sdcard.h"
class ODELaunchPad : public Application {
public: