From: Jinkun Jang Date: Sat, 16 Mar 2013 11:55:56 +0000 (+0900) Subject: sync with master X-Git-Tag: accepted/tizen_2.1/20130425.023719~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08b3b1074f28a49e3597577ca3dc1bae38160e63;p=apps%2Fosp%2FInstaller.git sync with master --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..c056ca0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +# Target name and AppID +## TODO : set application name and PKG_ID +SET(this_target Installer) +SET(PKG_ID D7eOJquGtL) + +# include directory +INCLUDE_DIRECTORIES( + /usr/include/osp + inc + ) + +# Source files +FILE(GLOB ${this_target}_SOURCE_FILES src/*.cpp) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") + +# Create executable +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") +ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES}) + +# Set link libraries and link options +## TODO : add more link libraries and options +TARGET_LINK_LIBRARIES(${this_target} -L/usr/lib/osp osp-appfw osp-uifw osp-media osp-image pthread) +TARGET_LINK_LIBRARIES(${this_target} -Xlinker --allow-shlib-undefined -pthread -pie) + +# Copy info, data, res, and icons directories +INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${PKG_ID}/bin) + +# Copy resource +INSTALL(FILES ${CMAKE_SOURCE_DIR}/manifest.xml DESTINATION ../usr/apps/${PKG_ID}/info) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ../usr/apps/${PKG_ID}) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/shared DESTINATION ../usr/apps/${PKG_ID}) diff --git a/inc/IstDetailForm.h b/inc/IstDetailForm.h new file mode 100644 index 0000000..600e34a --- /dev/null +++ b/inc/IstDetailForm.h @@ -0,0 +1,99 @@ +// +// 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. +// + +/** + * @file: IstDetailForm.h + * @brief: This file contains the implementation of IstDetailForm class, which acts as a + * application installer displaying a list of all the privilege description in the TPK file + * and install a package that can be consist of several application. + */ +#ifndef _IST_DETAIL_FORM_H_ +#define _IST_DETAIL_FORM_H_ + +#include +#include +#include + +class DetailForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IGroupedTableViewItemEventListener + , public Tizen::Ui::Controls::IGroupedTableViewItemProvider + , public Tizen::Ui::Scenes::ISceneEventListener +{ + +// Construction +public: + DetailForm(void); + virtual ~DetailForm(void); + bool Initialize(); + void CreateTableView(void); + void ConfirmPopupOn(); + result GetInfoValue(int groupIndex, int itemIndex, Tizen::Base::String& name, Tizen::Base::String& description); + result ParsingTPK(); + result ResizeSubText(int lineCount, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TextBox* pSubTextBox); + void SetInfoTextBox(); + void SetListItemImage(Tizen::App::AppResource* pAppResource); + void SetPopupControl(); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + virtual void OnFormBackRequested(Form& source); + virtual void OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status); + virtual void OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status); + virtual void OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated); + virtual int GetGroupCount(void); + virtual int GetItemCount(int groupIndex); + virtual Tizen::Ui::Controls::TableViewGroupItem* CreateGroupItem(int groupIndex, int itemWidth); + virtual Tizen::Ui::Controls::TableViewItem* CreateItem(int groupIndex, int itemIndex, int itemWidth); + virtual bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem); + virtual void UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem); + virtual bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem); + virtual void UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem); + virtual int GetDefaultGroupItemHeight(void); + virtual int GetDefaultItemHeight(void); + 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::Ui::Controls::Popup* __pPopup; + Tizen::Ui::Controls::TextBox* __pTextBox; + Tizen::Ui::Controls::ListView* __pInfoList; + Tizen::Ui::Controls::TableView* __pTableList; + Tizen::Ui::Controls::GroupedTableView* __pList; + Tizen::Ui::Controls::Label* __pShowAllImageLable; + Tizen::Ui::Controls::Label* __pPreInstallLabel; + Tizen::Graphics::Bitmap* __pHome; + Tizen::Graphics::Bitmap* __pHeaderImage; + Tizen::Graphics::Bitmap* __pDropDown; + Tizen::Graphics::Bitmap* __pDropDown2; + Tizen::Graphics::Bitmap* __pRollUp; + Tizen::Graphics::Bitmap* __pCheckImage; + + Tizen::App::Package::PackageInfo* __pTargetPackageInfo; + Tizen::Base::Collection::IList* __pPrivilegeList; + Tizen::Ui::Controls::Header* __pHeader; + + int __itemCount; + bool __isInstalled; + bool __isUpdatable; +}; + +#endif diff --git a/inc/IstFormFactory.h b/inc/IstFormFactory.h new file mode 100644 index 0000000..d4baacd --- /dev/null +++ b/inc/IstFormFactory.h @@ -0,0 +1,39 @@ +// +// 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. +// + +/** + *@file: IstFormFactory.h + *@brief: This file contains the implementation InstallServiceFormFactory class, which manages + *all the forms of the application. + */ + +#ifndef _IST_FORM_FACTORY_H_ +#define _IST_FORM_FACTORY_H_ + +#include + + +class FormFactory + : public Tizen::Ui::Scenes::IFormFactory +{ +public: + FormFactory(void); + virtual ~FormFactory(void); + + virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId); +}; + +#endif // _IST_FORM_FACTORY_H_ diff --git a/inc/IstInstallEventListener.h b/inc/IstInstallEventListener.h new file mode 100644 index 0000000..fea3ce2 --- /dev/null +++ b/inc/IstInstallEventListener.h @@ -0,0 +1,43 @@ +// +// 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. +// + +/** + * @file: IstAppInstall.h + * @brief: This file contains the implementation of IstAppInstall class, which acts as a + * application installer processing a installation of application. This form also notify + * completion of installation to IstAppInstallForm. + */ + +#ifndef _IST_INSTALL_EVENT_LISTENER_H_ +#define _IST_INSTALL_EVENT_LISTENER_H_ + + +#include + +class InstallEventListener + : public Tizen::App::Package::IPackageInstallationResponseListener +{ +public: + InstallEventListener(); + virtual ~InstallEventListener(); + + // package install Response Listener + virtual void OnPackageInstallationResponseReceived(const Tizen::Base::String& packageId, + Tizen::App::Package::PackageInstallationResult installationResult); + virtual void OnPackageInstallationInProgressResponseReceived(const Tizen::Base::String& packageId, int progress); +}; + +#endif /* _IST_INSTALL_EVENT_LISTENER_H_ */ diff --git a/inc/IstInstallForm.h b/inc/IstInstallForm.h new file mode 100644 index 0000000..b5bc039 --- /dev/null +++ b/inc/IstInstallForm.h @@ -0,0 +1,81 @@ +// +// 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. +// + +/** + * @file: IstAppInstallForm.h + * @brief: This file contains the implementation of IstAppInstallForm class, which acts as a + * application installer displaying a progress of installation of application. This form also open + * target application or close installer itself. + */ +#ifndef _IST_INSTALL_FORM_H_ +#define _IST_INSTALL_FORM_H_ + +#include +#include + +using namespace Tizen::Base::Runtime; + +class InstallForm + : public Tizen::Base::Runtime::ITimerEventListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ + +public: + InstallForm(void); + virtual ~InstallForm(void); + bool Initialize(); + void AddFooterItem(); + void InstallApplication(); + void OnPopup(); + void SetPopupValueAndOn(Tizen::Base::String title, Tizen::Base::String content); + void SetPopupControl(); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + virtual void OnTimerExpired(Timer& timer); + virtual void OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs); + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + virtual void OnFormBackRequested(Form& source); + 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: + int __timerCounter; + bool __isInstalling; + bool __isInstallSuccess; + + Timer* __pTimer; + Tizen::Ui::Controls::Header* __pHeader; + Tizen::Ui::Controls::Label* __pProgressLabel; + Tizen::Ui::Controls::Label* __progressImageLabel; + Tizen::Ui::Controls::Progress* __pProgress; + Tizen::Ui::Controls::Popup* __pPopup; + Tizen::Ui::Controls::TextBox* __pPopupTextBox; + + Tizen::Graphics::Bitmap* __pProgressImage; + Tizen::Graphics::Bitmap* __pProgressEfImage; + + Tizen::Base::String __packageOperationId; + Tizen::Base::String __packageName; + Tizen::App::AppManager* __pAppManager; + +}; + +#endif diff --git a/inc/IstInstallerApp.h b/inc/IstInstallerApp.h new file mode 100644 index 0000000..6d06d05 --- /dev/null +++ b/inc/IstInstallerApp.h @@ -0,0 +1,66 @@ +// +// 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. +// + +/** + * @file: IstInstallerApp.h + * @brief: This file contains the declaration of InstallerApp Class, + * which provides basic features necessary to define an UiApp. + */ + +#ifndef _IST_INSTALLER_APP_H_ +#define _IST_INSTALLER_APP_H_ + +#include +#include +#include +#include + + + +class InstallerApp + : public Tizen::App::UiApp + , public Tizen::App::IAppControlProviderEventListener + , public Tizen::System::IScreenEventListener +{ +public: + static Tizen::App::UiApp* CreateInstance(void); + InstallerApp(void); + virtual~InstallerApp(void); + Tizen::Base::String GetPackagePath(); + bool IsValidAccess(); + + virtual bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry); + virtual bool OnAppInitialized(void); + virtual bool OnAppWillTerminate(void); + virtual bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false); + virtual void OnForeground(void); + virtual void OnBackground(void); + virtual void OnLowMemory(void); + virtual void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel); + virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, + const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, + const Tizen::Base::Collection::IMap* pExtraData); + virtual void OnScreenOn(void); + virtual void OnScreenOff(void); + +private: + void SetUri(Tizen::Base::String uriData); + void SetPackagePath(Tizen::Base::String packagePath); + + bool __isValidAccess; +}; + +#endif // _IST_INSTALLER_APP_H_ diff --git a/inc/IstMainFrame.h b/inc/IstMainFrame.h new file mode 100644 index 0000000..a8e2f24 --- /dev/null +++ b/inc/IstMainFrame.h @@ -0,0 +1,20 @@ +#ifndef _IST_MAIN_FRAME_H_ +#define _IST_MAIN_FRAME_H_ + +#include +#include + + +class MainFrame + : public Tizen::Ui::Controls::Frame +{ +public: + MainFrame(void); + virtual ~MainFrame(void); + +public: + virtual result OnInitializing(void); + virtual result OnTerminating(void); +}; + +#endif //_IST_MAIN_FRAME_H_ diff --git a/inc/IstPanelFactory.h b/inc/IstPanelFactory.h new file mode 100644 index 0000000..b992ee2 --- /dev/null +++ b/inc/IstPanelFactory.h @@ -0,0 +1,39 @@ +// +// 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. +// + +/** + * @file: IstPanelFactory.h + * @brief: This file contains the implementation of InstallServicePanelFactory class, which manages + * all the panel containers used across the application. + */ + +#ifndef _IST_PANEL_FACTORY_H_ +#define _IST_PANEL_FACTORY_H_ + +#include + + +class PanelFactory + : public Tizen::Ui::Scenes::IPanelFactory +{ +public: + PanelFactory(void); + virtual ~PanelFactory(void); + + virtual Tizen::Ui::Controls::Panel* CreatePanelN(const Tizen::Base::String& panelId, const Tizen::Ui::Scenes::SceneId& sceneId); +}; + +#endif // _IST_PANEL_FACTORY_H_ diff --git a/inc/IstTypes.h b/inc/IstTypes.h new file mode 100644 index 0000000..80d7f21 --- /dev/null +++ b/inc/IstTypes.h @@ -0,0 +1,54 @@ +// +// 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. +// + +/** + * @file: IstTypes.h + * @brief: This file contains common enumerators, static constants used across the application + */ + +#ifndef _IST_TYPES_H_ +#define _IST_TYPES_H_ + +#include +#include + +using namespace Tizen::Graphics; + +static const int INSTALL_SUCCESS_EVENT = 2000; +static const int INSTALL_FAIL_STORAGE_FULL = 2001; +static const int INSTALL_FAIL_INVALID_PACKAGE = 2002; + +extern const wchar_t* HEADER_IMAGE; +extern const wchar_t* APP_NAME; +extern const wchar_t* FILE_URI_SCHEME; + +extern Tizen::Base::String __uriData; +extern Tizen::Base::String __packagePath; + +extern const int GAP_BETWEEN_FORM_POPUP; +extern const int X_POPUP_LABLE; +extern const int Y_POPUP_LABLE; +extern const int H_POPUP_LABLE; +extern const int GAP_BETWEEN_POPUP_LABEL; +extern const int GAP_BETWEEN_POPUP_BUTTON; +extern const int UI_H_POPUP; +extern const int UI_H_POPUP_BUTTON; +extern const int H_POPUP_TITLE; +extern const int H_TEXT_LINE; +extern const int GAP_BETWEEN_BUTTON; +extern const int X_CANCEL_BTN_ALONE; + +#endif /* _IST_TYPES_H_ */ diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..39cf499 --- /dev/null +++ b/manifest.xml @@ -0,0 +1,35 @@ + + + D7eOJquGtL + 1.0.0 + C++App + + true + true + + + 2.0 + + http://tizen.org/privilege/application.launch + http://tizen.org/privilege/packageinfo + http://tizen.org/privilege/application.kill + http://tizen.org/privilege/packagemanager.install + + + + + + Installer + + + mainmenu.png + + + + http://tizen.org/appcontrol/operation/install + + + + + + diff --git a/packaging/apps.Installer.spec b/packaging/apps.Installer.spec new file mode 100755 index 0000000..ae657ee --- /dev/null +++ b/packaging/apps.Installer.spec @@ -0,0 +1,53 @@ +Name: apps.Installer +Summary: Installer application +Version: 1.0.1 +Release: 1 +Group: TO_BE/FILLED_IN +License: TO BE FILLED IN +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(osp-appfw) +BuildRequires: pkgconfig(osp-uifw) +BuildRequires: pkgconfig(osp-media) +BuildRequires: pkgconfig(osp-image) +BuildRequires: pkgconfig(osp-image-core) + +%description +Verification application: Installer + +%prep +%setup -q + +%build +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%ifarch %{ix86} +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%else +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%endif + +# Call make instruction with smp support +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post +/sbin/ldconfig +PKG_ID=D7eOJquGtL +echo "/usr/etc/package-manager/backend/tpk -i /usr/apps/"${PKG_ID} +/usr/etc/package-manager/backend/tpk -i /usr/apps/${PKG_ID} +cp -f /usr/lib/osp/osp-service-app-loader /usr/apps/${PKG_ID}/bin/Installer + +%postun +/sbin/ldconfig +PKG_ID=D7eOJquGtL +echo "/usr/etc/package-manager/backend/tpk -u "${PKG_ID} +/usr/etc/package-manager/backend/tpk -u ${PKG_ID} + +%files +%defattr(-,root,root,-) +/usr/apps/* + + diff --git a/res/.workflow b/res/.workflow new file mode 100644 index 0000000..f41112c Binary files /dev/null and b/res/.workflow differ diff --git a/res/screen-density-xhigh/00_button_radio_select.png b/res/screen-density-xhigh/00_button_radio_select.png new file mode 100644 index 0000000..304d61b Binary files /dev/null and b/res/screen-density-xhigh/00_button_radio_select.png differ diff --git a/res/screen-density-xhigh/00_button_radio_select_dim.png b/res/screen-density-xhigh/00_button_radio_select_dim.png new file mode 100644 index 0000000..8e71cc0 Binary files /dev/null and b/res/screen-density-xhigh/00_button_radio_select_dim.png differ diff --git a/res/screen-density-xhigh/00_check_checking_dim.png b/res/screen-density-xhigh/00_check_checking_dim.png new file mode 100644 index 0000000..4d5c284 Binary files /dev/null and b/res/screen-density-xhigh/00_check_checking_dim.png differ diff --git a/res/screen-density-xhigh/00_icon_more.png b/res/screen-density-xhigh/00_icon_more.png new file mode 100644 index 0000000..8e90481 Binary files /dev/null and b/res/screen-density-xhigh/00_icon_more.png differ diff --git a/res/screen-density-xhigh/00_icon_more_ef.png b/res/screen-density-xhigh/00_icon_more_ef.png new file mode 100644 index 0000000..3c8323a Binary files /dev/null and b/res/screen-density-xhigh/00_icon_more_ef.png differ diff --git a/res/screen-density-xhigh/00_icon_more_press.png b/res/screen-density-xhigh/00_icon_more_press.png new file mode 100644 index 0000000..3a13509 Binary files /dev/null and b/res/screen-density-xhigh/00_icon_more_press.png differ diff --git a/res/screen-density-xhigh/00_list_expand_closed.png b/res/screen-density-xhigh/00_list_expand_closed.png new file mode 100644 index 0000000..a3f639e Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_closed.png differ diff --git a/res/screen-density-xhigh/00_list_expand_closed_press.png b/res/screen-density-xhigh/00_list_expand_closed_press.png new file mode 100644 index 0000000..b421ad1 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_closed_press.png differ diff --git a/res/screen-density-xhigh/00_list_expand_opened.png b/res/screen-density-xhigh/00_list_expand_opened.png new file mode 100644 index 0000000..377dbc9 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_opened.png differ diff --git a/res/screen-density-xhigh/00_list_expand_opened_press.png b/res/screen-density-xhigh/00_list_expand_opened_press.png new file mode 100644 index 0000000..1b49c94 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_opened_press.png differ diff --git a/res/screen-density-xhigh/00_progress_pending_02_bg.png b/res/screen-density-xhigh/00_progress_pending_02_bg.png new file mode 100644 index 0000000..685d87c Binary files /dev/null and b/res/screen-density-xhigh/00_progress_pending_02_bg.png differ diff --git a/res/screen-density-xhigh/00_progress_pending_ef_02_bg.png b/res/screen-density-xhigh/00_progress_pending_ef_02_bg.png new file mode 100644 index 0000000..367442e Binary files /dev/null and b/res/screen-density-xhigh/00_progress_pending_ef_02_bg.png differ diff --git a/res/screen-density-xhigh/00_time_picker_tail.png b/res/screen-density-xhigh/00_time_picker_tail.png new file mode 100644 index 0000000..eea39f7 Binary files /dev/null and b/res/screen-density-xhigh/00_time_picker_tail.png differ diff --git a/res/screen-density-xhigh/00_time_picker_tail_01.png b/res/screen-density-xhigh/00_time_picker_tail_01.png new file mode 100644 index 0000000..922ae4f Binary files /dev/null and b/res/screen-density-xhigh/00_time_picker_tail_01.png differ diff --git a/res/screen-density-xhigh/alarm_type2.png b/res/screen-density-xhigh/alarm_type2.png new file mode 100644 index 0000000..477171c Binary files /dev/null and b/res/screen-density-xhigh/alarm_type2.png differ diff --git a/res/screen-density-xhigh/home_type3.png b/res/screen-density-xhigh/home_type3.png new file mode 100644 index 0000000..0d41338 Binary files /dev/null and b/res/screen-density-xhigh/home_type3.png differ diff --git a/res/screen-density-xhigh/message_type2.png b/res/screen-density-xhigh/message_type2.png new file mode 100644 index 0000000..53efabe Binary files /dev/null and b/res/screen-density-xhigh/message_type2.png differ diff --git a/res/screen-size-normal/IDL_APP_INSTALL_FORM.xml b/res/screen-size-normal/IDL_APP_INSTALL_FORM.xml new file mode 100644 index 0000000..b1f0383 --- /dev/null +++ b/res/screen-size-normal/IDL_APP_INSTALL_FORM.xml @@ -0,0 +1,31 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+ + + + + + +
diff --git a/res/screen-size-normal/IDL_DETAIL_FORM.xml b/res/screen-size-normal/IDL_DETAIL_FORM.xml new file mode 100644 index 0000000..270f785 --- /dev/null +++ b/res/screen-size-normal/IDL_DETAIL_FORM.xml @@ -0,0 +1,33 @@ + + + + + 720 +
+ + + + +
+ + + + +
+
+ + +
+ + + + + + + + + + +
diff --git a/res/screen-size-normal/workflow.xml b/res/screen-size-normal/workflow.xml new file mode 100644 index 0000000..e89967c --- /dev/null +++ b/res/screen-size-normal/workflow.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/shared/res/screen-density-xhigh/mainmenu.png b/shared/res/screen-density-xhigh/mainmenu.png new file mode 100644 index 0000000..983c883 Binary files /dev/null and b/shared/res/screen-density-xhigh/mainmenu.png differ diff --git a/src/InstallerEntry.cpp b/src/InstallerEntry.cpp new file mode 100644 index 0000000..da96449 --- /dev/null +++ b/src/InstallerEntry.cpp @@ -0,0 +1,53 @@ +// +// 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 "IstInstallerApp.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + + +// +// The entry function of Tizen application called by the operating system. +// +_EXPORT_ int +OspMain(int argc, char* pArgv[]) +{ + AppLog("Application started."); + ArrayList args(SingleObjectDeleter); + args.Construct(); + for (int i = 0; i < argc; i++) + { + args.Add(new (std::nothrow) String(pArgv[i])); + } + + result r = Tizen::App::UiApp::Execute(InstallerApp::CreateInstance, &args); + TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r)); + AppLog("Application finished."); + + return static_cast(r); +} +#ifdef __cplusplus +} +#endif // __cplusplus diff --git a/src/IstDetailForm.cpp b/src/IstDetailForm.cpp new file mode 100644 index 0000000..dd017e8 --- /dev/null +++ b/src/IstDetailForm.cpp @@ -0,0 +1,506 @@ +// +// 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. +// + +/** + * @file: IstDetailForm.cpp + * @brief: This file contains the implementation of IstDetailForm class, which acts as a + * application installer displaying a list of all the privilege description in the TPK file + * and install a package that can be consist of several application. + */ +#include +#include +#include "IstDetailForm.h" +#include "IstInstallerApp.h" +#include "IstInstallEventListener.h" +#include "IstInstallerApp.h" +#include "IstTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::App; +using namespace Tizen::App::Package; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; +using namespace Tizen::Security; +using namespace Tizen::App::Package; + +static const int IDA_INSTALL_BTN = 101; + +static const int ID_BUTTON_CLOSE_POPUP = 503; +static const int ID_BUTTON_INSTALL_POPUP = 502; +static const wchar_t LIST_IMAGE_PATH1[] = L"00_button_radio_select_dim.png"; +static const wchar_t DROP_DOWN_IMAGE[] = L"00_list_expand_closed.png"; +static const wchar_t ROLL_UP_IMAGE[] = L"00_list_expand_opened.png"; +static const wchar_t ELM_CHECK_IMAGE[] = L"00_check_checking_dim.png"; + +// Color +static const Color UI_COLOR_WHITE = Color(248, 246, 239, 100); +static const Color UI_COLOR_WHITE2 = Color(0, 0, 0, 0); +// Font +static const int FONT_SIZE_MAIN_TEXT = 33; +static const int FONT_SIZE_SUB_TEXT = 30; +// Control Position & Size +static const int X_TABLE_VIEW_LIST = 0; +static const int Y_TABLE_VIEW_LIST = 250; +static const int X_MAIN_TEXT_LABEL = 80; +static const int Y_MAIN_TEXT_LABEL = 0; +static const int H_MAIN_TEXT_LABEL = 70; +static const int X_SUB_TEXT_LABEL = 95; +static const int Y_SUB_TEXT_LABEL = H_MAIN_TEXT_LABEL - 10; +static const int H_SUB_TEXT_LABEL = 45; +static const int X_MAIN_TEXT_IMAGE = 40; +static const int Y_MAIN_TEXT_IMAGE = 9; +static const int W_MAIN_TEXT_IMAGE = 50; +static const int H_MAIN_TEXT_IMAGE = 50; +static const int H_TABLE_VIEW_LIST_LINE = H_MAIN_TEXT_LABEL + H_SUB_TEXT_LABEL+ 20; + + +DetailForm::DetailForm(void) +{ +} + +DetailForm::~DetailForm(void) +{ +} + +bool +DetailForm::Initialize() +{ + Form::Construct(L"IDL_DETAIL_FORM"); + + return true; +} + +void +DetailForm::CreateTableView(void) +{ + Rectangle rect = GetClientAreaBounds(); + __pList = new (std::nothrow) GroupedTableView(); + __pList->Construct(Rectangle(X_TABLE_VIEW_LIST, Y_TABLE_VIEW_LIST, rect.width, rect.height - (__pTextBox->GetY() + __pTextBox->GetHeight())), true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT); + __pList->SetItemProvider(this); + __pList->AddGroupedTableViewItemEventListener(*this); + + AddControl(*__pList); + +} + +void +DetailForm::ConfirmPopupOn() +{ + __pPopup->SetShowState(true); + __pPopup->Show(); +} + +result +DetailForm::GetInfoValue(int groupIndex, int itemIndex, String& name, String& description) +{ + String value; + String privilege; + + TryReturn(groupIndex == 0, E_FAILURE, "Group Index Error"); + privilege = dynamic_cast (__pPrivilegeList->GetAt(itemIndex))->GetPointer(); + + name = PrivilegeInfo::GetName(privilege); + description = PrivilegeInfo::GetDescription(privilege); + + return E_SUCCESS; +} + +result +DetailForm::ParsingTPK() +{ + PackageManager* pMgr = PackageManager::GetInstance(); + String filePath; + String packageId; + String localVersion; + PackageInfo* pLocalPackageInfo; + + filePath = static_cast(UiApp::GetInstance())->GetPackagePath(); + // 2. parsing tpk file with file-path + __pTargetPackageInfo = pMgr->GetPackageInfoFromFileN(filePath); + TryReturn(__pTargetPackageInfo, E_FAILURE, "Package Path is not delivered"); + + __pHeader->SetTitleText(__pTargetPackageInfo->GetDisplayName()); + packageId = __pTargetPackageInfo->GetId().GetPointer(); + TryReturn(packageId.IsEmpty() == false, E_FAILURE, "pakcageId is Empty!!!"); + + pLocalPackageInfo = pMgr->GetPackageInfoN(packageId); + + // is the package already installed on local + if (pMgr->IsPackageInstalled(packageId)) + { + TryReturn(pLocalPackageInfo != NULL, E_FAILURE, "Local Package Info get Error"); + + __isInstalled = true; + localVersion = pLocalPackageInfo->GetVersion(); + // Upper Version Check + if (__pTargetPackageInfo->GetVersion().CompareTo(localVersion) <= 0){ + __isUpdatable = false; + } + else{ + __isUpdatable = true; + } + } + else{ + __isInstalled = false; + } + + __pPrivilegeList = __pTargetPackageInfo->GetPrivilegeListN(); + if (__pPrivilegeList) { + __itemCount = __pPrivilegeList->GetCount(); + } + else{ + AppLog("No Privilege List"); + } + + return E_SUCCESS; +} + + +result +DetailForm::ResizeSubText(int lineCount, TableViewItem* pItem, TextBox* pSubTextBox) +{ + result res = E_SUCCESS; + TryReturn(lineCount > 1, E_SUCCESS, ""); + + pItem->SetSize(pItem->GetWidth(), pItem->GetHeight() + H_SUB_TEXT_LABEL * (lineCount - 1)); + pSubTextBox->SetSize(pSubTextBox->GetWidth(), H_SUB_TEXT_LABEL * lineCount); + + return res; +} + +void +DetailForm::SetInfoTextBox() +{ + String installMsg = L"Do you want to install this application?\n\nAllow this application to:"; + if (__isInstalled){ + installMsg.Append(L"\n\n(application will be updated)"); + } + __pTextBox = static_cast(GetControl(L"IDC_INFO_TEXTBOX")); + __pTextBox->SetText(installMsg); + __pTextBox->SetColor(TEXT_BOX_STATUS_NORMAL, UI_COLOR_WHITE); + __pTextBox->Invalidate(false); +} + +void +DetailForm::SetListItemImage(AppResource* pAppResource) +{ + __pHome = pAppResource->GetBitmapN(LIST_IMAGE_PATH1); + __pDropDown = pAppResource->GetBitmapN(DROP_DOWN_IMAGE); + __pHeaderImage = pAppResource->GetBitmapN(HEADER_IMAGE); + __pCheckImage = pAppResource->GetBitmapN(ELM_CHECK_IMAGE); + __pRollUp = pAppResource->GetBitmapN(ROLL_UP_IMAGE); +} + + +void +DetailForm::SetPopupControl() +{ + int popupWidth = GetClientAreaBounds().width - GAP_BETWEEN_FORM_POPUP * 2; + __pPopup = new (std::nothrow) Popup(); + __pPopup->Construct(true, Dimension(popupWidth, UI_H_POPUP)); + __pPopup->SetTitleText(L"Install Application"); + __pPopup->SetTitleTextColor(Color::GetColor(COLOR_ID_BLACK)); + + Label* popUpLabel = new (std::nothrow) Label(); + popUpLabel->Construct(Rectangle(X_POPUP_LABLE, Y_POPUP_LABLE, __pPopup->GetBounds().width - GAP_BETWEEN_POPUP_LABEL*2, H_POPUP_LABLE), L"Application installation will be start."); + popUpLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + popUpLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); + + TextBox* pTextBox = new TextBox(); + pTextBox->Construct(Rectangle(X_POPUP_LABLE, Y_POPUP_LABLE, __pPopup->GetBounds().width - GAP_BETWEEN_POPUP_LABEL*2, UI_H_POPUP - H_POPUP_TITLE), TEXT_BOX_BORDER_NONE); + pTextBox->SetText(L"Application is already installed\n\nInstallation will be closed."); + pTextBox->SetTextSize(33); + + Button* pButtonInstall = new (std::nothrow) Button(); + int buttonWidth = __pPopup->GetBounds().width/2 - GAP_BETWEEN_POPUP_BUTTON; + pButtonInstall->Construct(Rectangle(GetClientAreaBounds().x, pTextBox->GetBounds().y + H_TEXT_LINE, buttonWidth , UI_H_POPUP_BUTTON), L"Install"); + pButtonInstall->SetActionId(ID_BUTTON_INSTALL_POPUP); + pButtonInstall->AddActionEventListener(*this); + + Button* pButtonClose = new (std::nothrow) Button(); + pButtonClose->Construct(Rectangle(GetClientAreaBounds().x + buttonWidth + GAP_BETWEEN_BUTTON , pTextBox->GetBounds().y + H_TEXT_LINE, __pPopup->GetBounds().width/2 - 30, UI_H_POPUP_BUTTON), L"Close"); + pButtonClose->SetActionId(ID_BUTTON_CLOSE_POPUP); + pButtonClose->AddActionEventListener(*this); + + InstallerApp* pUiApp = static_cast(UiApp::GetInstance()); + String packagePath = pUiApp->GetPackagePath(); + if (packagePath.IsEmpty() || pUiApp->IsValidAccess() == false){ + pTextBox->SetText(L"Wrong Execution."); + __pPopup->AddControl(*pTextBox); + pButtonClose->SetPosition(X_CANCEL_BTN_ALONE, pButtonClose->GetY()); + } + else if (__isInstalled && !__isUpdatable){ + __pPopup->AddControl(*pTextBox); + pButtonClose->SetPosition(X_CANCEL_BTN_ALONE, pButtonClose->GetY()); + } + else{ + __pPopup->AddControl(*popUpLabel); + __pPopup->AddControl(*pButtonInstall); + } + __pPopup->AddControl(*pButtonClose); +} + +result +DetailForm::OnInitializing(void) +{ + result r = E_SUCCESS; + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + + // Set Image Control + SetListItemImage(pAppResource); + + // Header Item set + __pHeader = GetHeader(); + __pHeader->SetTitleIcon(__pHeaderImage); + + // Footer Item Set + Footer* pFooter = GetFooter(); + SetFormBackEventListener(this); + pFooter->AddActionEventListener(*this); + + // initialize variable + __itemCount = 0; + __isUpdatable = false; + __isInstalled = false; + + // parsing tpk package info then get and set item count + ParsingTPK(); + + // Install Confirmation Popup + SetPopupControl(); + + SetInfoTextBox(); + CreateTableView(); + + // Set Disable Controls and Open Popup + ConfirmPopupOn(); + __pTextBox->SetShowState(false); + __pList->SetShowState(false); + + Invalidate(true); + + return r; +} + +result +DetailForm::OnTerminating(void) +{ + result r = E_SUCCESS; + + if (__pTargetPackageInfo){ + delete __pTargetPackageInfo; + } + if (__pPrivilegeList){ + delete __pPrivilegeList; + } + + return r; +} + +void +DetailForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + switch (actionId) + { + case IDA_INSTALL_BTN: + { + TryReturnVoid(__pTargetPackageInfo, "target package info is empty"); + + // In case of package update, previous running app has to be closed(killed) + AppManager* pAppManager = AppManager::GetInstance(); + String pakcageId = __pTargetPackageInfo->GetId() + L"." + __pTargetPackageInfo->GetDisplayName(); + AppLog("target package id : %ls" ,pakcageId.GetPointer()); + if (pAppManager->IsRunning(pakcageId)){ + AppLog("App is Running!!"); + //TODO: is this check necessary? + pAppManager->TerminateApplication(pakcageId); + } + + IList* pArgs = null; + pArgs = new (std::nothrow) ArrayList(); + pArgs->Add(*(new (std::nothrow) String(__pTargetPackageInfo->GetDisplayName()))); + + pSceneManager->GoForward(SceneTransitionId(L"ID_SCNT_1"), pArgs); + } + break; + case ID_BUTTON_CLOSE_POPUP: + { + __pPopup->SetShowState(false); + Invalidate(true); + App::GetInstance()->Terminate(); + } + break; + case ID_BUTTON_INSTALL_POPUP: + { + __pPopup->SetShowState(false); + __pTextBox->SetShowState(true); + __pList->SetShowState(true); + Invalidate(true); + } + break; + } +} +void +DetailForm::OnFormBackRequested(Form& source) +{ + UiApp* pApp = UiApp::GetInstance(); + AppAssert(pApp); + pApp->Terminate(); +} + + +void +DetailForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status) +{ +} + +void +DetailForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status) +{ +} + +void +DetailForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated) +{ +} +int +DetailForm::GetGroupCount(void) +{ + return 1; +} + +int +DetailForm::GetItemCount(int groupIndex) +{ + return __itemCount; +} + +Tizen::Ui::Controls::TableViewGroupItem* +DetailForm::CreateGroupItem(int groupIndex, int itemWidth) +{ + TableViewGroupItem* pItem; + pItem = new (std::nothrow) TableViewGroupItem(); + pItem->Construct(Dimension(itemWidth, 10)); + return pItem; +} + + + + +Tizen::Ui::Controls::TableViewItem* +DetailForm::CreateItem(int groupIndex, int itemIndex, int itemWidth) +{ + String name; + String description; + TableViewItem* pItem = new (std::nothrow) TableViewItem(); + Rectangle rect = GetClientAreaBounds(); + + // Get Title and Description + GetInfoValue(groupIndex, itemIndex, name, description); + + pItem->Construct(Tizen::Graphics::Dimension(rect.width, H_TABLE_VIEW_LIST_LINE), TABLE_VIEW_ANNEX_STYLE_NORMAL); + TryReturn(groupIndex == 0, null, ""); + if (itemIndex < GetItemCount(groupIndex)) + { + Label* pMainTextLable = null; + pMainTextLable = new (std::nothrow) Label(); + + pMainTextLable->Construct(Rectangle(X_MAIN_TEXT_LABEL, Y_MAIN_TEXT_LABEL, pItem->GetWidth() - X_MAIN_TEXT_LABEL, H_MAIN_TEXT_LABEL), name); + + Label* pImageLable = null; + Label* pSubTextLabel = null; + TextBox* pSubTextBox = new TextBox(); + + pImageLable = new (std::nothrow) Label(); + pSubTextLabel = new (std::nothrow) Label(); + pSubTextBox = new TextBox(); + + pMainTextLable->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_BOLD); + pMainTextLable->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + pMainTextLable->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + + pImageLable->Construct(Rectangle(X_MAIN_TEXT_IMAGE, Y_MAIN_TEXT_IMAGE, W_MAIN_TEXT_IMAGE, H_MAIN_TEXT_IMAGE), L""); + pImageLable->SetBackgroundBitmap(*__pCheckImage); + + pSubTextBox->Construct(Rectangle(X_SUB_TEXT_LABEL, Y_SUB_TEXT_LABEL, pItem->GetWidth() - X_SUB_TEXT_LABEL, H_SUB_TEXT_LABEL), TEXT_BOX_BORDER_NONE); + pSubTextBox->SetText(description); + pSubTextBox->SetTextSize(FONT_SIZE_SUB_TEXT); + pSubTextBox->SetColor(TEXT_BOX_STATUS_NORMAL, UI_COLOR_WHITE2); + pSubTextBox->SetColor(TEXT_BOX_STATUS_HIGHLIGHTED, UI_COLOR_WHITE2); + pSubTextBox->SetColor(TEXT_BOX_STATUS_DISABLED, UI_COLOR_WHITE2); + ResizeSubText(pSubTextBox->GetLineCount(), pItem, pSubTextBox); + pItem->AddControl(*pMainTextLable); + pItem->AddControl(*pImageLable); + pItem->AddControl(*pSubTextBox); + } + return pItem; +} + +bool +DetailForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem) +{ + delete pItem; + + return true; +} + +void +DetailForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem) +{ + +} + +bool +DetailForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem) +{ + delete pItem; + + return true; +} + +void +DetailForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem) +{ + +} + +int +DetailForm::GetDefaultGroupItemHeight(void) +{ + return 60; +} + +int +DetailForm::GetDefaultItemHeight(void) +{ + return 150; +} + +void +DetailForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) +{ +} + +void +DetailForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId) +{ +} diff --git a/src/IstFormFactory.cpp b/src/IstFormFactory.cpp new file mode 100644 index 0000000..7e0d9d3 --- /dev/null +++ b/src/IstFormFactory.cpp @@ -0,0 +1,60 @@ +// +// 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. +// + +/** + *@file: IstFormFactory.cpp + *@brief: This file contains the implementation InstallServiceFormFactory class, which manages + *all the forms of the application. + */ + +#include "IstFormFactory.h" +#include "IstDetailForm.h" +#include "IstInstallForm.h" + +using namespace Tizen::Ui::Scenes; + + +FormFactory::FormFactory(void) +{ +} + +FormFactory::~FormFactory(void) +{ +} + +Tizen::Ui::Controls::Form* +FormFactory::CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + Tizen::Ui::Controls::Form* pNewForm = null; + + if (formId == L"IDL_DETAIL_FORM") + { + DetailForm* pForm = new DetailForm(); + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == L"IDL_APP_INSTALL_FORM") + { + InstallForm* pForm = new InstallForm(); + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + + return pNewForm; +} diff --git a/src/IstInstallEventListener.cpp b/src/IstInstallEventListener.cpp new file mode 100644 index 0000000..3b3db25 --- /dev/null +++ b/src/IstInstallEventListener.cpp @@ -0,0 +1,80 @@ +// +// 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. +// + +/** + * @file: IstAppInstall.cpp + * @brief: This file contains the implementation of IstAppInstall class, which acts as a + * application installer processing a installation of application. This form also notify + * completion of installation to IstAppInstallForm. + */ + +#include +#include + +#include "IstInstallEventListener.h" +#include "IstTypes.h" + +using namespace Tizen::App; +using namespace Tizen::App::Package; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base; + +InstallEventListener::InstallEventListener() { + +} + +InstallEventListener::~InstallEventListener() { +} + +void +InstallEventListener::OnPackageInstallationResponseReceived(const PackageId& packageId, PackageInstallationResult installationResult) +{ + IList* pArgs = null; + switch(installationResult) + { + case PACKAGE_INSTALLATION_RESULT_SUCCESS: + { + String data = packageId; + + pArgs = new (std::nothrow) ArrayList(); + pArgs->Add(*(new (std::nothrow) String(data))); + UiApp::GetInstance()->GetFrame(APP_NAME)->GetCurrentForm()->SendUserEvent(INSTALL_SUCCESS_EVENT, pArgs); + } + break; + case PACKAGE_INSTALLATION_RESULT_INVALID_PACKAGE: + { + AppLogException("== PACKAGE_INSTALLATION_RESULT_INVALID_PACKAGE == package id : %ls", packageId.GetPointer()); + UiApp::GetInstance()->GetFrame(APP_NAME)->GetCurrentForm()->SendUserEvent(INSTALL_FAIL_INVALID_PACKAGE, pArgs); + } + break; + case PACKAGE_INSTALLATION_RESULT_STORAGE_FULL: + { + AppLogException("== PACKAGE_INSTALLATION_RESULT_STORAGE_FULL == "); + UiApp::GetInstance()->GetFrame(APP_NAME)->GetCurrentForm()->SendUserEvent(INSTALL_FAIL_STORAGE_FULL, pArgs); + } + break; + default: + { + AppLogException("Installation result value is not proper"); + } + break; + } +} + +void +InstallEventListener::OnPackageInstallationInProgressResponseReceived(const PackageId& packageId, int progress) +{ +} diff --git a/src/IstInstallForm.cpp b/src/IstInstallForm.cpp new file mode 100644 index 0000000..f4e8e48 --- /dev/null +++ b/src/IstInstallForm.cpp @@ -0,0 +1,336 @@ +// +// 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. +// + +/** + * @file: IstAppInstallForm.cpp + * @brief: This file contains the implementation of IstAppInstallForm class, which acts as a + * application installer displaying a progress of installation of application. This form also open + * target application or close installer itself. + */ +#include +#include "IstInstallForm.h" +#include "IstInstallEventListener.h" +#include "IstInstallerApp.h" +#include "IstTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::App; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; +using namespace Tizen::App::Package; + +static const int ID_FOOTER_OPEN = 101; +static const int ID_BUTTON_CLOSE_POPUP = 103; +static const wchar_t* PROGRESS_IMAGE = L"00_progress_pending_02_bg.png"; +static const wchar_t* PROGRESS_EF_IMAGE = L"00_progress_pending_ef_02_bg.png"; +static const wchar_t* POPUP_MSESSAGE_SUCCESS = L"Installation success"; +static const wchar_t* POPUP_MSESSAGE_FAIL = L"Installation fail"; + +static const int TIME_COUNT = 40; +InstallForm::InstallForm(void) +{ +} + +InstallForm::~InstallForm(void) +{ +} + +bool +InstallForm::Initialize() +{ + Form::Construct(L"IDL_APP_INSTALL_FORM"); + + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + __pAppManager = AppManager::GetInstance(); + + SetFormBackEventListener(this); + + // init variable + __timerCounter = 0; + __isInstalling = true; + __isInstallSuccess = false; + + // Timer + __pTimer = new (std::nothrow) Timer(); + __pTimer->Construct(*this); + __pTimer->StartAsRepeatable(500); + + // progress test image + __pProgressEfImage = pAppResource->GetBitmapN(PROGRESS_EF_IMAGE); + __pProgressImage = pAppResource->GetBitmapN(PROGRESS_IMAGE); + __progressImageLabel = new (std::nothrow) Label(); + __progressImageLabel->Construct(Rectangle(70, 550, 580, 20), L""); + + AddControl(*__progressImageLabel); + + InstallApplication(); + + return true; +} + +void +InstallForm::AddFooterItem() +{ + Footer* pFooter = GetFooter(); + + FooterItem footerItem1; + footerItem1.Construct(ID_FOOTER_OPEN); + footerItem1.SetText(L"Open"); + + pFooter->AddItem(footerItem1); + + pFooter->AddActionEventListener(*this); +} + +void +InstallForm::InstallApplication() +{ + PackageManager* packManager = PackageManager::GetInstance(); + InstallEventListener* appInstallObj = new InstallEventListener(); + String packageId = L"sangs_temp_id"; + String packagePath = static_cast(UiApp::GetInstance())->GetPackagePath(); + result res; + + if (packagePath.IsEmpty()){ + AppLogException("No Tpk File Path"); + SetPopupValueAndOn(L"Installation Fail", L"No Tpk File Path"); + OnPopup(); + return; + } + + res = packManager->InstallPackage(packageId, packagePath, appInstallObj); + if (res != E_SUCCESS) + { + TryLog(res != E_INVALID_ARG, "E_INVALID_ARG"); + TryLog(res != E_SYSTEM, "E_SYSTEM"); + TryLog(res != E_PRIVILEGE_DENIED, "E_PRIVILEGE_DENIED"); + } + else{ + AppLog("INSTALLTAION SUCCESS"); + } +} + + +void +InstallForm::SetPopupValueAndOn(String title, String content) +{ + __pPopup->SetTitleText(title); + __pPopupTextBox->SetText(content); +} + +void +InstallForm::OnPopup() +{ + __pPopup->SetShowState(true); + __pPopup->Show(); +} +void +InstallForm::SetPopupControl() +{ + int popupWidth = GetClientAreaBounds().width - GAP_BETWEEN_FORM_POPUP * 2; + __pPopup = new (std::nothrow) Popup(); + __pPopup->Construct(true, Dimension(popupWidth, UI_H_POPUP)); + __pPopup->SetTitleTextColor(Color::GetColor(COLOR_ID_BLACK)); + + Label* popUpLabel = new (std::nothrow) Label(); + popUpLabel->Construct(Rectangle(X_POPUP_LABLE, Y_POPUP_LABLE, __pPopup->GetBounds().width - GAP_BETWEEN_POPUP_LABEL*2, H_POPUP_LABLE), L"Application installation will be start."); + popUpLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + popUpLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); + + __pPopupTextBox = new TextBox(); + __pPopupTextBox->Construct(Rectangle(X_POPUP_LABLE, Y_POPUP_LABLE, __pPopup->GetBounds().width - GAP_BETWEEN_POPUP_LABEL*2, UI_H_POPUP - H_POPUP_TITLE), TEXT_BOX_BORDER_NONE); + __pPopupTextBox->SetTextSize(33); + + Button* pButtonClose = new (std::nothrow) Button(); + pButtonClose->Construct(Rectangle(GetClientAreaBounds().x, __pPopupTextBox->GetBounds().y + H_TEXT_LINE, __pPopup->GetBounds().width/2 - 30, UI_H_POPUP_BUTTON), L"Close"); + pButtonClose->SetActionId(ID_BUTTON_CLOSE_POPUP); + pButtonClose->AddActionEventListener(*this); + + __pPopup->AddControl(*__pPopupTextBox); + pButtonClose->SetPosition(X_CANCEL_BTN_ALONE, pButtonClose->GetY()); + __pPopup->AddControl(*pButtonClose); +} + +result +InstallForm::OnInitializing(void) +{ + result r = E_SUCCESS; + + __pProgress = static_cast(GetControl(L"IDF_PROGRESS", true)); + __pProgressLabel = static_cast(GetControl(L"IDC_PROGRESS_LABEL", true)); + + // Install Confirmation Popup + SetPopupControl(); + + return r; +} + +result +InstallForm::OnTerminating(void) +{ + result r = E_SUCCESS; + + if (__pTimer){ + delete __pTimer; + } + + return r; +} + + +void +InstallForm::OnTimerExpired(Timer& timer) +{ + __timerCounter++; + // wait closing install app until new app is running for smooth view change + if (!__isInstalling) + { + if (__pAppManager->IsRunning(__packageOperationId)){ + __pTimer->Cancel(); + App::GetInstance()->Terminate(); + } + return; + } + + if (__timerCounter >= TIME_COUNT) + { + if (__isInstallSuccess){ + __pProgressLabel->SetText(POPUP_MSESSAGE_SUCCESS); + __pTimer->Cancel(); + __isInstalling = false; + } + else{ + __pProgressLabel->SetText(POPUP_MSESSAGE_FAIL); + __pTimer->Cancel(); + __isInstalling = false; + } + } + else + { + if (__timerCounter % 2 == 0){ + __progressImageLabel->SetBackgroundBitmap(*__pProgressImage); + } + else{ + __progressImageLabel->SetBackgroundBitmap(*__pProgressEfImage); + } + + } + __pProgress->SetValue(__timerCounter); + __pProgress->Invalidate(false); + __pProgressLabel->Invalidate(false); +} + +void +InstallForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs) +{ + switch(requestId) + { + case INSTALL_SUCCESS_EVENT: + { + __isInstallSuccess = true; + AppLog("Install Success Event is Received"); + __timerCounter = TIME_COUNT; + String *packageId = (String*)pArgs->GetAt(0); +// AppLog("packageId : %ls", packageId->GetPointer()); + + PackageInfo* pLocalPackageInfo; + PackageManager* pMgr = PackageManager::GetInstance(); + pLocalPackageInfo = pMgr->GetPackageInfoN(*packageId); + + __packageOperationId = *packageId + L"." + pLocalPackageInfo->GetDisplayName(); +// AppLog("packageName : %ls", __packageOperationId.GetPointer()); + AddFooterItem(); + } + break; + case INSTALL_FAIL_INVALID_PACKAGE: + { + SetPopupValueAndOn(L"Installation Fail", L"Invalid Package Install Error"); + OnPopup(); + } + break; + case INSTALL_FAIL_STORAGE_FULL: + { + SetPopupValueAndOn(L"Installation Fail", L"Storage Full Install Error"); + OnPopup(); + } + break; + default: + { + AppLogException("error event request ID sended by EndpointThread"); + } + break; + } +} + + +void +InstallForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + switch(actionId) + { + case ID_FOOTER_OPEN: + { + AppManager* pAppManager = AppManager::GetInstance(); + + // init timer + __timerCounter = 0; + + pAppManager->LaunchApplication(__packageOperationId); + __pTimer->StartAsRepeatable(500); + } + break; + case ID_BUTTON_CLOSE_POPUP: + { + __pPopup->SetShowState(false); + Invalidate(true); + App::GetInstance()->Terminate(); + } + break; + } +} + +void +InstallForm::OnFormBackRequested(Form& source) +{ + TryReturnVoid(!__isInstalling, null); + + App::GetInstance()->Terminate(); +} + + +void +InstallForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) +{ + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + Bitmap* pHeaderImage = pAppResource->GetBitmapN(HEADER_IMAGE); + + String *packageName = (String*)pArgs->GetAt(0); + __pHeader = GetHeader(); + __pHeader->SetTitleText(*packageName); + __pHeader->SetTitleIcon(pHeaderImage); + +} + +void +InstallForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId) +{ +} + + diff --git a/src/IstInstallerApp.cpp b/src/IstInstallerApp.cpp new file mode 100644 index 0000000..017544a --- /dev/null +++ b/src/IstInstallerApp.cpp @@ -0,0 +1,167 @@ +// +// 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. +// + +/** + * @file: IstInstallerApp.cpp + * @brief: This file contains the declaration of InstallerApp Class, + * which provides basic features necessary to define an UiApp. + */ + +#include "IstInstallerApp.h" +#include "IstMainFrame.h" +#include "IstTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + + +InstallerApp::InstallerApp(void) +{ +} + +InstallerApp::~InstallerApp(void) +{ +} + +UiApp* +InstallerApp::CreateInstance(void) +{ + // Create the instance through the constructor. + return new InstallerApp(); +} + +String +InstallerApp::GetPackagePath() +{ + return __packagePath; +} + +bool +InstallerApp::IsValidAccess() +{ + return __isValidAccess; +} + +void +InstallerApp::SetUri(String uriData) +{ + __uriData.Clear(); + __uriData.Append(uriData); +} + +void +InstallerApp::SetPackagePath(String packagePath) +{ + __packagePath.Clear(); + __packagePath.Append(packagePath); +} + +bool +InstallerApp::OnAppInitializing(AppRegistry& appRegistry) +{ + AppControlProviderManager* pProviderMgr = AppControlProviderManager::GetInstance(); + pProviderMgr->SetAppControlProviderEventListener(this); + + __isValidAccess = false; + + return true; +} + +bool +InstallerApp::OnAppInitialized(void) +{ + // Create a Frame + MainFrame* pMainFrame = new MainFrame(); + pMainFrame->Construct(); + pMainFrame->SetName(APP_NAME); + AddFrame(*pMainFrame); + + return true; +} + +bool +InstallerApp::OnAppWillTerminate(void) +{ + return true; +} + +bool +InstallerApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) +{ + return true; +} + +void +InstallerApp::OnForeground(void) +{ +} + +void +InstallerApp::OnBackground(void) +{ +} + +void +InstallerApp::OnLowMemory(void) +{ +} + +void +InstallerApp::OnBatteryLevelChanged(BatteryLevel batteryLevel) +{ +} + +void +InstallerApp::OnScreenOn(void) +{ +} + +void +InstallerApp::OnScreenOff(void) +{ +} +void +InstallerApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, + const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, + const Tizen::Base::Collection::IMap* pExtraData) +{ + if (pUriData != NULL && !pUriData->IsEmpty()) + { + SetUri(*pUriData); + + String filePath; + // 1. parsing file uri data + if ((*pUriData).StartsWith(FILE_URI_SCHEME, 0)){ + __isValidAccess = true; + (*pUriData).SubString(String(FILE_URI_SCHEME).GetLength(), filePath); + AppLog("packageId : %ls", pUriData->GetPointer()); + AppLog("filePath : %ls", filePath.GetPointer()); + SetPackagePath(filePath); + } + else{ + __isValidAccess = false; + } + } + else{ + __isValidAccess = false; + } +} + + diff --git a/src/IstMainFrame.cpp b/src/IstMainFrame.cpp new file mode 100644 index 0000000..d5192b3 --- /dev/null +++ b/src/IstMainFrame.cpp @@ -0,0 +1,41 @@ +#include "IstMainFrame.h" +#include "IstFormFactory.h" +#include "IstPanelFactory.h" + +using namespace Tizen::Base; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +MainFrame::MainFrame(void) +{ +} + +MainFrame::~MainFrame(void) +{ +} + +result +MainFrame::OnInitializing(void) +{ + // Prepare Scene management. + SceneManager* pSceneManager = SceneManager::GetInstance(); + static FormFactory formFactory; + static PanelFactory panelFactory; + pSceneManager->RegisterFormFactory(formFactory); + pSceneManager->RegisterPanelFactory(panelFactory); + pSceneManager->RegisterScene(L"workflow"); + + // Goto the scene. + result r = pSceneManager->GoForward(SceneTransitionId(L"ID_SCNT_MAINSCENE")); + + return r; +} + +result +MainFrame::OnTerminating(void) +{ + result r = E_SUCCESS; + + return r; +} diff --git a/src/IstPanelFactory.cpp b/src/IstPanelFactory.cpp new file mode 100644 index 0000000..2e11039 --- /dev/null +++ b/src/IstPanelFactory.cpp @@ -0,0 +1,45 @@ +// +// 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. +// + +/** + * @file: IstPanelFactory.cpp + * @brief: This file contains the implementation of InstallServicePanelFactory class, which manages + * all the panel containers used across the application. + */ + + +#include "IstPanelFactory.h" + +using namespace Tizen::Ui::Scenes; + + +PanelFactory::PanelFactory(void) +{ +} + +PanelFactory::~PanelFactory(void) +{ +} + +Tizen::Ui::Controls::Panel* +PanelFactory::CreatePanelN(const Tizen::Base::String& panelId, const Tizen::Ui::Scenes::SceneId& sceneId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + Tizen::Ui::Controls::Panel* pNewPanel = null; + + return pNewPanel; +} diff --git a/src/IstTypes.cpp b/src/IstTypes.cpp new file mode 100644 index 0000000..f8da658 --- /dev/null +++ b/src/IstTypes.cpp @@ -0,0 +1,44 @@ +// +// 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. +// + +/** + * @file: IstTypes.cpp + * @brief: This file contains common enumerators, static constants used across the application + */ + + +#include "IstTypes.h" + +const int GAP_BETWEEN_FORM_POPUP = 28; +const int X_POPUP_LABLE = 0; +const int Y_POPUP_LABLE = 0; +const int H_POPUP_LABLE = 300; +const int GAP_BETWEEN_POPUP_LABEL = 25; +const int GAP_BETWEEN_POPUP_BUTTON = GAP_BETWEEN_POPUP_LABEL; +const int UI_H_POPUP = 330; +const int UI_H_POPUP_BUTTON = 74; +const int H_POPUP_TITLE = 50; +const int H_TEXT_LINE = 150; +const int GAP_BETWEEN_BUTTON = 10; +const int X_CANCEL_BTN_ALONE = 160; + + +const wchar_t* HEADER_IMAGE = L"home_type3.png"; +const wchar_t* APP_NAME = L"Installer"; +const wchar_t* FILE_URI_SCHEME = L"file://"; + +Tizen::Base::String __uriData; +Tizen::Base::String __packagePath;