Tizen 2.0 Release 2.0_release
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 06:10:38 +0000 (15:10 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 06:10:38 +0000 (15:10 +0900)
34 files changed:
LICENSE.Flora [new file with mode: 0644]
NOTICE [new file with mode: 0644]
description.xml [new file with mode: 0644]
project/data/nofile.dummy [new file with mode: 0644]
project/inc/DbForm.h [new file with mode: 0644]
project/inc/Dictionary.h [new file with mode: 0644]
project/inc/DictionaryData.h [new file with mode: 0644]
project/inc/FileForm.h [new file with mode: 0644]
project/inc/FormFactory.h [new file with mode: 0644]
project/inc/RegForm.h [new file with mode: 0644]
project/inc/SecureDbForm.h [new file with mode: 0644]
project/inc/SecureFileForm.h [new file with mode: 0644]
project/inc/SecureRegForm.h [new file with mode: 0644]
project/inc/SelectDictionaryForm.h [new file with mode: 0644]
project/inc/ViewDescriptForm.h [new file with mode: 0644]
project/manifest.xml [new file with mode: 0644]
project/res/screen-density-xhigh/nofile.dummy [new file with mode: 0644]
project/shared/data/nofile.dummy [new file with mode: 0644]
project/shared/res/screen-density-xhigh/mainmenu.png [new file with mode: 0755]
project/shared/trusted/nofile.dummy [new file with mode: 0644]
project/src/DbForm.cpp [new file with mode: 0644]
project/src/Dictionary.cpp [new file with mode: 0644]
project/src/DictionaryData.cpp [new file with mode: 0644]
project/src/DictionaryEntry.cpp [new file with mode: 0644]
project/src/FileForm.cpp [new file with mode: 0644]
project/src/FormFactory.cpp [new file with mode: 0644]
project/src/RegForm.cpp [new file with mode: 0644]
project/src/SecureDbForm.cpp [new file with mode: 0644]
project/src/SecureFileForm.cpp [new file with mode: 0644]
project/src/SecureRegForm.cpp [new file with mode: 0644]
project/src/SelectDictionaryForm.cpp [new file with mode: 0644]
project/src/ViewDescriptForm.cpp [new file with mode: 0644]
sample.xml [new file with mode: 0644]
screenshot.png [new file with mode: 0755]

diff --git a/LICENSE.Flora b/LICENSE.Flora
new file mode 100644 (file)
index 0000000..9c95663
--- /dev/null
@@ -0,0 +1,206 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+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.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Compatibility Definition Document
+and passes the Compatibility Test Suite as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+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
+solely as incorporated into a Tizen Certified Platform, 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 solely
+as incorporated into a Tizen Certified Platform 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 pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works
+     a copy of this License; and
+  2. You must cause any modified files to carry prominent notices stating
+     that You changed the files; and
+  3. 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
+  4. 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 Flora License to your work
+
+To apply the Flora 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 Flora License, Version 1.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://floralicense.org/license/
+
+   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.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..f37f329
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,4 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE.Flora file for Flora License terms and conditions.
+
diff --git a/description.xml b/description.xml
new file mode 100644 (file)
index 0000000..5b96f13
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<?xml-stylesheet type="text/xsl" href="../../../../description.xsl"?>
+
+<Overview version="0.17.1">
+  <SampleName> Dictionary </SampleName>
+  <SampleVersion>1.0</SampleVersion>
+  <Preview>screenshot.png</Preview>
+  <Description>
+    This sample application demonstrates how to use File, Database, and Registry class in Tizen::Io namespace.
+  </Description>
+</Overview>
diff --git a/project/data/nofile.dummy b/project/data/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/inc/DbForm.h b/project/inc/DbForm.h
new file mode 100644 (file)
index 0000000..ec20e2a
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _DB_FORM_H_
+#define _DB_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class DbForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+       DbForm(void);
+       virtual ~DbForm(void);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // 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) {}
+
+       //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);
+
+       bool CreateDictionary(void);
+       bool LoadDictionary(void);
+
+
+private:
+       Tizen::Base::Collection::HashMap __map;
+       Tizen::Base::String __dbPath;
+
+};
+
+#endif // _DB_FORM_H_
diff --git a/project/inc/Dictionary.h b/project/inc/Dictionary.h
new file mode 100644 (file)
index 0000000..1c307f3
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _DICTIONARY_H_
+#define _DICTIONARY_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FSystem.h>
+
+//[Dictionary] application must inherit from Application class
+//which provides basic features necessary to define an application.
+class Dictionary
+       : public Tizen::App::UiApp
+       , public Tizen::System::IScreenEventListener
+{
+public:
+       // [Dictionary] application must have a factory method that creates an instance of itself.
+
+public:
+       Dictionary(void);
+       ~Dictionary(void);
+
+public:
+       static Tizen::App::Application* CreateInstance(void);
+
+public:
+       //Called when the application is initializing.
+       bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+
+       // Called when the application is terminating.
+       bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination);
+
+       // Called when the application's frame moves to the top of the screen.
+       void OnForeground(void);
+
+       //Called when this application's frame is moved from top of the screen to the background.
+       void OnBackground(void);
+
+       //Called when the system memory is not sufficient to run the application any further.
+       void OnLowMemory(void);
+
+       // Called when the battery level changes.
+       void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+
+       //      Called when the screen turns on.
+       void OnScreenOn(void);
+
+       //      Called when the screen turns off.
+       void OnScreenOff(void);
+
+};
+
+#endif // _DICTIONARY_H_
diff --git a/project/inc/DictionaryData.h b/project/inc/DictionaryData.h
new file mode 100644 (file)
index 0000000..a4d926b
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 DICTIONARYDATA_H_
+#define DICTIONARYDATA_H_
+
+#include <FBaseCol.h>
+
+class DictionaryData {
+public:
+       static DictionaryData* GetInstance(void);
+
+       Tizen::Base::Collection::Queue* GetData(void);
+
+private:
+       DictionaryData();
+       virtual ~DictionaryData();
+
+       Tizen::Base::Collection::Queue* __pData;
+};
+
+#endif /* DICTIONARYDATA_H_ */
diff --git a/project/inc/FileForm.h b/project/inc/FileForm.h
new file mode 100644 (file)
index 0000000..aaaa653
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _FILE_FORM_H_
+#define _FILE_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class FileForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+       FileForm(void);
+       virtual ~FileForm(void);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // 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) {}
+
+       //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);
+
+       bool WriteFile(const Tizen::Base::String& strFilePath, const Tizen::Base::String& strFileContents);
+       bool ReadFile(const Tizen::Base::String& strFilePath, Tizen::Base::String& strFileContents);
+       bool LoadDictionary(void);
+
+private:
+       Tizen::Base::Collection::ArrayList __arrDescription;
+       Tizen::Base::Collection::LinkedList __lnkWord;
+       Tizen::Base::Collection::IEnumerator* __pEnumLnkWord;
+};
+
+#endif // _FILE_FORM_H_
diff --git a/project/inc/FormFactory.h b/project/inc/FormFactory.h
new file mode 100644 (file)
index 0000000..5495540
--- /dev/null
@@ -0,0 +1,32 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 FORMFACTORY_H_
+#define FORMFACTORY_H_
+
+#include <FUiScenesIFormFactory.h>
+
+class FormFactory: public Tizen::Ui::Scenes::IFormFactory {
+public:
+       FormFactory();
+       virtual ~FormFactory();
+
+       virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String &formId, const Tizen::Ui::Scenes::SceneId &sceneId);
+};
+
+#endif /* FORMFACTORY_H_ */
+
diff --git a/project/inc/RegForm.h b/project/inc/RegForm.h
new file mode 100644 (file)
index 0000000..6aad176
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _REG_FORM_H_
+#define _REG_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+#include <FIo.h>
+
+class RegForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+       RegForm(void);
+       virtual ~RegForm(void);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // 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) {}
+
+       //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);
+
+       bool AddRegistryData(Tizen::Io::Registry& reg);
+       bool LoadDictionary(void);
+
+
+private:
+       Tizen::Base::Collection::HashMap __map;
+};
+
+#endif // _REG_FORM_H_
diff --git a/project/inc/SecureDbForm.h b/project/inc/SecureDbForm.h
new file mode 100644 (file)
index 0000000..cfe6b39
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _SECURE_DB_FORM_H_
+#define _SECURE_DB_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class SecureDbForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+       SecureDbForm(void);
+       virtual ~SecureDbForm(void);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // 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) {}
+
+       //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);
+
+       bool CreateDictionary(void);
+       bool LoadDictionary(void);
+
+
+private:
+       Tizen::Base::Collection::HashMap __map;
+       Tizen::Base::String __secureDbPath;
+       Tizen::Base::ByteBuffer __key;
+       bool __encryption;
+};
+
+#endif // _SECURE_DB_FORM_H_
diff --git a/project/inc/SecureFileForm.h b/project/inc/SecureFileForm.h
new file mode 100644 (file)
index 0000000..c03489c
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _SECURE_FILE_FORM_H_
+#define _SECURE_FILE_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class SecureFileForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+       SecureFileForm(void);
+       virtual ~SecureFileForm(void);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // 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) {}
+
+       //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);
+
+       bool WriteFile(const Tizen::Base::String& strFilePath, const Tizen::Base::String& strFileContents);
+       bool ReadFile(const Tizen::Base::String& strFilePath, Tizen::Base::String& strFileContents);
+       bool LoadDictionary(void);
+
+private:
+       Tizen::Base::Collection::ArrayList __arrDescription;
+       Tizen::Base::Collection::LinkedList __lnkWord;
+       Tizen::Base::Collection::IEnumerator* __pEnumLnkWord;
+    Tizen::Base::ByteBuffer __key;
+};
+
+#endif // _SECURE_FILE_FORM_H_
diff --git a/project/inc/SecureRegForm.h b/project/inc/SecureRegForm.h
new file mode 100644 (file)
index 0000000..6ef2688
--- /dev/null
@@ -0,0 +1,60 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _SECURE_REG_FORM_H_
+#define _SECURE_REG_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+#include <FIo.h>
+
+class SecureRegForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Controls::IListViewItemProvider
+{
+public:
+       SecureRegForm(void);
+       virtual ~SecureRegForm(void);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // 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) {}
+
+       //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);
+
+       bool AddRegistryData(Tizen::Io::Registry& reg);
+       bool LoadDictionary(void);
+
+
+private:
+       Tizen::Base::Collection::HashMap __map;
+    Tizen::Base::ByteBuffer __key;
+};
+
+#endif // _SECURE_REG_FORM_H_
diff --git a/project/inc/SelectDictionaryForm.h b/project/inc/SelectDictionaryForm.h
new file mode 100644 (file)
index 0000000..6bafde6
--- /dev/null
@@ -0,0 +1,65 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _SELECT_DICTIONARY_FORM_H_
+#define _SELECT_DICTIONARY_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class SelectDictionaryForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::IActionEventListener
+       , public Tizen::Ui::Controls::IFormBackEventListener
+{
+public:
+       SelectDictionaryForm(void);
+       virtual ~SelectDictionaryForm(void);
+
+       bool Initialize(void);
+
+       result OnInitializing(void);
+
+       // Overridables
+       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       void CreatePlainIOPanel(void);
+       void CreateSecureIOPanel(void);
+
+public:
+       static const int ID_HEADER_ITEM1 = 101;
+       static const int ID_HEADER_ITEM2 = 102;
+
+       enum
+       {
+               SELECT_NONE = 0,
+               SELECT_DATABASE,
+               SELECT_FILE,
+               SELECT_REGISTRY,
+               SELECT_SECURE_DATABASE,
+               SELECT_SECURE_FILE,
+               SELECT_SECURE_REGISTRY,
+       };
+
+
+private:
+       Tizen::Ui::Controls::Panel* __pPlainIoPanel;
+       Tizen::Ui::Controls::Panel* __pSecureIoPanel;
+};
+
+#endif // _SELECT_DICTIONARY_FORM_H_
diff --git a/project/inc/ViewDescriptForm.h b/project/inc/ViewDescriptForm.h
new file mode 100644 (file)
index 0000000..b758d1d
--- /dev/null
@@ -0,0 +1,57 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 _VIEW_DESCRIPT_FORM_H_
+#define _VIEW_DESCRIPT_FORM_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+class ViewDescriptForm
+       : public Tizen::Ui::Controls::Form
+       , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IListViewItemEventListener
+       , public Tizen::Ui::Scenes::ISceneEventListener
+{
+public:
+       ViewDescriptForm(void);
+       virtual ~ViewDescriptForm(void);
+       result Construct(Tizen::Base::String* pstr);
+
+       bool Initialize(void);
+
+       virtual result OnInitializing(void);
+
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       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) {}
+
+       // ISceneEventListener
+       virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
+                                                                  const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
+       virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
+                                                                       const Tizen::Ui::Scenes::SceneId& nextSceneId);
+
+
+
+private:
+       Tizen::Base::String __strDescription;
+};
+
+#endif // _VIEW_DESCRIPT_FORM_H_
diff --git a/project/manifest.xml b/project/manifest.xml
new file mode 100644 (file)
index 0000000..069e995
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
+       <Id>$(manifestAppId)</Id>
+       <Version>2.0.0</Version>
+       <Type>C++App</Type>
+       <Author/>
+       <Descriptions>
+               <Description Locale="eng-GB">database, file, registry io test sample</Description>
+       </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="$(projectName)">
+                       <UiScalability BaseScreenSize="Normal" CoordinateSystem="Logical" LogicalCoordinate="720" />
+                       <UiTheme SystemTheme="White"/>
+                       <DisplayNames>
+                               <DisplayName Locale="eng-GB">$(projectName)</DisplayName>
+                       </DisplayNames>
+                       <Icons>
+                               <Icon Section="MainMenu" Type="Xhigh">mainmenu.png</Icon>
+                       </Icons>
+                       <LaunchConditions/>
+                       <Notifications/>
+               </UiApp>
+       </Apps>
+</Manifest>
diff --git a/project/res/screen-density-xhigh/nofile.dummy b/project/res/screen-density-xhigh/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/shared/data/nofile.dummy b/project/shared/data/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/shared/res/screen-density-xhigh/mainmenu.png b/project/shared/res/screen-density-xhigh/mainmenu.png
new file mode 100755 (executable)
index 0000000..983c883
Binary files /dev/null and b/project/shared/res/screen-density-xhigh/mainmenu.png differ
diff --git a/project/shared/trusted/nofile.dummy b/project/shared/trusted/nofile.dummy
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/project/src/DbForm.cpp b/project/src/DbForm.cpp
new file mode 100644 (file)
index 0000000..4a97b78
--- /dev/null
@@ -0,0 +1,305 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "DbForm.h"
+#include "ViewDescriptForm.h"
+#include "DictionaryData.h"
+
+#include <FApp.h>
+#include <FIo.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+
+DbForm::DbForm(void)
+{
+       __dbPath = App::GetInstance()->GetAppDataPath() + L"SampleDic.db";
+}
+
+DbForm::~DbForm(void)
+{
+       __map.RemoveAll(true);
+}
+
+bool
+DbForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       if (LoadDictionary() == false)
+       {
+               return false;
+       }
+
+       return true;
+
+}
+
+result
+DbForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       SetFormBackEventListener(this);
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"LIST OF WORDS");
+
+       ListView* pListView = new ListView();
+       pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, false);
+
+       pListView->SetItemProvider(*this);
+       pListView->AddListViewItemEventListener(*this);
+
+       AddControl(*pListView);
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+DbForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+void
+DbForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+       Database database;
+       DbEnumerator* pEnum;
+
+       String sql;
+       String statement;
+       String stringItem;
+
+       result r = E_SUCCESS;
+
+       r = database.Construct(__dbPath, "r");
+       if (IsFailed(r))
+       {
+               MessageBox myMSGBox;
+               myMSGBox.Construct(L"database open", L"database not founded", MSGBOX_STYLE_OK, 0);
+
+               // Call ShowAndWait
+               int modalResult = 0;
+               myMSGBox.ShowAndWait(modalResult);  //ShowAndWait() draw, show itself and process events
+               return;
+       }
+
+       sql.Format(1024, L"select WORD, WORD_DESC from MyDictionary where WORD='%ls'"
+                         , (dynamic_cast< String* >(__map.GetValue(Integer(index)))->GetPointer()));
+
+       pEnum = database.QueryN(sql);
+       if (pEnum == null)
+       {
+               MessageBox myMSGBox;
+               myMSGBox.Construct(L"select word description", L"word description not found", MSGBOX_STYLE_OK, 0);
+
+               // Call ShowAndWait
+               int modalResult = 0;
+               myMSGBox.ShowAndWait(modalResult);  //ShowAndWait() draw, show itself and process events
+               return;
+       }
+
+       String strWord;
+       String strWordDescription;
+
+       if (pEnum->MoveNext() == E_SUCCESS)
+       {
+               pEnum->GetStringAt(0, strWord);
+               pEnum->GetStringAt(1, strWordDescription);
+       }
+
+       delete pEnum;
+
+       LinkedList* pList = new LinkedList();
+       pList->Add(*(new String(strWordDescription)));
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(L"ViewDescriptScene"), pList);
+}
+
+int
+DbForm::GetItemCount(void)
+{
+       int itemCount = 0;
+       IList* pList = __map.GetKeysN();
+       AppAssert(pList);
+
+       itemCount = pList->GetCount();
+
+       delete pList;
+
+       return itemCount;
+}
+
+Tizen::Ui::Controls::ListItemBase*
+DbForm::CreateItem(int index, int itemWidth)
+{
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+
+       CustomItem* pItem = new (std::nothrow) CustomItem();
+       TryReturn(pItem != null, null, "Out of memory");
+
+       pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+
+       String* pStr = dynamic_cast< String* >(__map.GetValue(Integer(index)));
+       pItem->AddElement(Rectangle(26, 32, 200, 50), 0, *pStr, false);
+
+       return pItem;
+}
+
+bool
+DbForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+       return true;
+}
+
+bool
+DbForm::CreateDictionary(void)
+{
+       Database database;
+       DbStatement* pStmt = null;
+       DbEnumerator* pEnum = null;
+
+       String sql;
+       String statement;
+
+       result r = E_SUCCESS;
+
+       r = database.Construct(__dbPath, "a+");
+
+       if (IsFailed(r))
+       {
+               if (Database::Exists(__dbPath))
+               {
+                       Database::Delete(__dbPath);
+               }
+               return false;
+       }
+
+       // create database table
+       sql.Append(L"CREATE TABLE IF NOT EXISTS MyDictionary ( WORD VARCHAR(30) PRIMARY KEY, WORD_DESC TEXT )");
+
+       r = database.ExecuteSql(sql, true);
+
+       if (IsFailed(r))
+       {
+               if (Database::Exists(__dbPath))
+               {
+                       Database::Delete(__dbPath);
+               }
+               return false;
+       }
+
+       // insert rows
+       database.BeginTransaction();
+
+       statement.Append(L"INSERT INTO MyDictionary (WORD, WORD_DESC) VALUES (?, ?)");
+       pStmt = database.CreateStatementN(statement);
+
+       Queue* pData = new Queue();
+       pData->Construct(*(DictionaryData::GetInstance()->GetData()));
+
+       while (pData->GetCount())
+       {
+               String* tmpString = dynamic_cast< String* >(pData->Dequeue());
+               pStmt->BindString(0, *tmpString);       // String
+
+               tmpString = dynamic_cast< String* >(pData->Dequeue());
+               pStmt->BindString(1, *tmpString);   // String
+
+               pEnum = database.ExecuteStatementN(*pStmt);
+       }
+
+       database.CommitTransaction();
+
+
+       delete pData;
+
+       delete pEnum;
+
+       delete pStmt;
+
+       return true;
+}
+
+bool
+DbForm::LoadDictionary(void)
+{
+       __map.Construct();
+
+       Database database;
+       DbEnumerator* pEnum;
+
+       String sql;
+       String statement;
+       String stringItem;
+
+       result r = E_SUCCESS;
+
+       if (Database::Exists(__dbPath) == false)
+       {
+               if (CreateDictionary() == false)
+               {
+                       return false;
+               }
+       }
+
+       r = database.Construct(__dbPath, "r");
+       TryReturn(!IsFailed(r), false, "Database::Construct failed with: %s", GetErrorMessage(r));
+
+       sql.Append(L"select WORD from MyDictionary");
+
+       pEnum = database.QueryN(sql);
+       if (pEnum == null)
+       {
+               Database::Delete(__dbPath);
+               return false;
+       }
+       String strWord;
+       int nIndx = 0;
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               if (pEnum->GetStringAt(0, strWord) != E_SUCCESS)
+               {
+                       break;
+               }
+
+               __map.Add(*(new (std::nothrow) Integer(nIndx++)), *(new (std::nothrow) String(strWord)));
+       }
+
+       if (pEnum != null)
+       {
+               delete pEnum;
+       }
+
+       return true;
+}
diff --git a/project/src/Dictionary.cpp b/project/src/Dictionary.cpp
new file mode 100644 (file)
index 0000000..4a02f9e
--- /dev/null
@@ -0,0 +1,111 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "Dictionary.h"
+#include "FormFactory.h"
+
+#include <FSysPowerManager.h>
+#include <FUi.h>
+
+
+using namespace Tizen::Base;
+using namespace Tizen::System;
+using namespace Tizen::App;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+Dictionary::Dictionary(void)
+{
+}
+
+Dictionary::~Dictionary(void)
+{
+}
+
+Tizen::App::Application*
+Dictionary::CreateInstance(void)
+{
+       // Create the instance through the constructor.
+       return new Dictionary();
+}
+
+bool
+Dictionary::OnAppInitializing(AppRegistry& appRegistry)
+{
+       Frame* pAppFrame = new (std::nothrow) Frame();
+       TryReturn(pAppFrame != null, false, "new Frame() is null");
+       pAppFrame->Construct();
+       pAppFrame->SetName("AppFrame");
+       AddFrame(*pAppFrame);
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+
+       static FormFactory formFactory;
+       pSceneManager->RegisterFormFactory(formFactory);
+       pSceneManager->RegisterScene(L"SelectDictionaryScene", L"SelectDictionaryForm", L"");
+       pSceneManager->RegisterScene(L"DbScene", L"DbForm", L"");
+       pSceneManager->RegisterScene(L"FileScene", L"FileForm", L"");
+       pSceneManager->RegisterScene(L"RegScene", L"RegForm", L"");
+       pSceneManager->RegisterScene(L"SecureDbScene", L"SecureDbForm", L"");
+       pSceneManager->RegisterScene(L"SecureFileScene", L"SecureFileForm", L"");
+       pSceneManager->RegisterScene(L"SecureRegScene", L"SecureRegForm", L"");
+       pSceneManager->RegisterScene(L"ViewDescriptScene", L"ViewDescriptForm", L"");
+
+       if (pSceneManager->GoForward(ForwardSceneTransition(L"SelectDictionaryScene")) != E_SUCCESS)
+               return false;
+
+       return true;
+}
+
+bool
+Dictionary::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+       // Deallocate resources allocated by this application.
+       return true;
+}
+
+void
+Dictionary::OnForeground(void)
+{
+}
+
+void
+Dictionary::OnBackground(void)
+{
+}
+
+void
+Dictionary::OnLowMemory(void)
+{
+}
+
+void
+Dictionary::OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel)
+{
+}
+
+void
+Dictionary::OnScreenOn(void)
+{
+}
+
+void
+Dictionary::OnScreenOff(void)
+{
+}
diff --git a/project/src/DictionaryData.cpp b/project/src/DictionaryData.cpp
new file mode 100644 (file)
index 0000000..624416a
--- /dev/null
@@ -0,0 +1,103 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "DictionaryData.h"
+#include <FBase.h>
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+DictionaryData::DictionaryData()
+       : __pData(null)
+{
+
+}
+
+DictionaryData::~DictionaryData()
+{
+       __pData->RemoveAll(true);
+
+       delete __pData;
+}
+
+DictionaryData*
+DictionaryData::GetInstance(void)
+{
+       static DictionaryData* pDictionaryData = null;
+
+       if (pDictionaryData == null)
+       {
+               pDictionaryData = new DictionaryData();
+       }
+
+       return pDictionaryData;
+}
+
+Queue*
+DictionaryData::GetData(void)
+{
+       if (__pData == null)
+       {
+               int dataSize = 50;
+
+               __pData = new Queue();
+               __pData->Construct(dataSize);
+
+               __pData->Enqueue(*(new (std::nothrow) String(L"a")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"a: A or an is the indefinite article. It is used at the beginning of noun groups which refer to only one person or thing. The form an is used in front of words that begin with vowel sounds.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"able")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"able: Having the power, skill, means, or opportunity to do something.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"banana")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"banana: A banana is a long curved fruit which grows in clusters and has soft pulpy flesh and yellow skin when ripe.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"boss")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"boss: Your boss is the person in charge of the organization or department where you work.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"cake")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"cake: An item of soft sweet food made from a mixture of flour, fat, eggs, sugar, and other ingredients, baked and sometimes iced or decorated.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"door")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"door: A door is a piece of wood, glass, or metal, which is moved to open and close the entrance to a building, room, cupboard, or vehicle.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"echo")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"echo: An echo is a sound which is caused by a noise being reflected off a surface such as a wall.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"fox")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"fox: A fox is a wild animal which looks like a dog and has reddish-brown fur, a pointed face and ears, and a thick tail. Foxes eat smaller animals.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"gas")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"gas: Any substance like air that is neither a solid nor a liquid, for example hydrogen and oxygen are both gases.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"house")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"house: Building for people to live in, usually for one family.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"ice")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"ice: Frozen water, a brittle transparent crystalline solid.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"jacket")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"jacket: An outer garment extending either to the waist or the hips, typically having sleeves and a fastening down the front.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"kiss")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"kiss: If you kiss someone, you touch them with your lips to show affection or sexual desire, or to greet them or say goodbye.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"love")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"love: If you love someone, you feel romantically or sexually attracted to them, and they are very important to you.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"muse")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"muse: If you muse on something, you think about it, usually saying or writing what you are thinking at the same time.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"news")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"news: News is information about a recently changed situation or a recent event.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"notice")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"notice: If you notice something or someone, you become aware of them.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"oasis")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"oasis: An oasis is a small area in a desert where water and plants are found.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"ocean")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"ocean: A very large expanse of sea, in particular each of the main areas into which the sea is divided geographically.")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"pink")));
+               __pData->Enqueue(*(new (std::nothrow) String(L"pink: Pink is the colour between red and white.")));
+       }
+
+       return __pData;
+}
diff --git a/project/src/DictionaryEntry.cpp b/project/src/DictionaryEntry.cpp
new file mode 100644 (file)
index 0000000..646a723
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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.
+//
+
+/**
+ * This file contains the Tizen application entry point.
+ */
+#include "Dictionary.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+_EXPORT_ int OspMain(int argc, char* pArgv[]);
+
+/**
+ * The entry function of Tizen application called by the platform.
+ */
+int
+OspMain(int argc, char* pArgv[])
+{
+       result r = E_SUCCESS;
+
+       AppLog("Application started.");
+       ArrayList args;
+       args.Construct();
+       for (int i = 0; i < argc; i++)
+       {
+               args.Add(*(new (std::nothrow) String(pArgv[i])));
+       }
+
+       r = Tizen::App::Application::Execute(Dictionary::CreateInstance, &args);
+       if (IsFailed(r))
+       {
+               AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
+               r &= 0x0000FFFF;
+       }
+
+       args.RemoveAll(true);
+       AppLog("Application finished.");
+
+       return static_cast< int >(r);
+}
+#ifdef __cplusplus
+}
+#endif // __cplusplus
diff --git a/project/src/FileForm.cpp b/project/src/FileForm.cpp
new file mode 100644 (file)
index 0000000..ea543af
--- /dev/null
@@ -0,0 +1,247 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "FileForm.h"
+#include "ViewDescriptForm.h"
+#include "DictionaryData.h"
+
+#include <FApp.h>
+#include <FIo.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+FileForm::FileForm(void)
+       : __pEnumLnkWord(null)
+{
+}
+
+FileForm::~FileForm(void)
+{
+       __arrDescription.RemoveAll(true);
+       __lnkWord.RemoveAll(true);
+
+       delete __pEnumLnkWord;
+}
+
+bool
+FileForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       if (LoadDictionary() == false)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+result
+FileForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       SetFormBackEventListener(this);
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"LIST OF WORDS");
+
+       ListView* pListView = new ListView();
+       pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height),
+                       true, false);
+
+       pListView->SetItemProvider(*this);
+       pListView->AddListViewItemEventListener(*this);
+
+       AddControl(*pListView);
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+FileForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+bool
+FileForm::WriteFile(const String& strFilePath, const String& strFileContents)
+{
+       File file;
+
+       result r = file.Construct(strFilePath, "w");
+       if (IsFailed(r))
+       {
+               AppLog("File::Construct() is failed by %s", GetErrorMessage(r));
+               return false;
+       }
+
+       r = file.Write(strFileContents);
+       if (IsFailed(r))
+       {
+               AppLog("File::Write() is failed by %s", GetErrorMessage(r));
+               return false;
+       }
+       return true;
+}
+
+bool
+FileForm::ReadFile(const String& strFilePath, String& strFileContents)
+{
+       strFileContents = L"";
+
+       File file;
+
+       result r = file.Construct(strFilePath, "r");
+       TryReturn(!IsFailed(r), false, "File::Consturct() is failed with %s", GetErrorMessage(r));
+
+       FileAttributes fileAttrs;
+       file.GetAttributes(strFilePath, fileAttrs);
+       long long size = fileAttrs.GetFileSize();
+
+       ByteBuffer readBuffer;
+       readBuffer.Construct(static_cast< int >(size + 1));
+
+       r = file.Read(readBuffer);
+       TryReturn(!IsFailed(r), false, "File::Read() is failed with %s", GetErrorMessage(r));
+
+       readBuffer.Flip();
+
+       strFileContents = String(reinterpret_cast< const char* >(readBuffer.GetPointer()));
+
+       return true;
+}
+
+bool
+FileForm::LoadDictionary(void)
+{
+       String filePath = App::GetInstance()->GetAppDataPath() + L"SampleDic.txt";
+
+       String strText;
+       if (ReadFile(filePath, strText) == false)
+       {
+               String strBase;
+
+               Queue* pData = new Queue();
+               pData->Construct(*(DictionaryData::GetInstance()->GetData()));
+
+               while (pData->GetCount())
+               {
+                       String* tmpString = dynamic_cast< String* >(pData->Dequeue());
+                       strBase += *tmpString + "\2";
+
+                       tmpString = dynamic_cast< String* >(pData->Dequeue());
+                       strBase += *tmpString + "\1";
+               }
+
+               delete pData;
+
+               WriteFile(filePath, strBase);
+               if (ReadFile(filePath, strText) == false)
+               {
+                       return false;
+               }
+       }
+
+       StringTokenizer stSection(strText, String(L"\1"));
+
+       String token;
+       while (stSection.HasMoreTokens())
+       {
+               stSection.GetNextToken(token);
+
+               StringTokenizer stWord(token, String(L"\2"));
+               String strWord;
+               String strDescription;
+               if (stWord.HasMoreTokens())
+               {
+                       stWord.GetNextToken(strWord);
+                       __lnkWord.Add(*(new (std::nothrow) String(strWord)));
+
+                       stWord.GetNextToken(strDescription);
+                       __arrDescription.Add(*(new (std::nothrow) String(strDescription)));
+               }
+       }
+
+       __pEnumLnkWord = __lnkWord.GetEnumeratorN();
+
+       return true;
+}
+
+int
+FileForm::GetItemCount(void)
+{
+       return __lnkWord.GetCount();
+}
+
+Tizen::Ui::Controls::ListItemBase*
+FileForm::CreateItem(int index, int itemWidth)
+{
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+       CustomItem* pItem = null;
+       String* pStr = null;
+
+       IEnumerator* pEnum = __pEnumLnkWord;
+       TryReturn(pEnum != null, null, "EnumLnkWord is null");
+
+       if (pEnum->MoveNext() == E_SUCCESS)
+       {
+               pStr = dynamic_cast< String* >(pEnum->GetCurrent());
+
+               pItem = new (std::nothrow) CustomItem();
+               pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+
+               pItem->AddElement(Rectangle(26, 32, 200, 50), 0, *pStr, false);
+       }
+
+       return pItem;
+}
+
+bool
+FileForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+
+       return true;
+}
+
+void
+FileForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+       String* pDescription = null;
+
+       pDescription = dynamic_cast< String* >(__arrDescription.GetAt(index));
+
+       LinkedList* pList = new LinkedList();
+       pList->Add(*(new String(*pDescription)));
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(L"ViewDescriptScene"), pList);
+}
diff --git a/project/src/FormFactory.cpp b/project/src/FormFactory.cpp
new file mode 100644 (file)
index 0000000..f06d86a
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "FormFactory.h"
+#include "SelectDictionaryForm.h"
+#include "DbForm.h"
+#include "FileForm.h"
+#include "RegForm.h"
+#include "SecureDbForm.h"
+#include "SecureFileForm.h"
+#include "SecureRegForm.h"
+#include "ViewDescriptForm.h"
+
+#include <FUi.h>
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+
+FormFactory::FormFactory() {
+       // TODO Auto-generated constructor stub
+
+}
+
+FormFactory::~FormFactory() {
+       // TODO Auto-generated destructor stub
+}
+
+Form*
+FormFactory::CreateFormN(const String &formId, const SceneId &sceneId)
+{
+       Form* pNewForm = null;
+
+       if (formId == L"SelectDictionaryForm")
+       {
+               SelectDictionaryForm* pForm = new (std::nothrow) SelectDictionaryForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+       else if (formId == L"ViewDescriptForm")
+       {
+               ViewDescriptForm* pForm = new (std::nothrow) ViewDescriptForm();
+               pForm->Initialize();
+
+               SceneManager* pSceneManager = SceneManager::GetInstance();
+               pSceneManager->AddSceneEventListener(sceneId, *pForm);
+
+               return pForm;
+       }
+       else if (formId == L"DbForm")
+       {
+               DbForm* pForm = new (std::nothrow) DbForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+       else if (formId == L"FileForm")
+       {
+               FileForm* pForm = new (std::nothrow) FileForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+       else if (formId == L"RegForm")
+       {
+               RegForm* pForm = new (std::nothrow) RegForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+       else if (formId == L"SecureDbForm")
+       {
+               SecureDbForm* pForm = new (std::nothrow) SecureDbForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+       else if (formId == L"SecureFileForm")
+       {
+               SecureFileForm* pForm = new (std::nothrow) SecureFileForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+       else if (formId == L"SecureRegForm")
+       {
+               SecureRegForm* pForm = new (std::nothrow) SecureRegForm();
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
+
+       return pNewForm;
+}
+
diff --git a/project/src/RegForm.cpp b/project/src/RegForm.cpp
new file mode 100644 (file)
index 0000000..00fffe2
--- /dev/null
@@ -0,0 +1,249 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "RegForm.h"
+#include "ViewDescriptForm.h"
+#include "DictionaryData.h"
+
+#include <FApp.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+RegForm::RegForm(void)
+{
+}
+
+RegForm::~RegForm(void)
+{
+       __map.RemoveAll(true);
+}
+
+bool
+RegForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       if (LoadDictionary() == false)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+result
+RegForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       SetFormBackEventListener(this);
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"LIST OF WORDS");
+
+       ListView* pListView = new ListView();
+       pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height),
+                       true, false);
+
+       pListView->SetItemProvider(*this);
+       pListView->AddListViewItemEventListener(*this);
+
+       AddControl(*pListView);
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+RegForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+void
+RegForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+       AppLog("OnItemStateChanged process RegForm.....%d:%d", index, __map.GetCount());
+       String* pWord = null;
+       String wordDescription;
+       String regPath(App::GetInstance()->GetAppDataPath() + L"SampleDic.ini");
+       Registry reg;
+       result r = E_SUCCESS;
+
+       // get word
+       pWord = dynamic_cast< String* >(__map.GetValue(Integer(index)));
+
+       r = reg.Construct(regPath, "r"); // open an existing registry.
+       TryReturnVoid(r == E_SUCCESS, "Registry::Construct failed with %s", GetErrorMessage(r));
+
+       // get wordDescription from registry
+       r = reg.GetValue(*pWord, L"desc", wordDescription);
+       TryReturnVoid(r == E_SUCCESS, "Registry::GetValue() failed with %s", GetErrorMessage(r));
+
+       LinkedList* pList = new LinkedList();
+       pList->Add(*(new String(wordDescription)));
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(L"ViewDescriptScene"), pList);
+}
+
+bool
+RegForm::AddRegistryData(Registry& reg)
+{
+       // section name
+       String* pWord = null;
+
+       // entry name
+       String strEntry(L"desc");
+
+       // value
+       String* pWordDescription = null;
+
+       result r;
+
+       Queue* pData = new Queue();
+       pData->Construct(*(DictionaryData::GetInstance()->GetData()));
+
+       while (pData->GetCount())
+       {
+               pWord = dynamic_cast< String* >(pData->Dequeue());
+               reg.AddSection(*pWord);
+
+               pWordDescription = dynamic_cast< String* >(pData->Dequeue());
+               reg.AddValue(*pWord, strEntry, *pWordDescription);
+       }
+
+       delete pData;
+
+       r = reg.Flush();
+       if (IsFailed(r))
+       {
+               return false;
+       }
+
+       return true;
+}
+
+bool
+RegForm::LoadDictionary(void)
+{
+       Registry reg;
+
+       // registry name
+       String regPath(App::GetInstance()->GetAppDataPath() + L"SampleDic.ini");
+
+       // section name
+       String strWord;
+
+       // entry name
+       String strEntry(L"desc");
+
+       //value
+       String strDescription;
+
+       IList* pList = null;
+       bool ret = true;
+
+       result r = reg.Construct(regPath, "w+"); // create a new registry if not exists
+       TryReturn(r == E_SUCCESS, false, "Registry::Construct failed");
+
+       pList = reg.GetAllSectionNamesN();
+       TryReturn(pList != null, false, "Section list is empty");
+
+       if (pList->GetCount() < 1)
+       {
+               pList->RemoveAll(true);
+               delete pList;
+
+               AddRegistryData(reg);
+               pList = reg.GetAllSectionNamesN();
+       }
+
+       __map.Construct();
+
+       for (int nIndx = 0; nIndx < pList->GetCount(); nIndx++)
+       {
+               strWord = *(dynamic_cast< String* >(pList->GetAt(nIndx)));
+
+               // get value
+               r = reg.GetValue(strWord, strEntry, strDescription);
+               if (IsFailed(r))
+               {
+                       break;
+               }
+
+               Integer* pKey = new (std::nothrow) Integer(nIndx);
+
+               __map.Add(*pKey, *(new (std::nothrow) String(strWord)));
+       }
+
+       pList->RemoveAll(true);
+       delete pList;
+
+       return ret;
+}
+
+int
+RegForm::GetItemCount(void)
+{
+       int itemCount = 0;
+       IList* pList = __map.GetKeysN();
+       AppAssert(pList);
+
+       itemCount = pList->GetCount();
+
+       delete pList;
+
+       return itemCount;
+}
+
+Tizen::Ui::Controls::ListItemBase*
+RegForm::CreateItem(int index, int itemWidth)
+{
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+
+       // get value
+       String* pStrWord = dynamic_cast< String* >(__map.GetValue(Integer(index)));
+
+       CustomItem* pItem = new (std::nothrow) CustomItem();
+       pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+
+       pItem->AddElement(Rectangle(26, 32, 200, 50), 0, *pStrWord, false);
+
+       return pItem;
+}
+
+bool
+RegForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+
+       return true;
+}
+
+
diff --git a/project/src/SecureDbForm.cpp b/project/src/SecureDbForm.cpp
new file mode 100644 (file)
index 0000000..5f8a986
--- /dev/null
@@ -0,0 +1,345 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "SecureDbForm.h"
+#include "ViewDescriptForm.h"
+#include "DictionaryData.h"
+
+#include <FApp.h>
+#include <FIo.h>
+#include <FSystem.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+using namespace Tizen::System;
+
+static const int _MAX_KEY_LENGTH = 8;
+
+SecureDbForm::SecureDbForm(void)
+{
+       __secureDbPath = App::GetInstance()->GetAppDataPath() + L"SampleSecureDic.db";
+
+       result r = __key.Construct(_MAX_KEY_LENGTH);
+       if (IsFailed(r))
+       {
+               AppLogException("ByteBuffer::Construct() failed-[%s].", GetErrorMessage(r));
+       }
+
+       for (int i = 0; i < _MAX_KEY_LENGTH; i++)
+       {
+               __key[i] = 'a' + i;
+       }
+
+       r = SystemInfo::GetValue("http://tizen.org/feature/database.encryption", __encryption);
+       if (IsFailed(r))
+       {
+               AppLogException("SystemInfo::GetValue() failed-[%s].", GetErrorMessage(r));
+       }
+}
+
+SecureDbForm::~SecureDbForm()
+{
+       __map.RemoveAll(true);
+}
+
+
+bool
+SecureDbForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       if (LoadDictionary() == false)
+       {
+               return false;
+       }
+
+       return true;
+
+}
+
+result
+SecureDbForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"LIST OF WORDS");
+
+       SetFormBackEventListener(this);
+
+       ListView* pListView = new ListView();
+       pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, false);
+
+       pListView->SetItemProvider(*this);
+       pListView->AddListViewItemEventListener(*this);
+
+       AddControl(*pListView);
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+SecureDbForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+void
+SecureDbForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+       Database database;
+       String sql;
+       String statement;
+       String stringItem;
+       result r = E_SUCCESS;
+
+       if (__encryption == true)
+       {
+               r = database.Construct(__secureDbPath, "r", __key);
+       }
+       else
+       {
+               r = database.Construct(__secureDbPath, "r");
+       }
+       if (IsFailed(r))
+       {
+               MessageBox myMSGBox;
+               myMSGBox.Construct(L"database open", L"database not founded", MSGBOX_STYLE_OK, 0);
+
+               // Call ShowAndWait
+               int modalResult = 0;
+               myMSGBox.ShowAndWait(modalResult);  //ShowAndWait() draw, show itself and process events
+               return;
+       }
+
+       sql.Format(1024, L"select WORD, WORD_DESC from MyDictionary where WORD='%ls'",
+                          (dynamic_cast< String* >(__map.GetValue(Integer(index)))->GetPointer()));
+
+       DbEnumerator* pEnum = database.QueryN(sql);
+       if (pEnum == null)
+       {
+               MessageBox myMSGBox;
+               myMSGBox.Construct(L"select word description", L"word description not found", MSGBOX_STYLE_OK, 0);
+
+               // Call ShowAndWait
+               int modalResult = 0;
+               myMSGBox.ShowAndWait(modalResult);  //ShowAndWait() draw, show itself and process events
+
+               return;
+       }
+
+       String strWord;
+       String strWordDescription;
+
+       if (pEnum->MoveNext() == E_SUCCESS)
+       {
+               pEnum->GetStringAt(0, strWord);
+               pEnum->GetStringAt(1, strWordDescription);
+       }
+
+       delete pEnum;
+
+       LinkedList* pList = new LinkedList();
+       pList->Add(*(new String(strWordDescription)));
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(L"ViewDescriptScene"), pList);
+}
+
+int
+SecureDbForm::GetItemCount(void)
+{
+       int itemCount = 0;
+       IList* pList = __map.GetKeysN();
+       AppAssert(pList);
+
+       itemCount = pList->GetCount();
+
+       delete pList;
+       return itemCount;
+}
+
+Tizen::Ui::Controls::ListItemBase*
+SecureDbForm::CreateItem(int index, int itemWidth)
+{
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+       String* pStr = null;
+
+       CustomItem* pItem = new (std::nothrow) CustomItem();
+       pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+
+       pStr = dynamic_cast< String* >(__map.GetValue(Integer(index)));
+
+       pItem->AddElement(Rectangle(26, 32, 200, 50), 0, *pStr, false);
+
+       return pItem;
+}
+
+bool
+SecureDbForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+
+       return true;
+}
+
+bool
+SecureDbForm::CreateDictionary(void)
+{
+       Database database;
+       DbStatement* pStmt = null;
+       DbEnumerator* pEnum = null;
+
+       String sql;
+       String statement;
+
+       result r = E_SUCCESS;
+
+       if (__encryption == true)
+       {
+               r = database.Construct(__secureDbPath, "a+", __key);
+       }
+       else
+       {
+               r = database.Construct(__secureDbPath, "a+");
+       }
+
+       if (IsFailed(r))
+       {
+               if (Database::Exists(__secureDbPath))
+               {
+                       Database::Delete(__secureDbPath);
+               }
+               return false;
+       }
+
+       // create database table
+       sql.Append(L"CREATE TABLE IF NOT EXISTS MyDictionary ( WORD VARCHAR(30) PRIMARY KEY, WORD_DESC TEXT )");
+
+       r = database.ExecuteSql(sql, true);
+
+       if (IsFailed(r))
+       {
+               if (Database::Exists(__secureDbPath))
+               {
+                       Database::Delete(__secureDbPath);
+               }
+               return false;
+       }
+
+       // insert rows
+       database.BeginTransaction();
+
+       statement.Append(L"INSERT INTO MyDictionary (WORD, WORD_DESC) VALUES (?, ?)");
+       pStmt = database.CreateStatementN(statement);
+
+       Queue* pData = new Queue();
+       pData->Construct(*(DictionaryData::GetInstance()->GetData()));
+
+       while (pData->GetCount())
+       {
+               String* tmpString = dynamic_cast< String* >(pData->Dequeue());
+               pStmt->BindString(0, *tmpString);       // String
+
+               tmpString = dynamic_cast< String* >(pData->Dequeue());
+               pStmt->BindString(1, *tmpString);   // String
+
+               pEnum = database.ExecuteStatementN(*pStmt);
+       }
+
+       database.CommitTransaction();
+
+       delete pData;
+
+       delete pEnum;
+
+       delete pStmt;
+
+       return true;
+}
+
+bool
+SecureDbForm::LoadDictionary(void)
+{
+       __map.Construct();
+
+       Database database;
+       DbEnumerator* pEnum;
+
+       String sql;
+       String statement;
+       String stringItem;
+
+       result r = E_SUCCESS;
+
+       if (Database::Exists(__secureDbPath) == false)
+       {
+               if (CreateDictionary() == false)
+               {
+                       return false;
+               }
+       }
+
+       if (__encryption == true)
+       {
+               r = database.Construct(__secureDbPath, "r", __key);
+       }
+       else
+       {
+               r = database.Construct(__secureDbPath, "r");
+       }
+
+       TryReturn(!IsFailed(r), false, "Database::Construct failed with: %s", GetErrorMessage(r));
+
+       sql.Append(L"select WORD from MyDictionary");
+
+       pEnum = database.QueryN(sql);
+       if (pEnum == null)
+       {
+               Database::Delete(__secureDbPath);
+               return false;
+       }
+
+       String strWord;
+       int nIndx = 0;
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               if (pEnum->GetStringAt(0, strWord) != E_SUCCESS)
+               {
+                       break;
+               }
+               __map.Add(*(new (std::nothrow) Integer(nIndx++)), *(new (std::nothrow) String(strWord)));
+       }
+
+       if (pEnum != null)
+       {
+               delete pEnum;
+       }
+
+       return true;
+}
diff --git a/project/src/SecureFileForm.cpp b/project/src/SecureFileForm.cpp
new file mode 100644 (file)
index 0000000..68ff0d2
--- /dev/null
@@ -0,0 +1,260 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "SecureFileForm.h"
+#include "ViewDescriptForm.h"
+#include "DictionaryData.h"
+
+#include <FApp.h>
+#include <FIo.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+static const int _MAX_KEY_LENGTH = 8;
+
+SecureFileForm::SecureFileForm(void)
+       : __pEnumLnkWord(null)
+{
+       result r = __key.Construct(_MAX_KEY_LENGTH);
+       if (IsFailed(r))
+       {
+               AppLogException("ByteBuffer::Construct() failed-[%s].", GetErrorMessage(r));
+       }
+       for (int i = 0; i < _MAX_KEY_LENGTH; i++)
+       {
+               __key[i] = 'a' + i;
+       }
+}
+
+SecureFileForm::~SecureFileForm(void)
+{
+       __arrDescription.RemoveAll(true);
+       __lnkWord.RemoveAll(true);
+
+       delete __pEnumLnkWord;
+}
+
+bool
+SecureFileForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       if (LoadDictionary() == false)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+result
+SecureFileForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       SetFormBackEventListener(this);
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"LIST OF WORDS");
+
+       ListView* pListView = new ListView();
+       pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height),
+                       true, false);
+
+       pListView->SetItemProvider(*this);
+       pListView->AddListViewItemEventListener(*this);
+
+       AddControl(*pListView);
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+SecureFileForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+bool
+SecureFileForm::WriteFile(const String& strFilePath, const String& strFileContents)
+{
+       File file;
+
+       result r = file.Construct(strFilePath, "w", __key);
+       if (IsFailed(r))
+       {
+               AppLog("File::Consturct() is failed by %s", GetErrorMessage(r));
+               return false;
+       }
+
+       r = file.Write(strFileContents);
+       if (IsFailed(r))
+       {
+               AppLog("File::Write() is failed by %s", GetErrorMessage(r));
+               return false;
+       }
+       return true;
+}
+
+bool
+SecureFileForm::ReadFile(const String& strFilePath, String& strFileContents)
+{
+       strFileContents = L"";
+
+       File file;
+
+       result r = file.Construct(strFilePath, "r", __key);
+       TryReturn(!IsFailed(r), false, "File::Consturct() is failed with %s", GetErrorMessage(r));
+
+       FileAttributes fileAttrs;
+       file.GetAttributes(strFilePath, fileAttrs);
+       long long size = fileAttrs.GetFileSize();
+
+       ByteBuffer readBuffer;
+       readBuffer.Construct(static_cast< int >(size + 1));
+
+       r = file.Read(readBuffer);
+       TryReturn(!IsFailed(r), false, "File::Read() is failed with %s", GetErrorMessage(r));
+
+       readBuffer.Flip();
+
+       strFileContents = String(reinterpret_cast< const char* >(readBuffer.GetPointer()));
+
+       return true;
+}
+
+bool
+SecureFileForm::LoadDictionary(void)
+{
+       String filePath = App::GetInstance()->GetAppDataPath() + L"SampleSecureDic.txt";
+
+       String strText;
+       if (ReadFile(filePath, strText) == false)
+       {
+               String strBase;
+
+               Queue* pData = new Queue();
+               pData->Construct(*(DictionaryData::GetInstance()->GetData()));
+
+               while (pData->GetCount())
+               {
+                       String* tmpString = dynamic_cast< String* >(pData->Dequeue());
+                       strBase += *tmpString + "\2";
+
+                       tmpString = dynamic_cast< String* >(pData->Dequeue());
+                       strBase += *tmpString + "\1";
+               }
+
+               delete pData;
+
+               WriteFile(filePath, strBase);
+               if (ReadFile(filePath, strText) == false)
+               {
+                       return false;
+               }
+       }
+
+       AppLog("%ls", strText.GetPointer());
+
+       StringTokenizer stSection(strText, String(L"\1"));
+
+       String token;
+       while (stSection.HasMoreTokens())
+       {
+               stSection.GetNextToken(token);
+
+               StringTokenizer stWord(token, String(L"\2"));
+               String strWord;
+               String strDescription;
+               if (stWord.HasMoreTokens())
+               {
+                       stWord.GetNextToken(strWord);
+                       __lnkWord.Add(*(new (std::nothrow) String(strWord)));
+                       stWord.GetNextToken(strDescription);
+                       __arrDescription.Add(*(new (std::nothrow) String(strDescription)));
+               }
+       }
+
+       __pEnumLnkWord = __lnkWord.GetEnumeratorN();
+
+       return true;
+}
+
+int
+SecureFileForm::GetItemCount(void)
+{
+       return __lnkWord.GetCount();
+}
+
+Tizen::Ui::Controls::ListItemBase*
+SecureFileForm::CreateItem(int index, int itemWidth)
+{
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+       CustomItem* pItem = null;
+
+       String* pStr = null;
+
+       IEnumerator* pEnum = __pEnumLnkWord;
+       TryReturn(pEnum != null, null, "EnumLnkWord is null");
+
+       if (pEnum->MoveNext() == E_SUCCESS)
+       {
+               pStr = dynamic_cast< String* >(pEnum->GetCurrent());
+               pItem = new (std::nothrow) CustomItem();
+               pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+
+               pItem->AddElement(Rectangle(26, 32, 200, 50), 0, *pStr, false);
+       }
+
+       return pItem;
+}
+
+bool
+SecureFileForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+
+       return true;
+}
+
+void
+SecureFileForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId,
+                                                                                  Tizen::Ui::Controls::ListItemStatus status)
+{
+       String* pDescription = null;
+
+       pDescription = dynamic_cast< String* >(__arrDescription.GetAt(index));
+
+       LinkedList* pList = new LinkedList();
+       pList->Add(*(new String(*pDescription)));
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(L"ViewDescriptScene"), pList);
+}
diff --git a/project/src/SecureRegForm.cpp b/project/src/SecureRegForm.cpp
new file mode 100644 (file)
index 0000000..3f36e4f
--- /dev/null
@@ -0,0 +1,259 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "SecureRegForm.h"
+#include "ViewDescriptForm.h"
+#include "DictionaryData.h"
+
+#include <FApp.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+static const int _MAX_KEY_LENGTH = 8;
+
+SecureRegForm::SecureRegForm(void)
+{
+       result r = __key.Construct(_MAX_KEY_LENGTH);
+       if (IsFailed(r))
+       {
+               AppLogException("ByteBuffer::Construct() failed-[%s].", GetErrorMessage(r));
+       }
+
+       for (int i = 0; i < _MAX_KEY_LENGTH; i++)
+       {
+               __key[i] = 'a' + i;
+       }
+}
+
+SecureRegForm::~SecureRegForm(void)
+{
+       __map.RemoveAll(true);
+}
+
+bool
+SecureRegForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       if (LoadDictionary() == false)
+       {
+               return false;
+       }
+
+       return true;
+}
+
+result
+SecureRegForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       SetFormBackEventListener(this);
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"LIST OF WORDS");
+
+       ListView* pListView = new ListView();
+
+       pListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height),
+                       true, false);
+
+       pListView->SetItemProvider(*this);
+       pListView->AddListViewItemEventListener(*this);
+
+       AddControl(*pListView);
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+SecureRegForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+void
+SecureRegForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+       AppLog("OnItemStateChanged process SecureRegForm.....%d:%d", index, __map.GetCount());
+       String* pWord = null;
+       String wordDescription;
+       String regPath(App::GetInstance()->GetAppDataPath() + L"SampleSecureDic.ini");
+       Registry reg;
+       result r = E_SUCCESS;
+
+       // get word
+       pWord = dynamic_cast< String* >(__map.GetValue(Integer(index)));
+       TryReturnVoid(pWord != null, "pWord not found");
+
+       r = reg.Construct(regPath, "r", __key); // open an existing registry
+       TryReturnVoid(r == E_SUCCESS, "Registry::Construct failed with %s", GetErrorMessage(r));
+
+       // get wordDescription from registry
+       r = reg.GetValue(*pWord, L"desc", wordDescription);
+       TryReturnVoid(r == E_SUCCESS, "Registry::GetValue() failed with %s", GetErrorMessage(r));
+
+       LinkedList* pList = new LinkedList();
+       pList->Add(*(new String(wordDescription)));
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(L"ViewDescriptScene"), pList);
+}
+
+bool
+SecureRegForm::AddRegistryData(Registry& reg)
+{
+       // section name
+       String* pWord = null;
+       // entry name
+       String strEntry(L"desc");
+       // value
+       String* pWordDescription = null;
+
+       result r;
+
+       Queue* pData = new Queue();
+       pData->Construct(*(DictionaryData::GetInstance()->GetData()));
+
+       while (pData->GetCount())
+       {
+               pWord = dynamic_cast< String* >(pData->Dequeue());
+               reg.AddSection(*pWord);
+
+               pWordDescription = dynamic_cast< String* >(pData->Dequeue());
+               reg.AddValue(*pWord, strEntry, *pWordDescription);
+       }
+
+       delete pData;
+
+       r = reg.Flush();
+       if (IsFailed(r))
+       {
+               return false;
+       }
+
+       return true;
+}
+
+bool
+SecureRegForm::LoadDictionary(void)
+{
+       Registry reg;
+
+       // registry name
+       String regPath(App::GetInstance()->GetAppDataPath() + L"SampleSecureDic.ini");
+
+       // section name
+       String strWord;
+
+       // entry name
+       String strEntry(L"desc");
+
+       //value
+       String strDescription;
+
+       bool ret = true;
+
+       result r = reg.Construct(regPath, "w+", __key);
+       TryReturn(r == E_SUCCESS, false, "Registry::Construct failed");
+
+       IList* pList = reg.GetAllSectionNamesN();
+       TryReturn(pList != null, false, "Section list is empty");
+
+       if (pList->GetCount() < 1)
+       {
+               pList->RemoveAll(true);
+               delete pList;
+
+               AddRegistryData(reg);
+               pList = reg.GetAllSectionNamesN();
+       }
+
+       __map.Construct();
+
+       for (int nIndx = 0; nIndx < pList->GetCount(); nIndx++)
+       {
+               strWord = *(dynamic_cast< String* >(pList->GetAt(nIndx)));
+               // get value
+               r = reg.GetValue(strWord, strEntry, strDescription);
+               if (IsFailed(r))
+               {
+                       break;
+               }
+
+               Integer* pKey = new (std::nothrow) Integer(nIndx);
+
+               __map.Add(*pKey, *(new (std::nothrow) String(strWord)));
+       }
+
+       pList->RemoveAll(true);
+       delete pList;
+
+       return ret;
+}
+
+int
+SecureRegForm::GetItemCount(void)
+{
+       int itemCount = 0;
+       IList* pList = __map.GetKeysN();
+       AppAssert(pList);
+
+       itemCount = pList->GetCount();
+
+       delete pList;
+
+       return itemCount;
+}
+
+Tizen::Ui::Controls::ListItemBase*
+SecureRegForm::CreateItem(int index, int itemWidth)
+{
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+
+       // get value
+       String* pStrWord = dynamic_cast< String* >(__map.GetValue(Integer(index)));
+
+       CustomItem* pItem = new (std::nothrow) CustomItem();
+       pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
+
+       pItem->AddElement(Rectangle(26, 32, 200, 50), 0, *pStrWord, false);
+
+       return pItem;
+}
+
+bool
+SecureRegForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       pItem = null;
+
+       return true;
+}
+
+
diff --git a/project/src/SelectDictionaryForm.cpp b/project/src/SelectDictionaryForm.cpp
new file mode 100644 (file)
index 0000000..46daec9
--- /dev/null
@@ -0,0 +1,219 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "SelectDictionaryForm.h"
+#include "DbForm.h"
+#include "FileForm.h"
+#include "RegForm.h"
+#include "SecureDbForm.h"
+#include "SecureFileForm.h"
+#include "SecureRegForm.h"
+
+#include <FApp.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+SelectDictionaryForm::SelectDictionaryForm(void)
+       : __pPlainIoPanel(null)
+       , __pSecureIoPanel(null)
+{
+}
+
+SelectDictionaryForm::~SelectDictionaryForm(void)
+{
+}
+
+bool
+SelectDictionaryForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       return true;
+}
+
+result
+SelectDictionaryForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       Header* pHeader = GetHeader();
+       if (pHeader != null)
+       {
+               pHeader->SetStyle(HEADER_STYLE_TAB);
+
+               HeaderItem headerItem1;
+               headerItem1.Construct(ID_HEADER_ITEM1);
+               headerItem1.SetText(L"PLAIN I/O");
+               pHeader->AddItem(headerItem1);
+
+               HeaderItem headerItem2;
+               headerItem2.Construct(ID_HEADER_ITEM2);
+               headerItem2.SetText(L"SECURE I/O");
+               pHeader->AddItem(headerItem2);
+
+               pHeader->AddActionEventListener(*this);
+       }
+
+       Footer* pFooter = GetFooter();
+       if (pFooter != null)
+       {
+               pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+               pFooter->SetBackButton();
+               SetFormBackEventListener(this);
+       }
+
+       CreatePlainIOPanel();
+       CreateSecureIOPanel();
+       __pPlainIoPanel->SetShowState(true);
+       __pSecureIoPanel->SetShowState(false);
+
+       return r;
+}
+
+void
+SelectDictionaryForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       AppAssert(pSceneManager);
+
+       switch (actionId)
+       {
+       case ID_HEADER_ITEM1:
+               __pSecureIoPanel->SetShowState(false);
+               __pPlainIoPanel->SetShowState(true);
+               Draw();
+               break;
+
+       case ID_HEADER_ITEM2:
+               __pPlainIoPanel->SetShowState(false);
+               __pSecureIoPanel->SetShowState(true);
+               Draw();
+               break;
+
+       case SELECT_DATABASE:
+               pSceneManager->GoForward(ForwardSceneTransition(L"DbScene"));
+               break;
+
+       case SELECT_FILE:
+               pSceneManager->GoForward(ForwardSceneTransition(L"FileScene"));
+               break;
+
+       case SELECT_REGISTRY:
+               pSceneManager->GoForward(ForwardSceneTransition(L"RegScene"));
+               break;
+
+       case SELECT_SECURE_DATABASE:
+               pSceneManager->GoForward(ForwardSceneTransition(L"SecureDbScene"));
+               break;
+
+       case SELECT_SECURE_FILE:
+               pSceneManager->GoForward(ForwardSceneTransition(L"SecureFileScene"));
+               break;
+
+       case SELECT_SECURE_REGISTRY:
+               pSceneManager->GoForward(ForwardSceneTransition(L"SecureRegScene"));
+               break;
+
+       default:
+               AppLog("action id error");
+               break;
+       }
+}
+
+void
+SelectDictionaryForm::CreatePlainIOPanel(void)
+{
+       Rectangle clientRect = GetClientAreaBounds();
+       Rectangle rect(0, 0, clientRect.width, clientRect.height);
+
+       __pPlainIoPanel = new (std::nothrow) Panel();
+       TryReturnVoid(__pPlainIoPanel != null, "new Panel() is null.");
+
+       __pPlainIoPanel->Construct(rect);
+       AddControl(*__pPlainIoPanel);
+
+       Button* pButton = null;
+       pButton = new (std::nothrow) Button;
+       TryReturnVoid(pButton != null, "new Button() is null.");
+       pButton->Construct(Rectangle(50, 50, clientRect.width - 100, 74), L"from Plain Database");
+       pButton->SetActionId(SELECT_DATABASE);
+       pButton->AddActionEventListener(*this);
+       __pPlainIoPanel->AddControl(*pButton);
+
+       pButton = new (std::nothrow) Button;
+       TryReturnVoid(pButton != null, "new Button() is null.");
+       pButton->Construct(Rectangle(50, 162, clientRect.width - 100, 74), L"from Plain File");
+       pButton->SetActionId(SELECT_FILE);
+       pButton->AddActionEventListener(*this);
+       __pPlainIoPanel->AddControl(*pButton);
+
+       pButton = new (std::nothrow) Button;
+       TryReturnVoid(pButton != null, "new Button() is null.");
+       pButton->Construct(Rectangle(50, 274, clientRect.width - 100, 74), L"from Plain Registry");
+       pButton->SetActionId(SELECT_REGISTRY);
+       pButton->AddActionEventListener(*this);
+       __pPlainIoPanel->AddControl(*pButton);
+}
+
+void
+SelectDictionaryForm::CreateSecureIOPanel(void)
+{
+       Rectangle clientRect = GetClientAreaBounds();
+       Rectangle rect(0, 0, clientRect.width, clientRect.height);
+
+       __pSecureIoPanel = new (std::nothrow) Panel();
+       TryReturnVoid(__pSecureIoPanel != null, "new Panel() is null.");
+
+       __pSecureIoPanel->Construct(rect);
+       AddControl(*__pSecureIoPanel);
+
+       Button* pButton = null;
+       pButton = new (std::nothrow) Button;
+       TryReturnVoid(pButton != null, "new Button() is null.");
+       pButton->Construct(Rectangle(50, 50, clientRect.width - 100, 74), L"from Secure Database");
+       pButton->SetActionId(SELECT_SECURE_DATABASE);
+       pButton->AddActionEventListener(*this);
+       __pSecureIoPanel->AddControl(*pButton);
+
+       pButton = new (std::nothrow) Button;
+       TryReturnVoid(pButton != null, "new Button() is null.");
+       pButton->Construct(Rectangle(50, 162, clientRect.width - 100, 74), L"from Secure File");
+       pButton->SetActionId(SELECT_SECURE_FILE);
+       pButton->AddActionEventListener(*this);
+       __pSecureIoPanel->AddControl(*pButton);
+
+       pButton = new (std::nothrow) Button;
+       TryReturnVoid(pButton != null, "new Button() is null.");
+       pButton->Construct(Rectangle(50, 274, clientRect.width - 100, 74), L"from Secure Registry");
+       pButton->SetActionId(SELECT_SECURE_REGISTRY);
+       pButton->AddActionEventListener(*this);
+       __pSecureIoPanel->AddControl(*pButton);
+}
+
+void
+SelectDictionaryForm::OnFormBackRequested(Form& source)
+{
+       UiApp* pApp = UiApp::GetInstance();
+       AppAssert(pApp);
+       pApp->Terminate();
+}
diff --git a/project/src/ViewDescriptForm.cpp b/project/src/ViewDescriptForm.cpp
new file mode 100644 (file)
index 0000000..4b79065
--- /dev/null
@@ -0,0 +1,127 @@
+//
+// Tizen C++ SDK
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 "ViewDescriptForm.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Graphics;
+
+ViewDescriptForm::ViewDescriptForm(void)
+{
+}
+
+ViewDescriptForm::~ViewDescriptForm(void)
+{
+}
+
+result
+ViewDescriptForm::Construct(String* pstr)
+{
+       __strDescription = *pstr;
+
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       EditArea* pEaEditor = new (std::nothrow) EditArea;
+       TryReturn(pEaEditor != null, E_OUT_OF_MEMORY, "new EditArea() is null");
+
+       TryReturn(pEaEditor != null, E_OUT_OF_MEMORY, "new EditArea() is null");
+
+       Rectangle rect = Rectangle(10, 10, GetClientAreaBounds().width - 20, GetClientAreaBounds().height - 15);
+       result r = pEaEditor->Construct(rect);
+       TryReturn(r == E_SUCCESS, r, "FileViewForm - EditArea::Construct() is failed by %s", GetErrorMessage(r));
+
+       pEaEditor->SetKeypadEnabled(false);
+
+       r = AddControl(*pEaEditor);
+       TryReturn(r == E_SUCCESS, r, "FileViewForm - AddControl() is failed by %s", GetErrorMessage(r));
+
+       pEaEditor->SetText(__strDescription);
+
+       return E_SUCCESS;
+}
+
+bool
+ViewDescriptForm::Initialize(void)
+{
+       Form::Construct(FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
+
+       return true;
+}
+
+result
+ViewDescriptForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       SetFormBackEventListener(this);
+
+       EditArea* pEaEditor = new (std::nothrow) EditArea;
+
+       Rectangle rect = Rectangle(10, 10, GetClientAreaBounds().width - 20, GetClientAreaBounds().height - 15);
+       pEaEditor->Construct(rect);
+
+       pEaEditor->SetKeypadEnabled(false);
+
+       AddControl(*pEaEditor);
+
+       pEaEditor->SetText(__strDescription);
+
+       Header* pHeader = GetHeader();
+       pHeader->SetTitleText(L"DESCRIPTION");
+
+       Footer* pFooter = GetFooter();
+       pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
+       pFooter->SetBackButton();
+
+       return r;
+}
+
+void
+ViewDescriptForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoBackward(BackwardSceneTransition());
+}
+
+
+void
+ViewDescriptForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
+                                                          const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+       if (pArgs != null)
+       {
+               __strDescription = *((String*)pArgs->GetAt(0));
+
+               EditArea* pEaEditor = static_cast<EditArea*>(GetControl(0));
+               pEaEditor->SetText(__strDescription);
+
+               pArgs->RemoveAll(true);
+               delete pArgs;
+       }
+}
+
+void
+ViewDescriptForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
+                                                               const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+
+}
diff --git a/sample.xml b/sample.xml
new file mode 100644 (file)
index 0000000..b83b3e8
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template>
+                
+       <slp-property>
+               <property-group>
+                       <sample-name>Dictionary</sample-name>
+                       <category>Sample</category>
+                       <sdk-version>1.00</sdk-version>
+                       <project-type>org.tizen.nativecpp.buildArtefactType.app</project-type>                  
+                       <sample-description>description.xml</sample-description>
+               </property-group>
+       </slp-property>
+       
+       <process type="org.tizen.nativeappcommon.TizenCopyFolder">
+               <simple name="projectName" value="$(projectName)"/>
+               <simple name="folderPath" value="project"/>
+               <complex-array name="replaceableFiles">
+                 <element>
+                               <simple name="sourcePath" value="manifest.xml"/>
+                               <simple name="targetPath" value="manifest.xml"/>
+                               <simple name="replaceable" value = "true"/>
+                       </element>
+               </complex-array>
+       </process>
+       <process type="org.tizen.nativecpp.SetDefaultFrameworks">
+               <simple name="projectName" value="$(projectName)"/>
+               <complex-array name="frameworkList">
+                       <element>
+                               <simple name="framework" value="osp"/>
+                       </element>
+               </complex-array>
+       </process>
+       
+</template>
diff --git a/screenshot.png b/screenshot.png
new file mode 100755 (executable)
index 0000000..d4c2b92
Binary files /dev/null and b/screenshot.png differ