--- /dev/null
+Seungmin Yu <so.yu at samsung dot com>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+# Set application name and PKG_ID
+SET(this_target ac-certificate-manager)
+SET(PKG_ID hyCsE05ySM)
+
+# Include directories
+INCLUDE_DIRECTORIES(
+ /usr/include/osp
+ /usr/include/osp/security
+ inc
+)
+
+# Source files
+FILE(GLOB ${this_target}_SOURCE_FILES src/*.cpp)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
+
+# Create executable
+SET(CMAKE_EXECUTABLE_SUFFIX ".exe")
+ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES})
+
+# Set link libraries and link options
+TARGET_LINK_LIBRARIES(${this_target} -pie -L/usr/lib/osp osp-appfw osp-uifw)
+
+# Copy resources
+INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${PKG_ID}/bin)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.Apache-2.0 DESTINATION ../usr/apps/${PKG_ID})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/NOTICE DESTINATION ../usr/apps/${PKG_ID})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/AUTHORS DESTINATION ../usr/apps/${PKG_ID})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/ac-certificate-manager.manifest DESTINATION ../usr/apps/${PKG_ID})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/manifest.xml DESTINATION ../usr/apps/${PKG_ID}/info)
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ../usr/apps/${PKG_ID})
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/shared DESTINATION ../usr/apps/${PKG_ID})
--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
--- /dev/null
+Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.Apache-2.0 file for Apache License terms and conditions.
--- /dev/null
+<manifest>
+ <define>
+ <domain name="ac-certificate-manager"/>
+ </define>
+ <request>
+ <domain name="ac-certificate-manager"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/apps/hyCsE05ySM/bin/ac-certificate-manager.exe" label="ac-certificate-manager" exec_label="ac-certificate-manager"/>
+ <filesystem path="/usr/share/license/ac-certificate-manager" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorApp.h
+ * @brief This is the header file for the %CertificateSelectorApp class.
+ *
+ * This header file contains the declarations of the %CertificateSelectorApp class.
+ */
+
+#ifndef _CERTIFICATE_SELECTOR_APP_H_
+#define _CERTIFICATE_SELECTOR_APP_H_
+
+#include <FAppUiApp.h>
+#include <FSysIScreenEventListener.h>
+#include <FSysPowerManager.h>
+#include <FAppIAppControlProviderEventListener.h>
+
+namespace Tizen { namespace App {
+class AppRegistry;
+} } // Tizen::App
+
+class CertificateSelectorApp
+ : public Tizen::App::UiApp
+ , public Tizen::System::IScreenEventListener
+ , public Tizen::App::IAppControlProviderEventListener
+{
+public:
+ CertificateSelectorApp(void);
+ virtual~CertificateSelectorApp(void);
+
+ static Tizen::App::UiApp* CreateInstance(void);
+
+ virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+ virtual bool OnAppInitialized(void);
+ virtual bool OnAppWillTerminate(void);
+ virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+ virtual void OnForeground(void);
+ virtual void OnBackground(void);
+ virtual void OnLowMemory(void);
+ virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+ virtual void OnScreenOn(void);
+ virtual void OnScreenOff(void);
+ virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData);
+
+private:
+ RequestId __reqId;
+};
+
+#endif // _CERTIFICATE_SELECTOR_APP_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorForm.h
+ * @brief This is the header file for the %CertificateSelectorForm class.
+ *
+ * This header file contains the declarations of the %CertificateSelectorForm class.
+ */
+
+#ifndef _CERTIFICATE_SELECTOR_FORM_H_
+#define _CERTIFICATE_SELECTOR_FORM_H_
+
+#include <unique_ptr.h>
+#include <FBaseDataType.h>
+#include <FUiCtrlForm.h>
+#include <FUiCtrlIFormBackEventListener.h>
+#include <FUiCtrlIListViewItemEventListener.h>
+#include <FUiCtrlIListViewItemProvider.h>
+#include <FUiCtrlListViewTypes.h>
+#include <FUiCtrlListItemBase.h>
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class ListView;
+} } } // Tizen::Ui::Controls
+
+namespace Tizen { namespace Security { namespace Cert
+{
+struct _CertFieldInfos;
+} } } // Tizen::Security::Cert
+
+class CertificateSelectorForm
+ : public Tizen::Ui::Controls::Form
+ , virtual public Tizen::Ui::Controls::IListViewItemProvider
+ , virtual public Tizen::Ui::Controls::IListViewItemEventListener
+ , virtual public Tizen::Ui::Controls::IFormBackEventListener
+{
+
+// Construction
+public:
+ CertificateSelectorForm(void);
+ virtual ~CertificateSelectorForm(void);
+ result Initialize(RequestId reqId);
+
+private:
+ // prevent copy and assignment
+ CertificateSelectorForm(const CertificateSelectorForm& rhs);
+ CertificateSelectorForm& operator =(const CertificateSelectorForm& rhs);
+
+ void Finish(bool isSelected, int certId);
+
+ // Form
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ // IFormBackEventListener
+ virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+ // IListViewItemProvider
+ virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+ virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+ virtual int GetItemCount(void);
+
+ // IListViewItemEventListener
+ virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+ virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+ virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+
+private:
+ int __reqId;
+ int __itemLeftMargin;
+ int __itemHeight;
+ int __certCount;
+ std::unique_ptr<Tizen::Security::Cert::_CertFieldInfos[]> __pCertList;
+ std::unique_ptr<int[]> __pCertIndex;
+};
+
+#endif //_CERTIFICATE_SELECTOR_FORM_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorFrame.h
+ * @brief This is the header file for the %CertificateSelectorFrame class.
+ *
+ * This header file contains the declarations of the %CertificateSelectorFrame class.
+ */
+
+#ifndef _CERTIFICATE_SELECTOR_FRAME_H_
+#define _CERTIFICATE_SELECTOR_FRAME_H_
+
+#include <FBaseDataType.h>
+#include <FUiCtrlFrame.h>
+
+class CertificateSelectorFrame
+ : public Tizen::Ui::Controls::Frame
+{
+public:
+ CertificateSelectorFrame(void);
+ virtual ~CertificateSelectorFrame(void);
+
+ void SetRequestId(RequestId reqId);
+
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+private:
+ RequestId __reqId;
+};
+
+#endif //_CERTIFICATE_SELECTOR_FRAME_H_
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
+ <Id>hyCsE05ySM</Id>
+ <Version>1.0.0</Version>
+ <Type>C++App</Type>
+ <Descriptions/>
+ <Requirements>
+ <Feature Name="http://tizen.org/feature/platform.core.cpu.arch">x86</Feature>
+ <Feature Name="http://tizen.org/feature/platform.core.fpu.arch">vfpv3</Feature>
+ </Requirements>
+ <Apps>
+ <ApiVersion>2.0</ApiVersion>
+ <Privileges/>
+ <UiApp Main="True" MenuIconVisible="True" Name="ac-certificate-manager" SubMode="True">
+ <UiScalability BaseScreenSize="Normal" CoordinateSystem="Logical" LogicalCoordinate="720"/>
+ <UiTheme SystemTheme="White"/>
+ <DisplayNames>
+ <DisplayName Locale="eng-GB">ac-certificate-manager</DisplayName>
+ </DisplayNames>
+ <Icons>
+ <Icon Section="MainMenu" Type="Xhigh">mainmenu.png</Icon>
+ </Icons>
+ <AppControls>
+ <AppControl>
+ <Operation>http://tizen.org/appcontrol/operation/pick</Operation>
+ </AppControl>
+ </AppControls>
+ <LaunchConditions/>
+ <Notifications/>
+ </UiApp>
+ </Apps>
+</Manifest>
--- /dev/null
+Name: ac-certificate-manager
+Summary: The app-control of the certificate manager
+Version: 1.2.1.0
+Release: 1
+Group: TO_BE/FILLED_IN
+License: Apache License, Version 2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(osp-appfw)
+BuildRequires: osp-appfw-internal-devel
+BuildRequires: pkgconfig(osp-uifw)
+
+Requires: chromium
+Requires: osp-security-service
+Requires: osp-installer
+Requires: pkgcmd
+
+%description
+The app-control of the certificate manager
+
+%prep
+%setup -q
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%ifarch %{ix86}
+CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%else
+CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%endif
+
+# Call make instruction with smp support
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE.Apache-2.0 %{buildroot}/usr/share/license/%{name}
+
+%make_install
+
+%post
+/sbin/ldconfig
+PKG_ID=hyCsE05ySM
+pkgcmd -q -i -t tpk -p /usr/apps/${PKG_ID}
+
+%postun
+/sbin/ldconfig
+PKG_ID=hyCsE05ySM
+pkgcmd -q -u -t tpk -n ${PKG_ID}
+
+%files
+%manifest ac-certificate-manager.manifest
+%defattr(-,root,root,-)
+/usr/share/license/%{name}
+/usr/apps/*
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorApp.cpp
+ * @brief This is the implementation for the %CertificateSelectorApp class.
+ */
+
+#include <unique_ptr.h>
+#include <FAppAppRegistry.h>
+#include <FAppAppControlProviderManager.h>
+#include <FBaseLog.h>
+#include "CertificateSelectorFrame.h"
+#include "CertificateSelectorApp.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+CertificateSelectorApp::CertificateSelectorApp(void)
+ : __reqId(-1)
+{
+}
+
+CertificateSelectorApp::~CertificateSelectorApp(void)
+{
+}
+
+UiApp*
+CertificateSelectorApp::CreateInstance(void)
+{
+ return new CertificateSelectorApp();
+}
+
+bool
+CertificateSelectorApp::OnAppInitializing(AppRegistry& appRegistry)
+{
+ result r = E_SUCCESS;
+
+ r = Tizen::App::AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this);
+ return true;
+}
+
+bool
+CertificateSelectorApp::OnAppInitialized(void)
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr<CertificateSelectorFrame> pCertificateSelectorFrame(new (std::nothrow) CertificateSelectorFrame());
+ TryReturnResult(pCertificateSelectorFrame, false, E_OUT_OF_MEMORY
+ , "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pCertificateSelectorFrame->Construct();
+ TryReturnResult(!IsFailed(r), false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pCertificateSelectorFrame->SetName(L"CertificateSelector");
+
+ AppAssertf(__reqId > -1, "The request ID is invalid.");
+ pCertificateSelectorFrame->SetRequestId(__reqId);
+
+ r = AddFrame(*(pCertificateSelectorFrame.release()));
+ TryReturnResult(!IsFailed(r), false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return true;
+}
+
+bool
+CertificateSelectorApp::OnAppWillTerminate(void)
+{
+ return true;
+}
+
+
+bool
+CertificateSelectorApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+ return true;
+}
+
+void
+CertificateSelectorApp::OnForeground(void)
+{
+}
+
+void
+CertificateSelectorApp::OnBackground(void)
+{
+}
+
+void
+CertificateSelectorApp::OnLowMemory(void)
+{
+}
+
+void
+CertificateSelectorApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+}
+
+void
+CertificateSelectorApp::OnScreenOn(void)
+{
+}
+
+void
+CertificateSelectorApp::OnScreenOff(void)
+{
+}
+
+void
+CertificateSelectorApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData)
+{
+ AppLog("The current value of the request ID is %d.", reqId);
+ __reqId = reqId;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorEntry.cpp
+ * @brief This is the implementation for the %CertificateSelectorEntry class.
+ */
+
+#include <FBaseColArrayList.h>
+#include <FBaseDataType.h>
+#include <FBaseErrorDefine.h>
+#include "CertificateSelectorApp.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+_EXPORT_ int
+OspMain(int argc, char *pArgv[])
+{
+ AppLog("Application started.");
+ ArrayList args(SingleObjectDeleter);
+ args.Construct();
+ for (int i = 0; i < argc; i++)
+ {
+ args.Add(new (std::nothrow) String(pArgv[i]));
+ }
+
+ result r = Tizen::App::UiApp::Execute(CertificateSelectorApp::CreateInstance, &args);
+ TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r));
+ AppLog("Application finished.");
+
+ return static_cast<int>(r);
+}
+#ifdef __cplusplus
+}
+#endif // __cplusplus
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorForm.cpp
+ * @brief This is the implementation for the %CertificateSelectorForm class.
+ */
+
+#include <unique_ptr.h>
+#include <FAppUiApp.h>
+#include <FAppAppControlProviderManager.h>
+#include <FBaseDataType.h>
+#include <FBaseErrors.h>
+#include <FBaseString.h>
+#include <FBaseLog.h>
+#include <FBaseColHashMap.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiCtrlCustomItem.h>
+#include <FUiCtrlFooter.h>
+#include <FUiCtrlForm.h>
+#include <FUiCtrlFooter.h>
+#include <FUiCtrlListItemBase.h>
+#include <FUiCtrlListView.h>
+#include <FSecCert_CertService.h>
+#include <FSecCert_CertTypes.h>
+#include "CertificateSelectorForm.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Graphics;
+using namespace Tizen::Security::Cert;
+
+static const int HD_RESOLUTION_WIDTH = 720;
+static const int ITEM_HEIGHT = 112; // in 720X1280px resolution
+static const int ITEM_LEFT_MARGIN = 26; // in 720X1280px resolution
+static const wchar_t EMPTY_LIST_STRING[] = L"No Certificate";
+static const wchar_t TITLE_STRING[] = L"USER CERTIFICATES";
+
+CertificateSelectorForm::CertificateSelectorForm(void)
+ : __reqId(-1)
+ , __itemLeftMargin(ITEM_LEFT_MARGIN)
+ , __itemHeight(ITEM_HEIGHT)
+ , __certCount(0)
+ , __pCertList(null)
+ , __pCertIndex(null)
+{
+}
+
+CertificateSelectorForm::~CertificateSelectorForm(void)
+{
+}
+
+void
+CertificateSelectorForm::Finish(bool isSelected, int certId)
+{
+ result r = E_SUCCESS;
+
+ AppLog("The current value of certId is %d.", certId);
+
+ UiApp* pApp = UiApp::GetInstance();
+ AppAssert(pApp);
+
+ std::unique_ptr<HashMap, AllElementsDeleter> pMap(new (std::nothrow) HashMap());
+ TryCatchResult(pMap != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ r = pMap->Construct(2);
+ TryCatchResult(!IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (isSelected)
+ {
+ AppLog("The current value of isSelected is true.");
+ TryCatchResult(certId >= 0, , E_INVALID_ARG, "[%s] Invalid Certificate ID.", GetErrorMessage(E_INVALID_ARG));
+
+ pMap->Add(new (std::nothrow) String(L"Id"), new (std::nothrow) String(Integer(certId).ToString()));
+ TryCatchResult(!IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ // send result
+ AppControlProviderManager::GetInstance()->SendAppControlResult(__reqId, APP_CTRL_RESULT_SUCCEEDED, pMap.release());
+ }
+ else
+ {
+ AppLog("The current value of isSelected is false.");
+
+ // send result
+ AppControlProviderManager::GetInstance()->SendAppControlResult(__reqId, APP_CTRL_RESULT_CANCELED, null);
+ }
+
+ pApp->Terminate();
+ return;
+
+CATCH:
+ AppControlProviderManager::GetInstance()->SendAppControlResult(__reqId, APP_CTRL_RESULT_FAILED, null);
+ pApp->Terminate();
+}
+
+result
+CertificateSelectorForm::Initialize(RequestId reqId)
+{
+ result r = E_SUCCESS;
+
+ r = Construct(FORM_STYLE_INDICATOR | FORM_STYLE_TITLE | FORM_STYLE_FOOTER);
+ TryReturnResult(!IsFailed(r), E_SYSTEM, E_SYSTEM, "[%s] Failed to construct CertificateSelectorForm.", GetErrorMessage(E_SYSTEM));
+
+ __reqId = reqId;
+
+ return r;
+}
+
+result
+CertificateSelectorForm::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ int count = 0;
+ int certCount = 0;
+ int invalidCount = 0;
+ Footer* pFooter = null;
+
+ r = SetTitleText(TITLE_STRING, ALIGNMENT_LEFT);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ // footer
+ pFooter = GetFooter();
+ TryReturnResult(pFooter != null, E_SYSTEM, E_SYSTEM, "[%s] Footer instance is not available.", GetErrorMessage(E_SYSTEM));
+
+ r = pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pFooter->SetBackButton();
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ SetFormBackEventListener(this);
+
+ // load user certificates
+ _CertFieldInfos* pRawCertList = null;
+ certCount = _CertService::GetUserCertFieldInfoN(pRawCertList);
+ r = GetLastResult();
+ std::unique_ptr<_CertFieldInfos[]> pCertList(pRawCertList);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ // trivial condition
+ AppAssertf(((certCount > 0) && (pCertList != null)) || ((certCount == 0) && (pCertList == null))
+ , "A system error has been occurred. Because invalid cert count was returned.");
+
+ // cert index : count only for valid certificate
+ std::unique_ptr<int[]> pCertIndex(new (std::nothrow) int[certCount]);
+ TryReturnResult(pCertIndex != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ // assign number of certificate which is valid(certTitle or subjectName must be exist)
+ for (count = 0; count < certCount; count++)
+ {
+ if (!pCertList[count].certTitle[0] && !pCertList[count].subjectName[0])
+ {
+ invalidCount++;
+ continue;
+ }
+ pCertIndex[count - invalidCount] = count;
+ }
+ __certCount = certCount - invalidCount;
+
+ // listview
+ std::unique_ptr<ListView> pListView(new (std::nothrow) ListView());
+ TryReturnResult(pListView != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (__itemHeight == ITEM_HEIGHT && __itemLeftMargin == ITEM_LEFT_MARGIN)
+ {
+ double ratio = 1.0;
+ double logicalWidth = HD_RESOLUTION_WIDTH;
+ Dimension tempDim = CoordinateSystem::GetLogicalResolution();
+ logicalWidth = tempDim.width;
+ AppAssertf(logicalWidth > 0.0, "invalid logical resolution (%lf)", logicalWidth);
+
+ ratio = logicalWidth / HD_RESOLUTION_WIDTH;
+
+ // __itemHeight : 112 = logicalWidth : HD_RESOLUTION_WIDTH(720)
+ __itemHeight = static_cast<int>(__itemHeight * ratio);
+
+ // __itemLeftMargin : 26 = logicalWidth : HD_RESOLUTION_WIDTH(720)
+ __itemLeftMargin = static_cast<int>(__itemLeftMargin * ratio);
+ }
+
+ Rectangle rect(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height);
+ r = pListView->Construct(rect, true, false);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pListView->SetItemProvider(*this);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pListView->SetTextOfEmptyList(EMPTY_LIST_STRING);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pListView->AddListViewItemEventListener(*this);
+
+ r = AddControl(*(pListView.release()));
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pCertIndex = std::move(pCertIndex);
+ __pCertList = std::move(pCertList);
+
+ return r;
+}
+
+result
+CertificateSelectorForm::OnTerminating(void)
+{
+ return E_SUCCESS;
+}
+
+// IFormBackEventListener
+void
+CertificateSelectorForm::OnFormBackRequested(Form& source)
+{
+ Finish(false, -1);
+}
+
+// IListViewItemProvider
+ListItemBase*
+CertificateSelectorForm::CreateItem(int index, int itemWidth)
+{
+ result r = E_SUCCESS;
+ int validIndex = 0;
+ ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+
+ Rectangle rect(__itemLeftMargin, 0, itemWidth - (__itemLeftMargin * 2), __itemHeight);
+ Dimension dim(itemWidth, __itemHeight);
+
+ AppLog("The current value of index is %d", index);
+
+ // convert to valid index
+ AppAssertf((index >= 0) && (index < __certCount), "index (%d) is out of range.", index);
+ AppAssertf(__pCertIndex != null, "__pCertIndex instance must not be null.");
+ validIndex = __pCertIndex[index];
+ AppLog("The current value of validIndex is %d", validIndex);
+
+ // make item
+ std::unique_ptr<CustomItem> pItem(new (std::nothrow) CustomItem());
+ TryReturnResult(pItem != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pItem->Construct(dim, style);
+ TryReturnResult(!IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ // prevent overflow
+ __pCertList[validIndex].certTitle[_MAX_ISSUER_SUBJECT_NAME_SIZE] = '\0';
+ __pCertList[validIndex].subjectName[_MAX_ISSUER_SUBJECT_NAME_SIZE] = '\0';
+
+ AppLog("The current value of certFileId is %d", __pCertList[validIndex].certFileId);
+
+ // add to item, certFileId become elementId
+ if (__pCertList[validIndex].certTitle[0])
+ { // it has valid certTitle
+ AppLog("The current value of certTitle is %s", __pCertList[validIndex].certTitle);
+ r = pItem->AddElement(rect, __pCertList[validIndex].certFileId, __pCertList[validIndex].certTitle);
+ TryReturnResult(!IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ { // it is not reached because it already checked by OnInitializing method.
+ AppAssertf(__pCertList[validIndex].subjectName[0], "_CertFieldInfos instance must not be null.");
+
+ // it has valid subjectName
+ AppLog("The current value of subjectName is %s", __pCertList[validIndex].subjectName);
+ r = pItem->AddElement(rect, __pCertList[validIndex].certFileId, __pCertList[validIndex].subjectName);
+ TryReturnResult(!IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return pItem.release();
+}
+
+bool
+CertificateSelectorForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
+{
+ delete pItem;
+ return true;
+}
+
+int
+CertificateSelectorForm::GetItemCount(void)
+{
+ AppLog("The current value of __certCount is %d", __certCount);
+ return __certCount;
+}
+
+// IListViewItemEventListener
+void
+CertificateSelectorForm::OnListViewItemStateChanged(ListView &listView, int index, int elementId, ListItemStatus status)
+{
+ AppLog("The current value of elementId(certFileId) is %d", elementId);
+ Finish(true, elementId);
+}
+
+void
+CertificateSelectorForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
+{
+}
+
+void
+CertificateSelectorForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
+{
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+
+/**
+ * @file CertificateSelectorFrame.cpp
+ * @brief This is the implementation for the %CertificateSelectorFrame class.
+ */
+
+#include <unique_ptr.h>
+#include "CertificateSelectorForm.h"
+#include "CertificateSelectorFrame.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+CertificateSelectorFrame::CertificateSelectorFrame(void)
+ : __reqId(-1)
+{
+}
+
+CertificateSelectorFrame::~CertificateSelectorFrame(void)
+{
+}
+
+void
+CertificateSelectorFrame::SetRequestId(RequestId reqId)
+{
+ __reqId = reqId;
+}
+
+result
+CertificateSelectorFrame::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+ Form* pForm = null;
+
+ std::unique_ptr<CertificateSelectorForm> pCertificateSelectorForm(new (std::nothrow) CertificateSelectorForm());
+ TryReturnResult(pCertificateSelectorForm, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY
+ , "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ AppAssertf(__reqId > -1, "The request ID is invalid.");
+ r = pCertificateSelectorForm->Initialize(__reqId);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pForm = pCertificateSelectorForm.release();
+
+ r = AddControl(*pForm);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = SetCurrentForm(*pForm);
+ TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pForm->Invalidate(true);
+
+ return r;
+}
+
+result
+CertificateSelectorFrame::OnTerminating(void)
+{
+ return E_SUCCESS;
+}
+
+