merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:04:15 +0000 (01:04 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:04:15 +0000 (01:04 +0900)
124 files changed:
CMakeLists.txt
debian/changelog
mobileprint/CMakeLists.txt
mobileprint/app/CMakeLists.txt
mobileprint/app/loading_animation.c [deleted file]
mobileprint/app/mobileprint.c
mobileprint/app/preview_content.c
mobileprint/app/preview_task_model.c [deleted file]
mobileprint/app/preview_widget.c [deleted file]
mobileprint/app/pts_common.c
mobileprint/app/pts_list_view.c
mobileprint/app/pts_main_view.c
mobileprint/app/pts_print_search.c
mobileprint/app/pts_setting_view.c
mobileprint/app/pts_util.c [new file with mode: 0644]
mobileprint/edc/mobileprint.edc
mobileprint/include/loading_animation.h [deleted file]
mobileprint/include/mobileprint.h
mobileprint/include/pts_common.h
mobileprint/include/pts_main_view.h
mobileprint/include/pts_util.h [moved from mobileprint/include/preview_widget.h with 67% similarity]
mobileprint/mobileprint.xml
mobileprint/preview_engine/CMakeLists.txt [new file with mode: 0644]
mobileprint/preview_engine/include/preview_engine.h [moved from mobileprint/include/preview_engine.h with 98% similarity]
mobileprint/preview_engine/include/preview_model.h [moved from mobileprint/include/preview_model.h with 93% similarity]
mobileprint/preview_engine/include/preview_task_model.h [moved from mobileprint/include/preview_task_model.h with 95% similarity]
mobileprint/preview_engine/lib/CMakeLists.txt [new file with mode: 0644]
mobileprint/preview_engine/lib/preview_engine.c [moved from mobileprint/app/preview_engine.c with 89% similarity]
mobileprint/preview_engine/lib/preview_model.c [moved from mobileprint/app/preview_model.c with 79% similarity]
mobileprint/preview_engine/lib/preview_task_model.c [new file with mode: 0644]
mobileprint/previewgen/CMakeLists.txt
mobileprint/previewgen/include/page_preview.h
mobileprint/previewgen/include/page_preview_thread.h [deleted file]
mobileprint/previewgen/include/pdfgen.h
mobileprint/previewgen/include/pgen_debug.h
mobileprint/previewgen/include/previewgen.h
mobileprint/previewgen/lib/evas_render.c
mobileprint/previewgen/lib/image_scaler.c
mobileprint/previewgen/lib/page_preview.c
mobileprint/previewgen/lib/page_preview_thread.c [deleted file]
mobileprint/previewgen/lib/paper_size.c
mobileprint/previewgen/lib/pdfgen.c
mobileprint/previewgen/lib/preview_coords.c
mobileprint/previewgen/lib/preview_util.c
mobileprint/previewgen/lib/previewgen.c
mobileprint/previewgen/util/CMakeLists.txt [new file with mode: 0644]
mobileprint/previewgen/util/main.c [new file with mode: 0644]
mobileprint/smsc/CMakeLists.txt [new file with mode: 0644]
mobileprint/smsc/include/smsc_control.h [new file with mode: 0644]
mobileprint/smsc/include/smsc_debug.h [new file with mode: 0644]
mobileprint/smsc/include/smsc_position.h [new file with mode: 0644]
mobileprint/smsc/include/smsc_smart.h [new file with mode: 0644]
mobileprint/smsc/include/smsc_widget.h [new file with mode: 0644]
mobileprint/smsc/lib/CMakeLists.txt [new file with mode: 0644]
mobileprint/smsc/lib/smsc_control.c [new file with mode: 0644]
mobileprint/smsc/lib/smsc_position.c [new file with mode: 0644]
mobileprint/smsc/lib/smsc_smart.c [new file with mode: 0644]
mobileprint/smsc/lib/smsc_widget.c [new file with mode: 0644]
org.tizen.mobileprint.manifest
org.tizen.usb-printer-detector.manifest [deleted file]
packaging/mobileprint.spec
usb-printer-detector/CMakeLists.txt [deleted file]
usb-printer-detector/images/A09_device_printer.png [deleted file]
usb-printer-detector/include/upd-strings.h [deleted file]
usb-printer-detector/include/upd-util.h [deleted file]
usb-printer-detector/include/upd.h [deleted file]
usb-printer-detector/org.tizen.usb-printer-detector.xml [deleted file]
usb-printer-detector/po/CMakeLists.txt [deleted file]
usb-printer-detector/po/POTFILES.in [deleted file]
usb-printer-detector/po/ar.po [deleted file]
usb-printer-detector/po/az.po [deleted file]
usb-printer-detector/po/bg.po [deleted file]
usb-printer-detector/po/ca.po [deleted file]
usb-printer-detector/po/cs.po [deleted file]
usb-printer-detector/po/da.po [deleted file]
usb-printer-detector/po/de_DE.po [deleted file]
usb-printer-detector/po/el_GR.po [deleted file]
usb-printer-detector/po/en.po [deleted file]
usb-printer-detector/po/en_PH.po [deleted file]
usb-printer-detector/po/en_US.po [deleted file]
usb-printer-detector/po/es_ES.po [deleted file]
usb-printer-detector/po/es_US.po [deleted file]
usb-printer-detector/po/et.po [deleted file]
usb-printer-detector/po/eu.po [deleted file]
usb-printer-detector/po/fi.po [deleted file]
usb-printer-detector/po/fr_CA.po [deleted file]
usb-printer-detector/po/fr_FR.po [deleted file]
usb-printer-detector/po/ga.po [deleted file]
usb-printer-detector/po/gl.po [deleted file]
usb-printer-detector/po/hi.po [deleted file]
usb-printer-detector/po/hr.po [deleted file]
usb-printer-detector/po/hu.po [deleted file]
usb-printer-detector/po/hy.po [deleted file]
usb-printer-detector/po/is.po [deleted file]
usb-printer-detector/po/it_IT.po [deleted file]
usb-printer-detector/po/ja_JP.po [deleted file]
usb-printer-detector/po/ka.po [deleted file]
usb-printer-detector/po/kk.po [deleted file]
usb-printer-detector/po/ko_KR.po [deleted file]
usb-printer-detector/po/lt.po [deleted file]
usb-printer-detector/po/lv.po [deleted file]
usb-printer-detector/po/mk.po [deleted file]
usb-printer-detector/po/nb.po [deleted file]
usb-printer-detector/po/nl_NL.po [deleted file]
usb-printer-detector/po/pl.po [deleted file]
usb-printer-detector/po/pt_BR.po [deleted file]
usb-printer-detector/po/pt_PT.po [deleted file]
usb-printer-detector/po/ro.po [deleted file]
usb-printer-detector/po/ru_RU.po [deleted file]
usb-printer-detector/po/sk.po [deleted file]
usb-printer-detector/po/sl.po [deleted file]
usb-printer-detector/po/sr.po [deleted file]
usb-printer-detector/po/sv.po [deleted file]
usb-printer-detector/po/tr_TR.po [deleted file]
usb-printer-detector/po/uk.po [deleted file]
usb-printer-detector/po/update-po.sh [deleted file]
usb-printer-detector/po/uz.po [deleted file]
usb-printer-detector/po/zh_CN.po [deleted file]
usb-printer-detector/po/zh_HK.po [deleted file]
usb-printer-detector/po/zh_SG.po [deleted file]
usb-printer-detector/po/zh_TW.po [deleted file]
usb-printer-detector/src/upd-main.c [deleted file]
usb-printer-detector/src/upd-util.c [deleted file]
usb-printer-detector/src/upd-view.c [deleted file]

index d92358b..5a9ea6e 100644 (file)
@@ -29,4 +29,3 @@ FOREACH(flag ${pkgs_CFLAGS})
 ENDFOREACH(flag)                    
 
 ADD_SUBDIRECTORY(mobileprint)
-ADD_SUBDIRECTORY(usb-printer-detector)
index 9746981..4e02936 100755 (executable)
-mobileprint (0.2.15-55) unstable; urgency=low
+mobileprint (0.2.17-10) unstable; urgency=low
+
+  * Changed to show dimming list for unsupported printer
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-10
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Thu, 28 Feb 2013 17:58:59 +0900
+
+mobileprint (0.2.17-9) unstable; urgency=low
+
+  * Added work-around solution fixing that printing thread is not called
+  * Fixed smack incorrect label
+  * - wifi-direct-popup is changed to org.tizen.wifi-direct-popup
+  * - stest-service label is added for UI application dump
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-9
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Mon, 25 Feb 2013 17:43:13 +0900
+
+mobileprint (0.2.17-8) unstable; urgency=low
+
+  * Removed org.tizen.usb-printer-detector package
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-8
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Mon, 18 Feb 2013 13:35:54 +0900
+
+mobileprint (0.2.17-7) unstable; urgency=low
+
+  * SMACK rules updated
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-7
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Thu, 14 Feb 2013 21:48:34 +0900
+
+mobileprint (0.2.17-6) unstable; urgency=low
+
+  * Fixed wrong 2pages-in-one-sheet in scaling by SRR
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-6
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Tue, 12 Feb 2013 17:51:33 +0900
+
+mobileprint (0.2.17-5) unstable; urgency=low
+
+  * Fixed wrong loading animation in smooth scroll by SRR
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-5
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Tue, 12 Feb 2013 15:03:39 +0900
+
+mobileprint (0.2.17-4) unstable; urgency=low
+
+  * Updated wifi-direct-ug routine to support WFDS Print
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-4
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Fri, 08 Feb 2013 17:03:04 +0900
+
+mobileprint (0.2.17-3) unstable; urgency=low
+
+  * Fixed S1-12189(total page to support multiple copies)
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-3
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Tue, 05 Feb 2013 20:26:17 +0900
+
+mobileprint (0.2.17-2) unstable; urgency=low
+
+  * Smack rule updated
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-2
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Fri, 01 Feb 2013 14:09:51 +0900
+
+mobileprint (0.2.17-1) unstable; urgency=low
+
+  * Fixed ISE showing issue in custom_popup
+  * Fixed flickering issue in preview screen
+  * Fixed top white space when back from custom_popup
+  * Fixed conformant operation for ISE showing
+  * Fixed rotation checking routine for mixed scenario
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.17-1
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Tue, 29 Jan 2013 20:33:48 +0900
+
+mobileprint (0.2.16-10) unstable; urgency=low
+
+  * Fixed wrong progress routine after disabled page number correction
+  * Changed edc value of progress popup
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-10
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Fri, 25 Jan 2013 23:10:12 +0900
+
+mobileprint (0.2.16-9) unstable; urgency=low
+
+  * Don't use page number correction(P130107-3058)
+  * Added dummy noti id checking when try to terminate app
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-9
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Fri, 25 Jan 2013 17:21:22 +0900
+
+mobileprint (0.2.16-8) unstable; urgency=low
+
+  * Fixed cancel crash caused by temp files cleaning routine
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-8
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Sun, 20 Jan 2013 10:06:02 +0900
+
+mobileprint (0.2.16-7) unstable; urgency=low
+
+  * Applied temp files cleaning routine after app terminated
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-7
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Fri, 18 Jan 2013 22:37:40 +0900
+
+mobileprint (0.2.16-6) unstable; urgency=low
+
+  * Changed app directory(/opt/usr/apps -> /usr/apps)
+  * Read-only data is used in /usr/apps
+  * Read-Write data is used in /opt/usr/apps/data
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-6
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Fri, 18 Jan 2013 14:15:32 +0900
+
+mobileprint (0.2.16-5) unstable; urgency=low
 
   * Changed Flora license url
   * Git: magnolia/apps/home/mobileprint
-  * Tag: mobileprint_0.2.15-55
+  * Tag: mobileprint_0.2.16-5
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Thu, 17 Jan 2013 18:04:24 +0900
+
+mobileprint (0.2.16-4) unstable; urgency=low
+
+  * Fixed that printer list popup height is shown above screen
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-4
+
+ -- GangHeok Kim <gangheok.kim@samsung.com>  Wed, 16 Jan 2013 20:46:01 +0900
+
+mobileprint (0.2.16-3) unstable; urgency=low
+
+  * Applied code clean up and fixed img preview failed bug (SMRC)
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-3
+
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Tue, 15 Jan 2013 22:45:48 +0900
+
+mobileprint (0.2.16-1) unstable; urgency=low
+
+  * Changed preview-engine architecture from ecore_thread to ecore_exe(P121213-2630)
+  * Git: magnolia/apps/home/mobileprint
+  * Tag: mobileprint_0.2.16-1
 
- -- GangHeok Kim <gangheok.kim@samsung.com>  Thu, 17 Jan 2013 18:52:25 +0900
+ -- Taeksu Shin <taeksu.shin@samsung.com>  Mon, 14 Jan 2013 17:20:43 +0900
 
 mobileprint (0.2.15-54) unstable; urgency=low
 
index 7b7f6a9..5cd0ac9 100644 (file)
@@ -10,7 +10,8 @@ SET(PKGNAME "org.${VENDOR}.${PACKAGE}")
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(BINDIR "${PREFIX}/bin")
 SET(RESDIR "${PREFIX}/res")
-SET(DATADIR "${PREFIX}/data")
+SET(PPDDIR "${RESDIR}/ppd/")
+SET(DATADIR "/opt/${PREFIX}/data")
 SET(CACHEDIR "${PREFIX}/cache")
 SET(LOCALEDIR "${RESDIR}/locale")
 SET(EDC_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/edc")
@@ -29,6 +30,8 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 ####################################
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/previewgen/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/preview_engine/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/smsc/include)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
@@ -48,6 +51,7 @@ ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
 ADD_DEFINITIONS("-DEDJDIR=\"${EDJDIR}\"")
+ADD_DEFINITIONS("-DBINDIR=\"${BINDIR}\"")
 ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
 ADD_DEFINITIONS("-DIMGDIR=\"${IMGDIR}\"")
 ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"")
@@ -59,16 +63,18 @@ ADD_DEFINITIONS("-DCONFIG_PRINT_SETTING")
 ########### install desktop file & icon #############
 #####################################################
 #CONFIGURE_FILE(${PROJECT_NAME}.desktop.in ${PKGNAME}.desktop)
-#INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE}/${PKGNAME}.desktop DESTINATION "/opt/share/applications")
+#INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE}/${PKGNAME}.desktop DESTINATION "/usr/share/applications")
 #for appfw new manifest
 CONFIGURE_FILE(${PROJECT_NAME}.xml ${PKGNAME}.xml)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE}/${PKGNAME}.xml DESTINATION "/opt/share/packages/")
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE}/${PKGNAME}.xml DESTINATION "/usr/share/packages/")
 INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images/ DESTINATION ${IMGDIR})
 INSTALL(DIRECTORY DESTINATION ${DATADIR})
-INSTALL(DIRECTORY DESTINATION ${CACHEDIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/previewgen/rasterview.ppd DESTINATION ${DATADIR})
+#INSTALL(DIRECTORY DESTINATION ${CACHEDIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/previewgen/rasterview.ppd DESTINATION ${PPDDIR})
 
 ADD_SUBDIRECTORY(previewgen)
+ADD_SUBDIRECTORY(preview_engine)
+ADD_SUBDIRECTORY(smsc)
 ADD_SUBDIRECTORY(app)
 ADD_SUBDIRECTORY(po)
 
index 1132603..dffcdcf 100644 (file)
@@ -1,5 +1,7 @@
 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/mobileprint)
 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/mobileprint/previewgen/lib)
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/mobileprint/preview_engine/lib)
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/mobileprint/smsc/lib)
 
 FILE(GLOB SRCS *.c)
 
@@ -35,9 +37,9 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/genlist_custom.edj DESTINATION ${EDJDIR})
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -fpie")
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${app_pkgs_LDFLAGS} -lprint-service -lpreviewgen -lecore_evas)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${app_pkgs_LDFLAGS} -lprint-service -lpreviewgen -lecore_evas -lpreview_engine -lsmsc)
 
 ADD_DEPENDENCIES(${PROJECT_NAME} mobileprint_edj_build genlist_custom_edj_build)
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
-INSTALL(FILES icon_${PROJECT_NAME}.png DESTINATION "/opt/share/icons/default/small" RENAME "${PKGNAME}.png")
+INSTALL(FILES icon_${PROJECT_NAME}.png DESTINATION "/usr/share/icons/default/small" RENAME "${PKGNAME}.png")
diff --git a/mobileprint/app/loading_animation.c b/mobileprint/app/loading_animation.c
deleted file mode 100644 (file)
index 95570df..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-*  Mobileprint
-*
-* Copyright 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 "loading_animation.h"
-
-Evas_Object *loading_animation_add(Evas_Object *parent)
-{
-       Evas_Object *res;
-       res = elm_progressbar_add(parent);
-       PTS_RETV_IF(res == NULL, NULL, "res is NULL");
-
-       elm_object_style_set(res, "list_process");
-       evas_object_size_hint_align_set(res, EVAS_HINT_FILL, 0.5);
-       evas_object_size_hint_weight_set(res, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_progressbar_pulse(res, EINA_TRUE);
-       elm_object_part_content_set(parent, "process_animation", res);
-       return res;
-}
-
-void show_loading_animation(pts_core_data_t *ugd)
-{
-       PTS_RET_IF(ugd == NULL, "ugd is NULL");
-       PTS_RET_IF(ugd->loading_animation != NULL, "Already shown");
-       ugd->loading_animation = loading_animation_add(ugd->img_layout);
-       evas_object_show(ugd->loading_animation);
-}
-
-void hide_loading_animation(pts_core_data_t *ugd)
-{
-       PTS_RET_IF(ugd == NULL, "ugd is NULL");
-       PTS_RET_IF(ugd->loading_animation == NULL, "Already removed");
-       evas_object_hide(ugd->loading_animation);
-       evas_object_del(ugd->loading_animation);
-       ugd->loading_animation = NULL;
-}
index 29168ef..e191980 100644 (file)
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
 #include <utilX.h>
-#include <sys/utsname.h>
 #include "mobileprint.h"
 #include "pts_main_view.h"
 
+#define _GNU_SOURCE
 #include <unistd.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <linux/unistd.h>
 #include <errno.h>
@@ -78,8 +79,8 @@ static void _app_rotate(app_device_orientation_e orientation, void *user_data)
        elm_win_rotation_with_resize_set(ad->win, orientation);
        /* HACK based on ugd memsetting to 0 to avoid crash on rotation */
        if (NULL != ad->ugd && NULL != ad->ugd->active_printer) {
-               clear_preview_image(ad->ugd);
-               pts_main_view_rotate_image(ad->ugd, orientation);
+               /*clear_preview_image(ad->ugd);
+               pts_main_view_rotate_image(ad->ugd, orientation);*/
 
                if (NULL != ad->ugd->size_popup) {
                        PTS_DEBUG("Found size popup. Let's rotate and resize it");
@@ -102,6 +103,18 @@ static void _app_rotate(app_device_orientation_e orientation, void *user_data)
                                                                                          400 * elm_config_scale_get(), ad->ugd->custom_popup_landscape_height);
                        }
                }
+       } else if (NULL != ad->ugd && NULL != ad->ugd->printer_list_popup) {
+               PTS_DEBUG("Found printer list popup. Let's rotate and resize it");
+               if (APP_DEVICE_ORIENTATION_0 == orientation ||
+                               APP_DEVICE_ORIENTATION_180 == orientation) {
+                       evas_object_size_hint_min_set(ad->ugd->printer_list_popup_box,
+                       PRINTER_LIST_POPUP_W * elm_config_scale_get(),
+                       ad->ugd->printer_list_popup_portrait_height);
+               } else {
+                       evas_object_size_hint_min_set(ad->ugd->printer_list_popup_box,
+                       PRINTER_LIST_POPUP_LN_W * elm_config_scale_get(),
+                       ad->ugd->printer_list_popup_landscape_height);
+               }
        } else {
                PTS_DEBUG("Just ignore preview regeneration by device orientation");
        }
@@ -124,7 +137,6 @@ static Evas_Object *_create_win(const char *name)
        eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
        PTS_RETV_IF(eo == NULL, NULL, "Failed to elm_win_add");
 
-       elm_win_conformant_set(eo, EINA_TRUE);
        elm_win_autodel_set(eo, EINA_TRUE);
        elm_win_title_set(eo, name);
 
@@ -132,6 +144,7 @@ static Evas_Object *_create_win(const char *name)
        elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
 
        elm_win_alpha_set(eo, EINA_TRUE);
+       elm_win_conformant_set(eo, EINA_TRUE);
        evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL);
 
        ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
@@ -229,9 +242,13 @@ static int __x_rotation_get(Display *dpy, Window win)
 static int __as_rotate(Display *dpy, Window xwin, Evas_Object *win, void *data)
 {
        PTS_TRACE_BEGIN;
+       pts_appdata_t *ad = (pts_appdata_t *)data;
+       PTS_RETV_IF(ad == NULL, -1, "data is NULL");
+
        int rotation;
 
-       ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0);
+       // 2nd parameter should be set to 1 - "accepts_focus" to show ISE properly
+       ecore_x_icccm_hints_set(xwin, 1, 0, 0, 0, 0, 0, 0);
 
        rotation = __x_rotation_get(dpy, xwin);
        PTS_DEBUG("rotation of focused window : %d", rotation);
@@ -244,6 +261,8 @@ static int __as_rotate(Display *dpy, Window xwin, Evas_Object *win, void *data)
                elm_win_rotation_with_resize_set(win, rotation);
        }
 
+       ad->prev_app_win_rotate = rotation;
+
        PTS_TRACE_END;
        return 0;
 }
@@ -258,7 +277,7 @@ static bool _app_create(void *user_data)
        PTS_RETV_IF(user_data == NULL, false, "user_data is NULL");
 
        pts_appdata_t *ad = (pts_appdata_t *)user_data;
-       char *name;
+       char *name = NULL;
 
        /* create window */
        app_get_name(&name);
@@ -291,9 +310,9 @@ static void _app_terminate(void *user_data)
 
        PTS_RET_IF(ad == NULL, "data is NULL");
 
-       if (ad->ugd->main_win) {
+       if (ad->ugd->main_layout) {
                PTS_DEBUG("ad->lymain is not NULL");
-               //evas_object_del(ad->ugd->main_win);
+               //evas_object_del(ad->ugd->main_layout);
        }
 
        if (ad->win) {
@@ -302,6 +321,8 @@ static void _app_terminate(void *user_data)
        }
 #endif
 
+       pts_util_remove_tmp_files("/tmp/mobileprint/");
+
        PTS_TRACE_END;
 }
 
@@ -316,7 +337,7 @@ static void _app_pause(void *user_data)
        pts_appdata_t *ad = (pts_appdata_t *)user_data;
        PTS_RET_IF(ad == NULL,"ad is NULL");
        PTS_RET_IF(ad->ugd == NULL,"ad->ugd is NULL");
-       if (ad->ugd->job_spooling_list == NULL) {
+       if (ad->ugd->job_spooling_list == NULL && ad->ugd->dummy_noti_id == 0) {
                PTS_DEBUG("Without active job spooling, mobileprint will terminate when moved background.");
                app_efl_exit();
        } else {
@@ -335,18 +356,12 @@ static void _app_resume(void *user_data)
        PTS_TRACE_END;
 }
 
-/*
-* popup when machine is unsupported
-*/
-static Eina_Bool unsupported_exit(void *data)
+static Eina_Bool _simple_exit(void *data)
 {
        PTS_TRACE_BEGIN;
        pts_ug_list_data *ld = (pts_ug_list_data *) data;
-       PTS_RETV_IF(ld == NULL , ECORE_CALLBACK_CANCEL , "data is NULL");
-
        PTS_IF_FREE_MEM(ld);
        elm_exit();
-
        PTS_TRACE_END;
        return ECORE_CALLBACK_CANCEL;
 }
@@ -360,14 +375,15 @@ void load_main_view(void *userdata)
 
        // XXX - show main view after set active/default printer
        pts_create_main_view(ugd);
-       elm_win_resize_object_add(ugd->root_win, ugd->main_win);
-       edje_object_signal_callback_add(elm_layout_edje_get(ugd->main_win),
+       // XXX - disable to fix blink problem
+       //elm_win_resize_object_add(ugd->root_win, ugd->main_layout);
+       edje_object_signal_callback_add(elm_layout_edje_get(ugd->main_layout),
                                                                        "EXIT", "*", main_quit_cb, NULL);
 
        pts_main_view_update_printer_label(ugd);
        pts_main_view_rotate_image(ugd, app_get_device_orientation());
 
-       evas_object_show(ugd->main_win);
+       evas_object_show(ugd->main_layout);
        evas_object_show(ugd->root_win);
        PTS_TRACE_END;
 }
@@ -376,20 +392,26 @@ void load_main_view(void *userdata)
 /*
 * load the app
 */
-static void __app_load_app(pts_appdata_t *ad, pts_printing_data_t *pt_files)
+static void __app_load_data(pts_appdata_t *ad, pts_printing_data_t *pt_files)
 {
        PTS_TRACE_BEGIN;
-       PTS_RET_IF((ad == NULL) || (ad->win == NULL) || (pt_files == NULL), "error parameters");
+       PTS_RET_IF(ad == NULL, "ad is NULL");
+       PTS_RET_IF(ad->win == NULL, "ad->win is NULL");
+       PTS_RET_IF(pt_files == NULL, "pt_files is NULL");
 
        pts_core_data_t *ugd;
        int ret;
 
+       if (pts_util_supported_arch() != EINA_TRUE) {
+               pts_util_show_error_popup(ad->win, _("IDS_COM_POP_UNSUPPORTED"));
+               ecore_timer_add(1, (Ecore_Task_Cb)_simple_exit, (void *)ad->ugd);
+               return;
+       }
+
        if (ad->ugd == NULL) {
                PTS_DEBUG("ad->ugd is NULL");
                ugd = calloc(1, sizeof(pts_core_data_t));
                PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
-               memset(ugd, 0, sizeof(pts_core_data_t));
                ad->ugd = ugd;
                ugd->root_win = ad->win;
                pts_set_ugd(ugd);
@@ -398,29 +420,13 @@ static void __app_load_app(pts_appdata_t *ad, pts_printing_data_t *pt_files)
        ret = pt_init(__pts_event_cb, ad->ugd);
        PTS_RET_IF(ret != PT_ERR_NONE,"pt_init error");
 
+       //TODO: Remove this after ecore fix max thread  number problem.
+       ecore_thread_max_set(4);
+
        /*
         * prepare load print files
         */
-       pts_main_view_load_print_files(ad->ugd, pt_files);
-
-       //Not supported in Emulator
-       struct utsname buf;
-       ret = uname(&buf);
-       if (ret == -1) {
-               PTS_DEBUG("failed to get uname");
-       } else if (strstr(buf.machine,"arm") == NULL) {
-               PTS_DEBUG("not supported on %s",buf.machine);
-               Evas_Object *unsupported_popup;
-               unsupported_popup = elm_popup_add(ad->ugd->root_win);
-               evas_object_size_hint_weight_set(unsupported_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-               elm_object_text_set(unsupported_popup, _("IDS_COM_POP_UNSUPPORTED"));
-               evas_object_show(unsupported_popup);
-               evas_object_show(ad->ugd->root_win);
-               ecore_timer_add(1, (Ecore_Task_Cb)unsupported_exit, (void *)ad->ugd);
-               return;
-       } else {
-               PTS_DEBUG("ARM target");
-       }
+       pts_main_view_load_printing_data(ad->ugd, pt_files);
        pts_search_printer(ad->ugd, ad->ugd->root_win, PTS_SEARCH_INITIAL, load_main_view, (void *)NULL);
 
        PTS_TRACE_END;
@@ -438,29 +444,20 @@ static Eina_Bool show_dummy_noti_popup(service_h *service, void *user_data, pts_
        char *value = NULL;
 
        ret = service_get_extra_data(*service, SERVICE_FILES, &value);
-       if (ret != SERVICE_ERROR_NONE) {
-               PTS_DEBUG("get extra data failed!, errno: %d", ret);
-               return EINA_FALSE;
-       } else {
-               char *files = strdup(value);
-               if (files == NULL) {
-                       return EINA_FALSE;
-               }
-               PTS_DEBUG("files[%s]", files);
-               ret = service_get_extra_data(*service, SERVICE_PAGE_COUNT, &value);
-               if (ret != SERVICE_ERROR_NONE) {
-                       PTS_DEBUG("get extra data failed!, errno: %d", ret);
-                       return EINA_FALSE;
-               } else {
-                       int page_count = atoi(value);
-                       PTS_DEBUG("page_count[%d]", page_count);
-                       __pts_print_dummy_popup(ad->ugd, files, page_count);
-               }
-       }
+       PTS_RETV_IF(ret != SERVICE_ERROR_NONE, EINA_FALSE, "get extra data failed!, errno: %d", ret);
 
-       if (ad->win) {
-               evas_object_raise(ad->win);
-       }
+       char *files = strdup(value);
+       PTS_RETV_IF(files == NULL, EINA_FALSE, "failed to strdup. files is NULL");
+       PTS_DEBUG("files[%s]", files);
+
+       ret = service_get_extra_data(*service, SERVICE_PAGE_COUNT, &value);
+       PTS_RETV_IF(ret != SERVICE_ERROR_NONE, EINA_FALSE, "get extra data failed!, errno: %d", ret);
+
+       int page_count = atoi(value);
+       PTS_DEBUG("page_count[%d]", page_count);
+       __pts_print_dummy_popup(ad->ugd, files, page_count);
+
+       evas_object_raise(ad->win);
 
        PTS_TRACE_END;
        return EINA_TRUE;
@@ -478,29 +475,20 @@ static Eina_Bool show_progress_noti_popup(service_h *service, void *user_data)
        char *value = NULL;
 
        ret = service_get_extra_data(*service, SERVICE_JOB_ID, &value);
-       if (ret != SERVICE_ERROR_NONE) {
-               PTS_DEBUG("get extra data failed!, errno: %d", ret);
-               return EINA_FALSE;
-       } else {
-               if (NULL != value) {
-                       int job_id = atoi(value);
-                       PTS_DEBUG("job_id[%d]", job_id);
-                       ret = service_get_extra_data(*service, SERVICE_PAGE_COUNT, &value);
-                       if (ret != SERVICE_ERROR_NONE) {
-                               PTS_DEBUG("get extra data failed!, errno: %d", ret);
-                               return EINA_FALSE;
-                       } else {
-                               int page_count = atoi(value);
-                               PTS_DEBUG("page_count[%d]", page_count);
-                               __pts_print_progress_popup(ad->ugd, job_id, page_count);
-                       }
-               }
-       }
+       PTS_RETV_IF(ret != SERVICE_ERROR_NONE, EINA_FALSE, "get extra data failed!, errno: %d", ret);
 
-       if (ad->win) {
-               evas_object_raise(ad->win);
+       if (NULL != value) {
+               int job_id = atoi(value);
+               PTS_DEBUG("job_id[%d]", job_id);
+               ret = service_get_extra_data(*service, SERVICE_PAGE_COUNT, &value);
+               PTS_RETV_IF(ret != SERVICE_ERROR_NONE, EINA_FALSE, "get extra data failed!, errno: %d", ret);
+               int page_count = atoi(value);
+               PTS_DEBUG("page_count[%d]", page_count);
+               __pts_print_progress_popup(ad->ugd, job_id, page_count);
        }
 
+       evas_object_raise(ad->win);
+
        PTS_TRACE_END;
        return EINA_TRUE;
 }
@@ -542,6 +530,7 @@ static Eina_Bool get_extra_data_by_single_content(service_h *service, void *user
 
        uri_temp = (char *)pt_utils_filename_from_URI(value);
        PTS_IF_FREE_MEM(value);
+       PTS_RETV_IF(uri_temp == NULL, EINA_FALSE, "uri_temp is NULL");
        bret = _pts_printing_data_set_request_files((const char **)&uri_temp, 1, printing_data);
        PTS_RETV_IF(bret == EINA_FALSE, EINA_FALSE, "Failed to set request_files");
 
@@ -549,7 +538,7 @@ static Eina_Bool get_extra_data_by_single_content(service_h *service, void *user
        }
 #endif /* end of IMAGE_SELFTEST */
 
-       __app_load_app(ad, printing_data);
+       __app_load_data(ad, printing_data);
        evas_object_raise(ad->win);
 
        PTS_TRACE_END;
@@ -562,6 +551,7 @@ static Eina_Bool get_extra_data_by_multi_contents(service_h *service, void *user
        pts_appdata_t *ad = (pts_appdata_t *)user_data;
        PTS_RETV_IF(ad == NULL, EINA_FALSE,  "ad is NULL");
        PTS_RETV_IF(ad->win == NULL, EINA_FALSE, "ad->win is NULL");
+       PTS_RETV_IF(printing_data == NULL, EINA_FALSE, "printing_data is NULL");
 
        Eina_Bool bret = EINA_FALSE;
        int ret = -1;
@@ -606,7 +596,7 @@ static Eina_Bool get_extra_data_by_multi_contents(service_h *service, void *user
        PTS_IF_FREE_MEM(filesname);
        PTS_RETV_IF(bret == EINA_FALSE, EINA_FALSE, "Failed to set request files");
 
-       __app_load_app(ad, printing_data);
+       __app_load_data(ad, printing_data);
        evas_object_raise(ad->win);
 
        return EINA_TRUE;
@@ -667,7 +657,8 @@ static void _app_service(service_h service, void *user_data)
                service_reply_to_launch_request(reply_service, service, SERVICE_RESULT_SUCCEEDED);
        } else {
                service_reply_to_launch_request(reply_service, service, SERVICE_RESULT_FAILED);
-               elm_exit();
+               pts_util_show_error_popup(ad->win, IDS_PRT_41);
+               ecore_timer_add(1, (Ecore_Task_Cb)_simple_exit, (void *)ad->ugd);
        }
        PTS_TRACE_END;
        return;
index cda87d8..54c3b36 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "preview_content.h"
 
-#define  DEFAULT_PPD_FILE       DATADIR "/rasterview.ppd"
+#define  DEFAULT_PPD_FILE       RESDIR "/ppd/rasterview.ppd"
 
 int is_printer_grayscale(const pt_printer_mgr_t *active_printer)
 {
@@ -241,15 +241,17 @@ int generate_preview_images(pts_core_data_t *ugd,
        PTS_DEBUG("ALBUM, N_UP, ZOOM: %d, %d, %d", orientation, n_up, scale.type);
        PTS_DEBUG("CLIENT SIZE: %d : %d", client_size.x, client_size.y);
 
-       result = process_preview_engine_file(&(ugd->engine),
+       /*result = process_preview_engine_file(&(ugd->engine),
                                                                                 ugd->pt_files.request_files[0], ppd,
                                                                                 &paper_size,
                                                                                 &client_size, orientation, n_up,
-                                                                                &scale, is_grayscale);
-       PTS_DEBUG("process_preview_engine_file: %d", result);
+                                                                                &scale, is_grayscale);*/
+       result = evas_smart_smsc_set_file(ugd->smsc,
+                       ugd->pt_files.request_files[0], ppd, &paper_size,
+                       orientation, n_up, &scale, is_grayscale);
+       PTS_DEBUG("evas_smart_smsc_set_file: %d", result);
 
        PTS_TRACE_END;
-
        return result;
 }
 
diff --git a/mobileprint/app/preview_task_model.c b/mobileprint/app/preview_task_model.c
deleted file mode 100644 (file)
index 13b6927..0000000
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
-*  Mobileprint
-*
-* Copyright 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 <Ecore.h>
-
-#include <page_preview.h>
-#include <page_preview_thread.h>
-#include <preview_coords.h>
-
-#include "pts_debug.h"
-#include "preview_task_model.h"
-
-/* TODO: task model destruction */
-enum preview_task_type {
-       PREVIEW_TASK_GENERIC,
-       PREVIEW_TASK_INITIAL
-};
-
-struct preview_task_data {
-       int page;
-       enum preview_task_type task_type;
-       struct preview_conf conf;
-       char out_pic_fname[sizeof("/tmp/mobileprint_xxxx.ppm ")];
-       int is_task_ok;
-
-       /* not for use in thread */
-       struct preview_model *pmodel;
-       struct preview_task_model *task_model;
-};
-
-int init_preview_task_model(struct preview_task_model *model,
-                                                       struct preview_engine *engine)
-{
-       PTS_TRACE_BEGIN;
-       PTS_RETV_IF(model == NULL || engine == NULL, -1 , "Invalid argument");
-
-       /*model->task_count = MAX_PREVIEW_TASK_COUNT;
-       model->tasks = malloc(sizeof(struct preview_task) * model->task_count);
-       if (NULL == model->tasks) {
-               model->task_count = 0;
-               return -1;
-       }*/
-       /* TODO: thread queue */
-       model->task_list = NULL;
-       model->thread = NULL;
-       model->is_stop_processing = 0;
-       model->engine = engine;
-
-       //model->pdata = pdata;
-       PTS_TRACE_END;
-       return 0;
-}
-
-int preview_task_thread_generic(struct preview_task_data *ptd)
-{
-       PTS_TRACE_BEGIN;
-
-       struct size_px shadow_size_px = {10, 10};
-       struct preview_page_req settings_req;
-       struct preview_settings_px settings_px;
-       void *img_buf;
-       int img_size;
-
-       PTS_TRACE_BEGIN;
-       PTS_RETV_IF(ptd == NULL || ptd->task_type != PREVIEW_TASK_GENERIC, -1 , "Invalid argument");
-
-       settings_req.paper_size = ptd->conf.paper_size.s;
-       /* TODO: switch to real size */
-       settings_req.available_size_px = ptd->conf.max_available_size_px;
-       settings_req.shadow_offset = shadow_size_px;
-       settings_req.is_rotate90 =
-               (PAGE_ORIENTATION_LANDSCAPE == ptd->conf.orientation);
-       settings_req.is_grayscale = ptd->conf.is_grayscale;
-
-       if (get_preview_settings(&settings_req, &settings_px) < 0) {
-               //DBG("ERROR in get_preview_settings()");
-               PTS_TRACE_END;
-               return -1;
-       }
-
-       if (load_pdf_page_img(ptd->conf.fname, ptd->page,
-                                                 &(settings_px.page_px),
-                                                 &img_buf, &img_size) < 0) {
-               PTS_TRACE_END;
-               return -1;
-       }
-       struct pdf_preview_page_image_data test_data = {
-               img_buf, img_size, ptd->page, ptd->conf.pages_count,
-               &settings_px, ptd->out_pic_fname, 0
-       };
-       ecore_main_loop_thread_safe_call_sync(
-               save_pdf_preview_page_image_w_np_thread,
-               &test_data);
-
-       PTS_TRACE_END;
-       return test_data.res;
-}
-
-int preview_task_thread_initial(struct preview_task_data *ptd)
-{
-       PTS_TRACE_BEGIN;
-
-       PTS_RETV_IF(ptd == NULL || ptd->task_type != PREVIEW_TASK_INITIAL , -1, "Invalid argument");
-
-       int res;
-       enum file_type ftype;
-       char *fname;
-       struct preview_conf *conf;
-       struct process_image_downscale_data downscale_data;
-
-       conf = &(ptd->conf);
-       fname = conf->initial_fname;
-       ftype = get_file_type(fname);
-
-       PTS_DEBUG("conf->max_available_size_px (%d, %d)", conf->max_available_size_px.x, conf->max_available_size_px.y);
-
-       switch (ftype) {
-       case FILE_TYPE_IMAGE:
-               PTS_DEBUG("processing image");
-
-               /* downscale call parameters */
-               downscale_data.fname = fname;
-               downscale_data.out_fname = IMAGE_CONVERT_TEMP_FILE;
-               downscale_data.available_size_px = &(conf->max_available_size_px);
-               downscale_data.res = 0;
-
-               ecore_main_loop_thread_safe_call_sync(
-                       process_image_downscale_thread,
-                       &downscale_data);
-               res = downscale_data.res;
-               if (0 == res)
-                       res = img2pdf_preview_pages(downscale_data.out_fname,
-                                                                               TEMP_PDFTOPDF_FNAME, conf->ppd,
-                                                                               &(conf->paper_size),
-                                                                               &(conf->max_available_size_px),
-                                                                               conf->orientation, conf->n_up,
-                                                                               &(conf->scale), conf->is_grayscale);
-               PTS_DEBUG("img2pdf_preview_pages res = %d", res);
-               break;
-       case FILE_TYPE_PDF:
-               PTS_DEBUG("processing PDF");
-               res = pdf2pdf_preview_pages(fname,
-                                                                       TEMP_PDFTOPDF_FNAME, conf->ppd,
-                                                                       &(conf->paper_size),
-                                                                       conf->orientation, conf->n_up,
-                                                                       &(conf->scale), conf->is_grayscale);
-               PTS_DEBUG("pdf2pdf_preview_pages res = %d", res);
-               break;
-       default:
-               /* error condition */
-               res = -1;
-               break;
-       }
-
-       if (res == 0) {
-               conf->pages_count = get_pdf_pages_count(TEMP_PDFTOPDF_FNAME);
-               PTS_DEBUG("conf->pages_count = %d", conf->pages_count);
-       } else {
-               conf->pages_count = 0;
-       }
-
-       return res;
-}
-
-void preview_task_thread_cb(void *d, Ecore_Thread *thread)
-{
-       PTS_TRACE_BEGIN;
-       PTS_RET_IF(d == NULL, "Invalid argument");
-
-       /* TODO: work with thread-safe copy */
-       struct preview_task_data *ptd = (struct preview_task_data *)d;
-       int res = -1;
-
-       //struct size_px shadow_size_px = {10, 10};
-       //struct preview_page_req settings_req;
-
-       //PTS_TRACE_BEGIN;
-       switch (ptd->task_type) {
-       case PREVIEW_TASK_GENERIC:
-               res = preview_task_thread_generic(ptd);
-               break;
-       case PREVIEW_TASK_INITIAL:
-               res = preview_task_thread_initial(ptd);
-               break;
-       }
-
-       if (0 == res) {
-               ptd->is_task_ok = 1;
-       } else {
-               ptd->is_task_ok = 0;
-       }
-       PTS_DEBUG("ptd->is_task_ok = %d", ptd->is_task_ok);
-
-       PTS_TRACE_END;
-}
-
-int clear_preview_task_queue(struct preview_task_model *task_model)
-{
-       PTS_TRACE_BEGIN;
-       PTS_RETV_IF(task_model == NULL , -1 , "Invalid argument");
-
-       struct preview_task_data *ptd;
-       Eina_List *cur;
-
-       if (task_model->task_list != NULL) {
-               /* clean task list */
-               EINA_LIST_FOREACH(task_model->task_list, cur, ptd) {
-                       PTS_IF_FREE_MEM(ptd);
-               }
-               eina_list_free(task_model->task_list);
-       }
-       task_model->task_list = NULL;
-       PTS_TRACE_END;
-       return 0;
-}
-
-void preview_task_cancel_cb(void *d, Ecore_Thread *thread)
-{
-       PTS_TRACE_BEGIN;
-
-       PTS_TRACE_END;
-}
-
-void preview_task_end_cb(void *d, Ecore_Thread *thread)
-{
-       PTS_TRACE_BEGIN;
-
-       PTS_RET_IF(d == NULL, "Invalid argument");
-
-       struct preview_task_data *ptd = (struct preview_task_data *)d;
-       struct preview_task_data *next_ptd;
-       struct preview_task_model *task_model = ptd->task_model;
-       int is_init_engine = 1;
-       //struct preview_task_model *model = (struct preview_task_model*)d;
-       PTS_TRACE_BEGIN;
-
-       /* TODO: check for next initialization in queue */
-
-       switch (ptd->task_type) {
-       case PREVIEW_TASK_GENERIC:
-               if (ptd->is_task_ok) {
-                       preview_model_page_available(ptd->pmodel,
-                                                                                PREVIEW_ENGINE_EVENT_PAGE_READY,
-                                                                                ptd->page);
-               } else {
-                       preview_model_page_available(ptd->pmodel,
-                                                                                PREVIEW_ENGINE_EVENT_PAGE_ERROR,
-                                                                                ptd->page);
-               }
-               break;
-       case PREVIEW_TASK_INITIAL:
-               if (task_model->task_list != NULL) {
-                       next_ptd = (struct preview_task_data *)
-                                          eina_list_data_get(task_model->task_list);
-                       if (PREVIEW_TASK_INITIAL == next_ptd->task_type) {
-                               is_init_engine = 0;
-                       }
-               }
-               if (is_init_engine)
-                       preview_engine_init_done(task_model->engine,
-                                                                        &(ptd->conf));
-               PTS_DEBUG("releasing memory");
-               PTS_IF_FREE_MEM(ptd->conf.initial_fname);
-               PTS_IF_FREE_MEM(ptd->conf.ppd);
-               PTS_IF_FREE_MEM(ptd->conf.fname);
-               PTS_IF_FREE_MEM(ptd->conf.paper_size.name);
-               PTS_DEBUG("memory released");
-               break;
-       }
-
-       PTS_IF_FREE_MEM(ptd);
-       task_model->thread = NULL;
-
-       /* manage tasks queue */
-       if (task_model->task_list != NULL) {
-               ptd = (struct preview_task_data *)
-                         eina_list_data_get(task_model->task_list);
-               task_model->task_list = eina_list_remove_list(
-                                                                       task_model->task_list, task_model->task_list);
-               task_model->thread = ecore_thread_run(
-                                                                preview_task_thread_cb,
-                                                                preview_task_end_cb,
-                                                                preview_task_cancel_cb,
-                                                                ptd);
-       }
-
-       PTS_TRACE_END;
-}
-
-int add_preview_task_initial(struct preview_task_model *model,
-                                                        const struct preview_conf *conf)
-{
-       PTS_TRACE_BEGIN;
-       PTS_RETV_IF(model == NULL || conf == NULL, -1, "Invalid argument");
-
-       struct preview_task_data *ptd;
-
-       /* fill the preview_task_data structure */
-       ptd = malloc(sizeof(struct preview_task_data));
-       PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
-
-       memset(ptd, 0, sizeof(struct preview_task_data));
-       ptd->task_type = PREVIEW_TASK_INITIAL;
-       ptd->conf = *conf;
-       ptd->task_model = model;
-
-       /* TODO: clear task queue, disable generic tasks */
-       clear_preview_task_queue(model);
-
-       /* manage task queue */
-       if (NULL != model->thread) {
-               /* plan task for calculation in future */
-               /* TODO: check, does we have current tasks in task model */
-               model->task_list = eina_list_append(model->task_list, ptd);
-               /* TODO: leave only 4 last page requests in queue */
-       } else {
-               /* this task is a top task - just process */
-               model->thread = ecore_thread_run(
-                                                       preview_task_thread_cb,
-                                                       preview_task_end_cb,
-                                                       NULL, ptd);
-       }
-
-       PTS_TRACE_END;
-       return 0;
-}
-
-int add_preview_task(struct preview_task_model *model, int page,
-                                        struct preview_model *pmodel)
-{
-       PTS_TRACE_BEGIN;
-       PTS_RETV_IF(model == NULL || pmodel == NULL , -1 , "Invalid argument");
-       PTS_RETV_IF(model->is_stop_processing, -1, "is_stop_processing is %d", model->is_stop_processing);
-
-       /* fill the preview_task_data structure */
-       struct preview_task_data *ptd;
-       struct preview_task_data *next_ptd;
-       ptd = malloc(sizeof(struct preview_task_data));
-       PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
-
-       ptd->page = page;
-       ptd->task_type = PREVIEW_TASK_GENERIC;
-       sprintf(ptd->out_pic_fname, "/tmp/mobileprint_%04d.ppm", page);
-       ptd->is_task_ok = 0;
-       ptd->conf = pmodel->conf;
-       ptd->pmodel = pmodel;
-       ptd->task_model = model;
-
-       /* manage task queue */
-       if (NULL != model->thread) {
-               next_ptd = (struct preview_task_data *)
-                                  eina_list_data_get(model->task_list);
-               if (next_ptd == NULL) {
-                       PTS_IF_FREE_MEM(ptd);
-                       return 0;
-               }
-               if (PREVIEW_TASK_INITIAL == next_ptd->task_type) {
-                       /* do not add this task: initialization is planned */
-                       PTS_IF_FREE_MEM(ptd);
-               } else {
-                       /* plan task for calculation in future */
-                       model->task_list = eina_list_append(
-                                                                  model->task_list, ptd);
-               }
-               /* TODO: leave only 4 last page requests in queue */
-       } else {
-               /* this task is a top task - just process */
-               model->thread = ecore_thread_run(
-                                                       preview_task_thread_cb,
-                                                       preview_task_end_cb,
-                                                       preview_task_cancel_cb,
-                                                       ptd);
-       }
-
-       PTS_TRACE_END;
-       return 0;
-}
diff --git a/mobileprint/app/preview_widget.c b/mobileprint/app/preview_widget.c
deleted file mode 100644 (file)
index ad34a7a..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-*  Mobileprint
-*
-* Copyright 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 "loading_animation.h"
-#include "pts_common.h"
-#include "pts_debug.h"
-#include "preview_widget.h"
-
-extern int g_pages_count;
-
-Evas_Object *pts_main_view_load_preview_img(pts_core_data_t *ugd);
-
-/* just simple stub for 1-page documents */
-Eina_Bool page_ready_cb(void *data, int type, void *event)
-{
-       PTS_TRACE_BEGIN;
-       pts_core_data_t *ugd = (pts_core_data_t *)data;
-       struct preview_engine_event *event_data = (struct preview_engine_event *) event;
-       PTS_RETV_IF(ugd == NULL || event_data == NULL, ECORE_CALLBACK_DONE, "Invalid argument");
-
-       PTS_DEBUG("event:%d page: %d", event_data->status, event_data->page);
-
-       switch (event_data->status) {
-       case PREVIEW_ENGINE_EVENT_INITIAL_READY:
-               /* initialization done: request for page */
-               ugd->pt_files.current_index = 0;
-               g_pages_count = ugd->engine.p_model.conf.pages_count;
-               preview_model_request_page(&(ugd->engine.p_model), 1);
-               /* TODO: change preview image to fit it's size */
-               break;
-
-       case PREVIEW_ENGINE_EVENT_PAGE_READY:
-               /* load page */
-               if (event_data->page == ugd->pt_files.current_index + 1) {
-                       hide_loading_animation(ugd);
-                       pts_main_view_load_preview_img(ugd);
-                       if (event_data->page > 1)
-                               preview_model_request_page(
-                                       &(ugd->engine.p_model),
-                                       event_data->page - 1);
-                       if (event_data->page < (ugd->engine
-                                                                       .p_model.conf.pages_count))
-                               preview_model_request_page(
-                                       &(ugd->engine.p_model),
-                                       event_data->page + 1);
-               }
-               break;
-
-       case PREVIEW_ENGINE_EVENT_PAGE_PROCESSING:
-               /* TODO: show empty page */
-               if (event_data->page == ugd->pt_files.current_index + 1) {
-                       show_loading_animation(ugd);
-               }
-               break;
-
-       case PREVIEW_ENGINE_EVENT_INITIAL_ERROR:
-       case PREVIEW_ENGINE_EVENT_PAGE_ERROR:
-               /* TODO: something in error case */
-               break;
-       }
-
-       PTS_TRACE_END;
-       return ECORE_CALLBACK_DONE;
-}
index 70de8bd..28870d4 100644 (file)
@@ -23,7 +23,8 @@
 #include <vconf-keys.h>
 #include <sysman.h>
 #include <syspopup_caller.h>
-#include "pts_common.h"
+#include "mobileprint.h"
+//#include "pts_common.h"
 #include "image_editor_conn.h"
 #include "pts_main_view.h"
 #include "preview_util.h"
@@ -343,7 +344,7 @@ Evas_Object *pts_create_scaling_popup(Evas_Object *parent, pts_core_data_t *ugd)
        elm_object_part_content_set(popup, "button1", btn1);
        evas_object_smart_callback_add(btn1, "clicked", _pts_scaling_set_cb, ugd);
 
-       genlist = elm_genlist_add(ugd->navi);
+       genlist = elm_genlist_add(popup);
        evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
@@ -499,7 +500,6 @@ static void __pts_size_sel(void *data, Evas_Object *obj, void *event_info)
 
                        load_image_editor_ug(ugd);
                } else if (size == PTS_SIZE_CUSTOM) {
-                       //ugd->image_size = size;
                        pts_create_custom_popup(ugd->navi, ugd);
                } else if (size == PTS_SIZE_FIT_TO_PAPER) {
                        size_index = ugd->image_size = size;
@@ -745,7 +745,7 @@ static Evas_Object *__pts_singleline_editfield_add(Evas_Object *parent, int inde
        layout = elm_layout_add(parent);
        elm_layout_theme_set(layout, "layout", "editfield", "default"); // Default editfield layout style without top title.
 
-       entry = elm_entry_add(parent);
+       entry = elm_entry_add(layout);
        elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NUMBER);
        elm_entry_scrollable_set(entry, EINA_TRUE); // Make entry as scrollable single line.
        elm_entry_single_line_set(entry, EINA_TRUE);
@@ -775,6 +775,8 @@ static Evas_Object *__pts_singleline_editfield_add(Evas_Object *parent, int inde
 
        elm_object_signal_callback_add(layout, "elm,eraser,clicked", "elm", _eraser_clicked_cb, entry);
 
+       evas_object_show(entry);
+
        PTS_TRACE_END;
        return layout;
 }
@@ -958,6 +960,7 @@ Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_core_data_t *ugd)
        Evas_Object *genlist;
        Evas_Object *btn1;
        Evas_Object *btn2;
+       Evas_Object *layout = NULL;
        int index = -1;
 
        popup = elm_popup_add(parent);
@@ -981,7 +984,7 @@ Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_core_data_t *ugd)
        elm_theme_extension_add(NULL, RESDIR"/edje/genlist_custom.edj");
        PTS_DEBUG("Added extension theme");
 
-       genlist = elm_genlist_add(ugd->navi);
+       genlist = elm_genlist_add(popup);
        evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
@@ -1015,21 +1018,22 @@ Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_core_data_t *ugd)
        Evas_Smart_Cb temp_cb = NULL;
 
        for (index = 0; index < 6; index++) {
-               temp_cb = __pts_custom_sel;
                if (index == 0 || index == 2) { // width&height title
                        temp_itc = &title_itc;
-                       temp_cb = NULL;
                } else if (index == 1 || index == 3) { // width&height text field
                        temp_itc = &text_itc;
                } else if (index == 4) { // aspect ratio check
                        temp_itc = &check_itc;
+                       temp_cb = __pts_custom_sel;
                } else if (index == 5) { // change unit button
                        temp_itc = &button_itc;
                } else {
-                       temp_itc = &title_itc;
                }
 
                item = elm_genlist_item_append(genlist, temp_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, temp_cb, ugd);
+               if (index != 4) {
+                       elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
+               }
                PTS_DEBUG("index[%d] - item added : %s", index, (NULL == item)? "FAILURE" : "SUCCESS");
        }
 
@@ -1342,3 +1346,45 @@ Eina_Bool _pts_printing_data_set_type(const char *type, pts_printing_data_t *dat
                return EINA_TRUE;
        }
 }
+
+int _pts_get_rotate_angle(enum appcore_rm rotate_mode)
+{
+       PTS_TRACE_BEGIN;
+       int rotate_angle;
+       if (APPCORE_RM_UNKNOWN == rotate_mode) {
+               appcore_get_rotation_state(&rotate_mode);
+       }
+
+       PTS_DEBUG("rotate_mode = %d", rotate_mode);
+
+       switch (rotate_mode) {
+       case APPCORE_RM_PORTRAIT_NORMAL:     /**< Portrait mode */
+               PTS_DEBUG("rotate mode is APPCORE_RM_PORTRAIT_NORMAL");
+               rotate_angle = 0;
+               break;
+
+       case APPCORE_RM_PORTRAIT_REVERSE:     /**< Portrait upside down mode */
+               PTS_DEBUG("rotate mode is APPCORE_RM_PORTRAIT_REVERSE");
+               rotate_angle = 180;
+               break;
+
+       case APPCORE_RM_LANDSCAPE_NORMAL:     /**< Left handed landscape mode */
+               PTS_DEBUG("rotate mode is APPCORE_RM_LANDSCAPE_NORMAL");
+               rotate_angle = 270;
+               break;
+
+       case APPCORE_RM_LANDSCAPE_REVERSE:      /**< Right handed landscape mode */
+               PTS_DEBUG("rotate mode is APPCORE_RM_LANDSCAPE_REVERSE");
+               rotate_angle = 90;
+               break;
+       default:
+               PTS_DEBUG("Unknown mode. Then follow window rotate of previous app");
+               pts_appdata_t *ad = pts_get_appdata();
+               PTS_RETV_IF(ad == NULL, 0, "ad is NULL");
+               rotate_angle = ad->prev_app_win_rotate;
+               break;
+       }
+
+       PTS_TRACE_END;
+       return rotate_angle;
+}
index 09d8a89..02a151b 100644 (file)
@@ -253,15 +253,15 @@ static void __pts_list_view_get_printer_cb(pt_response_data_t *cb)
 
                // XXX - show main view after set active/default printer
                pts_create_main_view(ld->ugd);
-               elm_win_resize_object_add(ld->ugd->root_win, ld->ugd->main_win);
-               edje_object_signal_callback_add(elm_layout_edje_get(ld->ugd->main_win),
+               elm_win_resize_object_add(ld->ugd->root_win, ld->ugd->main_layout);
+               edje_object_signal_callback_add(elm_layout_edje_get(ld->ugd->main_layout),
                                                                                "EXIT", "*", main_quit_cb, NULL);
 
                pts_main_view_update_printer_label(ugd);
 
                pts_main_view_rotate_image(ld->ugd, app_get_device_orientation());
 
-               evas_object_show(ld->ugd->main_win);
+               evas_object_show(ld->ugd->main_layout);
                evas_object_show(ld->ugd->root_win);
 
                if (ld != NULL) {
index ee1a8a6..f3540f3 100644 (file)
 #include <previewgen.h>
 #include "pt_api.h"
 
-#include "loading_animation.h"
 #include "pts_common.h"
 #include "pts_main_view.h"
 #include "pts_list_view.h"
 #include "pts_setting_view.h"
 #include "preview_content.h"
-#include "preview_widget.h"
 #include "preview_util.h"
 
 
 #define MOBILEPRINT_PACKAGENAME "org.tizen.mobileprint"
-#define ICON_DIR "/opt/usr/apps/org.tizen.mobileprint/res/images"
-#define ICON_SETTING "/opt/usr/apps/org.tizen.mobileprint/res/images/pt_printer_setting.png"
-#define MOBILEPRINT_DEFAULTIMG "/opt/share/icons/default/small/org.tizen.mobileprint.png"
+#define ICON_DIR "/usr/apps/org.tizen.mobileprint/res/images"
+#define ICON_SETTING "/usr/apps/org.tizen.mobileprint/res/images/pt_printer_setting.png"
+#define MOBILEPRINT_DEFAULTIMG "/usr/share/icons/default/small/org.tizen.mobileprint.png"
 #define MOBILEPRINT_TMP_STR "_mobileprint.pdf"
 
 char *g_current_preview_path = NULL;
@@ -68,9 +66,9 @@ static void __pts_main_view_last_job_error(void *user_data);
 static Eina_Bool __pts_hide_main_view(void *data);
 static int __pts_create_notification_by_page(pts_core_data_t *ugd, pts_job_spooling_t *job_spooling);
 
-static int __pts_get_real_total_pages(int original_total_pages, int n_up_number)
+static int __pts_get_real_total_pages(int original_total_pages, int n_up_number, int copies)
 {
-       return (int)ceil((double)original_total_pages / (double)n_up_number);
+       return (int)ceil((double)original_total_pages / (double)n_up_number) * copies;
 }
 
 static pts_job_spooling_t *__pts_get_job_spooling(pts_core_data_t *ugd, int job_id)
@@ -124,6 +122,7 @@ int __pts_update_popup_progress(pts_core_data_t *ugd, pt_progress_info_t *progre
        double rate = progress_info->progress * 0.01;
        char progress_value[8] = {0,};
        char page_value[8] = {0,};
+       char aligned_label[128] = {0,};
 
        if (EINA_TRUE == elm_progressbar_pulse_get(ugd->progressbar)) {
                PTS_DEBUG("Stop pulsing mode\n");
@@ -135,16 +134,18 @@ int __pts_update_popup_progress(pts_core_data_t *ugd, pt_progress_info_t *progre
        elm_progressbar_value_set(ugd->progressbar, rate);
 
        if (rate > 0) {
-               elm_object_text_set(ugd->progress_label, _("IDS_PRT_HEADER_MEDIABOX_PRINTING"));
+               snprintf(aligned_label, 128, "<align=center>%s</align>",
+                                       _("IDS_PRT_HEADER_MEDIABOX_PRINTING"));
+               elm_object_text_set(ugd->progress_label, aligned_label);
        }
 
        snprintf(progress_value, 8, "%d%%", progress_info->progress);
        elm_object_part_text_set(ugd->progress_layout, "elm.text.subtext1", progress_value);
-       int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages, job_spooling->n_up);
-       if (job_spooling->page_printed < real_total_pages) {
+       int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages,
+                                                               job_spooling->n_up, job_spooling->copies);
+       if (job_spooling->page_printed <= real_total_pages) {
                PTS_DEBUG("real_total_pages:%d, page_printed:%d\n", real_total_pages, job_spooling->page_printed);
-               snprintf(page_value, 8, "%d/%d",
-                                (job_spooling->page_printed > real_total_pages)? real_total_pages : job_spooling->page_printed+1, real_total_pages);
+               snprintf(page_value, 8, "%d/%d", job_spooling->page_printed, real_total_pages);
                elm_object_part_text_set(ugd->progress_layout, "elm.text.subtext2", page_value);
        }
 
@@ -197,9 +198,10 @@ int __pts_update_notification(pts_core_data_t *ugd,
        }
 
        if (job_spooling->noti_id == NOTIFICATION_PRIV_ID_NONE && job_spooling->noti_handle == NULL) {
-               int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages, job_spooling->n_up);
-               if (job_spooling->page_printed < real_total_pages) {
-                       PTS_DEBUG("Create new notification for page %d", job_spooling->page_printed+1);
+               int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages,
+                                                                                       job_spooling->n_up, job_spooling->copies);
+               if (job_spooling->page_printed <= real_total_pages) {
+                       PTS_DEBUG("Create new notification for page %d", job_spooling->page_printed);
                        __pts_create_notification_by_page(ugd, job_spooling);
                }
                PTS_TRACE_END;
@@ -269,7 +271,8 @@ int __pts_create_dummy_notification(pts_core_data_t *ugd)
                ugd->pt_files.range.total_pages = ugd->pt_files.num_of_files;
        }
        // XXX - In this time, there's no job_spooling. So common pt_files field of ugd is used.
-       int real_total_pages = __pts_get_real_total_pages(ugd->pt_files.range.total_pages, printer_get_setting_n_up(ugd->active_printer));
+       int real_total_pages = __pts_get_real_total_pages(ugd->pt_files.range.total_pages,
+                                                               printer_get_setting_n_up(ugd->active_printer), ugd->active_printer->copies);
        snprintf(value, 4, "%d", real_total_pages);
        appsvc_set_pkgname(b, "org.tizen.mobileprint");
        appsvc_add_data(b, SERVICE_FILES, ugd->pt_files.request_files[0]);
@@ -342,11 +345,10 @@ static int __pts_create_notification_by_page(pts_core_data_t *ugd, pts_job_spool
        //re-allocate noti handle
        job_spooling->noti_handle = noti;
 
-       int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages, job_spooling->n_up);
+       int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages,
+                                                                       job_spooling->n_up, job_spooling->copies);
        snprintf(title, 32, "%s (%d/%d)",
-                        _("IDS_PRT_HEADER_MEDIABOX_PRINTING"),
-                        (job_spooling->page_printed+1 > real_total_pages)? real_total_pages : job_spooling->page_printed+1,
-                        real_total_pages);
+                        _("IDS_PRT_HEADER_MEDIABOX_PRINTING"), job_spooling->page_printed, real_total_pages);
        PTS_DEBUG("notification update: handle[%d] title=[%s]", job_spooling->noti_handle, title);
 
        res = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, title,
@@ -510,7 +512,10 @@ int __pts_create_job_notification(pts_core_data_t *ugd, int job_id)
 
        job_spooling->n_up = printer_get_setting_n_up(ugd->active_printer);
 
-       int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages, job_spooling->n_up);
+       job_spooling->copies = ugd->active_printer->copies;
+
+       int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages,
+                                                                       job_spooling->n_up, job_spooling->copies);
        snprintf(title, 32, "%s (1/%d)", _("IDS_PRT_HEADER_MEDIABOX_PRINTING"), real_total_pages);
        PTS_DEBUG("notification update: handle[%d] title=[%s]", job_spooling->noti_handle, title);
 
@@ -553,6 +558,7 @@ int __pts_create_job_notification(pts_core_data_t *ugd, int job_id)
        res = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
        if (res != NOTIFICATION_ERROR_NONE) {
                PTS_DEBUG("Failed to notification_set_execute_option. [%d]", res);
+               bundle_free(b);
                goto ERR_CASE;
        }
        bundle_free(b);
@@ -690,6 +696,7 @@ void __pts_event_cb(pt_event_e event, void *user_data, pt_progress_info_t *progr
        case PT_EVENT_JOB_STARTED:
                PTS_DEBUG("Job id %d is allocated", progress_info->job_id);
                __pts_remove_notification(ugd->dummy_noti_id);
+               ugd->dummy_noti_id = 0;
                __pts_create_job_notification(ugd, progress_info->job_id);
                g_timeout_add(5000, (GSourceFunc)__pts_main_view_job_monitor_timeout_cb, ugd);
                break;
@@ -1126,16 +1133,20 @@ void __pts_print_dummy_popup(pts_core_data_t *ugd, char *files, int page_count)
        Evas_Object *layout = NULL;
        Evas_Object *progressbar = NULL;
        char page_info[8] = {0,};
+       char aligned_label[128] = {0,};
 
-       popup = elm_popup_add(ugd->main_win);
+       popup = elm_popup_add(ugd->main_layout);
 
        label1 = elm_label_add(popup);
-       elm_object_style_set(label1, "popup/default");
+       elm_object_style_set(label1, "popup/progressview");
        elm_label_line_wrap_set(label1, ELM_WRAP_MIXED);
        char *printer_label = strdup(ugd->active_printer->name);
        pts_unstandardization(printer_label);
-       elm_object_text_set(label1, printer_label);
+       snprintf(aligned_label, 128, "<align=center>%s</align>", printer_label);
+       elm_object_text_set(label1, aligned_label);
        if (printer_label != NULL) {
+               /* accessability - screen reader support */
+               elm_access_info_set(label1, ELM_ACCESS_INFO, printer_label);
                free(printer_label);
                printer_label = NULL;
        }
@@ -1144,17 +1155,24 @@ void __pts_print_dummy_popup(pts_core_data_t *ugd, char *files, int page_count)
        evas_object_show(label1);
 
        label2 = elm_label_add(popup);
-       elm_object_style_set(label2, "popup/default");
+       elm_object_style_set(label2, "popup/progressview");
        elm_label_line_wrap_set(label2, ELM_WRAP_MIXED);
-       elm_object_text_set(label2, _("IDS_PRT_POP_WAITING_TO_PRINT_ING"));
+       snprintf(aligned_label, 128, "<align=center>%s</align>",
+                               _("IDS_PRT_POP_WAITING_TO_PRINT_ING"));
+       elm_object_text_set(label2, aligned_label);
+       /* accessability - screen reader support */
+       elm_access_info_set(label2, ELM_ACCESS_INFO, _("IDS_PRT_POP_WAITING_TO_PRINT_ING"));
        evas_object_size_hint_weight_set(label2, EVAS_HINT_EXPAND, 0.0);
        evas_object_size_hint_align_set(label2, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(label2);
 
        label3 = elm_label_add(popup);
-       elm_object_style_set(label3, "popup/default");
+       elm_object_style_set(label3, "popup/progressview");
        elm_label_line_wrap_set(label3, ELM_WRAP_MIXED);
-       elm_object_text_set(label3, basename(files));
+       snprintf(aligned_label, 128, "<align=center>%s</align>", basename(files));
+       elm_object_text_set(label3, aligned_label);
+       /* accessability - screen reader support */
+       elm_access_info_set(label3, ELM_ACCESS_INFO, basename(files));
        evas_object_size_hint_weight_set(label3, EVAS_HINT_EXPAND, 0.0);
        evas_object_size_hint_align_set(label3, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(label3);
@@ -1179,7 +1197,8 @@ void __pts_print_dummy_popup(pts_core_data_t *ugd, char *files, int page_count)
        elm_object_part_content_set(layout, "elm.swallow.end", progressbar);
        elm_object_part_text_set(layout, "elm.text.subtext1", "0%");
        // XXX - In this time, there's no job_spooling. So common pt_files field of ugd is used.
-       int real_total_pages = __pts_get_real_total_pages(ugd->pt_files.range.total_pages, printer_get_setting_n_up(ugd->active_printer));
+       int real_total_pages = __pts_get_real_total_pages(ugd->pt_files.range.total_pages,
+                                                               printer_get_setting_n_up(ugd->active_printer), ugd->active_printer->copies);
        snprintf(page_info, 8, "1/%d", real_total_pages);
        elm_object_part_text_set(layout, "elm.text.subtext2", page_info);
 
@@ -1226,16 +1245,21 @@ void __pts_print_progress_popup(pts_core_data_t *ugd, int job_id, int page_count
        Evas_Object *progressbar = NULL;
        char progress_info[8] = {0,};
        char page_info[8] = {0,};
+       char aligned_label[128] = {0,};
 
-       popup = elm_popup_add(ugd->main_win);
+       popup = elm_popup_add(ugd->main_layout);
 
        label1 = elm_label_add(popup);
-       elm_object_style_set(label1, "popup/default");
+       elm_object_style_set(label1, "popup/progressview");
        elm_label_line_wrap_set(label1, ELM_WRAP_MIXED);
        char *printer_label = strdup(ugd->active_printer->name);
        pts_unstandardization(printer_label);
-       elm_object_text_set(label1, printer_label);
+       snprintf(aligned_label, 128, "<align=center>%s</align>", printer_label);
+       elm_object_text_set(label1, aligned_label);
        if (printer_label != NULL) {
+               /* accessability - screen reader support */
+               elm_access_info_set(label1, ELM_ACCESS_INFO, printer_label);
+
                free(printer_label);
                printer_label = NULL;
        }
@@ -1244,26 +1268,42 @@ void __pts_print_progress_popup(pts_core_data_t *ugd, int job_id, int page_count
        evas_object_show(label1);
 
        label2 = elm_label_add(popup);
-       elm_object_style_set(label2, "popup/default");
+       elm_object_style_set(label2, "popup/progressview");
        elm_label_line_wrap_set(label2, ELM_WRAP_MIXED);
        if (job_spooling->progress > 0) {
-               elm_object_text_set(label2, _("IDS_PRT_HEADER_MEDIABOX_PRINTING"));
+               snprintf(aligned_label, 128, "<align=center>%s</align>",
+                                       _("IDS_PRT_HEADER_MEDIABOX_PRINTING"));
+               /* accessability - screen reader support */
+               elm_access_info_set(label2, ELM_ACCESS_INFO,
+                                       _("IDS_PRT_HEADER_MEDIABOX_PRINTING"));
        } else {
-               elm_object_text_set(label2, _("IDS_PRT_POP_WAITING_TO_PRINT_ING"));
+               snprintf(aligned_label, 128, "<align=center>%s</align>",
+                                       _("IDS_PRT_POP_WAITING_TO_PRINT_ING"));
+               /* accessability - screen reader support */
+               elm_access_info_set(label2, ELM_ACCESS_INFO,
+                                       _("IDS_PRT_POP_WAITING_TO_PRINT_ING"));
        }
+       elm_object_text_set(label2, aligned_label);
        evas_object_size_hint_weight_set(label2, EVAS_HINT_EXPAND, 0.0);
        evas_object_size_hint_align_set(label2, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(label2);
 
        label3 = elm_label_add(popup);
-       elm_object_style_set(label3, "popup/default");
+       elm_object_style_set(label3, "popup/progressview");
        elm_label_line_wrap_set(label3, ELM_WRAP_MIXED);
-       elm_object_text_set(label3, basename(job_spooling->pt_files.request_files[0]));
+       char* label3_text = basename(job_spooling->pt_files.request_files[0]);
+       snprintf(aligned_label, 128, "<align=center>%s</align>",
+                               label3_text);
+       elm_object_text_set(label3, aligned_label);
+       /* accessability - screen reader support */
+       elm_access_info_set(label3, ELM_ACCESS_INFO, label3_text);
+
        evas_object_size_hint_weight_set(label3, EVAS_HINT_EXPAND, 0.0);
        evas_object_size_hint_align_set(label3, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(label3);
 
        layout = pts_create_base_layout(popup, "popup_progress");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
        progressbar = elm_progressbar_add(popup);
        if (job_spooling->progress > 0) {
@@ -1293,7 +1333,7 @@ void __pts_print_progress_popup(pts_core_data_t *ugd, int job_id, int page_count
        } else {
                elm_object_part_text_set(layout, "elm.text.subtext1", "0%");
        }
-       snprintf(page_info, 8, "1/%d", page_count);
+       snprintf(page_info, 8, "%d/%d", job_spooling->page_printed, page_count);
        elm_object_part_text_set(layout, "elm.text.subtext2", page_info);
 
        Evas_Object *btn1 = NULL;
@@ -1311,6 +1351,7 @@ void __pts_print_progress_popup(pts_core_data_t *ugd, int job_id, int page_count
                elm_object_text_set(btn2, _("IDS_COM_SK_CANCEL"));
                elm_object_part_content_set(popup, "button2", btn2);
                evas_object_smart_callback_add(btn2, "clicked", __pts_main_view_response_cancel_print, (void *)job_id);
+               elm_access_info_set(btn2, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_PRINTING);
        }
 
        elm_object_content_set(popup, layout);
@@ -1332,7 +1373,6 @@ static Eina_Bool __pts_main_view_start_print(void *data)
        int ret = 0;
        int num = 0;
        char *first_fname;
-       struct preview_conf *conf;
 
        if (ugd->active_printer->copies <= 0) {
                ugd->active_printer->copies = 1;
@@ -1394,10 +1434,8 @@ static Eina_Bool __pts_main_view_start_print(void *data)
 
                pt_set_print_option_imagesize(&crop_image_info, first_fname, res_x, res_y);
                ugd->pt_files.range.selected_files[0] = ugd->pt_files.request_files[0];
-               conf = &(ugd->engine.p_model.conf);
        } else {
                pt_set_print_option_scaleimage(ugd->active_printer->scaling);
-               conf = &(ugd->engine.p_model.conf);
                num = 1;
                ugd->pt_files.range.selected_files[0] = ugd->input_file;
        }
@@ -1468,7 +1506,7 @@ static void __pts_main_view_btn_print_cb(void *data, Evas_Object *obj, void *eve
        PTS_RET_IF(ugd == NULL, "ugd is NULL");
 
        if ((NULL != ugd->pt_files.request_files) && (NULL != ugd->active_printer)) {
-               evas_object_hide(ugd->main_win);
+               evas_object_hide(ugd->main_layout);
                pts_create_popup(ugd->root_win, _("IDS_PRT_POP_PREPARING_TO_PRINT_ING"), 2.0);
                ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ugd);
 
@@ -1643,105 +1681,14 @@ static Evas_Object *create_toolbar_more_btn(Evas_Object *parent, Evas_Smart_Cb f
                return NULL;
        }
        elm_object_style_set(btn, "naviframe/more/default");
+       elm_access_info_set(btn, ELM_ACCESS_INFO, IDS_SCRREAD_MENU_INFO);
+       elm_access_info_set(btn, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_MENU_CONTEXT);
        evas_object_smart_callback_add(btn, "clicked", func, data);
        PTS_TRACE_END;
        return btn;
 }
 
-/*
-* mouse down callback
-*/
-static void __pts_main_view_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-       PTS_TRACE_BEGIN;
-       pts_core_data_t *ugd = (pts_core_data_t *)data;
-       PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
-       Evas_Event_Mouse_Down *ev = event_info;
-       PTS_RET_IF(ev == NULL, "ev is NULL");
-
-       ugd->cur_x = ev->canvas.x;
-       PTS_TRACE_END;
-}
-
-/*
-* mouse up callback
-*/
-static void __ug_view_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-       PTS_TRACE_BEGIN;
-
-       pts_core_data_t *ugd = (pts_core_data_t *)data;
-       PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
-       Evas_Event_Mouse_Down *ev = event_info;
-       PTS_RET_IF(ev == NULL, "ev is NULL");
-
-       PTS_DEBUG("dist is %d", ev->canvas.x - ugd->cur_x);
-       PTS_DEBUG("ugd->list_count is %d, cur_index: %d", ugd->pt_files.num_of_files, ugd->pt_files.current_index);
-
-       if ((ev->canvas.x - ugd->cur_x) < -150) {
-               /* next page */
-               if (ugd->pt_files.current_index < (g_pages_count - 1)) {
-                       ugd->pt_files.current_index++;
-                       //pts_main_view_load_preview_img(ugd);
-                       preview_model_request_page(&(ugd->engine.p_model),
-                                                                          ugd->pt_files.current_index + 1);
-               }
-       } else if ((ev->canvas.x - ugd->cur_x) > 150) {
-               /* prev page */
-               if (ugd->pt_files.current_index > 0) {
-                       ugd->pt_files.current_index--;
-                       //pts_main_view_load_preview_img(ugd);
-                       preview_model_request_page(&(ugd->engine.p_model),
-                                                                          ugd->pt_files.current_index + 1);
-               }
-       }
-
-       PTS_TRACE_END;
-}
-
-void clear_preview_image(pts_core_data_t *ugd)
-{
-       PTS_TRACE_BEGIN;
-       Evas_Object *evas_img;
-       /*elm_image_no_scale_set(ugd->preview_img, EINA_FALSE);
-       elm_image_resizable_set(ugd->preview_img, EINA_TRUE, EINA_TRUE);*/
-
-       if (NULL != ugd && NULL != ugd->preview_img) {
-               evas_img = elm_image_object_get(ugd->preview_img);
-               /*evas_object_resize(ugd->preview_img, 0, 0);*/
-               evas_object_image_data_set(evas_img, NULL);
-       } else {
-               PTS_DEBUG("Just ignore preview reset");
-       }
-       PTS_TRACE_END;
-}
-
-/*
-* set preview image
-*/
-void set_preview_image(Evas_Object *img, const char *fname, int preview_state)
-{
-       PTS_TRACE_BEGIN;
-       PTS_RET_IF(NULL == img || NULL == fname, "Invalid argument");
-
-       Evas_Object *evas_img;
-       evas_img = elm_image_object_get(img);
-
-       /*switch (get_file_type(fname)) {
-       case FILE_TYPE_IMAGE:*/
-       /*elm_image_no_scale_set(img, EINA_TRUE);
-       elm_image_resizable_set(img, EINA_FALSE, EINA_FALSE);*/
-       PTS_DEBUG("@@@FILENAME: %s", fname);
-       /* clear image */
-       evas_object_image_data_set(evas_img, NULL);
-       int elm_err = elm_image_file_set(img, fname, "ppm");
-       PTS_DEBUG("elm image_file_set error %d", elm_err);
-
-       PTS_TRACE_END;
-}
-
+#if 0
 char *get_preview_image_path(pts_core_data_t *ugd)
 {
        PTS_TRACE_BEGIN;
@@ -1753,7 +1700,7 @@ char *get_preview_image_path(pts_core_data_t *ugd)
 
        if ((ugd->pt_files.current_index >= 0)
                        && (ugd->pt_files.current_index < g_pages_count)) {
-               sprintf(g_current_preview_path, "/tmp/mobileprint_%04d.ppm",
+               sprintf(g_current_preview_path, "/tmp/mobileprint/mobileprint_%04d.ppm",
                                ugd->pt_files.current_index + 1);
                PTS_DEBUG("Preview image path is %s", g_current_preview_path);
                PTS_TRACE_END;
@@ -1762,6 +1709,85 @@ char *get_preview_image_path(pts_core_data_t *ugd)
        PTS_TRACE_END;
        return NULL;
 }
+#endif
+
+/*
+ * Set accessability information - screen reader text
+ */
+void set_main_view_accessability_info(pts_core_data_t *ugd)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RET_IF(NULL == ugd || NULL == ugd->active_printer, "Invalid argument");
+
+       char papersize[256]={0,};
+       strncpy(papersize, pt_get_print_option_papersize(ugd->active_printer->size), 256-1);
+       char *quality, *papertype, *grayscale_mode, *print_range;
+       int p_quality = pt_get_selected(PT_OPTION_ID_QUALITY);
+       if (PT_QUALITY_DRAFT == p_quality) {
+               quality = _("IDS_PRT_OPT_PRINTSETTINGS_DRAFT");
+       } else if (PT_QUALITY_STANDARD == p_quality) {
+               quality = _("IDS_PRT_OPT_PRINTSETTINGS_STANDARD");
+       } else if (PT_QUALITY_HIGH == p_quality) {
+               quality = _("IDS_COM_BODY_HIGH");
+       }
+       int p_type = pt_get_selected(PT_OPTION_ID_PAPER);
+       if (PT_PAPER_NORMAL == p_type) {
+               papertype = _("IDS_ST_BODY_NORMAL");
+       } else if (PT_PAPER_GLOSSY == p_type) {
+               papertype = _("IDS_ST_BODY_GLOSSY");
+       } else if (PT_PAPER_PHOTO == p_type) {
+               papertype = _("IDS_PRT_BODY_PHOTOGRAPHIC_ABB");
+       }
+       int p_grayscale = pt_get_selected(PT_OPTION_ID_GRAYSCALE);
+       if (PT_GRAYSCALE_COLOUR == p_grayscale) {
+               grayscale_mode = _("IDS_PRT_BODY_COLOUR");
+       } else if (PT_GRAYSCALE_GRAYSCALE == p_grayscale) {
+               grayscale_mode = _("IDS_IMGE_HEADER_GREY");
+       }
+       pt_range_e p_range = ugd->active_printer->range;
+       if (PT_RANGE_ALL == p_range) {
+               print_range = _("IDS_DIC_BODY_ALL");
+       } else {
+               print_range = _("IDS_BR_BODY_CURRENT_PAGE");
+       }
+
+       char main_view_accessability_text[2048] = {0,};
+       snprintf(main_view_accessability_text, 2047, "%s, %d page of %d pages, %s size, %d %s,"
+                                                                                               " print %s, %s, "
+                                                                                               " %s orientation, %s quality, %s paper"
+                                                                                               " %s mode, send to %s",
+                       basename(ugd->input_file), //printing file
+                       ugd->pt_files.current_index + 1, //current page
+                       g_pages_count, //total pages
+                       papersize,
+                       ugd->active_printer->copies,
+                       (1 == ugd->active_printer->copies) ? "copy" : "copies",
+                       print_range,
+                       (PT_SCALING_2_PAGES == ugd->active_printer->scaling) ? "2 pages in 1 sheet" :
+                       (PT_SCALING_4_PAGES == ugd->active_printer->scaling) ? "4 pages in 1 sheet" :
+                       "fit to paper",
+                       PT_ORIENTATION_PORTRAIT == ugd->active_printer->landscape ? "portrait" :
+                       PT_ORIENTATION_LANDSCAPE == ugd->active_printer->landscape ? "landscape" : "auto",
+                       quality,
+                       papertype,
+                       grayscale_mode,
+                       elm_access_info_get(ugd->printer_label, ELM_ACCESS_INFO));
+       Evas_Object *ao;
+       ao = elm_access_object_get(ugd->smsc);
+       if (NULL == ao) {
+               ao = elm_access_object_register(ugd->smsc, ugd->img_layout);
+               PTS_RET_IF(NULL == ao, "ERROR: Failed to register smsc in access!");
+       }
+       else {
+               PTS_DEBUG("Image Evas_Object is already registered in access.");
+       }
+       PTS_DEBUG("Setting accessability text: %s", main_view_accessability_text);
+       elm_access_info_set(ao, ELM_ACCESS_INFO, main_view_accessability_text);
+       elm_access_info_set(ao, ELM_ACCESS_TYPE, IDS_SCRREAD_PREVIEW_IMAGE_TYPE);
+       elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_PREVIEW_IMAGE_CONTEXT);
+
+       PTS_TRACE_END;
+}
 
 /*
 * create content of the main view screen
@@ -1771,10 +1797,6 @@ static Evas_Object *__pts_main_view_create_content(pts_core_data_t *ugd)
        PTS_TRACE_BEGIN;
        PTS_RETV_IF(ugd == NULL, NULL, "ugd is NULL");
 
-       char *file_path = NULL;
-       Evas_Object *printer_label = NULL;
-       char label[128] = {0,};
-
        /*
         * load preview group
         */
@@ -1788,59 +1810,27 @@ static Evas_Object *__pts_main_view_create_content(pts_core_data_t *ugd)
        ugd->img_layout = pts_create_base_layout(ugd->printer_layout, "image_view");
 
        if (NULL != ugd->pt_files.request_files) {
-               /* file_path = ugd->pt_files.files[0]; */
+               char *file_path = NULL;
                file_path = ugd->pt_files.request_files[ugd->pt_files.current_index];
                PTS_DEBUG("filepath is %s", file_path);
        }
 
-       ugd->preview_img = elm_image_add(ugd->img_layout);
-       elm_object_part_content_set(ugd->img_layout, "content", ugd->preview_img);
-
-       evas_object_event_callback_add(ugd->img_layout,
-                                                                  EVAS_CALLBACK_MOUSE_DOWN,
-                                                                  __pts_main_view_mouse_down_cb, ugd);
-       evas_object_event_callback_add(ugd->img_layout, EVAS_CALLBACK_MOUSE_UP,
-                                                                  __ug_view_mouse_up_cb,       ugd);
+       ugd->smsc = evas_smart_smsc_add(evas_object_evas_get(ugd->img_layout));
+       evas_smart_smsc_set_layout(ugd->smsc, ugd->img_layout);
+       elm_object_part_content_set(ugd->img_layout, "content", ugd->smsc);
 
+       set_main_view_accessability_info(ugd);
        /*
         * Set preview layout
         */
        elm_object_part_content_set(ugd->printer_layout, "image", ugd->img_layout);
-       evas_object_show(ugd->preview_img);
        evas_object_show(ugd->img_layout);
        evas_object_show(ugd->printer_layout);
 
-       show_loading_animation(ugd);
-
        PTS_TRACE_END;
        return ugd->printer_layout;
 }
 
-/**
- *     This function let the app load the previewed image
- *     @return  Evas_Object
- *     @param[in] ugd the pointer to the main data structure
- */
-Evas_Object *pts_main_view_load_preview_img(pts_core_data_t *ugd)
-{
-       PTS_TRACE_BEGIN;
-       char pages[15];
-       PTS_RETV_IF(ugd == NULL, NULL, "ugd is NULL");
-
-       set_preview_image(ugd->preview_img, get_preview_image_path(ugd), 0);
-
-       if (g_pages_count > 1)
-               sprintf(pages, "%d / %d", ugd->pt_files.current_index + 1,
-                               g_pages_count);
-       else {
-               strcpy(pages, "              ");
-       }
-       edje_object_part_text_set(elm_layout_edje_get(ugd->img_layout),
-                                                         "pagenumber", pages);
-
-       PTS_TRACE_END;
-       return NULL;
-}
 
 /*
 * setting button callback function
@@ -1865,7 +1855,7 @@ static void __pts_main_view_btn_setting_cb(void *data, Evas_Object *obj, void *e
        PTS_TRACE_END;
 }
 
-int pts_main_view_load_print_files(pts_core_data_t *ugd, pts_printing_data_t *printing_data)
+int pts_main_view_load_printing_data(pts_core_data_t *ugd, pts_printing_data_t *printing_data)
 {
        PTS_TRACE_BEGIN;
        PTS_RETV_IF(ugd == NULL || printing_data == NULL, -1, "Invalid argument");
@@ -1924,8 +1914,8 @@ void pts_main_view_update_printer_label(pts_core_data_t *ugd)
        PTS_TRACE_BEGIN;
        PTS_RET_IF(ugd == NULL, "ugd is NULL");
 
-       Evas_Object *printer_label = NULL;
-       char label[128] = {0,};
+       char label_text[128] = {0,};
+       char label_voice[128] = {0,};
 
        if (ugd->printer_label == NULL) {
                ugd->printer_label = elm_label_add(ugd->printer_layout);
@@ -1933,17 +1923,21 @@ void pts_main_view_update_printer_label(pts_core_data_t *ugd)
        PTS_DEBUG("ugd->active_printer is %p", ugd->active_printer);
 
        if (ugd->active_printer != NULL) {
-               char *printer_label = strdup(ugd->active_printer->name);
-               pts_unstandardization(printer_label);
-               snprintf(label, 128, "<align=center>%s</align>", printer_label);
-               if (printer_label != NULL) {
-                       free(printer_label);
-                       printer_label = NULL;
+               char *printer_name = strdup(ugd->active_printer->name);
+               pts_unstandardization(printer_name);
+               snprintf(label_text, 128, "<align=center>%s</align>", printer_name);
+               snprintf(label_voice, 128, "%s", printer_name);
+               if (printer_name != NULL) {
+                       free(printer_name);
+                       printer_name = NULL;
                }
        } else {
-               snprintf(label, 128, "<align=center>%s</align>", _("IDS_COM_BODY_NO_DEVICES"));
+               snprintf(label_text, 128, "<align=center>%s</align>", _("IDS_COM_BODY_NO_DEVICES"));
+               snprintf(label_voice, 128, "%s", _("IDS_COM_BODY_NO_DEVICES"));
        }
-       elm_object_text_set(ugd->printer_label, label);
+
+       elm_object_text_set(ugd->printer_label, label_text);
+       elm_access_info_set(ugd->printer_label, ELM_ACCESS_INFO, label_voice);
        evas_object_size_hint_weight_set(ugd->printer_label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(ugd->printer_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
@@ -1964,8 +1958,7 @@ void pts_main_view_rotate_image(pts_core_data_t *ugd,
        PTS_TRACE_BEGIN;
        PTS_RET_IF(ugd == NULL, "ugd is NULL");
 
-       clear_preview_image(ugd); /* TODO: show empty page */
-       show_loading_animation(ugd);
+       //clear_preview_image(ugd); /* TODO: show empty page */
        generate_preview_images(ugd, orientation);
        g_pages_count = 0;
 
@@ -1986,21 +1979,24 @@ API Evas_Object *pts_create_main_view(pts_core_data_t *ugd)
        Evas_Object *main_layout = NULL;
        Evas_Object *back_btn = NULL;
 
-       ugd->main_win = pts_create_base_layout_with_conform(ugd->root_win, "navi");
-       if (NULL == ugd->main_win) {
+       ugd->main_layout = pts_create_base_layout_with_conform(ugd->root_win, "navi");
+       if (NULL == ugd->main_layout) {
                PTS_IF_FREE_MEM(ugd);
                PTS_DEBUG("create base layout failed");
                PTS_TRACE_END;
                return NULL;
        }
 
-       ugd->navi = elm_naviframe_add(ugd->main_win);
-       elm_object_part_content_set(ugd->main_win, "navigation_bar", ugd->navi);
+       ugd->navi = elm_naviframe_add(ugd->main_layout);
+       elm_object_part_content_set(ugd->main_layout, "navigation_bar", ugd->navi);
 
        main_layout = __pts_main_view_create_content(ugd);
 
        back_btn = pts_create_label_btn(ugd->navi, _("IDS_COM_SK_BACK"));
+       elm_access_info_set(back_btn, ELM_ACCESS_INFO, _("IDS_COM_SK_BACK"));
+       elm_access_info_set(back_btn, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_PRINTING);
        elm_object_style_set(back_btn, "naviframe/back_btn/default");
+
        evas_object_smart_callback_add(back_btn, "clicked", __pts_main_view_btn_back_cb, ugd);
 
        evas_object_event_callback_add(ugd->navi, EVAS_CALLBACK_DEL, __pts_main_view_navi_delete_cb, ugd);
@@ -2008,21 +2004,15 @@ API Evas_Object *pts_create_main_view(pts_core_data_t *ugd)
        ugd->navi_it = elm_naviframe_item_push(ugd->navi, _("IDS_PRT_SK_PRINT_PREVIEW"), back_btn, NULL, main_layout, NULL);
 
        ugd->print_btn = create_toolbar_btn(ugd->navi, _("IDS_SMPOS_SK3_PRINT"), __pts_main_view_btn_print_cb, ugd);
+       elm_access_info_set(ugd->print_btn, ELM_ACCESS_INFO, _("IDS_SMPOS_SK3_PRINT"));
+       elm_access_info_set(ugd->print_btn, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_PRINT_CONTEXT);
        elm_object_item_part_content_set(ugd->navi_it, "toolbar_button1", ugd->print_btn);
 
        ugd->more_btn = create_toolbar_more_btn(ugd->navi, _more_btn_cb, ugd->navi_it);
        elm_object_item_part_content_set(ugd->navi_it, "toolbar_more_btn", ugd->more_btn);
 
        evas_object_event_callback_add(main_layout, EVAS_CALLBACK_DEL, __pts_main_view_delete_cb, ugd);
-       /*Create preview-images from pdf*/
-       /*assuming there can be only one pdf file on input*/
-       //g_pages_count = pts_generate_preview(ugd);
 
-       /* TODO: move to preview widget initialization */
-       init_preview_engine(&(ugd->engine));
-       /* connect callback for page ready */
-       ecore_event_handler_add(ugd->engine.page_ready_event_type,
-                                                       page_ready_cb, ugd);
 
        int tmp_width = 0;
        int tmp_height = 0;
@@ -2038,5 +2028,5 @@ API Evas_Object *pts_create_main_view(pts_core_data_t *ugd)
        ugd->custom_unit = 1; // cm unit
 
        PTS_TRACE_END;
-       return ugd->main_win;
+       return ugd->main_layout;
 }
index ed67adf..1a96945 100644 (file)
@@ -36,7 +36,6 @@
 #include "pts_list_view.h"
 #include "pts_setting_view.h"
 #include "preview_content.h"
-#include "preview_widget.h"
 #include "preview_util.h"
 
 static char *WiFi_Type_String[] = {
@@ -94,6 +93,35 @@ static void _pts_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
        PTS_TRACE_END;
 }
 
+static void _pts_ug_result_cb(ui_gadget_h ug, service_h result, void *priv)
+{
+       PTS_TRACE_BEGIN;
+       pts_core_data_t *ugd = (pts_core_data_t *)priv;
+       PTS_RET_IF(ugd == NULL, "ugd is NULL");
+
+       char *ip_addr = NULL;
+       service_get_extra_data(result, "ip_address", &ip_addr);
+       if (ip_addr) {
+               /* Check IP address of connected peer */
+               // TODO - Add active printer set routine to CUPS using this address
+               PTS_DEBUG("IP address of WiFi Direct Printer : %s", ip_addr);
+       } else {
+               PTS_DEBUG("Not found ip_address");
+       }
+
+       char *wfds_svc = NULL;
+       service_get_extra_data(result, "wfds", &wfds_svc);
+       if (wfds_svc) {
+               /* Check WFDS service */
+               // TODO - Add bypass routine to aviod L3 discovery when used WFDS Print
+               PTS_DEBUG("WFDS service : %s", wfds_svc);
+       } else {
+               PTS_DEBUG("Not found wfds");
+       }
+
+       PTS_TRACE_END;
+}
+
 static void _pts_ug_destroy_cb(ui_gadget_h ug, void *priv)
 {
        PTS_TRACE_BEGIN;
@@ -196,17 +224,8 @@ static void _pts_wifi_list_sel(void *data, Evas_Object *obj, void *event_info)
        Elm_Object_Item *item = (Elm_Object_Item *)event_info;
 
        if (item) {
-               struct ug_cbs cbs = {0, };
-               memset(&cbs, 0x00, sizeof(struct ug_cbs));
-
-               cbs.layout_cb = _pts_ug_layout_cb;
-               cbs.result_cb = NULL;
-               cbs.destroy_cb = _pts_ug_destroy_cb;
-               cbs.priv = ugd;
-
                index = (int)elm_object_item_data_get(item);
-               if (index == 0) {
-                       // Wi-Fi
+               if (index == 0) { // Wi-Fi
                        int ret = pts_launch_wifi_qs();
                        if (ret > 0) {
                                // Currently ret value is procces id of wifi_qs.
@@ -215,9 +234,24 @@ static void _pts_wifi_list_sel(void *data, Evas_Object *obj, void *event_info)
                        } else {
                                PTS_DEBUG("Failed to launch wifi-qs.");
                        }
-               } else if (index == 1) {
-                       // Wi-Fi Direct is selected.
-                       ug_create(NULL, "setting-wifidirect-efl", UG_MODE_FULLVIEW, NULL, &cbs);
+               } else if (index == 1) { // Wi-Fi Direct
+                       struct ug_cbs cbs = {0, };
+                       service_h service = NULL;
+
+                       memset(&cbs, 0x00, sizeof(struct ug_cbs));
+                       cbs.layout_cb = _pts_ug_layout_cb;
+                       cbs.result_cb = _pts_ug_result_cb;
+                       cbs.destroy_cb = _pts_ug_destroy_cb;
+                       cbs.priv = ugd;
+
+                       service_create(&service);
+                       service_add_extra_data(service, "device_filter", "printer");
+                       service_add_extra_data(service, "auto_exit", "on");
+                       service_add_extra_data(service, "multi_connect", "off");
+                       service_add_extra_data(service, "title_string", _("IDS_COM_OPT1_WI_FI_DIRECT"));
+
+                       ug_create(NULL, "setting-wifidirect-efl", UG_MODE_FULLVIEW, service, &cbs);
+                       service_destroy(service);
                } else {
                        PTS_DEBUG("Unknown index");
                }
@@ -365,6 +399,12 @@ static void _pts_printer_list_ok_cb(void *data, Evas_Object *obj, void *event_in
        pts_core_data_t *ugd = ld->ugd;
        PTS_RET_IF(ugd == NULL, "ugd is NULL");
 
+       if (ugd->select_printer == NULL) {
+               //No supported printer
+               PTS_TRACE_END;
+               return;
+       }
+
        if (NULL != printer_list_radio_main) {
                evas_object_del(printer_list_radio_main);
                printer_list_radio_main = NULL;
@@ -462,7 +502,11 @@ static char *__pts_list_view_label_get(void *data, Evas_Object *obj, const char
                }
        } else if (strcmp(part, "elm.text.2") == 0) {
                if (item != NULL) {
-                       return pts_parse_protocol(item->address);
+                       if (item->is_ppd_exist == FALSE) {
+                               return strdup(_("IDS_COM_POP_UNSUPPORTED"));
+                       } else {
+                               return pts_parse_protocol(item->address);
+                       }
                }
        }
 
@@ -590,9 +634,17 @@ Evas_Object *pts_search_create_wifi_type_selector_popup(Evas_Object *parent, pts
        elm_object_part_text_set(popup, "title,text", _("IDS_PRT_BODY_CONNECT_TO_WI_FI_NETWORK_TO_PRINT"));
        evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
+       /* accessability - screen reader support */
+       Evas_Object *po, *eo, *ao;
+       eo = elm_layout_edje_get(popup);
+       po = edje_object_part_object_get(eo, "access.title");
+       ao = elm_access_object_get(po);
+       elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, _("IDS_PRT_BODY_CONNECT_TO_WI_FI_NETWORK_TO_PRINT"));
+
        btn1 = elm_button_add(popup);
        elm_object_style_set(btn1,"popup_button/default");
        elm_object_text_set(btn1, _("IDS_COM_SK_CANCEL"));
+       elm_access_info_set(btn1, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_CONNECT_WIFI);
        elm_object_part_content_set(popup, "button1", btn1);
        evas_object_smart_callback_add(btn1, "clicked", _pts_cancel_cb, ugd);
 
@@ -667,6 +719,7 @@ Evas_Object *pts_create_content_printer_list(Evas_Object *parent, pts_ug_list_da
        PTS_RETV_IF(ld == NULL, NULL, "ld is NULL");
 
        Evas_Object *genlist = NULL;
+       Elm_Object_Item *git;
        genlist = elm_genlist_add(parent);
 
        // ToDo: Make sure that printer_list_radio_main always is NULL at here..
@@ -700,18 +753,18 @@ Evas_Object *pts_create_content_printer_list(Evas_Object *parent, pts_ug_list_da
 
        EINA_LIST_FOREACH(ld->printer_list, cursor, it) {
 
-               if (radio_index == 1)   {
+               if (ld->ugd->select_printer == NULL && it->is_ppd_exist == TRUE)        {
                        // set the first printer as default one.
                        ld->ugd->select_printer = it;
                }
                PTS_DEBUG("printer %d\n", radio_index);
-
                core = (radio_print_list_data_t *)malloc(sizeof(radio_print_list_data_t));
                core->radio_index = radio_index;
                core->pt = it;
                core->radio_group = printer_list_radio_main;
                core->ugd = ld->ugd;
-               elm_genlist_item_append(
+
+               git = elm_genlist_item_append(
                        genlist,
                        &list_itc,
                        (void *)core,
@@ -719,10 +772,15 @@ Evas_Object *pts_create_content_printer_list(Evas_Object *parent, pts_ug_list_da
                        ELM_GENLIST_ITEM_NONE,
                        __pts_search_print_list_sel,
                        ld);
+
+               if (it->is_ppd_exist == FALSE) {
+                       elm_object_item_disabled_set(git, EINA_TRUE);
+               }
                radio_index ++;
        }
 
        if (ld->ugd->print_search_mode != PTS_SEARCH_INITIAL) {
+
                elm_genlist_item_append(
                                genlist,
                                &refresh_itc,
@@ -758,18 +816,28 @@ Evas_Object *pts_create_printer_list_popup(Evas_Object *parent, pts_ug_list_data
        //elm_object_style_set(popup,"menustyle");
        elm_object_style_set(popup,"min_menustyle");
        elm_object_part_text_set(popup, "title,text", _("IDS_PRT_BODY_SELECT_PRINTER"));
-
        evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_access_info_set(popup, ELM_ACCESS_CONTEXT_INFO, _("IDS_PRT_BODY_SELECT_PRINTER")); //FIXME: should be set to title, not popup itself
+
+       /* accessability - screen reader support */
+       Evas_Object *po, *eo, *ao;
+       eo = elm_layout_edje_get(popup);
+       po = edje_object_part_object_get(eo, "access.title");
+       ao = elm_access_object_get(po);
+       elm_access_info_set(ao, ELM_ACCESS_INFO, _("IDS_PRT_BODY_SELECT_PRINTER"));
+       elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_PRINTERS_LIST_IS_BELOW);
 
        btn1 = elm_button_add(popup);
        elm_object_style_set(btn1,"popup_button/default");
        elm_object_text_set(btn1, _("IDS_COM_SK_OK"));
+       elm_access_info_set(btn1, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CONFIRM_SELECTED_PRINTER);
        elm_object_part_content_set(popup, "button1", btn1);
        evas_object_smart_callback_add(btn1, "clicked", _pts_printer_list_ok_cb, ld);
 
        btn2 = elm_button_add(popup);
        elm_object_style_set(btn2,"popup_button/default");
        elm_object_text_set(btn2, _("IDS_COM_SK_CANCEL"));
+       elm_access_info_set(btn2, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_PRINTING);
        elm_object_part_content_set(popup, "button2", btn2);
        evas_object_smart_callback_add(btn2, "clicked", _pts_printer_list_cancel_cb, popup);
 
@@ -784,9 +852,26 @@ Evas_Object *pts_create_printer_list_popup(Evas_Object *parent, pts_ug_list_data
  * XXX - below 143 value is just for entry height of 2text.1icon.4 style in genlist
  */
        elm_box_pack_end(box, genlist);
-       evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), elm_genlist_items_count(genlist) * 143 * elm_config_scale_get());
+
+       int rotate_angle = 0;
+       rotate_angle = _pts_get_rotate_angle(APPCORE_RM_UNKNOWN);
+       elm_win_rotation_with_resize_set(parent, rotate_angle);
+
+       ld->ugd->printer_list_popup_portrait_height     = MIN(PRINTER_LIST_POPUP_H, elm_genlist_items_count(genlist) * 143) * elm_config_scale_get();
+       ld->ugd->printer_list_popup_landscape_height    = MIN(PRINTER_LIST_POPUP_LN_H, elm_genlist_items_count(genlist) * 143) * elm_config_scale_get();
+
+       if (0 == rotate_angle || 180 == rotate_angle)
+               evas_object_size_hint_min_set(box,
+               PRINTER_LIST_POPUP_W * elm_config_scale_get(),
+               ld->ugd->printer_list_popup_portrait_height);
+       else
+               evas_object_size_hint_min_set(box,
+               PRINTER_LIST_POPUP_LN_W * elm_config_scale_get(),
+               ld->ugd->printer_list_popup_landscape_height);
+
        elm_object_content_set(popup, box);
 
+       ld->ugd->printer_list_popup_box = box;
        ld->ugd->printer_list_popup = popup;
 
        evas_object_show(genlist);
@@ -899,6 +984,7 @@ void pts_create_print_search_popup(Evas_Object *parent, pts_core_data_t *ugd)
 {
        PTS_TRACE_BEGIN;
        PTS_RET_IF(ugd == NULL, "ugd is NULL");
+       PTS_RET_IF(parent == NULL, "parent is NULL");
 
        pts_ug_list_data *ld = NULL;
        ld = (pts_ug_list_data *)calloc(1, sizeof(pts_ug_list_data));
@@ -922,15 +1008,24 @@ void pts_create_print_search_popup(Evas_Object *parent, pts_core_data_t *ugd)
        evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        elm_progressbar_pulse(progressbar, EINA_TRUE);
+       elm_access_info_set(progressbar, ELM_ACCESS_INFO, _("IDS_PRT_BODY_SEARCHING_FOR_PRINTERS_ING")); //FIXME Screen reader doesn't pronounce it
 
        evas_object_show(progressbar);
 
        elm_object_part_content_set(layout, "elm.swallow.content", progressbar);
        elm_object_part_text_set(layout, "elm.text", _("IDS_PRT_BODY_SEARCHING_FOR_PRINTERS_ING"));
 
+       /* accessability - screen reader support */
+       Evas_Object *po, *ao;
+       po = edje_object_part_object_get(layout, "elm.swallow.content");
+       ao = elm_access_object_get(po);
+       elm_access_info_set(ao, ELM_ACCESS_INFO, _("IDS_PRT_BODY_SEARCHING_FOR_PRINTERS_ING"));
+
+
        elm_object_content_set(ld->popup, layout);
        btn = elm_button_add(ld->popup);
        elm_object_text_set(btn, _("IDS_COM_SK_CANCEL"));
+       elm_access_info_set(btn, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_SEARCHING_PRINTERS);
        elm_object_part_content_set(ld->popup, "button1", btn);
        evas_object_smart_callback_add(btn, "clicked", _pts_cancel_cb, ld->ugd);
 
@@ -973,9 +1068,8 @@ void pts_search_printer(pts_core_data_t *ugd, Evas_Object *parent, pts_printer_s
                        pts_create_print_search_popup(ugd->print_search_popup_parent, ugd);
                }
        } else {
-               //ToDo: display error popup
+               //TODO: display error popup
                //Vconf access error.
-               ;
        }
 
        //pts_main_view_rotate_image(ugd, app_get_device_orientation());
index daef902..5b25a94 100644 (file)
@@ -316,6 +316,7 @@ static char *__pts_setting_view_printer_label_get(void *data, Evas_Object *obj,
        if (strcmp(part, "elm.text.1") == 0) {
                //if (printer != NULL) {
                //return strdup(printer->name);
+               PTS_TRACE_END;
                return strdup(_("IDS_PRT_BODY_PRINTER"));
                //}
        } else if (strcmp(part, "elm.text.2") == 0) {
@@ -324,8 +325,10 @@ static char *__pts_setting_view_printer_label_get(void *data, Evas_Object *obj,
                        char *printer_label = strdup(ugd->active_printer->name);
                        pts_unstandardization(printer_label);
                        //return strdup(printer->address);
+                       PTS_TRACE_END;
                        return printer_label;
                } else {
+                       PTS_TRACE_END;
                        return strdup(PTS_18);
                }
        }
@@ -758,8 +761,9 @@ static void __pts_setting_view_key_value_sel(void *user_data, Evas_Object *obj,
 
                elm_radio_value_set(core->radio_group, core->radio_index);
                __pts_setting_view_enable_disable(ugd);
-               elm_genlist_realized_items_update(obj);
-
+               if(parent_item) {
+                       elm_genlist_item_update(parent_item);
+               }
                PTS_DEBUG("Update radio group: r_group=[0x%x  <-- %d]", core->radio_group, core->radio_index);
 
        } else {
@@ -871,6 +875,8 @@ static Evas_Object *__pts_create_radio_group(Evas_Object *genlist)
 static void __pts_setting_view_gl_exp(void *data, Evas_Object *obj, void *event_info)
 {
        PTS_TRACE_BEGIN;
+       PTS_RET_IF(NULL == event_info, "item object is NULL");
+
        Elm_Object_Item *item = (Elm_Object_Item *)event_info;
        Evas_Object *genlist = elm_object_item_widget_get(item);
        pts_core_data_t *ugd = (pts_core_data_t *)data;
@@ -929,7 +935,54 @@ static void __pts_setting_view_gl_exp(void *data, Evas_Object *obj, void *event_
        PTS_TRACE_END;
 }
 
+/*
+ * Accessability info for items from list
+ */
+static void __pts_setting_view_gl_realized(void *data, Evas_Object *obj, void *event_info)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RET_IF(NULL == event_info, "item object is NULL");
+       PTS_RET_IF(NULL == data, "ugd is NULL");
 
+       Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+       pts_core_data_t *ugd = (pts_core_data_t *)data;
+       void *item_data = elm_object_item_data_get(item);
+       //PTS_RET_IF(NULL == item_data, "item data is NULL"); //FIXME: related to Jira issue #
+
+       if (item_data == (void *)ugd->active_printer){
+           Evas_Object *ao = elm_object_item_access_object_get(item);
+               PTS_RET_IF(NULL == ao, "Access object is NULL");
+               elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_PRINTER_ITEM_CONTEXT);
+               PTS_DEBUG("Item #printer access context info: [%s]", IDS_SCRREAD_PRINTER_ITEM_CONTEXT);
+       }
+       else {
+               //REINTERPRETING POINTER since it's ENUM!
+               pt_print_option_e option = (pt_print_option_e)item_data;
+               PTS_RET_IF(option >= PT_OPTION_ID_MAX, "UNKNOWN OPTION REALIZED");
+
+               PTS_DEBUG("realized print option: [%d]\n", option);
+
+               if (PT_OPTION_ID_PAPERSIZE == option
+                               || PT_OPTION_ID_RANGE == option
+                               || PT_OPTION_ID_QUALITY == option
+                               || PT_OPTION_ID_PAPER == option
+                               || PT_OPTION_ID_GRAYSCALE == option) {
+
+                       Evas_Object *ao = elm_object_item_access_object_get(item);
+                       PTS_RET_IF(NULL == ao, "Access object is NULL");
+                       elm_access_info_set(ao, ELM_ACCESS_TYPE, IDS_SCRREAD_EXPANDABLE_LIST_TYPE);
+                       elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_EXPANDABLE_LIST_CONTEXT);
+                       PTS_DEBUG("Item #%d access context info: [%s]", option, IDS_SCRREAD_EXPANDABLE_LIST_CONTEXT);
+               }
+               else if (PT_OPTION_ID_COPIES == option) {
+                       Evas_Object *ao = elm_object_item_access_object_get(item);
+                       PTS_RET_IF(NULL == ao, "Access object is NULL");
+                       elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_SETTINS_ITEM_CONTEXT);
+                       PTS_DEBUG("Item #%d access context info: [%s]", option, IDS_SCRREAD_SETTINS_ITEM_CONTEXT);
+               }
+       }
+       PTS_TRACE_END;
+}
 
 /*
 * create the content of setting view
@@ -1068,6 +1121,9 @@ static Evas_Object *__pts_setting_view_create_content(Evas_Object *parent, pts_c
        evas_object_smart_callback_add(genlist, "expanded", __pts_setting_view_gl_exp, ugd);
        evas_object_smart_callback_add(genlist, "contracted", __pts_setting_view_gl_con, ugd);
 
+       /* Accessability information callback */
+       evas_object_smart_callback_add(genlist, "realized", __pts_setting_view_gl_realized, ugd);
+
        /* Add touch coordinates handler */
        Ecore_Event_Handler *event;
        event = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _mousedown_cb, NULL);
diff --git a/mobileprint/app/pts_util.c b/mobileprint/app/pts_util.c
new file mode 100644 (file)
index 0000000..40d1222
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+*  Mobileprint
+*
+* Copyright 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 <linux/unistd.h>
+#include <sys/utsname.h>
+#include <dirent.h>
+#include "pts_common.h"
+#include "pts_debug.h"
+
+void pts_util_show_error_popup(Evas_Object *parent, const char *msg)
+{
+       //pts_appdata_t *ad = pts_get_appdata();
+       //PTS_RET_IF(ad == NULL, "ad is NULL");
+       //PTS_RET_IF(ad->win == NULL, "ad->win is NULL");
+
+       PTS_RET_IF(parent == NULL, "");
+
+       Evas_Object *error_popup = elm_popup_add(parent);
+       PTS_RET_IF(error_popup == NULL, "error_popup is NULL");
+       evas_object_size_hint_weight_set(error_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_text_set(error_popup, msg);
+       evas_object_show(error_popup);
+       evas_object_show(parent);
+       return;
+}
+
+Eina_Bool pts_util_supported_arch(void)
+{
+       struct utsname buf;
+       int ret = uname(&buf);
+       if (ret == -1) {
+               PTS_DEBUG("Failed to get uname");
+       } else if (strstr(buf.machine,"arm") == NULL) {
+               PTS_DEBUG("No supported : %s", buf.machine);
+               return EINA_FALSE;
+       } else {
+               PTS_DEBUG("Supported : %s", buf.machine);
+       }
+       return EINA_TRUE;
+}
+
+void pts_util_remove_tmp_files(const char *path)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RET_IF(path == NULL, "path is NULL");
+       char *cwd;
+       struct dirent *entry;
+       int ret = 1;
+       int iret = -1;
+       DIR *dir;
+
+       cwd = get_current_dir_name();
+
+       errno = 0;
+       ret = chdir(path);
+       if (ret == 0) {
+               dir = opendir(path);
+               while ((entry = readdir(dir)) != NULL) {
+                       PTS_DEBUG("Remove %s", entry->d_name);
+                       iret = remove(entry->d_name);
+                       if (iret == -1) {
+                               PTS_DEBUG("unable to remove %s",entry->d_name);
+                       }
+               }
+               closedir(dir);
+
+               iret = chdir(cwd);
+               PTS_IF_FREE_MEM(cwd);
+               PTS_RET_IF(iret == -1, "unable to chdir");
+               rmdir(path);
+       } else {
+               if (errno == ENOENT) {
+                       PTS_DEBUG("Not existed %s, just skip", path);
+               }
+       }
+       PTS_TRACE_END;
+       return;
+}
index f8ee183..de7b8fd 100644 (file)
@@ -1,4 +1,4 @@
-#define LAYOUT_INDICATOR_HEIGHT_INC 50
+#define LAYOUT_INDICATOR_HEIGHT_INC 0
 
 collections
 {
@@ -282,7 +282,7 @@ collections
                         repeat_events: 1;
                         description { state: "default" 0.0;
                                align: 0.5 0.0;
-                               min: 0 14;
+                               min: 0 0;
                                fixed: 0 1;
                                rel1 {
                                   relative: 1.0 0.0;
@@ -297,7 +297,7 @@ collections
                  part { name: "pad_l";
                         scale: 1;
                         description { state: "default" 0.0;
-                               min : 10 0;
+                               min : 0 0;
                                fixed: 1 0;
                                rel1 {
                                   relative: 0.0 0.0;
@@ -311,7 +311,7 @@ collections
                  part { name: "pad_r";
                         scale: 1;
                         description { state: "default" 0.0;
-                               min : 10 0;
+                               min : 0 0;
                                fixed: 1 0;
                                rel1 {
                                   relative: 1.0 0.0;
@@ -326,7 +326,7 @@ collections
                         type: SWALLOW;
                         scale : 1;
                         description { state: "default" 0.0;
-                               min: 300 0;
+                               min: 604 0;
                                align: 0.5 0.5;
                                fixed: 1 0;
                                rel1 {
@@ -343,7 +343,7 @@ collections
                         type: SWALLOW;
                         scale : 1;
                         description { state: "default" 0.0;
-                               min: 300 0;
+                               min: 604 0;
                                align: 0.5 0.5;
                                fixed: 1 0;
                                rel1 {
@@ -360,7 +360,7 @@ collections
                         type: SWALLOW;
                         scale : 1;
                         description { state: "default" 0.0;
-                               min: 300 0;
+                               min: 604 0;
                                align: 0.5 0.5;
                                fixed: 1 0;
                                rel1 {
@@ -377,7 +377,7 @@ collections
                         type: SWALLOW;
                         scale : 1;
                         description { state: "default" 0.0;
-                               min: 300 0;
+                               min: 604 0;
                                align: 0.5 0.5;
                                fixed: 1 0;
                                rel1 {
@@ -396,15 +396,17 @@ collections
                         repeat_events: 1;
                         description { state: "default" 0.0;
                                align: 0.5 1.0;
-                               min: 0 90;
+                               min: 0 54;
                                fixed: 0 1;
                                rel1 {
-                                  relative: 1.0 1.0;
+                                  relative: 1.0 0.0;
                                   to_x: "pad_l";
+                                  to_y: "pad_bm";
                                }
                                rel2 {
-                                  relative: 0.0 1.0;
+                                  relative: 0.0 0.0;
                                   to_x: "pad_r";
+                                  to_y: "pad_bm";
                                }
                         }
                  }
@@ -414,7 +416,8 @@ collections
                         mouse_events: 1;
                         repeat_events: 1;
                         description { state: "default" 0.0;
-                               align: 0.0 0.0;
+                               align: 0.5 0.5;
+                               min: 604 54;
                                fixed: 1 1;
                                rel1 {
                                   relative: 0.0 0.0;
@@ -431,16 +434,16 @@ collections
                         mouse_events: 0;
                         repeat_events: 1;
                         description { state: "default" 0.0;
-                               align: 0.0 1.0;
-                               min: 0 52;
-                               fixed: 0 1;
+                               align: 0.5 1.0;
+                               min: 604 54;
+                               fixed: 1 1;
                                rel1 {
                                   relative: 0.0 1.0;
-                                  to: "pad_b";
+                                  to: "pad_l";
                                }
                                rel2 {
                                   relative: 1.0 1.0;
-                                  to: "pad_b";
+                                  to: "pad_r";
                                }
                         }
                  }
@@ -450,11 +453,12 @@ collections
                         description { state: "default" 0.0;
                                text {
                                   font: "Tizen:style=Medium";
-                                  size: 16;
+                                  size: 36;
                                   min: 0 0;
-                                  align: 0.0 1.0;
+                                  align: 0.0 0.5;
+                                  text_class: "tizen";
                                  }
-                               color: 108 108 108 255;
+                               color: 128 128 128 255;
                                align: 0.0 0.5;
                                rel1 {
                                   relative: 0.0 0.0;
@@ -472,11 +476,12 @@ collections
                         description { state: "default" 0.0;
                                text {
                                   font: "Tizen:style=Medium";
-                                  size: 16;
+                                  size: 36;
                                   min: 0 0;
-                                  align: 1.0 1.0;
+                                  align: 1.0 0.5;
+                              text_class: "tizen";
                                  }
-                               color: 108 108 108 255;
+                               color: 128 128 128 255;
                                align: 1.0 0.5;
                                rel1 {
                                   relative: 0.0 0.0;
diff --git a/mobileprint/include/loading_animation.h b/mobileprint/include/loading_animation.h
deleted file mode 100644 (file)
index 1055ceb..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-*  Mobileprint
-*
-* Copyright 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 _LOADING_ANIMATION_H_INCLUDED_
-#define _LOADING_ANIMATION_H_INCLUDED_
-
-#include "pts_common.h"
-
-
-Evas_Object *loading_animation_add(Evas_Object *parent);
-void show_loading_animation(pts_core_data_t *ugd);
-void hide_loading_animation(pts_core_data_t *ugd);
-
-#endif /* _LOADING_ANIMATION_H_INCLUDED_ */
-
index 3d3bcc8..50ad28a 100755 (executable)
 typedef struct appdata {
        Evas_Object *win;
        //Evas_Object *ly_main;
+       Ecore_Event_Handler *screen_reader_message_handler;
 
        /* add more variables here */
        pts_core_data_t *ugd;
+       int prev_app_win_rotate;
 } pts_appdata_t;
 
 #endif /* __APP_COMMON_H__ */
index 5bf0252..7ce7b04 100755 (executable)
@@ -20,7 +20,9 @@
 #ifndef PTS_COMMON_H_
 #define PTS_COMMON_H_
 
+#include <appcore-common.h>
 #include <Ecore.h>
+#include <Ecore_X.h>
 #include <stdio.h>
 #include <string.h>
 #include <Elementary.h>
@@ -28,7 +30,7 @@
 #include <pt_api.h>
 #include "pts_debug.h"
 
-#include "preview_engine.h" /* TODO: move to preview widget */
+#include <smsc_smart.h>
 
 #define PTS_2  "Can not register the printer"
 #define PTS_17 "Error option"
 #define IDS_PRT_33     "Paper level error"
 #define IDS_PRT_34     "No print head"
 #define IDS_PRT_35     "Printer related error occurred"
+#define IDS_PRT_41     "Failed to launch mobileprint"
 
 #define IDS_BR_OPT_5X7 "5\"x7\"(13x18cm)"
 #define IDS_BR_OPT_4X6 "4\"x6\"(10x15cm)"
 #define IDS_BR_OPT_3_5X5       "3.5\"x5\"(9x13cm)"
 #define IDS_BR_OPT_WALLET      "Wallet(6.4x8.4cm)"
 
+
+#define IDS_PRT_GET_ATTRS_FOR_PRINTERS "Getting printer attributes..."
+#define IDS_ASEML_POP_GET_ATTRS_FAILED "Failed to get printer attributes"
+
+#define IDS_SCRREAD_CANCEL_SEARCHING_PRINTERS "Double tap to cancel searching for printers"
+#define IDS_SCRREAD_CONFIRM_SELECTED_PRINTER "Press to confirm selected printer"
+#define IDS_SCRREAD_CANCEL_CONNECT_WIFI "Cancel connect to Wi-Fi network"
+#define IDS_SCRREAD_SMPOS_SK3_CANCEL "Press to cancel printing"
+#define IDS_SCRREAD_MORE_OPTIONS "More options"
+#define IDS_SCRREAD_CANCEL_PRINTING "Double tap to cancel printing"
+#define IDS_SCRREAD_MENU_INFO "More options"
+#define IDS_SCRREAD_MENU_CONTEXT "Double click to access options menu"
+#define IDS_SCRREAD_PRINTERS_LIST_IS_BELOW "Printers list is below"
+#define IDS_SCRREAD_PRINT_CONTEXT "Double tap to send document to the printer"
+#define IDS_SCRREAD_PREVIEW_IMAGE_TYPE "Preview of the document to be printed"
+#define IDS_SCRREAD_PREVIEW_IMAGE_CONTEXT "Print button is below"
+#define IDS_SCRREAD_EXPANDABLE_LIST_TYPE "Expandable list"
+#define IDS_SCRREAD_EXPANDABLE_LIST_CONTEXT "Double tap to open list"
+#define IDS_SCRREAD_SETTINS_ITEM_CONTEXT "Double tap to edit"
+#define IDS_SCRREAD_PRINTER_ITEM_CONTEXT "Double tap to change selected printer"
+
 #define SERVICE_LAUNCH_TYPE "LAUNCH_TYPE"
 #define SERVICE_JOB_ID "JOB_ID"
 #define SERVICE_FILES "FILES"
 #define SERVICE_PRINT_FILES_FOLDER_NAME "service_print_files_folder_name"
 #define SERVICE_PRINT_FILES_FILES_NAME "service_print_files_files_name"
 
-#define ICON_PRINTER "/opt/usr/apps/org.tizen.mobileprint/res/images/pt_default_printer.png"
+#define ICON_PRINTER "/usr/apps/org.tizen.mobileprint/res/images/pt_default_printer.png"
 
 #define UG_MAX_FILED_LEN       64
 #define COPIES_MAX     99
 
+#undef MIN
+#define MIN(a,b)  ((((a)-(b))&0x80000000) >> 31)? (a) : (b)
+#define PRINTER_LIST_POPUP_W           656
+#define PRINTER_LIST_POPUP_H           880
+#define PRINTER_LIST_POPUP_LN_W                720
+#define PRINTER_LIST_POPUP_LN_H                480
+
 #ifndef API
 #define API __attribute__ ((visibility("default")))
 #endif
@@ -158,13 +189,14 @@ typedef struct {
        pts_printing_data_t     pt_files;
        char                    *input_file;
        int                             n_up;
+       int                             copies;
 } pts_job_spooling_t;
 
 typedef void (*pts_printer_selection_done_cb)(void *userdata);
 
 typedef struct {
        Evas_Object             *root_win;
-       Evas_Object             *main_win;
+       Evas_Object             *main_layout;
        Evas_Object             *navi;
        Evas_Object             *printer_layout;
        Evas_Object             *printer_label;
@@ -178,6 +210,9 @@ typedef struct {
        Evas_Object             *popup;
        Evas_Object             *wifi_type_popup;
        Evas_Object             *printer_list_popup;
+       Evas_Object             *printer_list_popup_box;
+       Evas_Coord              printer_list_popup_portrait_height;
+       Evas_Coord              printer_list_popup_landscape_height;
        Evas_Object             *no_found_popup;
        Evas_Object             *scaling_popup;
        Evas_Object             *size_popup;
@@ -248,16 +283,13 @@ typedef struct {
        int                                     dummy_noti_id;
        Eina_List                       *job_spooling_list;
 
-       Evas_Object *preview_img;
-       Evas_Object *loading_animation;
+       Evas_Object *smsc;
 
        int                     landscape_toggle;
 
        /* whether in process(searching, printing) */
        int                     is_process;
 
-       struct preview_engine engine; /* TODO: move to widget data */
-
        pts_image_size_e        image_size;
 
        double          custom_width;
@@ -307,6 +339,14 @@ Evas_Object *pts_create_label_btn(Evas_Object *parent, const char *label);
 Evas_Object *pts_create_base_layout(Evas_Object *parent, const char *group);
 
 /**
+ *     This function let the app create the base layout
+ *     @return  void
+ *     @param[in] parent the pointer to the parent of the base layout
+ *     @param[in] desc the pointer to group of the base layout
+ */
+Evas_Object *pts_create_base_layout_with_conform(Evas_Object *parent, const char *group);
+
+/**
  *     This function let the app create the popup element
  *     @return  void
  *     @param[in] parent the pointer to the parent of the popup element
@@ -322,7 +362,7 @@ void pts_set_ugd(pts_core_data_t *ugd);
 pts_core_data_t *pts_get_ugd(void);
 
 
-
+int _pts_get_rotate_angle(enum appcore_rm rotate_mode);
 void pts_search_printer(pts_core_data_t *ugd, Evas_Object *parent, pts_printer_search_state_e search_mode, pts_printer_selection_done_cb cb, void *userdata);
 void pts_create_print_search_popup(Evas_Object *parent, pts_core_data_t *ugd);
 Evas_Object *pts_utils_create_layout(Evas_Object *navi_frame);
@@ -339,7 +379,7 @@ Eina_Bool _pts_printing_data_set_files_count(const char *num_of_files, pts_print
 Eina_Bool _pts_printing_data_set_index(const char *current_index, pts_printing_data_t *data);
 Eina_Bool _pts_printing_data_set_type(const char *type, pts_printing_data_t *data);
 
-charpts_parse_protocol(char *addr);
+char *pts_parse_protocol(char *addr);
 int pts_unstandardization(char *name);
 
 #endif /* PTS_COMMON_H_ */
index 26963e6..d82ce0a 100755 (executable)
@@ -63,7 +63,7 @@ Evas_Object *pts_create_main_view(pts_core_data_t *ugd);
 void pts_main_view_search_printer(pts_core_data_t *ugd);
 
 
-int pts_main_view_load_print_files(pts_core_data_t *ugd, pts_printing_data_t *pt_files);
+int pts_main_view_load_printing_data(pts_core_data_t *ugd, pts_printing_data_t *pt_files);
 
 
 void __pts_event_cb(pt_event_e event, void *user_data, pt_progress_info_t *progress_info);
similarity index 67%
rename from mobileprint/include/preview_widget.h
rename to mobileprint/include/pts_util.h
index ead573c..0d92d7b 100644 (file)
 *
 */
 
-#ifndef _PREVIEW_WIDGET_H_INCLUDED_
-#define _PREVIEW_WIDGET_H_INCLUDED_
+#ifndef PTS_UTIL_H_
+#define PTS_UTIL_H_
 
-#include "preview_engine.h"
+void pts_util_show_error_popup(Evas_Object *parent, const char *msg);
 
+Eina_Bool pts_util_supported_arch(void);
 
-struct preview_widget {
-       int pages_count;
-       int cur_page;
-       struct preview_engine engine;
-};
-
-Eina_Bool page_ready_cb(void *data, int type, void *event);
-
-#endif /* _PREVIEW_WIDGET_H_INCLUDED_ */
+void pts_util_remove_tmp_files(const char *path);
 
+#endif
index cc60489..44720e1 100644 (file)
@@ -5,7 +5,7 @@
        <author email="taeksu.shin@samsung.com" href="www.samsung.com">Taeksu Shin</author>
        <author email="dwmax.lee@samsung.com" href="www.samsung.com">Dongwook Lee</author>
        <description>Mobile Print Application</description>
-       <ui-application appid="org.tizen.mobileprint" exec="/opt/usr/apps/org.tizen.mobileprint/bin/mobileprint" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+       <ui-application appid="org.tizen.mobileprint" exec="/usr/apps/org.tizen.mobileprint/bin/mobileprint" nodisplay="true" multiple="false" type="capp" taskmanage="false">
                <icon>org.tizen.mobileprint.png</icon>
                <label>Mobileprint</label>
                <label xml:lang="en-us">Mobileprint</label>
diff --git a/mobileprint/preview_engine/CMakeLists.txt b/mobileprint/preview_engine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0f1ceec
--- /dev/null
@@ -0,0 +1,8 @@
+INCLUDE(FindPkgConfig)
+pkg_check_modules(preview_engine_pkgs REQUIRED dlog evas elementary edje
+               ecore ecore-input ecore-x)
+FOREACH(flag ${preview_engine_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS_SMSC "${EXTRA_CFLAGS_SMSC} ${flag}")
+ENDFOREACH(flag)
+
+ADD_SUBDIRECTORY(lib)
similarity index 98%
rename from mobileprint/include/preview_engine.h
rename to mobileprint/preview_engine/include/preview_engine.h
index 71b036a..7ce5745 100644 (file)
@@ -79,7 +79,7 @@ struct preview_engine {
 
 int init_preview_engine(struct preview_engine *engine);
 int process_preview_engine_file(struct preview_engine *engine,
-                                                               char *fname, const char *ppd,
+                                                               const char *fname, const char *ppd,
                                                                const struct paper_size_pts *paper_size,
                                                                const struct size_px *max_available_size_px,
                                                                enum page_orientation orientation, int n_up,
similarity index 93%
rename from mobileprint/include/preview_model.h
rename to mobileprint/preview_engine/include/preview_model.h
index 810bfb5..058a20f 100644 (file)
@@ -24,6 +24,7 @@ struct preview_model;
 
 #include <paper_size.h>
 #include <pdfgen.h>
+#include <preview_coords.h>
 
 #include "preview_task_model.h"
 
@@ -53,10 +54,11 @@ struct preview_conf {
        //int is_original_size;
        struct page_scale scale;
        int n_up;
+       struct preview_page_req settings_req;
        enum page_orientation orientation;
        struct paper_size_pts paper_size;
-       struct size_px max_available_size_px;
-       int is_grayscale;
+       /*struct size_px max_available_size_px;
+       int is_grayscale;*/
 };
 
 struct preview_model {
@@ -29,7 +29,8 @@ struct preview_conf;
 
 struct preview_task_model {
        Eina_List *task_list;
-       Ecore_Thread *thread;
+       Ecore_Exe *previewgen_handle;
+       Ecore_Event_Handler *event_handler;
 
        int is_stop_processing;
 
diff --git a/mobileprint/preview_engine/lib/CMakeLists.txt b/mobileprint/preview_engine/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f1167aa
--- /dev/null
@@ -0,0 +1,5 @@
+FILE(GLOB SRCS *.c)
+
+ADD_LIBRARY(preview_engine ${SRCS})
+SET_TARGET_PROPERTIES(preview_engine PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS_SMSC} -fpie")
+
similarity index 89%
rename from mobileprint/app/preview_engine.c
rename to mobileprint/preview_engine/lib/preview_engine.c
index bac2645..d9afbd1 100644 (file)
@@ -20,7 +20,6 @@
 #include <Ecore.h>
 
 #include <page_preview.h>
-#include <page_preview_thread.h>
 #include <previewgen.h>
 
 #include "pts_debug.h"
@@ -87,7 +86,7 @@ int preview_engine_init_done(struct preview_engine *engine,
 }
 
 int process_preview_engine_file(struct preview_engine *engine,
-                                                               char *fname,
+                                                               const char *fname,
                                                                const char *ppd,
                                                                const struct paper_size_pts *paper_size,
                                                                const struct size_px *max_available_size_px,
@@ -104,6 +103,7 @@ int process_preview_engine_file(struct preview_engine *engine,
                                , -1 , "Invalid argument");
 
        struct initial_preview_data *data;
+       struct size_px shadow_size_px = {10, 10};
 
        data = malloc(sizeof(struct initial_preview_data));
        PTS_RETV_IF(data == NULL, -1, "Insufficient memory");
@@ -113,11 +113,19 @@ int process_preview_engine_file(struct preview_engine *engine,
        data->conf.fname = strdup(TEMP_PDFTOPDF_FNAME);
        data->conf.paper_size = *paper_size;
        data->conf.paper_size.name = strdup(paper_size->name);
-       data->conf.max_available_size_px = *max_available_size_px;
+       //data->conf.max_available_size_px = *max_available_size_px;
        data->conf.orientation = orientation;
        data->conf.n_up = n_up;
        data->conf.scale = *scale;
-       data->conf.is_grayscale = is_grayscale;
+       //data->conf.is_grayscale = is_grayscale;
+
+       data->conf.settings_req.paper_size = paper_size->s;
+       data->conf.settings_req.available_size_px = *max_available_size_px;
+       data->conf.settings_req.shadow_offset = shadow_size_px;
+       data->conf.settings_req.is_rotate90 =
+                       (PAGE_ORIENTATION_LANDSCAPE == orientation);
+       data->conf.settings_req.is_grayscale = is_grayscale;
+
        data->engine = engine;
 
        //careful memory release:
similarity index 79%
rename from mobileprint/app/preview_model.c
rename to mobileprint/preview_engine/lib/preview_model.c
index 114645a..576b09c 100644 (file)
@@ -19,7 +19,9 @@
 
 #include <Ecore.h>
 
-#include "pts_debug.h"
+#include <previewgen.h>
+#include <pts_debug.h>
+
 #include "preview_model.h"
 
 int init_preview_model(struct preview_model *model,
@@ -27,7 +29,7 @@ int init_preview_model(struct preview_model *model,
                                           struct preview_engine *engine)
 {
        PTS_TRACE_BEGIN;
-       PTS_RETV_IF(model == NULL || conf == NULL || engine == NULL, -1 , "Invalid argument");
+       PTS_RETV_IF(model == NULL || conf == NULL || engine == NULL, -1, "Invalid argument");
 
        model->conf = *conf;
        model->pages_state = malloc(sizeof(enum preview_page_state)
@@ -82,6 +84,12 @@ int preview_model_request_page(struct preview_model *model, int page)
        PTS_RETV_IF(model->pages_state == NULL, -1, "model is not initialized");
        PTS_RETV_IF(model->conf.pages_count - 1 < page - 1, -1 , "page is incorrect");
 
+       /* send message for empty page */
+       if (model->pages_state[page] != PREVIEW_PAGE_STATE_READY) {
+               preview_engine_send_page_message(model->engine,
+                                                                                PREVIEW_ENGINE_EVENT_PAGE_PROCESSING, page);
+       }
+
        if (PREVIEW_PAGE_STATE_NA == model->pages_state[page]) {
                add_preview_task(&(model->engine->task_model), page, model);
                model->pages_state[page] = PREVIEW_PAGE_STATE_PROCESSING;
@@ -90,12 +98,6 @@ int preview_model_request_page(struct preview_model *model, int page)
                                                                                 PREVIEW_ENGINE_EVENT_PAGE_READY, page);
        }
 
-       /* send message for empty page */
-       if (model->pages_state[page] != PREVIEW_PAGE_STATE_READY) {
-               preview_engine_send_page_message(model->engine,
-                                                                                PREVIEW_ENGINE_EVENT_PAGE_PROCESSING, page);
-       }
-
        PTS_TRACE_END;
        return 0;
 }
@@ -115,3 +117,45 @@ int preview_model_page_available(struct preview_model *model,
        PTS_TRACE_END;
        return 0;
 }
+
+
+int preview_model_debug_print_pages_state(struct preview_model *model)
+{
+       int i;
+       int pages_count;
+       char *outstr;
+       char s;
+
+       PTS_TRACE_BEGIN;
+       PTS_RETV_IF(NULL == model, -1, "Argument error");
+       pages_count = model->conf.pages_count;
+       if (pages_count <= 0 || pages_count > PDF_PAGE_MAX_VAL)
+               return -1;
+
+       outstr = malloc(sizeof(char) * (pages_count + 1));
+       for (i = 1; i <= pages_count; ++i) {
+               s = '?';
+               switch(model->pages_state[i]) {
+               case PREVIEW_PAGE_STATE_NA:
+                       s = 'N';
+                       break;
+               case PREVIEW_PAGE_STATE_PROCESSING:
+                       s = 'P';
+                       break;
+               case PREVIEW_PAGE_STATE_READY:
+                       s = 'R';
+                       break;
+               case PREVIEW_PAGE_STATE_ERROR:
+                       s = 'E';
+                       break;
+               }
+               outstr[i - 1] = s;
+       }
+       outstr[pages_count - 1] = '\0';
+       PTS_DEBUG("pages: %d, state: %s", pages_count, outstr);
+       free(outstr);
+
+       PTS_TRACE_END;
+       return 0;
+}
+
diff --git a/mobileprint/preview_engine/lib/preview_task_model.c b/mobileprint/preview_engine/lib/preview_task_model.c
new file mode 100644 (file)
index 0000000..5c7cc36
--- /dev/null
@@ -0,0 +1,432 @@
+/*
+*  Mobileprint
+*
+* Copyright 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 <Ecore.h>
+
+#include <page_preview.h>
+#include <pdfgen.h>
+#include <preview_coords.h>
+#include <previewgen.h>
+
+#include "pts_debug.h"
+
+#include "preview_task_model.h"
+
+
+#define PREVIEWGEN_EXECUTABLE  BINDIR "/previewgen-tool"
+#define SHADOW_SIZE_PX_X 10
+#define SHADOW_SIZE_PX_Y 10
+
+#define SINGLE_PAGE_PREVIEWGEN
+
+
+/* TODO: task model destruction */
+enum preview_task_type {
+       PREVIEW_TASK_GENERIC,
+       PREVIEW_TASK_INITIAL
+};
+
+
+struct preview_task_data {
+       int page;
+       enum preview_task_type task_type;
+       struct preview_conf conf;
+       char out_pic_fname[sizeof("/tmp/mobileprint/mobileprint_xxxx.ppm ")];
+       enum file_type ftype;
+       int is_task_ok;
+
+       struct preview_model *pmodel;
+       struct preview_task_model *task_model;
+       char previewgen_exe_cmd[1024];
+};
+
+
+int init_preview_task_model(struct preview_task_model *model,
+                                                       struct preview_engine *engine)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RETV_IF(model == NULL || engine == NULL, -1 , "Invalid argument");
+
+       /*model->task_count = MAX_PREVIEW_TASK_COUNT;
+       model->tasks = malloc(sizeof(struct preview_task) * model->task_count);
+       if (NULL == model->tasks) {
+               model->task_count = 0;
+               return -1;
+       }*/
+       model->task_list = NULL;
+       model->previewgen_handle = NULL;
+       model->event_handler = NULL;
+       model->is_stop_processing = 0;
+       model->engine = engine;
+
+       //model->pdata = pdata;
+       PTS_TRACE_END;
+       return 0;
+}
+
+
+int clear_preview_task_queue(struct preview_task_model *task_model)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RETV_IF(task_model == NULL , -1 , "Invalid argument");
+
+       struct preview_task_data *ptd;
+       Eina_List *cur;
+
+       if (task_model->task_list != NULL) {
+               /* clean task list */
+               EINA_LIST_FOREACH(task_model->task_list, cur, ptd) {
+                       PTS_IF_FREE_MEM(ptd);
+               }
+               eina_list_free(task_model->task_list);
+       }
+       task_model->task_list = NULL;
+       PTS_TRACE_END;
+       return 0;
+}
+
+
+int parse_previewgen_output(Ecore_Exe_Event_Data *data_from_process,
+               enum file_type ftype, int *pages_count)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RETV_IF(NULL == pages_count || NULL == data_from_process
+                       || data_from_process->size <= 0,
+                       -1, "Invalid argument");
+       PTS_DEBUG("data_from_process->size : %d\n", data_from_process->size);
+       char *msg = calloc(1, data_from_process->size + 1);
+       PTS_RETV_IF(NULL == msg, -1, "Memory allocation error");
+
+       strncpy(msg, data_from_process->data, data_from_process->size);
+       msg[data_from_process->size] = '\0';
+       *pages_count = 0;
+
+       switch (ftype) {
+       case FILE_TYPE_IMAGE:
+               sscanf(msg, "init img: pages count: %d", pages_count);
+               break;
+       case FILE_TYPE_PDF:
+               sscanf(msg, "init pdf: pages count: %d", pages_count);
+               break;
+       case FILE_TYPE_INCORRECT:
+               *pages_count = 0;
+               break;
+       }
+       PTS_IF_FREE_MEM(msg);
+       PTS_TRACE_END;
+       PTS_RETV_IF (*pages_count <= 0, -1, "Error");
+       return 0;
+}
+
+
+static Eina_Bool preview_handler_end_cb(void *d, int type, void *event)
+{
+       PTS_TRACE_BEGIN;
+
+       PTS_RETV_IF(d == NULL, ECORE_CALLBACK_DONE, "Invalid argument");
+
+       struct preview_task_data *ptd = (struct preview_task_data *)d;
+       struct preview_task_data *next_ptd;
+       struct preview_task_model *task_model = ptd->task_model;
+       int is_init_engine = 1;
+       int res;
+
+       /* TODO: check for next initialization in queue */
+
+       switch (ptd->task_type) {
+       case PREVIEW_TASK_GENERIC:
+               /* TODO: check does task OK (parse output) */
+               //if (ptd->is_task_ok) {
+                       preview_model_page_available(ptd->pmodel,
+                                       PREVIEW_ENGINE_EVENT_PAGE_READY,
+                                       ptd->page);
+               /*} else {
+                       preview_model_page_available(ptd->pmodel,
+                                       PREVIEW_ENGINE_EVENT_PAGE_ERROR,
+                                       ptd->page);
+               }*/
+               break;
+       case PREVIEW_TASK_INITIAL:
+               if (task_model->task_list != NULL) {
+                       next_ptd = (struct preview_task_data *)
+                               eina_list_data_get(task_model->task_list);
+                       if (PREVIEW_TASK_INITIAL == next_ptd->task_type) {
+                               is_init_engine = 0;
+                       }
+               }
+               if (is_init_engine) {
+                       res = parse_previewgen_output(
+                                       (Ecore_Exe_Event_Data *)event,
+                                       ptd->ftype,
+                                       &(ptd->conf.pages_count));
+                       if (res >= 0)
+                               preview_engine_init_done(task_model->engine,
+                                                       &(ptd->conf));
+                       /* TODO: ERROR condition in case of res < 0 */
+               }
+               PTS_DEBUG("releasing memory");
+               PTS_IF_FREE_MEM(ptd->conf.initial_fname);
+               PTS_IF_FREE_MEM(ptd->conf.ppd);
+               PTS_IF_FREE_MEM(ptd->conf.fname);
+               PTS_IF_FREE_MEM(ptd->conf.paper_size.name);
+               PTS_DEBUG("memory released");
+               break;
+       }
+
+       task_model->previewgen_handle = NULL;
+       ecore_event_handler_del(task_model->event_handler);
+       task_model->event_handler = NULL;
+       PTS_DEBUG("Freeing memory");
+       PTS_IF_FREE_MEM(ptd);
+
+       /* manage tasks queue */
+       if (task_model->task_list != NULL) {
+               ptd = (struct preview_task_data *)
+                         eina_list_data_get(task_model->task_list);
+               task_model->task_list = eina_list_remove_list(
+                               task_model->task_list, task_model->task_list);
+               task_model->previewgen_handle =
+                       ecore_exe_pipe_run(ptd->previewgen_exe_cmd,
+                                       ECORE_EXE_PIPE_READ_LINE_BUFFERED
+                                       | ECORE_EXE_PIPE_READ, /*ptd*/ NULL);
+               if (NULL == task_model->previewgen_handle) {
+                       PTS_IF_FREE_MEM(ptd);
+                       PTS_DEBUG("ecore_exe_pipe_run error (%s)",
+                                       ptd->previewgen_exe_cmd);
+                       PTS_TRACE_END;
+                       return ECORE_CALLBACK_DONE;
+               }
+               task_model->event_handler = ecore_event_handler_add(
+                               ECORE_EXE_EVENT_DATA,
+                               preview_handler_end_cb,
+                               /*task_model->previewgen_handle*/ ptd);
+       }
+
+       PTS_TRACE_END;
+       return ECORE_CALLBACK_DONE;
+}
+
+
+int add_preview_task_initial(struct preview_task_model *model,
+                                const struct preview_conf *conf)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RETV_IF(model == NULL || conf == NULL, -1, "Invalid argument");
+
+       struct preview_task_data *ptd;
+
+       /* fill the preview_task_data structure */
+       ptd = malloc(sizeof(struct preview_task_data));
+       PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+
+       memset(ptd, 0, sizeof(struct preview_task_data));
+       ptd->task_type = PREVIEW_TASK_INITIAL;
+       ptd->conf = *conf;
+       ptd->task_model = model;
+       /* fill cmd with arguments from ptd depending on file type*/
+       ptd->ftype = get_file_type(ptd->conf.initial_fname);
+       enum page_scale_type scale_type = ptd->conf.scale.type;
+       switch (ptd->ftype) {
+       case FILE_TYPE_IMAGE:
+               PTS_DEBUG("processing image");
+               snprintf(ptd->previewgen_exe_cmd, 1024, PREVIEWGEN_EXECUTABLE " init img "
+                        "%s %s %s %s %lf %lf %d %d %s %d %s %d %lf %lf %d",
+                        ptd->conf.initial_fname, ptd->conf.fname,
+                        ptd->conf.ppd, ptd->conf.paper_size.name,
+                        ptd->conf.paper_size.s.x, ptd->conf.paper_size.s.y,
+                        ptd->conf.settings_req.available_size_px.x,
+                        ptd->conf.settings_req.available_size_px.y,
+                        (PAGE_ORIENTATION_LANDSCAPE == ptd->conf.orientation) ? "landscape" :
+                        (PAGE_ORIENTATION_PORTRAIT == ptd->conf.orientation) ? "portrait" : "",
+                        ptd->conf.n_up,
+                        (SCALE_FIT_TO_PAPER == scale_type) ? "fit_to_paper" :
+                        (SCALE_CUSTOM == scale_type) ? "custom" :
+                        (SCALE_RELATIVE == scale_type) ? "relative" :
+                        (SCALE_ORIGINAL == scale_type) ? "original" : "",
+                        ptd->conf.scale.zoom, ptd->conf.scale.w, ptd->conf.scale.h,
+                        ptd->conf.settings_req.is_grayscale);
+               PTS_DEBUG("cmd: %s", ptd->previewgen_exe_cmd);
+               break;
+       case FILE_TYPE_PDF:
+               PTS_DEBUG("processing PDF");
+               snprintf(ptd->previewgen_exe_cmd, 1024, PREVIEWGEN_EXECUTABLE " init pdf "
+                        "%s %s %s %s %lf %lf %s %d %s %d %lf %lf %d",
+                        ptd->conf.initial_fname, ptd->conf.fname,
+                        ptd->conf.ppd, ptd->conf.paper_size.name,
+                        ptd->conf.paper_size.s.x, ptd->conf.paper_size.s.y,
+                        (PAGE_ORIENTATION_LANDSCAPE == ptd->conf.orientation) ? "landscape" :
+                        (PAGE_ORIENTATION_PORTRAIT == ptd->conf.orientation) ? "portrait" : "",
+                        ptd->conf.n_up,
+                        (SCALE_FIT_TO_PAPER == scale_type) ? "fit_to_paper" :
+                        (SCALE_CUSTOM == scale_type) ? "custom" :
+                        (SCALE_RELATIVE == scale_type) ? "relative" :
+                        (SCALE_ORIGINAL == scale_type) ? "original" : "",
+                        ptd->conf.scale.zoom, ptd->conf.scale.w, ptd->conf.scale.h,
+                        ptd->conf.settings_req.is_grayscale);
+               PTS_DEBUG("cmd: %s", ptd->previewgen_exe_cmd);
+               break;
+       case FILE_TYPE_INCORRECT:
+               PTS_DEBUG("Incorrect file type");
+               PTS_IF_FREE_MEM(ptd);
+               PTS_TRACE_END;
+               return -1;
+       }
+
+       /* TODO: clear task queue, disable generic tasks */
+       clear_preview_task_queue(model);
+
+       /* manage task queue */
+       if (NULL != model->previewgen_handle) {
+               /* plan task for calculation in future */
+               /* TODO: check, does we have current tasks in task model */
+               model->task_list = eina_list_append(model->task_list, ptd);
+               /* TODO: leave only 4 last page requests in queue */
+       } else {
+               /* this task is a top task - just process */
+               model->previewgen_handle = ecore_exe_pipe_run(
+                               ptd->previewgen_exe_cmd,
+                               ECORE_EXE_PIPE_READ, NULL/*ptd*/);
+               if (NULL == model->previewgen_handle) {
+                       PTS_IF_FREE_MEM(ptd);
+                       PTS_DEBUG("ecore_exe_pipe_run error (%s)",
+                                       ptd->previewgen_exe_cmd);
+                       PTS_TRACE_END;
+                       return 0;
+               }
+               model->event_handler = ecore_event_handler_add(
+                               ECORE_EXE_EVENT_DATA,
+                               preview_handler_end_cb, ptd);
+       }
+
+       PTS_TRACE_END;
+       return 0;
+}
+
+
+int add_preview_task(struct preview_task_model *model, int page,
+                                        struct preview_model *pmodel)
+{
+       PTS_TRACE_BEGIN;
+       PTS_RETV_IF(model == NULL || pmodel == NULL , -1, "Invalid argument");
+       PTS_RETV_IF(model->is_stop_processing, -1, "is_stop_processing is %d", model->is_stop_processing);
+
+       /* fill the preview_task_data structure */
+       struct preview_task_data *ptd;
+       struct preview_task_data *next_ptd;
+       ptd = malloc(sizeof(struct preview_task_data));
+       PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+
+       ptd->page = page;
+       ptd->task_type = PREVIEW_TASK_GENERIC;
+       sprintf(ptd->out_pic_fname,
+                       "/tmp/mobileprint/mobileprint_%04d.ppm", page);
+       ptd->is_task_ok = 0;
+       ptd->conf = pmodel->conf;
+       ptd->pmodel = pmodel;
+       ptd->task_model = model;
+
+       int to_be_previewed_as_landscape = (PAGE_ORIENTATION_LANDSCAPE == ptd->conf.orientation);
+       /* for number_up 2 page should be rotated to be viewed correctly */
+       if (2 == ptd->conf.n_up) {
+               switch_size_pts_coords(&(ptd->conf.paper_size.s));
+               switch_size_px_coords(&(ptd->conf.settings_req.available_size_px));
+       }
+
+       /* fill cmd with arguments from ptd */
+#ifndef SINGLE_PAGE_PREVIEWGEN
+       snprintf(ptd->previewgen_exe_cmd, 1024, PREVIEWGEN_EXECUTABLE " gen "
+                        "%s %d %d %s %lf %lf %d %d %d %d %d %d",
+                        ptd->conf.fname, page, ptd->conf.pages_count, ptd->out_pic_fname,
+                        ptd->conf.paper_size.s.x, ptd->conf.paper_size.s.y,
+                        ptd->conf.settings_req.available_size_px.x,
+                        ptd->conf.settings_req.available_size_px.y,
+                        ptd->conf.settings_req.shadow_offset.x,
+                        ptd->conf.settings_req.shadow_offset.y,
+                        to_be_previewed_as_landscape,
+                        ptd->conf.settings_req.is_grayscale);
+#else /* SINGLE_PAGE_PREVIEWGEN */
+       snprintf(ptd->previewgen_exe_cmd, 1024, PREVIEWGEN_EXECUTABLE
+                       " pagegen "
+                       "%s %d %s %lf %lf %d %d %d %d %d %d",
+                       ptd->conf.fname, page, ptd->out_pic_fname,
+                       ptd->conf.paper_size.s.x, ptd->conf.paper_size.s.y,
+                       ptd->conf.settings_req.available_size_px.x,
+                       ptd->conf.settings_req.available_size_px.y,
+                       ptd->conf.settings_req.shadow_offset.x,
+                       ptd->conf.settings_req.shadow_offset.y,
+                       to_be_previewed_as_landscape,
+                       ptd->conf.settings_req.is_grayscale);
+#endif
+       PTS_DEBUG("cmd: %s", ptd->previewgen_exe_cmd);
+
+       /* manage task queue */
+       if (NULL != model->previewgen_handle) {
+               if (NULL != model->task_list) {
+                       next_ptd = (struct preview_task_data *)
+                                          eina_list_data_get(model->task_list);
+                       if (next_ptd == NULL) {
+                               PTS_IF_FREE_MEM(ptd);
+                               PTS_TRACE_END;
+                               return 0;
+                       }
+                       if (PREVIEW_TASK_INITIAL == next_ptd->task_type) {
+                               /* do not add this task: initialization is planned */
+                               PTS_IF_FREE_MEM(ptd);
+                       } else {
+                               /* plan task for calculation in future */
+                               model->task_list = eina_list_append(
+                                               model->task_list, ptd);
+                       }
+               } else { /* NULL == model->task_list */
+                       model->task_list = eina_list_append(
+                               model->task_list, ptd);
+               }
+               /* TODO: leave only 4 last page requests in queue */
+       } else {
+               /* this task is a top task - just process */
+               model->previewgen_handle = ecore_exe_pipe_run(
+                               ptd->previewgen_exe_cmd,
+                               ECORE_EXE_PIPE_READ_LINE_BUFFERED
+                               | ECORE_EXE_PIPE_READ, NULL);
+               if (NULL == model->previewgen_handle) {
+                       PTS_IF_FREE_MEM(ptd);
+                       PTS_DEBUG("ecore_exe_pipe_run error (%s)",
+                                       ptd->previewgen_exe_cmd);
+                       PTS_TRACE_END;
+                       return 0;
+               } 
+               model->event_handler = ecore_event_handler_add(
+                               ECORE_EXE_EVENT_DATA,
+                               preview_handler_end_cb, ptd);
+       }
+
+       PTS_TRACE_END;
+       return 0;
+}
+
+
+int debug_print_preview_task_list(struct preview_task_model *model)
+{
+       /*struct preview_task_data *ptd;
+       Eina_List *cur;
+       char *outstr;*/
+       PTS_DEBUG("task_list size: %d", eina_list_count(model->task_list));
+       return 0;
+}
+
index b23f7dc..a7b53b4 100644 (file)
@@ -8,3 +8,4 @@ FOREACH(flag ${previewgen_pkgs_CFLAGS})
 ENDFOREACH(flag)
 
 ADD_SUBDIRECTORY(lib)
+ADD_SUBDIRECTORY(util)
index 1e11e81..243fcce 100644 (file)
@@ -28,7 +28,7 @@
 #include "pdfgen.h"
 
 
-#define IMAGE_CONVERT_TEMP_FILE        "/tmp/convert_tmp.ppm"
+#define IMAGE_CONVERT_TEMP_FILE        "/tmp/mobileprint/convert_tmp.ppm"
 
 
 Evas *get_pdf_preview_page_image(const char *fname, int first_page,
@@ -37,6 +37,8 @@ Evas *get_pdf_preview_page_image(const char *fname, int first_page,
 int save_pdf_preview_page_image(const char *pdf_fname, int first_page,
                                                                const struct preview_page_req *settings_pts,
                                                                const char *out_pic_fname);
+int save_empty_preview_page_image(const struct preview_page_req *settings_pts,
+                               const char *out_pic_fname);
 
 #if 0
 int get_pdf_preview_pages(const char *fname,
@@ -57,6 +59,10 @@ int save_pdf_preview_page_image_w_np(void *img_buf, int img_size,
                                                                         //const struct preview_page_req *settings_pts,
                                                                         const struct preview_settings_px *settings_px,
                                                                         const char *out_pic_fname);
+int save_pdf_preview_page_image_w_np_fname(const char *pdf_fname,
+               int page_num, int pages_count,
+               const struct preview_settings_px *settings_px,
+               const char *out_pic_fname);
 
 int pdf2pdf_preview_pages(const char *fname, const char *out_pdf_fname,
                                                  const char *printer_ppd_fname,
diff --git a/mobileprint/previewgen/include/page_preview_thread.h b/mobileprint/previewgen/include/page_preview_thread.h
deleted file mode 100644 (file)
index 0005d0b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-*  Mobileprint
-*
-* Copyright 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 _PAGE_PREVIEW_THREAD_H_INCLUDED_
-#define _PAGE_PREVIEW_THREAD_H_INCLUDED_
-
-#include "page_preview.h"
-
-
-struct pdf_preview_page_image_data {
-       //char *pdf_fname;
-       void *img_buf;
-       int img_size;
-       int page_num;
-       int pages_count;
-       struct preview_settings_px *settings_px;
-       char *out_pic_fname;
-
-       int res;
-};
-
-struct process_image_downscale_data {
-       char *fname;
-       char *out_fname;
-       struct size_px *available_size_px;
-
-       int res;
-};
-
-#if 0
-struct img2pdf_preview_pages_data {
-       char **fnames;
-       int files_count;
-       struct paper_size_pts *paper_size;
-       struct size_px *available_size_px;
-       enum page_orientation orientation;
-       int n_up;
-       struct page_scale *scale;
-       int is_grayscale;
-
-       int res;
-};
-#endif
-
-void *save_pdf_preview_page_image_w_np_thread(void *d);
-void *process_image_downscale_thread(void *d);
-//void *img2pdf_preview_pages_thread(void *d);
-
-#endif /* _PAGE_PREVIEW_THREAD_H_INCLUDED_ */
-
index e8d7edf..f2cf47f 100644 (file)
@@ -21,7 +21,7 @@
 #define _PDFGEN_H_INCLUDED_
 
 
-#define TEMP_PDFTOPDF_FNAME    "/tmp/pdftopdf_tmp.pdf"
+#define TEMP_PDFTOPDF_FNAME    "/tmp/mobileprint/pdftopdf_tmp.pdf"
 
 #define SCALE_WALLET_W 3.30709
 #define SCALE_WALLET_H
index b921e37..833a3cc 100644 (file)
 #ifndef _PGEN_DEBUG_H_INCLUDED_
 #define _PGEN_DEBUG_H_INCLUDED_
 
-#include <pts_debug.h>
-
 
 /* debugging macros definitions */
 
-/*#define PREVIEWGEN_DEBUG*/
+#define PREVIEWGEN_DEBUG
 #ifdef PREVIEWGEN_DEBUG
 /* standalone preview generation (e.g. for testing) */
 
-#define PGEN_DEBUG(fmt, arg...)                do { \
-               printf("DEBUG: " fmt "\n", ##arg); } while (0)
+#include <stdio.h>
+
+#define PGEN_DEBUG(fmt, arg...) \
+       do { \
+               fprintf(stderr, "DEBUG:%s:%s(%d): " fmt "\n", \
+                               __FILE__, __func__, __LINE__, ##arg); \
+       } while (0)
 #define PGEN_TRACE_BEGIN
 #define PGEN_TRACE_END
 
+#define PGEN_RET_IF(expr, fmt, args...) \
+       do { \
+               if(expr) { \
+                       PGEN_DEBUG("[%s] Return, message "fmt, #expr, ##args );\
+                       return; \
+               } \
+       } while (0)
+
+#define PGEN_RETV_IF(expr, val, fmt, args...) \
+       do { \
+               if(expr) { \
+                       PGEN_DEBUG("[%s] Return value, message "fmt, #expr, ##args );\
+                       return (val); \
+               } \
+       } while (0)
+
+#define PGEN_IF_FREE_MEM(mem) \
+       do { \
+               if(mem) { \
+                       free(mem); \
+                       mem = NULL; \
+               } \
+       } while (0)
+
 #else
 
+#include <pts_debug.h>
+
 #define PGEN_DEBUG(fmt, arg...)                PTS_DEBUG(fmt, ##arg)
 #define PGEN_TRACE_BEGIN               PTS_TRACE_BEGIN
 #define PGEN_TRACE_END                 PTS_TRACE_END
index b5c67ed..5d6d76b 100644 (file)
 #include <stdio.h>
 
 #include "paper_size.h"
-/*#include <pts_debug.h>*/
+
+
+#define PDF_PAGE_MAX_VAL       999999
+#define PDF_PAGE_MAX_STR_LEN   (sizeof("999999") - 1)
 
 
 struct pdf_preview_settings {
@@ -44,7 +47,7 @@ enum file_type {
                "bmp", "pcx", NULL}
 #define PDF_FILE_EXT   "pdf"
 
-#define IMG_TEMP_FILE_NAME     "/tmp/out.ppm"
+#define IMG_TEMP_FILE_NAME     "/tmp/mobileprint/out.ppm"
 #define PREVIEW_IMG_TEMP_FILE_NAME IMG_TEMP_FILE_NAME
 
 #if 0
index fb01f1e..81e701b 100644 (file)
@@ -34,20 +34,20 @@ int init_buffer_canvas(Evas *canvas, const struct size_px *page_size)
        int width = page_size->x;
        int height = page_size->y;
 
-       PTS_RETV_IF(page_size == NULL || canvas == NULL, -1 , "Invalid argument");
+       PGEN_RETV_IF(page_size == NULL || canvas == NULL, -1 , "Invalid argument");
 
        method = evas_render_method_lookup("buffer");
-       PTS_RETV_IF(method <= 0 , -1, "method is less than zero");
+       PGEN_RETV_IF(method <= 0 , -1, "method is less than zero");
 
        evas_output_method_set(canvas, method);
        evas_output_size_set(canvas, width, height);
        evas_output_viewport_set(canvas, 0, 0, width, height);
        einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas);
-       PTS_RETV_IF(einfo == NULL, -1, "einfo is NULL");
+       PGEN_RETV_IF(einfo == NULL, -1, "einfo is NULL");
 
        PGEN_DEBUG("pixels malloc(%d) width %d height %d ",width*height*sizeof(int), width, height);
        pixels = malloc(width * height * sizeof(int));
-       PTS_RETV_IF(pixels == NULL, -1, "pixels is NULL");
+       PGEN_RETV_IF(pixels == NULL, -1, "pixels is NULL");
        memset(pixels, 0, width * height * sizeof(int));
 
        einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
@@ -65,7 +65,7 @@ int init_buffer_canvas(Evas *canvas, const struct size_px *page_size)
 
 int init_temp_buffer_canvas(Evas *canvas)
 {
-       PTS_RETV_IF(canvas == NULL, -1 , "Invalid argument");
+       PGEN_RETV_IF(canvas == NULL, -1 , "Invalid argument");
        struct size_px page_size = {100, 100};
        return init_buffer_canvas(canvas, &page_size);
 }
@@ -75,17 +75,17 @@ int reinit_buffer_canvas(Evas *canvas, const struct size_px *page_size)
        Evas_Engine_Info_Buffer *einfo;
        void *oldbuf;
 
-       PTS_RETV_IF(canvas == NULL || page_size == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(canvas == NULL || page_size == NULL, -1, "Invalid argument");
 
        einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas);
-       PTS_RETV_IF(einfo == NULL, -1 , "einfo is NULL");
+       PGEN_RETV_IF(einfo == NULL, -1 , "einfo is NULL");
 
        oldbuf = einfo->info.dest_buffer;
        if (init_buffer_canvas(canvas, page_size) < 0) {
                return -1;
        }
        //memcpy(einfo->info.dest_buffer, oldbuf, 100 * 100 * sizeof(int));
-       PTS_IF_FREE_MEM(oldbuf);
+       PGEN_IF_FREE_MEM(oldbuf);
 
        return 0;
 }
@@ -100,10 +100,10 @@ Evas *create_canvas(const struct size_px *page_size)
 {
        PGEN_TRACE_BEGIN;
        Evas *canvas;
-       PTS_RETV_IF(page_size == NULL, NULL, "Invalid argument");
+       PGEN_RETV_IF(page_size == NULL, NULL, "Invalid argument");
 
        canvas = evas_new();
-       PTS_RETV_IF(canvas == NULL, NULL, "canvas is NULL");
+       PGEN_RETV_IF(canvas == NULL, NULL, "canvas is NULL");
 
        if (init_buffer_canvas(canvas, page_size) < 0) {
                evas_free(canvas);
@@ -117,7 +117,7 @@ Evas *create_canvas(const struct size_px *page_size)
 void destroy_canvas(Evas *canvas)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RET_IF(canvas == NULL, "Invalid argument");
+       PGEN_RET_IF(canvas == NULL, "Invalid argument");
 
        Evas_Engine_Info_Buffer *einfo;
        einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas);
@@ -126,7 +126,7 @@ void destroy_canvas(Evas *canvas)
                evas_free(canvas);
                return;
        }
-       PTS_IF_FREE_MEM(einfo->info.dest_buffer);
+       PGEN_IF_FREE_MEM(einfo->info.dest_buffer);
        evas_free(canvas);
 
        PGEN_TRACE_END;
@@ -139,7 +139,7 @@ void destroy_canvas(Evas *canvas)
 void draw_scene(Evas *canvas)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RET_IF(canvas == NULL, "Invalid argument");
+       PGEN_RET_IF(canvas == NULL, "Invalid argument");
 
        Eina_List *updates;/*, *n;*/
        /*Eina_Rectangle *update; */
@@ -162,7 +162,7 @@ void draw_scene(Evas *canvas)
 void save_scene(Evas *canvas, const char *dest)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RET_IF(canvas == NULL || dest == NULL, "Invalid argument");
+       PGEN_RET_IF(canvas == NULL || dest == NULL, "Invalid argument");
 
        Evas_Engine_Info_Buffer *einfo;
        const unsigned int *pixels, *pixels_end;
@@ -170,11 +170,11 @@ void save_scene(Evas *canvas, const char *dest)
        FILE *f;
 
        einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas);
-       PTS_RET_IF(einfo == NULL, "einfo is NULL");
+       PGEN_RET_IF(einfo == NULL, "einfo is NULL");
 
        evas_output_size_get(canvas, &width, &height);
        f = fopen(dest, "wb+");
-       PTS_RET_IF(f == NULL, "ERROR: could not open for writing '%s': %s",dest, strerror(errno));
+       PGEN_RET_IF(f == NULL, "ERROR: could not open for writing '%s': %s",dest, strerror(errno));
 
        pixels = einfo->info.dest_buffer;
        pixels_end = pixels + (width * height);
index 9fca6fc..93a4c99 100644 (file)
@@ -40,7 +40,7 @@ int downscale_image(const char *fname, const char *outfname_ppm,
        struct size_px size_limits;
 
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(fname == NULL || outfname_ppm == NULL || available_size == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(fname == NULL || outfname_ppm == NULL || available_size == NULL, -1, "Invalid argument");
 
        PGEN_DEBUG("available_size(%d,%d)",available_size->x, available_size->y);
 
@@ -52,7 +52,7 @@ int downscale_image(const char *fname, const char *outfname_ppm,
                return -1;
        }
 
-       PTS_RETV_IF(rw <= 0 || rh <= 0, -1, "Failed to get resolution");
+       PGEN_RETV_IF(rw <= 0 || rh <= 0, -1, "Failed to get resolution");
 
        rsize.x = rw;
        rsize.y = rh;
@@ -73,7 +73,7 @@ int downscale_image(const char *fname, const char *outfname_ppm,
        PGEN_DEBUG("canvas init, (%d; %d)", pic_size.x, pic_size.y);
 
        canvas = create_canvas(&pic_size);
-       PTS_RETV_IF(canvas == NULL, -1, "canvas is NULL");
+       PGEN_RETV_IF(canvas == NULL, -1, "canvas is NULL");
 
        /*PGEN_DEBUG("new image");*/
        img = evas_object_image_filled_add(canvas);
index f98f2d2..12dc1f1 100644 (file)
@@ -51,12 +51,12 @@ Evas_Object *get_pdf_img(Evas *canvas,
                                                 void *img_buf, int img_size)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(canvas == NULL || img_buf == NULL || img_size <= 0, NULL, "Invalid argument");
+       PGEN_RETV_IF(canvas == NULL || img_buf == NULL || img_size <= 0, NULL, "Invalid argument");
 
        Evas_Object *img = NULL;
        img = evas_object_image_filled_add(canvas);
        evas_object_image_memfile_set(img, img_buf, img_size,"ppm", NULL);
-       PTS_IF_FREE_MEM(img_buf); /* copy saved in image */
+       PGEN_IF_FREE_MEM(img_buf); /* copy saved in image */
 
        PGEN_TRACE_END;
        return img;
@@ -94,14 +94,14 @@ void grayscale_img(Evas_Object *img)
        int *data;
 
        PGEN_TRACE_BEGIN;
-       PTS_RET_IF(img == NULL, "Invalid argument");
+       PGEN_RET_IF(img == NULL, "Invalid argument");
 
        evas_object_image_size_get(img, &w, &h);
-       PTS_RET_IF(w == 0 || h == 0 , "can't get (w, h)");
+       PGEN_RET_IF(w == 0 || h == 0 , "can't get (w, h)");
        PGEN_DEBUG("grayscale_img(): size: (%d, %d)", w, h);
 
        data = evas_object_image_data_get(img, EINA_TRUE);
-       PTS_RET_IF(data == NULL, "can't get data");
+       PGEN_RET_IF(data == NULL, "can't get data");
 
        for (i = 0; i < w * h; ++i) {
                data[i] = grayscale_rgba(data[i]);
@@ -115,7 +115,7 @@ int set_canvas_background(Evas *canvas, const struct size_px *full_size)
 {
        Evas_Object *bg;
 
-       PTS_RETV_IF(canvas == NULL || full_size == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(canvas == NULL || full_size == NULL, -1, "Invalid argument");
 
        /* background */
        bg = evas_object_rectangle_add(canvas);
@@ -138,7 +138,7 @@ int set_preview_page(Evas *canvas,
                                         const struct size_px *off)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(canvas == NULL || b_s == NULL || p_s == NULL || off == NULL, -1 , "Invalid argument");
+       PGEN_RETV_IF(canvas == NULL || b_s == NULL || p_s == NULL || off == NULL, -1 , "Invalid argument");
 
        Evas_Object *bg;
        int shadow_offset_x;
@@ -185,7 +185,7 @@ int load_pdf_page_img(const char *fname, int page,
                                          void **out_img, int *size)
 {
        struct pdf_preview_settings pdf_settings;
-       PTS_RETV_IF(fname == NULL || page <= 0  || settings_px == NULL || out_img == NULL || size == NULL
+       PGEN_RETV_IF(fname == NULL || page <= 0  || settings_px == NULL || out_img == NULL || size == NULL
                                , -1 , "Invalid argument");
 
        /* put page image */
@@ -211,7 +211,7 @@ int set_pdf_preview_page_image(Evas *canvas,
                                                           const struct size_px *off,
                                                           const struct preview_page_px *settings_px)
 {
-       PTS_RETV_IF(canvas == NULL || img_buf == NULL || img_size <=0 || off == NULL || settings_px == NULL
+       PGEN_RETV_IF(canvas == NULL || img_buf == NULL || img_size <=0 || off == NULL || settings_px == NULL
                                , -1 , "Invalid argument");
 
        Evas_Object *img;
@@ -224,7 +224,7 @@ int set_pdf_preview_page_image(Evas *canvas,
        }
 
        img = get_pdf_img(canvas, img_buf, img_size);
-       PTS_RETV_IF(img == NULL, -1 , "img is NULL");
+       PGEN_RETV_IF(img == NULL, -1 , "img is NULL");
 
        if (settings_px->is_rotate90
                        && rotate90_image(img) < 0) {
@@ -261,7 +261,7 @@ int set_pdf_preview_page_image_w_np(Evas *canvas,
        struct size_px right_off = {0, 0};
 
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(canvas == NULL || img_buf == NULL || img_size <=0 || page_num <=0
+       PGEN_RETV_IF(canvas == NULL || img_buf == NULL || img_size <=0 || page_num <=0
                                || pages_count <=0 || settings_px == NULL, -1, "Invalid argument");
 
        center_off.x = settings_px->center_off;
@@ -333,7 +333,7 @@ int save_pdf_preview_page_image(const char *pdf_fname, int page_num,
        }
 
        canvas = create_canvas(&(settings_px.full_size));
-       PTS_RETV_IF(canvas == NULL, -1, "canvas is NULL");
+       PGEN_RETV_IF(canvas == NULL, -1, "canvas is NULL");
 
        if (load_pdf_page_img(pdf_fname, page_num, &settings_px,
                                                  &img_buf, &img_size) < 0) {
@@ -359,6 +359,44 @@ int save_pdf_preview_page_image(const char *pdf_fname, int page_num,
 }
 
 
+int save_empty_preview_page_image(const struct preview_page_req *settings_pts,
+                               const char *out_pic_fname)
+{
+       Evas *canvas;
+       struct preview_page_px settings_px;
+       struct size_px off = {0, 0};
+       struct size_px border_size = {1, 1};
+
+       PGEN_TRACE_BEGIN;
+
+       if (get_preview_page_settings(settings_pts, &settings_px) < 0) {
+               PGEN_DEBUG("ERROR: get_pdf_preview_page_image():"
+                                  " get_preview_page_settings()");
+               PGEN_TRACE_END;
+               return -1;
+       }
+
+       canvas = create_canvas(&(settings_px.full_size));
+       PGEN_RETV_IF(canvas == NULL, -1, "canvas is NULL");
+
+       if (set_preview_page(canvas, &(settings_px.full_size),
+                        &(settings_px.paper_size), &border_size, &off) < 0) {
+               PGEN_DEBUG("ERROR in set_preview_page()");
+               destroy_canvas(canvas);
+               PGEN_TRACE_END;
+               return -1;
+       }
+
+       draw_scene(canvas);
+       save_scene(canvas, out_pic_fname);
+       destroy_canvas(canvas);
+
+       PGEN_TRACE_END;
+
+       return 0;
+}
+
+
 int save_pdf_preview_page_image_w_np(
        void *img_buf, int img_size,
        int page_num, int pages_count,
@@ -368,7 +406,7 @@ int save_pdf_preview_page_image_w_np(
        PGEN_TRACE_BEGIN;
        Evas *canvas;
        canvas = create_canvas(&(settings_px->full_size));
-       PTS_RETV_IF(canvas == NULL, -1, "canvas is NULL");
+       PGEN_RETV_IF(canvas == NULL, -1, "canvas is NULL");
 
        /* till we save page images in PPM this is required */
        if (set_canvas_background(canvas, &(settings_px->full_size)) < 0) {
@@ -396,18 +434,40 @@ int save_pdf_preview_page_image_w_np(
        return 0;
 }
 
+
+int save_pdf_preview_page_image_w_np_fname(const char *pdf_fname,
+               int page_num, int pages_count,
+               const struct preview_settings_px *settings_px,
+               const char *out_pic_fname)
+{
+       int res;
+       void *img_buf;
+       int img_size;
+       if (load_pdf_page_img(pdf_fname, page_num, &(settings_px->page_px),
+                               &img_buf, &img_size) < 0) {
+               PGEN_TRACE_END;
+               return -1;
+       }
+
+       /* called function is responsible for img_buf allocation */
+       res = save_pdf_preview_page_image_w_np(img_buf, img_size,
+                       page_num, pages_count, settings_px, out_pic_fname);
+       return res;
+}
+
+
 /* fix pdftopdf page rotation problem by manual scaling option */
 int fix_pdf_page_scale(const char *fname,
                                           const struct size_pts *req_size,
                                           struct pdfgen_settings *settings)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(NULL == fname || NULL == req_size || NULL == settings, -1, "Invalid argument");
+       PGEN_RETV_IF(NULL == fname || NULL == req_size || NULL == settings, -1, "Invalid argument");
 
        struct size_pts input_pdf_pts = {0.0, };
 
        int result = get_pdf_page_size(fname, &input_pdf_pts);
-       PTS_RETV_IF(result < 0, -1, "can't get pdf page size");
+       PGEN_RETV_IF(result < 0, -1, "can't get pdf page size");
 
        /* check rotation */
        if ((PAGE_ORIENTATION_LANDSCAPE == settings->orientation
@@ -445,6 +505,71 @@ int fix_pdf_page_scale(const char *fname,
        return 0;
 }
 
+
+/**
+ * @brief      Generates preview images for all PDF pages in temporary files
+ *             (/tmp/mobileprint_xxxx.ppm)
+ * @param[in]  fname                   PDF file name
+ * @param[in]  paper_size              paper size in pts
+ * @param[in]  available_size_px       available size for images in px
+ * @param[in]  is_grayscale            is image must be grascaled
+ * @return     -1                      error
+ *             > 0                     generated pages count
+ */
+int generate_pdf_preview_pages(const char *fname,
+               const struct size_pts *paper_size,
+               const struct size_px *available_size_px,
+               int is_grayscale)
+{
+       int pages_count;
+       int cur_page;
+       struct size_pts page_size = {0.0, 0.0};
+
+       struct size_px shadow_size_px = {10, 10};
+       struct preview_page_req settings_req;
+       /*struct preview_settings_px settings_px;*/
+       char out_fname[sizeof("/tmp/mobileprint_xxxx.ppm ")];
+
+       PGEN_TRACE_BEGIN;
+
+       /*PGEN_DEBUG("available_size: (%d, %d)",
+                       available_size_px->x, available_size_px->y);*/
+
+
+       if (get_pdf_page_size(fname, &page_size) < 0) {
+               PGEN_DEBUG("ERROR in get_pdf_page_size()\n");
+               return -1;
+       }
+       pages_count = get_pdf_pages_count(fname);
+       if (pages_count <= 0) {
+               PGEN_DEBUG("ERROR: pages_count = %d (<=0)\n", pages_count);
+               return -1;
+       }
+
+       settings_req.paper_size = *paper_size;
+       settings_req.available_size_px = *available_size_px;
+       settings_req.shadow_offset = shadow_size_px;
+       settings_req.is_rotate90 = 0;
+       settings_req.is_grayscale = is_grayscale;
+
+       /*if (get_preview_settings(&settings_req, &settings_px) < 0) {
+               PGEN_DEBUG("ERROR in get_preview_settings()");
+               PGEN_TRACE_END;
+               return -1;
+       }*/
+
+       for (cur_page = 0; cur_page < pages_count; ++cur_page) {
+               sprintf(out_fname, "/tmp/mobileprint_%04d.ppm", cur_page + 1);
+               save_pdf_preview_page_image(fname,
+                               cur_page + 1, &settings_req,
+                               out_fname);
+       }
+
+       PGEN_TRACE_END;
+       return pages_count;
+}
+
+
 /**
  * @brief      Process PDF preview generation with CUPS filters to PDF with
  *             specific options
@@ -467,7 +592,7 @@ int pdf2pdf_preview_pages(const char *fname, const char *out_pdf_fname,
        struct pdfgen_settings pg_settings;
 
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(!fname || !scale, -1, "Invalid argument");
+       PGEN_RETV_IF(!fname || !scale, -1, "Invalid argument");
        PGEN_DEBUG("processing file name: %s", fname);
 
        /* generate result pdf */
@@ -478,7 +603,7 @@ int pdf2pdf_preview_pages(const char *fname, const char *out_pdf_fname,
        pg_settings.ppd_filename = (char *)printer_ppd_fname;
 
        int result = fix_pdf_page_scale(fname, &(paper_size->s), &pg_settings);
-       PTS_RETV_IF(result < 0, -1, "ERROR in fix_pdf_page_scale()");
+       PGEN_RETV_IF(result < 0, -1, "ERROR in fix_pdf_page_scale()");
 
        PGEN_DEBUG("pg_settings.paper_name = %s", pg_settings.paper_name);
        PGEN_DEBUG("pg_settings.orientation = %d",
@@ -488,17 +613,52 @@ int pdf2pdf_preview_pages(const char *fname, const char *out_pdf_fname,
                           (int)pg_settings.scale.type);
 
        result = call_pdftopdf(fname, out_pdf_fname, &pg_settings);
-       PTS_RETV_IF(result < 0, -1, "ERROR in call_pdftopdf()");
+       PGEN_RETV_IF(result < 0, -1, "ERROR in call_pdftopdf()");
 
        PGEN_TRACE_END;
        return 0;
 }
 
+
+/**
+ * @brief      Process PDF preview generation with CUPS filters into temporary
+ *             pages image files (/tmp/mobileprint_xxxx.ppm)
+ * @param[in]  fname                   input PDF file name
+ * @param[in]  paper_size              paper size with CUPS name
+ * @param[in]  available_size_px       available size for image in px
+ * @param[in]  orientation             requested printing orientation
+ * @param[in]  n_up                    number-up
+ * @param[in]  scale
+ * @param[in]  is_grayscale            image must be grascaled
+ * @return     -1                      error
+ *             > 0                     generated pages count
+ */
+int get_pdf_preview_pages(const char *fname, const char *out_pdf_fname,
+               const char *printer_ppd_fname,
+               const struct paper_size_pts *paper_size,
+               const struct size_px *available_size_px,
+               enum page_orientation orientation,
+               int n_up, const struct page_scale *scale, int is_grayscale)
+{
+       int res;
+       PGEN_TRACE_BEGIN;
+       pdf2pdf_preview_pages(fname, out_pdf_fname, printer_ppd_fname,
+                       paper_size, orientation,
+                       n_up, scale, is_grayscale);
+
+       res = generate_pdf_preview_pages(TEMP_PDFTOPDF_FNAME,
+                       &(paper_size->s), available_size_px,
+                       is_grayscale);
+       PGEN_TRACE_END;
+       return res;
+}
+
+
 int process_image_downscale(const char *fname, const char *out_fname,
                                                        const struct size_px *available_size_px)
 {
        struct size_px new_size;
-       PTS_RETV_IF(fname == NULL || out_fname == NULL || available_size_px == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(fname == NULL || out_fname == NULL || available_size_px == NULL, -1, "Invalid argument");
        new_size.x = available_size_px->x / 2;
        new_size.y = available_size_px->y / 2;
        downscale_image(fname, out_fname, &new_size);
@@ -513,7 +673,7 @@ int img2pdf_preview_pages(const char *fname, const char *out_pdf_fname,
                                                  const struct page_scale *scale, int is_grayscale)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(!fname || !out_pdf_fname || !printer_ppd_fname ||
+       PGEN_RETV_IF(!fname || !out_pdf_fname || !printer_ppd_fname ||
                                !paper_size || !available_size_px || !scale,
                                -1, "Invalid argument");
 
@@ -529,7 +689,7 @@ int img2pdf_preview_pages(const char *fname, const char *out_pdf_fname,
        pg_settings.ppd_filename = (char *)printer_ppd_fname;
 
        int result = call_imagetopdf(fname, out_pdf_fname, &pg_settings);
-       PTS_RETV_IF(result < 0, -1, "ERROR in call_imagetopdf()");
+       PGEN_RETV_IF(result < 0, -1, "ERROR in call_imagetopdf()");
 
        PGEN_TRACE_END;
        return 0;
diff --git a/mobileprint/previewgen/lib/page_preview_thread.c b/mobileprint/previewgen/lib/page_preview_thread.c
deleted file mode 100644 (file)
index 74ec445..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-*  Mobileprint
-*
-* Copyright 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 "page_preview.h"
-#include "page_preview_thread.h"
-
-void *save_pdf_preview_page_image_w_np_thread(void *d)
-{
-       struct pdf_preview_page_image_data *data =
-               (struct pdf_preview_page_image_data *)d;
-       data->res = save_pdf_preview_page_image_w_np(
-                                       data->img_buf, data->img_size,
-                                       data->page_num, data->pages_count,
-                                       data->settings_px, data->out_pic_fname);
-       return NULL;
-}
-
-void *process_image_downscale_thread(void *d)
-{
-       struct process_image_downscale_data *data =
-               (struct process_image_downscale_data *)d;
-       data->res = process_image_downscale(data->fname, data->out_fname,
-                                                                               data->available_size_px);
-       return NULL;
-}
index 3a81490..414331c 100644 (file)
@@ -44,7 +44,7 @@ struct paper_size_pts paper_sizes[] = {
 
 void switch_size_pts_coords(struct size_pts *s)
 {
-       PTS_RET_IF(s == NULL, "Invalid argument");
+       PGEN_RET_IF(s == NULL, "Invalid argument");
        double val;
        val = s->x;
        s->x = s->y;
@@ -53,7 +53,7 @@ void switch_size_pts_coords(struct size_pts *s)
 
 void switch_size_px_coords(struct size_px *s)
 {
-       PTS_RET_IF(s == NULL, "Invalid argument");
+       PGEN_RET_IF(s == NULL, "Invalid argument");
        int val;
        val = s->x;
        s->x = s->y;
@@ -62,7 +62,7 @@ void switch_size_px_coords(struct size_px *s)
 
 void add_size_pts(const struct size_pts *from, struct size_pts *to)
 {
-       PTS_RET_IF(from == NULL || to == NULL, "Invalid argument");
+       PGEN_RET_IF(from == NULL || to == NULL, "Invalid argument");
        to->x += from->x;
        to->y += from->y;
 }
@@ -70,7 +70,7 @@ void add_size_pts(const struct size_pts *from, struct size_pts *to)
 
 void neg_size_pts(struct size_pts *s)
 {
-       PTS_RET_IF(s == NULL, "Invalid argument");
+       PGEN_RET_IF(s == NULL, "Invalid argument");
        s->x = -s->x;
        s->y = -s->y;
 }
@@ -87,7 +87,7 @@ int get_paper_size_pts(const char *name, struct paper_size_pts *s)
        int i;
        struct paper_size_pts *cur_s;
 
-       PTS_RETV_IF(name == NULL || s == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(name == NULL || s == NULL, -1, "Invalid argument");
 
        for (i = 0; paper_sizes[i].name != NULL; ++i) {
                cur_s = &(paper_sizes[i]);
@@ -119,7 +119,7 @@ int pts_size2px(const struct size_pts *s_pts,
        double ratio_x;
        double ratio_y;
 
-       PTS_RETV_IF(s_pts == NULL || border_s_px == NULL || px == NULL, -1 , "Invalid argument");
+       PGEN_RETV_IF(s_pts == NULL || border_s_px == NULL || px == NULL, -1 , "Invalid argument");
 
        ratio_x = border_s_px->x / s_pts->x;
        ratio_y = border_s_px->y / s_pts->y;
@@ -135,7 +135,7 @@ int pts_size2px(const struct size_pts *s_pts,
        px->x = ratio_x * s_pts->x;
        px->y = ratio_y * s_pts->y;
 
-       PTS_DEBUG("px->x px->y :(%d, %d)",px->x, px->y);
+       PGEN_DEBUG("px->x px->y :(%d, %d)",px->x, px->y);
        PGEN_TRACE_END;
        return 0;
 }
index de50fc4..d713a1d 100644 (file)
@@ -62,7 +62,7 @@ int call_cmd(const char *cmd_str)
                read_len = getline(&str_buf, &len, cmd_output);
        } while (read_len != -1);
 
-       PTS_IF_FREE_MEM(str_buf);
+       PGEN_IF_FREE_MEM(str_buf);
        pclose(cmd_output);
 
        PGEN_TRACE_END;
@@ -83,15 +83,15 @@ int call_pdftopdf(const char *infile, const char *outfile,
 {
        PGEN_TRACE_BEGIN;
 
-       PTS_RETV_IF(infile == NULL || outfile == NULL || settings == NULL || settings->ppd_filename == NULL,
+       PGEN_RETV_IF(infile == NULL || outfile == NULL || settings == NULL || settings->ppd_filename == NULL,
                                -1, "Invalid argument");
 
        int err_code = 0;
        char cmd_str[1024];
 
        /* placing n_up number of pages on the specified media */
-       snprintf(cmd_str, 1024, "PPD=%s " CUPS_FILTER_DIR "/pdftopdf job user title 1 \"%s number-up=%d PageSize=%s fit-to-page=True\" \"%s\""
-                        " >%s 2> /tmp/errlog",
+       snprintf(cmd_str, 1024, "PPD=%s " CUPS_FILTER_DIR "/pdftopdf job user title 1 \"%s number-up=%d PageSize=%s fit-to-page=True pdftopdfAutoRotate=false\" \"%s\""
+                        " >%s 2> /tmp/mobileprint/errlog",
                         settings->ppd_filename,
                         PAGE_ORIENTATION_PORTRAIT == settings->orientation ? CUPS_OPTION_PORTRAIT :
                         PAGE_ORIENTATION_LANDSCAPE == settings->orientation ? CUPS_OPTION_LANDSCAPE : "",
@@ -100,12 +100,54 @@ int call_pdftopdf(const char *infile, const char *outfile,
 
        PGEN_DEBUG("call_pdftopdf(): %s", cmd_str);
        err_code = call_cmd(cmd_str);
-       PTS_RETV_IF(err_code, -1, "call_pdftopdf returned non-zero error code");
+       PGEN_RETV_IF(err_code, -1, "call_pdftopdf returned non-zero error code");
 
        PGEN_TRACE_END;
        return err_code;
 }
 
+
+int strcat_img_scale_option(char *res, const char *img_path,
+               const struct page_scale *scale)
+{
+       PGEN_TRACE_BEGIN;
+       PGEN_RETV_IF(res == NULL , -1 , "res is NULL");
+       PGEN_RETV_IF(img_path == NULL , -1 , "img_path is NULL");
+       PGEN_RETV_IF(scale == NULL , -1 , "scale is NULL");
+       //PGEN_RETV_IF(scale->w == 0 , -1 , "scale->w is 0");
+
+       int imgw;
+       int imgh;
+       int ppi;
+       char ppi_str[PPI_STR_MAX_LEN + 1];
+       int result;
+
+       switch (scale->type) {
+       case SCALE_FIT_TO_PAPER:
+               strcat(res, "fit-to-page=true");
+               return 0;
+       case SCALE_ORIGINAL:
+               strcat(res, "scaling=100");
+               return 0;
+       case SCALE_CUSTOM:
+               break;
+       }
+
+       result = get_image_resolution(img_path, &imgw, &imgh);
+       PGEN_RETV_IF(result < 0, -1 , "Can't get resolution");
+
+       ppi = (double)imgw / scale->w;
+       PGEN_RETV_IF(ppi >= PPI_MAX_VAL, -1 , "Resolution is too big");
+
+       snprintf(ppi_str, PPI_STR_MAX_LEN, "%d", ppi);
+       ppi_str[PPI_STR_MAX_LEN] = '\0';
+       strcat(res, "PPI=");
+       strcat(res, ppi_str);
+
+       return 0;
+}
+
+
 /**
  * @brief      This function forms and executes cmd line request to CUPS
  *             imagetopdf filter to convert image to PDF file
@@ -119,26 +161,40 @@ int call_imagetopdf(const char *infile, const char *outfile,
                                        const struct pdfgen_settings *settings)
 {
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(infile== NULL || outfile == NULL || settings == NULL || settings->ppd_filename == NULL,
+       PGEN_RETV_IF(infile== NULL || outfile == NULL || settings == NULL || settings->ppd_filename == NULL,
                                -1 , "Invalid argument");
 
        int err_code = 0;
        char cmd_str[1024];
+       char scale_str[256];
+
+       scale_str[0] = '\0';
+       strcat_img_scale_option(scale_str, infile,  &(settings->scale));
 
        /* placing n_up number of pages on the specified media */
-       snprintf(cmd_str, 1024, "PPD=%s " CUPS_FILTER_DIR "/imagetopdf job user title 1 \"%s number-up=%d PageSize=%s fit-to-page=%s \" \"%s\""
-                        " >%s 2> /tmp/errlog",
-                        settings->ppd_filename,
-                        PAGE_ORIENTATION_PORTRAIT == settings->orientation ? CUPS_OPTION_PORTRAIT " " :
-                        PAGE_ORIENTATION_LANDSCAPE == settings->orientation ? CUPS_OPTION_LANDSCAPE " " : "",
-                        settings->n_up,
-                        settings->paper_name,
-                        SCALE_FIT_TO_PAPER == settings->scale.type ? "True" : "False",
-                        infile, outfile);
+       snprintf(cmd_str, 1024, "PPD=%s " CUPS_FILTER_DIR
+                       "/imagetopdf job user title 1 \"%s"
+                       " number-up=%d PageSize=%s"
+                       /*fit-to-page=%s*/
+                       " %s"
+                       " \" \"%s\""
+                       " >%s 2> /tmp/mobileprint/errlog",
+                       settings->ppd_filename,
+                       PAGE_ORIENTATION_PORTRAIT == settings->orientation
+                               ? CUPS_OPTION_PORTRAIT " "
+                       : PAGE_ORIENTATION_LANDSCAPE == settings->orientation
+                               ? CUPS_OPTION_LANDSCAPE " "
+                       : "",
+                       settings->n_up,
+                       settings->paper_name,
+                       /*SCALE_FIT_TO_PAPER == settings->scale.type
+                               ? "True" : "False",*/
+                       scale_str,
+                       infile, outfile);
 
        PGEN_DEBUG("call_imagetopdf(): %s", cmd_str);
        err_code = call_cmd(cmd_str);
-       PTS_RETV_IF(err_code, -1, "call_pdftopdf returned non-zero error code");
+       PGEN_RETV_IF(err_code, -1, "call_pdftopdf returned non-zero error code");
 
        PGEN_TRACE_END;
        return 0;
index bf1589b..003dbd8 100644 (file)
@@ -77,7 +77,7 @@ void debug_print_preview_settings_px(const struct preview_settings_px *s)
 int process_preview_page_settings(const struct preview_page_req *req,
                                                                  struct preview_page_px *res)
 {
-       PTS_RETV_IF(req == NULL || res == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(req == NULL || res == NULL, -1, "Invalid argument");
 
        /*debug_print_preview_page_req(req);*/
 
@@ -110,7 +110,7 @@ int get_preview_page_settings(const struct preview_page_req *req,
 {
        struct preview_page_req newreq;
 
-       PTS_RETV_IF(req == NULL || res == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(req == NULL || res == NULL, -1, "Invalid argument");
 
        newreq = *req;
 
@@ -130,7 +130,7 @@ int get_preview_settings(const struct preview_page_req *req,
        double space_w_pts;
        struct preview_page_req newreq;
 
-       PTS_RETV_IF(req == NULL || res == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(req == NULL || res == NULL, -1, "Invalid argument");
 
        /*debug_print_preview_page_req(req);*/
 
index 5500689..85e300a 100644 (file)
@@ -39,10 +39,10 @@ int get_image_resolution(const char *path, int *resx, int *resy)
 
        Evas_Object *img;
 
-       PTS_RETV_IF(path == NULL || resx == NULL || resy == NULL, -1 , "Invalid argument");
+       PGEN_RETV_IF(path == NULL || resx == NULL || resy == NULL, -1 , "Invalid argument");
 
        ee = ecore_evas_buffer_new(1, 1);
-       PTS_RETV_IF(ee == NULL, -1 , "ee is NULL");
+       PGEN_RETV_IF(ee == NULL, -1 , "ee is NULL");
 
        canvas = ecore_evas_get(ee);
        img = evas_object_image_add(canvas);
@@ -95,19 +95,19 @@ int rotate90_image(Evas_Object *img)
        int iy;
 
        PGEN_TRACE_BEGIN;
-       PTS_RETV_IF(img == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(img == NULL, -1, "Invalid argument");
 
        /* allocate temporary memory */
        evas_object_image_size_get(img, &w, &h);
-       PTS_RETV_IF(w == 0 || h == 0 , -1, "Failed to allocate memory");
+       PGEN_RETV_IF(w == 0 || h == 0 , -1, "Failed to allocate memory");
        PGEN_DEBUG("w = %d h = %d", w, h);
 
        data_size = w * h;
        old_data = evas_object_image_data_get(img, EINA_FALSE);
-       PTS_RETV_IF(old_data == NULL, -1 , "Failed to get image data");
+       PGEN_RETV_IF(old_data == NULL, -1 , "Failed to get image data");
 
        new_data = malloc(sizeof(int) * (data_size + 1));
-       PTS_RETV_IF(new_data == NULL, -1 , "Failed to malloc");
+       PGEN_RETV_IF(new_data == NULL, -1 , "Failed to malloc");
 
        /* write rotated image data */
        for (iy = 0; iy < h; ++iy)
@@ -123,7 +123,7 @@ int rotate90_image(Evas_Object *img)
        /* store rotated image */
        evas_object_image_size_set(img, h, w);
        evas_object_image_data_copy_set(img, new_data);
-       PTS_IF_FREE_MEM(new_data);
+       PGEN_IF_FREE_MEM(new_data);
 
        PGEN_TRACE_END;
        return 0;
index 9c5592d..f562aa9 100644 (file)
 #define IMG_MAX_SIZE           (1024 * 1024 * 2) /* 2MB */
 #define PDF_INFO_STR_MAX_SIZE  511
 
-#define PDF_INFO_TEMP_FNAME    "/tmp/pdfinfo.txt"
+#define PDF_INFO_TEMP_FNAME    "/tmp/mobileprint/pdfinfo.txt"
 
 #define PDF_PX_MAX_VAL         999999
 #define PDF_PX_VAL_MAX_STR_LEN (sizeof("999999") - 1)
 
-#define PDF_PAGE_MAX_VAL       999999
-#define PDF_PAGE_MAX_STR_LEN   (sizeof("999999") - 1)
 
 /* Just simple stub for further development
    TODO: use pipe output, current implementation have high security risk
@@ -57,9 +55,9 @@ int call_pdftoppm(const char *path, const struct pdf_preview_settings *settings)
        int path_len;
        int cmd_len;
 
-       PTS_RETV_IF(path == NULL || settings == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(path == NULL || settings == NULL, -1, "Invalid argument");
        path_len = strnlen(path, MAX_PATH_LEN);
-       PTS_RETV_IF(path_len <= 0 || path_len >= MAX_PATH_LEN, -1, "path_len is out of scope");
+       PGEN_RETV_IF(path_len <= 0 || path_len >= MAX_PATH_LEN, -1, "path_len is out of scope");
 
        /* check for correct picture size */
        if (settings->w >= PDF_PX_MAX_VAL
@@ -90,7 +88,7 @@ int call_pdftoppm(const char *path, const struct pdf_preview_settings *settings)
                          + path_len + sizeof(output_cmd);
        cmd_str = malloc(sizeof(char) * (cmd_len + 1));
 
-       PTS_RETV_IF(cmd_str == NULL, -1, "cmd_str malloc failed");
+       PGEN_RETV_IF(cmd_str == NULL, -1, "cmd_str malloc failed");
        memset(cmd_str, 0, sizeof(char) * (cmd_len + 1));
        cmd_str[0] = '\0';
 
@@ -118,7 +116,7 @@ int call_pdftoppm(const char *path, const struct pdf_preview_settings *settings)
                PGEN_DEBUG("Failed to call system");
        }
 
-       PTS_IF_FREE_MEM(cmd_str);
+       PGEN_IF_FREE_MEM(cmd_str);
 
        return 0;
 }
@@ -130,16 +128,16 @@ int call_pdfinfo(const char *path, const char *field)
        int path_len;
        int cmd_len;
 
-       PTS_RETV_IF(path == NULL || field == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(path == NULL || field == NULL, -1, "Invalid argument");
        path_len = strnlen(path, MAX_PATH_LEN);
-       PTS_RETV_IF(path_len <= 0 || path_len >= MAX_PATH_LEN, -1, "path_len is out of scope");
+       PGEN_RETV_IF(path_len <= 0 || path_len >= MAX_PATH_LEN, -1, "path_len is out of scope");
 
        cmd_len = sizeof(PDF_INFO_UTIL) + sizeof(" '") + path_len
                          + sizeof("' | grep '") + strlen(field)
                          + strlen("' > " PDF_INFO_TEMP_FNAME); // strlen(output_cmd);
        cmd_str = malloc(sizeof(char) * (cmd_len + 1));
 
-       PTS_RETV_IF(cmd_str == NULL, -1, "cmd_str malloc failed");
+       PGEN_RETV_IF(cmd_str == NULL, -1, "cmd_str malloc failed");
        memset(cmd_str, 0, sizeof(char) * (cmd_len + 1));
 
        cmd_str[0] = '\0';
@@ -158,7 +156,7 @@ int call_pdfinfo(const char *path, const char *field)
                PGEN_DEBUG("Failed to call system");
        }
 
-       PTS_IF_FREE_MEM(cmd_str);
+       PGEN_IF_FREE_MEM(cmd_str);
 
        return 0;
 }
@@ -183,7 +181,7 @@ int call_pdfinfo_pages(const char *path)
 
 int is_page_landscape(struct size_pts *s)
 {
-       PTS_RETV_IF(s == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(s == NULL, -1, "Invalid argument");
 
        if (s->x > s->y) {
                return 1;
@@ -204,7 +202,7 @@ int get_pdf_page_size(const char *path, struct size_pts *s)
        int res;
        char cmd_str[MAX_PATH_LEN] = {0,};
 
-       PTS_RETV_IF(path == NULL || s == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(path == NULL || s == NULL, -1, "Invalid argument");
 
        //NOTICE : Usage : pdfinfo [options] <PDF-file>, we use "pdfinfo <PDF-file>" to get page size
        snprintf(cmd_str, MAX_PATH_LEN, "%s %s", PDF_INFO_UTIL, path);
@@ -234,7 +232,7 @@ int get_pdf_page_size(const char *path, struct size_pts *s)
                        continue;
                }
        } while (read_len != -1);
-       PTS_IF_FREE_MEM(str_buf);
+       PGEN_IF_FREE_MEM(str_buf);
 
        PGEN_DEBUG("Page size : [%f %f]",s->x, s->y);
 
@@ -253,7 +251,7 @@ int get_pdf_page_size(const char *path, struct size_pts *s)
  */
 int get_pdf_pages_count(const char *path)
 {
-       PTS_RETV_IF(path == NULL, -1, "Invalid argument");
+       PGEN_RETV_IF(path == NULL, -1, "Invalid argument");
 
        int res                 = -1;
        int val                 = -1;
@@ -261,7 +259,7 @@ int get_pdf_pages_count(const char *path)
        char cmd_str[MAX_PATH_LEN] = {0,};
 
        path_len = strnlen(path, MAX_PATH_LEN);
-       PTS_RETV_IF(path_len <= 0 || path_len >= MAX_PATH_LEN, -1, "path_len is out of scope");
+       PGEN_RETV_IF(path_len <= 0 || path_len >= MAX_PATH_LEN, -1, "path_len is out of scope");
 
        //NOTICE : Usage : pdfinfo [options] <PDF-file>, we use "pdfinfo <PDF-file>" to get pages
        snprintf(cmd_str, MAX_PATH_LEN, "%s %s", PDF_INFO_UTIL, path);
@@ -290,7 +288,7 @@ int get_pdf_pages_count(const char *path)
                        continue;
                }
        } while (read_len != -1);
-       PTS_IF_FREE_MEM(str_buf);
+       PGEN_IF_FREE_MEM(str_buf);
 
        PGEN_DEBUG("Pages : %d", val);
 
@@ -318,7 +316,7 @@ int get_pdf_preview(const char *path,
 {
        int img_fd;
        unsigned char *imgbuf;
-       PTS_RETV_IF(size == NULL || settings == NULL || out_img == NULL , -1, "Invalid argument");
+       PGEN_RETV_IF(size == NULL || settings == NULL || out_img == NULL , -1, "Invalid argument");
 
        if (call_pdftoppm(path, settings) < 0) {
                PGEN_DEBUG("ERROR: get_pdf_preview(): call_pdftoppm() error");
@@ -327,7 +325,7 @@ int get_pdf_preview(const char *path,
 
        /* just stub, insecure in case of multiple printing requests */
        img_fd = open(IMG_TEMP_FILE_NAME, O_RDONLY);
-       PTS_RETV_IF(img_fd == -1, -1, "Failed to open temporary file");
+       PGEN_RETV_IF(img_fd == -1, -1, "Failed to open temporary file");
 
        /* STUB: currently just with enough big memory area, no check for
           higher memory requirements */
@@ -342,7 +340,7 @@ int get_pdf_preview(const char *path,
        close(img_fd);
 
        if (*size <= 0) {
-               PTS_IF_FREE_MEM(imgbuf);
+               PGEN_IF_FREE_MEM(imgbuf);
                PGEN_DEBUG("ERROR: get_pdf_preview(): read error");
                return -1;
        }
@@ -361,7 +359,7 @@ int is_file_ext(const char *fname, int fname_len, const char *ext)
        const char *ptr, *ext_ptr;
        int ext_len;
 
-       PTS_RETV_IF(fname == NULL || ext == NULL, 0, "Invalid argument");
+       PGEN_RETV_IF(fname == NULL || ext == NULL, 0, "Invalid argument");
 
        ext_len = strlen(ext);
        if (fname_len < ext_len + 1) {
@@ -391,10 +389,10 @@ enum file_type get_file_type(const char *fname)
        int i;
 
        /* check for corectness */
-       PTS_RETV_IF(fname == NULL, FILE_TYPE_INCORRECT, "Incorrect file type");
+       PGEN_RETV_IF(fname == NULL, FILE_TYPE_INCORRECT, "Incorrect file type");
 
        fname_len = strnlen(fname, MAX_PATH_LEN);
-       PTS_RETV_IF(fname_len >= MAX_PATH_LEN, FILE_TYPE_INCORRECT, "Too long file name");
+       PGEN_RETV_IF(fname_len >= MAX_PATH_LEN, FILE_TYPE_INCORRECT, "Too long file name");
 
        /* check for pdf extension */
        if (is_file_ext(fname, fname_len, pdf_ftype)) {
@@ -419,13 +417,13 @@ enum file_type get_file_type(const char *fname)
  */
 enum file_type get_file_type(const char *fname)
 {
-       PTS_RETV_IF(fname == NULL, FILE_TYPE_INCORRECT, "fname is NULL");
+       PGEN_RETV_IF(fname == NULL, FILE_TYPE_INCORRECT, "fname is NULL");
        char *fname_copy = strdup(fname);
-       PTS_RETV_IF(fname_copy == NULL, FILE_TYPE_INCORRECT, "fname_copy is NULL");
+       PGEN_RETV_IF(fname_copy == NULL, FILE_TYPE_INCORRECT, "fname_copy is NULL");
 
        char *bname = basename(fname_copy);
        char *ext = strrchr(bname, '.');
-       PTS_RETV_IF(ext == NULL, FILE_TYPE_INCORRECT, "ext is NULL");
+       PGEN_RETV_IF(ext == NULL, FILE_TYPE_INCORRECT, "ext is NULL");
 
        const char *img_file_types[] = IMG_FILE_EXTS;
        const char *pdf_ftype = PDF_FILE_EXT;
@@ -443,7 +441,7 @@ enum file_type get_file_type(const char *fname)
                }
        }
 
-       PTS_IF_FREE_MEM(fname_copy);
+       PGEN_IF_FREE_MEM(fname_copy);
        return ret;
 }
 #endif
diff --git a/mobileprint/previewgen/util/CMakeLists.txt b/mobileprint/previewgen/util/CMakeLists.txt
new file mode 100644 (file)
index 0000000..00309f6
--- /dev/null
@@ -0,0 +1,11 @@
+FILE(GLOB SRCS *.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/mobileprint/previewgen/include)
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/mobileprint/previewgen/lib)
+ADD_EXECUTABLE(previewgen-tool ${SRCS})
+
+SET_TARGET_PROPERTIES(previewgen-tool PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS_PREVIEWGEN} -fpie")
+TARGET_LINK_LIBRARIES(previewgen-tool previewgen ${previewgen_pkgs_LDFLAGS} -lecore_evas)
+
+INSTALL(TARGETS previewgen-tool DESTINATION ${BINDIR})
+
diff --git a/mobileprint/previewgen/util/main.c b/mobileprint/previewgen/util/main.c
new file mode 100644 (file)
index 0000000..371c255
--- /dev/null
@@ -0,0 +1,392 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <page_preview.h>
+#include <paper_size.h>
+#include <preview_coords.h>
+
+
+void show_help()
+{
+       printf("Usage: previewgen-tool cmd ...\n"
+               "Commands:"
+               "\n"
+               "help - show help\n"
+               "\n"
+               "init img - generate PDF for image\n"
+               "Arguments:\n"
+               "\tfname toutfname_pdf ppdfname\n"
+               "\tpaper_name paper_s_x paper_s_y\n"
+               "\tav_s_x av_s_y orientation n_up\n"
+               "\tscale_type scale_zoom scale_w scale_h\n"
+               "\tis_grayscale\n"
+               "\n"
+               "init pdf - generate PDF for PDF\n"
+               "Arguments:\n"
+               "\tfname toutfname_pdf ppdfname\n"
+               "\tpaper_name paper_s_x paper_s_y\n"
+               "\torientation n_up\n"
+               "\tscale_type scale_zoom scale_w scale_h\n"
+               "\tis_grayscale\n"
+               "\n"
+               "gen - generate page image for PDF\n"
+               "Arguments:\n"
+               "\tfname page pages_count outfname_ppm\n"
+               "\tpaper_s_x paper_s_y av_s_x av_s_y\n"
+               "\tshadow_x shadow_y is_rotate90 is_grayscale\n"
+               "\n"
+               "pagegen - generate single page image for PDF\n"
+               "\tfname page outfname_ppm\n"
+               "\tpaper_s_x paper_s_y av_s_x av_s_y\n"
+               "\tshadow_x shadow_y is_rotate90 is_grayscale\n"
+               );
+}
+
+
+int parse_page_orientation(char *str, enum page_orientation *res)
+{
+       if (NULL == str || NULL == res) {
+               printf("ERROR in orientation string\n");
+               return -1;
+       }
+
+       if (strcasecmp(str, "portrait") == 0) {
+               *res = PAGE_ORIENTATION_PORTRAIT;
+               return 0;
+       }
+       if (strcasecmp(str, "landscape") == 0) {
+               *res = PAGE_ORIENTATION_LANDSCAPE;
+               return 0;
+       }
+
+       return -1;
+}
+
+
+int parse_scale_type(char *str, enum page_scale_type *res)
+{
+       if (NULL == str || NULL == res) {
+               printf("ERROR in scale type string\n");
+               return -1;
+       }
+
+       if (strcasecmp(str, "fit_to_paper") == 0) {
+               *res = SCALE_FIT_TO_PAPER;
+               return 0;
+       }
+       if (strcasecmp(str, "custom") == 0) {
+               *res = SCALE_CUSTOM;
+               return 0;
+       }
+       if (strcasecmp(str, "relative") == 0) {
+               *res = SCALE_RELATIVE;
+               return 0;
+       }
+       if (strcasecmp(str, "original") == 0) {
+               *res = SCALE_ORIGINAL;
+               return 0;
+       }
+
+       printf("ERROR in scale type string\n");
+       return -1;
+}
+
+
+int process_init_img(int argc, char *argv[])
+{
+       char *fname;
+       char *outfname;
+       char *ppd_fname;
+       struct paper_size_pts paper_size;
+       struct size_px av_size;
+       enum page_orientation orientation;
+       int n_up;
+       struct page_scale scale;
+       int is_grayscale;
+
+       int res;
+       int pages_count;
+
+
+       if (argc < 15) {
+               printf("ERROR in init img arguments count\n");
+               return -1;
+       }
+
+       fname = argv[0];
+       outfname = argv[1];
+       ppd_fname = argv[2];
+
+       paper_size.name = argv[3];
+       paper_size.s.x = atof(argv[4]);
+       paper_size.s.y = atof(argv[5]);
+
+       av_size.x = atoi(argv[6]);
+       av_size.y = atoi(argv[7]);
+
+       if (parse_page_orientation(argv[8], &orientation) < 0)
+               return -1;
+
+       n_up = atoi(argv[9]);
+
+       if (parse_scale_type(argv[10], &(scale.type)) < 0)
+               return -1;
+       scale.zoom = atoi(argv[11]);
+       scale.w = atof(argv[12]);
+       scale.h = atof(argv[13]);
+
+       is_grayscale = atoi(argv[14]);
+
+
+       /* TODO: generate temporary name based on pid */
+       res = process_image_downscale(fname, IMAGE_CONVERT_TEMP_FILE, &av_size);
+       if (res < 0) {
+               printf("ERROR in image downscale\n");
+               return -1;
+       }
+
+       res = img2pdf_preview_pages(IMAGE_CONVERT_TEMP_FILE, outfname,
+                       ppd_fname, &paper_size, &av_size, orientation, n_up,
+                       &scale, is_grayscale);
+       if (res < 0) {
+               printf("ERROR in init img\n");
+               return -1;
+       }
+       pages_count = get_pdf_pages_count(outfname);
+       printf("init img: pages count: %d\n", pages_count);
+       return 0;
+}
+
+
+int process_init_pdf(int argc, char *argv[])
+{
+       char *fname;
+       char *outfname;
+       char *ppd_fname;
+       struct paper_size_pts paper_size;
+       enum page_orientation orientation;
+       int n_up;
+       struct page_scale scale;
+       int is_grayscale;
+
+       int res;
+       int pages_count;
+
+       if (argc < 13) {
+               printf("ERROR in init pdf arguments count\n");
+               return -1;
+       }
+
+       fname = argv[0];
+       outfname = argv[1];
+       ppd_fname = argv[2];
+
+       paper_size.name = argv[3];
+       paper_size.s.x = atof(argv[4]);
+       paper_size.s.y = atof(argv[5]);
+
+       if (parse_page_orientation(argv[6], &orientation) < 0)
+               return -1;
+
+       n_up = atoi(argv[7]);
+
+       if (parse_scale_type(argv[8], &(scale.type)) < 0)
+               return -1;
+       scale.zoom = atoi(argv[9]);
+       scale.w = atof(argv[10]);
+       scale.h = atof(argv[11]);
+
+       is_grayscale = atoi(argv[12]);
+
+
+       res = pdf2pdf_preview_pages(fname, outfname, ppd_fname,
+                       &paper_size, orientation, n_up,
+                       &scale, is_grayscale);
+       if (res < 0) {
+               printf("ERROR in init pdf\n");
+               return -1;
+       }
+       pages_count = get_pdf_pages_count(outfname);
+       printf("init pdf: pages count: %d\n", pages_count);
+       return 0;
+}
+
+
+int process_gen(int argc, char *argv[])
+{
+       char *fname;
+       int page;
+       int pages_count;
+       char *outfname_ppm;
+       struct size_pts paper_size;
+       struct size_px av_size;
+       struct size_px shadow_size;
+       int is_rotate90;
+       int is_grayscale;
+
+       struct preview_page_req settings_req;
+       struct preview_settings_px settings_px;
+
+       int res;
+
+
+       if (argc < 12) {
+               printf("ERROR in gen arguments count\n");
+               return -1;
+       }
+
+       fname = argv[0];
+       page = atoi(argv[1]);
+       pages_count = atoi(argv[2]);
+       outfname_ppm = argv[3];
+
+       paper_size.x = atof(argv[4]);
+       paper_size.y = atof(argv[5]);
+
+       av_size.x = atoi(argv[6]);
+       av_size.y = atoi(argv[7]);
+
+       shadow_size.x = atoi(argv[8]);
+       shadow_size.y = atoi(argv[9]);
+
+       is_rotate90 = atoi(argv[10]);
+       is_grayscale = atoi(argv[11]);
+
+
+       settings_req.paper_size = paper_size;
+       settings_req.available_size_px = av_size;
+       settings_req.shadow_offset = shadow_size;
+       settings_req.is_rotate90 = is_rotate90;
+       settings_req.is_grayscale = is_grayscale;
+
+       if (get_preview_settings(&settings_req, &settings_px) < 0) {
+               printf("ERROR in settings\n");
+               return -1;
+       }
+
+       res = save_pdf_preview_page_image_w_np_fname(fname, page, pages_count,
+                       &settings_px, outfname_ppm);
+       if (res <= 0) {
+               printf("ERROR in preview image generation\n");
+               return -1;
+       }
+       printf("OK\n");
+       return 0;
+}
+
+
+int process_pagegen(int argc, char *argv[])
+{
+       char *pdf_fname;
+       char *outfname_ppm;
+       int page;
+       struct size_pts paper_size;
+       struct size_px av_size;
+       struct size_px shadow_size;
+       int is_rotate90;
+       int is_grayscale;
+
+       struct preview_page_req settings_req;
+       //struct preview_settings_px settings_px;
+
+       int res;
+
+
+       if (argc < 11) {
+               printf("ERROR in gen arguments count\n");
+               return -1;
+       }
+
+       pdf_fname = argv[0];
+       page = atoi(argv[1]);
+       outfname_ppm = argv[2];
+
+       paper_size.x = atof(argv[3]);
+       paper_size.y = atof(argv[4]);
+
+       av_size.x = atoi(argv[5]);
+       av_size.y = atoi(argv[6]);
+
+       shadow_size.x = atoi(argv[7]);
+       shadow_size.y = atoi(argv[8]);
+
+       is_rotate90 = atoi(argv[9]);
+       is_grayscale = atoi(argv[10]);
+
+
+       settings_req.paper_size = paper_size;
+       settings_req.available_size_px = av_size;
+       settings_req.shadow_offset = shadow_size;
+       settings_req.is_rotate90 = is_rotate90;
+       settings_req.is_grayscale = is_grayscale;
+
+       /*if (get_preview_settings(&settings_req, &settings_px) < 0) {
+               printf("ERROR in settings\n");
+               return -1;
+       }*/
+
+       res = save_pdf_preview_page_image(pdf_fname, page,
+                       &settings_req, outfname_ppm);
+       if (res <= 0) {
+               printf("ERROR in preview page image generation\n");
+               return -1;
+       }
+       printf("OK\n");
+       return 0;
+}
+
+
+int process_cmd(int argc, char *argv[])
+{
+       if (strcasecmp("init", argv[1]) == 0) {
+               if (argc <= 2) {
+                       printf("ERROR in init cmd usage\n");
+                       return -1;
+               }
+               if (strcasecmp("img", argv[2]) == 0)
+                       return process_init_img(argc - 2, &(argv[3]));
+               if (strcasecmp("pdf", argv[2]) == 0)
+                       return process_init_pdf(argc - 2, &(argv[3]));
+               printf("ERROR in init cmd usage\n");
+               return -1;
+       }
+
+       if (strcasecmp("gen", argv[1]) == 0)
+               return process_gen(argc - 1, &(argv[2]));
+
+       if (strcasecmp("pagegen", argv[1]) == 0)
+               return process_pagegen(argc - 1, &(argv[2]));
+
+       return 0;
+}
+
+
+int main(int argc, char *argv[])
+{
+       int res;
+
+       if (argc <= 1) {
+               printf("ERROR: no arguments, type help for usage\n");
+               return 1;
+       }
+
+       if (strcasecmp("help", argv[1]) == 0) {
+               show_help();
+               return 0;
+       }
+
+       mkdir("/tmp/mobileprint/", 0777);
+
+       evas_init();
+       res = process_cmd(argc, argv);
+       evas_shutdown();
+       if (res < 0) {
+               printf("Arguments ERROR\n");
+               return 1;
+       }
+
+       return 0;
+}
+
diff --git a/mobileprint/smsc/CMakeLists.txt b/mobileprint/smsc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bd126b8
--- /dev/null
@@ -0,0 +1,8 @@
+INCLUDE(FindPkgConfig)
+pkg_check_modules(smsc_pkgs REQUIRED dlog evas elementary edje
+               ecore ecore-input ecore-x)
+FOREACH(flag ${smsc_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS_SMSC "${EXTRA_CFLAGS_SMSC} ${flag}")
+ENDFOREACH(flag)
+
+ADD_SUBDIRECTORY(lib)
diff --git a/mobileprint/smsc/include/smsc_control.h b/mobileprint/smsc/include/smsc_control.h
new file mode 100644 (file)
index 0000000..85c58ea
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _SMSC_CONTROL_H_INCLUDED_
+#define _SMSC_CONTROL_H_INCLUDED_
+
+#include <Ecore.h>
+
+#include "smsc_position.h"
+
+
+struct smsc_control {
+       int is_pressed;
+       int last_x;
+       //int last_y;
+       //int cur_x;
+       //int cur_y;
+       Ecore_Animator *move_anim;
+       int anim_xdiff;
+       int anim_initial_offset;
+
+       struct smsc_position *position;
+};
+
+
+int init_smsc_control(struct smsc_control *control,
+               struct smsc_position *position);
+
+int reset_smsc_control(struct smsc_control *control);
+int smsc_control_begin_move(struct smsc_control *control, int xpos);
+int smsc_control_process_move(struct smsc_control *control, int xpos);
+int smsc_control_finish_move(struct smsc_control *control, int xpos);
+
+#endif /* _SMSC_CONTROL_H_INCLUDED_ */
+
diff --git a/mobileprint/smsc/include/smsc_debug.h b/mobileprint/smsc/include/smsc_debug.h
new file mode 100644 (file)
index 0000000..6812df9
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef _SMSC_DEBUG_H_INCLUDED_
+#define _SMSC_DEBUG_H_INCLUDED_
+
+//#define SMSC_DEBUG_SILENT
+#ifdef SMSC_DEBUG_SILENT
+#define SMSC_DEBUG
+#define SMSC_TRACE_BEGIN
+#define SMSC_TRACE_END
+#else /* !SMSC_DEBUG_SILENT */
+
+/*#define SMSC_DEBUG_STANDALONE*/
+#ifdef SMSC_DEBUG_STANDALONE
+
+/* standalone debugging */
+#include <stdio.h>
+#define SMSC_DEBUG(fmt, arg...)                do { \
+               printf("DEBUG: %s: " fmt "\n", __FUNCTION__, ##arg); } while (0)
+#define SMSC_TRACE_BEGIN       SMSC_DEBUG("TRACE: %s enter", __FUNCTION__)
+#define SMSC_TRACE_END         SMSC_DEBUG("TRACE: %s leave", __FUNCTION__)
+
+#define SMSC_IF_FREE_MEM(mem) \
+       do { \
+               if(mem) { \
+                       free(mem); \
+                       mem = NULL; \
+               } \
+       } while (0)
+#define SMSC_RET_IF(expr, fmt, args...) \
+       do { \
+               if(expr) { \
+                       PTS_PRT("[%s] Return, message "fmt, #expr, ##args );\
+                       return; \
+               } \
+       } while (0)
+#define SMSC_RETV_IF(expr, val, fmt, args...) \
+       do { \
+               if(expr) { \
+                       PTS_PRT("[%s] Return value, message "fmt, #expr, ##args );\
+                       return (val); \
+               } \
+       } while (0)
+
+#else /* !SMSC_DEBUG_STANDALONE */
+
+#include <pts_debug.h>
+#define SMSC_DEBUG(fmt, arg...)                PTS_DEBUG(fmt, ##arg)
+#define SMSC_TRACE_BEGIN               PTS_TRACE_BEGIN
+#define SMSC_TRACE_END                 PTS_TRACE_END
+
+#define SMSC_IF_FREE_MEM               PTS_IF_FREE_MEM
+#define SMSC_RET_IF                    PTS_RET_IF
+#define SMSC_RETV_IF                   PTS_RETV_IF
+
+#endif /* SMSC_DEBUG_STANDALONE */
+#endif /* SMSC_DEBUG_SILENT */
+
+
+#endif /* _SMSC_DEBUG_H_INCLUDED_ */
+
diff --git a/mobileprint/smsc/include/smsc_position.h b/mobileprint/smsc/include/smsc_position.h
new file mode 100644 (file)
index 0000000..d66f28f
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _SMSC_POSITION_H_INCLUDED_
+#define _SMSC_POSITION_H_INCLUDED_
+
+#include <paper_size.h>
+
+struct smsc_position {
+       int is_configured;
+       struct size_px available_size;
+       struct size_px page_size_px;
+       int page_space;
+       int pages_count;
+       int offset;
+
+       int position_update_event_type;
+};
+
+
+struct smsc_position_event {
+       int is_ok; /* STUB */
+};
+
+
+int init_smsc_position(struct smsc_position *position);
+int set_smsc_position_settings(struct smsc_position *position, int pages_count,
+               const struct size_px *available_size_px,
+               const struct size_pts *page_size);
+int get_smsc_position_all_width(const struct smsc_position *position);
+int get_smsc_position_cur_page(const struct smsc_position *position);
+int *get_smsc_position_visible_pages(const struct smsc_position *position);
+int get_smsc_position_page(const struct smsc_position *position,
+               int page, int *is_ok);
+int get_smsc_position_cur_page_center_xdiff(
+               const struct smsc_position *position, int *is_ok);
+int move_smsc_position(struct smsc_position *position, int xdiff);
+int set_smsc_position(struct smsc_position *position, int offset);
+
+
+#endif /* _SMSC_POSITION_H_INCLUDED_ */
+
diff --git a/mobileprint/smsc/include/smsc_smart.h b/mobileprint/smsc/include/smsc_smart.h
new file mode 100644 (file)
index 0000000..b6d4789
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _SMSC_SMART_H_INCLUDED_
+#define _SMSC_SMART_H_INCLUDED_
+
+#include <Evas.h>
+
+#include <paper_size.h>
+#include <pdfgen.h>
+
+
+Evas_Object *evas_smart_smsc_add(Evas *evas);
+int evas_smart_smsc_set_file(Evas_Object *o, const char *fname,
+               const char *ppd, const struct paper_size_pts *paper_size,
+               enum page_orientation orientation, int n_up,
+               const struct page_scale *scale, int is_grayscale);
+int evas_smart_smsc_set_layout(Evas_Object *o, Evas_Object *layout);
+
+
+#endif /* _SMSC_SMART_H_INCLUDED_ */
+
diff --git a/mobileprint/smsc/include/smsc_widget.h b/mobileprint/smsc/include/smsc_widget.h
new file mode 100644 (file)
index 0000000..9100941
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef _SMSC_WIDGET_H_INCLUDED_
+#define _SMSC_WIDGET_H_INCLUDED_
+
+
+#include <Elementary.h>
+#include <Eina.h>
+
+#include <preview_engine.h>
+
+#include "smsc_control.h"
+#include "smsc_position.h"
+
+
+struct smsc_page_data {
+       int num;
+       Evas_Object *page_obj;
+};
+
+struct smsc_widget {
+       int is_ready;
+       Eina_List *pages_list;
+
+       struct smsc_position position;
+       struct smsc_control control;
+
+       Evas_Object *loading_animation;
+       Evas_Object *parent;
+       Evas_Object *layout;
+
+       Evas *canvas;
+
+       int posy;
+
+       int off_x;
+       int off_y;
+
+       struct preview_engine engine;
+};
+
+
+int init_smsc_widget(struct smsc_widget *widget, Evas_Object *parent);
+int clear_smsc_position_settings(struct smsc_position *position);
+
+int clear_smsc_widget(struct smsc_widget *widget);
+int hide_smsc_widget(struct smsc_widget *widget);
+int show_smsc_widget(struct smsc_widget *widget);
+int smsc_widget_set_layout(struct smsc_widget *widget, Evas_Object *layout);
+
+
+#endif /* _SMSC_WIDGET_H_INCLUDED_ */
+
diff --git a/mobileprint/smsc/lib/CMakeLists.txt b/mobileprint/smsc/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fb88ed7
--- /dev/null
@@ -0,0 +1,5 @@
+FILE(GLOB SRCS *.c)
+
+ADD_LIBRARY(smsc ${SRCS})
+SET_TARGET_PROPERTIES(smsc PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS_SMSC} -fpie")
+
diff --git a/mobileprint/smsc/lib/smsc_control.c b/mobileprint/smsc/lib/smsc_control.c
new file mode 100644 (file)
index 0000000..2d55111
--- /dev/null
@@ -0,0 +1,112 @@
+#include <string.h>
+
+#include "smsc_debug.h"
+
+#include "smsc_control.h"
+
+
+int init_smsc_control(struct smsc_control *control,
+               struct smsc_position *position)
+{
+       memset(control, 0, sizeof(struct smsc_control));
+
+       control->position = position;
+
+       control->is_pressed = 0;
+       control->last_x = 0;
+       control->move_anim = NULL;
+       //control->last_y = 0;
+       //control->cur_x = 0;
+       //control->cur_y = 0;
+
+       return 0;
+}
+
+
+int smsc_control_remove_animator(struct smsc_control *control)
+{
+       SMSC_RETV_IF(NULL == control, -1, "Argument error");
+       if (NULL == control->move_anim)
+               return 0;
+
+       ecore_animator_del(control->move_anim);
+       control->move_anim = NULL;
+
+       return 0;
+}
+
+
+int reset_smsc_control(struct smsc_control *control)
+{
+       control->is_pressed = 0;
+       smsc_control_remove_animator(control);
+       return 0;
+}
+
+
+int smsc_control_begin_move(struct smsc_control *control, int xpos)
+{
+       SMSC_RETV_IF(NULL == control, -1, "Argument error");
+
+       control->is_pressed = 1;
+       control->last_x = xpos;
+
+       SMSC_DEBUG("smsc_control_begin_move()");
+       smsc_control_remove_animator(control);
+
+       return 0;
+}
+
+
+int smsc_control_process_move(struct smsc_control *control, int xpos)
+{
+       int xpos_diff;
+
+       SMSC_RETV_IF(NULL == control, -1, "Argument error");
+
+       if (control->is_pressed) {
+               xpos_diff = control->last_x - xpos;
+               //int all_width = get_smsc_position_all_width(control->position);
+               /* simple stubbed logic */
+               /* TODO: inertia, fixation */
+               //SMSC_DEBUG("smsc_control_process_move(): moving");
+               move_smsc_position(control->position, xpos_diff);
+               control->last_x = xpos;
+       }
+
+       return 0;
+}
+
+
+static Eina_Bool smsc_control_pagefix_anim(void *data, double pos)
+{
+       struct smsc_control *control = (struct smsc_control*)data;
+       SMSC_RETV_IF(NULL == control, ECORE_CALLBACK_CANCEL, "Argument error");
+       /* TODO */
+       set_smsc_position(control->position, pos * control->anim_xdiff
+                       + control->anim_initial_offset);
+       return ECORE_CALLBACK_RENEW;
+}
+
+
+int smsc_control_finish_move(struct smsc_control *control, int xpos)
+{
+       int is_ok;
+       SMSC_RETV_IF(NULL == control, -1, "Argument error");
+       SMSC_DEBUG("smsc_control_finish_move()");
+       /* provide page center fixation */
+       /* provide animated fixation */
+       control->anim_xdiff = get_smsc_position_cur_page_center_xdiff(
+                       control->position, &is_ok);
+       SMSC_RETV_IF(0 == is_ok, -1, "Current xdiff calculation ERROR");
+       control->anim_initial_offset = control->position->offset;
+       smsc_control_remove_animator(control);
+       control->move_anim = ecore_animator_timeline_add(
+                       0.2, smsc_control_pagefix_anim, control);
+
+       control->last_x = xpos;
+       control->is_pressed = 0;
+
+       return 0;
+}
+
diff --git a/mobileprint/smsc/lib/smsc_position.c b/mobileprint/smsc/lib/smsc_position.c
new file mode 100644 (file)
index 0000000..72a20fd
--- /dev/null
@@ -0,0 +1,277 @@
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <Ecore.h>
+
+#include <preview_coords.h>
+
+#include "smsc_debug.h"
+
+#include "smsc_position.h"
+
+
+int init_smsc_position(struct smsc_position *position)
+{
+       SMSC_DEBUG("init_smsc_position() started");
+
+       memset(position, 0, sizeof(struct smsc_position));
+
+       /* event of position update */
+       position->position_update_event_type = ecore_event_type_new();
+
+       SMSC_DEBUG("init_smsc_position() finished");
+
+       return 0;
+}
+
+
+int set_smsc_position_settings(struct smsc_position *position, int pages_count,
+               const struct size_px *available_size_px,
+               const struct size_pts *page_size)
+{
+       /* calculate page size in pixels */
+       struct size_pts min_area_size;
+       struct size_px min_area_size_px;
+       //int vis_pages = 3;
+
+       position->is_configured = 1;
+       position->pages_count = pages_count;
+       position->available_size = *available_size_px;
+       position->offset = 0;
+
+       min_area_size.x = page_size->x
+               * (1 + PAGE_SIDE_SHOW_COEFF * 2 + MIN_PAGE_SPACE_COEFF * 2);
+       min_area_size.y = page_size->y;
+
+       if (pts_size2px(&min_area_size, available_size_px,
+                       &min_area_size_px) < 0) {
+               //PGEN_DEBUG("ERROR: full_size: pts_size2px()\n");
+               return -1;
+       }
+
+       position->page_size_px.x = min_area_size_px.x
+               / (1 + PAGE_SIDE_SHOW_COEFF * 2 + MIN_PAGE_SPACE_COEFF * 2);
+       position->page_size_px.y = min_area_size_px.y;
+       SMSC_DEBUG("init_smsc_position(): page_size_px: (%d, %d)",
+                       position->page_size_px.x, position->page_size_px.y);
+
+       return 0;
+}
+
+
+int clear_smsc_position_settings(struct smsc_position *position)
+{
+       position->is_configured = 0;
+       return 0;
+}
+
+
+int get_smsc_position_all_width(const struct smsc_position *position)
+{
+       if (position->is_configured == 0)
+               return -1;
+       if (1 == position->pages_count)
+               return 0;
+       return position->page_size_px.x * (position->pages_count - 1)
+               * (1 + MIN_PAGE_SPACE_COEFF);
+}
+
+
+int get_smsc_position_cur_page(const struct smsc_position *position)
+{
+       float res;
+
+       if (NULL == position)
+               return -1;
+
+       /*SMSC_DEBUG("position->offset = %d", position->offset);
+       SMSC_DEBUG("position->page_size_px.x = %d", position->page_size_px.x);
+       SMSC_DEBUG("MIN_PAGE_SPACE_COEFF = %f", MIN_PAGE_SPACE_COEFF);
+       SMSC_DEBUG("position->pages_count = %d", position->pages_count);*/
+       res = (position->offset + (position->page_size_px.x / 2)
+                       * (1 + MIN_PAGE_SPACE_COEFF))
+               / (position->page_size_px.x * (1 + MIN_PAGE_SPACE_COEFF));
+       //SMSC_DEBUG("res = %f", res);
+       if (res >= position->pages_count)
+               return position->pages_count - 1;
+       else if (res < 0)
+               return 0;
+
+       return res;
+}
+
+int get_smsc_position_max_vispages_count(const struct smsc_position *position)
+{
+       int all_sizex;
+       int page_sizex;
+       int page_count;
+
+       if (NULL == position)
+               return -1;
+
+       page_sizex = position->page_size_px.x;
+       all_sizex = position->available_size.x;
+       page_count = ceil(all_sizex * (1 + MIN_PAGE_SPACE_COEFF)
+                       / (page_sizex * (1 + MIN_PAGE_SPACE_COEFF)));
+       //SMSC_DEBUG("page_count = %d", page_count);
+       if (page_count > 0) {
+               /* provide odd page_count to have central page */
+               page_count = page_count + 1 - page_count % 2;
+               //SMSC_DEBUG("corrected page_count = %d", page_count);
+               return page_count;
+       }
+       return 1;
+}
+
+int *get_smsc_position_visible_pages(const struct smsc_position *position)
+{
+       int *res;
+       int cur_page_i;
+       int cur_page;
+       int max_vispage_count;
+       int vispages_right;
+       int vispages_left;
+       int vispages;
+       int middle_page;
+       int i;
+
+       if (position->is_configured == 0)
+               return NULL;
+
+       if (1 == position->pages_count) {
+               res = malloc(sizeof(int) * (1 + 1));
+               res[0] = 0;
+               res[1] = -1;
+               return res;
+       }
+
+       cur_page_i = get_smsc_position_cur_page(position);
+       if (cur_page_i < 0)
+               return NULL;
+       cur_page = cur_page_i + 1;
+       max_vispage_count = get_smsc_position_max_vispages_count(position);
+       if (max_vispage_count < 1)
+               return NULL;
+
+       middle_page = 1 + max_vispage_count / 2;
+       vispages_left = cur_page - 1;
+       if (vispages_left > middle_page - 1)
+               vispages_left = middle_page - 1;
+       vispages_right = position->pages_count - cur_page;
+       if (vispages_right > middle_page - 1)
+               vispages_right = middle_page - 1;
+       vispages = vispages_right + vispages_left + 1;
+
+       res = malloc(sizeof(int) * (vispages + 1));
+       if (NULL == res)
+               return NULL;
+       /*SMSC_DEBUG("vispages = %d, vispages_left = %d, vispages_right = %d, "
+                       "middle_page = %d",
+                       vispages, vispages_left, vispages_right, middle_page);*/
+
+       for (i = 0; i < vispages; ++i)
+               res[i] = cur_page + (i + 1 - (vispages_left + 1)) - 1;
+       res[vispages] = -1;
+
+       return res;
+}
+
+
+int get_smsc_position_page(const struct smsc_position *position,
+               int page, int *is_ok)
+{
+       int res;
+
+       SMSC_RETV_IF(NULL == position || NULL == is_ok, -1, "Argument error");
+
+       *is_ok = 1;
+       if (position->is_configured == 0) {
+               *is_ok = 0;
+               return 0;
+       }
+       if (NULL == position || page < 0 || page >= position->pages_count) {
+               /*SMSC_DEBUG("ERROR in get_smsc_position_page(), page = %d,"
+                               " pages_count = %d",
+                               page, position->pages_count);*/
+               *is_ok = 0;
+               return 0;
+       }
+       res = position->available_size.x / 2 - position->offset
+               + page * position->page_size_px.x
+               * (1 + MIN_PAGE_SPACE_COEFF)
+               - position->page_size_px.x / 2;
+       //SMSC_DEBUG("get_smsc_position_page(): page %d: res = %d", page, res);
+       return res;
+}
+
+
+int get_smsc_position_cur_page_center_xdiff(
+               const struct smsc_position *position, int *is_ok)
+{
+       int page;
+       int res;
+       SMSC_RETV_IF(NULL == is_ok, -1, "Argument error");
+       *is_ok = 0;
+       SMSC_RETV_IF(NULL == position, -1, "Argument error");
+       *is_ok = 1;
+       page = get_smsc_position_cur_page(position);
+       SMSC_RETV_IF(page < 0, -1, "Error in current page calculation");
+       res = page * (position->page_size_px.x * (1 + MIN_PAGE_SPACE_COEFF))
+                       - position->offset;
+       return res;
+}
+
+
+int move_smsc_position(struct smsc_position *position, int xdiff)
+{
+       struct smsc_position_event *event_data;
+       int all_width;
+
+       SMSC_RETV_IF(NULL == position, -1, "Argument error");
+       SMSC_RETV_IF(position->is_configured == 0, -1, "Not configured");
+
+       all_width = get_smsc_position_all_width(position);
+       SMSC_RETV_IF(all_width < 0, -1, "Width calculation error");
+       //SMSC_DEBUG("move_smsc_position() started");
+       if (xdiff + position->offset >= all_width)
+               position->offset = all_width;
+       else if (xdiff + position->offset <= 0)
+               position->offset = 0;
+       else
+               position->offset = position->offset + xdiff;
+
+       /* emit ecore event */
+       event_data = malloc(sizeof(struct smsc_position_event));
+       memset(event_data, 0, sizeof(struct smsc_position_event));
+       ecore_event_add(position->position_update_event_type,
+                       event_data, NULL, NULL);
+
+       return 0;
+}
+
+
+int set_smsc_position(struct smsc_position *position, int offset)
+{
+       struct smsc_position_event *event_data;
+       int all_width;
+
+       SMSC_RETV_IF(NULL == position || offset < 0, -1, "Argument error");
+
+       all_width = get_smsc_position_all_width(position);
+       SMSC_RETV_IF(all_width < 0, -1, "Width calculation error");
+
+       if (offset >= all_width)
+               position->offset = all_width;
+       else
+               position->offset = offset;
+
+       /* emit ecore event */
+       event_data = malloc(sizeof(struct smsc_position_event));
+       memset(event_data, 0, sizeof(struct smsc_position_event));
+       ecore_event_add(position->position_update_event_type,
+                       event_data, NULL, NULL);
+
+       return 0;
+}
+
diff --git a/mobileprint/smsc/lib/smsc_smart.c b/mobileprint/smsc/lib/smsc_smart.c
new file mode 100644 (file)
index 0000000..85a2a28
--- /dev/null
@@ -0,0 +1,279 @@
+#include <Evas.h>
+
+#include "smsc_debug.h"
+#include "smsc_widget.h"
+
+#include "smsc_smart.h"
+
+
+#define _evas_smart_smsc_type "Evas_Smart_Smsc"
+
+
+#define _evas_smart_smsc_type          "Evas_Smart_Smsc"
+#define EVT_CHILDREN_NUMBER_CHANGED    "children,changed"
+
+
+static const Evas_Smart_Cb_Description _smart_callbacks[] =
+{
+   {EVT_CHILDREN_NUMBER_CHANGED, "i"},
+   {NULL, NULL}
+};
+
+
+struct _Evas_Smart_Smsc_Data {
+       Evas_Object_Smart_Clipped_Data base;
+       struct smsc_widget widget;
+       //Evas_Object *children[2];
+       /*Evas_Object *rect;
+       Evas_Object *bg;*/
+       int is_ready;
+       struct size_px widget_size;
+
+       int is_process_file;
+       char *fname;
+       char *ppd;
+       struct paper_size_pts paper_size;
+       enum page_orientation orientation;
+       int n_up;
+       struct page_scale scale;
+       int is_grayscale;
+};
+
+
+typedef struct _Evas_Smart_Smsc_Data Evas_Smart_Smsc_Data;
+
+
+#define EVAS_SMART_SMSC_DATA_GET(o, ptr) \
+       Evas_Smart_Smsc_Data *ptr = evas_object_smart_data_get(o)
+
+#define EVAS_SMART_SMSC_DATA_GET_OR_RETURN(o, ptr)             \
+       EVAS_SMART_SMSC_DATA_GET(o, ptr);                       \
+       if (!ptr) {                                             \
+               fprintf(stderr, "No widget data for object %p (%s)!", \
+                               o, evas_object_type_get(o));    \
+               fflush(stderr);                                 \
+               abort();                                        \
+               return;                                         \
+       }
+
+#define EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, ptr, val)    \
+       EVAS_SMART_SMSC_DATA_GET(o, ptr);                       \
+       if (!ptr) {                                             \
+               fprintf(stderr, "No widget data for object %p (%s)!", \
+                               o, evas_object_type_get(o));    \
+               fflush(stderr);                                 \
+               abort();                                        \
+               return val;                                     \
+       }
+
+EVAS_SMART_SUBCLASS_NEW(_evas_smart_smsc_type, _evas_smart_smsc,
+               Evas_Smart_Class, Evas_Smart_Class,
+               evas_object_smart_clipped_class_get, _smart_callbacks);
+
+
+static void _evas_smart_smsc_smart_add(Evas_Object *o)
+{
+       SMSC_TRACE_BEGIN;
+       EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Smsc_Data);
+
+       /*priv->bg = evas_object_rectangle_add(evas_object_evas_get(o));
+       evas_object_color_set(priv->bg, 0, 255, 0, 255);
+       evas_object_smart_member_add(priv->bg, o);
+
+       priv->rect = evas_object_rectangle_add(evas_object_evas_get(o));
+       evas_object_color_set(priv->rect, 255, 0, 0, 255);
+       evas_object_smart_member_add(priv->rect, o);*/
+
+       init_smsc_widget(&(priv->widget), o);
+       priv->is_ready = 0;
+       memset(&(priv->widget_size), 0, sizeof(priv->widget_size));
+
+       priv->is_process_file = 0;
+       priv->fname = NULL;
+       priv->ppd = NULL;
+       memset(&(priv->paper_size), 0, sizeof(priv->paper_size));
+       priv->orientation = PAGE_ORIENTATION_PORTRAIT;
+       priv->n_up = 1;
+       memset(&(priv->scale), 0, sizeof(priv->scale));
+       priv->is_grayscale = 0;
+
+       _evas_smart_smsc_parent_sc->add(o);
+       SMSC_TRACE_END;
+}
+
+
+static void _evas_smart_smsc_smart_del(Evas_Object *o)
+{
+       //EVAS_SMART_SMSC_DATA_GET(o, priv);
+
+       /* remove childrens */
+       /* TODO: destroy smsc_widget */
+
+       _evas_smart_smsc_parent_sc->del(o);
+}
+
+
+static void _evas_smart_smsc_smart_show(Evas_Object *o)
+{
+       EVAS_SMART_SMSC_DATA_GET(o, priv);
+       /* show smsc_widget */
+       show_smsc_widget(&(priv->widget));
+       _evas_smart_smsc_parent_sc->show(o);
+}
+
+
+static void _evas_smart_smsc_smart_hide(Evas_Object *o)
+{
+       EVAS_SMART_SMSC_DATA_GET(o, priv);
+       /* hide childrens */
+       /* TODO: save hide state for smsc_widget */
+       hide_smsc_widget(&(priv->widget));
+       _evas_smart_smsc_parent_sc->hide(o);
+}
+
+
+static void _evas_smart_smsc_smart_move(Evas_Object *o,
+               Evas_Coord x, Evas_Coord y)
+{
+       /* TODO: correct move event usage (provide picture moving animation) */
+       /*SMSC_TRACE_BEGIN;
+       SMSC_TRACE_END;*/
+}
+
+
+static void _evas_smart_smsc_smart_resize(Evas_Object *o,
+               Evas_Coord w, Evas_Coord h)
+{
+       SMSC_TRACE_BEGIN;
+       Evas_Coord ow, oh;
+       evas_object_geometry_get(o, NULL, NULL, &ow, &oh);
+       if ((ow == w) && (oh == h)) {
+               SMSC_TRACE_END;
+               return;
+       }
+
+       evas_object_smart_changed(o);
+       SMSC_TRACE_END;
+}
+
+
+void evas_smart_smsc_free_process_file_args(Evas_Smart_Smsc_Data *priv)
+{
+       SMSC_RET_IF(NULL == priv, "priv is NULL");
+       SMSC_IF_FREE_MEM(priv->fname);
+       SMSC_IF_FREE_MEM(priv->ppd);
+       SMSC_IF_FREE_MEM(priv->paper_size.name);
+
+       priv->is_process_file = 0;
+}
+
+
+static void _evas_smart_smsc_smart_calculate(Evas_Object *o)
+{
+       SMSC_TRACE_BEGIN;
+       Evas_Coord x, y, w, h;
+
+       EVAS_SMART_SMSC_DATA_GET_OR_RETURN(o, priv);
+       evas_object_geometry_get(o, &x, &y, &w, &h);
+       SMSC_DEBUG("Geometry: (%d, %d) : (%d, %d)",
+                       x, y, w, h);
+
+       /* change children sizes */
+       /*evas_object_resize(priv->rect, w - 10, h - 10);
+       evas_object_move(priv->rect, x + 5, y + 5);
+       evas_object_resize(priv->bg, w, h);
+       evas_object_move(priv->bg, 0, 0);*/
+
+       priv->widget_size.x = w;
+       priv->widget_size.y = h;
+       priv->is_ready = 1;
+
+       /* set widget offset */
+       priv->widget.off_x = x;
+       priv->widget.off_y = y;
+
+       clear_smsc_widget(&(priv->widget));
+
+       /* request to preview_engine for recalculation */
+       if (priv->is_process_file)
+               process_preview_engine_file(&(priv->widget.engine), priv->fname,
+                               priv->ppd, &(priv->paper_size),
+                               &(priv->widget_size), priv->orientation,
+                               priv->n_up, &(priv->scale), priv->is_grayscale);
+
+       SMSC_TRACE_END;
+}
+
+
+/* set smart interface */
+static void _evas_smart_smsc_smart_set_user(Evas_Smart_Class *sc)
+{
+       SMSC_TRACE_BEGIN;
+       sc->add = _evas_smart_smsc_smart_add;
+       sc->del = _evas_smart_smsc_smart_del;
+       sc->show = _evas_smart_smsc_smart_show;
+       sc->hide = _evas_smart_smsc_smart_hide;
+       sc->move = _evas_smart_smsc_smart_move;
+
+       sc->resize = _evas_smart_smsc_smart_resize;
+       sc->calculate = _evas_smart_smsc_smart_calculate;
+       SMSC_TRACE_END;
+}
+
+
+Evas_Object *evas_smart_smsc_add(Evas *evas)
+{
+       Evas_Object *res;
+       SMSC_TRACE_BEGIN;
+       res = evas_object_smart_add(evas, _evas_smart_smsc_smart_class_new());
+       SMSC_TRACE_END;
+       return res;
+}
+
+
+int evas_smart_smsc_set_file(Evas_Object *o, const char *fname,
+               const char *ppd, const struct paper_size_pts *paper_size,
+               enum page_orientation orientation, int n_up,
+               const struct page_scale *scale, int is_grayscale)
+{
+       int res = 0;
+       SMSC_TRACE_BEGIN;
+       EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, priv, -1);
+
+       /* save configuration for future usage */
+       evas_smart_smsc_free_process_file_args(priv);
+
+       priv->fname = strdup(fname);
+       priv->ppd = strdup(ppd);
+       priv->paper_size = *paper_size;
+       priv->paper_size.name = strdup(paper_size->name);
+       priv->orientation = orientation;
+       priv->n_up = n_up;
+       priv->scale = *scale;
+       priv->is_grayscale = is_grayscale;
+
+       priv->is_process_file = 1;
+
+       /* TODO: clear widget */
+
+       /* request preview_engine for recalculation */
+       if (priv->is_ready) {
+               clear_smsc_widget(&(priv->widget));
+               res = process_preview_engine_file(&(priv->widget.engine),
+                               priv->fname, priv->ppd, &(priv->paper_size),
+                               &(priv->widget_size), priv->orientation,
+                               priv->n_up, &(priv->scale), priv->is_grayscale);
+       }
+
+       SMSC_TRACE_END;
+       return res;
+}
+
+
+int evas_smart_smsc_set_layout(Evas_Object *o, Evas_Object *layout)
+{
+       EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, priv, -1);
+       smsc_widget_set_layout(&(priv->widget), layout);
+       return 0;
+}
+
diff --git a/mobileprint/smsc/lib/smsc_widget.c b/mobileprint/smsc/lib/smsc_widget.c
new file mode 100644 (file)
index 0000000..e49057e
--- /dev/null
@@ -0,0 +1,633 @@
+#include <page_preview.h>
+
+//#include <pts_debug.h>
+
+#include "smsc_debug.h"
+
+#include "smsc_widget.h"
+
+
+#define SMSC_WIDGET_EMPTY_PAGE_FNAME   "/tmp/mobileprint/empty_page.ppm"
+/* TODO: automatically calculate initial position */
+#define SMSC_WIDGET_POSX               250
+
+
+int add_smsc_widget_page(struct smsc_widget *widget, int page_num)
+{
+       struct smsc_page_data *page_data;
+       int posx;
+       int is_ok;
+       char img_fname[sizeof("/tmp/mobileprint/mobileprint_xxxx.ppm ")];
+
+       /*int w;
+       int h;
+       int x;
+       int y;*/
+
+       SMSC_TRACE_BEGIN;
+
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+       SMSC_RETV_IF(page_num < 0
+                       || widget->engine.p_model.conf.pages_count <= 0
+                       || widget->engine.p_model.conf.pages_count <= page_num,
+                       -1, "Incorrect page number");
+
+       posx = get_smsc_position_page(&(widget->position), page_num, &is_ok);
+       SMSC_RETV_IF(!is_ok, -1, "Error in page position");
+
+       sprintf(img_fname,
+                       "/tmp/mobileprint/mobileprint_%04d.ppm", page_num + 1);
+       page_data = (struct smsc_page_data*)
+                               malloc(sizeof(struct smsc_page_data));
+       SMSC_RETV_IF(NULL == page_data, -1, "Memory allocation error");
+       page_data->num = page_num;
+
+       //page_data->page_obj = evas_object_rectangle_add(widget->canvas);
+       page_data->page_obj = evas_object_image_filled_add(widget->canvas);
+       if (widget->engine.p_model.pages_state[page_num + 1]
+                       == PREVIEW_PAGE_STATE_READY) {
+               SMSC_DEBUG("loading image %s", img_fname);
+               evas_object_image_file_set(
+                               page_data->page_obj, img_fname, NULL);
+       } else {
+               SMSC_DEBUG("page %d state: %d", page_num + 1,
+                               widget->engine.p_model
+                                       .pages_state[page_num + 1]);
+               evas_object_image_file_set(page_data->page_obj,
+                               SMSC_WIDGET_EMPTY_PAGE_FNAME, NULL);
+       }
+       //evas_object_color_set(page_data->page_obj, 0, 0, 0, 255);
+
+       SMSC_DEBUG("posx = %d,"
+                       " widget->off_x = %d",
+                       posx, widget->off_x);
+       evas_object_move(page_data->page_obj,
+                       posx + widget->off_x, widget->posy);
+       evas_object_resize(page_data->page_obj,
+                       widget->position.page_size_px.x,
+                       widget->position.page_size_px.y);
+       evas_object_pass_events_set(page_data->page_obj, EINA_TRUE);
+       /* add object to smart object */
+       evas_object_smart_member_add(page_data->page_obj, widget->parent);
+       evas_object_show(page_data->page_obj);
+
+       widget->pages_list = eina_list_append(
+                       widget->pages_list, (void*)page_data);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int destroy_smsc_widget_page(struct smsc_page_data *page_data)
+{
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == page_data, -1, "Invalid page data pointer");
+
+       evas_object_hide(page_data->page_obj);
+       evas_object_del(page_data->page_obj);
+       free(page_data);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int destroy_smsc_widget_pages(struct smsc_widget *widget)
+{
+       struct smsc_page_data* page_data;
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+       EINA_LIST_FREE(widget->pages_list, page_data)
+               destroy_smsc_widget_page(page_data);
+       widget->pages_list = NULL;
+       SMSC_TRACE_END;
+
+       return 0;
+}
+
+
+int update_smsc_widget_page(struct smsc_widget *widget, int page_num)
+{
+       Eina_List *cur_page = NULL;
+       char img_fname[sizeof("/tmp/mobileprint/mobileprint_xxxx.ppm ")];
+       struct smsc_page_data* page_data;
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+       SMSC_RETV_IF(page_num < 0
+                       || widget->engine.p_model.conf.pages_count <= 0
+                       || widget->engine.p_model.conf.pages_count <= page_num,
+                       -1, "Incorrect page number");
+
+       if (widget->engine.p_model.pages_state[page_num + 1]
+                       != PREVIEW_PAGE_STATE_READY)
+               return -1;
+
+       sprintf(img_fname,
+                       "/tmp/mobileprint/mobileprint_%04d.ppm", page_num + 1);
+       SMSC_DEBUG("page_num = %d", page_num);
+
+       EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data)
+               if (page_data->num == page_num)
+                       evas_object_image_file_set(
+                                       page_data->page_obj, img_fname, NULL);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int update_smsc_widget_positions(struct smsc_widget *widget)
+{
+       int *vis_pages;
+       int i;
+       Eina_List *old_pages_list = NULL;
+       Eina_List *cur_page = NULL;
+       int is_found;
+       int posx;
+       int is_ok;
+       struct smsc_page_data* page_data;
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+       //SMSC_DEBUG("update_smsc_widget_positions() started");
+
+       vis_pages = get_smsc_position_visible_pages(&(widget->position));
+       SMSC_RETV_IF(NULL == vis_pages, -1, "Invalid visible pages list");
+
+       /* construct new visible pages list */
+       old_pages_list = widget->pages_list;
+       widget->pages_list = NULL;
+       EINA_LIST_FREE(old_pages_list, page_data) {
+               is_found = 0;
+               if (page_data != NULL) {
+                       for (i = 0; vis_pages[i] >= 0; ++i) {
+                               /*SMSC_DEBUG("update_smsc_widget_positions():"
+                                               " i = %d, vis_pages[i] = %d", i,
+                                               vis_pages[i]);*/
+                               if (page_data->num == vis_pages[i]) {
+                                       is_found = 1;
+                                       /* move page to new list */
+                                       widget->pages_list = eina_list_append(
+                                                       widget->pages_list,
+                                                       page_data);
+                                       posx = get_smsc_position_page(
+                                                       &(widget->position),
+                                                       vis_pages[i], &is_ok);
+                                       /*SMSC_DEBUG("posx = %d,"
+                                                       " widget->off_x = %d",
+                                                       posx, widget->off_x);*/
+                                       if (is_ok)
+                                               evas_object_move(
+                                                       page_data->page_obj,
+                                                       posx + widget->off_x,
+                                                       widget->posy);
+                               }
+                       }
+                       if (!is_found)
+                               destroy_smsc_widget_page(page_data);
+               }
+       }
+
+       /* add new pages */
+       for (i = 0; vis_pages[i] >= 0; ++i) {
+               is_found = 0;
+               EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data)
+                       if (page_data != NULL && page_data->num == vis_pages[i])
+                               is_found = 1;
+               if (!is_found) {
+                       /*SMSC_DEBUG("update_smsc_widget_positions(): adding,"
+                                       " i = %d, vis_pages[i] = %d",
+                                       i, vis_pages[i]);*/
+                       add_smsc_widget_page(widget, vis_pages[i]);
+               }
+       }
+
+       free(vis_pages);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int hide_smsc_widget(struct smsc_widget *widget)
+{
+       Eina_List *cur_page = NULL;
+       struct smsc_page_data* page_data;
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+
+       EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data)
+               if (page_data != NULL)
+                       evas_object_hide(page_data->page_obj);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int show_smsc_widget(struct smsc_widget *widget)
+{
+       Eina_List *cur_page = NULL;
+       struct smsc_page_data* page_data;
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+
+       EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data)
+               if (page_data != NULL)
+                       evas_object_show(page_data->page_obj);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+Evas_Object *loading_animation_add(Evas_Object *parent)
+{
+       Evas_Object *res;
+       res = elm_progressbar_add(parent);
+       SMSC_RETV_IF(res == NULL, NULL, "res is NULL");
+
+       elm_object_style_set(res, "list_process");
+       evas_object_size_hint_align_set(res, EVAS_HINT_FILL, 0.5);
+       evas_object_size_hint_weight_set(res, EVAS_HINT_EXPAND,
+                       EVAS_HINT_EXPAND);
+       elm_progressbar_pulse(res, EINA_TRUE);
+       return res;
+}
+
+
+void show_smsc_widget_loading_animation(struct smsc_widget *widget)
+{
+       SMSC_TRACE_BEGIN;
+       SMSC_RET_IF(NULL == widget || NULL == widget->loading_animation,
+                       "Invalid widget pointer");
+
+       evas_object_move(widget->loading_animation,
+                       widget->off_x, widget->off_y);
+       evas_object_resize(widget->loading_animation,
+                       widget->position.available_size.x,
+                       widget->position.available_size.y);
+       evas_object_raise(widget->loading_animation);
+       evas_object_show(widget->loading_animation);
+       SMSC_TRACE_END;
+}
+
+
+void hide_smsc_widget_loading_animation(struct smsc_widget *widget)
+{
+       SMSC_TRACE_BEGIN;
+       SMSC_RET_IF(NULL == widget, "Invalid widget pointer");
+       if (NULL == widget->loading_animation)
+               return;
+       evas_object_hide(widget->loading_animation);
+       SMSC_TRACE_END;
+}
+
+
+int update_smsc_widget_loading_animation(struct smsc_widget *widget)
+{
+       int page_num;
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+       page_num = get_smsc_position_cur_page(&widget->position);
+       if (widget->engine.p_model.conf.pages_count <= 0) {
+               show_smsc_widget_loading_animation(widget);
+               SMSC_TRACE_END;
+               return 0;
+       }
+       if (widget->engine.p_model.pages_state[page_num + 1]
+                       != PREVIEW_PAGE_STATE_READY)
+               show_smsc_widget_loading_animation(widget);
+       else
+               hide_smsc_widget_loading_animation(widget);
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int smsc_widget_update_page_number(struct smsc_widget *widget)
+{
+       int page_num;
+       char pages[16];
+
+       Evas *e;
+       int x;
+       int y;
+       int w;
+       int h;
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+
+       page_num = get_smsc_position_cur_page(&widget->position);
+       /* update page number */
+       if (widget->position.pages_count > 1) {
+               snprintf(pages, 15, "%d / %d",
+                               page_num + 1, widget->position.pages_count);
+               pages[15] = '\0';
+       } else {
+               strcpy(pages, " ");
+       }
+       edje_object_part_text_set(elm_layout_edje_get(widget->layout),
+                       "pagenumber", pages);
+
+       /* !!! hack to enforce text updating to avoid text image caching */
+       e = evas_object_evas_get(widget->layout);
+       evas_output_viewport_get(e, &x, &y, &w, &h);
+       /* enforce bottom updating */
+       evas_damage_rectangle_add(e, 0, h * 3 / 4, w, h / 4);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+Eina_Bool smsc_widget_update_position(void *data, int type, void *event)
+{
+       int *vis_pages;
+       int i;
+       struct smsc_widget *widget;
+       //int page_num;
+       //char pages[15];
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == data || NULL == event,
+                       ECORE_CALLBACK_DONE, "Invalid pointer");
+
+       widget = (struct smsc_widget*)data;
+       /* update paper images positions */
+       update_smsc_widget_positions(widget);
+       smsc_widget_update_page_number(widget);
+       update_smsc_widget_loading_animation(widget);
+
+       //preview_model_debug_print_pages_state(&(widget->engine.p_model));
+
+       /* request engine for new pages */
+       vis_pages = get_smsc_position_visible_pages(&(widget->position));
+
+       if (NULL == vis_pages || widget->engine.p_model.conf.pages_count <= 0)
+               return ECORE_CALLBACK_DONE;
+       for (i = 0; vis_pages[i] >= 0; ++i)
+               if (widget->engine.p_model.pages_state[vis_pages[i] + 1]
+                               == PREVIEW_PAGE_STATE_NA)
+                       preview_model_request_page(
+                                       &(widget->engine.p_model),
+                                       vis_pages[i] + 1);
+       free(vis_pages);
+       SMSC_TRACE_END;
+       return ECORE_CALLBACK_DONE;
+}
+
+
+void smsc_widget_mouse_up_cb(void *data, Evas *evas,
+               Evas_Object *obj, void *event_info)
+{
+       struct smsc_widget *widget = (struct smsc_widget*)data;
+       SMSC_TRACE_BEGIN;
+       SMSC_RET_IF(NULL == data || NULL == event_info, "Argument error");
+       Evas_Event_Mouse_Down *ev = event_info;
+       smsc_control_finish_move(&(widget->control), ev->canvas.x);
+       SMSC_TRACE_END;
+}
+
+
+void smsc_widget_mouse_down_cb(void *data, Evas *evas,
+               Evas_Object *obj, void *event_info)
+{
+       Evas_Event_Mouse_Down *ev = event_info;
+       struct smsc_widget *widget = (struct smsc_widget*)data;
+       SMSC_TRACE_BEGIN;
+
+       if (NULL == widget) {
+               SMSC_TRACE_END;
+               return;
+       }
+       /* send to smsc_control new coordinates and moving beginning */
+       smsc_control_begin_move(&(widget->control), ev->canvas.x);
+       SMSC_TRACE_END;
+}
+
+
+void smsc_widget_mouse_move_cb(void *data, Evas *evas,
+               Evas_Object *obj, void *event_info)
+{
+       Evas_Event_Mouse_Down *ev = event_info;
+       struct smsc_widget *widget = (struct smsc_widget*)data;
+       /* send to smsc_control new coordinates */
+       smsc_control_process_move(&(widget->control), ev->canvas.x);
+}
+
+
+int clear_smsc_widget(struct smsc_widget *widget)
+{
+       SMSC_TRACE_BEGIN;
+       hide_smsc_widget_loading_animation(widget);
+       if (widget->pages_list != NULL)
+               destroy_smsc_widget_pages(widget);
+       reset_smsc_control(&(widget->control));
+       clear_smsc_position_settings(&(widget->position));
+       //show_smsc_widget_loading_animation(widget);
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int smsc_widget_load_near_pages(struct smsc_widget *widget, int page_num)
+{
+       Eina_List *cur_page = NULL;
+       struct smsc_page_data* page_data;
+
+       if (widget->engine.p_model.conf.pages_count <= 0)
+               return 0;
+
+       EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data) {
+               SMSC_DEBUG("page_data->num = %d", page_data->num);
+               if (page_num == page_data->num) {
+                       if (page_num + 1 < widget->engine
+                                       .p_model.conf.pages_count
+                                       && PREVIEW_PAGE_STATE_NA
+                                       == widget->engine
+                                       .p_model.pages_state[page_num + 2])
+                               preview_model_request_page(
+                                               &(widget->engine.p_model),
+                                               page_num + 1 + 1);
+                       if (page_num + 1 > 1
+                                       && PREVIEW_PAGE_STATE_NA
+                                       == widget->engine
+                                       .p_model.pages_state[page_num])
+                               preview_model_request_page(
+                                               &(widget->engine.p_model),
+                                               page_num + 1 - 1);
+               }
+       }
+
+       return 0;
+}
+
+
+int smsc_widget_calculate_posy(struct smsc_widget *widget, int page_h)
+{
+       int h;
+       //int y;
+       int cy;
+
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget || page_h <= 0, -1, "Incorrect arguments");
+
+       //evas_object_geometry_get(widget->parent, NULL, &y, NULL, &h);
+       h = widget->position.available_size.y;
+       if (h <= 0)
+               return -1;
+
+       cy = widget->off_y + (h - page_h) / 2;
+
+       SMSC_DEBUG("cy = %d, off_y = %d, h = %d, page_h = %d",
+                       cy, widget->off_y, h, page_h);
+
+       return cy;
+}
+
+
+Eina_Bool smsc_widget_page_ready_cb(void *data, int type, void *event)
+{
+       int pages_count;
+       struct smsc_widget *widget = (struct smsc_widget*)data;
+       struct preview_engine_event *event_data =
+                       (struct preview_engine_event*)event;
+
+       struct size_px *available_size_px;
+       struct size_pts page_size;
+       /*struct size_px shadow_size_px = {10, 10};
+       struct preview_page_req settings_req;*/
+       //struct preview_page_px settings_px;
+
+       SMSC_TRACE_BEGIN;
+
+       switch (event_data->status) {
+       case PREVIEW_ENGINE_EVENT_INITIAL_READY:
+               /* initialization done: request for page */
+               pages_count = widget->engine.p_model.conf.pages_count;
+               if (pages_count <= 0)
+                       break;
+               SMSC_DEBUG("PREVIEW_ENGINE_EVENT_INITIAL_READY,"
+                               " pages_count = %d", pages_count);
+               available_size_px = &(widget->engine.p_model.conf
+                               .settings_req.available_size_px);
+
+               page_size = widget->engine.p_model.conf.paper_size.s;
+               if (widget->engine.p_model.conf.settings_req.is_rotate90)
+                       switch_size_pts_coords(&page_size);
+
+               clear_smsc_widget(widget);
+               set_smsc_position_settings(&(widget->position), pages_count,
+                               available_size_px, &page_size);
+
+               /* create new page images based on empty page */
+               /* convert p_model configuration to preview_page_req */
+               /* TODO: move to preview_engine */
+               save_empty_preview_page_image(
+                               &(widget->engine.p_model.conf.settings_req),
+                               SMSC_WIDGET_EMPTY_PAGE_FNAME);
+
+               preview_model_request_page(&(widget->engine.p_model), 1);
+
+               widget->posy = smsc_widget_calculate_posy(widget,
+                               widget->position.page_size_px.y);
+
+               update_smsc_widget_positions(widget);
+               smsc_widget_update_page_number(widget);
+               update_smsc_widget_loading_animation(widget);
+               break;
+
+       case PREVIEW_ENGINE_EVENT_PAGE_READY:
+               /* load page */
+               SMSC_DEBUG("PREVIEW_ENGINE_EVENT_PAGE_READY,"
+                               " event_data->page = %d", event_data->page);
+               update_smsc_widget_page(widget, event_data->page - 1);
+               update_smsc_widget_loading_animation(widget);
+               smsc_widget_load_near_pages(widget, event_data->page - 1);
+               break;
+
+       case PREVIEW_ENGINE_EVENT_PAGE_PROCESSING:
+               /* TODO: show empty page */
+               /*if (event_data->page == ugd->pt_files.current_index + 1) {
+                       show_loading_animation(ugd);
+               }*/
+               break;
+
+       case PREVIEW_ENGINE_EVENT_INITIAL_ERROR:
+       case PREVIEW_ENGINE_EVENT_PAGE_ERROR:
+               /* TODO: something in error case */
+               break;
+       }
+
+       SMSC_TRACE_END;
+       return ECORE_CALLBACK_DONE;
+}
+
+
+int smsc_widget_set_layout(struct smsc_widget *widget, Evas_Object *layout)
+{
+       SMSC_TRACE_BEGIN;
+       SMSC_RETV_IF(NULL == widget || NULL == layout, -1,
+                       "Invalid arguments");
+
+       /* mouse events */
+       widget->layout = layout;
+       evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_DOWN,
+                       smsc_widget_mouse_down_cb, widget);
+       evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_UP,
+                       smsc_widget_mouse_up_cb, widget);
+       evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_MOVE,
+                       smsc_widget_mouse_move_cb, widget);
+
+       SMSC_TRACE_END;
+       return 0;
+}
+
+
+int init_smsc_widget(struct smsc_widget *widget,
+               Evas_Object *parent)
+{
+       SMSC_TRACE_BEGIN;
+
+       SMSC_RETV_IF(NULL == widget || NULL == parent, -1,
+                       "Invalid arguments");
+
+       memset(widget, 0, sizeof(struct smsc_widget));
+       widget->parent = parent;
+       widget->layout = NULL;
+       widget->canvas = evas_object_evas_get(parent);
+       widget->loading_animation = loading_animation_add(widget->parent);
+       evas_object_smart_member_add(widget->loading_animation, widget->parent);
+
+       show_smsc_widget_loading_animation(widget);
+       init_smsc_position(&(widget->position));
+       init_smsc_control(&(widget->control), &(widget->position));
+       init_preview_engine(&(widget->engine));
+
+       /* connect events */
+       /* position event */
+       ecore_event_handler_add(widget->position.position_update_event_type,
+                       smsc_widget_update_position, widget);
+
+       /* preview engine events */
+       ecore_event_handler_add(widget->engine.page_ready_event_type,
+                       smsc_widget_page_ready_cb, widget);
+
+       widget->is_ready = 1;
+
+       SMSC_TRACE_END;
+
+       return 0;
+}
+
+
+/* TODO: widget destruction */
+
+
+
index b8e1459..3cbf8c3 100644 (file)
@@ -1,13 +1,59 @@
 <manifest>
-       <define>
-               <domain name="mobileprint" policy="shared"/>
-               <request>
-                       <smack request="cups" type="rx"/>
-               </request>
-               <permit>
-                       <smack permit="_" type="rx"/>
-               </permit>
-       </define>
+       <assign>
+               <filesystem path="/usr/share/icons/default/small/org.tizen.mobileprint.png" label="_"/>
+               <filesystem path="/usr/share/packages/org.tizen.mobileprint.xml" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ar/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/az/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/bg/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ca/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/cs/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/da/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/de_DE/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/el_GR/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/en/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/en_PH/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/en_US/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/es_ES/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/es_US/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/et/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/eu/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/fi/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/fr_CA/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/fr_FR/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ga/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/gl/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/hi/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/hr/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/hu/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/hy/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/is/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/it_IT/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ja_JP/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ka/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/kk/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ko_KR/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/lt/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/lv/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/mk/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/nb/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/nl_NL/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/pl/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/pt_BR/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/pt_PT/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ro/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/ru_RU/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/sk/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/sl/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/sr/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/sv/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/tr_TR/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/uk/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/uz/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/zh_CN/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/zh_HK/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/zh_SG/LC_MESSAGES/mobileprint.mo" label="_"/>
+               <filesystem path="/usr/apps/org.tizen.mobileprint/res/locale/zh_TW/LC_MESSAGES/mobileprint.mo" label="_"/>
+       </assign>
        <request>
                <domain name="mobileprint"/>
        </request>
diff --git a/org.tizen.usb-printer-detector.manifest b/org.tizen.usb-printer-detector.manifest
deleted file mode 100644 (file)
index 334898d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<manifest>
-       <define>
-               <domain name="usb-printer-detector" policy="shared"/>
-       </define>
-       <request>
-               <domain name="usb-printer-detector"/>
-       </request>
-</manifest>
index 9214444..fbf4004 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       mobileprint
 Summary:    Library for writing UNIX daemons
-Version:    0.2.15
-Release:    55
+Version:    0.2.17
+Release:    10
 Group:      System/Libraries
 License:    Flora Software License
 Source0:    %{name}-%{version}.tar.gz
@@ -29,26 +29,17 @@ Mobile Print application
 %package -n org.tizen.mobileprint
 Summary:    Mobile Print application
 Group:      Development/Libraries
-Requires:      cups
+Requires:      sys-assert
+Requires:      print-service
 
 %description -n org.tizen.mobileprint
 Mobile Print application
 
-%package -n org.tizen.usb-printer-detector
-Summary:    Mobile Print application
-Group:      Development/Libraries
-Requires:      pkgconfig(usbutils)
-Requires:      cups
-
-%description -n org.tizen.usb-printer-detector
-Mobile Print application
-
 %prep
 %setup -q
 
 %build
-%define PREFIX /opt/usr/apps/org.tizen.mobileprint
-%define PREFIXUSB /opt/usr/apps/org.tizen.usb-printer-detector
+%define PREFIX /usr/apps/org.tizen.mobileprint
 cmake . -DCMAKE_INSTALL_PREFIX=%{PREFIX}
 
 %install
@@ -57,14 +48,13 @@ rm -rf %{buildroot}
 
 mkdir -p %{buildroot}/usr/share/license
 cp %{_builddir}/%{buildsubdir}/LICENSE.Flora %{buildroot}/usr/share/license/org.tizen.mobileprint
-cp %{_builddir}/%{buildsubdir}/LICENSE.Flora %{buildroot}/usr/share/license/org.tizen.usb-printer-detector
 
 %clean
 rm -rf %{buildroot}
 
 %post -n org.tizen.mobileprint
-   chown -R 5000:5000 %{PREFIX}/data
-   chown -R 5000:5000 %{PREFIX}/cache
+   chown -R 5000:5000 /opt/%{PREFIX}/data
+#  chown -R 5000:5000 %{PREFIX}/cache
 
 %files -n org.tizen.mobileprint
 %manifest org.tizen.mobileprint.manifest
@@ -72,19 +62,10 @@ rm -rf %{buildroot}
 #%doc LICENSE
 /usr/share/license/org.tizen.mobileprint
 %{PREFIX}/*
-#/opt/share/applications/org.tizen.mobileprint.desktop
-/opt/share/icons/default/small/org.tizen.mobileprint.png
-#for appfw new manifest
-/opt/share/packages/org.tizen.mobileprint.xml
-
-%files -n org.tizen.usb-printer-detector
-%manifest org.tizen.usb-printer-detector.manifest
-%defattr(-,root,root,-)
-#%doc LICENSE
-/usr/share/license/org.tizen.usb-printer-detector
-%{PREFIXUSB}/*
-#/opt/share/applications/org.tizen.usb-printer-detector.desktop
+/opt/%{PREFIX}/*
+#/usr/share/applications/org.tizen.mobileprint.desktop
+/usr/share/icons/default/small/org.tizen.mobileprint.png
 #for appfw new manifest
-/opt/share/packages/org.tizen.usb-printer-detector.xml
+/usr/share/packages/org.tizen.mobileprint.xml
 
 %changelog
diff --git a/usb-printer-detector/CMakeLists.txt b/usb-printer-detector/CMakeLists.txt
deleted file mode 100644 (file)
index 6ecac18..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(usb-printer-detector C)
-SET(PACKAGE_NAME org.tizen.usb-printer-detector)
-
-SET(PREFIX /opt/usr/apps/${PACKAGE_NAME})
-SET(BINDIR "${PREFIX}/bin")
-SET(RESDIR "${PREFIX}/res")
-SET(LOCALEDIR "${RESDIR}/locale")
-SET(EDJDIR "${RESDIR}/edje")
-SET(IMGDIR "${RESDIR}/images/")
-
-SET(SRCS
-       src/upd-main.c
-       src/upd-util.c
-       src/upd-view.c
-)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
-
-SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -DVITA_FEATURE")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_C_FLAGS_RELEASE "-O2")
-
-IF("${ARCH}" STREQUAL "arm")
-       ADD_DEFINITIONS("-DTARGET")
-       MESSAGE("add -DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
-ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
-ADD_DEFINITIONS("-DIMGDIR=\"${IMGDIR}\"")
-
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
-
-#CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}.desktop.in ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.desktop)
-#INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.desktop DESTINATION /opt/share/applications)
-#for appfw new manifest
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}.xml ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}.xml)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}.xml DESTINATION "/opt/share/packages/")
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images/ DESTINATION ${IMGDIR})
-
-ADD_SUBDIRECTORY(po)
diff --git a/usb-printer-detector/images/A09_device_printer.png b/usb-printer-detector/images/A09_device_printer.png
deleted file mode 100644 (file)
index 795af23..0000000
Binary files a/usb-printer-detector/images/A09_device_printer.png and /dev/null differ
diff --git a/usb-printer-detector/include/upd-strings.h b/usb-printer-detector/include/upd-strings.h
deleted file mode 100644 (file)
index 9aee9c3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-*  USB-Printer-Detector
-*
-* Copyright 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 __UPD_STRING_H__
-#define __UPD_STRING_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UPD_STR_BUTN_YES                               _("Yes")
-#define UPD_STR_BUTN_NO                                        _("No")
-#define UPD_STR_BTN_OK                                 _("OK")
-#define UPD_STR_BTN_CLOSE                              _("Close")
-#define UPD_STR_BTN_CANCEL                             _("Cancel")
-#define UPD_STR_POP_PROG_CONNECT               _("Connecting...")
-#define UPD_STR_POP_PROG_CANCEL                        _("Canceling...")
-#define UPD_STR_POP_NOTI_CONNECTED             _("Connected")
-#define UPD_STR_POP_NOTI_DISCONNECTED  _("Disconnected")
-#define UPD_STR_POP_FAIL_CONNECT               "An error has occurred during<br>"\
-       "connecting"
-#define UPD_STR_POP_FAIL_TIMEOUT               "Connection timeout"
-
-       /* Not included in excel file, but it exist in STMS */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UPD_STRING_H__ */
diff --git a/usb-printer-detector/include/upd-util.h b/usb-printer-detector/include/upd-util.h
deleted file mode 100644 (file)
index dc65d33..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-*  USB-Printer-Detector
-*
-* Copyright 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 __UPD_UTIL_H__
-#define __UPD_UTIL_H__
-
-#include <notification.h>
-
-#define NOTI_PACKAGE "org.tizen.usb-printer-detector"
-#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
-
-#define USB_PRINTER_DETECTOR_DLOG_OUT
-#ifdef USB_PRINTER_DETECTOR_DLOG_OUT
-#include <dlog.h>
-
-#undef LOG_TAG
-#define LOG_TAG                "USB_PRINTER_DETECTOR"
-
-#define UPD_VERBOSE(fmt, args...) \
-        LOGV(fmt, ##args)
-#define UPD_INFO(fmt, args...) \
-        LOGI(fmt, ##args)
-#define UPD_DEBUG(fmt, args...) \
-        LOGD(fmt, ##args)
-#define UPD_WARN(fmt, args...) \
-        LOGW(fmt, ##args)
-#define UPD_ERROR(fmt, args...) \
-        LOGE(fmt, ##args)
-#define UPD_FATAL(fmt, args...) \
-        LOGF(fmt, ##args)
-
-#define __UPD_FUNC_ENTER__     UPD_INFO("Enter: %s()\n", __func__);
-#define __UPD_FUNC_EXIT__      UPD_INFO("Quit: %s()\n", __func__);
-
-#else /** _DLOG_UTIL */
-
-#define UPD_PRT(prio, fmt, arg...) \
-       do { \
-               fprintf((prio ? stderr : stdout), "%s:%s(%d)>"fmt"\n", __FILE__, __func__, __LINE__, ##arg); \
-       } while (0)
-
-#define UPD_DEBUG(fmt, args...) \
-       do { \
-               printf("%s:%s(%d)>"fmt"\n", __FILE__, __func__, __LINE__, ##arg); \
-       } while (0)
-
-#define __UPD_FUNC_ENTER__     UPD_PRT(0, "%s enter\n", __FUNCTION__);
-#define __UPD_FUNC_EXIT__      UPD_PRT(0, "%s leave\n", __FUNCTION__);
-
-#endif /** _USE_DLOG_UTIL */
-
-#define UPD_FILE_EXISTS(path) \
-       (path && (1 == ecore_file_exists(path)) && (ecore_file_size(path) > 0))
-
-#define UPD_IF_DEL_TIMER(timer) \
-       do { \
-               if(timer) { \
-                       ecore_timer_del(timer); \
-                       timer = NULL; \
-               } \
-       } while (0)
-
-#define UPD_IF_DEL_IDLER(idler) \
-       do { \
-               if(idler) { \
-                       ecore_idler_del(idler); \
-                       idler = NULL; \
-               } \
-       } while (0)
-
-
-#define UPD_IF_DEL_OBJ(obj) \
-       do { \
-               if(obj) { \
-                       evas_object_del(obj); \
-                       obj = NULL; \
-               } \
-       } while (0)
-
-#define UPD_IF_FREE_MEM(mem) \
-       do { \
-               if(mem) { \
-                       free(mem); \
-                       mem = NULL; \
-               } \
-       } while (0)
-
-#define assertm_if(expr, fmt, arg...) do { \
-               if(expr) { \
-                       UPD_DEBUG(UPD_LOG_ASSERT, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
-                       exit(1); \
-               } \
-       } while (0)                     // retvm if
-
-int upd_create_notification(int *noti_id, const char *printer_model);
-int upd_remove_notification(int noti_id);
-int upd_draw_connected_syspopup(void);
-int upd_get_printer_info(char **printer_model);
-
-#endif /* __UPD_UTIL_H__ */
diff --git a/usb-printer-detector/include/upd.h b/usb-printer-detector/include/upd.h
deleted file mode 100644 (file)
index fc1cf49..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-*  USB-Printer-Detector
-*
-* Copyright 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 __UPD_H__
-#define __UPD_H__
-
-#include <appcore-efl.h>
-#include <Ecore_X.h>
-#include <Elementary.h>
-#include <appsvc.h>
-#include <aul.h>
-#include <bundle.h>
-#include <notification.h>
-#include <vconf.h>
-#include <pmapi.h>
-
-#define PACKAGE "usb-printer-detector"
-#define EDJ_NAME RESDIR"/edje/usb-printer-detector.edj"
-#define LOCALEDIR "/opt/usr/apps/org.tizen.usb-printer-detector/res/locale"
-#define UPD_STR_MAX_LEN                128
-
-enum {
-       UPD_TIMER_3 = 3,
-       UPD_TIMER_10 = 10,
-       UPD_TIMER_30 = 30,
-       UPD_TIMER_120 = 120,
-};
-
-enum {
-       UPD_PROG_CONNECT,
-       UPD_PROG_DISCONNECT,
-       UPD_PROG_CONNECT_CANCEL,
-       UPD_NOTI_CONNECTED,
-       UPD_NOTI_DISCONNECTED,
-       UPD_FAIL_INIT,
-       UPD_FAIL_CONNECT,
-//    UPD_BROWSE_FILES_REQ,
-};
-
-enum {
-       UPD_RESP_OK,
-       UPD_RESP_CANCEL,
-       UPD_RESP_APRV_CONNECT_PBC_YES = 1,
-       UPD_RESP_APRV_CONNECT_DISPLAY_YES,
-       UPD_RESP_APRV_CONNECT_KEYPAD_YES,
-       UPD_RESP_APRV_CONNECT_NO,
-       UPD_RESP_PROG_CONNECT_CANCEL,
-       UPD_RESP_PROG_CONNECT_KEYPAD_OK,
-       UPD_RESP_APRV_ENTER_PIN_YES,
-       UPD_RESP_APRV_ENTER_PIN_NO,
-       UPD_BROWSE_FILES_YES,
-       UPD_BROWSE_FILES_NO,
-};
-
-typedef struct {
-       int type;
-       char text[UPD_STR_MAX_LEN];
-       char label1[UPD_STR_MAX_LEN];
-       char label2[UPD_STR_MAX_LEN];
-       int timeout;
-       int resp_data1;
-       int resp_data2;
-       int data;
-} upd_popup_t;
-
-typedef struct {
-       Evas_Object *win;
-       Evas_Object *popup;
-       Evas_Object *pin_entry;
-       upd_popup_t *popup_data;
-       uint popup_timeout_handle;
-       int noti_id;
-} upd_appdata_t;
-
-
-extern upd_appdata_t *upd_get_appdata();
-extern void upd_destroy_popup();
-extern void upd_prepare_popup(int type, void *userdata);
-
-#endif /* __UPD_H__ */
diff --git a/usb-printer-detector/org.tizen.usb-printer-detector.xml b/usb-printer-detector/org.tizen.usb-printer-detector.xml
deleted file mode 100644 (file)
index 33aa017..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?> 
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.usb-printer-detector" version="0.2.10-4" install-location="internal-only">
-       <label>usb-printer-detector</label>
-       <author email="gangheok.kim@samsung.com" href="www.samsung.com">GangHeok Kim</author>
-       <author email="taeksu.shin@samsung.com" href="www.samsung.com">Taeksu Shin</author>
-       <author email="dwmax.lee@samsung.com" href="www.samsung.com">Dongwook Lee</author>
-       <description>USB Host Printer UI Application</description>
-       <ui-application appid="org.tizen.usb-printer-detector" exec="/opt/usr/apps/org.tizen.usb-printer-detector/bin/usb-printer-detector" nodisplay="true" multiple="false" type="capp" taskmanage="false">
-               <label>usb-printer-detector</label>
-               <label xml:lang="en-us">usb-printer-detector</label>
-               <label xml:lang="ko-kr">USB프린터감지기</label>
-       </ui-application>
-</manifest>
diff --git a/usb-printer-detector/po/CMakeLists.txt b/usb-printer-detector/po/CMakeLists.txt
deleted file mode 100644 (file)
index 7cba244..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# for i18n
-
-SET(POFILES 
-    ar.po da.po en_US.po fi.po hi.po it_IT.po 
-    lt.po pl.po sk.po uk.po zh_TW.po az.po 
-    de_DE.po es_ES.po fr_CA.po hr.po ja_JP.po 
-    lv.po pt_BR.po sl.po uz.po bg.po el_GR.po 
-    es_US.po fr_FR.po hu.po ka.po mk.po pt_PT.po 
-    sr.po zh_CN.po ca.po en.po et.po ga.po hy.po 
-    kk.po nb.po ro.po sv.po zh_HK.po cs.po en_PH.po 
-    eu.po gl.po is.po ko_KR.po nl_NL.po ru_RU.po 
-    tr_TR.po zh_SG.po       
-    )
-
-SET(MSGFMT "/usr/bin/msgfmt")
-
-FOREACH(pofile ${POFILES})
-       SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
-       MESSAGE("PO: ${pofile}")
-       GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
-       GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
-       SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
-       ADD_CUSTOM_COMMAND(
-                       OUTPUT ${moFile}
-                       COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
-                       DEPENDS ${absPofile}
-       )
-       INSTALL(FILES ${moFile}
-                       DESTINATION /opt/usr/apps/org.tizen.usb-printer-detector/res/locale/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
-       SET(moFiles ${moFiles} ${moFile})
-ENDFOREACH(pofile)
-
-MESSAGE(".mo files: ${moFiles}")
-ADD_CUSTOM_TARGET(pop_po ALL DEPENDS ${moFiles})
diff --git a/usb-printer-detector/po/POTFILES.in b/usb-printer-detector/po/POTFILES.in
deleted file mode 100644 (file)
index c138b68..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# List of source files containing translatable strings.
-upd-strings.h
diff --git a/usb-printer-detector/po/ar.po b/usb-printer-detector/po/ar.po
deleted file mode 100644 (file)
index 8ad93fe..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "تم توصيل الطابعة"
-
diff --git a/usb-printer-detector/po/az.po b/usb-printer-detector/po/az.po
deleted file mode 100644 (file)
index 0380eaa..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer qoşuldu"
-
diff --git a/usb-printer-detector/po/bg.po b/usb-printer-detector/po/bg.po
deleted file mode 100644 (file)
index 89165a6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Принтерът е свързан"
-
diff --git a/usb-printer-detector/po/ca.po b/usb-printer-detector/po/ca.po
deleted file mode 100644 (file)
index 70d08f7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Impressora connectada"
-
diff --git a/usb-printer-detector/po/cs.po b/usb-printer-detector/po/cs.po
deleted file mode 100644 (file)
index 120893e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Tiskárna byla připojena"
-
diff --git a/usb-printer-detector/po/da.po b/usb-printer-detector/po/da.po
deleted file mode 100644 (file)
index 894dede..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer tilsluttet"
-
diff --git a/usb-printer-detector/po/de_DE.po b/usb-printer-detector/po/de_DE.po
deleted file mode 100644 (file)
index 70aa564..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Drucker verbunden"
-
diff --git a/usb-printer-detector/po/el_GR.po b/usb-printer-detector/po/el_GR.po
deleted file mode 100644 (file)
index 9eac3e9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Συνδέθηκε εκτυπωτής"
-
diff --git a/usb-printer-detector/po/en.po b/usb-printer-detector/po/en.po
deleted file mode 100644 (file)
index 64c98c5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer connected"
-
diff --git a/usb-printer-detector/po/en_PH.po b/usb-printer-detector/po/en_PH.po
deleted file mode 100644 (file)
index 64c98c5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer connected"
-
diff --git a/usb-printer-detector/po/en_US.po b/usb-printer-detector/po/en_US.po
deleted file mode 100644 (file)
index 64c98c5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer connected"
-
diff --git a/usb-printer-detector/po/es_ES.po b/usb-printer-detector/po/es_ES.po
deleted file mode 100644 (file)
index 825acde..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Impresora conectada"
-
diff --git a/usb-printer-detector/po/es_US.po b/usb-printer-detector/po/es_US.po
deleted file mode 100644 (file)
index 825acde..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Impresora conectada"
-
diff --git a/usb-printer-detector/po/et.po b/usb-printer-detector/po/et.po
deleted file mode 100644 (file)
index 37694b6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer on ühendatud"
-
diff --git a/usb-printer-detector/po/eu.po b/usb-printer-detector/po/eu.po
deleted file mode 100644 (file)
index d66a0a3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Inprimagailua konektatuta"
-
diff --git a/usb-printer-detector/po/fi.po b/usb-printer-detector/po/fi.po
deleted file mode 100644 (file)
index 6635912..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Tulostin kytketty"
-
diff --git a/usb-printer-detector/po/fr_CA.po b/usb-printer-detector/po/fr_CA.po
deleted file mode 100644 (file)
index fea1654..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Imprimante connectée"
-
diff --git a/usb-printer-detector/po/fr_FR.po b/usb-printer-detector/po/fr_FR.po
deleted file mode 100644 (file)
index fea1654..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Imprimante connectée"
-
diff --git a/usb-printer-detector/po/ga.po b/usb-printer-detector/po/ga.po
deleted file mode 100644 (file)
index 237b44f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printéir ceangailte"
-
diff --git a/usb-printer-detector/po/gl.po b/usb-printer-detector/po/gl.po
deleted file mode 100644 (file)
index 825acde..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Impresora conectada"
-
diff --git a/usb-printer-detector/po/hi.po b/usb-printer-detector/po/hi.po
deleted file mode 100644 (file)
index 02ca05a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "प्रिंटर कनेक्ट किया गया"
-
diff --git a/usb-printer-detector/po/hr.po b/usb-printer-detector/po/hr.po
deleted file mode 100644 (file)
index 05d330d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Pisač spojen"
-
diff --git a/usb-printer-detector/po/hu.po b/usb-printer-detector/po/hu.po
deleted file mode 100644 (file)
index 1de6bc2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Nyomtató csatlakoztatva"
-
diff --git a/usb-printer-detector/po/hy.po b/usb-printer-detector/po/hy.po
deleted file mode 100644 (file)
index dd55d7a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Տպիչը միացված է"
-
diff --git a/usb-printer-detector/po/is.po b/usb-printer-detector/po/is.po
deleted file mode 100644 (file)
index 290fed5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Prentari tengdur"
-
diff --git a/usb-printer-detector/po/it_IT.po b/usb-printer-detector/po/it_IT.po
deleted file mode 100644 (file)
index cdc8a8a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Stampante connessa"
-
diff --git a/usb-printer-detector/po/ja_JP.po b/usb-printer-detector/po/ja_JP.po
deleted file mode 100644 (file)
index 4e6201e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "プリンターが接続されました。"
-
diff --git a/usb-printer-detector/po/ka.po b/usb-printer-detector/po/ka.po
deleted file mode 100644 (file)
index f52bf06..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "პრინტერი დაკავშირებულია"
-
diff --git a/usb-printer-detector/po/kk.po b/usb-printer-detector/po/kk.po
deleted file mode 100644 (file)
index 733ae42..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Принтер қосылды"
-
diff --git a/usb-printer-detector/po/ko_KR.po b/usb-printer-detector/po/ko_KR.po
deleted file mode 100644 (file)
index d601139..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "프린터가 연결되었습니다"
-
diff --git a/usb-printer-detector/po/lt.po b/usb-printer-detector/po/lt.po
deleted file mode 100644 (file)
index 8860a5e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Prijungtas spausdintuvas"
-
diff --git a/usb-printer-detector/po/lv.po b/usb-printer-detector/po/lv.po
deleted file mode 100644 (file)
index 4e21aa1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printeris pievienots"
-
diff --git a/usb-printer-detector/po/mk.po b/usb-printer-detector/po/mk.po
deleted file mode 100644 (file)
index d16fff6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Поврзан е печатач"
-
diff --git a/usb-printer-detector/po/nb.po b/usb-printer-detector/po/nb.po
deleted file mode 100644 (file)
index e23edf9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Skriver tilkoblet"
-
diff --git a/usb-printer-detector/po/nl_NL.po b/usb-printer-detector/po/nl_NL.po
deleted file mode 100644 (file)
index 955c1c3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer aangesloten"
-
diff --git a/usb-printer-detector/po/pl.po b/usb-printer-detector/po/pl.po
deleted file mode 100644 (file)
index 1c6c0dd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Drukarka podłączona"
-
diff --git a/usb-printer-detector/po/pt_BR.po b/usb-printer-detector/po/pt_BR.po
deleted file mode 100644 (file)
index 6239718..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Impressora conectada"
-
diff --git a/usb-printer-detector/po/pt_PT.po b/usb-printer-detector/po/pt_PT.po
deleted file mode 100644 (file)
index 49f945c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Impressora ligada"
-
diff --git a/usb-printer-detector/po/ro.po b/usb-printer-detector/po/ro.po
deleted file mode 100644 (file)
index 207b2cc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Imprimantă conectată"
-
diff --git a/usb-printer-detector/po/ru_RU.po b/usb-printer-detector/po/ru_RU.po
deleted file mode 100644 (file)
index c96414d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Принтер подключен"
-
diff --git a/usb-printer-detector/po/sk.po b/usb-printer-detector/po/sk.po
deleted file mode 100644 (file)
index ebd5d2d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Tlačiareň je pripojená"
-
diff --git a/usb-printer-detector/po/sl.po b/usb-printer-detector/po/sl.po
deleted file mode 100644 (file)
index 26d7498..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Tiskalnik je povezan"
-
diff --git a/usb-printer-detector/po/sr.po b/usb-printer-detector/po/sr.po
deleted file mode 100644 (file)
index 05a6e34..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Štampač je priključen"
-
diff --git a/usb-printer-detector/po/sv.po b/usb-printer-detector/po/sv.po
deleted file mode 100644 (file)
index 4140980..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Skrivare ansluten"
-
diff --git a/usb-printer-detector/po/tr_TR.po b/usb-printer-detector/po/tr_TR.po
deleted file mode 100644 (file)
index 045ccea..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Yazıcı bağlı"
-
diff --git a/usb-printer-detector/po/uk.po b/usb-printer-detector/po/uk.po
deleted file mode 100644 (file)
index 6f31205..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Принтер підключено"
-
diff --git a/usb-printer-detector/po/update-po.sh b/usb-printer-detector/po/update-po.sh
deleted file mode 100755 (executable)
index fcf256d..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-PACKAGE=usb-printer-detector
-SRCROOT=..
-POTFILES=POTFILES.in
-
-ALL_LINGUAS="ar da en_US fi hi it_IT lt pl sk uk zh_TW az de_DE es_ES fr_CA hr ja_JP lv pt_BR sl uz bg el_GR es_US fr_FR hu ka mk pt_PT sr zh_CN ca en et ga hy kk nb ro sv zh_HK cs en_PH eu gl is ko_KR nl_NL ru_RU tr_TR zh_SG"
-
-XGETTEXT=/usr/bin/xgettext
-MSGMERGE=/usr/bin/msgmerge
-
-echo -n "Make ${PACKAGE}.pot  "
-if [ ! -e $POTFILES ] ; then
-       echo "$POTFILES not found"
-       exit 1
-fi
-
-$XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \
-               --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES
-if [ $? -ne 0 ]; then
-       echo "error"
-       exit 1  
-fi
-
-if [ ! -f ${PACKAGE}.po ]; then
-       echo "No such file: ${PACKAGE}.po"
-       exit 1
-fi
-
-rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot
-echo "done"
-
-for LANG in $ALL_LINGUAS; do 
-       echo "$LANG : "
-
-       if [ ! -e $LANG.po ] ; then
-               sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po
-               echo "${LANG}.po created"
-       else
-               if $MSGMERGE ${LANG}.po ${PACKAGE}.pot -o ${LANG}.new.po ; then
-                       if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
-                               rm -f ${LANG}.new.po
-                       else
-                               if mv -f ${LANG}.new.po ${LANG}.po; then
-                                       echo "" 
-                               else
-                                       echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
-                                       rm -f ${LANG}.new.po
-                                       exit 1
-                               fi
-                       fi
-               else
-                       echo "msgmerge for $LANG failed!"
-                       rm -f ${LANG}.new.po
-               fi
-       fi
-       echo ""
-done
-
diff --git a/usb-printer-detector/po/uz.po b/usb-printer-detector/po/uz.po
deleted file mode 100644 (file)
index 6c8deb1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "Printer ulandi"
-
diff --git a/usb-printer-detector/po/zh_CN.po b/usb-printer-detector/po/zh_CN.po
deleted file mode 100644 (file)
index 1091794..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "打印机已连接"
-
diff --git a/usb-printer-detector/po/zh_HK.po b/usb-printer-detector/po/zh_HK.po
deleted file mode 100644 (file)
index 2954327..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "打印機已連接"
-
diff --git a/usb-printer-detector/po/zh_SG.po b/usb-printer-detector/po/zh_SG.po
deleted file mode 100644 (file)
index 1091794..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "打印机已连接"
-
diff --git a/usb-printer-detector/po/zh_TW.po b/usb-printer-detector/po/zh_TW.po
deleted file mode 100644 (file)
index 5232ea5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-msgid "IDS_COM_POP_PRINTER_CONNECTED_ABB2"
-msgstr "印表機已連接"
-
diff --git a/usb-printer-detector/src/upd-main.c b/usb-printer-detector/src/upd-main.c
deleted file mode 100644 (file)
index da0b98b..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
-*  USB-Printer-Detector
-*
-* Copyright 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 <libintl.h>
-
-#include "upd.h"
-#include "upd-util.h"
-
-upd_appdata_t *g_upd_ad;
-
-
-upd_appdata_t *upd_get_appdata()
-{
-       return g_upd_ad;
-}
-
-static void _win_del(void *data, Evas_Object *obj, void *event)
-{
-       elm_exit();
-}
-
-static Evas_Object *_create_win(Evas_Object *parent, const char *name)
-{
-       Evas_Object *eo;
-       int w, h;
-
-       eo = elm_win_add(parent, name, ELM_WIN_BASIC);
-       if (eo) {
-               elm_win_title_set(eo, name);
-               elm_win_borderless_set(eo, EINA_TRUE);
-               elm_win_alpha_set(eo, EINA_TRUE);
-               evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL);
-               ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
-               evas_object_resize(eo, w, h);
-               evas_object_raise(eo);
-       }
-
-       return eo;
-}
-
-static void _usb_host_monitoring_cb(keynode_t *key, void *data)
-{
-       __UPD_FUNC_ENTER__;
-       int usb_host_state = -1;
-       //upd_appdata_t *ad = upd_get_appdata();
-
-       int error_code = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &usb_host_state);
-       if (error_code == -1) {
-               UPD_DEBUG("Error when check USB host status");
-               return;
-       }
-
-       // FIXME: should report SYSMAN to fix it
-       if (usb_host_state < VCONFKEY_SYSMAN_USB_HOST_CONNECTED) {
-               //TODO: Clean up all existing job
-               //upd_destroy_popup();
-               //upd_remove_notification(ad->noti_id);
-               //ad->noti_id = -1;
-
-               UPD_DEBUG("usb-printer-detector will be terminated!!!");
-               __UPD_FUNC_EXIT__;
-               //_app_terminate(ad);
-               elm_exit();
-       }
-       __UPD_FUNC_EXIT__;
-}
-
-static int _app_create(void *data)
-{
-       __UPD_FUNC_ENTER__;
-
-       upd_appdata_t *ad = upd_get_appdata();
-
-       if (data == NULL) {
-               UPD_DEBUG("Incorrect parameter\n");
-               return -1;
-       }
-
-       bindtextdomain(PACKAGE, LOCALEDIR);
-
-       ad->popup_data = (upd_popup_t *) malloc(sizeof(upd_popup_t));
-       if (!ad->popup_data) {
-               UPD_DEBUG("malloc failed\n");
-               return -1;
-       }
-       memset(ad->popup_data, 0x0, sizeof(upd_popup_t));
-
-       ad->win = _create_win(NULL, PACKAGE);
-
-       elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
-
-       int ret;
-
-       if (!ecore_x_display_get()) {
-               return -1;
-       }
-
-       ret = appcore_set_i18n(PACKAGE, NULL);
-       if (ret != 0) {
-               UPD_DEBUG("appcore_set_i18n error\n");
-               return -1;
-       }
-
-       char *printer_model = NULL;
-
-       ret = upd_get_printer_info(&printer_model);
-       if (ret < 0) {
-               UPD_DEBUG("failed to get printer info");
-       }
-
-       if (printer_model == NULL) {
-               UPD_DEBUG("printer_model is NULL");
-               printer_model = strdup("Unknown");
-       }
-
-       ret = pm_change_state(LCD_NORMAL);
-       if (ret < 0) {
-               UPD_DEBUG("power manager change state failed. (ret=%d)\n", ret);
-       } else {
-               UPD_DEBUG("power manager changed state\n");
-       }
-
-       upd_prepare_popup(UPD_NOTI_CONNECTED, NULL);
-       vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, _usb_host_monitoring_cb, NULL);
-
-       ad->noti_id = -1;
-       upd_create_notification(&(ad->noti_id), printer_model);
-       UPD_DEBUG("Notification ID[%d]\n", ad->noti_id);
-
-       //upd_prepare_popup(UPD_BROWSE_FILES_REQ, NULL);
-
-       UPD_IF_FREE_MEM(printer_model);
-
-       __UPD_FUNC_EXIT__;
-
-       return 0;
-}
-
-static int _app_terminate(void *data)
-{
-       __UPD_FUNC_ENTER__;
-
-       if (data == NULL) {
-               UPD_DEBUG("Incorrect parameter\n");
-               return -1;
-       }
-
-       upd_appdata_t *ad = (upd_appdata_t *) data;
-
-       if (ad->popup) {
-               evas_object_del(ad->popup);
-               ad->popup = NULL;
-       }
-       if (ad->win) {
-               evas_object_del(ad->win);
-               ad->win = NULL;
-       }
-
-       // FIXME: which data should be freed?
-       vconf_ignore_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, _usb_host_monitoring_cb);
-       UPD_DEBUG("Will be removed noti id[%d]\n", ad->noti_id);
-       upd_remove_notification(ad->noti_id);
-       ad->noti_id = -1;
-
-       __UPD_FUNC_EXIT__;
-
-       return 0;
-}
-
-static int _app_pause(void *data)
-{
-       __UPD_FUNC_ENTER__;
-       __UPD_FUNC_EXIT__;
-       return 0;
-}
-
-static int _app_resume(void *data)
-{
-       __UPD_FUNC_ENTER__;
-       __UPD_FUNC_EXIT__;
-       return 0;
-}
-
-static int _app_reset(bundle *b, void *data)
-{
-       __UPD_FUNC_ENTER__;
-       __UPD_FUNC_EXIT__;
-       return 0;
-}
-
-int main(int argc, char *argv[])
-{
-       upd_appdata_t ad;
-       struct appcore_ops ops = {
-               .create = _app_create,
-               .terminate = _app_terminate,
-               .pause = _app_pause,
-               .resume = _app_resume,
-               .reset = _app_reset,
-       };
-
-       memset(&ad, 0x0, sizeof(upd_appdata_t));
-       ops.data = &ad;
-       g_upd_ad = &ad;
-
-       return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
-}
diff --git a/usb-printer-detector/src/upd-util.c b/usb-printer-detector/src/upd-util.c
deleted file mode 100644 (file)
index 8349967..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
-*  USB-Printer-Detector
-*
-* Copyright 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <linux/unistd.h>
-#include <libintl.h>
-#include "syspopup_caller.h"
-#include "upd-util.h"
-
-#define UPD_1 "USB Printer Connected"
-
-#define USB_BACKEND    "/usr/lib/cups/backend/usb"
-
-typedef struct {
-       unsigned int Bus;
-       unsigned int Level;
-       unsigned int Port;
-       int Vendor;
-       int ProductID;
-       char *Manufacturer;
-       char *ModelName;
-       char *ProductName;
-} upd_printer_info_t;
-
-int upd_parse_info(char **output)
-{
-       __UPD_FUNC_ENTER__;
-
-
-       FILE *fp                = NULL;
-
-       if ((fp=popen(USB_BACKEND, "r"))==NULL) {
-               UPD_DEBUG("popen error(%s)",USB_BACKEND);
-               return -1;
-       }
-
-       size_t len              = 0;
-       ssize_t read_len        = 0;
-
-       char *str_buf   = NULL;
-       char *mfg               = NULL;
-       char *mdl               = NULL;
-       char *mfg_temp  = NULL;
-       char *mdl_temp  = NULL;
-
-       //TODO : use upd_printer_info_t list for multi-printer case
-       upd_printer_info_t *usb_printer = (upd_printer_info_t *) calloc(1, sizeof(upd_printer_info_t));
-
-       if (usb_printer == NULL) {
-               UPD_DEBUG("Failed to calloc usb_printer");
-               goto ERROR;
-       }
-
-       //Notice : thie use one usb printer at last
-       //TODO : apply multiple usb printer connection scenario
-       do {
-               read_len = getline(&str_buf, &len, fp);
-               UPD_DEBUG("Retrieved line of length %zu :\n", read_len);
-               UPD_DEBUG("%s", str_buf);
-
-               if (strncmp(str_buf, "direct ",7) == 0
-                               && strstr(str_buf, "usb://") != NULL
-                               && strstr(str_buf,"MFG") != NULL
-                               && strstr(str_buf,"MDL") != NULL) {
-                       // USB printer case
-                       mfg = strstr(str_buf, "MFG:");
-                       mdl = strstr(str_buf, "MDL:");
-
-                       if (mfg == NULL || mdl == NULL) {
-                               UPD_DEBUG("failed to find MFG or MDL");
-                               goto ERROR;
-                       }
-                       mfg_temp = strdup(mfg+4);
-                       mdl_temp = strdup(mdl+4);
-
-                       if (mfg_temp == NULL || mdl_temp == NULL) {
-                               goto ERROR;
-                       }
-                       mfg = strtok(mfg_temp, ";");
-                       mdl = strtok(mdl_temp, ";");
-
-                       if (mfg == NULL || mdl == NULL) {
-                               UPD_DEBUG("failed to strtok");
-                               goto ERROR;
-                       }
-
-                       if (strncasecmp(mfg_temp, "SAMSUNG", 7) == 0) {
-                               usb_printer->Manufacturer = strdup("Samsung");
-                       } else if (strncasecmp(mfg_temp, "EPSON", 5) == 0) {
-                               usb_printer->Manufacturer = strdup("Epson");
-                       } else if (strncasecmp(mfg_temp, "HP", 2) == 0) {
-                               usb_printer->Manufacturer = strdup("HP");
-                       } else if (strncasecmp(mfg_temp, "Hewlett-Packard", 15) == 0) {
-                               usb_printer->Manufacturer = strdup("HP");
-                       } else {
-                               usb_printer->Manufacturer = strdup("");
-                       }
-
-                       usb_printer->ModelName = strdup(mdl_temp);
-                       if (usb_printer->ModelName == NULL) {
-                               goto ERROR;
-                       }
-
-                       UPD_IF_FREE_MEM(mfg_temp);
-                       UPD_IF_FREE_MEM(mdl_temp);
-
-                       UPD_DEBUG("[INFO] MFG %s MDL %s", usb_printer->Manufacturer, usb_printer->ModelName);
-               } else {
-                       continue;
-               }
-       } while (read_len != -1);
-
-       if (usb_printer->Manufacturer == NULL || usb_printer->ModelName == NULL) {
-               UPD_DEBUG("Manufacturer or ModelName is NULL");
-               goto ERROR;
-       }
-
-       if (strstr(usb_printer->ModelName, usb_printer->Manufacturer) != NULL
-                       || strcmp(usb_printer->ModelName, "Unknown") == 0) {
-               *output= (char *) calloc(1, strlen(usb_printer->ModelName) +1);
-               if (*output == NULL) {
-                       UPD_DEBUG("Failed to calloc");
-                       goto ERROR;
-               }
-               UPD_DEBUG("ModelName include Manufacturer again");
-               UPD_DEBUG("ModelName %s Manufacturer %s",usb_printer->ModelName, usb_printer->Manufacturer);
-               snprintf(*output, strlen(usb_printer->ModelName)+1, "%s",  usb_printer->ModelName);
-       } else {
-               *output= calloc(1, strlen(usb_printer->Manufacturer) + strlen(usb_printer->ModelName) + 2);
-               if (*output == NULL) {
-                       UPD_DEBUG("Failed to calloc");
-                       goto ERROR;
-               }
-               UPD_DEBUG("ModelName do not include Manufacturer");
-               UPD_DEBUG("ModelName %s Manufacturer %s",usb_printer->ModelName, usb_printer->Manufacturer);
-               snprintf(*output, strlen(usb_printer->Manufacturer)
-                                +strlen(usb_printer->ModelName)
-                                +2
-                                , "%s %s"
-                                , usb_printer->Manufacturer
-                                , usb_printer->ModelName);
-       }
-       UPD_IF_FREE_MEM(str_buf);
-
-       int ret = pclose(fp);
-       if (!WIFEXITED(ret) || (WEXITSTATUS(ret) != 0)) {
-               UPD_DEBUG("pclose error!");
-       }
-
-       if (usb_printer != NULL) {
-               UPD_IF_FREE_MEM(usb_printer->Manufacturer);
-               UPD_IF_FREE_MEM(usb_printer->ModelName);
-               UPD_IF_FREE_MEM(usb_printer);
-       }
-
-       __UPD_FUNC_EXIT__;
-       return 0;
-
-ERROR:
-       if (fp !=NULL) {
-               fclose(fp);
-       }
-
-       UPD_IF_FREE_MEM(str_buf);
-       UPD_IF_FREE_MEM(mfg_temp);
-       UPD_IF_FREE_MEM(mdl_temp);
-
-       if (usb_printer != NULL) {
-               UPD_IF_FREE_MEM(usb_printer->Manufacturer);
-               UPD_IF_FREE_MEM(usb_printer->ModelName);
-               UPD_IF_FREE_MEM(usb_printer);
-       }
-       return -1;
-}
-
-int upd_get_printer_info(char **printer_model)
-{
-       __UPD_FUNC_ENTER__;
-       //TODO : use to parse lsusb or udev event
-       //issue : multi usb printer is connected
-
-       int ret = -1;
-
-       ret = upd_parse_info(printer_model);
-       if (ret == -1) {
-               UPD_DEBUG("Failed to upd_parse_info");
-               return -1;
-       }
-
-       __UPD_FUNC_EXIT__;
-       return 0;
-}
-
-int upd_create_notification(int *noti_id, const char *printer_model)
-{
-       __UPD_FUNC_ENTER__;
-
-       int res = -1;
-       notification_h noti = NULL;
-
-       noti = notification_new(NOTIFICATION_TYPE_ONGOING,
-                                                       NOTIFICATION_GROUP_ID_NONE,
-                                                       NOTIFICATION_PRIV_ID_NONE);
-       if (noti == NULL) {
-               UPD_DEBUG("Failed to create Notification");
-               goto ERROR;
-       }
-
-       res = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, UPD_1, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-       if (res != NOTIFICATION_ERROR_NONE) {
-               UPD_DEBUG("Failed to set Notification title [%d]", res);
-               goto ERROR;
-       }
-
-       res = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, printer_model, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-       if (res != NOTIFICATION_ERROR_NONE) {
-               UPD_DEBUG("Failed to set Notification title [%d]", res);
-               goto ERROR;
-       }
-
-       res = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, RESDIR"/images/A01_print_popup_icon_print.png");
-       if (res != NOTIFICATION_ERROR_NONE) {
-               UPD_DEBUG("Failed to set image icon");
-               goto ERROR;
-       }
-
-       res = notification_insert(noti, noti_id);
-       if (res != NOTIFICATION_ERROR_NONE) {
-               UPD_DEBUG("Failed to insert Notification [%d]", res);
-               goto ERROR;
-       }
-       UPD_DEBUG("Notification ID [%d]", *noti_id);
-
-       res = notification_free(noti);
-       if (res != NOTIFICATION_ERROR_NONE) {
-               UPD_DEBUG("Failed to set Notification title [%d]", res);
-               goto ERROR;
-       }
-
-       __UPD_FUNC_EXIT__;
-
-       return res;
-
-ERROR:
-       if (noti != NULL) {
-               notification_free(noti);
-               noti = NULL;
-       }
-       return -1;
-
-}
-
-int upd_remove_notification(int noti_id)
-{
-       __UPD_FUNC_ENTER__;
-
-       if (noti_id != NOTIFICATION_PRIV_ID_NONE) {
-               notification_delete_by_priv_id(NOTI_PACKAGE, NOTIFICATION_TYPE_ONGOING, noti_id);
-               UPD_DEBUG("Notification is deleted");
-       }
-
-       __UPD_FUNC_EXIT__;
-
-       return 0;
-}
-
-int upd_draw_connected_syspopup(void)
-{
-       __UPD_FUNC_ENTER__;
-
-       bundle *b = NULL;
-       int ret = -1;
-
-       b = bundle_create();
-       if (!b) {
-               UPD_DEBUG("FAIL: bundle_create()\n");
-               return -1;
-       }
-       /* "0" means tickernoti style */
-       ret = bundle_add(b, "0", "info");
-       if (ret != 0) {
-               UPD_DEBUG("FAIL: bundle_add()\n");
-               if (0 != bundle_free(b)) {
-                       UPD_DEBUG("FAIL: bundle_free()\n");
-               }
-               return -1;
-       }
-
-       /* "1" means popup text */
-       ret = bundle_add(b, "1", dgettext("usb-printer-detector", "IDS_COM_POP_PRINTER_CONNECTED_ABB2"));
-       if (ret != 0) {
-               UPD_DEBUG("FAIL: bundle_add()\n");
-               if (0 != bundle_free(b)) {
-                       UPD_DEBUG("FAIL: bundle_free()\n");
-               }
-               return -1;
-       }
-
-       /* "2" means orientation of tickernoti */
-       ret = bundle_add(b, "2", "0");
-       if (ret != 0) {
-               UPD_DEBUG("FAIL: bundle_add()\n");
-               if (0 != bundle_free(b)) {
-                       UPD_DEBUG("FAIL: bundle_free()\n");
-               }
-               return -1;
-       }
-
-       /* "3" means timeout(second) of tickernoti */
-       ret = bundle_add(b, "3", "3");
-       if (ret != 0) {
-               UPD_DEBUG("FAIL: bundle_add()\n");
-               if (0 != bundle_free(b)) {
-                       UPD_DEBUG("FAIL: bundle_free()\n");
-               }
-               return -1;
-       }
-
-       ret = syspopup_launch("tickernoti-syspopup", b);
-       if (ret != 0) {
-               UPD_DEBUG("FAIL: syspopup_launch()\n");
-       }
-
-       if (0 != bundle_free(b)) {
-               UPD_DEBUG("FAIL: bundle_free()\n");
-       }
-
-       __UPD_FUNC_EXIT__;
-
-       return ret;
-}
diff --git a/usb-printer-detector/src/upd-view.c b/usb-printer-detector/src/upd-view.c
deleted file mode 100644 (file)
index 0059bd1..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-*  USB-Printer-Detector
-*
-* Copyright 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 <libintl.h>
-#include <glib.h>
-
-#include "upd.h"
-#include "upd-strings.h"
-#include "upd-util.h"
-
-#include <app_service.h>
-
-void upd_prepare_popup(int type, void *userdata)
-{
-       __UPD_FUNC_ENTER__;
-       upd_appdata_t *ad = upd_get_appdata();
-       upd_popup_t *pop = ad->popup_data;
-
-       //upd_destroy_popup();
-
-       memset(pop, 0, sizeof(upd_popup_t));
-
-       pop->type = type;
-
-       switch (pop->type) {
-#if 0
-       case UPD_BROWSE_FILES_REQ: {
-               snprintf(pop->text, sizeof(pop->text), _("IDS_UPD_BROWSE_Q")); // WFD_STR_POP_APRV_CONNECT4
-               snprintf(pop->label1, sizeof(pop->label1), "%s", dgettext("sys_string", "IDS_COM_SK_YES")); // WFD_STR_BUTN_YES
-               snprintf(pop->label2, sizeof(pop->label2), "%s", dgettext("sys_string", "IDS_COM_SK_NO")); // WFD_STR_BUTN_NO
-               pop->resp_data1 = UPD_BROWSE_FILES_YES;
-               pop->resp_data2 = UPD_BROWSE_FILES_NO;
-
-               ad->popup = upd_draw_pop_type_c(ad->win, pop); // normal popup
-       }
-       break;
-#endif
-       case UPD_NOTI_CONNECTED:
-               upd_draw_connected_syspopup();
-               break;
-       default:
-               break;
-       }
-
-       __UPD_FUNC_EXIT__;
-       return;
-}