)
FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -fdata-sections -ffunction-sections -Wl,--gc-sections")
ENDFOREACH(flag)
ADD_SUBDIRECTORY(mobileprint)
+mobileprint (0.2.21-1) unstable; urgency=low
+
+ * Clean up for tizen 2.1 source open
+ * Refactored structure
+ * Updated refresh position of printer list popup to follow latest UX
+ * Git: apps/home/mobileprint
+ * Tag: mobileprint_0.2.21-1
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Fri, 29 Mar 2013 22:36:32 +0900
+
+mobileprint (0.2.20-1) unstable; urgency=low
+
+ * Fixed Jira issues(S1-12503,S1-12482) by SRR
+ * Show refresh btn for 1st searching (workaround by different searching result)
+ * Show cancel btn for 1 page printing
+ * Added current page printing
+ * Git: magnolia/apps/home/mobileprint
+ * Tag: mobileprint_0.2.20-1
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Sat, 23 Mar 2013 11:35:47 +0900
+
+mobileprint (0.2.19-1) unstable; urgency=low
+
+ * Removed unnecessary smack permission
+ * Git: magnolia/apps/home/mobileprint
+ * Tag: mobileprint_0.2.19-1
+
+ -- GangHeok Kim <gangheok.kim@samsung.com> Wed, 20 Mar 2013 16:41:19 +0900
+
+mobileprint (0.2.18-1) unstable; urgency=low
+
+ * Code clean-up
+ * Added test code for multi contents
+ * Added missing commit to fix build error(undefined symbol of ptdb)
+ * Git: magnolia/apps/home/mobileprint
+ * Tag: mobileprint_0.2.18-1
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Mon, 18 Mar 2013 15:29:18 +0900
+
+mobileprint (0.2.17-11) unstable; urgency=low
+
+ * Applied SRR patches (screen reader, getppd API, multiple images support, prevent fix)
+ * Git: magnolia/apps/home/mobileprint
+ * Tag: mobileprint_0.2.17-11
+
+ -- Taeksu Shin <taeksu.shin@samsung.com> Thu, 14 Mar 2013 23:35:51 +0900
+
mobileprint (0.2.17-10) unstable; urgency=low
* Changed to show dimming list for unsupported printer
+++ /dev/null
-Source: mobileprint
-Section: devel
-Priority: extra
-Maintainer: GangHeok Kim <gangheok.kim@samsung.com>, Taeksu Shin <taeksu.shin@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com>
-Uploaders: GangHeok Kim <gangheok.kim@samsung.com>, Taeksu Shin <taeksu.shin@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com>
-Build-Depends: debhelper (>= 5),
- libelm-dev,
- dlog-dev,
- libappsvc-dev,
- print-service-dev,
- libslp-utilx-dev,
- libui-gadget-dev,
- libappcore-efl-dev,
- capi-appfw-application,
- capi-appfw-application-dev,
- syspopup-caller-dev,
- libnotification-dev,
- libslp-pm-dev,
-Standards-Version: 0.1.0
-
-Package: org.tizen.mobileprint
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends},
- print-service,
- poppler-utils,
-Description: Mobile Print application
-
-Package: org.tizen.mobileprint-dbg
-Section: debug
-Architecture: any
-Depends: org.tizen.mobileprint(= ${Source-Version})
-Description: SLP Mobile Print UI Gadget(unstripped)
-
-Package: org.tizen.usb-printer-detector
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends},
- print-service,
- poppler-utils,
-Description: USB OTG Printer popup application
-
-Package: org.tizen.usb-printer-detector-dbg
-Section: debug
-Architecture: any
-Depends: org.tizen.usb-printer-detector(= ${Source-Version})
-Description: USB OTG Printer popup application debug pkg
-
-
+++ /dev/null
-CMakeLists.txt
+++ /dev/null
-@PREFIX@/*
-/opt/share/applications/org.tizen.mobileprint.desktop
+++ /dev/null
-#!/bin/sh
-
-if [ ${USER} = "root" ]
-then
-# Change file owner
- chown -R 5000:5000 @PREFIX@/data
- chown -R 5000:5000 @PREFIX@/cache
-fi
-
-echo "Done"
+++ /dev/null
-/opt/usr/apps/org.tizen.usb-printer-detector/*
-/opt/share/applications/org.tizen.usb-printer-detector.desktop
+++ /dev/null
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-export DH_VERBOSE=1
-
-CFLAGS += -Wall -g
-LDFLAGS ?=
-PREFIX ?= /opt/usr/apps/org.tizen.mobileprint
-RESDIR ?= ${PREFIX}/res
-UGDIR ?= /opt/ug
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-
-LDFLAGS += -Wl,--hash-style=both -Wl,--rpath=/usr/lib -Wl,--rpath=${UGDIR}/lib -Wl,--as-needed
-
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- # Add here commands to configure the package.
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX="$(PREFIX)"
-
- touch configure-stamp
-
-build: build-stamp
-
-build-stamp: configure-stamp
- dh_testdir
-
- # Add here commands to compile the package.
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
-
- for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
- cat $$f > $${f%.in}; \
- sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
- sed -i -e "s#@RESDIR@#$(RESDIR)#g" $${f%.in}; \
- sed -i -e "s#@UGDATADIR@#$(UGDATADIR)#g" $${f%.in}; \
- sed -i -e "s#@UGDIR@#$(UGDIR)#g" $${f%.in}; \
- done
-
-
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
-
- # Add here commands to clean up after the build process.
- rm -rf $(CMAKE_BUILD_DIR)
-
- for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
- rm -f $${f%.in}; \
- done
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/mobileprint.
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
-# dh_installchangelogs
-# dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
-# dh_installmenu
-# dh_installdebconf
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_python
-# dh_installinit
-# dh_installcron
-# dh_installinfo
- dh_installman
- dh_link
- dh_strip --dbg-package=org.tizen.mobileprint-dbg --dbg-package=org.tizen.usb-printer-detector-dbg
- dh_compress
- dh_fixperms
-# dh_perl
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
SET(EDC_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/edc")
SET(EDJDIR "${RESDIR}/edje/")
SET(IMGDIR "${RESDIR}/images/")
-set(VERSION "0.2.6")
-
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE "Release")
MESSAGE("add -DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")
-
ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
ADD_DEFINITIONS("-DUGDATADIR=\"${UGDATADIR}\"")
ADD_DEFINITIONS("-DCONFIG_PRINT_SETTING")
-
#####################################################
-########### install desktop file & icon #############
+########### install xml file & icon #############
#####################################################
-#CONFIGURE_FILE(${PROJECT_NAME}.desktop.in ${PKGNAME}.desktop)
-#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 "/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 ${PPDDIR})
ADD_SUBDIRECTORY(previewgen)
ADD_SUBDIRECTORY(smsc)
ADD_SUBDIRECTORY(app)
ADD_SUBDIRECTORY(po)
-
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 -lpreview_engine -lsmsc)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${app_pkgs_LDFLAGS} -lprint-service -lpreviewgen -lecore_evas -lpreview_engine -lsmsc -lptdb)
ADD_DEPENDENCIES(${PROJECT_NAME} mobileprint_edj_build genlist_custom_edj_build)
PTS_TRACE_END;
}
-
void image_editor_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");
+ pts_appdata_t *ad = (pts_appdata_t *)priv;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
char *path = NULL;
- service_get_extra_data(result, "crop_image_path", &path);
-
- if (path) {
- /* save path */
- PTS_IF_FREE_MEM(ugd->pt_files.request_files[0]);
- ugd->pt_files.request_files[0] = strdup(path);
- PTS_DEBUG("crop_image_path: %s", path);
- pts_main_view_rotate_image(ugd, app_get_device_orientation());
- size_index = ugd->image_size; // When crop is done, then save the index.
- } else {
- PTS_DEBUG("no crop_image_path");
- }
+ int ret = -1;
+ ret = service_get_extra_data(result, "crop_image_path", &path);
+ PTS_RET_IF(ret != SERVICE_ERROR_NONE, "Failed to get crop_image_path(%d)", ret);
+ PTS_RET_IF(path == NULL, "path is NULL");
+
+ /* save path */
+ PTS_IF_FREE_MEM(ad->printing_data.request_files[0]);
+ ad->printing_data.request_files[0] = strdup(path);
+ PTS_DEBUG("crop_image_path: %s", path);
+ pts_main_view_rotate_image(ad, app_get_device_orientation());
+ size_index = ad->size_popup_info.image_size; // When crop is done, then save the index.
+
PTS_TRACE_END;
}
void image_editor_destroy_cb(ui_gadget_h ug, void *priv)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)priv;
- PTS_RET_IF(ugd == NULL || ug == NULL, "Invalid argument");
+ pts_appdata_t *ad = (pts_appdata_t *)priv;
+ PTS_RET_IF(ad == NULL || ug == NULL, "Invalid argument");
ug_destroy(ug);
PTS_TRACE_END;
}
-int load_image_editor_ug(pts_core_data_t *ugd)
+int load_image_editor_ug(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL, -1, "ugd is NULL");
+ PTS_RETV_IF(ad == NULL, -1, "ad is NULL");
struct ug_cbs image_editor_cbs;
ui_gadget_h ug = NULL;
int w = 300;
int h = 300;
- switch (ugd->image_size) {
+ switch (ad->size_popup_info.image_size) {
case PTS_SIZE_FIT_TO_PAPER:
break;
case PTS_SIZE_5X7:
w = w * 1.31;
break;
case PTS_SIZE_CUSTOM:
- w = w * (ugd->custom_width / ugd->custom_height);
+ w = w * (ad->size_popup_info.custom_width / ad->size_popup_info.custom_height);
PTS_DEBUG("Passed custom ratio : %dx%d", w, h);
break;
default:
image_editor_cbs.layout_cb = image_editor_layout_cb;
image_editor_cbs.result_cb = image_editor_result_cb;
image_editor_cbs.destroy_cb = image_editor_destroy_cb;
- image_editor_cbs.priv = ugd;
+ image_editor_cbs.priv = ad;
service_create(&service);
service_add_extra_data(service, "View Mode", "SETAS");
- service_add_extra_data(service, "Path", ugd->input_file);
+ service_add_extra_data(service, "Path", ad->printing_data.input_file);
service_add_extra_data(service, "Setas type", "Crop");
service_add_extra_data(service, "Fixed ratio", "TRUE");
}
/*
-* the registered callback function is called
-* when the orientation of device changes
-*/
-static void _app_rotate(app_device_orientation_e orientation, void *user_data)
-{
- PTS_TRACE_BEGIN;
- pts_appdata_t *ad = (pts_appdata_t *)user_data;
- PTS_RET_IF(ad == NULL,"appdata is NULL");
- PTS_RET_IF(ad->win == NULL,"appdata->win is NULL");
-
- 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);*/
-
- if (NULL != ad->ugd->size_popup) {
- PTS_DEBUG("Found size 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->size_popup_box,
- 400 * elm_config_scale_get(), (6 * 114) * elm_config_scale_get());
- } else {
- evas_object_size_hint_min_set(ad->ugd->size_popup_box,
- 400 * elm_config_scale_get(), ad->ugd->size_popup_landscape_height);
- }
- } else if (NULL != ad->ugd->custom_popup) {
- PTS_DEBUG("Found custom 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->custom_popup_box,
- (5 * 114 + 4) * elm_config_scale_get(), ad->ugd->custom_popup_portrait_height);
- } else {
- evas_object_size_hint_min_set(ad->ugd->custom_popup_box,
- 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");
- }
-
- PTS_TRACE_END;
-}
-
-/*
* create the main window
*/
static Evas_Object *_create_win(const char *name)
int w = 0;
int h = 0;
+ const int rots[4] = { APP_DEVICE_ORIENTATION_0,
+ APP_DEVICE_ORIENTATION_90,
+ APP_DEVICE_ORIENTATION_180,
+ APP_DEVICE_ORIENTATION_270 };
+
eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
PTS_RETV_IF(eo == NULL, NULL, "Failed to elm_win_add");
ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
evas_object_resize(eo, w, h);
+ /* Register a list of rotation angles that mobileprint supports */
+ if (elm_win_wm_rotation_supported_get(eo))
+ elm_win_wm_rotation_available_rotations_set(
+ eo, rots, 4);
+
PTS_TRACE_END;
return eo;
}
-static int __get_window_property(Display *dpy, Window win, Atom atom,
- Atom type, unsigned int *val,
- unsigned int len)
+/*
+* callback function for device rotation
+*/
+static void _rot_changed_cb(void *data, Evas_Object *obj, void *event)
{
+ pts_appdata_t *ad = (pts_appdata_t*)data;
+ int rot;
+
PTS_TRACE_BEGIN;
- unsigned char *prop_ret;
- Atom type_ret;
- unsigned long bytes_after;
- unsigned long num_ret;
- int format_ret;
- unsigned int i;
- int num;
-
- prop_ret = NULL;
- if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
- type, &type_ret, &format_ret, &num_ret,
- &bytes_after, &prop_ret) != Success) {
- return -1;
- }
- if (type_ret != type || format_ret != 32) {
- num = -1;
- } else if (num_ret == 0 || !prop_ret) {
- num = 0;
- } else {
- if (num_ret < len) {
- len = num_ret;
+ rot = elm_win_rotation_get(ad->win);
+
+
+ if (NULL != ad->list_info.active_printer) {
+ if (NULL != ad->size_popup_info.size_popup) {
+ PTS_DEBUG("Found size popup. Let's resize it");
+ if (rot == APP_DEVICE_ORIENTATION_0
+ || rot == APP_DEVICE_ORIENTATION_180)
+ evas_object_size_hint_min_set(
+ ad->size_popup_info.size_popup_box,
+ 400 * elm_config_scale_get(),
+ ad->size_popup_info
+ .size_popup_portrait_height);
+ else
+ evas_object_size_hint_min_set(
+ ad->size_popup_info.size_popup_box,
+ 400 * elm_config_scale_get(),
+ ad->size_popup_info
+ .size_popup_landscape_height);
}
- for (i = 0; i < len; i++) {
- val[i] = ((unsigned long *)prop_ret)[i];
+ else if (NULL != ad->size_popup_info.custom_popup) {
+ PTS_DEBUG("Found custom popup. Let's resize It");
+ if (rot == APP_DEVICE_ORIENTATION_0
+ || rot == APP_DEVICE_ORIENTATION_180)
+ evas_object_size_hint_min_set(
+ ad->size_popup_info.custom_popup_box,
+ 400 * elm_config_scale_get(),
+ ad->size_popup_info
+ .custom_popup_portrait_height);
+ else
+ evas_object_size_hint_min_set(
+ ad->size_popup_info.custom_popup_box,
+ 400 * elm_config_scale_get(),
+ ad->size_popup_info
+ .custom_popup_landscape_height);
}
- num = len;
}
-
- if (prop_ret) {
- XFree(prop_ret);
+ else if (NULL != ad->list_info.printer_list_popup) {
+ PTS_DEBUG("Found printer list popup. Let's resize it");
+ if (rot == APP_DEVICE_ORIENTATION_0
+ || rot == APP_DEVICE_ORIENTATION_180)
+ evas_object_size_hint_min_set(
+ ad->list_info.printer_list_popup_box,
+ PRINTER_LIST_POPUP_W * elm_config_scale_get(),
+ ad->list_info
+ .printer_list_popup_portrait_height);
+ else
+ evas_object_size_hint_min_set(
+ ad->list_info.printer_list_popup_box,
+ PRINTER_LIST_POPUP_LN_W
+ * elm_config_scale_get(),
+ ad->list_info
+ .printer_list_popup_landscape_height);
}
PTS_TRACE_END;
- return num;
-}
-
-static int __x_rotation_get(Display *dpy, Window win)
-{
- PTS_TRACE_BEGIN;
- Window active_win;
- Window root_win;
- int rotation = -1;
- int ret;
-
- Atom atom_active_win;
- Atom atom_win_rotate_angle;
-
- root_win = XDefaultRootWindow(dpy);
-
- atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
- ret = __get_window_property(dpy, root_win, atom_active_win,
- XA_WINDOW,
- (unsigned int *)&active_win, 1);
-
- /*printf("[SYSPOPUP] Active win : %x, Window %x\n", active_win, win);*/
-
- /*active_win = get_active_win(dpy, root_win, atom_active_win);*/
- if (ret < 0) {
- return ret;
- }
-
- atom_win_rotate_angle =
- XInternAtom(dpy, "_E_ILLUME_ROTATE_WINDOW_ANGLE", False);
- ret = __get_window_property(dpy, active_win,
- atom_win_rotate_angle, XA_CARDINAL,
- (unsigned int *)&rotation, 1);
-
- /*printf("[SYSPOPUP] Rotation %d\n", rotation);*/
-
- PTS_TRACE_END;
-
- if (ret != -1) {
- return rotation;
- }
-
- return -1;
-}
-
-
-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;
-
- // 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);
-
- if (rotation == -1) {
- rotation = 0;
- }
-
- if (rotation >= 0) {
- elm_win_rotation_with_resize_set(win, rotation);
- }
-
- ad->prev_app_win_rotate = rotation;
-
- PTS_TRACE_END;
- return 0;
}
/*
ad->win = _create_win(name);
PTS_RETV_IF(ad->win == NULL, false, "ad->win is NULL");
- //app_device_orientation_e rotation_state = app_get_device_orientation();
- //_app_rotate(rotation_state, ad);
- //DBG("device orientation : %d", rotation_state);
-
- __as_rotate(ecore_x_display_get(), elm_win_xwindow_get(ad->win), ad->win, ad);
+ evas_object_smart_callback_add(ad->win, "wm,rotation,changed",
+ _rot_changed_cb, ad);
UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
PTS_TRACE_BEGIN;
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 && ad->ugd->dummy_noti_id == 0) {
+ if (ad->noti_info.job_spooling_list == NULL && ad->noti_info.dummy_noti_id == 0) {
PTS_DEBUG("Without active job spooling, mobileprint will terminate when moved background.");
app_efl_exit();
} else {
static Eina_Bool _simple_exit(void *data)
{
PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *) data;
- PTS_IF_FREE_MEM(ld);
+ pts_appdata_t *ad = (pts_appdata_t *) data;
+ PTS_IF_FREE_MEM(ad);
elm_exit();
PTS_TRACE_END;
return ECORE_CALLBACK_CANCEL;
PTS_TRACE_BEGIN;
pts_appdata_t *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
+ //pts_core_data_t *ugd = ad->ugd;
// XXX - show main view after set active/default printer
- pts_create_main_view(ugd);
+ pts_create_main_view(ad);
// 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),
+ edje_object_signal_callback_add(elm_layout_edje_get(ad->main_info.main_layout),
"EXIT", "*", main_quit_cb, NULL);
- pts_main_view_update_printer_label(ugd);
- pts_main_view_rotate_image(ugd, app_get_device_orientation());
+ pts_main_view_update_printer_label(ad);
+ pts_main_view_rotate_image(ad, app_get_device_orientation());
- evas_object_show(ugd->main_layout);
- evas_object_show(ugd->root_win);
+ evas_object_show(ad->main_info.main_layout);
+ evas_object_show(ad->main_info.root_win);
PTS_TRACE_END;
}
-
/*
* load the app
*/
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);
+ ecore_timer_add(1, (Ecore_Task_Cb)_simple_exit, (void *)ad);
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");
- ad->ugd = ugd;
- ugd->root_win = ad->win;
- pts_set_ugd(ugd);
+ if (ad->main_info.root_win == NULL) {
+ ad->main_info.root_win = ad->win;
}
- ret = pt_init(__pts_event_cb, ad->ugd);
+ ret = pt_init(__pts_event_cb, ad);
PTS_RET_IF(ret != PT_ERR_NONE,"pt_init error");
//TODO: Remove this after ecore fix max thread number problem.
/*
* prepare load print files
*/
- 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_main_view_load_printing_data(ad, pt_files);
+
+ ad->search_info.print_search_mode = PTS_SEARCH_INITIAL;
+ ad->search_info.selection_done_cb = load_main_view;
+ ad->search_info.print_search_popup_parent = ad->main_info.root_win;
+ ad->search_info.printer_search_user_data = NULL;
+ pts_search_printer(ad);
PTS_TRACE_END;
}
int page_count = atoi(value);
PTS_DEBUG("page_count[%d]", page_count);
- __pts_print_dummy_popup(ad->ugd, files, page_count);
+ __pts_print_dummy_popup(ad, files, page_count);
evas_object_raise(ad->win);
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);
+ __pts_print_progress_popup(ad, job_id, page_count);
}
evas_object_raise(ad->win);
char *uri_temp = NULL;
ret = service_get_extra_data(*service, SERVICE_PRINT_FILES_TYPE, &value);
-#ifdef PTS_IMAGE_SELFTEST
- if (ret != SERVICE_ERROR_NONE) {
- printing_data = (pts_printing_data_t *)calloc(1, sizeof(pts_printing_data_t));
- PTS_RETV_IF(printing_data == NULL, EINA_FALSE, "printing_data is NULL");
- printing_data->type = strdup("IMG");
- printing_data->num_of_files = 1;
- uri_temp = strdup("/opt/usr/media/Images/image1.jpg");
- printing_data->request_files = &uri_temp;
- } else {
-#endif /* end of IMAGE_SELFTEST */
PTS_RETV_IF(ret != SERVICE_ERROR_NONE, EINA_FALSE, "get the type of print files failed!, errno: %d", ret);
bret = _pts_printing_data_set_type(value, printing_data);
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");
-#ifdef PTS_IMAGE_SELFTEST
- }
-#endif /* end of IMAGE_SELFTEST */
-
__app_load_data(ad, printing_data);
evas_object_raise(ad->win);
PTS_RET_IF(ad->win == NULL, "ad->win is NULL");
int ret = -1;
- char *value = NULL;
+ char *value = NULL;
pts_printing_data_t printing_data;
service_h reply_service;
Eina_Bool is_success = EINA_FALSE;
PTS_DEBUG("SERVICE_PRINT_FILES_COUNT ERROR(%d) ", ret);
}
} else if (ret == SERVICE_ERROR_NONE) {
+ PTS_DEBUG("SERVICE_LAUNCH_TYPE : %s", value);
if (!strcmp(value, LAUNCH_FROM_DUMMY_NOTI)) {
PTS_DEBUG("***** DUMMY NOTI MODE *****");
is_success = show_dummy_noti_popup(&service, user_data, &printing_data);
} else {
service_reply_to_launch_request(reply_service, service, SERVICE_RESULT_FAILED);
pts_util_show_error_popup(ad->win, IDS_PRT_41);
- ecore_timer_add(1, (Ecore_Task_Cb)_simple_exit, (void *)ad->ugd);
+ ecore_timer_add(1, (Ecore_Task_Cb)_simple_exit, (void *)ad);
}
PTS_TRACE_END;
return;
event_callback.service = _app_service;
event_callback.low_memory = NULL;
event_callback.low_battery = NULL;
- event_callback.device_orientation = _app_rotate;
+ event_callback.device_orientation = NULL;
event_callback.language_changed = NULL;
event_callback.region_format_changed = NULL;
return 0;
}
-int printer_get_setting_is_original_zoom(
- const pt_printer_mgr_t *active_printer)
-{
-#if 0
- if (active_printer->scaling == PT_SCALING_ORIGINAL_SIZE) {
- return 1;
- }
-#endif
- return 0;
-}
-
-
int pts_image_size_t2page_scale(pts_image_size_e pts_size,
struct page_scale *scale)
{
* @param[in] ugd the pointer to the main data structure
* @return
*/
-int generate_preview_images(pts_core_data_t *ugd,
+int generate_preview_images(pts_appdata_t *ad,
app_device_orientation_e dev_orientation)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL , -1 , "ugd is NULL");
+ PTS_RETV_IF(ad == NULL , -1 , "ad is NULL");
int result = 0;
struct paper_size_pts paper_size;
enum page_orientation orientation;
- //int is_original_zoom;
struct page_scale scale = {0, 0, 0};
int n_up;
int is_grayscale;
- struct size_px client_size;
- pt_printer_mgr_t *active_printer = ugd->active_printer;
+ pt_printer_mgr_t *active_printer = ad->list_info.active_printer;
char *ppd;
- //char *first_file_path;
/* currently supported: only one PDF or multiple images;
mixed images-pdf unsupported */
- PTS_RETV_IF(ugd == NULL || ugd->pt_files.num_of_files <= 0, -1 , "Invalid argument");
-
- /* TODO: use widget maximum size */
- //evas_object_geometry_get(ugd->img_layout, NULL, NULL,
- // &(client_size.x), &(client_size.y));
- //evas_object_geometry_get(ugd->root_win, NULL, NULL,
- // &(client_size.x), &(client_size.y));
-
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &(client_size.x), &(client_size.y));
-
- PTS_DEBUG("rotating orientation, dev_orientation = %d,"
- " app_get_device_orientation() = %d",
- dev_orientation, app_get_device_orientation());
- if (APP_DEVICE_ORIENTATION_0 == dev_orientation
- || APP_DEVICE_ORIENTATION_180 == dev_orientation) {
- if (client_size.x > client_size.y) {
- switch_size_px_coords(&client_size);
- }
- } else {
- if (client_size.x < client_size.y) {
- switch_size_px_coords(&client_size);
- }
- }
-
- /* WARNING: potential problem here: geometry calculation sometimes
- are incorrect, but with wide pictures currently it works */
- if (client_size.x > client_size.y && client_size.y > 320) {
- client_size.y = 320; /* ugly hack */
- }
+ PTS_RETV_IF(ad->printing_data.num_of_files <= 0, -1 , "Invalid argument");
/* should be taken from settings */
if (active_printer != NULL) {
printer_get_paper_size(&paper_size);
orientation = printer_get_setting_orientation(active_printer);
n_up = printer_get_setting_n_up(active_printer);
- pts_image_size_t2page_scale(ugd->image_size, &scale);
- if (ugd->image_size == PTS_SIZE_CUSTOM) {
- scale.w = ugd->custom_width;
- scale.h = ugd->custom_height;
+ pts_image_size_t2page_scale(ad->size_popup_info.image_size, &scale);
+ if (ad->size_popup_info.image_size == PTS_SIZE_CUSTOM) {
+ scale.w = ad->size_popup_info.custom_width;
+ scale.h = ad->size_popup_info.custom_height;
scale.type = SCALE_CUSTOM;
}
is_grayscale = is_printer_grayscale(active_printer);
is_grayscale = 1;
}
- //first_file_path = ugd->pt_files.files[0];
- //DBG("PDF_PATH IS: %s", first_file_path);
PTS_DEBUG("USING PPD: %s", ppd);
PTS_DEBUG("PAPER NAME: %s", paper_size.name);
PTS_DEBUG("PAPER SIZE: %f, %f", paper_size.s.x, paper_size.s.y);
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),
- ugd->pt_files.request_files[0], ppd,
- &paper_size,
- &client_size, orientation, n_up,
- &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);
+ result = evas_smart_smsc_set_file(ad->main_info.smsc,
+ ad->printing_data.request_files, ad->printing_data.num_of_files,
+ ppd, &paper_size, orientation, n_up, &scale,
+ is_grayscale);
PTS_DEBUG("evas_smart_smsc_set_file: %d", result);
PTS_TRACE_END;
#include <sysman.h>
#include <syspopup_caller.h>
#include "mobileprint.h"
-//#include "pts_common.h"
#include "image_editor_conn.h"
#include "pts_main_view.h"
#include "preview_util.h"
-pts_core_data_t *g_ugd;
-Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_core_data_t *ugd);
-void __pts_main_view_create_list_view(pts_core_data_t *ugd);
+Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_appdata_t *ad);
+void __pts_main_view_create_list_view(pts_appdata_t *ad);
void main_quit_cb(void *data, Evas_Object *obj,
const char *emission, const char *source);
static Evas_Object *height_layout;
static Evas_Object *height_entry;
-void pts_set_ugd(pts_core_data_t *ugd)
-{
- g_ugd = ugd;
-}
-
-pts_core_data_t *pts_get_ugd(void)
-{
- return g_ugd;
-}
-
int pts_unstandardization(char *name)
{
char *ptr = NULL;/* Pointer into name */
static void _pts_scaling_set_cb(void *data, Evas_Object *obj, void *event_info)
{
PTS_TRACE_BEGIN;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
- if (NULL != scaling_radio_main) {
- evas_object_del(scaling_radio_main);
- scaling_radio_main = NULL;
- }
-
- if (NULL != ugd->scaling_popup) {
- evas_object_del(ugd->scaling_popup);
- ugd->scaling_popup = NULL;
- }
-
- pts_main_view_rotate_image(ugd, app_get_device_orientation());
+ PTS_IF_DEL_OBJ(scaling_radio_main);
+ PTS_IF_DEL_OBJ(ad->scaling_popup_info.scaling_popup);
+ pts_main_view_rotate_image(ad, app_get_device_orientation());
PTS_TRACE_END;
}
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(NULL == ugd, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(NULL == ad, "ad is NULL");
int scaling = -1;
Elm_Object_Item *item = event_info;
if (scaling > -1) {
PTS_DEBUG("Selected scaling : %d", scaling);
- scaling_index = ugd->active_printer->scaling = scaling;
+ scaling_index = ad->list_info.active_printer->scaling = scaling;
// Now call real event trigger to update radio button when selected.
elm_genlist_item_update(item);
PTS_TRACE_END;
}
-Evas_Object *pts_create_scaling_popup(Evas_Object *parent, pts_core_data_t *ugd)
+Evas_Object *pts_create_scaling_popup(Evas_Object *parent, pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
Evas_Object *popup;
elm_object_style_set(btn1,"popup_button/default");
elm_object_text_set(btn1, _("IDS_PRT_BODY_SCALING_ABB"));
elm_object_part_content_set(popup, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", _pts_scaling_set_cb, ugd);
+ evas_object_smart_callback_add(btn1, "clicked", _pts_scaling_set_cb, ad);
genlist = elm_genlist_add(popup);
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
Elm_Object_Item *item = NULL;
for (index = 0; index < (PT_SCALING_4_PAGES+1); index++) {
- item = elm_genlist_item_append(genlist, &scaling_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, __pts_scaling_sel, ugd);
+ item = elm_genlist_item_append(genlist, &scaling_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, __pts_scaling_sel, ad);
PTS_DEBUG("index[%d] - item added : %s", index, (NULL == item)? "FAILURE" : "SUCCESS");
}
evas_object_show(genlist);
evas_object_show(popup);
- ugd->scaling_popup = popup;
+ ad->scaling_popup_info.scaling_popup = popup;
PTS_TRACE_END;
return genlist;
static void _pts_size_cancel_cb(void *data, Evas_Object *obj, void *event_info)
{
PTS_TRACE_BEGIN;
-
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(NULL == ugd, "ugd is NULL");
-
- if (NULL != size_radio_main) {
- evas_object_del(size_radio_main);
- size_radio_main = NULL;
- }
-
- evas_object_del(obj);
- evas_object_del(ugd->size_popup);
- ugd->size_popup = NULL;
-
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(NULL == ad, "ad is NULL");
+ PTS_IF_DEL_OBJ(size_radio_main);
+ PTS_IF_DEL_OBJ(obj);
+ PTS_IF_DEL_OBJ(ad->size_popup_info.size_popup);
PTS_TRACE_END;
}
int index = (int)data;
char *label = NULL;
char custom[32] = {0,};
- pts_core_data_t *ugd = pts_get_ugd();
+ pts_appdata_t *ad = pts_get_appdata();
if (strcmp(part, "elm.text") == 0) {
switch (index) {
label = strdup(IDS_BR_OPT_WALLET);
break;
case PTS_SIZE_CUSTOM:
- if (ugd->custom_unit == 1) { // cm unit
- snprintf(custom, 32, "%s (%.1lfx%.1lfcm)", _("IDS_COM_SK_CUSTOM"), ugd->custom_height, ugd->custom_width);
- } else if (ugd->custom_unit == 2) { // inch unit
- snprintf(custom, 32, "%s (%.1lf\"x%.1lf\")", _("IDS_COM_SK_CUSTOM"), ugd->custom_height, ugd->custom_width);
+ if (ad->size_popup_info.custom_unit == 1) { // cm unit
+ snprintf(custom, 32, "%s (%.1lfx%.1lfcm)", _("IDS_COM_SK_CUSTOM"), ad->size_popup_info.custom_height, ad->size_popup_info.custom_width);
+ } else if (ad->size_popup_info.custom_unit == 2) { // inch unit
+ snprintf(custom, 32, "%s (%.1lf\"x%.1lf\")", _("IDS_COM_SK_CUSTOM"), ad->size_popup_info.custom_height, ad->size_popup_info.custom_width);
} else {
- snprintf(custom, 32, "%s (%.1lfx%.1lf)", _("IDS_COM_SK_CUSTOM"), ugd->custom_height, ugd->custom_width);
+ snprintf(custom, 32, "%s (%.1lfx%.1lf)", _("IDS_COM_SK_CUSTOM"), ad->size_popup_info.custom_height, ad->size_popup_info.custom_width);
}
label = strdup(custom);
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
int size = -1;
Elm_Object_Item *item = event_info;
if (size > PTS_SIZE_FIT_TO_PAPER && size < PTS_SIZE_CUSTOM) {
PTS_DEBUG("Selected size : %d", size);
- ugd->image_size = size;
+ ad->size_popup_info.image_size = size;
// Now call real event trigger to update radio button when selected.
elm_genlist_item_update(item);
- load_image_editor_ug(ugd);
+ load_image_editor_ug(ad);
} else if (size == PTS_SIZE_CUSTOM) {
- pts_create_custom_popup(ugd->navi, ugd);
+ pts_create_custom_popup(ad->main_info.navi, ad);
} else if (size == PTS_SIZE_FIT_TO_PAPER) {
- size_index = ugd->image_size = size;
+ size_index = ad->size_popup_info.image_size = size;
// just back to fit-to-paper of original image
- PTS_IF_FREE_MEM(ugd->pt_files.request_files[0]);
- ugd->pt_files.request_files[0] = strdup(ugd->input_file);
- PTS_DEBUG("original_image_path: %s", ugd->pt_files.request_files[0]);
- pts_main_view_rotate_image(ugd, app_get_device_orientation());
+ PTS_IF_FREE_MEM(ad->printing_data.request_files[0]);
+ ad->printing_data.request_files[0] = strdup(ad->printing_data.input_file);
+ PTS_DEBUG("original_image_path: %s", ad->printing_data.request_files[0]);
+ pts_main_view_rotate_image(ad, app_get_device_orientation());
} else {
PTS_DEBUG("Unknown size");
}
- evas_object_del(obj);
- evas_object_del(ugd->size_popup);
- ugd->size_popup = NULL;
-
- if (NULL != size_radio_main) {
- evas_object_del(size_radio_main);
- size_radio_main = NULL;
- }
+ PTS_IF_DEL_OBJ(obj);
+ PTS_IF_DEL_OBJ(ad->size_popup_info.size_popup);
+ PTS_IF_DEL_OBJ(size_radio_main);
}
PTS_TRACE_END;
}
-Evas_Object *pts_create_size_popup(Evas_Object *parent, pts_core_data_t *ugd)
+Evas_Object *pts_create_size_popup(Evas_Object *parent, pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
Evas_Object *popup;
elm_object_style_set(btn1, "popup_button/default");
elm_object_text_set(btn1, _("IDS_COM_SK_CANCEL"));
elm_object_part_content_set(popup, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", _pts_size_cancel_cb, ugd);
+ evas_object_smart_callback_add(btn1, "clicked", _pts_size_cancel_cb, ad);
genlist = elm_genlist_add(popup);
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
Elm_Object_Item *item = NULL;
for (index = 0; index < PTS_SIZE_MAX; index++) {
- item = elm_genlist_item_append(genlist, &size_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, __pts_size_sel, ugd);
+ item = elm_genlist_item_append(genlist, &size_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, __pts_size_sel, ad);
PTS_DEBUG("index[%d] - item added : %s", index, (NULL == item)? "FAILURE" : "SUCCESS");
}
elm_box_pack_end(box, genlist);
- ugd->size_popup_portrait_height = elm_genlist_items_count(genlist) * 114 * elm_config_scale_get();
- ugd->size_popup_landscape_height = 300;
+ ad->size_popup_info.size_popup_portrait_height = elm_genlist_items_count(genlist) * 114 * elm_config_scale_get();
+ ad->size_popup_info.size_popup_landscape_height = 300;
- app_device_orientation_e orientation = app_get_device_orientation();
+ int orientation = 0;
+ if (ad->win)
+ orientation = elm_win_rotation_get(ad->win);
if (APP_DEVICE_ORIENTATION_0 == orientation ||
APP_DEVICE_ORIENTATION_180 == orientation) {
- evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ugd->size_popup_portrait_height);
+ evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ad->size_popup_info.size_popup_portrait_height);
} else {
- evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ugd->size_popup_landscape_height);
+ evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ad->size_popup_info.size_popup_landscape_height);
}
elm_object_content_set(popup, box);
- ugd->size_popup_box = box;
+ ad->size_popup_info.size_popup_box = box;
evas_object_show(genlist);
evas_object_show(popup);
- ugd->size_popup = popup;
+ ad->size_popup_info.size_popup = popup;
PTS_TRACE_END;
return genlist;
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
- ugd->image_size = PTS_SIZE_CUSTOM;
- load_image_editor_ug(ugd);
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- evas_object_del(obj);
- evas_object_del(ugd->custom_popup);
- ugd->custom_popup = NULL;
+ ad->size_popup_info.image_size = PTS_SIZE_CUSTOM;
+ load_image_editor_ug(ad);
+ PTS_IF_DEL_OBJ(obj);
+ PTS_IF_DEL_OBJ(ad->size_popup_info.custom_popup);
elm_theme_extension_del(NULL, RESDIR"/edje/genlist_custom.edj");
PTS_TRACE_END;
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
- evas_object_del(obj);
- evas_object_del(ugd->custom_popup);
- ugd->custom_popup = NULL;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
+ PTS_IF_DEL_OBJ(obj);
+ PTS_IF_DEL_OBJ(ad->size_popup_info.custom_popup);
// FIXME - just back to original size
int tmp_width = 0;
int tmp_height = 0;
- get_image_resolution(ugd->input_file, &tmp_width, &tmp_height);
- ugd->custom_width = (double)tmp_width;
- ugd->custom_height = (double)tmp_height;
- ugd->custom_w_ratio = ugd->custom_width / ugd->custom_height;
- PTS_DEBUG("Original image size : %lfx%lf(%lfx1)", ugd->custom_width, ugd->custom_height, ugd->custom_w_ratio);
+ get_image_resolution(ad->printing_data.input_file, &tmp_width, &tmp_height);
+ ad->size_popup_info.custom_width = (double)tmp_width;
+ ad->size_popup_info.custom_height = (double)tmp_height;
+ ad->size_popup_info.custom_w_ratio = ad->size_popup_info.custom_width / ad->size_popup_info.custom_height;
+ PTS_DEBUG("Original image size : %lfx%lf(%lfx1)", ad->size_popup_info.custom_width, ad->size_popup_info.custom_height, ad->size_popup_info.custom_w_ratio);
// original image size (unit cm) calculated by 300dpi
- ugd->custom_width = (ugd->custom_width / 300) * 2.54;
- ugd->custom_height = (ugd->custom_height / 300) * 2.54;
- ugd->custom_unit = 1; // cm unit
+ ad->size_popup_info.custom_width = (ad->size_popup_info.custom_width / 300) * 2.54;
+ ad->size_popup_info.custom_height = (ad->size_popup_info.custom_height / 300) * 2.54;
+ ad->size_popup_info.custom_unit = 1; // cm unit
elm_theme_extension_del(NULL, RESDIR"/edje/genlist_custom.edj");
entry_text = elm_entry_entry_get(obj);
if ((input_str = elm_entry_markup_to_utf8(entry_text))) {
- pts_core_data_t *ugd = pts_get_ugd();
+ pts_appdata_t *ad = pts_get_appdata();
if (index == 1) {
- ugd->custom_width = atoi(input_str);
+ ad->size_popup_info.custom_width = atoi(input_str);
} else if (index == 3) {
- ugd->custom_height = atoi(input_str);
+ ad->size_popup_info.custom_height = atoi(input_str);
} else {
PTS_DEBUG("Unknown index : %d", index);
}
- PTS_DEBUG("Typed custom value : width[%lf] x height[%lf]", ugd->custom_width, ugd->custom_height);
+ PTS_DEBUG("Typed custom value : width[%lf] x height[%lf]", ad->size_popup_info.custom_width, ad->size_popup_info.custom_height);
PTS_IF_FREE_MEM(input_str);
}
}
if (aspect_ratio) {
- pts_core_data_t *ugd = pts_get_ugd();
+ pts_appdata_t *ad = pts_get_appdata();
if (obj == width_entry) {
- ugd->custom_height = ugd->custom_width / ugd->custom_w_ratio;
- snprintf(temp_size, 32, "%.1lf", ugd->custom_height);
+ ad->size_popup_info.custom_height = ad->size_popup_info.custom_width / ad->size_popup_info.custom_w_ratio;
+ snprintf(temp_size, 32, "%.1lf", ad->size_popup_info.custom_height);
elm_object_signal_emit(height_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(height_entry, temp_size);
} else if (obj == height_entry) {
- ugd->custom_width = ugd->custom_height * ugd->custom_w_ratio;
- snprintf(temp_size, 32, "%.1lf", ugd->custom_width);
+ ad->size_popup_info.custom_width = ad->size_popup_info.custom_height * ad->size_popup_info.custom_w_ratio;
+ snprintf(temp_size, 32, "%.1lf", ad->size_popup_info.custom_width);
elm_object_signal_emit(width_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(width_entry, temp_size);
} else {
Evas_Object *layout, *entry;
static Elm_Entry_Filter_Accept_Set digits_filter_data;
char temp_size[32] = {0,};
- pts_core_data_t *ugd = pts_get_ugd();
+ pts_appdata_t *ad = pts_get_appdata();
layout = elm_layout_add(parent);
elm_layout_theme_set(layout, "layout", "editfield", "default"); // Default editfield layout style without top title.
elm_object_part_content_set(layout, "elm.swallow.content", entry);
if (index == 1) {
- snprintf(temp_size, 32, "%.1lf", ugd->custom_width);
+ snprintf(temp_size, 32, "%.1lf", ad->size_popup_info.custom_width);
elm_object_part_text_set(layout, "elm.guidetext", temp_size);
width_layout = layout;
width_entry = entry;
} else if (index == 3) {
- snprintf(temp_size, 32, "%.1lf", ugd->custom_height);
+ snprintf(temp_size, 32, "%.1lf", ad->size_popup_info.custom_height);
elm_object_part_text_set(layout, "elm.guidetext", temp_size);
height_layout = layout;
height_entry = entry;
{
PTS_TRACE_BEGIN;
char temp[32] = {0,};
- pts_core_data_t *ugd = pts_get_ugd();
- PTS_DEBUG("Current unit : %d", ugd->custom_unit);
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_DEBUG("Current unit : %d", ad->size_popup_info.custom_unit);
- if (ugd->custom_unit == 1) { // cm to inch
- ugd->custom_unit = 2;
- ugd->custom_width = ugd->custom_width / 2.54;
- ugd->custom_height = ugd->custom_height / 2.54;
+ if (ad->size_popup_info.custom_unit == 1) { // cm to inch
+ ad->size_popup_info.custom_unit = 2;
+ ad->size_popup_info.custom_width = ad->size_popup_info.custom_width / 2.54;
+ ad->size_popup_info.custom_height = ad->size_popup_info.custom_height / 2.54;
snprintf(temp, 32, "%s", _("IDS_COM_BODY_UNIT_CM"));
- } else if (ugd->custom_unit == 2) { // inch to cm
- ugd->custom_unit = 1;
- ugd->custom_width = ugd->custom_width * 2.54;
- ugd->custom_height = ugd->custom_height * 2.54;
+ } else if (ad->size_popup_info.custom_unit == 2) { // inch to cm
+ ad->size_popup_info.custom_unit = 1;
+ ad->size_popup_info.custom_width = ad->size_popup_info.custom_width * 2.54;
+ ad->size_popup_info.custom_height = ad->size_popup_info.custom_height * 2.54;
snprintf(temp, 32, "%s", _("IDS_COM_BODY_UNIT_INCH"));
} else {
PTS_DEBUG("Unknown unit");
elm_object_text_set(obj, temp);
- snprintf(temp, 32, "%.1lf", ugd->custom_width);
+ snprintf(temp, 32, "%.1lf", ad->size_popup_info.custom_width);
elm_object_signal_emit(width_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(width_entry, temp);
- snprintf(temp, 32, "%.1lf", ugd->custom_height);
+ snprintf(temp, 32, "%.1lf", ad->size_popup_info.custom_height);
elm_object_signal_emit(height_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(height_entry, temp);
- PTS_DEBUG("Changed unit : %d", ugd->custom_unit);
+ PTS_DEBUG("Changed unit : %d", ad->size_popup_info.custom_unit);
PTS_TRACE_END;
}
{
PTS_TRACE_BEGIN;
char temp[32] = {0,};
- pts_core_data_t *ugd = pts_get_ugd();
- PTS_DEBUG("Current unit : %d", ugd->custom_unit);
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_DEBUG("Current unit : %d", ad->size_popup_info.custom_unit);
- if (ugd->custom_unit == 1) { // cm to inch
- ugd->custom_unit = 2;
- ugd->custom_width = ugd->custom_width / 2.54;
- ugd->custom_height = ugd->custom_height / 2.54;
+ if (ad->size_popup_info.custom_unit == 1) { // cm to inch
+ ad->size_popup_info.custom_unit = 2;
+ ad->size_popup_info.custom_width = ad->size_popup_info.custom_width / 2.54;
+ ad->size_popup_info.custom_height = ad->size_popup_info.custom_height / 2.54;
} else {
PTS_DEBUG("Unknown unit");
PTS_TRACE_END;
return;
}
- snprintf(temp, 32, "%.1lf", ugd->custom_width);
+ snprintf(temp, 32, "%.1lf", ad->size_popup_info.custom_width);
elm_object_signal_emit(width_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(width_entry, temp);
- snprintf(temp, 32, "%.1lf", ugd->custom_height);
+ snprintf(temp, 32, "%.1lf", ad->size_popup_info.custom_height);
elm_object_signal_emit(height_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(height_entry, temp);
- PTS_DEBUG("Changed unit : %d", ugd->custom_unit);
+ PTS_DEBUG("Changed unit : %d", ad->size_popup_info.custom_unit);
PTS_TRACE_END;
}
{
PTS_TRACE_BEGIN;
char temp[32] = {0,};
- pts_core_data_t *ugd = pts_get_ugd();
- PTS_DEBUG("Current unit : %d", ugd->custom_unit);
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_DEBUG("Current unit : %d", ad->size_popup_info.custom_unit);
- if (ugd->custom_unit == 2) { // inch to cm
- ugd->custom_unit = 1;
- ugd->custom_width = ugd->custom_width * 2.54;
- ugd->custom_height = ugd->custom_height * 2.54;
+ if (ad->size_popup_info.custom_unit == 2) { // inch to cm
+ ad->size_popup_info.custom_unit = 1;
+ ad->size_popup_info.custom_width = ad->size_popup_info.custom_width * 2.54;
+ ad->size_popup_info.custom_height = ad->size_popup_info.custom_height * 2.54;
} else {
PTS_DEBUG("Unknown unit");
PTS_TRACE_END;
return;
}
- snprintf(temp, 32, "%.1lf", ugd->custom_width);
+ snprintf(temp, 32, "%.1lf", ad->size_popup_info.custom_width);
elm_object_signal_emit(width_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(width_entry, temp);
- snprintf(temp, 32, "%.1lf", ugd->custom_height);
+ snprintf(temp, 32, "%.1lf", ad->size_popup_info.custom_height);
elm_object_signal_emit(height_layout, "elm,state,guidetext,hide", "elm");
elm_entry_entry_set(height_entry, temp);
- PTS_DEBUG("Changed unit : %d", ugd->custom_unit);
+ PTS_DEBUG("Changed unit : %d", ad->size_popup_info.custom_unit);
PTS_TRACE_END;
}
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
int index = -1;
Elm_Object_Item *item = event_info;
PTS_TRACE_END;
}
-Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_core_data_t *ugd)
+Evas_Object *pts_create_custom_popup(Evas_Object *parent, pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
Evas_Object *popup;
elm_object_style_set(btn1,"popup_button/default");
elm_object_text_set(btn1, _("IDS_COM_SK_OK"));
elm_object_part_content_set(popup, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", _pts_custom_ok_cb, ugd);
+ evas_object_smart_callback_add(btn1, "clicked", _pts_custom_ok_cb, ad);
btn2 = elm_button_add(popup);
elm_object_style_set(btn2,"popup_button/default");
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_custom_cancel_cb, ugd);
+ evas_object_smart_callback_add(btn2, "clicked", _pts_custom_cancel_cb, ad);
elm_theme_extension_add(NULL, RESDIR"/edje/genlist_custom.edj");
PTS_DEBUG("Added extension theme");
} else {
}
- item = elm_genlist_item_append(genlist, temp_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, temp_cb, ugd);
+ item = elm_genlist_item_append(genlist, temp_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, temp_cb, ad);
if (index != 4) {
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE);
}
elm_box_pack_end(box, genlist);
- ugd->custom_popup_portrait_height = (5 * 114 + 4) * elm_config_scale_get();
- //ugd->custom_popup_portrait_height = (4 * 114 + 13 )* elm_config_scale_get();
- ugd->custom_popup_landscape_height = 300;
- app_device_orientation_e orientation = app_get_device_orientation();
+ ad->size_popup_info.custom_popup_portrait_height = (5 * 114 + 4) * elm_config_scale_get();
+ ad->size_popup_info.custom_popup_landscape_height = 300;
+ int orientation = 0;
+ if (ad->win)
+ orientation = elm_win_rotation_get(ad->win);
if (APP_DEVICE_ORIENTATION_0 == orientation ||
APP_DEVICE_ORIENTATION_180 == orientation) {
- evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ugd->custom_popup_portrait_height);
+ evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ad->size_popup_info.custom_popup_portrait_height);
} else {
- evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ugd->custom_popup_landscape_height);
+ evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), ad->size_popup_info.custom_popup_landscape_height);
}
elm_object_content_set(popup, box);
- ugd->custom_popup_box = box;
+ ad->size_popup_info.custom_popup_box = box;
evas_object_show(genlist);
evas_object_show(popup);
- ugd->custom_popup = popup;
+ ad->size_popup_info.custom_popup = popup;
PTS_TRACE_END;
return genlist;
}
-#if 1
static Evas_Object *__pts_utils_create_conformant(Evas_Object *parent)
{
return layout;
}
-#else
-static Evas_Object *__pts_utils_create_conformant(Evas_Object *parent)
-{
-
- Evas_Object *conform = NULL;
- elm_win_conformant_set(parent, TRUE);
- conform = elm_conformant_add(parent);
-
- elm_object_style_set(conform, "internal_layout");
-
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- evas_object_show(conform);
-
- return conform;
-}
-
-Evas_Object *pts_utils_create_layout(Evas_Object *navi_frame)
-{
- Evas_Object *layout;
- layout = elm_layout_add(navi_frame);
- elm_layout_theme_set(layout, "layout", "application", "noindicator");
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- Evas_Object *bg = elm_bg_add(layout);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_object_style_set(bg, "group_list");
- elm_object_part_content_set(layout, "elm.swallow.bg", bg);
-
- Evas_Object *conform = __pts_utils_create_conformant(layout);
- //assertm_if(NULL == conform, "NULL!!");
- elm_object_part_content_set(layout, "elm.swallow.content", conform);
- evas_object_show(layout);
-
- return layout;
-}
-#endif
-
/*
* this function is used to compose folder and filename.
*/
return true;
}
+/*
+* validate the path of image files.
+*/
+bool _is_pdf_file_type(char **files, int num)
+{
+ PTS_TRACE_BEGIN;
+
+ PTS_RETV_IF(files == NULL || num <= 0, false, "the input param is invalid!");
+
+ int i = 0;
+ char *path = NULL;
+ const int filters_num = 1;
+ /* the image type that cups supports */
+ const char *filters[] = {".pdf"};
+
+ for (; i < num; i++) {
+ path = *(files + i);
+
+ /* check whether the file is exist */
+ int ret = -1;
+ struct stat buf;
+
+ ret = stat(path, &buf);
+ PTS_RETV_IF(ret != 0, false, "get file(%s) status failed!", path);
+
+ /* check whether the file can be supported */
+ char *p = NULL;
+ p = strrchr(path, '.');
+ PTS_RETV_IF(p == NULL, false, "get file(%s) filter failed!", path);
+
+ int j = 0;
+ int tag = 0;
+
+ for (; j < filters_num; j++) {
+ if (0 == strcasecmp(p, filters[j])) {
+ tag = 1;
+ break;
+ }
+ }
+ PTS_RETV_IF(tag == 0, false, "the file(%s) can't be supported!", path);
+ }
+
+ PTS_TRACE_END;
+ return true;
+}
+
+/*
+* validate the path of image files.
+*/
+bool _is_img_file_type(char **files, int num)
+{
+ PTS_TRACE_BEGIN;
+
+ PTS_RETV_IF(files == NULL || num <= 0, false, "the input param is invalid!");
+
+ int i = 0;
+ char *path = NULL;
+ const int filters_num = 15;
+ /* the image type that cups supports */
+ const char *filters[] = {".gif", ".bmp", ".sgi", ".ras", ".pbm", ".pgm", ".ppm", ".pcd",
+ ".pix", ".png", ".jpeg", ".jpg", ".jpe", ".tiff", ".tif"};
+
+ for (; i < num; i++) {
+ path = *(files + i);
+
+ /* check whether the file is exist */
+ int ret = -1;
+ struct stat buf;
+
+ ret = stat(path, &buf);
+ PTS_RETV_IF(ret != 0, false, "get file(%s) status failed!", path);
+
+ /* check whether the file can be supported */
+ char *p = NULL;
+ p = strrchr(path, '.');
+ PTS_RETV_IF(p == NULL, false, "get file(%s) filter failed!", path);
+
+ int j = 0;
+ int tag = 0;
+
+ for (; j < filters_num; j++) {
+ if (0 == strcasecmp(p, filters[j])) {
+ tag = 1;
+ break;
+ }
+ }
+ PTS_RETV_IF(tag == 0, false, "the file(%s) can't be supported!", path);
+ }
+
+ PTS_TRACE_END;
+ return true;
+}
+
inline char *_pts_printing_data_get_directory(pts_printing_data_t *data)
{
return data->directory;
}
}
-Eina_Bool _pts_printing_data_set_type(const char *type, pts_printing_data_t *data)
+Eina_Bool _is_document_ux_type(const char *type)
{
PTS_RETV_IF(type == NULL, EINA_FALSE, "type is NULL");
- PTS_RETV_IF(data == NULL, EINA_FALSE, "data is NULL");
-
- if (strcasecmp(type, "IMG") && strcasecmp(type,"DOC") && strcasecmp(type,"WEB")) {
- PTS_DEBUG("the type of print files(%s) is invalid!", type);
- return EINA_FALSE;
- } else {
- data->type = strdup(type);
- PTS_RETV_IF(data->type == NULL, EINA_FALSE, "Failed to strdup");
+ if (strcasecmp(type, "DOC") == 0) {
return EINA_TRUE;
}
+ return EINA_FALSE;
}
-int _pts_get_rotate_angle(enum appcore_rm rotate_mode)
+Eina_Bool _is_image_ux_type(const char *type)
{
- PTS_TRACE_BEGIN;
- int rotate_angle;
- if (APPCORE_RM_UNKNOWN == rotate_mode) {
- appcore_get_rotation_state(&rotate_mode);
+ PTS_RETV_IF(type == NULL, EINA_FALSE, "type is NULL");
+ if (strcasecmp(type, "IMG") == 0) {
+ return EINA_TRUE;
}
+ return EINA_FALSE;
+}
- 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;
+Eina_Bool _is_valid_print_file_type(const char *type)
+{
+ if (strcasecmp(type, "IMG") && strcasecmp(type,"DOC") && strcasecmp(type,"WEB")) {
+ PTS_DEBUG("the type of print files(%s) is invalid!", type);
+ return EINA_FALSE;
}
- PTS_TRACE_END;
- return rotate_angle;
+ return EINA_TRUE;
+}
+
+Eina_Bool _pts_printing_data_set_type(const char *type, pts_printing_data_t *data)
+{
+ PTS_RETV_IF(type == NULL, EINA_FALSE, "type is NULL");
+ PTS_RETV_IF(data == NULL, EINA_FALSE, "data is NULL");
+ PTS_RETV_IF(_is_valid_print_file_type(type) == EINA_FALSE, EINA_FALSE, "invalid type");
+
+ data->type = strdup(type);
+ PTS_RETV_IF(data->type == NULL, EINA_FALSE, "Failed to strdup");
+ return EINA_TRUE;
}
+++ /dev/null
-/*
-* 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 "pts_common.h"
-#include "pts_main_view.h"
-#include "pts_list_view.h"
-#include "pts_setting_view.h"
-#if 0
-
-//static Elm_Genlist_Item_Class list_itc;
-
-void main_quit_cb(void *data, Evas_Object *obj,
- const char *emission, const char *source);
-
-/*
-* release the list data
-*/
-static void __pts_list_view_delete_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- ug_printer_retm_if(ld == NULL, "data is NULL");
-
- if (ld->popup) {
- evas_object_del(ld->popup);
- ld->popup = NULL;
- }
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- PTS_TRACE_END;
-}
-
-/*
-* the response callback when click the "back" button
-*/
-static void __pts_list_view_btn_back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- ug_printer_retm_if(ld == NULL, "data is NULL");
-
- elm_naviframe_item_pop(ld->ugd->navi);
- PTS_TRACE_END;
-}
-
-
-
-#if 0
-/*
-* create the content of the list view
-*/
-Evas_Object *__pts_list_view_create_content(pts_ug_list_data *ld)
-{
- PTS_TRACE_BEGIN;
-
- if (NULL == ld) {
- return NULL;
- }
-
- Evas_Object *genlist = NULL;
-
- genlist = elm_genlist_add(ld->ugd->navi);
-
- if (!list_radio_main) {
- list_radio_main = elm_radio_add(genlist);
- elm_radio_state_value_set(list_radio_main, 0);
- elm_radio_value_set(list_radio_main, 0);
- }
-
- list_itc.item_style = "2text.1icon.4"; // Left Icon, Right Main/Sub Text
- list_itc.func.text_get = __pts_list_view_label_get;
- list_itc.func.content_get = __pts_list_view_icon_get;
- list_itc.func.state_get = NULL;
- list_itc.func.del = NULL;
-
- pt_printer_mgr_t *it = NULL;
- Eina_List *cursor = NULL;
-
- int index = 1;
- EINA_LIST_FOREACH(ld->printer_list, cursor, it) {
- elm_genlist_item_append(genlist, &list_itc, (void *)it, NULL, ELM_GENLIST_ITEM_NONE, __pts_list_view_sel, ld);
- //elm_genlist_item_append(genlist, &list_itc, (void *)index, NULL, ELM_GENLIST_ITEM_NONE, __pts_list_view_sel, ld);
- index++;
- }
-
- evas_object_show(genlist);
- PTS_TRACE_END;
- return genlist;
-}
-#endif
-
-
-
-#if 0
-static void _pts_printer_list_cancel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- evas_object_del(data);
- pt_deinit();
- elm_exit();
- PTS_TRACE_END;
-}
-
-Evas_Object *pts_create_printer_list_popup(Evas_Object *parent, pts_ug_list_data *ld)
-{
- PTS_TRACE_BEGIN;
- Evas_Object *popup;
- Evas_Object *genlist;
- Evas_Object *btn1;
- Evas_Object *btn2;
-
- popup = elm_popup_add(parent);
- elm_object_style_set(popup,"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);
-
- btn1 = elm_button_add(popup);
- elm_object_style_set(btn1,"popup_button/default");
- elm_object_text_set(btn1, _("IDS_COM_SK_OK"));
- 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_object_part_content_set(popup, "button2", btn2);
- evas_object_smart_callback_add(btn2, "clicked", _pts_printer_list_cancel_cb, popup);
-
- genlist = __pts_list_view_create_content(ld);
-
- elm_object_content_set(popup, genlist);
- evas_object_show(popup);
- evas_object_show(parent);
-
- ld->ugd->printer_list_popup = popup;
-
- PTS_TRACE_END;
- return genlist;
-}
-#endif
-
-#if 0
-/*
-* the response callback when search the printer
-*/
-static void __pts_list_view_get_printer_cb(pt_response_data_t *cb)
-{
- PTS_TRACE_BEGIN;
-
- //Evas_Object *back_btn = NULL;
- //Evas_Object *content = NULL;
-
- if (NULL == cb) {
- PTS_DEBUG("response data is NULL");
- return;
- }
-
- int pt_count = 0;
- pts_ug_list_data *ld = cb->userdata;
- ug_printer_retm_if(ld == NULL, "data is NULL");
-
- ld->printer_list = cb->printerlist;
- ld->ugd->is_process = 0;/*process is complete*/
-
- /*
- * Not found any printer
- */
- if (NULL == ld->printer_list) {
- /*
- * destroy popup progress bar
- */
- evas_object_del(ld->popup);
- ld->popup = NULL;
- PTS_DEBUG("search printer failed");
-
- pts_create_no_found_popup(ld->ugd->root_win, ld->ugd, (void *) _pts_refresh_cb, (void *) _pts_cancel_cb);
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
-
- return;
- }
-
- /* get printer list count */
- pt_count = eina_list_count(ld->printer_list);
- PTS_DEBUG("Printer count is %d, connect_type %d", pt_count, ld->ugd->connect_type);
-
- /* destroy popup progress bar */
- evas_object_del(ld->popup);
-
- /* USB mode or only first search only get one printer */
- if ((PT_CONNECTION_USB == ld->ugd->connect_type) || (1 == pt_count)) {
- int ret = 0;
-
- /* get the usb printer info */
- pt_printer_mgr_t *pt = eina_list_data_get(ld->printer_list);
-
- PTS_DEBUG("pt name is %s", pt->name);
-
- PTS_DEBUG("pt address %x", pt);
-
- ret = pt_set_active_printer(pt);
- if (PT_ERR_NONE != ret) {
- pts_create_popup(ld->ugd->navi, PTS_2, 1.0);
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- return;
- }
-
- pt_set_default_printer(pt);
-
- if (NULL == ld->ugd->active_printer) {
- ld->ugd->active_printer = (pt_printer_mgr_t *)malloc(sizeof(pt_printer_mgr_t));
- } else {
- memset(ld->ugd->active_printer, 0, sizeof(ld->ugd->active_printer));
- }
-
- if (NULL != ld->ugd->active_printer) {
- memset(ld->ugd->active_printer, 0, sizeof(pt_printer_mgr_t));
- memcpy(ld->ugd->active_printer, pt, sizeof(pt_printer_mgr_t));
- } else {
- pts_create_popup(ld->ugd->navi, _("No Memory"), 1.0);
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- return;
- }
-
- // 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_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_layout);
- evas_object_show(ld->ugd->root_win);
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- } else { // Show printer list popup
-#if 0
- back_btn = pts_create_label_btn(ld->ugd->navi, _("IDS_COM_SK_BACK"));
- evas_object_smart_callback_add(back_btn, "clicked", __pts_list_view_btn_back_cb, ld);
-
- content = __pts_list_view_create_content(ld);
-
- evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, __pts_list_view_delete_cb, ld);
-
- elm_naviframe_item_push(ld->ugd->navi, PTS_4, back_btn, NULL, content, NULL);
- elm_object_style_set(back_btn, "naviframe/back_btn/default");
-#endif
-
- pts_create_printer_list_popup(ld->ugd->root_win, ld);
- }
-
- PTS_TRACE_END;
-}
-#endif
-
-/*
-* the response callback when searching popup
-*/
-#if 0
-static void __pts_list_view_popup_response_cb(void *data, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- ug_printer_retm_if(ld == NULL, "setting is NULL");
-
- /* cancel searching printers */
- if (ELM_POPUP_RESPONSE_CANCEL == (int)event_info) {
- if (ld->search_err_timer != NULL) {
- ecore_timer_del(ld->search_err_timer);
- ld->search_err_timer = NULL;
- }
- pt_cancel_get_printers();
- }
-
- evas_object_del(ld->popup);
- ld->popup = NULL;
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- PTS_TRACE_END;
-}
-#else
-# if 0
-static void __pts_list_view_popup_ok_cb(void *data, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- ug_printer_retm_if(ld == NULL, "setting is NULL");
-
- evas_object_del(ld->popup);
- ld->popup = NULL;
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- PTS_TRACE_END;
-}
-
-static void __pts_list_view_popup_close_cb(void *data, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- ug_printer_retm_if(ld == NULL, "setting is NULL");
-
- evas_object_del(ld->popup);
- ld->popup = NULL;
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- PTS_TRACE_END;
-}
-# endif
-
-static void __pts_list_view_popup_cancel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- ug_printer_retm_if(ld == NULL, "setting is NULL");
-
- /* cancel searching printers */
- if (ld->search_err_timer != NULL) {
- ecore_timer_del(ld->search_err_timer);
- ld->search_err_timer = NULL;
- }
- pt_cancel_get_printers();
-
- evas_object_del(ld->popup);
- ld->popup = NULL;
-
- if (ld != NULL) {
- free(ld);
- ld = NULL;
- }
- PTS_TRACE_END;
-}
-#endif
-
-#if 0
-/**
- * This function let the app create the printers list view
- * @return void
- * @param[in] ld the pointer to the ug list structure
- */
-void pts_create_list_view(pts_ug_list_data *ld)
-{
- PTS_TRACE_BEGIN;
- if (NULL == ld) {
- PTS_DEBUG("ld is NULL");
- return;
- }
-
- int ret = 0;
- Evas_Object *layout = NULL;
- Evas_Object *progressbar = NULL;
-
- printer_index = -1; // Initialize value when start searching everytime
- prev_printer_index = -1; // Initialize value when start searching everytime
-
- ld->popup = elm_popup_add(ld->ugd->root_win);
- layout = pts_create_base_layout(ld->popup, "popup_search");
- ld->search_err_timer = NULL;
- ld->ugd->is_process = 1; /* in process */
-
- progressbar = elm_progressbar_add(ld->popup);
- elm_object_style_set(progressbar, "list_process");
- elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
- 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);
-
- 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"));
-
-#if 0
- /* add cancel button */
- Evas_Object *btn1 = NULL;
- btn1 = elm_button_add(ld->popup);
- elm_object_text_set(btn1, S_("Cancel"));
- elm_object_part_content_set(ld->popup, "button1", btn1);
-
- evas_object_smart_callback_add(btn1, "clicked", __pts_list_view_popup_cancel_cb, ld);
-#endif
-
- elm_object_content_set(ld->popup, layout);
- evas_object_show(layout);
- evas_object_show(ld->popup);
- evas_object_show(ld->ugd->root_win);
-
- ret = pt_get_printers(__pts_list_view_get_printer_cb, ld);
- if (PT_ERR_NONE != ret) {
- ld->search_err_timer = ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_list_view_popup_error, (void *)ld);
- }
-
- PTS_TRACE_END;
-}
-#endif
-
-#endif
#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_util.h"
static void __pts_main_view_job_error(void *userdata, int job_id);
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_create_notification_by_page(pts_appdata_t *ad, pts_job_spooling_t *job_spooling);
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) * copies;
}
-static pts_job_spooling_t *__pts_get_job_spooling(pts_core_data_t *ugd, int job_id)
+static pts_job_spooling_t *__pts_get_job_spooling(pts_appdata_t *ad, int job_id)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL, NULL, "Invalid parameter for __pts_get_last_job_spooling");
+ PTS_RETV_IF(ad == NULL, NULL, "Invalid parameter for __pts_get_last_job_spooling");
PTS_RETV_IF(job_id <= 0, NULL, "job_id is invalid(%d)", job_id);
Eina_List *job_spooling_list = NULL;
pts_job_spooling_t *job_spooling = NULL;
- EINA_LIST_FOREACH(ugd->job_spooling_list, job_spooling_list, job_spooling) {
+ EINA_LIST_FOREACH(ad->noti_info.job_spooling_list, job_spooling_list, job_spooling) {
if (job_spooling->job_id == job_id) {
PTS_DEBUG("Found job_spooling for job_id[%d]", job_id);
break;
return job_spooling;
}
-static pts_job_spooling_t *__pts_get_last_job_spooling(pts_core_data_t *ugd)
+static pts_job_spooling_t *__pts_get_last_job_spooling(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL, NULL, "Invalid parameter for __pts_get_last_job_spooling");
+ PTS_RETV_IF(ad == NULL, NULL, "Invalid parameter for __pts_get_last_job_spooling");
Eina_List *job_spooling_list = NULL;
pts_job_spooling_t *job_spooling = NULL;
- job_spooling_list = eina_list_last(ugd->job_spooling_list);
+ job_spooling_list = eina_list_last(ad->noti_info.job_spooling_list);
PTS_RETV_IF(job_spooling_list == NULL, NULL, "No found job_spooling_list for last job");
job_spooling = (pts_job_spooling_t *)eina_list_data_get(job_spooling_list);
return job_spooling;
}
-int __pts_update_popup_progress(pts_core_data_t *ugd, pt_progress_info_t *progress_info, pts_job_spooling_t *job_spooling)
+int __pts_update_popup_progress(pts_appdata_t *ad, pt_progress_info_t *progress_info, pts_job_spooling_t *job_spooling)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL || ugd->progressbar == NULL || progress_info == NULL || job_spooling == NULL
+ PTS_RETV_IF(ad == NULL || ad->progress_info.progressbar == NULL || progress_info == NULL || job_spooling == NULL
, 1, "Invalid parameter for __pts_update_popup_progress");
PTS_DEBUG("progress popup [%d]\n", progress_info->progress);
char progress_value[8] = {0,};
char page_value[8] = {0,};
char aligned_label[128] = {0,};
+ int real_total_pages = -1;
- if (EINA_TRUE == elm_progressbar_pulse_get(ugd->progressbar)) {
+ if (EINA_TRUE == elm_progressbar_pulse_get(ad->progress_info.progressbar)) {
PTS_DEBUG("Stop pulsing mode\n");
- elm_progressbar_pulse_set(ugd->progressbar, EINA_FALSE);
- elm_object_style_set(ugd->progressbar, "list_progress");
- elm_progressbar_value_set(ugd->progressbar, 0.00);
+ elm_progressbar_pulse_set(ad->progress_info.progressbar, EINA_FALSE);
+ elm_object_style_set(ad->progress_info.progressbar, "list_progress");
+ elm_progressbar_value_set(ad->progress_info.progressbar, 0.00);
}
- elm_progressbar_value_set(ugd->progressbar, rate);
+ elm_progressbar_value_set(ad->progress_info.progressbar, rate);
if (rate > 0) {
snprintf(aligned_label, 128, "<align=center>%s</align>",
_("IDS_PRT_HEADER_MEDIABOX_PRINTING"));
- elm_object_text_set(ugd->progress_label, aligned_label);
+ elm_object_text_set(ad->progress_info.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, job_spooling->copies);
+ elm_object_part_text_set(ad->progress_info.progress_layout, "elm.text.subtext1", progress_value);
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ real_total_pages = 1;
+ } else {
+ 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);
- elm_object_part_text_set(ugd->progress_layout, "elm.text.subtext2", page_value);
+ elm_object_part_text_set(ad->progress_info.progress_layout, "elm.text.subtext2", page_value);
}
if (rate >= 1.00 && job_spooling->page_printed == real_total_pages) {
- if (ugd->progressbar != NULL) {
- evas_object_del(ugd->progressbar);
- ugd->progressbar = NULL;
- }
-
- if (ugd->popup != NULL) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
-
- if (ugd->root_win != NULL) {
- evas_object_hide(ugd->root_win);
- }
+ PTS_IF_DEL_OBJ(ad->progress_info.progressbar);
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
+ PTS_IF_DEL_OBJ(ad->main_info.root_win);
}
PTS_TRACE_END;
return 0;
}
-int __pts_update_notification(pts_core_data_t *ugd,
+int __pts_update_notification(pts_appdata_t *ad,
pt_progress_info_t *progress_info,
pts_job_spooling_t *job_spooling)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL || progress_info == NULL || job_spooling == NULL
+ PTS_RETV_IF(ad == NULL || progress_info == NULL || job_spooling == NULL
, -1 ,"Invalid parameters for update_notification");
double rate = progress_info->progress * 0.01;
}
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,
+ int real_total_pages = -1;
+
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ real_total_pages = 1;
+ } else {
+ 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_create_notification_by_page(ad, job_spooling);
}
PTS_TRACE_END;
return 0;
return 0;
}
-int __pts_create_dummy_notification(pts_core_data_t *ugd)
+int __pts_create_dummy_notification(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL, -1, "Invalid paramter for __pts_create_dummy_notification");
+ PTS_RETV_IF(ad == NULL, -1, "Invalid paramter for __pts_create_dummy_notification");
int res = -1;
notification_h noti = NULL;
goto ERR_CASE;
}
- char *printer_label = strdup(ugd->active_printer->name);
+ char *printer_label = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_label);
res = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, printer_label, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
if (res != NOTIFICATION_ERROR_NONE) {
bundle *b = NULL;
b = bundle_create();
char value[4] = {0,};
- if (!strcasecmp(ugd->pt_files.type, "DOC") || !strcasecmp(ugd->pt_files.type, "WEB")) {
- PTS_DEBUG("It's pdf file. [%s]", ugd->pt_files.type);
- ugd->pt_files.range.total_pages = get_pdf_pages_count(ugd->pt_files.request_files[0]);
+
+ if (!strcasecmp(ad->printing_data.type, "DOC") || !strcasecmp(ad->printing_data.type, "WEB")) {
+ PTS_DEBUG("It's pdf file. [%s]", ad->printing_data.type);
+ ad->printing_data.range.total_pages = get_pdf_pages_count(ad->printing_data.request_files[0]);
} else {
- PTS_DEBUG("It's not pdf file. [%s]", ugd->pt_files.type);
- ugd->pt_files.range.total_pages = ugd->pt_files.num_of_files;
+ PTS_DEBUG("It's not pdf file. [%s]", ad->printing_data.type);
+ ad->printing_data.range.total_pages = ad->printing_data.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), ugd->active_printer->copies);
+ int real_total_pages = -1;
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ real_total_pages = 1;
+ } else {
+ real_total_pages = __pts_get_real_total_pages(ad->printing_data.range.total_pages,
+ printer_get_setting_n_up(ad->list_info.active_printer), ad->list_info.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]);
+ appsvc_set_pkgname(b, MOBILEPRINT_PACKAGENAME);
+ appsvc_add_data(b, SERVICE_FILES, ad->printing_data.request_files[0]);
appsvc_add_data(b, SERVICE_PAGE_COUNT, value);
appsvc_add_data(b, SERVICE_LAUNCH_TYPE, LAUNCH_FROM_DUMMY_NOTI);
goto ERR_CASE;
}
- res = notification_insert(noti, &ugd->dummy_noti_id);
+ res = notification_insert(noti, &(ad->noti_info.dummy_noti_id));
if (res != NOTIFICATION_ERROR_NONE) {
PTS_DEBUG("Failed to insert Notification [%d]", res);
goto ERR_CASE;
}
- PTS_DEBUG("Notification ID [%d]", ugd->dummy_noti_id);
+ PTS_DEBUG("Notification ID [%d]", ad->noti_info.dummy_noti_id);
PTS_TRACE_END;
return 0;
return -1;
}
-static int __pts_create_notification_by_page(pts_core_data_t *ugd, pts_job_spooling_t *job_spooling)
+static int __pts_create_notification_by_page(pts_appdata_t *ad, pts_job_spooling_t *job_spooling)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL || job_spooling == NULL
+ PTS_RETV_IF(ad == NULL || job_spooling == NULL
, -1, "Invalid parameter for __pts_create_notification_by_page");
int res = -1;
//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,
+ int real_total_pages = -1;
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ real_total_pages = 1;
+ } else {
+ 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, real_total_pages);
PTS_DEBUG("notification update: handle[%d] title=[%s]", job_spooling->noti_handle, title);
goto ERR_CASE;
}
- char *printer_label = strdup(ugd->active_printer->name);
+ char *printer_label = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_label);
res = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, printer_label, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
if (res != NOTIFICATION_ERROR_NONE) {
char value2[4] = {0,};
snprintf(value1, 4, "%d", job_spooling->job_id);
snprintf(value2, 4, "%d", real_total_pages);
- appsvc_set_pkgname(b, "org.tizen.mobileprint");
+ appsvc_set_pkgname(b, MOBILEPRINT_PACKAGENAME);
appsvc_add_data(b, SERVICE_JOB_ID, value1);
appsvc_add_data(b, SERVICE_PAGE_COUNT, value2);
appsvc_add_data(b, SERVICE_LAUNCH_TYPE, LAUNCH_FROM_PROGRESS_NOTI);
return -1;
}
-int __pts_create_job_notification(pts_core_data_t *ugd, int job_id)
+int __pts_create_job_notification(pts_appdata_t *ad, int job_id)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL || job_id <=0
+ PTS_RETV_IF(ad == NULL || job_id <=0
, -1 , "Invalid parameter for __pts_create_job_notification");
int res = -1;
memset(job_spooling, 0, sizeof(pts_job_spooling_t));
//FIXME - pt_files.files should be managed carefully during printing
- job_spooling->pt_files.num_of_files = ugd->pt_files.num_of_files;
- job_spooling->pt_files.current_index = ugd->pt_files.current_index;
+ job_spooling->pt_files.num_of_files = ad->printing_data.num_of_files;
+ job_spooling->pt_files.current_index = ad->printing_data.current_index;
- job_spooling->pt_files.type = strdup(ugd->pt_files.type); // need malloc
+ job_spooling->pt_files.type = strdup(ad->printing_data.type); // need malloc
if (job_spooling->pt_files.type == NULL) {
PTS_DEBUG("Failed to malloc job_spooling->pt_files.type");
goto ERR_CASE;
}
int i = 0;
for (i = 0; i < job_spooling->pt_files.num_of_files; i++) {
- PTS_DEBUG("file path is %s", ugd->pt_files.request_files[i]);
- if (NULL != ugd->pt_files.request_files[i]) {
- job_spooling->pt_files.request_files[i] = strdup(ugd->pt_files.request_files[i]);
+ PTS_DEBUG("file path is %s", ad->printing_data.request_files[i]);
+ if (NULL != ad->printing_data.request_files[i]) {
+ job_spooling->pt_files.request_files[i] = strdup(ad->printing_data.request_files[i]);
} else {
job_spooling->pt_files.request_files[i] = strdup(MOBILEPRINT_DEFAULTIMG);
}
goto ERR_CASE;
}
- job_spooling->pt_files.range.from = ugd->pt_files.range.from;
- job_spooling->pt_files.range.to = ugd->pt_files.range.to;
- job_spooling->pt_files.range.total_pages = ugd->pt_files.range.total_pages;
+ job_spooling->pt_files.range.from = ad->printing_data.range.from;
+ job_spooling->pt_files.range.to = ad->printing_data.range.to;
+ job_spooling->pt_files.range.total_pages = ad->printing_data.range.total_pages;
job_spooling->pt_files.range.selected_files = (char **)malloc(sizeof(char *) * job_spooling->pt_files.range.total_pages);
if (job_spooling->pt_files.range.selected_files == NULL) {
goto ERR_CASE;
}
- job_spooling->pt_files.range.selected_files[0] = strdup(ugd->pt_files.range.selected_files[0]);
+ job_spooling->pt_files.range.selected_files[0] = strdup(ad->printing_data.range.selected_files[0]);
if (job_spooling->pt_files.range.selected_files[0] == NULL) {
PTS_DEBUG("Failed to malloc job_spooling->pt_files.range.selected_files[0]");
goto ERR_CASE;
job_spooling->noti_handle = noti;
- job_spooling->n_up = printer_get_setting_n_up(ugd->active_printer);
+ job_spooling->n_up = printer_get_setting_n_up(ad->list_info.active_printer);
- job_spooling->copies = ugd->active_printer->copies;
+ job_spooling->copies = ad->list_info.active_printer->copies;
- int real_total_pages = __pts_get_real_total_pages(job_spooling->pt_files.range.total_pages,
+ int real_total_pages = -1;
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ real_total_pages = 1;
+ } else {
+ 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);
goto ERR_CASE;
}
- char *printer_label = strdup(ugd->active_printer->name);
+ char *printer_label = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_label);
res = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, printer_label, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
if (res != NOTIFICATION_ERROR_NONE) {
char value2[4] = {0,};
snprintf(value1, 4, "%d", job_id);
snprintf(value2, 4, "%d", real_total_pages);
- appsvc_set_pkgname(b, "org.tizen.mobileprint");
+ appsvc_set_pkgname(b, MOBILEPRINT_PACKAGENAME);
appsvc_add_data(b, SERVICE_JOB_ID, value1);
appsvc_add_data(b, SERVICE_PAGE_COUNT, value2);
appsvc_add_data(b, SERVICE_LAUNCH_TYPE, LAUNCH_FROM_PROGRESS_NOTI);
}
PTS_DEBUG("Notification ID [%d]", job_spooling->noti_id);
- ugd->job_spooling_list = eina_list_append(ugd->job_spooling_list, job_spooling);
+ ad->noti_info.job_spooling_list = eina_list_append(ad->noti_info.job_spooling_list, job_spooling);
if (eina_error_get()) {
PTS_DEBUG("Failed to append job_spooling");
goto ERR_CASE;
static gboolean __pts_main_view_job_monitor_timeout_cb(void *data)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RETV_IF(ugd == NULL, TRUE, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RETV_IF(ad == NULL, TRUE, "ad is NULL");
pt_job_state_e job_status = PT_JOB_ERROR;
gboolean ret = FALSE;
//FIXME - need to check one or all?
Eina_List *job_spooling_list = NULL;
pts_job_spooling_t *job_spooling = NULL;
- EINA_LIST_FOREACH(ugd->job_spooling_list, job_spooling_list, job_spooling) {
+ EINA_LIST_FOREACH(ad->noti_info.job_spooling_list, job_spooling_list, job_spooling) {
job_status = pt_get_current_job_status(job_spooling->job_id);
if (job_status == PT_JOB_PROCESSING || job_status == PT_JOB_PENDING) {
PTS_DEBUG("job_id[%d] status is %d", job_spooling->job_id, job_status);
// XXX - progress_info can be passed by NULL
PTS_RET_IF(event < 0 || user_data == NULL, "Invalid parameters for event cb");
- pts_core_data_t *ugd = (pts_core_data_t *)user_data;
+ pts_appdata_t *ad = (pts_appdata_t *)user_data;
pts_job_spooling_t *job_spooling = NULL;
switch (event) {
case PT_EVENT_USB_PRINTER_ONLINE:
- __pts_main_view_check_usb_printer_online(ugd);
+ __pts_main_view_check_usb_printer_online(ad);
break;
case PT_EVENT_USB_PRINTER_OFFLINE:
- __pts_main_view_check_usb_printer_offline(ugd);
+ __pts_main_view_check_usb_printer_offline(ad);
break;
case PT_EVENT_PRINTER_ONLINE:
- __pts_main_view_check_printer_online(ugd);
+ __pts_main_view_check_printer_online(ad);
break;
case PT_EVENT_PRINTER_OFFLINE:
- __pts_main_view_check_printer_offline(ugd);
+ __pts_main_view_check_printer_offline(ad);
break;
case PT_EVENT_JOB_COMPLETED:
PTS_DEBUG("Job[%d] is completed.", progress_info->job_id);
- __pts_main_view_remove_job(ugd, progress_info->job_id);
+ __pts_main_view_remove_job(ad, progress_info->job_id);
break;
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);
+ __pts_remove_notification(ad->noti_info.dummy_noti_id);
+ ad->noti_info.dummy_noti_id = 0;
+ __pts_create_job_notification(ad, progress_info->job_id);
+ g_timeout_add(5000, (GSourceFunc)__pts_main_view_job_monitor_timeout_cb, ad);
break;
case PT_EVENT_JOB_PROCESSING:
PTS_DEBUG("Job[%d] is processing.", progress_info->job_id);
break;
case PT_EVENT_JOB_PROGRESS:
- job_spooling = __pts_get_job_spooling(ugd, progress_info->job_id);
+ job_spooling = __pts_get_job_spooling(ad, progress_info->job_id);
if (job_spooling != NULL) {
PTS_DEBUG("new - progress_info: job_id[%d] progress[%d] page_printed[%d]\n"
"old - job_spooling: job_id[%d] progress[%d] page_printed[%d]",
job_spooling->progress = progress_info->progress;
}
- __pts_update_notification(ugd, progress_info, job_spooling);
- __pts_update_popup_progress(ugd, progress_info, job_spooling);
+ __pts_update_notification(ad, progress_info, job_spooling);
+ __pts_update_popup_progress(ad, progress_info, job_spooling);
break;
case PT_EVENT_JOB_PENDING:
PTS_DEBUG("Job[%d] is waiting.", progress_info->job_id);
break;
case PT_EVENT_JOB_STOPPED:
PTS_DEBUG("Job[%d] is stopped.", progress_info->job_id);
- __pts_main_view_job_error(ugd, progress_info->job_id);
- __pts_main_view_remove_job(ugd, progress_info->job_id);
+ __pts_main_view_job_error(ad, progress_info->job_id);
+ __pts_main_view_remove_job(ad, progress_info->job_id);
break;
case PT_EVENT_JOB_CANCELED:
PTS_DEBUG("Job[%d] is canceled.", progress_info->job_id);
- __pts_main_view_job_error(ugd, progress_info->job_id);
- __pts_main_view_remove_job(ugd, progress_info->job_id);
+ __pts_main_view_job_error(ad, progress_info->job_id);
+ __pts_main_view_remove_job(ad, progress_info->job_id);
break;
case PT_EVENT_JOB_ABORTED:
PTS_DEBUG("Job[%d] is aborted.", progress_info->job_id);
if (progress_info->job_id > 0) {
- __pts_main_view_job_error(ugd, progress_info->job_id);
- __pts_main_view_remove_job(ugd, progress_info->job_id);
+ __pts_main_view_job_error(ad, progress_info->job_id);
+ __pts_main_view_remove_job(ad, progress_info->job_id);
} else { // XXX - for dummy job?
- __pts_main_view_last_job_error(ugd);
+ __pts_main_view_last_job_error(ad);
}
break;
case PT_EVENT_JOB_ERROR:
PTS_DEBUG("Job[%d] error", progress_info->job_id);
- __pts_main_view_job_error(ugd, progress_info->job_id);
- __pts_main_view_remove_job(ugd, progress_info->job_id);
+ __pts_main_view_job_error(ad, progress_info->job_id);
+ __pts_main_view_remove_job(ad, progress_info->job_id);
break;
case PT_EVENT_ALL_THREAD_COMPLETED:
PTS_DEBUG("All thread is completed.");
static void __pts_main_view_check_usb_printer_online(void *userdata)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)userdata;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)userdata;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
/* if in ether searching or printing, ignore it */
- PTS_RET_IF(ugd->is_process == 1, "searching or printing is processing");
+ PTS_RET_IF(ad->search_info.is_process == 1, "searching or printing is processing");
- if (ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
+
+ elm_naviframe_item_pop_to(ad->main_info.navi_it);
- elm_naviframe_item_pop_to(ugd->navi_it);
/* re-searching printers */
- pts_search_printer(ugd, ugd->root_win, PTS_SEARCH_INITIAL, load_main_view, (void *)NULL);
+ ad->search_info.print_search_mode = PTS_SEARCH_INITIAL;
+ ad->search_info.selection_done_cb = load_main_view;
+ ad->search_info.print_search_popup_parent = ad->main_info.root_win;
+ ad->search_info.printer_search_user_data = NULL;
+ pts_search_printer(ad);
//pts_main_view_search_printer(ugd);
PTS_TRACE_END;
static void __pts_main_view_check_usb_printer_offline(void *userdata)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)userdata;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)userdata;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
/* if in searching or printing, return */
- PTS_RET_IF(ugd->is_process == 1, "searching or printing is processing");
+ PTS_RET_IF(ad->search_info.is_process == 1, "searching or printing is processing");
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
+ PTS_IF_FREE_MEM(ad->list_info.active_printer);
- if (ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
-
- PTS_IF_FREE_MEM(ugd->active_printer);
+ elm_naviframe_item_pop_to(ad->main_info.navi_it);
- elm_naviframe_item_pop_to(ugd->navi_it);
-
- pts_main_view_update_printer_label(ugd);
+ pts_main_view_update_printer_label(ad);
PTS_TRACE_END;
}
PTS_TRACE_BEGIN;
PTS_RET_IF(user_data == NULL || job_id <= 0,"Invalid parameter for job error processing");
- pts_core_data_t *ugd = (pts_core_data_t *)user_data;
+ pts_appdata_t *ad = (pts_appdata_t *)user_data;
int ret;
- if (NULL != ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- evas_object_hide(ugd->root_win);
+ if (NULL != ad->progress_info.popup) {
+ evas_object_del(ad->progress_info.popup);
+ ad->progress_info.popup = NULL;
+ evas_object_hide(ad->main_info.root_win);
}
Eina_List *job_spooling_list = NULL;
pts_job_spooling_t *job_spooling = NULL;
- EINA_LIST_FOREACH(ugd->job_spooling_list, job_spooling_list, job_spooling) {
+ EINA_LIST_FOREACH(ad->noti_info.job_spooling_list, job_spooling_list, job_spooling) {
if (job_spooling->job_id == job_id) {
PTS_DEBUG("Found job_spooling for job_id[%d]", job_id);
break;
,"No found job_spooling for job_id[%d]\n", job_id);
notification_delete_by_priv_id(MOBILEPRINT_PACKAGENAME, NOTIFICATION_TYPE_ONGOING, job_spooling->noti_id);
- ugd->is_process = 0;/*process is complete*/
+ ad->search_info.is_process = 0;/*process is complete*/
- ugd->job_spooling_list = eina_list_remove_list(ugd->job_spooling_list, job_spooling_list);
- if (0 == eina_list_count(ugd->job_spooling_list)) {
+ ad->noti_info.job_spooling_list = eina_list_remove_list(ad->noti_info.job_spooling_list, job_spooling_list);
+ if (0 == eina_list_count(ad->noti_info.job_spooling_list)) {
PTS_DEBUG("Job spooling list is empty");
- ugd->job_spooling_list = NULL;
+ ad->noti_info.job_spooling_list = NULL;
}
if (job_spooling->noti_handle != NULL) {
PTS_TRACE_BEGIN;
PTS_RET_IF(user_data == NULL || job_id <= 0, "Invalid parameter for job error processing");
- pts_core_data_t *ugd = (pts_core_data_t *)user_data;
- if (NULL != ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ pts_appdata_t *ad = (pts_appdata_t *)user_data;
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
- pts_job_spooling_t *job_spooling = __pts_get_job_spooling(ugd, job_id);
+ pts_job_spooling_t *job_spooling = __pts_get_job_spooling(ad, job_id);
PTS_RET_IF(job_spooling == NULL || job_spooling->noti_id == NOTIFICATION_PRIV_ID_NONE
, "No found job_spooling for job_id[%d]\n", job_id);
notification_delete_by_priv_id(MOBILEPRINT_PACKAGENAME, NOTIFICATION_TYPE_ONGOING, job_spooling->noti_id);
- ugd->is_process = 0;/*process is complete*/
- pts_create_popup(ugd->root_win, _("IDS_PRT_POP_PRINTINGERROR"), 2.0);
- evas_object_show(ugd->root_win);
- ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ugd);
+ ad->search_info.is_process = 0;/*process is complete*/
+ pts_create_popup(ad->main_info.root_win, _("IDS_PRT_POP_PRINTINGERROR"), 2.0);
+ evas_object_show(ad->main_info.root_win);
+ ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ad);
PTS_TRACE_END;
}
PTS_TRACE_BEGIN;
PTS_RET_IF(user_data == NULL, "Invalid parameter for last job error processing");
- pts_core_data_t *ugd = (pts_core_data_t *)user_data;
+ pts_appdata_t *ad = (pts_appdata_t *)user_data;
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
- if (NULL != ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
-
- pts_job_spooling_t *job_spooling = __pts_get_last_job_spooling(ugd);
+ pts_job_spooling_t *job_spooling = __pts_get_last_job_spooling(ad);
PTS_RET_IF(job_spooling == NULL || job_spooling->noti_id == NOTIFICATION_PRIV_ID_NONE
, "No found job_spooling for last_job");
notification_delete_by_priv_id(MOBILEPRINT_PACKAGENAME, NOTIFICATION_TYPE_ONGOING, job_spooling->noti_id);
- ugd->is_process = 0;/*process is complete*/
- pts_create_popup(ugd->root_win, _("IDS_PRT_POP_PRINTINGERROR"), 2.0);
- evas_object_show(ugd->root_win);
- ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ugd);
+ ad->search_info.is_process = 0;/*process is complete*/
+ pts_create_popup(ad->main_info.root_win, _("IDS_PRT_POP_PRINTINGERROR"), 2.0);
+ evas_object_show(ad->main_info.root_win);
+ ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ad);
PTS_TRACE_END;
}
PTS_TRACE_BEGIN;
PTS_RET_IF(user_data == NULL, "Invalid parameter for __pts_main_view_check_printer_online");
- pts_core_data_t *ugd = (pts_core_data_t *)user_data;
- ecore_timer_add(1.0, (Ecore_Task_Cb)__pts_main_view_start_print, ugd);
+ pts_appdata_t *ad = (pts_appdata_t *)user_data;
+ ecore_timer_add(1.0, (Ecore_Task_Cb)__pts_main_view_start_print, ad);
PTS_TRACE_END;
}
PTS_TRACE_BEGIN;
PTS_RET_IF(user_data == NULL, "Invalid parameter for __pts_main_view_check_printer_offline");
- pts_core_data_t *ugd = (pts_core_data_t *)user_data;
-
- if (NULL != ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ pts_appdata_t *ad = (pts_appdata_t *)user_data;
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
+ PTS_IF_FREE_MEM(ad->list_info.active_printer);
- PTS_IF_FREE_MEM(ugd->active_printer);
-
- pts_main_view_update_printer_label(ugd);
- pts_create_popup(ugd->navi, _("IDS_PRT_POP_CHECKPRINTERSTATE"), 2.0);
- ugd->is_process = 0;/* process is complete */
+ pts_main_view_update_printer_label(ad);
+ pts_create_popup(ad->main_info.navi, _("IDS_PRT_POP_CHECKPRINTERSTATE"), 2.0);
+ ad->search_info.is_process = 0;/* process is complete */
PTS_TRACE_END;
}
static void __pts_main_view_delete_cb(void *data, Evas *e, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
#if 0
if (NULL != ugd->pt_files.request_files) {
static void __pts_main_view_navi_delete_cb(void *data, Evas *e, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- PTS_IF_FREE_MEM(ugd->active_printer);
+ PTS_IF_FREE_MEM(ad->list_info.active_printer);
PTS_TRACE_END;
}
void __pts_main_view_btn_back_cb(void *data, 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");
+ pts_appdata_t *ad = (pts_appdata_t *) data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
//TODO - check current spooling job status before app termination
- if (ugd->job_spooling_list == NULL) {
+ if (ad->noti_info.job_spooling_list == NULL) {
vconf_ignore_key_changed(VCONFKEY_WIFI_QS_EXIT, _wifi_qs_monitoring_cb);
pt_deinit();
elm_exit();
} else {
PTS_DEBUG("Active job spooling list is existed. So just hide preview.");
- __pts_hide_main_view(ugd);
+ __pts_hide_main_view(ad);
}
PTS_TRACE_END;
}
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = pts_get_ugd();
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->progressbar != NULL) {
- evas_object_del(ugd->progressbar);
- ugd->progressbar = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->progress_info.progressbar);
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
- if (ugd->popup != NULL) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
-
- pts_create_popup(ugd->root_win, PTS_19, 2.0);
- evas_object_show(ugd->root_win);
- ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ugd);
+ pts_create_popup(ad->main_info.root_win, PTS_19, 2.0);
+ evas_object_show(ad->main_info.root_win);
+ ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ad);
PTS_TRACE_END;
}
{
PTS_TRACE_BEGIN;
int job_id = (int)data;
- pts_core_data_t *ugd = pts_get_ugd();
- PTS_RET_IF(ugd == NULL || job_id <= 0, "Invalid parameter for __pts_main_view_response_cancel_print");
-
- if (ugd->progressbar != NULL) {
- evas_object_del(ugd->progressbar);
- ugd->progressbar = NULL;
- }
-
- if (ugd->popup != NULL) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RET_IF(ad == NULL || job_id <= 0, "Invalid parameter for __pts_main_view_response_cancel_print");
+ PTS_IF_DEL_OBJ(ad->progress_info.progressbar);
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
pt_cancel_print(job_id);
- pts_job_spooling_t *job_spooling = __pts_get_job_spooling(ugd, job_id);
+ pts_job_spooling_t *job_spooling = __pts_get_job_spooling(ad, job_id);
PTS_RET_IF(job_spooling == NULL || job_spooling->noti_id == NOTIFICATION_PRIV_ID_NONE
, "No found job_spooling for job[%d]\n", job_id);
// FIXME - Is it better to do this job after received canceled evt_cb?
__pts_remove_notification(job_spooling->noti_id);
- pts_create_popup(ugd->root_win, _("IDS_PRT_POP_PRINTING_CANCELED"), 2.0);
- evas_object_show(ugd->root_win);
- ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ugd);
+ pts_create_popup(ad->main_info.root_win, _("IDS_PRT_POP_PRINTING_CANCELED"), 2.0);
+ evas_object_show(ad->main_info.root_win);
+ ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ad);
PTS_TRACE_END;
}
static void __pts_hide_progress_popup(void *data, 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");
-
- if (ugd->progressbar != NULL) {
- evas_object_del(ugd->progressbar);
- ugd->progressbar = NULL;
- }
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->popup != NULL) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->progress_info.progressbar);
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
- evas_object_hide(ugd->root_win);
+ evas_object_hide(ad->main_info.root_win);
PTS_TRACE_END;
}
-void __pts_print_dummy_popup(pts_core_data_t *ugd, char *files, int page_count)
+void __pts_print_dummy_popup(pts_appdata_t *ad, char *files, int page_count)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(ugd == NULL || files == NULL || page_count <= 0, "Invalid parameters for progress_popup");
+ PTS_RET_IF(ad == NULL || files == NULL || page_count <= 0, "Invalid parameters for progress_popup");
Evas_Object *label1 = NULL;
Evas_Object *label2 = NULL;
char page_info[8] = {0,};
char aligned_label[128] = {0,};
- popup = elm_popup_add(ugd->main_layout);
+ popup = elm_popup_add(ad->main_info.main_layout);
label1 = elm_label_add(popup);
elm_object_style_set(label1, "popup/progressview");
elm_label_line_wrap_set(label1, ELM_WRAP_MIXED);
- char *printer_label = strdup(ugd->active_printer->name);
+ char *printer_label = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_label);
snprintf(aligned_label, 128, "<align=center>%s</align>", printer_label);
elm_object_text_set(label1, aligned_label);
evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(progressbar);
- ugd->progress_label = label2;
- ugd->progress_layout = layout;
- ugd->progressbar = progressbar;
+ ad->progress_info.progress_label = label2;
+ ad->progress_info.progress_layout = layout;
+ ad->progress_info.progressbar = progressbar;
elm_object_part_content_set(layout, "elm.swallow.content.1", label1);
elm_object_part_content_set(layout, "elm.swallow.content.2", label2);
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), ugd->active_printer->copies);
+ int real_total_pages = -1;
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ real_total_pages = 1;
+ } else {
+ real_total_pages = __pts_get_real_total_pages(ad->printing_data.range.total_pages,
+ printer_get_setting_n_up(ad->list_info.active_printer), ad->list_info.active_printer->copies);
+ }
snprintf(page_info, 8, "1/%d", real_total_pages);
elm_object_part_text_set(layout, "elm.text.subtext2", page_info);
elm_object_style_set(btn1,"popup_button/default");
elm_object_text_set(btn1, _("IDS_COM_SK_HIDE"));
elm_object_part_content_set(popup, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", __pts_hide_progress_popup, ugd);
+ evas_object_smart_callback_add(btn1, "clicked", __pts_hide_progress_popup, ad);
if (page_count > 1) {
Evas_Object *btn2 = NULL;
elm_object_content_set(popup, layout);
evas_object_show(popup);
- evas_object_show(ugd->root_win);
+ evas_object_show(ad->main_info.root_win);
- ugd->popup = popup;
+ ad->progress_info.popup = popup;
PTS_TRACE_END;
}
-void __pts_print_progress_popup(pts_core_data_t *ugd, int job_id, int page_count)
+void __pts_print_progress_popup(pts_appdata_t *ad, int job_id, int page_count)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(ugd == NULL || job_id <= 0 || page_count <= 0, "Invalid parameters for progress_popup");
+ PTS_RET_IF(ad == NULL || job_id <= 0 || page_count <= 0, "Invalid parameters for progress_popup");
pts_job_spooling_t *job_spooling = NULL;
- job_spooling = __pts_get_job_spooling(ugd, job_id);
+ job_spooling = __pts_get_job_spooling(ad, job_id);
PTS_RET_IF(job_spooling == NULL, "No found job_spooling for job_id[%d]", job_id);
Evas_Object *label1 = NULL;
char page_info[8] = {0,};
char aligned_label[128] = {0,};
- popup = elm_popup_add(ugd->main_layout);
+ popup = elm_popup_add(ad->main_info.main_layout);
label1 = elm_label_add(popup);
elm_object_style_set(label1, "popup/progressview");
elm_label_line_wrap_set(label1, ELM_WRAP_MIXED);
- char *printer_label = strdup(ugd->active_printer->name);
+ char *printer_label = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_label);
snprintf(aligned_label, 128, "<align=center>%s</align>", printer_label);
elm_object_text_set(label1, aligned_label);
evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(progressbar);
- ugd->progress_label = label2;
- ugd->progress_layout = layout;
- ugd->progressbar = progressbar;
+ ad->progress_info.progress_label = label2;
+ ad->progress_info.progress_layout = layout;
+ ad->progress_info.progressbar = progressbar;
elm_object_part_content_set(layout, "elm.swallow.content.1", label1);
elm_object_part_content_set(layout, "elm.swallow.content.2", label2);
elm_object_style_set(btn1,"popup_button/default");
elm_object_text_set(btn1, _("IDS_COM_SK_HIDE"));
elm_object_part_content_set(popup, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", __pts_hide_progress_popup, ugd);
+ evas_object_smart_callback_add(btn1, "clicked", __pts_hide_progress_popup, ad);
// Show cancel button when total page is greater than 1 page.
- if (page_count > 1) {
+// if (page_count > 1) {
Evas_Object *btn2 = NULL;
btn2 = elm_button_add(popup);
elm_object_style_set(btn2,"popup_button/default");
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);
evas_object_show(popup);
- evas_object_show(ugd->root_win);
+ evas_object_show(ad->main_info.root_win);
- ugd->popup = popup;
+ ad->progress_info.popup = popup;
PTS_TRACE_END;
}
-
-static Eina_Bool __pts_main_view_start_print(void *data)
+static Eina_Bool __pts_is_valid_printing_data(pts_appdata_t *ad)
{
- PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RETV_IF(ugd == NULL, ECORE_CALLBACK_CANCEL, "ugd is NULL");
+ PTS_RETV_IF(ad == NULL, EINA_FALSE, "ad is NULL");
+ PTS_RETV_IF(ad->list_info.active_printer == NULL, EINA_FALSE, "ad->list_info.active_printer is NULL");
- int ret = 0;
- int num = 0;
- char *first_fname;
+ if (ad->list_info.active_printer->copies <= 0) {
+ ad->list_info.active_printer->copies = 1;
+ PTS_DEBUG("copies is less than 0(%d)", ad->list_info.active_printer->copies);
+ return EINA_FALSE;
+ }
- if (ugd->active_printer->copies <= 0) {
- ugd->active_printer->copies = 1;
+ /* get the range of print files */
+ if (ad->printing_data.range.from <= 0 ||
+ ad->printing_data.range.to > ad->printing_data.range.total_pages ||
+ ad->printing_data.range.from > ad->printing_data.range.to) {
+ PTS_DEBUG("from(%d) to(%d) total(%d)"
+ ,ad->printing_data.range.from
+ ,ad->printing_data.range.to
+ ,ad->printing_data.range.total_pages);
+ PTS_DEBUG("range checking error");
+ return EINA_FALSE;
}
- //FIXME - Is it correct position?
- if (!strcasecmp(ugd->pt_files.type, "DOC") || !strcasecmp(ugd->pt_files.type, "WEB")) {
- ugd->pt_files.range.total_pages = get_pdf_pages_count(ugd->pt_files.request_files[0]);
+ return EINA_TRUE;
+}
+
+static Eina_Bool __pts_set_print_option_page_range(pts_appdata_t *ad)
+{
+ PTS_RETV_IF(ad == NULL, EINA_FALSE, "ad is NULL");
+
+ char temp[1024] = {0,};
+ int index = 0;
+
+ if(_is_pdf_file_type(ad->printing_data.request_files, ad->printing_data.num_of_files) == true) {
+ for (index = 0 ; index < ad->printing_data.num_of_files ; index++) {
+ ad->printing_data.range.total_pages += get_pdf_pages_count(ad->printing_data.request_files[index]);
+ }
} else {
- ugd->pt_files.range.total_pages = ugd->pt_files.num_of_files;
+ ad->printing_data.range.total_pages = ad->printing_data.num_of_files;
}
- PTS_DEBUG("Updated ugd->pt_files.range.total_pages: %d", ugd->pt_files.range.total_pages);
- ugd->pt_files.range.to = ugd->pt_files.range.total_pages;
+ PTS_DEBUG("Updated ad->printing_data.range.total_pages: %d", ad->printing_data.range.total_pages);
+ ad->printing_data.range.to = ad->printing_data.range.total_pages;
- pt_set_print_option_papersize(); //(ugd->active_printer->size);
- pt_set_print_option_copies(ugd->active_printer->copies);
- // TODO: Print range
-// pt_set_print_option_scaleimage(ugd->active_printer->scaling);
- pt_set_print_option_orientation(ugd->active_printer->landscape);
- // FIXME : which field of ppd structure sholud be used for this?
- pt_set_print_option_quality();
- pt_set_print_option_paper_type();
- pt_set_print_option_color();
-
- /* get the range of print files */
- if (ugd->pt_files.range.from <= 0 ||
- ugd->pt_files.range.to > ugd->pt_files.range.total_pages ||
- ugd->pt_files.range.from > ugd->pt_files.range.to) {
- PTS_DEBUG("range checking error");
- goto ERR_CASE;
+ if (ad->list_info.active_printer->range == PT_RANGE_CURRENT) {
+ ad->printing_data.range.from = ad->printing_data.range.to = evas_smart_smsc_calculate_page_number(ad->main_info.smsc) + 1;
+ snprintf(temp, sizeof(temp), "%d", ad->printing_data.range.from);
+ pt_set_print_option_page_range(temp);
+ PTS_DEBUG("Set current page[%d] printing", ad->printing_data.range.from);
}
- PTS_IF_FREE_MEM(ugd->pt_files.range.selected_files);
+ return EINA_TRUE;
+}
+static Eina_Bool __pts_set_print_scale_size(pts_appdata_t *ad)
+{
+ PTS_RETV_IF(ad == NULL, EINA_FALSE, "ad is NULL");
+
+ int num = 0;
+ char *first_fname = NULL;
+
+ PTS_IF_FREE_MEM(ad->printing_data.range.selected_files);
//FIXME - multiple page pdf will be changed to several image files.
- num = ugd->pt_files.range.total_pages;
- ugd->pt_files.range.selected_files = (char **)malloc(sizeof(char *)*num);
+ num = ad->printing_data.range.total_pages;
+ ad->printing_data.range.selected_files = (char **)malloc(sizeof(char *)*num);
- if (NULL == ugd->pt_files.range.selected_files) {
+ if (NULL == ad->printing_data.range.selected_files) {
PTS_DEBUG("selected_files malloc error");
- goto ERR_CASE;
+ return EINA_FALSE;
}
- first_fname = ugd->pt_files.request_files[ugd->pt_files.range.from - 1];
+ first_fname = ad->printing_data.request_files[ad->printing_data.range.from - 1];
if (1 == num && FILE_TYPE_IMAGE == get_file_type(first_fname)) {
int res_x = 0;
int res_y = 0;
if (get_image_resolution(first_fname, &res_x, &res_y) < 0) {
PTS_DEBUG("[ERROR] Failed to get image resolution(%s)",first_fname);
- goto ERR_CASE;
+ return EINA_FALSE;
}
pt_imagesize_t crop_image_info;
- crop_image_info.imagesize = ugd->image_size;
- crop_image_info.resolution_width = ugd->custom_width;
- crop_image_info.resolution_height = ugd->custom_height;
- crop_image_info.ratio = ugd->custom_w_ratio;
- crop_image_info.unit = ugd->custom_unit;
+ crop_image_info.imagesize = ad->size_popup_info.image_size;
+ crop_image_info.resolution_width = ad->size_popup_info.custom_width;
+ crop_image_info.resolution_height = ad->size_popup_info.custom_height;
+ crop_image_info.ratio = ad->size_popup_info.custom_w_ratio;
+ crop_image_info.unit = ad->size_popup_info.custom_unit;
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];
+ ad->printing_data.range.selected_files[0] = ad->printing_data.request_files[0];
} else {
- pt_set_print_option_scaleimage(ugd->active_printer->scaling);
+ pt_set_print_option_scaleimage(ad->list_info.active_printer->scaling);
num = 1;
- ugd->pt_files.range.selected_files[0] = ugd->input_file;
+ ad->printing_data.range.selected_files[0] = ad->printing_data.input_file;
}
- if (1 != ugd->active_printer->actived) {
+ return EINA_TRUE;
+}
+
+static Eina_Bool __pts_set_print_options(pts_appdata_t *ad)
+{
+ PTS_RETV_IF(ad == NULL, EINA_FALSE, "ad is NULL");
+ PTS_RETV_IF(ad->list_info.active_printer == NULL, EINA_FALSE, "ad->list_info.active_printer is NULL");
+
+ Eina_Bool eret = EINA_FALSE;
+
+ eret = __pts_set_print_option_page_range(ad);
+ PTS_RETV_IF(eret == EINA_FALSE, EINA_FALSE, "Failed to set page ragnge");
+
+ pt_set_print_option_papersize(); //(ugd->active_printer->size);
+ pt_set_print_option_copies(ad->list_info.active_printer->copies);
+// pt_set_print_option_scaleimage(ugd->active_printer->scaling);
+ pt_set_print_option_orientation(ad->list_info.active_printer->landscape);
+ // FIXME : which field of ppd structure sholud be used for this?
+ pt_set_print_option_quality();
+ pt_set_print_option_paper_type();
+ pt_set_print_option_color();
+ pt_set_print_option_duplex(ad->list_info.active_printer->landscape);
+ eret = __pts_set_print_scale_size(ad);
+ PTS_RETV_IF(eret == EINA_FALSE, EINA_FALSE, "Failed to set print scale size");
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool __pts_set_active_printer(pts_appdata_t *ad)
+{
+ PTS_RETV_IF(ad == NULL, EINA_FALSE, "ad is NULL");
+ PTS_RETV_IF(ad->list_info.active_printer == NULL, EINA_FALSE, "ad->list_info.active_printer is NULL");
+
+ int ret = 0;
+
+ if (1 != ad->list_info.active_printer->actived) {
/* use default printer, needs active */
- ret = pt_set_active_printer(ugd->active_printer);
+ ret = pt_set_active_printer(ad->list_info.active_printer);
if (PT_ERR_NONE != ret) {
PTS_DEBUG("pt_set_active_printer error");
- goto ERR_CASE;
+ return EINA_FALSE;
}
}
- __pts_create_dummy_notification(ugd);
+ return EINA_TRUE;
+}
- ret = pt_start_print((const char **)ugd->pt_files.range.selected_files, num);
+static Eina_Bool __pts_main_view_start_print(void *data)
+{
+ PTS_TRACE_BEGIN;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL");
+ int ret = 0;
+ int num = 1;
+
+ Eina_Bool eret = EINA_FALSE;
+ eret = __pts_set_print_options(ad);
+ PTS_RETV_IF(eret == EINA_FALSE, EINA_FALSE, "Failed to set print option");
+
+ eret = __pts_is_valid_printing_data(ad);
+ PTS_RETV_IF(eret == EINA_FALSE, EINA_FALSE, "It's not valid printing data");
+
+ eret = __pts_set_active_printer(ad);
+ PTS_RETV_IF(eret == EINA_FALSE, EINA_FALSE, "Failed to set active printer");
+
+ __pts_create_dummy_notification(ad);
+
+ ret = pt_start_print((const char **)ad->printing_data.range.selected_files, num);
if (PT_ERR_NONE != ret) {
PTS_DEBUG("pt_start_print error");
goto ERR_CASE;
return ECORE_CALLBACK_CANCEL;
ERR_CASE:
- ugd->is_process = 0;/*process is complete*/
+ ad->search_info.is_process = 0;/*process is complete*/
- if (NULL != ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
if ((PT_ERR_NOT_USB_ACCESS == ret) || (PT_ERR_NOT_NETWORK_ACCESS == ret)) {
- pts_create_popup(ugd->navi, _("IDS_COM_POP_PRINTER_DISCONNECTED_ABB2"), 2.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_COM_POP_PRINTER_DISCONNECTED_ABB2"), 2.0);
} else {
- pts_create_popup(ugd->navi, _("IDS_COM_BODY_UNSUPPORTED_FILE_TYPE"), 1.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_COM_BODY_UNSUPPORTED_FILE_TYPE"), 1.0);
}
return ECORE_CALLBACK_CANCEL;
}
static Eina_Bool __pts_hide_main_view(void *data)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *) data;
- PTS_RETV_IF(ugd == NULL, ECORE_CALLBACK_CANCEL, "data is NULL");
-
- if (ugd->popup) {
- evas_object_del(ugd->popup);
- ugd->popup = NULL;
- }
+ pts_appdata_t *ad = (pts_appdata_t *) data;
+ PTS_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL, "data is NULL");
+ PTS_IF_DEL_OBJ(ad->progress_info.popup);
PTS_DEBUG("Hide main view of mobileprint");
-
- evas_object_hide(ugd->root_win);
+ evas_object_hide(ad->main_info.root_win);
PTS_TRACE_END;
return ECORE_CALLBACK_CANCEL;
static void __pts_main_view_btn_print_cb(void *data, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data ;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if ((NULL != ugd->pt_files.request_files) && (NULL != ugd->active_printer)) {
- 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);
+ if ((NULL != ad->printing_data.request_files) && (NULL != ad->list_info.active_printer)) {
+ evas_object_hide(ad->main_info.main_layout);
+ pts_create_popup(ad->main_info.root_win, _("IDS_PRT_POP_PREPARING_TO_PRINT_ING"), 2.0);
+ ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_hide_main_view, (void *)ad);
- ugd->is_process = 1;/* in process */
- __pts_main_view_start_print(ugd);
+ ad->search_info.is_process = 1;/* in process */
+ __pts_main_view_start_print(ad);
} else {
- pts_create_popup(ugd->navi, _("IDS_PRT_BODY_SELECT_PRINTER"), 2.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_PRT_BODY_SELECT_PRINTER"), 2.0);
}
PTS_TRACE_END;
}
static void __pts_main_view_btn_size_cb(void *data, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->ctxpopup) {
- evas_object_del(ugd->ctxpopup);
- ugd->ctxpopup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->setting_info.ctxpopup);
- if (ugd->active_printer) {
- pts_create_size_popup(ugd->navi, ugd);
+ if (ad->list_info.active_printer) {
+ pts_create_size_popup(ad->main_info.navi, ad);
} else {
- pts_create_popup(ugd->navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
}
PTS_TRACE_END;
static void __pts_main_view_btn_scaling_cb(void *data, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->ctxpopup) {
- evas_object_del(ugd->ctxpopup);
- ugd->ctxpopup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->setting_info.ctxpopup);
- if (ugd->active_printer) {
- pts_create_scaling_popup(ugd->navi, ugd);
+ if (ad->list_info.active_printer) {
+ pts_create_scaling_popup(ad->main_info.navi, ad);
} else {
- pts_create_popup(ugd->navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
}
PTS_TRACE_END;
static void __pts_main_view_btn_landscape_cb(void *data, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->ctxpopup) {
- evas_object_del(ugd->ctxpopup);
- ugd->ctxpopup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->setting_info.ctxpopup);
- if (ugd->active_printer) {
- PTS_DEBUG("initial ugd->landscape_toggle : %d",
- ugd->landscape_toggle);
- if (PT_ORIENTATION_PORTRAIT == ugd->landscape_toggle) {
- ugd->landscape_toggle = PT_ORIENTATION_LANDSCAPE;
+ if (ad->list_info.active_printer) {
+ PTS_DEBUG("initial ad->main_info.landscape_toggle : %d",
+ ad->main_info.landscape_toggle);
+ if (PT_ORIENTATION_PORTRAIT == ad->main_info.landscape_toggle) {
+ ad->main_info.landscape_toggle = PT_ORIENTATION_LANDSCAPE;
} else { /*FIXME if (PT_LANDSCAPE_LANDSCAPE == ugd->landscape_toggle)*/
- ugd->landscape_toggle = PT_ORIENTATION_PORTRAIT;
+ ad->main_info.landscape_toggle = PT_ORIENTATION_PORTRAIT;
}
- PTS_DEBUG("ugd->landscape_toggle : %d", ugd->landscape_toggle);
+ PTS_DEBUG("ad->main_info.landscape_toggle : %d", ad->main_info.landscape_toggle);
- ugd->active_printer->landscape = ugd->landscape_toggle;
- pts_main_view_rotate_image(ugd, app_get_device_orientation());
+ ad->list_info.active_printer->landscape = ad->main_info.landscape_toggle;
+ pts_main_view_rotate_image(ad, app_get_device_orientation());
} else {
- pts_create_popup(ugd->navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
}
PTS_TRACE_END;
static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info)
{
- evas_object_del(obj);
- obj = NULL;
+ PTS_IF_DEL_OBJ(obj);
}
static void _move_ctxpopup_more(Evas_Object *ctxpopup, Evas_Object *btn)
Evas_Object *icon;
char buf[256];
- pts_core_data_t *ugd = pts_get_ugd();
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->ctxpopup) {
- evas_object_del(ugd->ctxpopup);
- }
+ PTS_IF_DEL_OBJ(ad->setting_info.ctxpopup);
- ugd->ctxpopup = elm_ctxpopup_add(ugd->navi);
- elm_object_style_set(ugd->ctxpopup, "more_button");
- evas_object_smart_callback_add(ugd->ctxpopup, "dismissed", _dismissed_cb, ugd->ctxpopup);
+ ad->setting_info.ctxpopup = elm_ctxpopup_add(ad->main_info.navi);
+ elm_object_style_set(ad->setting_info.ctxpopup, "more_button");
+ evas_object_smart_callback_add(ad->setting_info.ctxpopup, "dismissed", _dismissed_cb, ad->setting_info.ctxpopup);
- icon = elm_icon_add(ugd->ctxpopup);
- if (ugd->pt_files.type != NULL) {
- if (0 == strcasecmp(ugd->pt_files.type, "IMG")) {
+ icon = elm_icon_add(ad->setting_info.ctxpopup);
+ if (ad->printing_data.type != NULL) {
+ if (0 == strcasecmp(ad->printing_data.type, "IMG")) {
snprintf(buf, sizeof(buf), "%s/A01_print_popup_icon_size.png", ICON_DIR);
elm_icon_file_set(icon, buf, NULL);
- elm_ctxpopup_item_append(ugd->ctxpopup, _("IDS_IMGE_BODY_SIZE"), icon, __pts_main_view_btn_size_cb, ugd);
- } else if (0 == strcasecmp(ugd->pt_files.type, "DOC") || 0 == strcasecmp(ugd->pt_files.type, "WEB")) {
+ elm_ctxpopup_item_append(ad->setting_info.ctxpopup, _("IDS_IMGE_BODY_SIZE"), icon, __pts_main_view_btn_size_cb, ad);
+ } else if (0 == strcasecmp(ad->printing_data.type, "DOC") || 0 == strcasecmp(ad->printing_data.type, "WEB")) {
snprintf(buf, sizeof(buf), "%s/A01_print_popup_icon_scaling.png", ICON_DIR);
elm_icon_file_set(icon, buf, NULL);
- elm_ctxpopup_item_append(ugd->ctxpopup, _("IDS_PRT_BODY_SCALING_ABB"), icon, __pts_main_view_btn_scaling_cb, ugd);
+ elm_ctxpopup_item_append(ad->setting_info.ctxpopup, _("IDS_PRT_BODY_SCALING_ABB"), icon, __pts_main_view_btn_scaling_cb, ad);
}
} else { /* Default IMG */
snprintf(buf, sizeof(buf), "%s/A01_print_popup_icon_size.png", ICON_DIR);
elm_icon_file_set(icon, buf, NULL);
- elm_ctxpopup_item_append(ugd->ctxpopup, _("IDS_IMGE_BODY_SIZE"), icon, __pts_main_view_btn_size_cb, ugd);
+ elm_ctxpopup_item_append(ad->setting_info.ctxpopup, _("IDS_IMGE_BODY_SIZE"), icon, __pts_main_view_btn_size_cb, ad);
}
- icon = elm_icon_add(ugd->ctxpopup);
- if (ugd->landscape_toggle == PT_ORIENTATION_PORTRAIT) {
+ icon = elm_icon_add(ad->setting_info.ctxpopup);
+ if (ad->main_info.landscape_toggle == PT_ORIENTATION_PORTRAIT) {
snprintf(buf, sizeof(buf), "%s/A01_print_popup_icon_Rotate.png", ICON_DIR);
} else {
snprintf(buf, sizeof(buf), "%s/A01_print_popup_icon_Rotate02.png", ICON_DIR);
}
elm_icon_file_set(icon, buf, NULL);
- elm_ctxpopup_item_append(ugd->ctxpopup, _("IDS_IMGE_OPT_ROTATE"), icon, __pts_main_view_btn_landscape_cb, ugd);
+ elm_ctxpopup_item_append(ad->setting_info.ctxpopup, _("IDS_IMGE_OPT_ROTATE"), icon, __pts_main_view_btn_landscape_cb, ad);
- icon = elm_icon_add(ugd->ctxpopup);
+ icon = elm_icon_add(ad->setting_info.ctxpopup);
snprintf(buf, sizeof(buf), "%s/A01_print_popup_icon_setting.png", ICON_DIR);
elm_icon_file_set(icon, buf, NULL);
- elm_ctxpopup_item_append(ugd->ctxpopup, _("IDS_COM_BODY_SETTING"), icon, __pts_main_view_btn_setting_cb, ugd);
+ elm_ctxpopup_item_append(ad->setting_info.ctxpopup, _("IDS_COM_BODY_SETTING"), icon, __pts_main_view_btn_setting_cb, ad);
- _move_ctxpopup_more(ugd->ctxpopup, obj);
+ _move_ctxpopup_more(ad->setting_info.ctxpopup, obj);
- evas_object_show(ugd->ctxpopup);
+ evas_object_show(ad->setting_info.ctxpopup);
PTS_TRACE_END;
}
/*
* Set accessability information - screen reader text
*/
-void set_main_view_accessability_info(pts_core_data_t *ugd)
+void generate_main_view_accessability_info(pts_appdata_t *ad,
+ char* main_view_accessability_text,
+ size_t text_max_length)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(NULL == ugd || NULL == ugd->active_printer, "Invalid argument");
+ PTS_RET_IF(NULL == ad || NULL == ad->list_info.active_printer, "Invalid argument");
char papersize[256]={0,};
- strncpy(papersize, pt_get_print_option_papersize(ugd->active_printer->size), 256-1);
+ strncpy(papersize, pt_get_print_option_papersize(ad->list_info.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_STANDARD");
} else if (PT_QUALITY_HIGH == p_quality) {
quality = _("IDS_COM_BODY_HIGH");
+ } else {
+ quality = NULL;
}
int p_type = pt_get_selected(PT_OPTION_ID_PAPER);
if (PT_PAPER_NORMAL == p_type) {
papertype = _("IDS_ST_BODY_GLOSSY");
} else if (PT_PAPER_PHOTO == p_type) {
papertype = _("IDS_PRT_BODY_PHOTOGRAPHIC_ABB");
+ } else {
+ papertype = NULL;
}
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");
+ } else {
+ grayscale_mode = NULL;
}
- pt_range_e p_range = ugd->active_printer->range;
+ pt_range_e p_range = ad->list_info.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,"
+ snprintf(main_view_accessability_text, text_max_length, "%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
+ basename(ad->printing_data.input_file), //printing file
+ evas_smart_smsc_calculate_page_number(ad->main_info.smsc) + 1, //current page
g_pages_count, //total pages
papersize,
- ugd->active_printer->copies,
- (1 == ugd->active_printer->copies) ? "copy" : "copies",
+ ad->list_info.active_printer->copies,
+ (1 == ad->list_info.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" :
+ (PT_SCALING_2_PAGES == ad->list_info.active_printer->scaling) ? "2 pages in 1 sheet" :
+ (PT_SCALING_4_PAGES == ad->list_info.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",
+ PT_ORIENTATION_PORTRAIT == ad->list_info.active_printer->landscape ? "portrait" :
+ PT_ORIENTATION_LANDSCAPE == ad->list_info.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);
+ elm_access_info_get(ad->main_info.printer_label, ELM_ACCESS_INFO));
PTS_TRACE_END;
}
/*
* create content of the main view screen
*/
-static Evas_Object *__pts_main_view_create_content(pts_core_data_t *ugd)
+static Evas_Object *__pts_main_view_create_content(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL, NULL, "ugd is NULL");
+ PTS_RETV_IF(ad == NULL, NULL, "ad is NULL");
/*
* load preview group
*/
- ugd->printer_layout = pts_create_base_layout(ugd->navi, "printer");
+ ad->main_info.printer_layout = pts_create_base_layout(ad->main_info.navi, "printer");
- pts_main_view_update_printer_label(ugd);
+ pts_main_view_update_printer_label(ad);
/*
* load preview image group
*/
- ugd->img_layout = pts_create_base_layout(ugd->printer_layout, "image_view");
+ ad->main_info.img_layout = pts_create_base_layout(ad->main_info.printer_layout, "image_view");
- if (NULL != ugd->pt_files.request_files) {
+ if (NULL != ad->printing_data.request_files) {
char *file_path = NULL;
- file_path = ugd->pt_files.request_files[ugd->pt_files.current_index];
+ file_path = ad->printing_data.request_files[ad->printing_data.current_index];
PTS_DEBUG("filepath is %s", file_path);
}
- 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);
+ ad->main_info.smsc = evas_smart_smsc_add(evas_object_evas_get(ad->main_info.img_layout));
+ evas_smart_smsc_set_layout(ad->main_info.smsc, ad->main_info.img_layout);
+ elm_object_part_content_set(ad->main_info.img_layout, "content", ad->main_info.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->img_layout);
- evas_object_show(ugd->printer_layout);
+ elm_object_part_content_set(ad->main_info.printer_layout, "image", ad->main_info.img_layout);
+ evas_object_show(ad->main_info.img_layout);
+ evas_object_show(ad->main_info.printer_layout);
+
+ static char main_view_accessability_text[2048] = {0,};
+ generate_main_view_accessability_info(ad, main_view_accessability_text, 2048);
+ init_smsc_accessability_support(ad->main_info.smsc);
+ set_main_view_accessability_info(ad->main_info.smsc, ad->main_info.img_layout,
+ main_view_accessability_text,
+ IDS_SCRREAD_PREVIEW_IMAGE_TYPE,
+ IDS_SCRREAD_PREVIEW_IMAGE_CONTEXT);
PTS_TRACE_END;
- return ugd->printer_layout;
+ return ad->main_info.printer_layout;
}
static void __pts_main_view_btn_setting_cb(void *data, 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");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->ctxpopup) {
- evas_object_del(ugd->ctxpopup);
- ugd->ctxpopup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->setting_info.ctxpopup);
- if (ugd->active_printer) {
- pts_create_setting_view(ugd);
+ if (ad->list_info.active_printer) {
+ pts_create_setting_view(ad);
} else {
- pts_create_popup(ugd->navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
+ pts_create_popup(ad->main_info.navi, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"), 1.0);
}
PTS_TRACE_END;
}
-int pts_main_view_load_printing_data(pts_core_data_t *ugd, pts_printing_data_t *printing_data)
+int pts_main_view_load_printing_data(pts_appdata_t *ad, pts_printing_data_t *printing_data)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL || printing_data == NULL, -1, "Invalid argument");
+ PTS_RETV_IF(ad == NULL || printing_data == NULL, -1, "Invalid argument");
- PTS_IF_FREE_MEM(ugd->pt_files.request_files);
- PTS_IF_FREE_MEM(ugd->pt_files.type);
+ PTS_IF_FREE_MEM(ad->printing_data.request_files);
+ PTS_IF_FREE_MEM(ad->printing_data.type);
- memset(&ugd->pt_files, 0, sizeof(pts_printing_data_t));
+ memset(&ad->printing_data, 0, sizeof(pts_printing_data_t));
- ugd->pt_files.num_of_files = printing_data->num_of_files;
- ugd->pt_files.current_index = printing_data->current_index;
- ugd->pt_files.type = printing_data->type;
- ugd->pt_files.request_files = (char **)malloc(sizeof(char *) * ugd->pt_files.num_of_files);
+ ad->printing_data.num_of_files = printing_data->num_of_files;
+ ad->printing_data.current_index = printing_data->current_index;
+ ad->printing_data.type = printing_data->type;
+ ad->printing_data.request_files = (char **)malloc(sizeof(char *) * ad->printing_data.num_of_files);
- if (!ugd->pt_files.request_files) {
- PTS_IF_FREE_MEM(ugd->pt_files.type);
- PTS_IF_FREE_MEM(ugd);
+ if (!ad->printing_data.request_files) {
+ PTS_IF_FREE_MEM(ad->printing_data.type);
+ //PTS_IF_FREE_MEM(ad->printing_data);
PTS_DEBUG("calloc print files failed");
PTS_TRACE_END;
return -1;
}
int i = 0;
- for (i = 0; i < ugd->pt_files.num_of_files; i++) {
+ for (i = 0; i < ad->printing_data.num_of_files; i++) {
PTS_DEBUG("file path is %s", printing_data->request_files[i]);
if (NULL != printing_data->request_files[i]) {
- ugd->pt_files.request_files[i] = strdup(printing_data->request_files[i]);
+ ad->printing_data.request_files[i] = strdup(printing_data->request_files[i]);
} else {
- ugd->pt_files.request_files[i] = strdup(MOBILEPRINT_DEFAULTIMG);
+ ad->printing_data.request_files[i] = strdup(MOBILEPRINT_DEFAULTIMG);
}
- PTS_DEBUG("file path is %s", ugd->pt_files.request_files[i]);
+ PTS_DEBUG("file path is %s", ad->printing_data.request_files[i]);
}
- ugd->input_file = strdup(ugd->pt_files.request_files[0]);
- PTS_DEBUG("ugd->input_file: %s", ugd->input_file);
+ ad->printing_data.input_file = strdup(ad->printing_data.request_files[0]);
+ PTS_DEBUG("ad->input_file: %s", ad->printing_data.input_file);
- PTS_DEBUG("count: %d", ugd->pt_files.num_of_files);
- PTS_DEBUG("current index: %d", ugd->pt_files.current_index);
- PTS_DEBUG("filetype: %s", ugd->pt_files.type);
+ PTS_DEBUG("count: %d", ad->printing_data.num_of_files);
+ PTS_DEBUG("current index: %d", ad->printing_data.current_index);
+ PTS_DEBUG("filetype: %s", ad->printing_data.type);
/* init the print range(include all pages) */
- ugd->pt_files.range.from = 1;
- ugd->pt_files.range.to = ugd->pt_files.range.total_pages = ugd->pt_files.num_of_files;
- ugd->pt_files.range.selected_files = NULL;
+ ad->printing_data.range.from = 1;
+ ad->printing_data.range.to = ad->printing_data.range.total_pages = ad->printing_data.num_of_files;
+ ad->printing_data.range.selected_files = NULL;
PTS_TRACE_END;
return 0;
* @return void
* @param[in] ugd the pointer to the main data structure
*/
-void pts_main_view_update_printer_label(pts_core_data_t *ugd)
+void pts_main_view_update_printer_label(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ PTS_RET_IF(ad == NULL, "ad is NULL");
char label_text[128] = {0,};
char label_voice[128] = {0,};
- if (ugd->printer_label == NULL) {
- ugd->printer_label = elm_label_add(ugd->printer_layout);
+ if (ad->main_info.printer_label == NULL) {
+ ad->main_info.printer_label = elm_label_add(ad->main_info.printer_layout);
}
- PTS_DEBUG("ugd->active_printer is %p", ugd->active_printer);
+ PTS_DEBUG("ad->list_info.active_printer is %p", ad->list_info.active_printer);
- if (ugd->active_printer != NULL) {
- char *printer_name = strdup(ugd->active_printer->name);
+ if (ad->list_info.active_printer != NULL) {
+ char *printer_name = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_name);
snprintf(label_text, 128, "<align=center>%s</align>", printer_name);
snprintf(label_voice, 128, "%s", printer_name);
snprintf(label_voice, 128, "%s", _("IDS_COM_BODY_NO_DEVICES"));
}
- 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);
+ elm_object_text_set(ad->main_info.printer_label, label_text);
+ elm_access_info_set(ad->main_info.printer_label, ELM_ACCESS_INFO, label_voice);
+ evas_object_size_hint_weight_set(ad->main_info.printer_label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ad->main_info.printer_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_part_content_set(ugd->printer_layout, "printer_name", ugd->printer_label);
+ elm_object_part_content_set(ad->main_info.printer_layout, "printer_name", ad->main_info.printer_label);
PTS_TRACE_END;
}
* @param[in] ugd the pointer to the main data structure
* @param[in] landscape the landscape value
*/
-void pts_main_view_rotate_image(pts_core_data_t *ugd,
+void pts_main_view_rotate_image(pts_appdata_t *ad,
app_device_orientation_e orientation)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- //clear_preview_image(ugd); /* TODO: show empty page */
- generate_preview_images(ugd, orientation);
+ generate_preview_images(ad, orientation);
g_pages_count = 0;
PTS_TRACE_END;
* @param[in] win the pointer to the main window
* @param[in] pt_files the pointer to the path of print files
*/
-API Evas_Object *pts_create_main_view(pts_core_data_t *ugd)
+API Evas_Object *pts_create_main_view(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF((ugd == NULL) || (ugd->root_win == NULL), NULL, "Invalid argument");
+ PTS_RETV_IF((ad == NULL) || (ad->main_info.root_win == NULL), NULL, "Invalid argument");
Evas_Object *main_layout = NULL;
Evas_Object *back_btn = NULL;
- ugd->main_layout = pts_create_base_layout_with_conform(ugd->root_win, "navi");
- if (NULL == ugd->main_layout) {
- PTS_IF_FREE_MEM(ugd);
+ ad->main_info.main_layout = pts_create_base_layout_with_conform(ad->main_info.root_win, "navi");
+ if (NULL == ad->main_info.main_layout) {
+ //PTS_IF_FREE_MEM(ad);
PTS_DEBUG("create base layout failed");
PTS_TRACE_END;
return NULL;
}
- ugd->navi = elm_naviframe_add(ugd->main_layout);
- elm_object_part_content_set(ugd->main_layout, "navigation_bar", ugd->navi);
+ ad->main_info.navi = elm_naviframe_add(ad->main_info.main_layout);
+ elm_object_part_content_set(ad->main_info.main_layout, "navigation_bar", ad->main_info.navi);
- main_layout = __pts_main_view_create_content(ugd);
+ main_layout = __pts_main_view_create_content(ad);
- back_btn = pts_create_label_btn(ugd->navi, _("IDS_COM_SK_BACK"));
+ back_btn = pts_create_label_btn(ad->main_info.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_smart_callback_add(back_btn, "clicked", __pts_main_view_btn_back_cb, ad);
- evas_object_event_callback_add(ugd->navi, EVAS_CALLBACK_DEL, __pts_main_view_navi_delete_cb, ugd);
+ evas_object_event_callback_add(ad->main_info.navi, EVAS_CALLBACK_DEL, __pts_main_view_navi_delete_cb, ad);
- ugd->navi_it = elm_naviframe_item_push(ugd->navi, _("IDS_PRT_SK_PRINT_PREVIEW"), back_btn, NULL, main_layout, NULL);
+ ad->main_info.navi_it = elm_naviframe_item_push(ad->main_info.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);
+ ad->main_info.print_btn = create_toolbar_btn(ad->main_info.navi, _("IDS_SMPOS_SK3_PRINT"), __pts_main_view_btn_print_cb, ad);
+ elm_access_info_set(ad->main_info.print_btn, ELM_ACCESS_INFO, _("IDS_SMPOS_SK3_PRINT"));
+ elm_access_info_set(ad->main_info.print_btn, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_PRINT_CONTEXT);
+ elm_object_item_part_content_set(ad->main_info.navi_it, "toolbar_button1", ad->main_info.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);
+ ad->main_info.more_btn = create_toolbar_more_btn(ad->main_info.navi, _more_btn_cb, ad->main_info.navi_it);
+ elm_object_item_part_content_set(ad->main_info.navi_it, "toolbar_more_btn", ad->main_info.more_btn);
- evas_object_event_callback_add(main_layout, EVAS_CALLBACK_DEL, __pts_main_view_delete_cb, ugd);
+ evas_object_event_callback_add(main_layout, EVAS_CALLBACK_DEL, __pts_main_view_delete_cb, ad);
int tmp_width = 0;
int tmp_height = 0;
- get_image_resolution(ugd->input_file, &tmp_width, &tmp_height);
- ugd->custom_width = (double)tmp_width;
- ugd->custom_height = (double)tmp_height;
- ugd->custom_w_ratio = ugd->custom_width / ugd->custom_height;
- PTS_DEBUG("Original image size : %lfx%lf(%lfx1)", ugd->custom_width, ugd->custom_height, ugd->custom_w_ratio);
+ get_image_resolution(ad->printing_data.input_file, &tmp_width, &tmp_height);
+ ad->size_popup_info.custom_width = (double)tmp_width;
+ ad->size_popup_info.custom_height = (double)tmp_height;
+ ad->size_popup_info.custom_w_ratio = ad->size_popup_info.custom_width / ad->size_popup_info.custom_height;
+ PTS_DEBUG("Original image size : %lfx%lf(%lfx1)", ad->size_popup_info.custom_width, ad->size_popup_info.custom_height, ad->size_popup_info.custom_w_ratio);
// original image size (unit cm) calculated by 300dpi
- ugd->custom_width = (ugd->custom_width / 300) * 2.54;
- ugd->custom_height = (ugd->custom_height / 300) * 2.54;
- ugd->custom_unit = 1; // cm unit
+ ad->size_popup_info.custom_width = (ad->size_popup_info.custom_width / 300) * 2.54;
+ ad->size_popup_info.custom_height = (ad->size_popup_info.custom_height / 300) * 2.54;
+ ad->size_popup_info.custom_unit = 1; // cm unit
PTS_TRACE_END;
- return ugd->main_layout;
+ return ad->main_info.main_layout;
}
#include "mobileprint.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_util.h"
};
typedef struct {
- pts_core_data_t *ugd;
pt_printer_mgr_t *pt;
-
int radio_index;
Evas_Object *radio_group;
} radio_print_list_data_t;
static Elm_Genlist_Item_Class list_itc;
-static Elm_Genlist_Item_Class refresh_itc;
+//static Elm_Genlist_Item_Class refresh_itc;
static Elm_Genlist_Item_Class wifi_list_itc;
static Evas_Object *printer_list_radio_main = NULL;
-void pt_post_print_search(pts_core_data_t *ugd);
-void pts_create_no_found_popup(Evas_Object *parent, pts_core_data_t *ugd, void *refresh_cb, void *cancel_cb);
+void pt_post_print_search(pts_appdata_t *ad);
+Evas_Object *pts_create_no_found_popup(Evas_Object *parent, void *refresh_cb, void *cancel_cb);
static char *_pts_wifi_text_get(void *data, Evas_Object *obj, const char *part)
{
}
}
-static void _pts_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+static void _wifi_direct_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
{
PTS_TRACE_BEGIN;
PTS_RET_IF(ug == NULL, "ug is NULL");
PTS_TRACE_END;
}
-static void _pts_ug_result_cb(ui_gadget_h ug, service_h result, void *priv)
+static void _wifi_direct_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");
+ pts_appdata_t *ad = (pts_appdata_t *)priv;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
char *ip_addr = NULL;
service_get_extra_data(result, "ip_address", &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);
+ PTS_IF_FREE_MEM(ad->search_info.ip_address);
+ ad->search_info.ip_address = strdup(ip_addr);
+ PTS_RET_IF(ad->search_info.ip_address == NULL, "ad->search_info.ip_address is NULL");
} 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)
+static void _wifi_direct_ug_destroy_cb(ui_gadget_h ug, void *priv)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)priv;
- PTS_RET_IF(ug == NULL || ugd == NULL, "Invalid argument");
-
- int ret = 0;
- int net_type = 0;
- ret = pt_get_connection_status(&net_type);
+ pts_appdata_t *ad = (pts_appdata_t *)priv;
+ PTS_RET_IF(ug == NULL || ad == NULL, "Invalid argument");
- PTS_DEBUG("RET is %d", ret);
+ pts_search_printer(ad);
- if ((net_type&PT_CONNECTION_USB)>0 ||
- (net_type&PT_CONNECTION_WIFI)>0 ||
- (net_type&PT_CONNECTION_WIFI_DIRECT)>0) {
-
- // Begin actual printer searching...
- pts_create_print_search_popup(ugd->print_search_popup_parent, ugd);
- } else {
- if (ugd->print_search_mode == PTS_SEARCH_INITIAL) {
- pt_deinit();
- elm_exit();
- } else {
- // Reselect...
- pts_search_printer(ugd, ugd->print_search_popup_parent, ugd->print_search_mode, ugd->selection_done_cb, ugd->printer_search_user_data);
- }
- }
PTS_TRACE_END;
}
vconf_ignore_key_changed(VCONFKEY_WIFI_QS_EXIT, _wifi_qs_monitoring_cb);
- pts_core_data_t *ugd = (pts_core_data_t *)data;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+
+ pts_search_printer(ad);
+ PTS_TRACE_END;
+}
+
+static void pts_launch_wifi_direct_ug(pts_appdata_t *ad)
+{
+ PTS_TRACE_BEGIN;
int ret = 0;
- int net_type = 0;
- ret = pt_get_connection_status(&net_type);
- PTS_DEBUG("RET is %d", ret);
+ struct ug_cbs cbs = {0, };
+ service_h service = NULL;
+
+ memset(&cbs, 0x00, sizeof(struct ug_cbs));
+ cbs.layout_cb = _wifi_direct_ug_layout_cb;
+ cbs.result_cb = _wifi_direct_ug_result_cb;
+ cbs.destroy_cb = _wifi_direct_ug_destroy_cb;
+ cbs.priv = ad;
+
+ service_create(&service);
+ ret = service_add_extra_data(service, "device_filter", "printer");
+ if (ret != SERVICE_ERROR_NONE) { goto ERROR; }
+ ret= service_add_extra_data(service, "auto_exit", "on");
+ if (ret != SERVICE_ERROR_NONE) { goto ERROR; }
+ ret = service_add_extra_data(service, "multi_connect", "off");
+ if (ret != SERVICE_ERROR_NONE) { goto ERROR; }
+ ret= service_add_extra_data(service, "title_string", _("IDS_COM_OPT1_WI_FI_DIRECT"));
+ if (ret != SERVICE_ERROR_NONE) { goto ERROR; }
+
+ ug_create(NULL, "setting-wifidirect-efl", UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(service);
- if ((net_type&PT_CONNECTION_USB)>0 ||
- (net_type&PT_CONNECTION_WIFI)>0 ||
- (net_type&PT_CONNECTION_WIFI_DIRECT)>0) {
+ PTS_TRACE_END;
+ return ret;
- // Begin actual printer searching...
- pts_create_print_search_popup(ugd->print_search_popup_parent, ugd);
- } else {
- if (ugd->print_search_mode == PTS_SEARCH_INITIAL) {
- pt_deinit();
- elm_exit();
- } else {
- // Reselect...
- pts_search_printer(ugd, ugd->print_search_popup_parent, ugd->print_search_mode, ugd->selection_done_cb, ugd->printer_search_user_data);
- }
- }
+ERROR:
+ PTS_DEBUG("Failed to create wifi direct ug(%d)", ret);
+ service_destroy(service);
PTS_TRACE_END;
+ return ret;
+
}
static void _pts_wifi_list_sel(void *data, Evas_Object *obj, void *event_info)
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
+ pts_appdata_t *ad = pts_get_appdata();
int index = 0;
+ int ret = -1;
Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- if (item) {
- index = (int)elm_object_item_data_get(item);
- if (index == 0) { // Wi-Fi
- int ret = pts_launch_wifi_qs();
- if (ret > 0) {
- // Currently ret value is procces id of wifi_qs.
- PTS_DEBUG("Now register vocnf cb for VCONFKEY_WIFI_QS_EXIT");
- vconf_notify_key_changed(VCONFKEY_WIFI_QS_EXIT, _wifi_qs_monitoring_cb, ugd);
- } else {
- PTS_DEBUG("Failed to launch wifi-qs.");
- }
- } 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");
- }
+ if (item == NULL) {
+ PTS_IF_DEL_OBJ(ad->select_info.wifi_type_popup);
+ return;
}
- if (ugd->wifi_type_popup != NULL) {
- evas_object_del(ugd->wifi_type_popup);
- ugd->wifi_type_popup = NULL;
+ index = (int)elm_object_item_data_get(item);
+ if (index == 0) { // Wi-Fi
+ ret = pts_launch_wifi_qs();
+ if (ret > 0) {
+ // Currently ret value is procces id of wifi_qs.
+ PTS_DEBUG("Now register vocnf cb for VCONFKEY_WIFI_QS_EXIT");
+ vconf_notify_key_changed(VCONFKEY_WIFI_QS_EXIT, _wifi_qs_monitoring_cb, ad);
+ } else {
+ PTS_DEBUG("Failed to launch wifi-qs(%d)",ret);
+ }
+ } else if (index == 1) { // Wi-Fi Direct
+ pts_launch_wifi_direct_ug(ad);
+ } else {
+ PTS_DEBUG("Unknown index");
}
+ PTS_IF_DEL_OBJ(ad->select_info.wifi_type_popup);
PTS_TRACE_END;
}
static void _pts_refresh_cb(void *data, 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");
-
- if (NULL != ugd->no_found_popup) {
- evas_object_del(ugd->no_found_popup);
- ugd->no_found_popup = NULL;
- }
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (NULL != ugd->printer_list_popup) {
- evas_object_del(ugd->printer_list_popup);
- ugd->printer_list_popup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->list_info.no_found_popup);
+ PTS_IF_DEL_OBJ(ad->list_info.printer_list_popup);
- pts_create_print_search_popup(ugd->print_search_popup_parent, ugd);
+ pts_search_printer(ad);
PTS_TRACE_END;
}
static void _pts_cancel_cb(void *data, Evas_Object *obj, void *event_info)
{
PTS_TRACE_BEGIN;
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
- if (ugd->print_search_mode == PTS_SEARCH_INITIAL) {
- if (ugd->no_found_popup != NULL) {
- evas_object_del(ugd->no_found_popup);
- ugd->no_found_popup = NULL;
- }
-
- if (obj != NULL) {
- evas_object_del(obj);
- obj = NULL;
- }
+ if (ad->search_info.print_search_mode == PTS_SEARCH_INITIAL) {
+ PTS_IF_DEL_OBJ(ad->list_info.printer_list_popup);
+ PTS_IF_DEL_OBJ(obj);
pt_deinit();
elm_exit();
} else {
- if (ugd->no_found_popup != NULL) {
- evas_object_del(ugd->no_found_popup);
- ugd->no_found_popup = NULL;
- }
- if (ugd->wifi_type_popup != NULL) {
- evas_object_del(ugd->wifi_type_popup);
- ugd->wifi_type_popup = NULL;
- }
- if (ugd->active_printer == NULL) {
+ PTS_IF_DEL_OBJ(ad->list_info.no_found_popup);
+ PTS_IF_DEL_OBJ(ad->select_info.wifi_type_popup);
+ PTS_IF_DEL_OBJ(obj);
+
+ if (ad->list_info.active_printer == NULL) {
PTS_DEBUG("No active printer. So remove all option");
- elm_genlist_item_update(ugd->printer_item);
- elm_object_item_del(ugd->header_separator_item);
- elm_object_item_del(ugd->item_paper_size);
- elm_object_item_del(ugd->item_paper_copies);
- elm_object_item_del(ugd->item_page_range);
- elm_object_item_del(ugd->item_paper_quality);
- elm_object_item_del(ugd->item_paper_type);
- elm_object_item_del(ugd->item_grayscale);
- elm_object_item_del(ugd->footer_separator_item);
- }
- if (obj != NULL) {
- evas_object_del(obj);
- obj = NULL;
+ elm_genlist_item_update(ad->setting_info.printer_item);
+ elm_object_item_del(ad->setting_info.header_separator_item);
+ elm_object_item_del(ad->setting_info.item_paper_size);
+ elm_object_item_del(ad->setting_info.item_paper_copies);
+ elm_object_item_del(ad->setting_info.item_page_range);
+ elm_object_item_del(ad->setting_info.item_paper_quality);
+ elm_object_item_del(ad->setting_info.item_paper_type);
+ elm_object_item_del(ad->setting_info.item_grayscale);
+ elm_object_item_del(ad->setting_info.footer_separator_item);
}
}
PTS_TRACE_END;
}
-static int pts_save_selected_printer(pts_core_data_t *ugd, pt_printer_mgr_t *pt)
+static int pts_save_selected_printer(pts_appdata_t *ad, pt_printer_mgr_t *pt)
{
PTS_TRACE_BEGIN;
PTS_RETV_IF(pt == NULL, PT_ERR_INVALID_PARAM, "printer_info is NULL.");
PTS_DEBUG("pt address %x", pt);
/* Check whether the printer is already activated or not. */
- if (NULL != ugd->active_printer) {
- if ((strcmp(ugd->active_printer->name, pt->name) == 0) &&
- (strcmp(ugd->active_printer->address, pt->address) == 0)) {
+ if (NULL != ad->list_info.active_printer) {
+ if ((strcmp(ad->list_info.active_printer->name, pt->name) == 0) &&
+ (strcmp(ad->list_info.active_printer->address, pt->address) == 0)) {
// if same printer, then nothing to do...
PTS_DEBUG("Same printer is selected. No update required. %x", pt);
return PT_ERR_NONE;
ret = pt_set_default_printer(pt);
PTS_RETV_IF(ret != PT_ERR_NONE, PT_ERR_FAIL, "Can not set default printer.");
- if (NULL == ugd->active_printer) {
- ugd->active_printer = (pt_printer_mgr_t *)malloc(sizeof(pt_printer_mgr_t));
- PTS_RETV_IF(ugd->active_printer == NULL, PT_ERR_NO_MEMORY, "Can allocate memory");
+ if (NULL == ad->list_info.active_printer) {
+ ad->list_info.active_printer = (pt_printer_mgr_t *)malloc(sizeof(pt_printer_mgr_t));
+ PTS_RETV_IF(ad->list_info.active_printer == NULL, PT_ERR_NO_MEMORY, "Can allocate memory");
}
- memset(ugd->active_printer, 0, sizeof(pt_printer_mgr_t));
- memcpy(ugd->active_printer, pt, sizeof(pt_printer_mgr_t));
+ memset(ad->list_info.active_printer, 0, sizeof(pt_printer_mgr_t));
+ memcpy(ad->list_info.active_printer, pt, sizeof(pt_printer_mgr_t));
- ugd->paper_size = (Elm_Object_Item *)realloc(ugd->paper_size, pt_get_print_option_papersize_num() * sizeof(Elm_Object_Item *));
- memset(ugd->paper_size, 0, pt_get_print_option_papersize_num() * sizeof(Elm_Object_Item *));
+ ad->setting_info.paper_size = (Elm_Object_Item *)realloc(ad->setting_info.paper_size, pt_get_print_option_papersize_num() * sizeof(Elm_Object_Item *));
+ memset(ad->setting_info.paper_size, 0, pt_get_print_option_papersize_num() * sizeof(Elm_Object_Item *));
return PT_ERR_NONE;
}
{
PTS_TRACE_BEGIN;
struct appdata *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
- evas_object_del(data);
+ PTS_IF_DEL_OBJ(data);
- if (ugd->print_search_mode == PTS_SEARCH_INITIAL) {
+ if (ad->search_info.print_search_mode == PTS_SEARCH_INITIAL) {
PTS_TRACE_END;
pt_deinit();
elm_exit();
static void _pts_printer_list_ok_cb(void *data, Evas_Object *obj, void *event_info)
{
PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
- pts_core_data_t *ugd = ld->ugd;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- if (ugd->select_printer == NULL) {
- //No supported printer
- PTS_TRACE_END;
- return;
- }
+ PTS_RET_IF(ad->list_info.select_printer == NULL, "No supported printer");
+ PTS_IF_DEL_OBJ(printer_list_radio_main);
+ PTS_IF_DEL_OBJ(ad->list_info.printer_list_popup);
- if (NULL != printer_list_radio_main) {
- evas_object_del(printer_list_radio_main);
- printer_list_radio_main = NULL;
- }
+ pts_save_selected_printer(ad, ad->list_info.select_printer);
- if (ugd->printer_list_popup != NULL) {
- evas_object_del(ugd->printer_list_popup);
- ugd->printer_list_popup = NULL;
- }
-
- pts_save_selected_printer(ugd, ugd->select_printer);
-
- if (ugd->selection_done_cb != NULL) {
- ugd->selection_done_cb(ugd->printer_search_user_data);
+ if (ad->search_info.selection_done_cb != NULL) {
+ ad->search_info.selection_done_cb(ad->search_info.printer_search_user_data);
}
PTS_TRACE_END;
return;
}
-#if 0
-/*
-* the response callback when click back button
-*/
-static void __pts_search_btn_back_cb(void *data, 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");
-
- pts_save_selected_printer(ugd, ugd->select_printer);
-
- //elm_naviframe_item_pop_to(ugd->navi_it);
- elm_naviframe_item_pop(ugd->navi);
- //pts_main_view_rotate_image(ugd, app_get_device_orientation());
-
- if (ugd->selection_done_cb != NULL) {
- ugd->selection_done_cb(ugd->printer_search_user_data);
- }
-
- PTS_TRACE_END;
-}
-#endif
-
/*
* select the printer from the searched printers list
*/
PTS_TRACE_BEGIN;
PTS_RET_IF(data == NULL, "data is NULL");
PTS_RET_IF(event_info == NULL, "event_info is NULL");
- pts_ug_list_data *ld = (pts_ug_list_data *)data;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
Elm_Object_Item *item = event_info;
pt_printer_mgr_t *pt = NULL;
PTS_DEBUG("pt->name : %s", pt->name);
PTS_DEBUG("pt->address : %s", pt->address);
- ld->ugd->select_printer = pt;
+ ad->list_info.select_printer = pt;
elm_radio_value_set(core->radio_group, core->radio_index);
// Now call real event trigger to update radio button when selected.
PTS_TRACE_BEGIN;
radio_print_list_data_t *core = (radio_print_list_data_t *) data;
- pts_core_data_t *ugd = core->ugd;
- PTS_RETV_IF(core == NULL || ugd == NULL, NULL, "Invalid argument");
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RETV_IF(core == NULL || ad == NULL, NULL, "Invalid argument");
pt_printer_mgr_t *pt = core->pt;
Evas_Object *radio = NULL;
radio = elm_radio_add(obj);
elm_radio_state_value_set(radio, core->radio_index);
elm_radio_group_add(radio, core->radio_group);
- if (ugd->active_printer != NULL) {
- if (strcmp(ugd->active_printer->name, pt->name) ==0 &&
- strcmp(ugd->active_printer->address, pt->address) ==0) {
+ if (ad->list_info.active_printer != NULL) {
+ if (strcmp(ad->list_info.active_printer->name, pt->name) ==0 &&
+ strcmp(ad->list_info.active_printer->address, pt->address) ==0) {
elm_radio_value_set(radio, core->radio_index);
- ugd->select_printer = pt;
+ ad->list_info.select_printer = pt;
PTS_DEBUG("Printer[%d] name=[%s], address=[%s] -> Active", core->radio_index, pt->name, pt->address);
} else {
return NULL;
}
+#if 0
static Evas_Object *__pts_refresh_icon_get(void *data, Evas_Object *obj, const char *part)
{
PTS_TRACE_BEGIN;
Evas_Object *btn1;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- PTS_RETV_IF(ugd == NULL, NULL, "Invalid argument");
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ PTS_RETV_IF(ad == NULL, NULL, "Invalid argument");
if (!strcmp(part, "elm.icon")) {
btn1 = elm_button_add(obj);
elm_object_text_set(btn1, _("IDS_COM_SK_REFRESH"));
//elm_object_part_content_set(obj, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", _pts_refresh_cb, ugd);
+ evas_object_smart_callback_add(btn1, "clicked", _pts_refresh_cb, ad);
PTS_TRACE_END;
return btn1;
} else {
PTS_TRACE_END;
return NULL;
}
+#endif
/*
* popup when machine is unsupported
static Eina_Bool __pts_exit_cb(void *data)
{
PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *) data;
- PTS_RETV_IF(ld == NULL, ECORE_CALLBACK_CANCEL, "ld is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *) data;
+ PTS_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL");
- PTS_IF_FREE_MEM(ld);
+ PTS_IF_FREE_MEM(ad);
elm_exit();
PTS_TRACE_END;
static Eina_Bool __pts_list_view_popup_error(void *data)
{
PTS_TRACE_BEGIN;
- pts_ug_list_data *ld = (pts_ug_list_data *) data;
- PTS_RETV_IF(ld == NULL, ECORE_CALLBACK_CANCEL, "ld is NULL");
+ pts_appdata_t *ad = (pts_appdata_t *) data;
+ PTS_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL, "ad is NULL");
- ld->ugd->is_process = 0;/*process is complete*/
+ ad->search_info.is_process = 0;/*process is complete*/
- if (ld->popup) {
- evas_object_del(ld->popup);
- ld->popup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->search_info.popup);
PTS_DEBUG("search printer failed");
- pts_create_popup(ld->ugd->print_search_popup_parent, _("IDS_ASEML_POP_SEARCH_FAILED"), 1.0);
- ecore_timer_add(1, (Ecore_Task_Cb)__pts_exit_cb, (void *)ld->ugd);
+ pts_create_popup(ad->search_info.print_search_popup_parent, _("IDS_ASEML_POP_SEARCH_FAILED"), 1.0);
+ ecore_timer_add(1, (Ecore_Task_Cb)__pts_exit_cb, (void *)ad);
- PTS_IF_FREE_MEM(ld);
+ PTS_IF_FREE_MEM(ad);
PTS_TRACE_END;
return ECORE_CALLBACK_CANCEL;
}
// pts_create_wifi_popup
-Evas_Object *pts_search_create_wifi_type_selector_popup(Evas_Object *parent, pts_core_data_t *ugd)
+Evas_Object *pts_create_wifi_type_selector_popup(Evas_Object *parent)
{
PTS_TRACE_BEGIN;
- Evas_Object *popup;
- int index;
- Evas_Object *genlist;
- Evas_Object *btn1;
- popup = elm_popup_add(parent);
+ Evas_Object *popup = elm_popup_add(parent);
elm_object_style_set(popup,"min_menustyle");
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);
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);
+ Evas_Object *cancel_button = elm_button_add(popup);
+ elm_object_style_set(cancel_button,"popup_button/default");
+ elm_object_text_set(cancel_button, _("IDS_COM_SK_CANCEL"));
+ elm_access_info_set(cancel_button, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_CONNECT_WIFI);
+ elm_object_part_content_set(popup, "button1", cancel_button);
+ evas_object_smart_callback_add(cancel_button, "clicked", _pts_cancel_cb, NULL);
wifi_list_itc.item_style = "1text";
wifi_list_itc.func.text_get = _pts_wifi_text_get;
wifi_list_itc.func.state_get = NULL;
wifi_list_itc.func.del = NULL;
- genlist = elm_genlist_add(popup);
+ Evas_Object *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);
+
+ int index = 0;
for (index = 0; index < 2; index++) {
elm_genlist_item_append(genlist, &wifi_list_itc, (void *) index, NULL,
- ELM_GENLIST_ITEM_NONE, _pts_wifi_list_sel, ugd);
+ ELM_GENLIST_ITEM_NONE, _pts_wifi_list_sel, NULL);
}
Evas_Object *box = elm_box_add(popup);
evas_object_size_hint_min_set(box, 400 * elm_config_scale_get(), elm_genlist_items_count(genlist) * 114 * elm_config_scale_get());
elm_object_content_set(popup, box);
- ugd->wifi_type_popup = popup;
-
evas_object_show(genlist);
evas_object_show(popup);
evas_object_show(parent);
PTS_TRACE_END;
- return genlist;
+ return popup;
}
-void pts_create_no_found_popup(Evas_Object *parent, pts_core_data_t *ugd, void *refresh_cb, void *cancel_cb)
+Evas_Object *pts_create_no_found_popup(Evas_Object *parent, void *refresh_cb, void *cancel_cb)
{
PTS_TRACE_BEGIN;
- Evas_Object *popup;
- Evas_Object *btn1;
- popup = elm_popup_add(parent);
+ Evas_Object *popup = elm_popup_add(parent);
//elm_object_style_set(popup,"menustyle");
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(popup, _("IDS_PRT_BODY_NO_PRINTERS_AVAILABLE"));
// evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb,
// NULL);
- btn1 = elm_button_add(popup);
- //elm_object_style_set(btn1,"popup_button/default");
- elm_object_text_set(btn1, _("IDS_COM_SK_REFRESH"));
- elm_object_part_content_set(popup, "button1", btn1);
- evas_object_smart_callback_add(btn1, "clicked", refresh_cb, ugd);
- btn1 = elm_button_add(popup);
- //elm_object_style_set(btn1,"popup_button/default");
- elm_object_text_set(btn1, _("IDS_COM_SK_CANCEL"));
- elm_object_part_content_set(popup, "button2", btn1);
- evas_object_smart_callback_add(btn1, "clicked", cancel_cb, ugd);
+
+ Evas_Object *refresh_button = elm_button_add(popup);
+ //elm_object_style_set(refresh_button,"popup_button/default");
+ elm_object_text_set(refresh_button, _("IDS_COM_SK_REFRESH"));
+ elm_object_part_content_set(popup, "button1", refresh_button);
+ evas_object_smart_callback_add(refresh_button, "clicked", refresh_cb, NULL);
+
+ Evas_Object *cancel_button = elm_button_add(popup);
+ //elm_object_style_set(cancel_button,"popup_button/default");
+ elm_object_text_set(cancel_button, _("IDS_COM_SK_CANCEL"));
+ elm_object_part_content_set(popup, "button2", cancel_button);
+ evas_object_smart_callback_add(cancel_button, "clicked", cancel_cb, NULL);
evas_object_show(popup);
evas_object_show(parent);
- ugd->no_found_popup = popup;
-
PTS_TRACE_END;
+ return popup;
}
/*
* create the content of the list view
*/
-Evas_Object *pts_create_content_printer_list(Evas_Object *parent, pts_ug_list_data *ld, int *print_counter)
+Evas_Object *pts_create_content_printer_list(Evas_Object *parent, pts_appdata_t *ad, int *print_counter)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ld == NULL, NULL, "ld is NULL");
+ PTS_RETV_IF(ad == NULL, NULL, "ad is NULL");
Evas_Object *genlist = NULL;
Elm_Object_Item *git;
list_itc.func.state_get = NULL;
list_itc.func.del = NULL;
+#if 0
refresh_itc.item_style = "1icon"; // Text Button
refresh_itc.func.text_get = NULL;
refresh_itc.func.content_get = __pts_refresh_icon_get;
refresh_itc.func.state_get = NULL;
refresh_itc.func.del = NULL;
+#endif
pt_printer_mgr_t *it = NULL;
Eina_List *cursor = NULL;
int radio_index = 1;
radio_print_list_data_t *core = NULL;
- ld->ugd->select_printer = NULL;
+ ad->list_info.select_printer = NULL;
- EINA_LIST_FOREACH(ld->printer_list, cursor, it) {
+ EINA_LIST_FOREACH(ad->list_info.printer_list, cursor, it) {
- if (ld->ugd->select_printer == NULL && it->is_ppd_exist == TRUE) {
+ if (ad->list_info.select_printer == NULL && it->is_ppd_exist == TRUE) {
// set the first printer as default one.
- ld->ugd->select_printer = it;
+ ad->list_info.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;
+ //core->ugd = ld->ugd;
git = elm_genlist_item_append(
genlist,
NULL,
ELM_GENLIST_ITEM_NONE,
__pts_search_print_list_sel,
- ld);
+ ad);
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) {
+#if 0
+// if (ld->ugd->print_search_mode != PTS_SEARCH_INITIAL) {
elm_genlist_item_append(
genlist,
&refresh_itc,
- (void *)ld->ugd,
+ (void *)ad,
NULL,
ELM_GENLIST_ITEM_NONE,
NULL,
NULL);
- }
+// }
+#endif
*print_counter = radio_index-1;
PTS_DEBUG("printer num = %d\n", *print_counter);
return genlist;
}
-Evas_Object *pts_create_printer_list_popup(Evas_Object *parent, pts_ug_list_data *ld)
+Evas_Object *pts_create_printer_list_popup(Evas_Object *parent, pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
Evas_Object *popup;
Evas_Object *genlist;
- Evas_Object *btn1;
- Evas_Object *btn2;
+ Evas_Object *ok_button;
+ Evas_Object *refresh_button;
+ Evas_Object *cancel_button;
int printer_num = 0;
// XXX
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);
-
- genlist = pts_create_content_printer_list(parent, ld, &printer_num);
+ ok_button = elm_button_add(popup);
+ elm_object_style_set(ok_button,"popup_button/default");
+ elm_object_text_set(ok_button, _("IDS_COM_SK_OK"));
+ elm_access_info_set(ok_button, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CONFIRM_SELECTED_PRINTER);
+ elm_object_part_content_set(popup, "button1", ok_button);
+ evas_object_smart_callback_add(ok_button, "clicked", _pts_printer_list_ok_cb, ad);
+
+ refresh_button = elm_button_add(popup);
+ elm_object_style_set(refresh_button,"popup_button/default");
+ elm_object_text_set(refresh_button, _("IDS_COM_SK_REFRESH"));
+ elm_access_info_set(ok_button, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_REFRESH_SEARCHING_PRINTERS);
+ elm_object_part_content_set(popup, "button2", refresh_button);
+ evas_object_smart_callback_add(refresh_button, "clicked", _pts_refresh_cb, ad);
+
+ cancel_button = elm_button_add(popup);
+ elm_object_style_set(cancel_button,"popup_button/default");
+ elm_object_text_set(cancel_button, _("IDS_COM_SK_CANCEL"));
+ elm_access_info_set(cancel_button, ELM_ACCESS_CONTEXT_INFO, IDS_SCRREAD_CANCEL_PRINTING);
+ elm_object_part_content_set(popup, "button3", cancel_button);
+ evas_object_smart_callback_add(cancel_button, "clicked", _pts_printer_list_cancel_cb, popup);
+
+ genlist = pts_create_content_printer_list(parent, ad, &printer_num);
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);
elm_box_pack_end(box, genlist);
int rotate_angle = 0;
- rotate_angle = _pts_get_rotate_angle(APPCORE_RM_UNKNOWN);
- elm_win_rotation_with_resize_set(parent, rotate_angle);
+ if (ad->win) {
+ rotate_angle = elm_win_rotation_get(ad->win);
+ PTS_DEBUG("rotate_angle: %d", rotate_angle);
+ } else {
+ PTS_DEBUG("No ld->ugd->root_win");
+ }
- 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();
+ ad->list_info.printer_list_popup_portrait_height = MIN(PRINTER_LIST_POPUP_H, elm_genlist_items_count(genlist) * 143) * elm_config_scale_get();
+ ad->list_info.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);
+ ad->list_info.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);
+ ad->list_info.printer_list_popup_landscape_height);
elm_object_content_set(popup, box);
- ld->ugd->printer_list_popup_box = box;
- ld->ugd->printer_list_popup = popup;
+ ad->list_info.printer_list_popup_box = box;
+ ad->list_info.printer_list_popup = popup;
evas_object_show(genlist);
+ evas_object_show(box);
evas_object_show(popup);
evas_object_show(parent);
return genlist;
}
-#if 0
-Evas_Object *pts_create_printer_list_view(Evas_Object *parent, pts_ug_list_data *ld)
-{
- pts_core_data_t *ugd = ld->ugd;
- Evas_Object *back_btn = NULL;
- Evas_Object *layout = NULL;
- Evas_Object *genlist = NULL;
- Elm_Object_Item *navi_item = NULL;
- int printer_num = 0;
-
- layout = pts_utils_create_layout(ugd->navi);
- evas_object_show(layout);
- Evas_Object *conform = elm_object_part_content_get(layout, "elm.swallow.content");
-
- genlist = pts_create_content_printer_list(conform, ld, &printer_num);
-
- elm_object_content_set(conform, genlist);
-
- back_btn = elm_button_add(ugd->navi);
- elm_object_style_set(back_btn, "naviframe/end_btn/default");
-
- evas_object_smart_callback_add(back_btn, "clicked", __pts_search_btn_back_cb, ugd);
- navi_item = elm_naviframe_item_push(ugd->navi, _("IDS_PRT_BODY_SELECT_PRINTER"), back_btn, NULL, layout, NULL);
-
- return layout;
-
-}
-#endif
-
-void pts_search_printer_select(pts_core_data_t *ugd, pts_ug_list_data *ld)
+void pts_search_printer_select(pts_appdata_t *ad)
{
// if (ugd->print_search_mode == PTS_SEARCH_INITIAL)
- pts_create_printer_list_popup(ugd->print_search_popup_parent, ld);
+ pts_create_printer_list_popup(ad->search_info.print_search_popup_parent, ad);
// else
// pts_create_printer_list_view(ugd->print_search_popup_parent, ld);
PTS_TRACE_BEGIN;
PTS_RET_IF(cb == NULL, "response data is NULL");
- pts_ug_list_data *ld = cb->userdata;
- PTS_RET_IF(ld == NULL, "ld is NULL");
-
- pts_core_data_t *ugd = ld->ugd;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = cb->userdata;
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- ld->printer_list = cb->printerlist;
- ld->ugd->is_process = 0; /*process is complete*/
+ ad->list_info.printer_list = cb->printerlist;
+ ad->search_info.is_process = 0; /*process is complete*/
/* destroy popup progress bar */
- if (ld->popup != NULL) {
- evas_object_del(ld->popup);
- ld->popup = NULL;
- }
+ PTS_IF_DEL_OBJ(ad->search_info.popup);
/*
* Not found any printer
*/
- if (NULL == ld->printer_list) {
+ if (NULL == ad->list_info.printer_list) {
/*
* destroy popup progress bar
*/
-
PTS_DEBUG("search printer failed");
- pts_create_no_found_popup(ugd->print_search_popup_parent, ld->ugd, _pts_refresh_cb, _pts_cancel_cb);
-
- PTS_IF_FREE_MEM(ld->ugd->active_printer);
- PTS_IF_FREE_MEM(ld);
-
+ PTS_IF_FREE_MEM(ad->list_info.active_printer);
+ ad->list_info.no_found_popup = pts_create_no_found_popup(ad->search_info.print_search_popup_parent,
+ _pts_refresh_cb,
+ _pts_cancel_cb);
return;
}
int pt_count = 0;
/* get printer list count */
- pt_count = eina_list_count(ld->printer_list);
+ pt_count = eina_list_count(ad->list_info.printer_list);
PTS_DEBUG("Printer count is %d", pt_count);
if (pt_count > 0) {
- pts_search_printer_select(ugd, ld);
+ pts_search_printer_select(ad);
} else {
// No Printer found.
// Control can't be reach here...
* @return void
* @param[in] ld the pointer to the ug list structure
*/
-void pts_create_print_search_popup(Evas_Object *parent, pts_core_data_t *ugd)
+Evas_Object *pts_create_print_search_popup(Evas_Object *parent)
{
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));
- PTS_RET_IF(ld == NULL, "ld is NULL");
- memset(ld, 0, sizeof(pts_ug_list_data));
- ld->ugd = ugd;
-
int ret = 0;
Evas_Object *layout = NULL;
Evas_Object *progressbar = NULL;
Evas_Object *btn = NULL;
+ Evas_Object *popup = NULL;
- ld->popup = elm_popup_add(parent);
- layout = pts_create_base_layout(ld->popup, "popup_search");
- ld->search_err_timer = NULL;
- ld->ugd->is_process = 1; /* in process */
-
- progressbar = elm_progressbar_add(ld->popup);
+ popup = elm_popup_add(parent);
+ layout = pts_create_base_layout(popup, "popup_search");
+ progressbar = elm_progressbar_add(popup);
elm_object_style_set(progressbar, "list_process");
elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
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);
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_content_set(popup, layout);
+ btn = elm_button_add(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);
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", _pts_cancel_cb, NULL);
evas_object_show(layout);
- evas_object_show(ld->popup);
- evas_object_show(ld->ugd->root_win);
+ evas_object_show(popup);
+ evas_object_show(parent);
- ret = pt_get_printers(__pts_get_printer_cb, ld);
- if (PT_ERR_NONE != ret) {
- ld->search_err_timer = ecore_timer_add(2.0, (Ecore_Task_Cb)__pts_list_view_popup_error, (void *)ld);
+ PTS_TRACE_END;
+ return popup;
+}
+
+static gboolean __is_wifi_direct_connected(int net_info)
+{
+ /** Connected with peer as GC */
+ if ((net_info&PT_CONNECTION_WIFI_DIRECT)>0) {
+ return TRUE;
}
+ return FALSE;
+}
- PTS_TRACE_END;
+static gboolean __is_wifi_connected(int net_info)
+{
+ if ((net_info&PT_CONNECTION_WIFI)>0) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean __is_usb_host_connected(int net_info)
+{
+ if ((net_info&PT_CONNECTION_USB)>0) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean __is_connected(int net_info)
+{
+ if (net_info == 0) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static gboolean __is_valid_ip_address(const char *ip_address)
+{
+ PTS_RETV_IF(ip_address == NULL, FALSE, "ip_address is NULL");
+ return FALSE;
}
/*
* start to search printer
*/
-//void pts_main_view_search_printer(pts_ug_main_data *ugd, pts_print_search_mode_t search_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_search_printer(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
-
- ugd->print_search_mode = search_mode;
- ugd->selection_done_cb = cb;
- ugd->print_search_popup_parent = parent;
- ugd->printer_search_user_data = userdata;
-
+ PTS_RET_IF(ad == NULL, "ad is NULL");
int ret = 0;
int net_type = 0;
ret = pt_get_connection_status(&net_type);
- PTS_DEBUG("RET is %d", ret);
+ PTS_RET_IF(ret != PT_ERR_NONE, "Failed to get connection status(%d)", ret);
- if (ret == PT_ERR_NONE) {
- if (net_type ==0) {
- pts_search_create_wifi_type_selector_popup(ugd->print_search_popup_parent, ugd);
- return;
+ if (__is_connected(net_type)) {
+ if (__is_wifi_direct_connected(net_type)) {
+ ad->search_info.popup = pts_create_print_search_popup(ad->search_info.print_search_popup_parent);
+ ad->search_info.is_process = 1; /* in process */
+ PTS_IF_DEL_TIMER(ad->search_info.search_err_timer);
+
+ ret = pt_get_printers(__pts_get_printer_cb, ad);
+ if (PT_ERR_NONE != ret) {
+ ad->search_info.search_err_timer = ecore_timer_add(1.0, (Ecore_Task_Cb)__pts_list_view_popup_error, (void *)ad);
+ }
+ } else if (__is_wifi_connected(net_type) || __is_usb_host_connected(net_type)) {
+ ad->search_info.popup = pts_create_print_search_popup(ad->search_info.print_search_popup_parent);
+ ad->search_info.is_process = 1; /* in process */
+ PTS_IF_DEL_TIMER(ad->search_info.search_err_timer);
+ ret = pt_get_printers(__pts_get_printer_cb, ad);
+ if (PT_ERR_NONE != ret) {
+ ad->search_info.search_err_timer = ecore_timer_add(1.0, (Ecore_Task_Cb)__pts_list_view_popup_error, (void *)ad);
+ }
} else {
- pts_create_print_search_popup(ugd->print_search_popup_parent, ugd);
+ PTS_DEBUG("Undefined connection status");
+ return;
}
} else {
- //TODO: display error popup
- //Vconf access error.
+ ad->select_info.wifi_type_popup = pts_create_wifi_type_selector_popup(ad->search_info.print_search_popup_parent);
+ return;
}
-
- //pts_main_view_rotate_image(ugd, app_get_device_orientation());
PTS_TRACE_END;
}
static Elm_Genlist_Item_Class itc_paper_type;
static Elm_Genlist_Item_Class itc_grayscale;
static Elm_Genlist_Item_Class itc_page_range;
+static Elm_Genlist_Item_Class itc_duplex;
static Evas_Coord touch_x;
static Evas_Coord touch_y;
static Evas_Object *copies_popup = NULL;
-static void __pts_setting_view_leave_view(pts_core_data_t *ugd)
+static void __pts_setting_view_leave_view(pts_appdata_t *ad)
{
- if (ugd->radio_group_paper_size != NULL) {
- evas_object_del(ugd->radio_group_paper_size);
- ugd->radio_group_paper_size = NULL;
- }
- if (ugd->radio_group_paper_quality != NULL) {
- evas_object_del(ugd->radio_group_paper_quality);
- ugd->radio_group_paper_quality = NULL;
- }
- if (ugd->radio_group_paper_type != NULL) {
- evas_object_del(ugd->radio_group_paper_type);
- ugd->radio_group_paper_type = NULL;
- }
- if (ugd->radio_group_page_range != NULL) {
- evas_object_del(ugd->radio_group_page_range);
- ugd->radio_group_page_range = NULL;
- }
- if (ugd->radio_group_grayscale != NULL) {
- evas_object_del(ugd->radio_group_grayscale);
- ugd->radio_group_grayscale = NULL;
- }
-
- elm_naviframe_item_pop_to(ugd->navi_it);
+ PTS_IF_DEL_OBJ(ad->setting_info.radio_group_paper_size);
+ PTS_IF_DEL_OBJ(ad->setting_info.radio_group_paper_quality);
+ PTS_IF_DEL_OBJ(ad->setting_info.radio_group_paper_type);
+ PTS_IF_DEL_OBJ(ad->setting_info.radio_group_page_range);
+ PTS_IF_DEL_OBJ(ad->setting_info.radio_group_grayscale);
+ PTS_IF_DEL_OBJ(ad->setting_info.radio_group_duplex);
+ elm_naviframe_item_pop_to(ad->main_info.navi_it);
}
/*
{
PTS_TRACE_BEGIN;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ PTS_RET_IF(ad == NULL, "ad is NULL");
- __pts_setting_view_leave_view(ugd);
+ __pts_setting_view_leave_view(ad);
- if (ugd->active_printer == NULL) {
+ if (ad->list_info.active_printer == NULL) {
PTS_DEBUG("No active printer. So just exit mobileprint");
pt_deinit();
elm_exit();
return;
}
- pts_main_view_update_printer_label(ugd);
- pts_main_view_rotate_image(ugd, app_get_device_orientation());
+ pts_main_view_update_printer_label(ad);
+ pts_main_view_rotate_image(ad, app_get_device_orientation());
PTS_TRACE_END;
}
static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info)
{
- if (copies_popup!=NULL) {
- evas_object_del(copies_popup);
- }
- copies_popup = NULL;
+ PTS_IF_DEL_OBJ(copies_popup);
}
static void _copies_picker_cb(void *data, Evas_Object *obj, void *event_info)
{
PTS_TRACE_BEGIN;
int copies = 1;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
Elm_Object_Item *item = event_info;
const char *label = elm_object_item_text_get(item);
PTS_RET_IF(label == NULL, "label is NULL");
copies = atoi(label);
- if (copies == ugd->active_printer->copies) {
+ if (copies == ad->list_info.active_printer->copies) {
PTS_DEBUG("Not changed\n");
PTS_TRACE_END;
return;
} else {
PTS_DEBUG("text(%s) is clicked!\n", label);
- ugd->active_printer->copies = copies;
- elm_genlist_item_selected_set(ugd->item_paper_copies, EINA_FALSE);
- elm_genlist_item_update(ugd->item_paper_copies);
+ ad->list_info.active_printer->copies = copies;
+ elm_genlist_item_selected_set(ad->setting_info.item_paper_copies, EINA_FALSE);
+ elm_genlist_item_update(ad->setting_info.item_paper_copies);
- if (copies_popup) {
- evas_object_del(copies_popup);
- copies_popup = NULL;
- }
+ PTS_IF_DEL_OBJ(copies_popup);
}
PTS_TRACE_END;
}
char buffer[4];
char current_selection[4];
- pts_core_data_t *ugd = (pts_core_data_t *)data;
- elm_genlist_item_selected_set(ugd->item_paper_copies, EINA_TRUE);
+ pts_appdata_t *ad = (pts_appdata_t *)data;
+ elm_genlist_item_selected_set(ad->setting_info.item_paper_copies, EINA_TRUE);
Elm_Object_Item *item = (Elm_Object_Item *)event_info;
if (event_info) {
elm_genlist_item_selected_set(event_info, EINA_FALSE);
}
- if (copies_popup) {
- evas_object_del(copies_popup);
- copies_popup = NULL;
- }
+ PTS_IF_DEL_OBJ(copies_popup);
- evas_object_geometry_get(ugd->root_win, NULL, NULL, &w, NULL);
- copies_popup = elm_ctxpopup_add(ugd->navi);
+ evas_object_geometry_get(ad->main_info.root_win, NULL, NULL, &w, NULL);
+ copies_popup = elm_ctxpopup_add(ad->main_info.navi);
//elm_object_style_set(copies_popup, "timepicker");
elm_object_style_set(copies_popup, "datetime/default");
evas_object_size_hint_min_set(copies_popup, w, -1);
evas_object_size_hint_weight_set(copies_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_smart_callback_add(copies_popup, "dismissed", _dismissed_cb, copies_popup);
- evas_object_event_callback_add(copies_popup, EVAS_CALLBACK_SHOW, __on_show, ugd);
- evas_object_event_callback_add(copies_popup, EVAS_CALLBACK_HIDE, __on_hide, ugd);
+ evas_object_event_callback_add(copies_popup, EVAS_CALLBACK_SHOW, __on_show, ad);
+ evas_object_event_callback_add(copies_popup, EVAS_CALLBACK_HIDE, __on_hide, ad);
- diskselector = elm_diskselector_add(ugd->navi);
+ diskselector = elm_diskselector_add(ad->main_info.navi);
elm_diskselector_display_item_num_set(diskselector, 8);
//elm_object_style_set(diskselector, "timepicker");
elm_object_style_set(diskselector, "datetime/default");
- snprintf(current_selection, 4, "%d", ugd->active_printer->copies);
+ snprintf(current_selection, 4, "%d", ad->list_info.active_printer->copies);
for (idx = 1; idx < COPIES_MAX+1; idx++) {
snprintf(buffer, 4, "%d", idx);
if (strcmp(current_selection, buffer) == 0) {
- item = elm_diskselector_item_append(diskselector, buffer, NULL, _copies_picker_cb, ugd);
+ item = elm_diskselector_item_append(diskselector, buffer, NULL, _copies_picker_cb, ad);
} else {
- elm_diskselector_item_append(diskselector, buffer, NULL, _copies_picker_cb, ugd);
+ elm_diskselector_item_append(diskselector, buffer, NULL, _copies_picker_cb, ad);
}
}
ELM_CTXPOPUP_DIRECTION_LEFT,
ELM_CTXPOPUP_DIRECTION_RIGHT);
- _move_copies_popup(copies_popup, ugd->root_win);
+ _move_copies_popup(copies_popup, ad->main_info.root_win);
evas_object_show(copies_popup);
PTS_TRACE_END;
{
PTS_TRACE_BEGIN;
struct appdata *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
Elm_Object_Item *item = (Elm_Object_Item *)userdata;
elm_genlist_item_update(item);
- if (ugd->active_printer) {
- pts_create_setting_view(ugd);
+ if (ad->list_info.active_printer) {
+ pts_create_setting_view(ad);
}
PTS_TRACE_END;
{
PTS_TRACE_BEGIN;
-// Elm_Object_Item *item = (Elm_Object_Item *)event_info;
-// Eina_Bool expand_state = EINA_FALSE;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
if (event_info) {
elm_genlist_item_selected_set(event_info, EINA_FALSE);
}
// Launch Print searching module
- pts_search_printer(ugd, ugd->navi, PTS_SEARCH_IN_SETTING, pts_setting_view_printer_select_done_cb, (void *)event_info);
+ ad->search_info.print_search_mode = PTS_SEARCH_IN_SETTING;
+ ad->search_info.selection_done_cb = pts_setting_view_printer_select_done_cb;
+ ad->search_info.print_search_popup_parent = ad->main_info.navi;
+ ad->search_info.printer_search_user_data = (void *)event_info;
+ pts_search_printer(ad);
PTS_TRACE_END;
}
static char *__pts_setting_view_printer_label_get(void *data, Evas_Object *obj, const char *part)
{
PTS_TRACE_BEGIN;
- //pt_printer_mgr_t *printer = (pt_printer_mgr_t *) data;
struct appdata *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
if (strcmp(part, "elm.text.1") == 0) {
//if (printer != NULL) {
//return strdup(printer->name);
//}
} else if (strcmp(part, "elm.text.2") == 0) {
//if (printer != NULL) {
- if (ugd->active_printer != NULL) {
- char *printer_label = strdup(ugd->active_printer->name);
+ if (ad->list_info.active_printer != NULL) {
+ char *printer_label = strdup(ad->list_info.active_printer->name);
pts_unstandardization(printer_label);
//return strdup(printer->address);
PTS_TRACE_END;
{
PTS_TRACE_BEGIN;
struct appdata *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
- pt_printer_mgr_t *active_printer = ugd->active_printer;
+ pt_printer_mgr_t *active_printer = ad->list_info.active_printer;
pt_print_option_e option_type = (pt_print_option_e)data;
char buf[MAX_TMP_BUF];
return strdup(_("IDS_PRT_BODY_PRINTSETTINGS_PRINT_QUALITY"));
case PT_OPTION_ID_PAPER:
return strdup(_("IDS_IMGE_BUTTON_PAPER_M_STICKER"));
+ case PT_OPTION_ID_DUPLEX:
+ return strdup(IDS_PRINT_SETTINGS_DUPLEX);
default:
return strdup(PTS_17);
}
PTS_DEBUG("Selected paper type [%d, %s]", p_type, buf);
}
break;
-
+ case PT_OPTION_ID_DUPLEX: {
+ int p_dup = pt_get_selected(PT_OPTION_ID_DUPLEX);
+ if (PT_DUPLEX_OFF == p_dup) {
+ strcpy(buf, IDS_PRINT_SETTINGS_DUPLEX_OFF);
+ } else if (PT_DUPLEX_NO_TUMBLE == p_dup || PT_DUPLEX_TUMBLE == p_dup) {
+ strcpy(buf, IDS_PRINT_SETTINGS_DUPLEX_ON);
+ }
+ PTS_DEBUG("Selected duplex mode [%d, %s]", p_dup, buf);
+ }
+ break;
default: {
return strdup(PTS_17);
}
{
PTS_TRACE_BEGIN;
pts_appdata_t *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
Evas_Object *radio_button = NULL;
Item_data *core = (Item_data *)data;
int selected = 0;
selected = pt_get_selected(PT_OPTION_ID_PAPERSIZE);
break;
case PT_OPTION_ID_RANGE:
- selected = ugd->active_printer->range;
+ selected = ad->list_info.active_printer->range;
break;
case PT_OPTION_ID_QUALITY:
selected = pt_get_selected(PT_OPTION_ID_QUALITY);
case PT_OPTION_ID_GRAYSCALE:
selected = pt_get_selected(PT_OPTION_ID_GRAYSCALE);
break;
+ case PT_OPTION_ID_DUPLEX:
+ selected = pt_get_selected(PT_OPTION_ID_DUPLEX);
+ break;
/* case PT_OPTION_ID_COPIES: */
default:
break;
PTS_TRACE_BEGIN;
PTS_RET_IF(data == NULL, "data is NULL");
Item_data *core = (Item_data *)data;
- pts_core_data_t *ugd = core->ugd;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ pts_appdata_t *ad = pts_get_appdata();
+ PTS_RET_IF(ad == NULL, "ad is NULL");
switch (core->option) {
case PT_OPTION_ID_QUALITY:
- ugd->quality[core->sub_item] = NULL;
+ ad->setting_info.quality[core->sub_item] = NULL;
break;
case PT_OPTION_ID_PAPER:
- ugd->paper_type[core->sub_item] = NULL;
+ ad->setting_info.paper_type[core->sub_item] = NULL;
break;
case PT_OPTION_ID_GRAYSCALE:
- ugd->color[core->sub_item] = NULL;
+ ad->setting_info.color[core->sub_item] = NULL;
break;
case PT_OPTION_ID_PAPERSIZE:
- ugd->paper_size[core->sub_item] = NULL;
+ ad->setting_info.paper_size[core->sub_item] = NULL;
+ break;
+ case PT_OPTION_ID_DUPLEX:
+ ad->setting_info.duplex[core->sub_item] = NULL;
break;
default:
break;
return ret;
}
+/*
+* get the duplex value of the key
+*/
+static char *__pts_setting_view_duplex_key_label_get(void *data, Evas_Object *obj, const char *part)
+{
+ PTS_TRACE_BEGIN;
+ Item_data *core = (Item_data *)data;
+ pt_duplex_e p_duplex = (pt_duplex_e)core->sub_item;
+ char *ret = NULL;
-static void __pts_setting_view_enable_disable(pts_core_data_t *ugd)
+ if (strcmp(part, "elm.text") == 0) {
+ switch (p_duplex) {
+ case PT_DUPLEX_OFF:
+ ret = strdup(IDS_PRINT_SETTINGS_DUPLEX_OFF);
+ break;
+ case PT_DUPLEX_NO_TUMBLE:
+ case PT_DUPLEX_TUMBLE:
+ ret = strdup(IDS_PRINT_SETTINGS_DUPLEX_ON);
+ break;
+ default:
+ ret = NULL;
+ }
+ }
+ PTS_TRACE_END;
+ return ret;
+}
+
+static void __pts_setting_view_enable_disable(pts_appdata_t *ad)
{
int i;
for (i=0; i<PT_QUALITY_ANY; i++) {
- if (ugd->quality[i]) {
+ if (ad->setting_info.quality[i]) {
if (pt_is_enabled(PT_OPTION_ID_QUALITY, i)) {
- elm_object_item_disabled_set(ugd->quality[i], EINA_FALSE);
+ elm_object_item_disabled_set(ad->setting_info.quality[i], EINA_FALSE);
} else {
- elm_object_item_disabled_set(ugd->quality[i], EINA_TRUE);
+ elm_object_item_disabled_set(ad->setting_info.quality[i], EINA_TRUE);
}
}
}
for (i=0; i<PT_PAPER_ANY; i++) {
- if (ugd->paper_type[i]) {
+ if (ad->setting_info.paper_type[i]) {
if (pt_is_enabled(PT_OPTION_ID_PAPER, i)) {
- elm_object_item_disabled_set(ugd->paper_type[i], EINA_FALSE);
+ elm_object_item_disabled_set(ad->setting_info.paper_type[i], EINA_FALSE);
} else {
- elm_object_item_disabled_set(ugd->paper_type[i], EINA_TRUE);
+ elm_object_item_disabled_set(ad->setting_info.paper_type[i], EINA_TRUE);
}
}
}
for (i=0; i<PT_GRAYSCALE_ANY; i++) {
- if (ugd->color[i]) {
+ if (ad->setting_info.color[i]) {
if (pt_is_enabled(PT_OPTION_ID_GRAYSCALE, i)) {
- elm_object_item_disabled_set(ugd->color[i], EINA_FALSE);
+ elm_object_item_disabled_set(ad->setting_info.color[i], EINA_FALSE);
} else {
- elm_object_item_disabled_set(ugd->color[i], EINA_TRUE);
+ elm_object_item_disabled_set(ad->setting_info.color[i], EINA_TRUE);
+ }
+ }
+ }
+ for (i=0; i<PT_DUPLEX_ANY-1; i++) {
+ if (ad->setting_info.duplex[i]) {
+ if (pt_is_enabled(PT_OPTION_ID_DUPLEX, i)) {
+ elm_object_item_disabled_set(ad->setting_info.duplex[i], EINA_FALSE);
+ } else {
+ elm_object_item_disabled_set(ad->setting_info.duplex[i], EINA_TRUE);
}
}
}
for (i=0; i<pt_get_print_option_papersize_num(); i++) {
- if (ugd->paper_size[i]) {
+ if (ad->setting_info.paper_size[i]) {
if (pt_is_enabled(PT_OPTION_ID_PAPERSIZE, i)) {
- elm_object_item_disabled_set(ugd->paper_size[i], EINA_FALSE);
+ elm_object_item_disabled_set(ad->setting_info.paper_size[i], EINA_FALSE);
} else {
- elm_object_item_disabled_set(ugd->paper_size[i], EINA_TRUE);
+ elm_object_item_disabled_set(ad->setting_info.paper_size[i], EINA_TRUE);
}
}
}
Item_data *core = (Item_data *) user_data;
struct appdata *ad = pts_get_appdata();
- pts_core_data_t *ugd = ad->ugd;
Elm_Object_Item *item = (Elm_Object_Item *)event_info;
Elm_Object_Item *parent_item = NULL;
switch (core->option) {
case PT_OPTION_ID_PAPERSIZE:
- ugd->active_printer->size = core->sub_item;
- parent_item = ugd->item_paper_size;
+ ad->list_info.active_printer->size = core->sub_item;
+ parent_item = ad->setting_info.item_paper_size;
pt_set_choice(PT_OPTION_ID_PAPERSIZE, core->sub_item);
- PTS_DEBUG("Paper size select: %d", ugd->active_printer->size);
+ PTS_DEBUG("Paper size select: %d", ad->list_info.active_printer->size);
break;
case PT_OPTION_ID_COPIES:
- ugd->active_printer->copies = core->sub_item;
- parent_item = ugd->item_paper_copies;
- PTS_DEBUG("Print copy select: %d", ugd->active_printer->copies);
+ ad->list_info.active_printer->copies = core->sub_item;
+ parent_item = ad->setting_info.item_paper_copies;
+ PTS_DEBUG("Print copy select: %d", ad->list_info.active_printer->copies);
break;
case PT_OPTION_ID_RANGE:
- ugd->active_printer->range = core->sub_item;
- parent_item = ugd->item_page_range;
- PTS_DEBUG("Print range select: %d", ugd->active_printer->range);
+ ad->list_info.active_printer->range = core->sub_item;
+ parent_item = ad->setting_info.item_page_range;
+ PTS_DEBUG("Print range select: %d", ad->list_info.active_printer->range);
break;
case PT_OPTION_ID_QUALITY:
pt_set_choice(PT_OPTION_ID_QUALITY, core->sub_item);
- parent_item = ugd->item_paper_quality;
+ parent_item = ad->setting_info.item_paper_quality;
PTS_DEBUG("Print quality select: %d", pt_get_selected(PT_OPTION_ID_QUALITY));
break;
case PT_OPTION_ID_PAPER:
pt_set_choice(PT_OPTION_ID_PAPER, core->sub_item);
- parent_item = ugd->item_paper_type;
+ parent_item = ad->setting_info.item_paper_type;
PTS_DEBUG("Paper type select: %d", pt_get_selected(PT_OPTION_ID_PAPER));
break;
case PT_OPTION_ID_GRAYSCALE:
pt_set_choice(PT_OPTION_ID_GRAYSCALE, core->sub_item);
- parent_item = ugd->item_grayscale;
+ parent_item = ad->setting_info.item_grayscale;
PTS_DEBUG("Print color select: %d", pt_get_selected(PT_OPTION_ID_GRAYSCALE));
break;
+ case PT_OPTION_ID_DUPLEX:
+ pt_set_choice(PT_OPTION_ID_DUPLEX, core->sub_item);
+ parent_item = ad->setting_info.item_duplex;
+ PTS_DEBUG("Duplex select: %d", pt_get_selected(PT_OPTION_ID_DUPLEX));
+ break;
default:
PTS_DEBUG("Unknown option: %d", core->option);
parent_item = NULL;
}
elm_radio_value_set(core->radio_group, core->radio_index);
- __pts_setting_view_enable_disable(ugd);
+ __pts_setting_view_enable_disable(ad);
if(parent_item) {
elm_genlist_item_update(parent_item);
}
int sub_item,
int *radio_btn_index,
Evas_Object *radio_group,
- pts_core_data_t *ugd)
+ pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
PTS_RETV_IF(genlist == NULL, NULL, "genlist is NULL");
itc_page_range.func.state_get = NULL; //__pts_setting_view_gl_state_get;
itc_page_range.func.del = __pts_setting_view_gl_state_item_delete;
itc = &itc_page_range;
- }
- //else if (MOBILEPRINT_OPTION_ID_COPIES == option) {
- else {
+ } else if (PT_OPTION_ID_DUPLEX == option) {
+ itc_duplex.item_style = "dialogue/1text.1icon/expandable2";
+ itc_duplex.func.text_get = __pts_setting_view_duplex_key_label_get;
+ itc_duplex.func.content_get = __pts_setting_view_gl_content_get;
+ itc_duplex.func.state_get = NULL;
+ itc_duplex.func.del = __pts_setting_view_gl_state_item_delete;
+ itc = &itc_duplex;
+ } else {
PTS_DEBUG("Unknown option: %d", option);
PTS_TRACE_END;
return NULL;
evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
Item_data *core = calloc(1, sizeof(Item_data));
- core->ugd = ugd;
core->option = option;
core->sub_item = sub_item;
core->radio_index = *radio_btn_index;
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;
+ pts_appdata_t *ad = (pts_appdata_t *)data;
int radio_index = 0;
int i = 0;
elm_genlist_item_selected_set(item, EINA_FALSE);
- if (ugd->radio_group_paper_size == NULL) {
- ugd->radio_group_paper_size = __pts_create_radio_group(genlist);
+ if (ad->setting_info.radio_group_paper_size == NULL) {
+ ad->setting_info.radio_group_paper_size = __pts_create_radio_group(genlist);
+ }
+ if (ad->setting_info.radio_group_paper_quality == NULL) {
+ ad->setting_info.radio_group_paper_quality = __pts_create_radio_group(genlist);
}
- if (ugd->radio_group_paper_quality == NULL) {
- ugd->radio_group_paper_quality = __pts_create_radio_group(genlist);
+ if (ad->setting_info.radio_group_paper_type == NULL) {
+ ad->setting_info.radio_group_paper_type = __pts_create_radio_group(genlist);
}
- if (ugd->radio_group_paper_type == NULL) {
- ugd->radio_group_paper_type = __pts_create_radio_group(genlist);
+ if (ad->setting_info.radio_group_page_range == NULL) {
+ ad->setting_info.radio_group_page_range = __pts_create_radio_group(genlist);
}
- if (ugd->radio_group_page_range == NULL) {
- ugd->radio_group_page_range = __pts_create_radio_group(genlist);
+ if (ad->setting_info.radio_group_grayscale == NULL) {
+ ad->setting_info.radio_group_grayscale = __pts_create_radio_group(genlist);
}
- if (ugd->radio_group_grayscale == NULL) {
- ugd->radio_group_grayscale = __pts_create_radio_group(genlist);
+ if (ad->setting_info.radio_group_duplex == NULL) {
+ ad->setting_info.radio_group_duplex = __pts_create_radio_group(genlist);
}
- if (item == ugd->item_paper_size) {
+ if (item == ad->setting_info.item_paper_size) {
radio_index = 0;
Item_data *i_d;
for (i = 0; i < pt_get_print_option_papersize_num(); i++) {
- i_d = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPERSIZE, i, &radio_index, ugd->radio_group_paper_size, ugd);
+ i_d = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPERSIZE, i, &radio_index, ad->setting_info.radio_group_paper_size, ad);
if (i_d != NULL) {
- ugd->paper_size[i] = i_d->item;
+ ad->setting_info.paper_size[i] = i_d->item;
}
}
- } else if (item == ugd->item_paper_quality) {
+ } else if (item == ad->setting_info.item_paper_quality) {
radio_index = 0;
- ugd->quality[PT_QUALITY_DRAFT] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_DRAFT, &radio_index, ugd->radio_group_paper_quality, ugd)->item;
- ugd->quality[PT_QUALITY_STANDARD] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_STANDARD, &radio_index, ugd->radio_group_paper_quality, ugd)->item;
- ugd->quality[PT_QUALITY_HIGH] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_HIGH, &radio_index, ugd->radio_group_paper_quality, ugd)->item;
- } else if (item == ugd->item_paper_type) {
+ ad->setting_info.quality[PT_QUALITY_DRAFT] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_DRAFT, &radio_index, ad->setting_info.radio_group_paper_quality, ad)->item;
+ ad->setting_info.quality[PT_QUALITY_STANDARD] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_STANDARD, &radio_index, ad->setting_info.radio_group_paper_quality, ad)->item;
+ ad->setting_info.quality[PT_QUALITY_HIGH] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_QUALITY, PT_QUALITY_HIGH, &radio_index, ad->setting_info.radio_group_paper_quality, ad)->item;
+ } else if (item == ad->setting_info.item_paper_type) {
radio_index = 0;
- ugd->paper_type[PT_PAPER_NORMAL] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_NORMAL, &radio_index, ugd->radio_group_paper_type, ugd)->item;
- ugd->paper_type[PT_PAPER_GLOSSY] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_GLOSSY, &radio_index, ugd->radio_group_paper_type, ugd)->item;
- ugd->paper_type[PT_PAPER_PHOTO] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_PHOTO, &radio_index, ugd->radio_group_paper_type, ugd)->item;
- } else if (item == ugd->item_page_range) {
+ ad->setting_info.paper_type[PT_PAPER_NORMAL] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_NORMAL, &radio_index, ad->setting_info.radio_group_paper_type, ad)->item;
+ ad->setting_info.paper_type[PT_PAPER_GLOSSY] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_GLOSSY, &radio_index, ad->setting_info.radio_group_paper_type, ad)->item;
+ ad->setting_info.paper_type[PT_PAPER_PHOTO] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_PAPER, PT_PAPER_PHOTO, &radio_index, ad->setting_info.radio_group_paper_type, ad)->item;
+ } else if (item == ad->setting_info.item_page_range) {
radio_index = 0;
- __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_RANGE, PT_RANGE_ALL, &radio_index, ugd->radio_group_page_range, ugd);
- __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_RANGE, PT_RANGE_CURRENT, &radio_index, ugd->radio_group_page_range, ugd);
- } else if (item == ugd->item_grayscale) {
+ __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_RANGE, PT_RANGE_ALL, &radio_index, ad->setting_info.radio_group_page_range, ad);
+ __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_RANGE, PT_RANGE_CURRENT, &radio_index, ad->setting_info.radio_group_page_range, ad);
+ } else if (item == ad->setting_info.item_grayscale) {
radio_index = 0;
- ugd->color[PT_GRAYSCALE_GRAYSCALE] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_GRAYSCALE, PT_GRAYSCALE_GRAYSCALE, &radio_index, ugd->radio_group_grayscale, ugd)->item;
- ugd->color[PT_GRAYSCALE_COLOUR] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_GRAYSCALE, PT_GRAYSCALE_COLOUR, &radio_index, ugd->radio_group_grayscale, ugd)->item;
- } else {
+ ad->setting_info.color[PT_GRAYSCALE_GRAYSCALE] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_GRAYSCALE, PT_GRAYSCALE_GRAYSCALE, &radio_index, ad->setting_info.radio_group_grayscale, ad)->item;
+ ad->setting_info.color[PT_GRAYSCALE_COLOUR] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_GRAYSCALE, PT_GRAYSCALE_COLOUR, &radio_index, ad->setting_info.radio_group_grayscale, ad)->item;
+ } else if (item == ad->setting_info.item_duplex) {
+ radio_index = 0;
+ ad->setting_info.duplex[PT_DUPLEX_OFF] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_DUPLEX, PT_DUPLEX_OFF, &radio_index, ad->setting_info.radio_group_duplex, ad)->item;
+ ad->setting_info.duplex[PT_DUPLEX_NO_TUMBLE] = __pts_setting_view_add_genlist_item(genlist, item, PT_OPTION_ID_DUPLEX, PT_DUPLEX_NO_TUMBLE, &radio_index, ad->setting_info.radio_group_duplex, ad)->item;
+ } else {
PTS_DEBUG("Unknown item");
}
{
PTS_TRACE_BEGIN;
PTS_RET_IF(NULL == event_info, "item object is NULL");
- PTS_RET_IF(NULL == data, "ugd is NULL");
+ PTS_RET_IF(NULL == data, "ad is NULL");
Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- pts_core_data_t *ugd = (pts_core_data_t *)data;
+ pts_appdata_t *ad = (pts_appdata_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){
+ if (item_data == (void *)ad->list_info.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);
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_RET_IF(option >= PT_OPTION_ID_MAX, "UNKNOWN OPTION REALIZED - %d", option);
PTS_DEBUG("realized print option: [%d]\n", option);
|| PT_OPTION_ID_RANGE == option
|| PT_OPTION_ID_QUALITY == option
|| PT_OPTION_ID_PAPER == option
- || PT_OPTION_ID_GRAYSCALE == option) {
+ || PT_OPTION_ID_GRAYSCALE == option
+ || PT_OPTION_ID_DUPLEX == option) {
Evas_Object *ao = elm_object_item_access_object_get(item);
PTS_RET_IF(NULL == ao, "Access object is NULL");
/*
* create the content of setting view
*/
-static Evas_Object *__pts_setting_view_create_content(Evas_Object *parent, pts_core_data_t *ugd)
+static Evas_Object *__pts_setting_view_create_content(Evas_Object *parent, pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RETV_IF(ugd == NULL, NULL, "ugd is NULL");
+ PTS_RETV_IF(ad == NULL, NULL, "ad is NULL");
PTS_RETV_IF(parent == NULL, NULL, "parent is NULL");
Evas_Object *genlist = NULL;
elm_genlist_item_select_mode_set(separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- ugd->printer_item = elm_genlist_item_append(
+ ad->setting_info.printer_item = elm_genlist_item_append(
genlist,
&itc_printer,
- (void *)ugd->active_printer,
+ (void *)ad->list_info.active_printer,
NULL,
ELM_GENLIST_ITEM_NONE,
- __pts_setting_view_printer_sel, ugd);
+ __pts_setting_view_printer_sel, ad);
- ugd->header_separator_item = elm_genlist_item_append(
+ ad->setting_info.header_separator_item = elm_genlist_item_append(
genlist,
&itc_separator,
NULL,
NULL,
ELM_GENLIST_ITEM_NONE,
NULL, NULL);
- elm_genlist_item_select_mode_set(ugd->header_separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ elm_genlist_item_select_mode_set(ad->setting_info.header_separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- ugd->item_paper_size = elm_genlist_item_append(
+ ad->setting_info.item_paper_size = elm_genlist_item_append(
genlist,
&itc_tree_options,
(void *)PT_OPTION_ID_PAPERSIZE,
NULL,
ELM_GENLIST_ITEM_TREE,
__pts_setting_view_gl_sel,
- ugd);
+ ad);
- ugd->item_paper_copies = elm_genlist_item_append(
+ ad->setting_info.item_paper_copies = elm_genlist_item_append(
genlist,
&itc_normal_options,
(void *)PT_OPTION_ID_COPIES,
NULL,
ELM_GENLIST_ITEM_NONE,
_create_copies_popup_timepicker,
- ugd);
+ ad);
- ugd->item_page_range = elm_genlist_item_append(
+ ad->setting_info.item_page_range = elm_genlist_item_append(
genlist,
&itc_tree_options,
(void *)PT_OPTION_ID_RANGE,
NULL,
ELM_GENLIST_ITEM_TREE,
__pts_setting_view_gl_sel,
- ugd);
+ ad);
- ugd->item_paper_quality = elm_genlist_item_append(
+ ad->setting_info.item_paper_quality = elm_genlist_item_append(
genlist,
&itc_tree_options,
(void *)PT_OPTION_ID_QUALITY,
NULL,
ELM_GENLIST_ITEM_TREE,
__pts_setting_view_gl_sel,
- ugd);
+ ad);
- ugd->item_paper_type = elm_genlist_item_append(
+ ad->setting_info.item_paper_type = elm_genlist_item_append(
genlist,
&itc_tree_options,
(void *)PT_OPTION_ID_PAPER,
NULL,
ELM_GENLIST_ITEM_TREE,
__pts_setting_view_gl_sel,
- ugd);
+ ad);
- ugd->item_grayscale = elm_genlist_item_append(
+ ad->setting_info.item_grayscale = elm_genlist_item_append(
genlist,
&itc_tree_options,
(void *)PT_OPTION_ID_GRAYSCALE,
NULL,
ELM_GENLIST_ITEM_TREE,
__pts_setting_view_gl_sel,
- ugd);
+ ad);
+
+ ad->setting_info.item_duplex = elm_genlist_item_append(
+ genlist,
+ &itc_tree_options,
+ (void *)PT_OPTION_ID_DUPLEX,
+ NULL,
+ ELM_GENLIST_ITEM_TREE,
+ __pts_setting_view_gl_sel,
+ ad);
// Footer space
- ugd->footer_separator_item = elm_genlist_item_append(
+ ad->setting_info.footer_separator_item = elm_genlist_item_append(
genlist,
&itc_separator,
NULL,
NULL,
ELM_GENLIST_ITEM_NONE,
NULL, NULL);
- elm_genlist_item_select_mode_set(ugd->footer_separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ elm_genlist_item_select_mode_set(ad->setting_info.footer_separator_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- 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);
+ evas_object_smart_callback_add(genlist, "expanded", __pts_setting_view_gl_exp, ad);
+ evas_object_smart_callback_add(genlist, "contracted", __pts_setting_view_gl_con, ad);
/* Accessability information callback */
- evas_object_smart_callback_add(genlist, "realized", __pts_setting_view_gl_realized, ugd);
+ evas_object_smart_callback_add(genlist, "realized", __pts_setting_view_gl_realized, ad);
/* Add touch coordinates handler */
Ecore_Event_Handler *event;
return bg;
}
-
/**
* This function let the app create setting view
* @return void
* @param[in] sd the pointer to the printer setting structure
*/
-void pts_create_setting_view(pts_core_data_t *ugd)
+void pts_create_setting_view(pts_appdata_t *ad)
{
PTS_TRACE_BEGIN;
- PTS_RET_IF(ugd == NULL, "ugd is NULL");
+ PTS_RET_IF(ad == NULL, "ad is NULL");
Evas_Object *back_btn = NULL;
//Evas_Object *layout = NULL;
//evas_object_show(layout);
//Evas_Object *conform = elm_object_part_content_get(layout, "elm.swallow.content");
- genlist = __pts_setting_view_create_content(ugd->navi, ugd);
+ genlist = __pts_setting_view_create_content(ad->main_info.navi, ad);
//elm_object_content_set(layout, genlist);
- back_btn = elm_button_add(ugd->navi);
+ back_btn = elm_button_add(ad->main_info.navi);
elm_object_style_set(back_btn, "naviframe/end_btn/default");
- evas_object_smart_callback_add(back_btn, "clicked", __pts_setting_view_btn_back_cb, ugd);
- elm_naviframe_item_push(ugd->navi, _("IDS_SMPOS_HEADER_PRINTER_SETTINGS"), back_btn, NULL, genlist, NULL);
+ evas_object_smart_callback_add(back_btn, "clicked", __pts_setting_view_btn_back_cb, ad);
+ elm_naviframe_item_push(ad->main_info.navi, _("IDS_SMPOS_HEADER_PRINTER_SETTINGS"), back_btn, NULL, genlist, NULL);
//navi_item = elm_naviframe_item_push(ugd->navi, _("IDS_SMPOS_HEADER_PRINTER_SETTINGS"), back_btn, NULL, genlist, NULL);
PTS_TRACE_END;
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, "");
+ PTS_RET_IF(parent == NULL, "parent is NULL");
+ PTS_RET_IF(msg == NULL, "msg is NULL");
Evas_Object *error_popup = elm_popup_add(parent);
PTS_RET_IF(error_popup == NULL, "error_popup is NULL");
PTS_DEBUG("Not existed %s, just skip", path);
}
}
+ PTS_IF_FREE_MEM(cwd);
PTS_TRACE_END;
return;
}
#ifndef _IMAGE_EDITOR_H_INCLUDED_
#define _IMAGE_EDITOR_H_INCLUDED_
-int load_image_editor_ug(pts_core_data_t *ugd);
+int load_image_editor_ug(pts_appdata_t *ad);
#endif /* _IMAGE_EDITOR_H_INCLUDED_ */
#include <Elementary.h>
#include "pts_common.h"
-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__ */
#include "pts_common.h"
-int generate_preview_images(pts_core_data_t *ugd,
+int generate_preview_images(pts_appdata_t *ad,
app_device_orientation_e dev_orientation);
int printer_get_setting_n_up(const pt_printer_mgr_t *active_printer);
#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_REFRESH_SEARCHING_PRINTERS "Press to refresh searching for printers"
#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 SERVICE_PRINT_FILES_TYPE "service_print_files_type"
#define SERVICE_PRINT_FILES_FOLDER_NAME "service_print_files_folder_name"
#define SERVICE_PRINT_FILES_FILES_NAME "service_print_files_files_name"
+#define IDS_PRINT_SETTINGS_DUPLEX "Duplex"
+#define IDS_PRINT_SETTINGS_DUPLEX_OFF "One side"
+#define IDS_PRINT_SETTINGS_DUPLEX_ON "Double side"
#define ICON_PRINTER "/usr/apps/org.tizen.mobileprint/res/images/pt_default_printer.png"
char *directory;
char **request_files;
pts_range_t range;
- int num_of_files;
- int current_index;
+ int num_of_files;
+ int current_index;
char *type;
+
+ char *input_file;
} pts_printing_data_t;
typedef struct {
typedef void (*pts_printer_selection_done_cb)(void *userdata);
typedef struct {
+ pt_print_option_e option; /* pts_print_option_type */
+ int sub_item; /* Individual item. It stores any type of options:
+ pt_paper_size_t, pt_range_t,
+ pt_grayscale_t, pt_quality_t,
+ pt_paper_t*/
+ int radio_index;
+
+ Elm_Object_Item *item;
+ Evas_Object *radio_btn;
+ Evas_Object *radio_group;
+} Item_data;
+
+typedef struct
+{
Evas_Object *root_win;
Evas_Object *main_layout;
Evas_Object *navi;
Evas_Object *printer_label;
Evas_Object *more_btn;
Evas_Object *print_btn;
- Evas_Object *ctxpopup;
/*
- * popup
+ * image layout
*/
- 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;
- Evas_Object *size_popup_box;
- Evas_Coord size_popup_portrait_height;
- Evas_Coord size_popup_landscape_height;
- Evas_Object *custom_popup;
- Evas_Object *custom_popup_box;
- Evas_Coord custom_popup_portrait_height;
- Evas_Coord custom_popup_landscape_height;
-
- Evas_Object *progressbar;
- Evas_Object *progress_layout;
- Evas_Object *progress_label;
+ Evas_Object *img_layout;
/*
- * image layout
+ * sweep image
*/
- Evas_Object *img_layout;
+ Evas_Object *smsc;
+ int landscape_toggle;
+
/*
* main navi item
*/
Elm_Object_Item *navi_it;
+} pts_main_info_t;
- /* Print Search Type*/
- pts_printer_search_state_e print_search_mode;
- pts_printer_selection_done_cb selection_done_cb;
- Evas_Object *print_search_popup_parent;
- void *printer_search_user_data;
+typedef struct
+{
+ Evas_Object *ctxpopup;
/* Setting option: Header-item */
Elm_Object_Item *printer_item;
Elm_Object_Item *item_paper_type;
Elm_Object_Item *item_page_range;
Elm_Object_Item *item_grayscale;
+ Elm_Object_Item *item_duplex;
Elm_Object_Item *footer_separator_item;
/* Settings: subitems */
Elm_Object_Item *quality[PT_QUALITY_ANY];
Elm_Object_Item *paper_type[PT_PAPER_ANY];
Elm_Object_Item *color[PT_GRAYSCALE_ANY];
+ Elm_Object_Item *duplex[PT_DUPLEX_ANY];
/* Setting option: Radio Group Leader */
Evas_Object *radio_group_paper_size;
Evas_Object *radio_group_paper_type;
Evas_Object *radio_group_page_range;
Evas_Object *radio_group_grayscale;
+ Evas_Object *radio_group_duplex;
+} pts_setting_info_t;
- char *input_file; /* initial input file */
- pts_printing_data_t pt_files;
- /*
- * wifi, usb, all connection
- */
- //int connect_type;
- /*
- * sweep image
- */
- Evas_Coord cur_x;
- pt_printer_mgr_t *active_printer;
+typedef struct
+{
+ 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;
pt_printer_mgr_t *select_printer;
+ pt_printer_mgr_t *active_printer;
+
+ /*from pts_ug_list_data*/
- int dummy_noti_id;
- Eina_List *job_spooling_list;
+ Eina_List *printer_list;
- Evas_Object *smsc;
+} pts_list_info_t;
- int landscape_toggle;
+typedef struct
+{
+ Evas_Object *popup;
+ Evas_Object *progressbar;
+ Evas_Object *progress_layout;
+ Evas_Object *progress_label;
+} pts_progress_info_t;
+typedef struct
+{
+ /* Print Search Type*/
+ pts_printer_search_state_e print_search_mode;
+ pts_printer_selection_done_cb selection_done_cb;
+ Evas_Object *print_search_popup_parent;
+ void *printer_search_user_data;
+ char *ip_address;
/* whether in process(searching, printing) */
int is_process;
+ /*from pts_ug_list_data*/
+ Ecore_Timer *search_err_timer;
+ Evas_Object *popup;
+
+} pts_searching_info_t;
+
+typedef struct
+{
+ Evas_Object *wifi_type_popup;
+} pts_selector_info_t;
+
+typedef struct
+{
+ Evas_Object *size_popup;
+ Evas_Object *size_popup_box;
+ Evas_Coord size_popup_portrait_height;
+ Evas_Coord size_popup_landscape_height;
+ Evas_Object *custom_popup;
+ Evas_Object *custom_popup_box;
+ Evas_Coord custom_popup_portrait_height;
+ Evas_Coord custom_popup_landscape_height;
pts_image_size_e image_size;
double custom_width;
double custom_height;
double custom_w_ratio;
int custom_unit; // 1:cm 2:inch
-} pts_core_data_t;
+} pts_size_popup_info_t;
-typedef struct {
- Evas_Object *popup;
- Eina_List *printer_list;
+typedef struct
+{
+ Evas_Object *scaling_popup;
+} pts_scaling_popup_info_t;
- pts_core_data_t *ugd;
+typedef struct
+{
+ int dummy_noti_id;
+ Eina_List *job_spooling_list; /*TODO : provide pt_get_job_count, pt_get_job_id ... as API in print-service*/
- Ecore_Timer *search_err_timer;
-} pts_ug_list_data;
+} pts_noti_info_t;
-typedef struct {
- pts_core_data_t *ugd;
+typedef struct appdata {
+ Evas_Object *win;
+ Ecore_Event_Handler *screen_reader_message_handler;
- pt_print_option_e option; /* pts_print_option_type */
- int sub_item; /* Individual item. It stores any type of options:
- pt_paper_size_t, pt_range_t,
- pt_grayscale_t, pt_quality_t,
- pt_paper_t*/
- int radio_index;
+ /* add more variables here */
+ int prev_app_win_rotate;
- Elm_Object_Item *item;
- Evas_Object *radio_btn;
- Evas_Object *radio_group;
-} Item_data;
+ pts_main_info_t main_info; /*Global variables about preview view*/
+ pts_setting_info_t setting_info; /*Global variables about setting view*/
+ pts_list_info_t list_info; /*Global variables about printer list popup*/
+ pts_progress_info_t progress_info; /*Global variables about progress popup*/
+ pts_searching_info_t search_info;
+ pts_selector_info_t select_info; /*Global variables about wifi/p2p selet popup*/
+ pts_size_popup_info_t size_popup_info; /*Global variables about size popup*/
+ pts_scaling_popup_info_t scaling_popup_info; /*Global variables about scaling popup*/
+ pts_noti_info_t noti_info; /*Global variables about noti*/
+ pts_printing_data_t printing_data;
+
+} pts_appdata_t;
/**
* This function let the app create the label
* @param[in] timeout the timeout value
*/
Evas_Object *pts_create_popup(Evas_Object *parent, const char *desc, double timeout);
-Evas_Object *pts_create_size_popup(Evas_Object *parent, pts_core_data_t *ugd);
-Evas_Object *pts_create_scaling_popup(Evas_Object *parent, pts_core_data_t *ugd);
-Evas_Object *pts_create_wifi_popup(Evas_Object *parent, pts_core_data_t *ugd);
-void clear_preview_image(pts_core_data_t *ugd);
-void pts_set_ugd(pts_core_data_t *ugd);
-pts_core_data_t *pts_get_ugd(void);
-
+Evas_Object *pts_create_size_popup(Evas_Object *parent, pts_appdata_t *ad);
+Evas_Object *pts_create_scaling_popup(Evas_Object *parent, pts_appdata_t *ad);
+Evas_Object *pts_create_wifi_popup(Evas_Object *parent, pts_appdata_t *ad);
+void clear_preview_image(pts_appdata_t *ad);
+//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);
+void pts_search_printer(pts_appdata_t *ad);
+Evas_Object *pts_create_print_search_popup(Evas_Object *parent);
Evas_Object *pts_utils_create_layout(Evas_Object *navi_frame);
void load_main_view(void *userdata);
+++ /dev/null
-/*
-* 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 PTS_LIST_VIEW_H_
-#define PTS_LIST_VIEW_H_
-
-/**
- * This function let the app create the printers list view
- * @return void
- * @param[in] ld the pointer to the ug list structure
- */
-#endif /* PTS_LIST_VIEW_H_ */
struct appdata *pts_get_appdata();
-void clear_preview_image(pts_core_data_t *ugd);
+void clear_preview_image(pts_appdata_t *ad);
/**
* This function let the app rotate the image by the given landscape
* @param[in] ugd the pointer to the main data structure
* @param[in] landscape the landscape value
*/
-void pts_main_view_rotate_image(pts_core_data_t *ugd,
+void pts_main_view_rotate_image(pts_appdata_t *ad,
app_device_orientation_e orientation);
/**
* @return void
* @param[in] ugd the pointer to the main data structure
*/
-void pts_main_view_update_printer_label(pts_core_data_t *ugd);
+void pts_main_view_update_printer_label(pts_appdata_t *ad);
/**
* 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);
+Evas_Object *pts_main_view_load_preview_img(pts_appdata_t *ad);
/**
* This function let the app create the main screen view
* @param[in] win the pointer to the main window
* @param[in] filepath the pointer to the path of files
*/
-Evas_Object *pts_create_main_view(pts_core_data_t *ugd);
+Evas_Object *pts_create_main_view(pts_appdata_t *ad);
-void pts_main_view_search_printer(pts_core_data_t *ugd);
+void pts_main_view_search_printer(pts_appdata_t *ad);
-int pts_main_view_load_printing_data(pts_core_data_t *ugd, pts_printing_data_t *pt_files);
+int pts_main_view_load_printing_data(pts_appdata_t *ad, pts_printing_data_t *pt_files);
void __pts_event_cb(pt_event_e event, void *user_data, pt_progress_info_t *progress_info);
-void __pts_print_progress_popup(pts_core_data_t *ugd, int job_id, int page_count);
+void __pts_print_progress_popup(pts_appdata_t *ad, int job_id, int page_count);
-void __pts_print_dummy_popup(pts_core_data_t *ugd, char *files, int page_count);
+void __pts_print_dummy_popup(pts_appdata_t *ad, char *files, int page_count);
#endif /* PTS_MAIN_VIEW_H_ */
* @return void
* @param[in] sd the pointer to the pts_ug_main_data structure
*/
-void pts_create_setting_view(pts_core_data_t *ugd);
+void pts_create_setting_view(pts_appdata_t *ad);
#endif /* PTS_SETTING_VIEW_H_ */
+++ /dev/null
-Name=MobilePrint
-Type=Application
-Exec=@PREFIX@/bin/@PROJECT_NAME@
-Icon=@PKGNAME@.png
-MimeType=
-nodisplay=True
-Version=0.2.15-54
-X-TIZEN-TaskManage=False
-X-TIZEN-Multiple=False
-X-TIZEN-SVC=http://tizen.org/appcontrol/operation/PRINT|NULL|image/*;http://tizen.org/appcontrol/operation/PRINT|NULL|application/pdf;
PREVIEW_ENGINE_EVENT_PAGE_ERROR = -1,
PREVIEW_ENGINE_EVENT_PAGE_PROCESSING,
PREVIEW_ENGINE_EVENT_PAGE_READY,
- PREVIEW_ENGINE_EVENT_INITIAL_READY
+ PREVIEW_ENGINE_EVENT_INITIAL_READY,
+ PREVIEW_ENGINE_EVENT_EMPTY_PAGE_PROCESSING,
+ PREVIEW_ENGINE_EVENT_EMPTY_PAGE_READY
/* add cancelled state? */
};
};
struct initial_preview_data {
- //char *fname; /* initial file */
struct preview_conf conf;
struct preview_engine *engine; /* not for use in thread */
};
struct preview_engine {
- //char *fname;
-
enum preview_engine_state state;
struct preview_task_model task_model;
struct preview_model p_model;
- Ecore_Thread *initial_thread;
struct initial_preview_data *next_preview_data;
int page_ready_event_type;
int init_preview_engine(struct preview_engine *engine);
int process_preview_engine_file(struct preview_engine *engine,
- 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,
- const struct page_scale *scale, int is_grayscale);
+ char **const fnames, int files_count,
+ 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,
+ const struct page_scale *scale, int is_grayscale);
void preview_engine_send_page_message(struct preview_engine *engine,
enum preview_engine_event_status status, int page);
int preview_engine_init_done(struct preview_engine *engine,
struct preview_conf {
int pages_count;
- char *initial_fname;
+ char **initial_fnames;
+ int files_count;
char *fname;
char *ppd; /*PPD file name*/
//int is_original_size;
//int pages_count;
enum preview_page_state *pages_state;
struct preview_conf conf;
+ enum preview_page_state empty_page_state;
//struct preview_task_model *task_model;
struct preview_engine *engine;
};
#include "preview_engine.h"
+void destroy_preview_conf(struct preview_conf *conf);
+int copy_preview_conf(struct preview_conf *dest,
+ const struct preview_conf *src);
+
int init_preview_model(struct preview_model *model,
const struct preview_conf *conf,
struct preview_engine *engine);
void destroy_preview_model(struct preview_model *model);
+int preview_model_request_empty_page(struct preview_model *model);
int preview_model_request_page(struct preview_model *model, int page);
int preview_model_page_available(struct preview_model *model,
enum preview_engine_event_status status, int page);
#define _PREVIEW_TASK_MODEL_H_INCLUDED_
//#define MAX_PREVIEW_TASK_COUNT 3 /* TODO: autodetection */
+#define PREVIEW_EMPTY_PAGE_FNAME PREVIEW_TEMP_DIR "/empty_page.ppm"
struct preview_task_model;
struct preview_conf;
#include <Ecore.h>
+#include <previewgen.h> /* PREVIEW_TEMP_DIR definition */
struct preview_task_model {
Eina_List *task_list;
#include "preview_model.h"
+
+#define PREVIEW_EMPTY_PAGE_FNAME PREVIEW_TEMP_DIR "/empty_page.ppm"
+
+
int init_preview_task_model(struct preview_task_model *model,
struct preview_engine *engine);
int preview_task_stop_processing(struct preview_task_model *task_model);
int add_preview_task_initial(struct preview_task_model *model,
const struct preview_conf *conf);
+int add_preview_task_empty_page(struct preview_task_model *model,
+ struct preview_model *pmodel);
int add_preview_task(struct preview_task_model *model, int page,
struct preview_model *pmodel);
int init_preview_engine(struct preview_engine *engine)
{
+ int ret;
+ int errsv;
+
PTS_TRACE_BEGIN;
PTS_RETV_IF(engine == NULL, -1, "engine is NULL");
/*engine->fname = NULL;
DBG("preview_engine: fname = %s", fname);*/
+ memset(engine, 0, sizeof(struct preview_engine));
+
engine->state = PREVIEW_ENGINE_STATE_INITIAL;
- engine->initial_thread = NULL;
engine->next_preview_data = NULL;
memset(&(engine->p_model), 0, sizeof(struct preview_model));
+ ret = mkdir(PREVIEW_TEMP_DIR, 0777);
+ errsv = errno;
+ PTS_RETV_IF(ret < 0 && errsv != EEXIST, -1,
+ "Failed to mkdir " PREVIEW_TEMP_DIR
+ ", errno = %d", errsv);
+
if (init_preview_task_model(&(engine->task_model), engine) < 0) {
PTS_TRACE_BEGIN;
return -1;
}
/* TODO: engine destruction */
+
int preview_engine_init_done(struct preview_engine *engine,
const struct preview_conf *conf)
{
}
int process_preview_engine_file(struct preview_engine *engine,
- const char *fname,
+ char **const fnames, int files_count,
const char *ppd,
const struct paper_size_pts *paper_size,
const struct size_px *max_available_size_px,
{
PTS_TRACE_BEGIN;
PTS_RETV_IF(NULL == engine ||
- NULL == fname ||
+ NULL == fnames ||
+ files_count <= 0 ||
+ NULL == fnames[0] ||
NULL == ppd ||
NULL == paper_size ||
NULL == scale ||
struct initial_preview_data *data;
struct size_px shadow_size_px = {10, 10};
+ int i;
data = malloc(sizeof(struct initial_preview_data));
PTS_RETV_IF(data == NULL, -1, "Insufficient memory");
- data->conf.initial_fname = strdup(fname);
+
+ data->conf.initial_fnames = calloc(files_count + 1, sizeof(char*));
+ if (NULL == data->conf.initial_fnames) {
+ PTS_IF_FREE_MEM(data);
+ PTS_RETV_IF(1, -1, "Insufficient memory");
+ }
+ for (i = 0; i < files_count; ++i) {
+ data->conf.initial_fnames[i] = strdup(fnames[i]);
+ PTS_DEBUG("Fname %d: %s", i, fnames[i]);
+ if (NULL == data->conf.initial_fnames[i]) {
+ /* memory error */
+ destroy_preview_conf(&(data->conf));
+ PTS_IF_FREE_MEM(data);
+ PTS_RETV_IF(1, -1, "Insufficient memory");
+ }
+ }
+ data->conf.files_count = files_count;
+
data->conf.ppd = strdup(ppd);
data->conf.fname = strdup(TEMP_PDFTOPDF_FNAME);
data->conf.paper_size = *paper_size;
data->engine = engine;
+
//careful memory release:
- if (data->conf.initial_fname == NULL || data->conf.ppd == NULL ||
- data->conf.fname == NULL || data->conf.paper_size.name == NULL) {
- PTS_IF_FREE_MEM(data->conf.initial_fname);
- PTS_IF_FREE_MEM(data->conf.ppd);
- PTS_IF_FREE_MEM(data->conf.fname);
- PTS_IF_FREE_MEM(data->conf.paper_size.name);
+ if (data->conf.ppd == NULL || data->conf.fname == NULL
+ || data->conf.paper_size.name == NULL) {
+ destroy_preview_conf(&(data->conf));
PTS_IF_FREE_MEM(data);
PTS_RETV_IF(1, -1, "Insufficient memory");
}
#include "preview_model.h"
+
+void destroy_preview_conf(struct preview_conf *conf)
+{
+ int i;
+ PTS_RET_IF(NULL == conf, "Argument error");
+
+ if (conf->initial_fnames != NULL)
+ for (i = 0; i < conf->files_count; ++i)
+ PTS_IF_FREE_MEM(conf->initial_fnames[i]);
+ PTS_IF_FREE_MEM(conf->initial_fnames);
+ conf->files_count = 0;
+
+ PTS_IF_FREE_MEM(conf->fname);
+ PTS_IF_FREE_MEM(conf->ppd);
+ PTS_IF_FREE_MEM(conf->paper_size.name);
+ conf->pages_count = 0;
+}
+
+
+int copy_preview_conf(struct preview_conf *dest, const struct preview_conf *src)
+{
+ int i;
+ PTS_RETV_IF(NULL == dest || NULL == src, -1, "Argument error");
+ memset(dest, 0, sizeof(struct preview_conf));
+ *dest = *src;
+
+ dest->initial_fnames = calloc(src->files_count + 1, sizeof(char*));
+ if (NULL == dest->initial_fnames)
+ goto ERR_CASE;
+ for (i = 0; i < src->files_count; ++i) {
+ dest->initial_fnames[i] = strdup(src->initial_fnames[i]);
+ if (NULL == dest->initial_fnames[i])
+ goto ERR_CASE;
+ }
+
+ dest->fname = strdup(src->fname);
+ dest->ppd = strdup(src->ppd);
+ dest->paper_size.name = strdup(src->paper_size.name);
+ if (NULL == dest->fname || NULL == dest->ppd
+ || NULL == dest->paper_size.name)
+ goto ERR_CASE;
+
+ return 0;
+
+ERR_CASE:
+ destroy_preview_conf(dest);
+ PTS_RETV_IF(1, -1, "Insufficient memory");
+}
+
+
int init_preview_model(struct preview_model *model,
const struct preview_conf *conf,
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->conf = *conf;
model->pages_state = malloc(sizeof(enum preview_page_state)
* (conf->pages_count + 1));
PTS_RETV_IF(model->pages_state == NULL, -1, "Insufficient memory");
- model->conf.initial_fname = strdup(conf->initial_fname);
- model->conf.ppd = strdup(conf->ppd);
- model->conf.fname = strdup(conf->fname);
- model->conf.paper_size.name = strdup(conf->paper_size.name);
-
- //careful memory release:
- if (model->conf.initial_fname == NULL || model->conf.ppd == NULL ||
- model->conf.fname == NULL || model->conf.paper_size.name == NULL) {
- PTS_IF_FREE_MEM(model->conf.initial_fname);
- PTS_IF_FREE_MEM(model->conf.ppd);
- PTS_IF_FREE_MEM(model->conf.fname);
- PTS_IF_FREE_MEM(model->conf.paper_size.name);
- PTS_RETV_IF(1, -1, "Insufficient memory");
+ if (copy_preview_conf(&(model->conf), conf) < 0) {
+ PTS_IF_FREE_MEM(model->pages_state);
+ PTS_RETV_IF(1, -1, "Error in configuration copy");
}
int i;
}
model->engine = engine;
+ model->empty_page_state = PREVIEW_PAGE_STATE_NA;
PTS_TRACE_END;
return 0;
PTS_RET_IF(model == NULL, "Invalid argument");
PTS_IF_FREE_MEM(model->pages_state);
- model->conf.pages_count = 0;
- PTS_IF_FREE_MEM(model->conf.fname);
- PTS_IF_FREE_MEM(model->conf.initial_fname);
- PTS_IF_FREE_MEM(model->conf.ppd);
- PTS_IF_FREE_MEM(model->conf.paper_size.name);
+ destroy_preview_conf(&(model->conf));
PTS_TRACE_END;
}
+int preview_model_request_empty_page(struct preview_model *model)
+{
+ PTS_TRACE_BEGIN;
+ PTS_RETV_IF(model == NULL, -1, "model is NULL");
+ PTS_RETV_IF(model->pages_state == NULL, -1, "model is not initialized");
+
+ if (model->empty_page_state != PREVIEW_PAGE_STATE_READY)
+ preview_engine_send_page_message(model->engine,
+ PREVIEW_ENGINE_EVENT_EMPTY_PAGE_PROCESSING, 0);
+
+ if (PREVIEW_PAGE_STATE_NA == model->empty_page_state) {
+ add_preview_task_empty_page(
+ &(model->engine->task_model), model);
+ model->empty_page_state = PREVIEW_PAGE_STATE_READY;
+ } else {
+ preview_engine_send_page_message(model->engine,
+ PREVIEW_ENGINE_EVENT_EMPTY_PAGE_READY, 0);
+ }
+
+ PTS_TRACE_END;
+ return 0;
+}
+
int preview_model_request_page(struct preview_model *model, int page)
{
PTS_TRACE_BEGIN;
PTS_TRACE_BEGIN;
PTS_RETV_IF(model == NULL || model->pages_state == NULL, -1, "model is not initialized");
- model->pages_state[page] = PREVIEW_PAGE_STATE_READY;
- /* TODO: send message */
+ if (PREVIEW_ENGINE_EVENT_PAGE_READY == status)
+ model->pages_state[page] = PREVIEW_PAGE_STATE_READY;
+ else if (PREVIEW_ENGINE_EVENT_EMPTY_PAGE_READY == status)
+ model->empty_page_state = PREVIEW_PAGE_STATE_READY;
preview_engine_send_page_message(model->engine,
- PREVIEW_ENGINE_EVENT_PAGE_READY, page);
+ status, page);
PTS_TRACE_END;
return 0;
#define SHADOW_SIZE_PX_X 10
#define SHADOW_SIZE_PX_Y 10
+#define CMD_STR_MAX_LEN 1024
+
#define SINGLE_PAGE_PREVIEWGEN
/* TODO: task model destruction */
enum preview_task_type {
+ PREVIEW_TASK_EMPTY_PAGE,
PREVIEW_TASK_GENERIC,
PREVIEW_TASK_INITIAL
};
int page;
enum preview_task_type task_type;
struct preview_conf conf;
- char out_pic_fname[sizeof("/tmp/mobileprint/mobileprint_xxxx.ppm ")];
+ char out_pic_fname[sizeof(PREVIEW_TEMP_DIR "/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];
+ char *previewgen_exe_cmd;
};
msg[data_from_process->size] = '\0';
*pages_count = 0;
+ PTS_DEBUG("msg: %s", msg);
+
switch (ftype) {
case FILE_TYPE_IMAGE:
sscanf(msg, "init img: pages count: %d", pages_count);
/* TODO: check for next initialization in queue */
switch (ptd->task_type) {
+ case PREVIEW_TASK_EMPTY_PAGE:
+ preview_model_page_available(ptd->pmodel,
+ PREVIEW_ENGINE_EVENT_EMPTY_PAGE_READY,
+ 0);
+ break;
case PREVIEW_TASK_GENERIC:
/* TODO: check does task OK (parse output) */
//if (ptd->is_task_ok) {
/* 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);
+ destroy_preview_conf(&(ptd->conf));
PTS_DEBUG("memory released");
break;
}
ecore_event_handler_del(task_model->event_handler);
task_model->event_handler = NULL;
PTS_DEBUG("Freeing memory");
+ PTS_IF_FREE_MEM(ptd->previewgen_exe_cmd);
PTS_IF_FREE_MEM(ptd);
/* manage tasks queue */
task_model->previewgen_handle =
ecore_exe_pipe_run(ptd->previewgen_exe_cmd,
ECORE_EXE_PIPE_READ_LINE_BUFFERED
- | ECORE_EXE_PIPE_READ, /*ptd*/ NULL);
+ | ECORE_EXE_PIPE_READ, 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_IF_FREE_MEM(ptd->previewgen_exe_cmd);
+ PTS_IF_FREE_MEM(ptd);
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);
+ preview_handler_end_cb, ptd);
}
PTS_TRACE_END;
PTS_TRACE_BEGIN;
PTS_RETV_IF(model == NULL || conf == NULL, -1, "Invalid argument");
+ char *fnames_str;
struct preview_task_data *ptd;
+ int i;
+ int fnames_strlen;
/* fill the preview_task_data structure */
ptd = malloc(sizeof(struct preview_task_data));
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);
+ /* TODO: check for each file */
+ ptd->ftype = get_file_type(ptd->conf.initial_fnames[0]);
+
+ ptd->previewgen_exe_cmd = NULL;
+
enum page_scale_type scale_type = ptd->conf.scale.type;
switch (ptd->ftype) {
case FILE_TYPE_IMAGE:
+ /* calculate correct string length to support
+ many images*/
+ fnames_strlen = 0;
+ for (i = 0; i < conf->files_count; ++i)
+ fnames_strlen += strlen(ptd->conf.initial_fnames[i])
+ + 1;
+ fnames_str = (char*)malloc(sizeof(char) * (fnames_strlen + 1));
+ if (NULL == fnames_str) {
+ PTS_IF_FREE_MEM(ptd);
+ PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+ }
+ /* generate fnames list string */
+ fnames_str[0] = '\0';
+ for (i = 0; i < conf->files_count; ++i) {
+ strncat(fnames_str, ptd->conf.initial_fnames[i],
+ fnames_strlen);
+ strncat(fnames_str, " ", fnames_strlen);
+ }
+ fnames_str[fnames_strlen] = '\0';
+ /* generate command string */
+ ptd->previewgen_exe_cmd = (char*)malloc(sizeof(char)
+ * (CMD_STR_MAX_LEN + fnames_strlen + 1));
+ if (NULL == ptd->previewgen_exe_cmd) {
+ PTS_IF_FREE_MEM(ptd);
+ PTS_IF_FREE_MEM(fnames_str);
+ PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+ }
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);
+ snprintf(ptd->previewgen_exe_cmd, CMD_STR_MAX_LEN,
+ PREVIEWGEN_EXECUTABLE " init img "
+ "%s%s %s %s %lf %lf %d %d %s %d %s %d %lf %lf %d",
+ fnames_str, 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_IF_FREE_MEM(fnames_str);
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 "
+ ptd->previewgen_exe_cmd = malloc(sizeof(char)
+ * (CMD_STR_MAX_LEN + 1));
+ snprintf(ptd->previewgen_exe_cmd, CMD_STR_MAX_LEN,
+ 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.initial_fnames[0], 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" :
break;
case FILE_TYPE_INCORRECT:
PTS_DEBUG("Incorrect file type");
+ PTS_IF_FREE_MEM(ptd->previewgen_exe_cmd);
PTS_IF_FREE_MEM(ptd);
PTS_TRACE_END;
return -1;
/* 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*/);
+ ECORE_EXE_PIPE_READ, NULL);
if (NULL == model->previewgen_handle) {
+ PTS_DEBUG("ecore_exe_pipe_run error (%s)",
+ ptd->previewgen_exe_cmd);
+ PTS_IF_FREE_MEM(ptd->previewgen_exe_cmd);
+ destroy_preview_conf(&(ptd->conf));
PTS_IF_FREE_MEM(ptd);
+ 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 process_preview_task_ptd(struct preview_task_model *model,
+ struct preview_task_data *ptd)
+{
+ struct preview_task_data *next_ptd;
+
+ PTS_TRACE_BEGIN;
+ PTS_RETV_IF(model == NULL || NULL == ptd,
+ -1, "Argument error");
+
+ 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 || PREVIEW_TASK_INITIAL
+ == next_ptd->task_type) {
+ /* incorret list content or initialization
+ is planned */
+ PTS_IF_FREE_MEM(ptd->previewgen_exe_cmd);
+ PTS_IF_FREE_MEM(ptd);
+ PTS_TRACE_END;
+ return 0;
+ }
+ /* 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_DEBUG("ecore_exe_pipe_run error (%s)",
ptd->previewgen_exe_cmd);
+ PTS_IF_FREE_MEM(ptd->previewgen_exe_cmd);
+ PTS_IF_FREE_MEM(ptd);
PTS_TRACE_END;
return 0;
}
}
+int add_preview_task_empty_page(struct preview_task_model *model,
+ 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);
+
+ int res;
+ struct preview_task_data *ptd;
+ struct preview_task_data *next_ptd;
+
+ /* fill the preview_task_data structure */
+ ptd = malloc(sizeof(struct preview_task_data));
+ PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+
+ ptd->page = 0;
+ ptd->task_type = PREVIEW_TASK_EMPTY_PAGE;
+ sprintf(ptd->out_pic_fname, PREVIEW_TEMP_DIR "/empty_page.ppm");
+ ptd->is_task_ok = 0;
+ ptd->conf = pmodel->conf;
+ ptd->pmodel = pmodel;
+ ptd->task_model = model;
+
+ ptd->previewgen_exe_cmd = malloc(sizeof(char) * (CMD_STR_MAX_LEN + 1));
+ if (NULL == ptd->previewgen_exe_cmd) {
+ PTS_IF_FREE_MEM(ptd);
+ PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+ }
+
+ 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 */
+ snprintf(ptd->previewgen_exe_cmd, CMD_STR_MAX_LEN,
+ PREVIEWGEN_EXECUTABLE " empty_gen "
+ "%s %lf %lf %d %d %d %d %d",
+ 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);
+ PTS_DEBUG("cmd: %s", ptd->previewgen_exe_cmd);
+
+ res = process_preview_task_ptd(model, ptd);
+
+ PTS_TRACE_END;
+ return res;
+}
+
+
int add_preview_task(struct preview_task_model *model, int page,
struct preview_model *pmodel)
{
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 */
+ int res;
struct preview_task_data *ptd;
struct preview_task_data *next_ptd;
+
+ /* fill the preview_task_data structure */
ptd = malloc(sizeof(struct preview_task_data));
PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
ptd->pmodel = pmodel;
ptd->task_model = model;
+ ptd->previewgen_exe_cmd = malloc(sizeof(char) * (CMD_STR_MAX_LEN + 1));
+ if (NULL == ptd->previewgen_exe_cmd) {
+ PTS_IF_FREE_MEM(ptd);
+ PTS_RETV_IF(ptd == NULL, -1, "malloc failed");
+ }
+
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));
+ //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 "
+ snprintf(ptd->previewgen_exe_cmd, CMD_STR_MAX_LEN,
+ 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.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);
- }
+ res = process_preview_task_ptd(model, ptd);
PTS_TRACE_END;
- return 0;
+ return res;
}
#include "pdfgen.h"
-#define IMAGE_CONVERT_TEMP_FILE "/tmp/mobileprint/convert_tmp.ppm"
+#define IMAGE_CONVERT_TEMP_FILE PREVIEW_TEMP_DIR "/convert_tmp.ppm"
Evas *get_pdf_preview_page_image(const char *fname, int first_page,
const struct size_px *available_size_px,
enum page_orientation orientation, int n_up,
const struct page_scale *scale, int is_grayscale);
+int img_files2pdf_preview_pages(char **const fnames,
+ int files_count,
+ 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 process_image_downscale(const char *fname, const char *out_fname,
const struct size_px *available_size_px);
const struct pdfgen_settings *settings);
int call_imagetopdf(const char *path, const char *outfile,
const struct pdfgen_settings *settings);
+int call_pdfunite(char **const infiles_z, const char *outfile);
+
#endif /* _PDFGEN_H_INCLUDED_ */
/* debugging macros definitions */
-#define PREVIEWGEN_DEBUG
-#ifdef PREVIEWGEN_DEBUG
+/*#define PREVIEWGEN_STANDALONE_DEBUG*/
+#define PREVIEWGEN_DLOG_DEBUG
+#if defined PREVIEWGEN_STANDALONE_DEBUG
/* standalone preview generation (e.g. for testing) */
#include <stdio.h>
fprintf(stderr, "DEBUG:%s:%s(%d): " fmt "\n", \
__FILE__, __func__, __LINE__, ##arg); \
} while (0)
-#define PGEN_TRACE_BEGIN
-#define PGEN_TRACE_END
+#define PGEN_TRACE_BEGIN fprintf(stderr, "TRACE:%s ENTER\n", __func__);
+#define PGEN_TRACE_END fprintf(stderr, "TRACE:%s LEAVE\n", __func__);
#define PGEN_RET_IF(expr, fmt, args...) \
do { \
} \
} while (0)
+
+#elif defined PREVIEWGEN_DLOG_DEBUG
+/* standalone debugging with dlog */
+#undef LOG_TAG
+#define LOG_TAG "MOBILEPRINT_PREVIEWGEN"
+#include <dlog.h>
+
+#define PGEN_DEBUG LOGD
+#define PGEN_INFO LOGI
+#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_TRACE_BEGIN PGEN_INFO("ENTER FUNCTION: %s\n", __FUNCTION__);
+#define PGEN_TRACE_END PGEN_INFO("EXIT FUNCTION: %s\n", __FUNCTION__);
+
+#define PGEN_IF_FREE_MEM(mem) \
+ do { \
+ if(mem) { \
+ free(mem); \
+ mem = NULL; \
+ } \
+ } while (0)
+
+
#else
+/* connection to mobileprint debugging */
#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
+#define PGEN_RET_IF PTS_RET_IF
+#define PGEN_RETV_IF PTS_RETV_IF
+#define PGEN_IF_FREE_MEM PTS_IF_FREE_MEM
#endif /* PREVIEWGEN_DEBUG */
"bmp", "pcx", NULL}
#define PDF_FILE_EXT "pdf"
-#define IMG_TEMP_FILE_NAME "/tmp/mobileprint/out.ppm"
+#define PREVIEW_TEMP_DIR "/tmp/mobileprint"
+#define IMG_TEMP_FILE_NAME PREVIEW_TEMP_DIR "/out.ppm"
#define PREVIEW_IMG_TEMP_FILE_NAME IMG_TEMP_FILE_NAME
-#if 0
-/*#define PREVIEWGEN_DEBUG*/
-#ifdef PREVIEWGEN_DEBUG
-#define PGEN_DEBUG(fmt, arg...) do { \
- printf("DEBUG: " fmt "\n", ##arg); } while (0)
-#else
-#define PGEN_DEBUG(fmt, arg...) PTS_DEBUG(fmt, ##arg)
-#endif /* PREVIEWGEN_DEBUG */
-#endif
int is_page_landscape(struct size_pts *s);
int get_pdf_page_size(const char *path, struct size_pts *s);
{
PGEN_TRACE_BEGIN;
Evas_Engine_Info_Buffer *einfo;
+ Eina_Bool ret;
int method;
void *pixels;
int width = page_size->x;
einfo->info.alpha_threshold = 0;
einfo->info.func.new_update_region = NULL;
einfo->info.func.free_update_region = NULL;
- evas_engine_info_set(canvas, (Evas_Engine_Info *)einfo);
+ ret = evas_engine_info_set(canvas, (Evas_Engine_Info *)einfo);
+ PGEN_RETV_IF(ret == EINA_FALSE, -1, "Failed to evas_engine_info_set");
PGEN_TRACE_END;
return 0;
return 0;
}
+
+int img_files2pdf_preview_pages(char **const fnames,
+ int files_count,
+ 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 i;
+ struct pdfgen_settings pg_settings;
+ int out_fname_size = sizeof(PREVIEW_TEMP_DIR "/mobileprint_xxxx.pdf ");
+ int res;
+ char **out_fnames;
+ char *cur_fname;
+ int is_err = 0;
+ PGEN_TRACE_BEGIN;
+
+ PGEN_RETV_IF(files_count <= 0 || files_count > 9999,
+ -1, "Incorrect files_count");
+
+ pg_settings.n_up = 1; /* TODO: n_up */
+ pg_settings.paper_name = paper_size->name;
+ pg_settings.scale = *scale;
+ pg_settings.orientation = orientation;
+ pg_settings.ppd_filename = (char *)printer_ppd_fname;
+
+ /* generate images pdf files and their files list */
+ out_fnames = (char **)malloc(sizeof(char*) * (files_count + 1));
+ PGEN_RETV_IF(NULL == out_fnames, -1, "Out of memory");
+ memset(out_fnames, 0, sizeof(char*) * (files_count + 1));
+ for (i = 0; i < files_count; ++i) {
+ cur_fname = (char*)malloc(
+ sizeof(char) * (out_fname_size + 1));
+ if (NULL == cur_fname) {
+ is_err = 1;
+ break;
+ }
+ out_fnames[i] = cur_fname;
+ cur_fname[out_fname_size] = '\0';
+ snprintf(cur_fname, out_fname_size,
+ PREVIEW_TEMP_DIR "/mobileprint_%04d.pdf",
+ i + 1);
+ res = call_imagetopdf(fnames[i], cur_fname, &pg_settings);
+ PGEN_DEBUG("res = %d, i = %d", res, i);
+ }
+
+ /* connect images pdf files into one file */
+ if (!is_err)
+ res = call_pdfunite(out_fnames, out_pdf_fname);
+
+ /* free allocated memory */
+ for (i = 0; i < files_count; ++i)
+ PGEN_IF_FREE_MEM(out_fnames[i]);
+ PGEN_IF_FREE_MEM(out_fnames);
+ if (is_err)
+ PGEN_RETV_IF(1, -1, "Out of memory");
+
+
+ PGEN_TRACE_END;
+ return 0;
+}
+
#define PPI_MAX_VAL 10000
#define PPI_STR_MAX_LEN sizeof("10000")
+#define PDFGEN_CMDSTR_MAXLEN 1024
+
+#define PDFUNITE_PATH "/usr/bin/pdfunite"
+
/**
* @brief This function securely executes cmd line request with popen
* @param[in] cmd_str command line to execute
/* 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 pdftopdfAutoRotate=false\" \"%s\""
- " >%s 2> /tmp/mobileprint/errlog",
+ " >%s 2> " PREVIEW_TEMP_DIR "/errlog",
settings->ppd_filename,
PAGE_ORIENTATION_PORTRAIT == settings->orientation ? CUPS_OPTION_PORTRAIT :
PAGE_ORIENTATION_LANDSCAPE == settings->orientation ? CUPS_OPTION_LANDSCAPE : "",
return 0;
}
+
+int call_pdfunite(char **const infiles_z, const char *outfile)
+{
+ int err_code = 0;
+ char cmd_str[PDFGEN_CMDSTR_MAXLEN + 1];
+ int i;
+
+ PGEN_TRACE_BEGIN;
+ PGEN_RETV_IF(NULL == infiles_z || NULL == infiles_z[0]
+ || NULL == outfile, -1, "Argument error");
+
+ cmd_str[0] = '\0';
+ strncat(cmd_str, PDFUNITE_PATH, PDFGEN_CMDSTR_MAXLEN);
+
+ i = 0;
+ while (infiles_z[i] != NULL) {
+ strncat(cmd_str, " ", PDFGEN_CMDSTR_MAXLEN);
+ strncat(cmd_str, infiles_z[i], PDFGEN_CMDSTR_MAXLEN);
+ ++i;
+ }
+
+ strncat(cmd_str, " ", PDFGEN_CMDSTR_MAXLEN);
+ strncat(cmd_str, outfile, PDFGEN_CMDSTR_MAXLEN);
+ cmd_str[PDFGEN_CMDSTR_MAXLEN] = '\0';
+
+ err_code = call_cmd(cmd_str);
+
+ PGEN_TRACE_END;
+ return 0;
+}
+
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
#include <page_preview.h>
#include <paper_size.h>
+#include <pgen_debug.h>
#include <preview_coords.h>
"\n"
"init img - generate PDF for image\n"
"Arguments:\n"
- "\tfname toutfname_pdf ppdfname\n"
+ "\tfname1 ... fnameN outfname_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"
"\tscale_type scale_zoom scale_w scale_h\n"
"\tis_grayscale\n"
"\n"
+ "empty_gen - generate empty page image\n"
+ "Arguments:\n"
+ "\toutfname_ppm paper_s_x paper_s_y av_s_x av_s_y\n"
+ "\tshadow_x shadow_y is_rotate90\n"
+ "\n"
"gen - generate page image for PDF\n"
"Arguments:\n"
"\tfname page pages_count outfname_ppm\n"
}
-int process_init_img(int argc, char *argv[])
+void destroy_str_list(char **str_list, int list_len)
{
- char *fname;
+ int i;
+ PGEN_RET_IF(NULL == str_list || list_len <= 0 || NULL == str_list[0],
+ "Argument error");
+ for (i = 0; i < list_len; ++i) {
+ PGEN_IF_FREE_MEM(str_list[i]);
+ }
+}
+
+
+void remove_tmp_files(char **const files, int files_count)
+{
+ int i;
+ PGEN_RET_IF(NULL == files || files_count <= 0 || NULL == files[0],
+ "Arguments error");
+ for (i = 0; i <= files_count; ++i)
+ unlink(files[i]);
+}
+
+
+int process_init_img_files(int argc, char *argv[])
+{
+ char **fnames;
+ int files_count;
char *outfname;
char *ppd_fname;
struct paper_size_pts paper_size;
struct page_scale scale;
int is_grayscale;
+ char **tmp_fnames;
+ int len;
+ char *tmp_str;
+
int res;
+ int is_err = 0;
int pages_count;
-
+ int i;
if (argc < 15) {
printf("ERROR in init img arguments count\n");
return -1;
}
+ PGEN_DEBUG("argc: %d", argc);
- fname = argv[0];
- outfname = argv[1];
- ppd_fname = argv[2];
+ fnames = argv;
+ files_count = argc - 15;
+ i = argc - 15 - 1;
+ outfname = argv[i + 1];
+ ppd_fname = argv[i + 2];
- paper_size.name = argv[3];
- paper_size.s.x = atof(argv[4]);
- paper_size.s.y = atof(argv[5]);
+ PGEN_DEBUG("files_count: %d", files_count);
+ PGEN_DEBUG("outfname: %s", outfname);
+ PGEN_DEBUG("i: %d", i);
- av_size.x = atoi(argv[6]);
- av_size.y = atoi(argv[7]);
+ paper_size.name = argv[i + 3];
+ paper_size.s.x = atof(argv[i + 4]);
+ paper_size.s.y = atof(argv[i + 5]);
- if (parse_page_orientation(argv[8], &orientation) < 0)
+ av_size.x = atoi(argv[i + 6]);
+ av_size.y = atoi(argv[i + 7]);
+
+ PGEN_DEBUG("orientation: %s", argv[i + 8]);
+ if (parse_page_orientation(argv[i + 8], &orientation) < 0)
return -1;
- n_up = atoi(argv[9]);
+ n_up = atoi(argv[i + 9]);
- if (parse_scale_type(argv[10], &(scale.type)) < 0)
+ PGEN_DEBUG("scale_type");
+ if (parse_scale_type(argv[i + 10], &(scale.type)) < 0)
return -1;
- scale.zoom = atoi(argv[11]);
- scale.w = atof(argv[12]);
- scale.h = atof(argv[13]);
+ scale.zoom = atoi(argv[i + 11]);
+ scale.w = atof(argv[i + 12]);
+ scale.h = atof(argv[i + 13]);
- is_grayscale = atoi(argv[14]);
+ is_grayscale = atoi(argv[i + 14]);
+ if (files_count < 1 || files_count > 9999) {
+ printf("Files count ERROR\n");
+ return -1;
+ }
- /* 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");
+ /* TODO: downscale each image file */
+ /* generate temporary names based on pid */
+ tmp_fnames = (char**)calloc(files_count + 1, sizeof(char*));
+ for (i = 0; i < files_count; ++i) {
+ len = sizeof(PREVIEW_TEMP_DIR
+ "/convert_tmp_XXXXXXXX_XXXX.ppm");
+ tmp_str = (char*)malloc(sizeof(char) * (len + 1));
+ if (NULL == tmp_str) {
+ is_err = 1;
+ break;
+ }
+ tmp_str[len] = '\0';
+ snprintf(tmp_str, len, PREVIEW_TEMP_DIR
+ "/convert_tmp_%08X_%04d.ppm", getpid(), i + 1);
+ tmp_fnames[i] = tmp_str;
+ }
+ if (is_err) {
+ destroy_str_list(tmp_fnames, files_count);
+ PGEN_IF_FREE_MEM(tmp_fnames);
+ printf("ERROR: out of memory\n");
return -1;
}
- res = img2pdf_preview_pages(IMAGE_CONVERT_TEMP_FILE, outfname,
- ppd_fname, &paper_size, &av_size, orientation, n_up,
- &scale, is_grayscale);
+ for (i = 0; i < files_count; ++i) {
+ res = process_image_downscale(
+ fnames[i], tmp_fnames[i], &av_size);
+ if (res < 0) {
+ printf("ERROR in image downscale\n");
+ is_err = 1;
+ break;
+ }
+ }
+ if (is_err) {
+ remove_tmp_files(tmp_fnames, files_count);
+ destroy_str_list(tmp_fnames, files_count);
+ PGEN_IF_FREE_MEM(tmp_fnames);
+ return -1;
+ }
+
+ /* convert to pdf */
+ if (files_count > 1)
+ res = img_files2pdf_preview_pages(tmp_fnames, files_count,
+ outfname, ppd_fname, &paper_size, &av_size,
+ orientation, n_up, &scale, is_grayscale);
+ else
+ res = img2pdf_preview_pages(tmp_fnames[0], outfname, ppd_fname,
+ &paper_size, &av_size, orientation, n_up,
+ &scale, is_grayscale);
+
+ /* remove temporary files */
+ remove_tmp_files(tmp_fnames, files_count);
+ destroy_str_list(tmp_fnames, files_count);
+ PGEN_IF_FREE_MEM(tmp_fnames);
+
if (res < 0) {
printf("ERROR in init img\n");
return -1;
+ } else {
+ PGEN_DEBUG("PDF generation OK");
}
pages_count = get_pdf_pages_count(outfname);
printf("init img: pages count: %d\n", pages_count);
- return 0;
+
+ return res;
}
int is_grayscale;
struct preview_page_req settings_req;
- //struct preview_settings_px settings_px;
int res;
}
+int process_empty_gen(int argc, char *argv[])
+{
+ char *outfname_ppm;
+ struct size_pts paper_size;
+ struct size_px av_size;
+ struct size_px shadow_size;
+ int is_rotate90;
+
+ struct preview_page_req settings_req;
+
+ int res;
+
+
+ if (argc < 8) {
+ printf("ERROR in empty_gen arguments count\n");
+ return -1;
+ }
+
+ outfname_ppm = argv[0];
+
+ paper_size.x = atof(argv[1]);
+ paper_size.y = atof(argv[2]);
+
+ av_size.x = atoi(argv[3]);
+ av_size.y = atoi(argv[4]);
+
+ shadow_size.x = atoi(argv[5]);
+ shadow_size.y = atoi(argv[6]);
+
+ is_rotate90 = atoi(argv[7]);
+
+ 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 = 0;
+
+
+ res = save_empty_preview_page_image(&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) {
return -1;
}
if (strcasecmp("img", argv[2]) == 0)
- return process_init_img(argc - 2, &(argv[3]));
+ return process_init_img_files(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");
if (strcasecmp("pagegen", argv[1]) == 0)
return process_pagegen(argc - 1, &(argv[2]));
+ if (strcasecmp("empty_gen", argv[1]) == 0)
+ return process_empty_gen(argc - 1, &(argv[2]));
+
return 0;
}
int main(int argc, char *argv[])
{
int res;
+ int ret;
+ int errsv;
if (argc <= 1) {
printf("ERROR: no arguments, type help for usage\n");
return 0;
}
- mkdir("/tmp/mobileprint/", 0777);
+ ret = mkdir(PREVIEW_TEMP_DIR, 0777);
+ errsv = errno;
+ if (ret < 0 && errsv != EEXIST) {
+ printf("Failed to mkdir temporary directory " PREVIEW_TEMP_DIR
+ ", errno = %d\n", errsv);
+ return 1;
+ }
evas_init();
res = process_cmd(argc, argv);
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,
+int evas_smart_smsc_set_file(Evas_Object *o, char **const fname,
+ int files_count, 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);
-
+int init_smsc_accessability_support(Evas_Object *o);
+int set_main_view_accessability_info(Evas_Object *o,
+ Evas_Object *layout,
+ const char *access_info,
+ const char *access_type,
+ const char *access_context_info);
+int evas_smart_smsc_calculate_page_number(Evas_Object *o);
+int evas_smart_smsc_get_pages_count(Evas_Object *o);
#endif /* _SMSC_SMART_H_INCLUDED_ */
int show_smsc_widget(struct smsc_widget *widget);
int smsc_widget_set_layout(struct smsc_widget *widget, Evas_Object *layout);
+int move_smsc_widget_pages(struct smsc_widget *widget);
+
#endif /* _SMSC_WIDGET_H_INCLUDED_ */
int clear_smsc_position_settings(struct smsc_position *position)
{
position->is_configured = 0;
+ position->pages_count = -1;
return 0;
}
{
float res;
- if (NULL == position)
- return -1;
+ SMSC_RETV_IF(NULL == position, -1, "Argument error");
+ SMSC_RETV_IF(!position->is_configured, -1, "Position not configured");
/*SMSC_DEBUG("position->offset = %d", position->offset);
SMSC_DEBUG("position->page_size_px.x = %d", position->page_size_px.x);
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;*/
+ Evas_Object *screen_reader_rectangle;
+
int is_ready;
struct size_px widget_size;
int is_process_file;
- char *fname;
+ char **fnames;
+ int files_count;
char *ppd;
struct paper_size_pts paper_size;
enum page_orientation orientation;
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->fnames = NULL;
+ priv->files_count = 0;
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;
+ priv->screen_reader_rectangle = NULL;
_evas_smart_smsc_parent_sc->add(o);
SMSC_TRACE_END;
Evas_Coord x, Evas_Coord y)
{
/* TODO: correct move event usage (provide picture moving animation) */
- /*SMSC_TRACE_BEGIN;
- SMSC_TRACE_END;*/
+ SMSC_TRACE_BEGIN;
+ EVAS_SMART_SMSC_DATA_GET_OR_RETURN(o, priv);
+ priv->widget.off_x = x;
+ priv->widget.off_y = y;
+ move_smsc_widget_pages(&(priv->widget));
+ evas_object_move(priv->widget.loading_animation, x, y);
+ SMSC_TRACE_END;
}
void evas_smart_smsc_free_process_file_args(Evas_Smart_Smsc_Data *priv)
{
+ int i;
SMSC_RET_IF(NULL == priv, "priv is NULL");
- SMSC_IF_FREE_MEM(priv->fname);
+ if (priv->fnames != NULL)
+ for (i = 0; i < priv->files_count; ++i)
+ SMSC_IF_FREE_MEM(priv->fnames[i]);
+ SMSC_IF_FREE_MEM(priv->fnames);
+ priv->files_count = 0;
SMSC_IF_FREE_MEM(priv->ppd);
SMSC_IF_FREE_MEM(priv->paper_size.name);
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->widget.off_x = x;
priv->widget.off_y = y;
+ /* resize rectangle for accessibility support */
+ evas_object_move(priv->screen_reader_rectangle, x, y);
+ evas_object_resize(priv->screen_reader_rectangle, w, h);
+
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,
+ process_preview_engine_file(&(priv->widget.engine),
+ priv->fnames, priv->files_count,
priv->ppd, &(priv->paper_size),
&(priv->widget_size), priv->orientation,
priv->n_up, &(priv->scale), priv->is_grayscale);
}
-int evas_smart_smsc_set_file(Evas_Object *o, const char *fname,
- const char *ppd, const struct paper_size_pts *paper_size,
+int evas_smart_smsc_set_file(Evas_Object *o, char **const fnames,
+ int files_count, 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;
+ int i;
SMSC_TRACE_BEGIN;
+ SMSC_RETV_IF(NULL == o || NULL == fnames || files_count <= 0
+ || NULL == fnames[0] || NULL == ppd
+ || NULL == paper_size || NULL == scale,
+ -1, "Argument error");
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->fnames = malloc(sizeof(char*) * (files_count + 1));
+ SMSC_RETV_IF(NULL == priv->fnames, -1, "Out of memory");
+ memset(priv->fnames, 0, sizeof(char*) * (files_count + 1));
+ for (i = 0; i < files_count; ++i) {
+ priv->fnames[i] = strdup(fnames[i]);
+ if (NULL == priv->fnames[i]) {
+ evas_smart_smsc_free_process_file_args(priv);
+ SMSC_RETV_IF(1, -1, "Out of memory");
+ }
+ }
+ priv->files_count = files_count;
priv->ppd = strdup(ppd);
priv->paper_size = *paper_size;
priv->paper_size.name = strdup(paper_size->name);
priv->is_process_file = 1;
- /* TODO: clear widget */
+ if (NULL == priv->ppd || NULL == priv->paper_size.name) {
+ evas_smart_smsc_free_process_file_args(priv);
+ SMSC_RETV_IF(1, -1, "Out of memory");
+ }
/* 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);
+ priv->fnames, priv->files_count, priv->ppd,
+ &(priv->paper_size), &(priv->widget_size),
+ priv->orientation, priv->n_up, &(priv->scale),
+ priv->is_grayscale);
}
SMSC_TRACE_END;
return res;
}
+//needed to get events MOUSE_IN for correct Screen Reader work
+void smsc_mouse_in_cb(void *data, Evas *evas,
+ Evas_Object *obj, void *event_info)
+{
+ SMSC_TRACE_BEGIN;
+ SMSC_TRACE_END;
+}
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);
+ evas_object_event_callback_add(priv->screen_reader_rectangle, EVAS_CALLBACK_MOUSE_IN,
+ smsc_mouse_in_cb, &(priv->widget));
return 0;
}
+/* transparent rectangle to support Screen Reader */
+int init_smsc_accessability_support(Evas_Object *o)
+{
+ SMSC_TRACE_BEGIN;
+ SMSC_RETV_IF(NULL == o, -1, "Invalid arguments");
+ EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, priv, -1);
+ struct smsc_widget *widget = &(priv->widget);
+
+ SMSC_RETV_IF(NULL == widget || NULL == widget->parent || NULL == widget->canvas, -1,
+ "Can't get widget of object.");
+ if (NULL == priv->screen_reader_rectangle)
+ {
+ priv->screen_reader_rectangle = evas_object_rectangle_add(widget->canvas);
+ SMSC_RETV_IF(NULL == priv->screen_reader_rectangle, -1,
+ "Failed to add rectangle to smart object widget canvas");
+ }
+
+ evas_object_color_set(priv->screen_reader_rectangle, 0, 0, 0, 0);
+ evas_object_smart_member_add(priv->screen_reader_rectangle, widget->parent);
+ evas_object_move(priv->screen_reader_rectangle,
+ priv->widget.off_x, priv->widget.off_y);
+ evas_object_resize(priv->screen_reader_rectangle,
+ priv->widget_size.x,
+ priv->widget_size.y);
+ evas_object_raise(priv->screen_reader_rectangle);
+ evas_object_show(priv->screen_reader_rectangle);
+
+ SMSC_TRACE_END;
+ return 0;
+}
+
+/* rectangle for screen reader creating and registering in access */
+int set_main_view_accessability_info(Evas_Object *o,
+ Evas_Object *layout,
+ const char *access_info,
+ const char *access_type,
+ const char *access_context_info)
+{
+ SMSC_TRACE_BEGIN;
+ EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, priv, -1);
+
+ Evas_Object *ao;
+ ao = elm_access_object_get(priv->screen_reader_rectangle);
+ if (NULL == ao) {
+ ao = elm_access_object_register(priv->screen_reader_rectangle, layout);
+ SMSC_RETV_IF(NULL == ao, -1, "ERROR: Failed to register smsc in access!");
+ }
+ SMSC_DEBUG("Setting main view accessibility info for screen reader: %s", access_info);
+ elm_access_info_set(ao, ELM_ACCESS_INFO, access_info);
+ elm_access_info_set(ao, ELM_ACCESS_TYPE, access_type);
+ elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, access_context_info);
+ SMSC_TRACE_END;
+ return 0;
+}
+
+
+/**
+ * @brief Calculate current page number based on current page offset
+ * @param[in] o Smooth scrolling widget
+ * @return <0 Error (argument error or not initialized)
+ * >=0 Current page number starting from 0
+ */
+int evas_smart_smsc_calculate_page_number(Evas_Object *o)
+{
+ EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, priv, -1);
+ return get_smsc_position_cur_page(&(priv->widget.position));
+}
+
+
+/**
+ * @brief Get pages count
+ * @param[in] o Smooth scrolling widget
+ * return <=0 Error (argument error or not initialized)
+ * >0 Pages count
+ */
+int evas_smart_smsc_get_pages_count(Evas_Object *o)
+{
+ EVAS_SMART_SMSC_DATA_GET_OR_RETURN_VAL(o, priv, -1);
+ SMSC_RETV_IF(!priv->widget.position.is_configured,
+ -1, "Not initialized");
+ return priv->widget.position.pages_count;
+}
#include <page_preview.h>
+#include <previewgen.h>
//#include <pts_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 ")];
+ char img_fname[sizeof(PREVIEW_TEMP_DIR "/mobileprint_xxxx.ppm ")];
/*int w;
int h;
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);
+ sprintf(img_fname, PREVIEW_TEMP_DIR "/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) {
widget->engine.p_model
.pages_state[page_num + 1]);
evas_object_image_file_set(page_data->page_obj,
- SMSC_WIDGET_EMPTY_PAGE_FNAME, NULL);
+ PREVIEW_EMPTY_PAGE_FNAME, NULL);
}
+ //evas_object_image_preload(page_data->page_obj, EINA_FALSE);
//evas_object_color_set(page_data->page_obj, 0, 0, 0, 255);
SMSC_DEBUG("posx = %d,"
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 ")];
+ char img_fname[sizeof(PREVIEW_TEMP_DIR "/mobileprint_xxxx.ppm ")];
struct smsc_page_data* page_data;
SMSC_TRACE_BEGIN;
!= PREVIEW_PAGE_STATE_READY)
return -1;
- sprintf(img_fname,
- "/tmp/mobileprint/mobileprint_%04d.ppm", page_num + 1);
+ sprintf(img_fname, PREVIEW_TEMP_DIR
+ "/mobileprint_%04d.ppm", page_num + 1);
SMSC_DEBUG("page_num = %d", page_num);
EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data)
}
+int move_smsc_widget_pages(struct smsc_widget *widget)
+{
+ int is_ok;
+ int posx;
+ Eina_List *cur_page = NULL;
+ struct smsc_page_data* page_data;
+
+ SMSC_RETV_IF(NULL == widget, -1, "Invalid widget pointer");
+ EINA_LIST_FOREACH(widget->pages_list, cur_page, page_data)
+ if (page_data != NULL) {
+ posx = get_smsc_position_page(&(widget->position),
+ page_data->num, &is_ok);
+ if (is_ok)
+ evas_object_move(page_data->page_obj,
+ posx + widget->off_x,
+ widget->posy);
+ }
+
+ return 0;
+}
+
+
int update_smsc_widget_positions(struct smsc_widget *widget)
{
int *vis_pages;
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);
+ evas_damage_rectangle_add(e, 0, h * 6 / 7, w, h / 7);
SMSC_TRACE_END;
return 0;
//preview_model_debug_print_pages_state(&(widget->engine.p_model));
+ if (widget->engine.p_model.conf.pages_count <= 0)
+ return ECORE_CALLBACK_DONE;
+
/* 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)
+ if (NULL == vis_pages)
return ECORE_CALLBACK_DONE;
for (i = 0; vis_pages[i] >= 0; ++i)
if (widget->engine.p_model.pages_state[vis_pages[i] + 1]
return ECORE_CALLBACK_DONE;
}
-
void smsc_widget_mouse_up_cb(void *data, Evas *evas,
Evas_Object *obj, void *event_info)
{
destroy_smsc_widget_pages(widget);
reset_smsc_control(&(widget->control));
clear_smsc_position_settings(&(widget->position));
+ smsc_widget_update_page_number(widget); /* clear page number */
//show_smsc_widget_loading_animation(widget);
SMSC_TRACE_END;
return 0;
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);
+ /* request empty page image */
+ preview_model_request_empty_page(
+ &(widget->engine.p_model));
+ //update_smsc_widget_loading_animation(widget);
+ break;
+ case PREVIEW_ENGINE_EVENT_EMPTY_PAGE_READY:
preview_model_request_page(&(widget->engine.p_model), 1);
+ /* show empty pages */
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);
+ update_smsc_widget_positions(widget);
+ show_smsc_widget_loading_animation(widget);
break;
case PREVIEW_ENGINE_EVENT_PAGE_READY:
<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"/>
Name: mobileprint
Summary: Library for writing UNIX daemons
-Version: 0.2.17
-Release: 10
+Version: 0.2.21
+Release: 1
Group: System/Libraries
License: Flora Software License
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: gettext-tools
BuildRequires: edje-tools
-#BuildRequires: edje-bin
BuildRequires: sysman-devel
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(elementary)
%post -n org.tizen.mobileprint
chown -R 5000:5000 /opt/%{PREFIX}/data
-# chown -R 5000:5000 %{PREFIX}/cache
%files -n org.tizen.mobileprint
%manifest org.tizen.mobileprint.manifest
%defattr(-,root,root,-)
-#%doc LICENSE
/usr/share/license/org.tizen.mobileprint
%{PREFIX}/*
/opt/%{PREFIX}/*
-#/usr/share/applications/org.tizen.mobileprint.desktop
/usr/share/icons/default/small/org.tizen.mobileprint.png
#for appfw new manifest
/usr/share/packages/org.tizen.mobileprint.xml