./src/interface/external/decrypt-sdcard.cpp
./src/interface/external/insert-sdcard.cpp
./src/interface/external/password-sdcard.cpp
+ ./src/interface/external/password-sdcard-extended.cpp
./src/interface/external/encrypt-extension.cpp
./src/interface/external/retry-sdcard.cpp)
#include "insert-sdcard.h"
-InsertSDCardInterface::InsertSDCardInterface()
- : popup(nullptr), appControl("org.tizen.ode"), notification(NOTIFICATION_TYPE_NOTI)
+InsertSDCardInterface::InsertSDCardInterface(AppControl *appData)
+ : popup(nullptr), appControl("org.tizen.ode"), interface(nullptr), notification(NOTIFICATION_TYPE_NOTI), device(""), node("")
{
window->setConfig(Window::Config::SetAlpha);
+ device = appData->getData("dev_path");
+ node = appData->getData("mapping_node");
}
InsertSDCardInterface::~InsertSDCardInterface()
void InsertSDCardInterface::createPasswordSDCard()
{
- passwordSDCard.create();
+ if (device.compare("")) {
+ interface.reset(new PasswordSDCardExtended{device, node});
+ interface->create();
+ } else {
+ interface.reset(new PasswordSDCard{});
+ interface->create();
+ }
}
void InsertSDCardInterface::create()
popup->show();
/* SD Card Encrypted Notification */
- appControl.setData("viewtype", "SD_CARD_PASSWORD");
+ if (device.compare("")) {
+ appControl.setData("viewtype", "SD_CARD_EXTENDED_PASSWORD");
+ appControl.setData("dev_path", device);
+ appControl.setData("mapping_node", node);
+ } else {
+ appControl.setData("viewtype", "SD_CARD_PASSWORD");
+ }
+
notification.setTitle(dgetText("IDS_ST_MBODY_SD_CARD_ENCRYPTED"));
notification.setContentText(dgetText("IDS_ST_SBODY_TAP_HERE_TO_ENTER_PW_FOR_SD_CARD_ABB"));
notification.setAppControl(appControl);
#define __ODE_INSERT_SD_CARD_H__
#include "password-sdcard.h"
+#include "password-sdcard-extended.h"
#include "../interface.h"
#include "../../widgets/popup.h"
#include "../../widgets/appcontrol.h"
class InsertSDCardInterface : public ODEInterface {
public:
- InsertSDCardInterface();
+ InsertSDCardInterface(AppControl *appData);
~InsertSDCardInterface();
void create();
private:
Popup *popup;
AppControl appControl;
- PasswordSDCard passwordSDCard;
+ std::unique_ptr<ODEInterface> interface;
Notification notification;
+ std::string device;
+ std::string node;
};
#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 "password-sdcard-extended.h"
+
+PasswordSDCardExtended::PasswordSDCardExtended(const std::string &device, const std::string &node)
+ : baseLayout(new Layout(window)),
+ passwordConfirm(baseLayout, PasswordInterface::Mode::EXTENSION),
+ devicePath(device),
+ mappingNode(node)
+{
+ window->setContent(baseLayout);
+ window->setConfig(Window::Config::SetAlpha);
+}
+
+PasswordSDCardExtended::~PasswordSDCardExtended()
+{
+ if (baseLayout)
+ delete baseLayout;
+}
+
+void PasswordSDCardExtended::create()
+{
+ passwordConfirm.onResult.connect(this, &PasswordSDCardExtended::onResultCallback);
+ passwordConfirm.show();
+}
+
+void PasswordSDCardExtended::dispose()
+{
+ ::ui_app_exit();
+}
+
+void PasswordSDCardExtended::onResultCallback(int result, const std::string &data)
+{
+ if (result == 1)
+ encryption.mount(devicePath, data, mappingNode);
+ 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.
+ *
+ */
+
+#ifndef __ODE_PASSWORD_SDCARD_EXTENDED_H__
+#define __ODE_PASSWORD_SDCARD_EXTENDED_H__
+
+#include "../interface.h"
+#include "../tools/encryption.h"
+#include "../external-locktype/password.h"
+#include "../../language.h"
+#include "../../widgets/appcontrol.h"
+
+class PasswordSDCardExtended : public ODEInterface {
+public:
+ PasswordSDCardExtended(const std::string &device, const std::string &node);
+ ~PasswordSDCardExtended();
+
+ void create();
+ void dispose();
+ void onResultCallback(int result, const std::string &data);
+private:
+ Layout *baseLayout;
+ PasswordConfirm passwordConfirm;
+ ExtensionEncryption encryption;
+ std::string devicePath;
+ std::string mappingNode;
+};
+
+#endif
PasswordSDCard::PasswordSDCard()
: baseLayout(new Layout(window)),
- passwordConfirm(baseLayout, PasswordInterface::Mode::EXTENSION),
+ passwordConfirm(baseLayout, PasswordInterface::Mode::EXTERNAL),
notification(NOTIFICATION_TYPE_NOTI),
progress(nullptr)
{
return Type::SD_CARD_PASSWORD;
} else if (!type.compare("ENCRYPT_EXTENSION")) {
return Type::ENCRYPT_EXTENSION;
+ } else if (!type.compare("SD_CARD_EXTENDED_PASSWORD")) {
+ return Type::SD_CARD_EXTENDED_PASSWORD;
}
return Type::DO_NOT_SUPPORTED;
interface = new DecryptSDCardInterface{};
break;
case Type::INSERT_SD_CARD:
- interface = new InsertSDCardInterface{};
+ interface = new InsertSDCardInterface{appControl.get()};
break;
case Type::SD_CARD_PASSWORD:
interface = new PasswordSDCard{};
case Type::ENCRYPT_EXTENSION:
interface = new EncryptExtensionInterface{appControl.get()};
break;
+ case Type::SD_CARD_EXTENDED_PASSWORD:
+ interface = new PasswordSDCardExtended{appControl->getData("dev_path"), appControl->getData("mapping_node")};
+ break;
default:
throw runtime::Exception("Do not supported viewtype");
break;
DECRYPT_SD_CARD,
INSERT_SD_CARD,
SD_CARD_PASSWORD,
+ SD_CARD_EXTENDED_PASSWORD,
ENCRYPT_EXTENSION,
DO_NOT_SUPPORTED,
};