#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <liberdm/display.h>
#include <liberdm/connectionMgrConstants.h>
#include <liberregxml/erregapi.h>
#include <libergtk/ergtk.h>
#include <liberipc/eripc.h>
#include <liberipc/eripctoolbar.h>
#include <libermanifest/ermanifest.h>
#include "contentListerLog.h"
#include "erConnect.h"
#include "erMSDisk.h"
#include "system.h"
#include "gtkPincodeScreen.h"
#include "control.h"
#include "control_share.h"
#include "programManager.h"
#include "displayUpdate.h"
#include "viewer.h"
#include "cursor.h"
#include "gtkErrorScreen.h"
#include "button.h"
#include "metadataStoreManager.h"
#include "icons.h"
#include "pagebar.h"
#include "history.h"
#include "erbusy.h"
#include "languages.h"
#include "regValue.h"
#include "toolbar.h"
#include "powerManager.h"
#include "gtkMetadataWnd.h"
#include "pincodeIdleTime.h"
#include "gtkSearchWnd.h"
#include "gtkSortWnd.h"
#include "gtkDistListWnd.h"
#include "timedids.h"
Go to the source code of this file.
<File description>="">
Definition in file control.c.
| typedef void on_item_selected_t(const int *index_tbl, ContentLister *theContentLister) |
| typedef void(* on_tbsync_action_t)(void) |
| static void ctrl_add_on_toolbar_sync_action | ( | on_tbsync_action_t | action | ) | [static] |
Definition at line 2720 of file control.c.
02721 { 02722 int i; 02723 02724 CL_LOGPRINTF("entry"); 02725 g_assert(action != NULL); 02726 02727 for (i = 0; i < sizeof(on_toolbar_sync_actions) / sizeof(on_toolbar_sync_actions[0]); i++) 02728 { 02729 if (on_toolbar_sync_actions[i] == NULL) 02730 { 02731 on_toolbar_sync_actions[i] = action; 02732 return; 02733 } 02734 } 02735 02736 g_assert_not_reached(); 02737 }
| void ctrl_background_connect_timeout_start | ( | gboolean | read_settings | ) |
Definition at line 428 of file control.c.
00429 { 00430 CL_LOGPRINTF("entry: read_settings [%d]", read_settings); 00431 00432 ctrl_background_connect_timeout_start_withinterval(read_settings, FALSE, 0); 00433 }

| static void ctrl_background_connect_timeout_start_withinterval | ( | gboolean | read_settings, | |
| gboolean | immediate, | |||
| gint | interval | |||
| ) | [static] |
Definition at line 375 of file control.c.
00376 { 00377 CL_LOGPRINTF("entry: read_settings [%d] interval [%d]", read_settings, interval); 00378 00379 static gint background_connect_interval = 0; 00380 static gint background_timeout_id = 0; // 0 = initially no timeout running 00381 00382 // read background-connect settings from registry 00383 if (read_settings) 00384 { 00385 regAutoConnect_t* autoconnect_settings = NULL; 00386 00387 // get settings from registry 00388 autoconnect_settings = erRegGetAutoConnect(); 00389 if (autoconnect_settings) 00390 { 00391 // remember settings 00392 g_background_connect_enable = autoconnect_settings->backgroundEnable; 00393 background_connect_interval = autoconnect_settings->backgroundInterval; 00394 CL_WARNPRINTF("registry read: enable [%d] interval [%d]", g_background_connect_enable, background_connect_interval); 00395 g_free(autoconnect_settings); 00396 } 00397 else 00398 { 00399 CL_ERRORPRINTF("no settings from erRegReadAutoconnect"); 00400 } 00401 } 00402 00403 // stop time-out if running 00404 if (background_timeout_id > 0) 00405 { 00406 g_source_remove(background_timeout_id); 00407 background_timeout_id = 0; 00408 } 00409 00410 // start new time-out if requested 00411 if (immediate) 00412 { 00413 interval = 0; 00414 } 00415 else if (interval <= 0) 00416 { 00417 interval = background_connect_interval; 00418 } 00419 if (g_background_connect_enable || immediate) 00420 { 00421 background_timeout_id = g_timeout_add( 100 + (interval * 60 * 1000), 00422 on_idle_connect_start_background, 00423 (gpointer)connect_background); 00424 CL_WARNPRINTF("timeout started, interval [%d] id [%d]", interval, background_timeout_id); 00425 } 00426 }

| void ctrl_battery_low_screen | ( | gint | percentage, | |
| gint | time_left, | |||
| gboolean | shutdown | |||
| ) |
Definition at line 2134 of file control.c.
02135 { 02136 static int ignore_count = 0; 02137 02138 CL_CONTROLPRINTF("entry: percentage [%d] time_left [%d]", percentage, time_left); 02139 02140 // We don't do anything with the battery status at the moment... 02141 02142 if (shutdown && g_errorTypeDisplayed == ctrlBatteryLowError) 02143 { 02144 ctrl_shutdown(); 02145 } 02146 else if ( ctrl_is_connect_from_pincode() 02147 && ignore_count < 2 ) 02148 { 02149 ignore_count++; 02150 } 02151 else 02152 { 02153 ignore_count = 0; 02154 listerShowErrorScreen(ctrlBatteryLowError); 02155 } 02156 }

| int ctrl_before_file_clicked | ( | clDisplayItem_t * | theItem | ) |
Definition at line 3136 of file control.c.
03137 { 03138 CL_LOGPRINTF("entry: szFilename [%s] szFileExt [%s]", theItem->szFilename, theItem->szFileExt); 03139 03140 int ret = -1; // -1 = error, 0 = ok 03141 03142 if (strlen(theItem->szFilename) >= ERMDS_MAX_FILENAME_SIZE) 03143 { 03144 CL_ERRORPRINTF("Filename too long: [%s]", theItem->szFilename); 03145 return ret; 03146 } 03147 03148 // maximum tries for file rename, arbitary value 03149 static const int MAX_COUNT = 5; 03150 char * viewer_id; 03151 03152 int i; 03153 char dirname [ ERMDS_MAX_FILENAME_SIZE ]; 03154 char filename[ ERMDS_MAX_FILENAME_SIZE ]; 03155 char tmp_file[ ERMDS_MAX_FILENAME_SIZE + MAX_COUNT]; 03156 char new_dir [ ERMDS_MAX_FILENAME_SIZE ]; 03157 char new_file[2 * ERMDS_MAX_FILENAME_SIZE ]; 03158 char new_fil2[ ERMDS_MAX_FILENAME_SIZE ]; 03159 03160 // 1. get extname, filename and dirname 03161 char *name = strrchr(theItem->szFilename, '/'); 03162 char *extension = theItem->szFileExt; 03163 if (name == NULL || extension == NULL || strlen(name) <= strlen(extension)) 03164 { 03165 // it must be a fatal error, ignore this file 03166 CL_ERRORPRINTF("No extension or file name error!"); 03167 return ret; 03168 } 03169 name++; 03170 03171 i = strlen(theItem->szFilename) - strlen(name); 03172 strncpy(dirname, theItem->szFilename, i); 03173 dirname[i] = '\0'; 03174 03175 // verify if the path is trusted, otherwise we will *not* create the 03176 // manifest 03177 if (ctrl_is_trusted_path(dirname) == NULL) 03178 { 03179 CL_ERRORPRINTF("The fully qualified path [%s] is not trusted, not creating manifest", dirname); 03180 return ret; 03181 } 03182 03183 // check if for this path we cannot create manifest folders 03184 if (ctrl_not_create_manifest(dirname)) 03185 { 03186 CL_ERRORPRINTF("Configured to not create manifest folder for [%s]", dirname); 03187 return ret; 03188 } 03189 03190 strcpy(filename, name); // including extension 03191 03192 // 2. check. we only handle the file we can handle 03193 if (!ctrl_check_extension(extension)) 03194 { 03195 CL_ERRORPRINTF("Invalid extension: [%s]", extension); 03196 return ret; 03197 } 03198 03199 // 3. create directory and move file if needed 03200 // Determine new directory and filename 03201 sprintf(new_dir, "%s%s", dirname, filename); 03202 sprintf(new_file, "%s%s/%s", dirname, filename, filename); 03203 if (strlen(new_file) >= ERMDS_MAX_FILENAME_SIZE) 03204 { 03205 CL_ERRORPRINTF("Filename too long to make it a container: [%s]", theItem->szFilename); 03206 return ret; 03207 } 03208 // before we create the dir, we need to change the file name 03209 // otherwise the dir will not be created successfully 03210 strcpy(tmp_file, theItem->szFilename); 03211 for(i = 0; i < MAX_COUNT; ++i) 03212 { 03213 strcat(tmp_file, "_"); 03214 if (!ctrl_file_exist(tmp_file)) 03215 { 03216 rename(theItem->szFilename, tmp_file); 03217 break; 03218 } 03219 } 03220 if (MAX_COUNT == i) 03221 { 03222 // could not change filename 03223 CL_ERRORPRINTF("Could not change name to %s", tmp_file); 03224 return ret; 03225 } 03226 // 03227 // create dir now 03228 if (0 != mkdir(new_dir, 0755)) 03229 { 03230 CL_ERRORPRINTF("Can not create directory for this content!"); 03231 rename(tmp_file, theItem->szFilename); 03232 return ret; 03233 } 03234 if (0 != rename(tmp_file, new_file)) 03235 { 03236 // restore the file name and remove dir 03237 rmdir(new_dir); 03238 rename(tmp_file, theItem->szFilename); 03239 CL_ERRORPRINTF("Can not move file!"); 03240 return ret; 03241 } 03242 03243 // if this is Mobipocket, check if there is a *.mbp file with the same name 03244 viewer_id = pm_getUaID(extension); 03245 if (viewer_id && strcmp(viewer_id, "MOBIPOCKET") == 0) 03246 { 03247 struct stat file_stat; 03248 03249 // strip extension 03250 char * tmp; 03251 char * fname = strdup(filename); 03252 tmp = strrchr(fname, '.'); 03253 if (tmp) *tmp = '\0'; 03254 03255 snprintf(tmp_file, sizeof(tmp_file), "%s%s.%s", dirname, fname, "mbp"); 03256 snprintf(new_fil2, sizeof(new_fil2), "%s%s/%s.%s", dirname, filename, fname, "mbp"); 03257 free(fname); 03258 if (stat(tmp_file, &file_stat) == 0 && S_ISREG(file_stat.st_mode)) 03259 { 03260 CL_CONTROLPRINTF("Going to rename %s to %s", tmp_file, new_fil2); 03261 if (rename(tmp_file, new_fil2) != 0) 03262 { 03263 unlink(tmp_file); 03264 CL_ERRORPRINTF("Could not move %s, deleted it instead!", tmp_file); 03265 } 03266 } 03267 } 03268 03269 // update the file name, so that it can be open successfully 03270 strncpy(theItem->szFilename, new_file, ERMDS_MAX_FILENAME_SIZE); 03271 03272 // 4. create the manifest file 03273 ctrl_create_manifest(theItem, new_dir, filename); 03274 03275 // 5. change item to mdsFitContainer 03276 theItem->fit = mdsFitContainer; 03277 03278 ret = 0; 03279 return ret; 03280 }

| gboolean ctrl_check_extension | ( | const char * | extension | ) | [static] |
Definition at line 3283 of file control.c.
03284 { 03285 // for the following file, we can handle them directly. temp solution 03286 static const char *ext_table[] = { 03287 "pdf", 03288 "xeb", 03289 "eba", 03290 "prc", 03291 "pdb", 03292 "mobi" 03293 }; 03294 03295 const int size = sizeof(ext_table) / sizeof(ext_table[0]); 03296 03297 int i = 0; 03298 for (; i < size; ++i) 03299 { 03300 if (0 == strcasecmp(extension, ext_table[i])) 03301 return TRUE; 03302 } 03303 return FALSE; 03304 }
| void ctrl_cleanup_download_history | ( | void | ) |
Definition at line 1979 of file control.c.
01980 { 01981 char dirname[ERMDS_MAX_FILENAME_SIZE]; 01982 01983 if ( mdsGetRootLocation(st_DownloadHistory, dirname, sizeof(dirname)) > 0 ) 01984 { 01985 // remove dangling symlinks 01986 hsCleanupSymlinks(dirname); 01987 01988 // restrict the number of symlinks 01989 hsLimitSymlinks(dirname, MAX_DOWNLOAD_ITEMS); 01990 } 01991 }

| void ctrl_connect | ( | connectScr_e | screen, | |
| e_ctrl_connect_reason_t | reason | |||
| ) |
Definition at line 1755 of file control.c.
01756 { 01757 CL_LOGPRINTF("entry: reason [%d]", reason); 01758 01759 gboolean use_last_connected = FALSE; 01760 gboolean background = FALSE; 01761 gboolean content_only = FALSE; 01762 gchar* content_uuid = NULL; 01763 gboolean from_pincode_screen = FALSE; 01764 gboolean force_ids = FALSE; 01765 gboolean after_reboot = FALSE; 01766 01767 switch (reason) 01768 { 01769 case connect_manual: 01770 break; 01771 case connect_background: 01772 use_last_connected = TRUE; 01773 background = TRUE; 01774 content_only = TRUE; 01775 break; 01776 case connect_from_pincode: 01777 use_last_connected = TRUE; 01778 content_only = TRUE; 01779 content_uuid = "reset-pin-code"; 01780 from_pincode_screen = TRUE; 01781 force_ids = TRUE; 01782 break; 01783 case connect_after_reboot: 01784 use_last_connected = TRUE; 01785 force_ids = TRUE; 01786 after_reboot = TRUE; 01787 break; 01788 case connect_timed_ids_with_sw: 01789 force_ids = TRUE; 01790 break; 01791 case connect_timed_ids_content_only: 01792 content_only = TRUE; 01793 force_ids = TRUE; 01794 break; 01795 case connect_timed_ids_background: 01796 use_last_connected = TRUE; 01797 background = TRUE; 01798 content_only = TRUE; 01799 force_ids = TRUE; 01800 break; 01801 default: 01802 CL_ERRORPRINTF("Illegal reason [%d]", reason); 01803 return; 01804 } 01805 01806 if ( gContentLister->currentError == ctrlNoError 01807 && connectStruct.state == connectStateIdle ) 01808 { 01809 // Show toolbar icon "connected" 01810 toolbar_setIconState(iconID_connect, iconState_selected); 01811 01812 // Put contentlister on top 01813 if ( background ) 01814 { 01815 toolbar_synchronise(); 01816 } 01817 else 01818 { 01819 const char* UaOnTop = pm_getUaOnTop(); 01820 CL_CONTROLPRINTF("UaOnTop = %s", UaOnTop); 01821 if ((strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 01822 { 01823 // contentLister not "On Top" => show contentlister 01824 CL_CONTROLPRINTF("CL NOT on top - current type was = %d", gContentLister->currentContentType); 01825 pm_RaiseContentLister(); 01826 } 01827 setListerState(STATE_DOWNLOADMGR); 01828 pm_setUaOnTop(PROFILES_APP); // set connection mgr as application-on-top, so key events will be sent here 01829 toolbar_restore(); 01830 } 01831 01832 // Block USB connect while connectionMgr running 01833 erStopMSDiskApp(); 01834 01835 // Start the connectionMgr, 01836 // who connects to the IDS server 01837 // end then starts the downloadMgr 01838 snprintf( connectStruct.szCommand, 01839 sizeof(connectStruct.szCommand), 01840 "%s%s%s%s%s%s%s%s", 01841 CONNECTIONMGR_EXECUTABLE, 01842 use_last_connected ? " --use-last-connected" : "", 01843 background ? " --background" : "", 01844 content_only ? " --content-only" : "", 01845 content_uuid ? " --content-uuid " : "", 01846 content_uuid ? content_uuid : "", 01847 force_ids ? " --connect-ids" : "", 01848 after_reboot ? " --connect-after-reboot" : "" ); 01849 01850 connectStruct.screen = screen; 01851 connectStruct.background = background; 01852 connectStruct.connect_from_pincode = from_pincode_screen; 01853 connectStruct.connect_after_reboot = after_reboot; 01854 connectStruct.command = connectCmdStart; 01855 pthread_mutex_unlock( &(connectStruct.mutex) ); 01856 } 01857 else 01858 { 01859 CL_SCREENPRINTF("cannot connect now"); 01860 display_update_request_screen_refresh(MAIN_WINDOW_EXPOSE_LEVEL); 01861 } 01862 }

| void ctrl_connect_back_to_pincode_screen | ( | void | ) |
Definition at line 3799 of file control.c.
03800 { 03801 ContentLister *theContentLister = gContentLister; 03802 char *UaOnTop = NULL; 03803 showPincodeReason_t reason; 03804 03805 g_return_if_fail(NULL != theContentLister); 03806 g_return_if_fail(NULL != theContentLister->pincodeScreen); 03807 03808 // set contentliser to STATE_PINCODE 03809 setListerState(STATE_PINCODE); 03810 03811 // when finishing downloading reset pincode, we should continue accumulate_idle_time 03812 03813 // re-read pincode from sysset 03814 // from pincode screen user can connect to iDS and download a pincode reset package 03815 ctrl_pincode_setting_init(); 03816 03817 reason = gtk_pincode_screen_get_reason(theContentLister->pincodeScreen); 03818 if (reason != startup_t) 03819 { 03820 UaOnTop = pm_getUaOnTop(); 03821 CL_CONTROLPRINTF("UaOnTop = %s", UaOnTop); 03822 if ((strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 03823 { 03824 // contentLister not "On Top" => show contentlister 03825 CL_CONTROLPRINTF("CL NOT on top"); 03826 pm_RaiseContentLister(); 03827 } 03828 } 03829 03830 display_update_request_screen_refresh(MAIN_WINDOW_EXPOSE_LEVEL); 03831 }

| void ctrl_connect_button_clicked | ( | void | ) |
Definition at line 1744 of file control.c.
01745 { 01746 CL_LOGPRINTF("entry"); 01747 01748 // stop background connect, to avoid conflicts 01749 ctrl_disconnect_wait(); 01750 01751 // connect to iDS 01752 ctrl_connect(connectScrDownloadHistory, connect_manual); 01753 }

| void ctrl_contentType_button_clicked | ( | st_ContentType_e | type | ) |
category button selected
| data | - reference contentLister data |
Definition at line 1650 of file control.c.
01651 { 01652 ContentLister *theContentLister = gContentLister; 01653 clDisplayItem_t theItem; 01654 const gboolean cl_OnTop = (strcmp(pm_getUaOnTop(), CONTENTLISTER_UAID) == 0) ? TRUE : FALSE; 01655 const gboolean dm_OnTop = (strcmp(pm_getUaOnTop(), PROFILES_APP ) == 0) ? TRUE : FALSE; 01656 char *location; 01657 01658 // check whether contentlister is visible 01659 CL_CONTROLPRINTF("entry: theContentLister [%p] type [%d] UaOnTop [%s]", theContentLister, theContentType, pm_getUaOnTop()); 01660 if ( !cl_OnTop ) 01661 { 01662 // contentLister not "On Top" => scan current content and show contentlister 01663 CL_CONTROLPRINTF("CL NOT on top - current type was = %d", theContentLister->currentContentType); 01664 01665 theContentLister->previousContentType = theContentLister->currentContentType; 01666 theContentLister->currentContentType = theContentType; 01667 // change acording to design, do not record history 01668 stackClear(theContentType); 01669 01670 pm_RaiseContentLister(); 01671 01672 if (dm_OnTop) 01673 { 01674 // This scan_content only needed after download manager, 01675 // because the sigchld handler already rescans (see programMgr.c) 01676 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01677 } 01678 } 01679 else 01680 { 01681 // contentLister is "On Top" 01682 if (theContentType != theContentLister->currentContentType) 01683 { 01684 // contentLister "On Top" but different contentType => scan 01685 // new contentType 01686 CL_CONTROLPRINTF 01687 ("CL on top - current type (%d) != theContentType (%d)", 01688 theContentLister->currentContentType, theContentType); 01689 01690 if (getListerState() == STATE_MISC) 01691 { 01692 ctrl_hide_misc_screen(); 01693 } 01694 ctrl_select_stop(TRUE); 01695 01696 theContentLister->previousContentType = theContentLister->currentContentType; 01697 theContentLister->currentContentType = theContentType; 01698 // change acording to design, do not record history 01699 stackClear(theContentType); 01700 01701 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01702 } 01703 else if (theContentLister->currentError != ctrlNoError) 01704 { 01705 CL_CONTROLPRINTF("currentError %d", theContentLister->currentError); 01706 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01707 } 01708 else if (g_select.active) 01709 { 01710 ctrl_select_stop(TRUE); 01711 toolbar_synchronise(); 01712 } 01713 else if (getListerState() == STATE_MISC) 01714 { 01715 ctrl_hide_misc_screen(); 01716 } 01717 else 01718 { 01719 CL_CONTROLPRINTF("CL on top - current type (%d) == theContentType", theContentLister->currentContentType); 01720 01721 CL_HISTORYPRINTF("Goto last read content of the contentType %d", theContentType); 01722 01723 hsGetItem(theContentType, &theItem); 01724 location = hsGetLocation(theContentType); 01725 01726 CL_HISTORYPRINTF("hsGetLocation (for %d) returned %s", 01727 theContentType, (location == NULL) ? "NULL" : location); 01728 01729 if (ctrl_start_viewer(theContentLister->currentContentType, &theItem, location) == FALSE) 01730 { 01731 CL_CONTROLPRINTF("ctrl_start_viewer returned FALSE"); 01732 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01733 } 01734 01735 if (location) 01736 { 01737 g_free(location); 01738 location = NULL; 01739 } 01740 } 01741 } 01742 }

| gboolean ctrl_create_manifest | ( | clDisplayItem_t * | theItem, | |
| const char * | dir, | |||
| const char * | name | |||
| ) | [static] |
Definition at line 3312 of file control.c.
03313 { 03314 char pathName[ERMDS_MAX_FILENAME_SIZE] = {0}; 03315 03316 // remember manifest name 03317 int nPathLength = g_snprintf(pathName, ERMDS_MAX_FILENAME_SIZE, "%s/" MANIFEST_FILENAME, dir); 03318 if (nPathLength > ERMDS_MAX_FILENAME_SIZE) 03319 { 03320 CL_ERRORPRINTF("manifest path name is too long: %d\n", nPathLength); 03321 return FALSE; 03322 } 03323 strcpy(theItem->szManifest, pathName); 03324 03325 // call lib/ermanifest to create a xml file 03326 erManifest manifest; 03327 int ret = RET_ERR; 03328 ret = ermXmlCreateManifest(dir, &manifest); 03329 if (ret == RET_ERR) 03330 { 03331 CL_ERRORPRINTF("Could not create xml manifest file!\n"); 03332 return FALSE; 03333 } 03334 03335 ermXmlNewString(&manifest, "/", "package", ""); 03336 ermXmlNewString(&manifest, "/package", "metadata", ""); 03337 03338 // dc-metadata 03339 ermXmlNewString(&manifest, "/package/metadata", "dc-metadata", ""); 03340 ermXmlNewString(&manifest, "/package/metadata/dc-metadata", "Title", name); 03341 ermXmlNewString(&manifest, "/package/metadata/dc-metadata", "Description", ""); 03342 ermXmlNewString(&manifest, "/package/metadata/dc-metadata", "Date", theItem->szDate); 03343 03344 // y-metadata 03345 ermXmlNewString(&manifest, "/package/metadata", "y-metadata", ""); 03346 03347 // startpage serves as an entry point for app. 03348 ermXmlNewString(&manifest, "/package/metadata/y-metadata", "startpage", name); 03349 03350 ermXmlNewString(&manifest, "/package/metadata/y-metadata", "version", "000"); 03351 03352 // save 03353 ermXmlSaveAndClose(&manifest); 03354 03355 return TRUE; 03356 }

| static gboolean ctrl_current_location_is_empty | ( | void | ) | [static] |
Definition at line 3544 of file control.c.
03545 { 03546 CL_CONTROLPRINTF("empty"); 03547 03548 if (gContentLister && gContentLister->itemCount > 0) 03549 { 03550 return FALSE; 03551 } 03552 else 03553 { 03554 CL_CONTROLPRINTF("Current location is empty."); 03555 return TRUE; 03556 } 03557 }
| gboolean ctrl_current_location_is_mobipocket | ( | void | ) | [static] |
Definition at line 3493 of file control.c.
03494 { 03495 char location[ERMDS_MAX_FILENAME_SIZE]; 03496 char * cp; 03497 03498 location[0] = '\0'; 03499 stItem_t *pItem = stackPeek(gContentLister->currentContentType); 03500 if (pItem != NULL) 03501 { 03502 mdsDirectory_t *directory = &g_array_index(pItem->dirArray, mdsDirectory_t, 0); 03503 if (directory) 03504 { 03505 strncpy(location, directory->szFilename, sizeof(location)); 03506 } 03507 else 03508 { 03509 return FALSE; 03510 } 03511 } 03512 else 03513 { 03514 return FALSE; 03515 } 03516 03517 cp = &location[0]; 03518 03519 CL_CONTROLPRINTF("check location: [%s]", cp); 03520 03521 // TODO: We could use a simple 03522 // return ctrl_not_create_manifest(location); 03523 // here. Is this what we want? 03524 03525 if (strlen(location) > strlen(MOBIPOCKET_FOLDER)) 03526 { 03527 cp += (strlen(location) - strlen(MOBIPOCKET_FOLDER)); 03528 } 03529 03530 CL_CONTROLPRINTF("found: [%s]", cp); 03531 03532 if (strcmp(cp, MOBIPOCKET_FOLDER) == 0) 03533 { 03534 return TRUE; 03535 } 03536 else 03537 { 03538 return FALSE; 03539 } 03540 }

| gboolean ctrl_current_location_is_outbox | ( | void | ) | [static] |
Definition at line 3483 of file control.c.
03484 { 03485 const char* location = ctrl_get_current_location(gContentLister); 03486 03487 return ctrl_location_is_outbox(location); 03488 }

| void ctrl_disconnect | ( | connectScr_e | screen | ) |
Definition at line 1864 of file control.c.
01865 { 01866 CL_LOGPRINTF("entry: screen [%d]", screen); 01867 01868 if (connectStruct.state == connectStateConnected) 01869 { 01870 connectStruct.screen = screen; 01871 connectStruct.command = connectCmdStop; 01872 } 01873 }
| void ctrl_disconnect_wait | ( | void | ) |
Definition at line 1875 of file control.c.
01876 { 01877 CL_LOGPRINTF("entry"); 01878 01879 ctrl_disconnect(connectStruct.screen); 01880 01881 while (connectStruct.state != connectStateIdle) 01882 { 01883 CL_WARNPRINTF("Waiting for connectStateIdle [%d], current state [%d]", connectStateIdle, connectStruct.state); 01884 sleep(1); 01885 } 01886 }

| void ctrl_display_download_history | ( | void | ) |
Definition at line 1946 of file control.c.
01947 { 01948 ContentLister *theContentLister = gContentLister; 01949 char *UaOnTop; 01950 01951 CL_CONTROLPRINTF("entry 0x%x", (unsigned int)theContentLister); 01952 01953 // back to the download history menu 01954 CL_CONTROLPRINTF("Back to the download history menu"); 01955 theContentLister->previousContentType = theContentLister->currentContentType; 01956 theContentLister->currentContentType = st_DownloadHistory; 01957 if (g_new_content_received) 01958 { 01959 g_new_content_acknowledged = TRUE; 01960 } 01961 01962 ctrl_cleanup_download_history(); 01963 01964 // reset the st_DownloadHistory stack 01965 stackClear(theContentLister->currentContentType); 01966 // always display the first page 01967 mdsSetIndex(theContentLister->currentContentType, 0); 01968 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01969 UaOnTop = pm_getUaOnTop(); 01970 CL_CONTROLPRINTF("UaOnTop = %s", UaOnTop); 01971 if ((strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 01972 { 01973 // contentLister not "On Top" => show contentlister 01974 CL_CONTROLPRINTF("CL NOT on top"); 01975 pm_RaiseContentLister(); 01976 } 01977 }

| static void ctrl_display_item_view | ( | ContentLister * | theContentLister | ) | [static] |
Update the page content and the pagebar with the updated contentlister data:
| contentLister | reference contentLister data |
Definition at line 1179 of file control.c.
01180 { 01181 char page_title[ERCL_MAX_TITLE_SIZE]; 01182 01183 CL_CONTROLPRINTF("entry"); 01184 01185 if (theContentLister) 01186 { 01187 switch (theContentLister->currentContentType) 01188 { 01189 case st_ContentTypeBooks: 01190 case st_ContentTypeNews: 01191 case st_ContentTypeDocs: 01192 case st_ContentTypeNotes: 01193 case st_StorageTypeMain: // MAIN MEMORY 01194 case st_StorageTypeCF: // Should check if filesystem is readonly, but how? 01195 case st_StorageTypeSD: // Should check if filesystem is readonly, but how? 01196 case st_StorageTypeUSB: // Should check if filesystem is readonly, but how? 01197 toolbar_disableUpdate(); 01198 // Custom toolbar states for certain special folders 01199 if ( ctrl_current_location_is_empty() ) 01200 { 01201 toolbar_setIconState(iconID_trashcan, iconState_grey); 01202 } 01203 else 01204 { 01205 toolbar_setIconState(iconID_trashcan, iconState_normal); 01206 } 01207 01208 if ( ctrl_current_location_is_mobipocket() 01209 || ctrl_current_location_is_outbox() 01210 || ctrl_current_location_is_empty() ) 01211 { 01212 toolbar_setIconState(iconID_share, iconState_grey ); 01213 toolbar_setIconState(iconID_tagging, iconState_grey ); 01214 } 01215 else 01216 { 01217 toolbar_setIconState(iconID_share, iconState_normal); 01218 toolbar_setIconState(iconID_tagging, iconState_normal); 01219 } 01220 01221 if ( ctrl_current_location_is_outbox() || ctrl_current_location_is_empty() ) 01222 { 01223 toolbar_setIconState(iconID_search, iconState_grey ); 01224 toolbar_setIconState(iconID_sort, iconState_grey ); 01225 } 01226 else 01227 { 01228 toolbar_setIconState(iconID_search, iconState_normal); 01229 toolbar_setIconState(iconID_sort, iconState_normal); 01230 } 01231 01232 toolbar_enableUpdate(); 01233 break; 01234 01235 case st_MenuTypeMode: 01236 case st_DownloadHistory: 01237 case st_RecentDocuments: 01238 toolbar_disableUpdate(); 01239 toolbar_setIconState(iconID_search, iconState_grey); 01240 toolbar_setIconState(iconID_sort, iconState_grey); 01241 toolbar_setIconState(iconID_share, iconState_grey); 01242 toolbar_setIconState(iconID_tagging, iconState_grey); 01243 toolbar_setIconState(iconID_trashcan, iconState_grey); 01244 toolbar_enableUpdate(); 01245 break; 01246 01247 case st_SearchResult: 01248 toolbar_disableUpdate(); 01249 toolbar_setIconState(iconID_trashcan, iconState_grey ); 01250 toolbar_setIconState(iconID_tagging, iconState_grey ); 01251 if ( ctrl_current_location_is_empty() ) 01252 { 01253 toolbar_setIconState(iconID_search, iconState_grey); 01254 } 01255 else 01256 { 01257 toolbar_setIconState(iconID_search, iconState_normal); 01258 } 01259 toolbar_setIconState(iconID_sort, iconState_grey); 01260 toolbar_setIconState(iconID_share, iconState_grey ); 01261 toolbar_enableUpdate(); 01262 break; 01263 01264 default: 01265 CL_ERRORPRINTF("Unknown currentContentType: %d", theContentLister->currentContentType); 01266 toolbar_disableUpdate(); 01267 toolbar_setIconState(iconID_search, iconState_grey); 01268 toolbar_setIconState(iconID_sort, iconState_grey); 01269 toolbar_setIconState(iconID_share, iconState_grey); 01270 toolbar_setIconState(iconID_tagging, iconState_grey); 01271 toolbar_setIconState(iconID_trashcan, iconState_grey); 01272 toolbar_enableUpdate(); 01273 } 01274 01275 // hide cursor for outbox 01276 if (ctrl_current_location_is_outbox()) 01277 { 01278 ctrl_listItem_focus(-1, theContentLister); 01279 } 01280 01281 ctrl_get_content_name(theContentLister->currentContentType, page_title); 01282 01283 // get current location information. display location in title bar 01284 const char* location; 01285 if (theContentLister->currentContentType == st_DownloadHistory) 01286 { 01287 location = ""; 01288 } 01289 else 01290 { 01291 location = ctrl_get_current_location(theContentLister); 01292 } 01293 lsUpdatePage(theContentLister->lister, theContentLister->items, 01294 theContentLister->itemCount, theContentLister->currentFocus, page_title, location); 01295 01296 pagebar_reset(); // a little overkill, but this ensures the 01297 // pageBar always has the correct 01298 // currentApp 01299 pagebar_set_pagecount(theContentLister->pagecount); 01300 pagebar_goto_page(theContentLister->currentPage); 01301 pagebar_redraw(); 01302 } 01303 else 01304 { 01305 CL_ERRORPRINTF("theContentLister == NULL"); 01306 } 01307 }

| static void ctrl_display_recent_documents | ( | ) | [static] |
Definition at line 4452 of file control.c.
04453 { 04454 CL_CONTROLPRINTF("entry"); 04455 04456 ContentLister *theContentLister = gContentLister; 04457 char *UaOnTop = NULL; 04458 04459 g_return_if_fail(NULL != theContentLister); 04460 04461 // Start in recent-documents 04462 theContentLister->previousContentType = st_MenuTypeMode; 04463 theContentLister->currentContentType = st_RecentDocuments; 04464 04465 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 04466 04467 UaOnTop = pm_getUaOnTop(); 04468 04469 CL_CONTROLPRINTF("UaOnTop = %s", UaOnTop); 04470 04471 if ( (NULL != UaOnTop) && (0 != strlen(UaOnTop)) 04472 && (strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 04473 { 04474 // contentLister not "On Top" => show contentlister 04475 CL_CONTROLPRINTF("CL NOT on top"); 04476 pm_RaiseContentLister(); 04477 } 04478 04479 CL_CONTROLPRINTF("leave"); 04480 }

| static void ctrl_display_reference_materials | ( | void | ) | [static] |
Definition at line 4398 of file control.c.
04399 { 04400 CL_CONTROLPRINTF("entry"); 04401 int index; 04402 04403 ContentLister *theContentLister = gContentLister; 04404 04405 // first scan mode 04406 ctrl_mode_button_clicked(); 04407 04408 if (theContentLister->itemCount > 0) 04409 { 04410 for (index = 0; index < theContentLister->itemCount; index++) 04411 { 04412 if (strstr(theContentLister->items[index].szManifest, MODE_MENU_REFERENCE_MATERIALS_DIRNAME) != NULL) 04413 { 04414 CL_WARNPRINTF("The index of reference materials is %d", index); 04415 // scan reference materials 04416 ctrl_listItem_clicked(index, theContentLister); 04417 break; 04418 } 04419 } 04420 } 04421 04422 // If not found, do nothing 04423 04424 CL_CONTROLPRINTF("leave"); 04425 }

| void ctrl_display_search_result | ( | void | ) |
Definition at line 3092 of file control.c.
03093 { 03094 CL_SEARCHPRINTF("entry"); 03095 03096 gContentLister->previousContentType = gContentLister->currentContentType; 03097 gContentLister->currentContentType = st_SearchResult; 03098 03099 // reset the st_SearchResult stack, always display the first page 03100 stackClear(gContentLister->currentContentType); 03101 mdsSetIndex(gContentLister->currentContentType, 0); 03102 ctrl_scan_content(gContentLister, ctrlScanCurrent, NULL); 03103 03104 char *UaOnTop = pm_getUaOnTop(); 03105 CL_SEARCHPRINTF("UaOnTop = %s", UaOnTop); 03106 if ((strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 03107 { 03108 // contentLister not "On Top" => show contentlister 03109 CL_SEARCHPRINTF("CL NOT on top"); 03110 pm_RaiseContentLister(); 03111 } 03112 }

| static guint ctrl_errorScreen_buttonpress | ( | GtkWidget * | widget, | |
| GdkEventButton * | event, | |||
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 2178 of file control.c.
02181 { 02182 CL_CONTROLPRINTF("entry"); 02183 02184 if ( g_errorTypeDisplayed == ctrlConnectedUSBError 02185 || g_errorTypeDisplayed == ctrlSystemShutdownError ) 02186 { 02187 CL_WARNPRINTF("Ignore button-press while USB or shutdown screen shown"); 02188 return 1; // TRUE => no further processing 02189 } 02190 02191 erbusy_blink(); 02192 02193 if (g_shutdownPending && g_errorTypeDisplayed == ctrlBatteryLowError && is_battery_charging() == FALSE) 02194 { 02195 ctrl_shutdown(); 02196 } 02197 else if (g_listerState == STATE_USB_CONNECTED) 02198 { 02199 listerShowErrorScreen(ctrlConnectedUSBError); 02200 } 02201 else 02202 { 02203 listerHideErrorScreen(); 02204 } 02205 02206 return 0; // FALSE => default GTK handling 02207 }

| gboolean ctrl_file_exist | ( | const char * | pathName | ) | [static] |
| const char* ctrl_get_abscurr_location | ( | char * | sPath, | |
| int | iSize | |||
| ) |
Definition at line 3451 of file control.c.
03452 { 03453 memset(sPath, 0, iSize); 03454 if (0 >= mdsGetRootLocation(gContentLister->currentContentType, sPath, iSize)) 03455 { 03456 return sPath; 03457 } 03458 03459 stItem_t *pItem = stackPeek(gContentLister->currentContentType); 03460 if (NULL != pItem) 03461 { 03462 mdsDirectory_t *directory = &g_array_index(pItem->dirArray, mdsDirectory_t, 0); 03463 if (directory) 03464 { 03465 return directory->szFilename; 03466 } 03467 } 03468 return sPath; 03469 }

| static void ctrl_get_content_name | ( | st_ContentType_e | theType, | |
| char * | name | |||
| ) | [static] |
Definition at line 2012 of file control.c.
02013 { 02014 if (name) 02015 { 02016 switch (theType) 02017 { 02018 case st_ContentTypeBooks: 02019 strcpy(name, _("Books")); 02020 break; 02021 case st_ContentTypeNews: 02022 strcpy(name, _("Newspapers")); 02023 break; 02024 case st_ContentTypeDocs: 02025 strcpy(name, _("Documents")); 02026 break; 02027 case st_ContentTypeNotes: 02028 strcpy(name, _("Notes")); 02029 break; 02030 case st_StorageTypeCF: 02031 strcpy(name, _("CF")); 02032 break; 02033 case st_StorageTypeSD: 02034 strcpy(name, _("MMC")); 02035 break; 02036 case st_StorageTypeUSB: 02037 strcpy(name, _("USB")); 02038 break; 02039 case st_StorageTypeMain: 02040 strcpy(name, _("Internal Memory")); 02041 break; 02042 case st_MenuTypeMode: 02043 strcpy(name, _("Device Manager")); 02044 break; 02045 case st_DownloadHistory: 02046 strcpy(name, _("Download History")); 02047 break; 02048 case st_SearchResult: 02049 strcpy(name, _("Search Results")); 02050 break; 02051 case st_RecentDocuments: 02052 strcpy(name, _("Recent Documents")); 02053 break; 02054 default: 02055 strcpy(name, _("Unknown")); 02056 break; 02057 } 02058 } 02059 }
| const char * ctrl_get_current_location | ( | ContentLister * | theContentLister | ) | [static] |
Definition at line 3419 of file control.c.
03420 { 03421 CL_CONTROLPRINTF("entry: contentType [%d]", theContentLister->currentContentType); 03422 03423 char root[ERMDS_MAX_FILENAME_SIZE] = { 0 }; 03424 if (0 >= mdsGetRootLocation(theContentLister->currentContentType, root, ERMDS_MAX_FILENAME_SIZE)) 03425 { 03426 return NULL; 03427 } 03428 03429 stItem_t *pItem = stackPeek(theContentLister->currentContentType); 03430 if (NULL == pItem) 03431 { 03432 // no stack item -> report top directory 03433 return ""; 03434 } 03435 else 03436 { 03437 // stack item found -> report its path 03438 mdsDirectory_t *directory = &g_array_index(pItem->dirArray, mdsDirectory_t, 0); 03439 if (directory) 03440 { 03441 if (strstr(directory->szFilename, root)) 03442 { 03443 return (directory->szFilename + strlen(root)); 03444 } 03445 } 03446 } 03447 return NULL; 03448 }

| unsigned int ctrl_get_item_index | ( | ContentLister * | theContentLister | ) |
Definition at line 1050 of file control.c.
01051 { 01052 unsigned int itemIndex; 01053 int pageIndex; 01054 01055 pageIndex = (theContentLister->currentPage - 1); 01056 if (pageIndex < 0) 01057 { 01058 pageIndex = 0; 01059 } 01060 01061 itemIndex = (pageIndex * MAX_ITEMS_ON_ONE_PAGE); 01062 if (itemIndex >= 0) 01063 { 01064 itemIndex += theContentLister->currentFocus; 01065 } 01066 01067 CL_CURSORPRINTF ("item index %d (current page %d, pageindex %d, currentFocus %d)", 01068 itemIndex, theContentLister->currentPage, 01069 pageIndex, theContentLister->currentFocus); 01070 01071 return itemIndex; 01072 }
| st_ContentType_e ctrl_get_storageType | ( | gchar * | szExtID | ) |
Definition at line 1022 of file control.c.
01023 { 01024 st_ContentType_e theType = st_ContentTypeUndefined; 01025 01026 if (strncmp(szExtID, CF_ID, ERMDS_MAX_EXTENSION_ID_SIZE) == 0) 01027 { 01028 theType = st_StorageTypeCF; 01029 } 01030 else if (strncmp(szExtID, SD_ID, ERMDS_MAX_EXTENSION_ID_SIZE) == 0) 01031 { 01032 theType = st_StorageTypeSD; 01033 } 01034 else if (strncmp(szExtID, USB_ID, ERMDS_MAX_EXTENSION_ID_SIZE) == 0) 01035 { 01036 theType = st_StorageTypeUSB; 01037 } 01038 else if (strncmp(szExtID, MAIN_MEMORY_ID, ERMDS_MAX_EXTENSION_ID_SIZE) == 0) 01039 { 01040 theType = st_StorageTypeMain; 01041 } 01042 else if (strncmp(szExtID, RECENT_DOCS_ID, ERMDS_MAX_EXTENSION_ID_SIZE) == 0) 01043 { 01044 theType = st_RecentDocuments; 01045 } 01046 01047 return theType; 01048 }
| int ctrl_goto_item | ( | const gchar * | szFilename | ) | [static] |
Definition at line 1572 of file control.c.
01573 { 01574 CL_SCREENPRINTF("entry: filename [%s]", szFilename); 01575 01576 int startindex; 01577 int req_cnt = MAX_ITEMS_ON_ONE_PAGE; 01578 ContentLister *theContentLister = gContentLister; 01579 01580 // find index for specified file 01581 int index = mdsGetItemIndex(szFilename); 01582 if (index < 0) 01583 { 01584 CL_WARNPRINTF("Cannot find filename [%s]", szFilename); 01585 index = 0; 01586 } 01587 // display and select the specified file 01588 int pagenumber = (index / MAX_ITEMS_ON_ONE_PAGE) + 1; 01589 int pageindex = index % MAX_ITEMS_ON_ONE_PAGE; 01590 if ((pagenumber > 0) && (pagenumber <= theContentLister->pagecount)) 01591 { 01592 // select the correct page 01593 theContentLister->currentPage = pagenumber; 01594 startindex = MAX_ITEMS_ON_ONE_PAGE * (pagenumber - 1); 01595 01596 // retrieve new page content 01597 mdsSetPageContent(theContentLister->items, startindex, &req_cnt); 01598 theContentLister->itemCount = req_cnt; 01599 01600 // select the correct item on this page 01601 g_assert(pageindex < theContentLister->itemCount); 01602 theContentLister->currentFocus = pageindex; 01603 } 01604 // and finally display this page 01605 ctrl_display_item_view(theContentLister); 01606 return 0; 01607 }

| void ctrl_goto_page | ( | int | pagenumber | ) |
Jump to the specified page number, in case the page number is invalid keep the current status and update the status information
| pagenumber | the requested page number |
Definition at line 1534 of file control.c.
01535 { 01536 CL_SCREENPRINTF("entry: pagenum [%d]", pagenumber); 01537 01538 int startindex; 01539 int req_cnt = MAX_ITEMS_ON_ONE_PAGE; 01540 ContentLister *theContentLister = gContentLister; 01541 01542 if ( getListerState() == STATE_MISC 01543 && GTK_WIDGET_VISIBLE(theContentLister->distListWnd)) 01544 { 01545 dist_list_wnd_goto_page(pagenumber); 01546 } 01547 else if ((pagenumber > 0) && (pagenumber != theContentLister->currentPage) 01548 && (pagenumber <= theContentLister->pagecount)) 01549 { 01550 theContentLister->currentPage = pagenumber; 01551 startindex = MAX_ITEMS_ON_ONE_PAGE * (pagenumber - 1); 01552 01553 ctrl_select_stop(TRUE); 01554 01555 // retrieve new page content 01556 mdsSetPageContent(theContentLister->items, startindex, &req_cnt); 01557 01558 // update the stored index value 01559 mdsSetIndex(theContentLister->currentContentType, startindex); 01560 01561 theContentLister->itemCount = req_cnt; 01562 theContentLister->currentFocus = 0; 01563 ctrl_display_item_view(theContentLister); 01564 } 01565 else 01566 { 01567 erbusy_off(); 01568 } 01569 }

| static void ctrl_hide_keyboard | ( | int | iconState | ) | [static] |
Definition at line 2811 of file control.c.
02812 { 02813 g_assert((iconState == iconState_grey) || (iconState == iconState_normal)); 02814 02815 erbusy_blink(); 02816 02817 // block screen updates until keyboard hides 02818 display_update_increase_level(KEYBOARD_SHOW_HIDE_LEVEL); 02819 02820 // update GTK objects then hide keyboard, rely on display update by 02821 // keyboard 02822 g_idle_add(ctrl_on_idle_hide_keyboard, (gpointer) iconState); 02823 }

| void ctrl_hide_lister_area | ( | void | ) |
Definition at line 2766 of file control.c.
02767 { 02768 if (gContentLister->listerArea) 02769 { 02770 gtk_widget_hide(gContentLister->listerArea); 02771 } 02772 }
| void ctrl_hide_misc_screen | ( | void | ) |
Definition at line 2117 of file control.c.
02118 { 02119 CL_CONTROLPRINTF("entry"); 02120 02121 if (getListerState() == STATE_MISC) 02122 { 02123 ctrl_metadata_editor_close(FALSE); 02124 ctrl_hide_search_wnd(); 02125 ctrl_hide_sort_wnd(FALSE); 02126 ctrl_hide_sel_list_wnd(gContentLister, FALSE); 02127 } 02128 else 02129 { 02130 ctrl_select_stop(TRUE); 02131 } 02132 }

| void ctrl_hide_pincode_screen | ( | void | ) |
Definition at line 3655 of file control.c.
03656 { 03657 showPincodeReason_t reason; 03658 CL_LOGPRINTF("PINCODE screen hide"); 03659 03660 ContentLister *theContentLister = gContentLister; 03661 if (g_listerState != STATE_PINCODE) 03662 { 03663 return; 03664 } 03665 03666 if (theContentLister && theContentLister->pincodeScreen && GTK_WIDGET_VISIBLE(theContentLister->pincodeScreen)) 03667 { 03668 // => only request a refresh on the main window expose event 03669 CL_SCREENPRINTF(""); 03670 display_update_increase_level(MAIN_WINDOW_EXPOSE_LEVEL); 03671 03672 gtk_window_unfullscreen(GTK_WINDOW(theContentLister->topLevelWindow)); 03673 gtk_widget_show(GTK_WIDGET(theContentLister->listerScreen )); 03674 gtk_widget_hide(GTK_WIDGET(theContentLister->errorScreen )); 03675 gtk_widget_hide(GTK_WIDGET(theContentLister->pincodeScreen)); 03676 gtk_widget_grab_focus(GTK_WIDGET(theContentLister->listerArea)); 03677 03678 reason = gtk_pincode_screen_get_reason(theContentLister->pincodeScreen); 03679 if (reason != startup_t) 03680 { 03681 if ((strncmp (restoreUaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 03682 { 03683 pm_RaiseUserApp (restoreUaOnTop); 03684 strncpy (restoreUaOnTop, CONTENTLISTER_UAID, sizeof(restoreUaOnTop)); 03685 } 03686 } 03687 if ( reason != startup_t 03688 && reason != enterSettings_t) 03689 { 03690 erStartMSDiskApp(); 03691 } 03692 } 03693 03694 // when hide pincode screen, 03695 // and set contentlister to be normal state 03696 // and enable usb connect with pc 03697 // and end to accumulate idle time 03698 setListerState(STATE_NORMAL); 03699 accumulate_idle_time_end(); 03700 }

| void ctrl_hide_search_wnd | ( | void | ) |
Definition at line 3032 of file control.c.
03033 { 03034 CL_SEARCHPRINTF("entry"); 03035 03036 if ( (getListerState() == STATE_MISC) 03037 && (gContentLister->searchWnd) 03038 && GTK_WIDGET_VISIBLE(gContentLister->searchWnd) ) 03039 { 03040 // update toolbar, hide keyboard 03041 toolbar_disableUpdate(); 03042 toolbar_setIconState(iconID_search, iconState_normal); 03043 toolbar_setIconState(iconID_sort, iconState_normal); 03044 toolbar_setIconState(iconID_share, iconState_normal); 03045 toolbar_setIconState(iconID_tagging, iconState_normal); 03046 toolbar_setIconState(iconID_trashcan, iconState_normal); 03047 ctrl_hide_keyboard(iconState_grey); 03048 toolbar_enableUpdate(); 03049 03050 // show contentlister page 03051 gtk_widget_hide(GTK_WIDGET(gContentLister->searchWnd)); 03052 gtk_widget_grab_focus(GTK_WIDGET(gContentLister->listerArea)); 03053 setListerState(STATE_NORMAL); 03054 ctrl_rescan_current(); 03055 } 03056 }

| void ctrl_hide_sort_wnd | ( | gboolean | bSort | ) | [static] |
Definition at line 3958 of file control.c.
03959 { 03960 CL_LOGPRINTF("entry"); 03961 03962 if ( (getListerState() == STATE_MISC) 03963 && (gContentLister->sortWnd) 03964 && GTK_WIDGET_VISIBLE(gContentLister->sortWnd) ) 03965 { 03966 // update toolbar 03967 toolbar_disableUpdate(); 03968 toolbar_setIconState(iconID_search, iconState_normal); 03969 toolbar_setIconState(iconID_sort, iconState_normal); 03970 toolbar_setIconState(iconID_share, iconState_normal); 03971 toolbar_setIconState(iconID_tagging, iconState_normal); 03972 toolbar_setIconState(iconID_trashcan, iconState_normal); 03973 ctrl_hide_keyboard(iconState_grey); 03974 toolbar_enableUpdate(); 03975 03976 if (bSort) 03977 { 03978 ctrl_sort_current(); 03979 } 03980 else 03981 { 03982 ctrl_rescan_current(); 03983 } 03984 03985 // show contentlister page 03986 gtk_widget_hide(GTK_WIDGET(gContentLister->sortWnd)); 03987 gtk_widget_grab_focus(GTK_WIDGET(gContentLister->listerArea)); 03988 setListerState(STATE_NORMAL); 03989 } 03990 }

| static void ctrl_init_screen_layout | ( | GtkWidget * | topLevelWindow, | |
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 1074 of file control.c.
01075 { 01076 GtkWidget *topLevelVBox; 01077 01078 // object hierarchy: 01079 // topLevelWindow 01080 // |-- topLevelVBox 01081 // | 01082 topLevelVBox = gtk_vbox_new(FALSE, 0); 01083 gtk_container_add(GTK_CONTAINER(topLevelWindow), topLevelVBox); 01084 // | 01085 // |-- theContentLister->listerScreen 01086 // | |-- alignment 01087 // | |-- vbox 01088 // | | 01089 theContentLister->listerScreen = gtk_event_box_new(); 01090 gtk_widget_set_name(GTK_WIDGET(theContentLister->listerScreen), "lister_background"); 01091 gtk_box_pack_start(GTK_BOX(topLevelVBox), theContentLister->listerScreen, TRUE, TRUE, 0); 01092 gtk_widget_show(theContentLister->listerScreen); 01093 // 01094 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0); 01095 gtk_widget_show(alignment); 01096 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), LISTER_BOX_BORDER, 0, 0, 0); 01097 gtk_container_add(GTK_CONTAINER(theContentLister->listerScreen), alignment); 01098 // 01099 GtkWidget *vbox = gtk_vbox_new(FALSE, LIST_ITEM_SPACING); 01100 gtk_container_add(GTK_CONTAINER(alignment), vbox); 01101 gtk_widget_show(vbox); 01102 // | |-- theContentLister->listerArea (event box) 01103 // | | 01104 theContentLister->listerArea = gtk_event_box_new(); 01105 gtk_widget_set_name(GTK_WIDGET(theContentLister->listerArea), "lister_background"); 01106 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->listerArea), GTK_CAN_FOCUS); 01107 gtk_box_pack_start(GTK_BOX(vbox), theContentLister->listerArea, FALSE, FALSE, 0); 01108 gtk_widget_show(theContentLister->listerArea); 01109 // | | 01110 // | |-- alignment 01111 // | |-- vbox 01112 // | | 01113 alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0); 01114 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, LISTER_BOX_BORDER, 0); 01115 gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0); 01116 gtk_widget_show(alignment); 01117 // 01118 vbox = gtk_vbox_new(FALSE, 0); 01119 gtk_container_add(GTK_CONTAINER(alignment), vbox); 01120 gtk_widget_show(vbox); 01121 // | | 01122 // | |-- theContentLister->contentEditWnd (event box) 01123 theContentLister->contentEditWnd = gtk_event_box_new(); 01124 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->contentEditWnd), GTK_CAN_FOCUS); 01125 gtk_widget_set_name(GTK_WIDGET(theContentLister->contentEditWnd), "lister_background"); 01126 gtk_box_pack_start(GTK_BOX(vbox), theContentLister->contentEditWnd, FALSE, FALSE, METADATA_WND_SPACE_ABOVE); 01127 // | | 01128 // | |-- theContentLister->searchWnd (event box) 01129 theContentLister->searchWnd = gtk_event_box_new(); 01130 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->searchWnd), GTK_CAN_FOCUS); 01131 gtk_widget_set_name(GTK_WIDGET(theContentLister->searchWnd), "lister_background"); 01132 gtk_box_pack_start(GTK_BOX(vbox), theContentLister->searchWnd, FALSE, FALSE, SEARCH_WND_SPACE_ABOVE); 01133 // | | 01134 // | |-- theContentLister->sortWnd (event box) 01135 theContentLister->sortWnd = gtk_event_box_new(); 01136 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->sortWnd), GTK_CAN_FOCUS); 01137 gtk_widget_set_name(GTK_WIDGET(theContentLister->sortWnd), "lister_background"); 01138 gtk_box_pack_start(GTK_BOX(vbox), theContentLister->sortWnd, FALSE, FALSE, 0); 01139 // | | 01140 // | |-- theContentLister->distListWnd (event box) 01141 // | 01142 theContentLister->distListWnd = gtk_event_box_new(); 01143 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->distListWnd), GTK_CAN_FOCUS); 01144 gtk_widget_set_name(GTK_WIDGET(theContentLister->distListWnd), "lister_background"); 01145 gtk_box_pack_start(GTK_BOX(vbox), theContentLister->distListWnd, FALSE, FALSE, 0); 01146 // | 01147 // |-- theContentLister->errorScreen (GtkErrorScreen) 01148 // | 01149 theContentLister->errorScreen = gtk_error_screen_new(); 01150 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->errorScreen), GTK_CAN_FOCUS); 01151 gtk_box_pack_start(GTK_BOX(topLevelVBox), theContentLister->errorScreen, TRUE, TRUE, 0); 01152 // | 01153 // |-- theContentLister->pincodeScreen (GtkPincodeScreen) 01154 // 01155 theContentLister->pincodeScreen = gtk_pincode_screen_new(); 01156 GTK_WIDGET_SET_FLAGS(GTK_WIDGET(theContentLister->pincodeScreen), GTK_CAN_FOCUS); 01157 gtk_box_pack_start(GTK_BOX(topLevelVBox), theContentLister->pincodeScreen, TRUE, TRUE, 0); 01158 01159 gtk_widget_show(topLevelVBox); 01160 01161 g_signal_connect(G_OBJECT(theContentLister->listerArea), 01162 "key_press_event", G_CALLBACK(ctrl_listerArea_keypress), theContentLister); 01163 g_signal_connect(G_OBJECT(theContentLister->errorScreen), 01164 "button_press_event", G_CALLBACK(ctrl_errorScreen_buttonpress), theContentLister); 01165 01166 g_signal_connect(G_OBJECT(topLevelWindow), "expose-event", 01167 G_CALLBACK(ctrl_main_window_expose_event), theContentLister); 01168 g_signal_connect(G_OBJECT(topLevelWindow), "realize", G_CALLBACK(ctrl_main_window_realize_event), theContentLister); 01169 }

| gboolean ctrl_is_connect_from_pincode | ( | void | ) |
Definition at line 3786 of file control.c.
03787 { 03788 gboolean bRet = FALSE; 03789 03790 if ( getListerState() == STATE_DOWNLOADMGR 03791 && connectStruct.connect_from_pincode ) 03792 { 03793 bRet = TRUE; 03794 } 03795 CL_LOGPRINTF("return %d", bRet); 03796 return bRet; 03797 }

| static guint ctrl_listerArea_keypress | ( | GtkWidget * | widget, | |
| GdkEventKey * | event, | |||
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 1309 of file control.c.
01310 { 01311 int newPage; 01312 int returnValue = 0; // return FALSE => default gtk 01313 // handling 01314 int newFocus; 01315 01316 CL_CONTROLPRINTF("entry: keyval [0x%04X]", event->keyval); 01317 01318 CL_TIMEDISPLAY("keypress handling"); 01319 01320 // ignore all keys during select or rename action 01321 if ( g_select.active 01322 || toolbar_is_tagging_selected() ) 01323 { 01324 erbusy_off(); 01325 return returnValue; 01326 } 01327 01328 switch (event->keyval) 01329 { 01330 case GDK_Page_Down: 01331 newPage = theContentLister->currentPage + 1; 01332 ctrl_goto_page(newPage); 01333 01334 // return TRUE => stop event handling 01335 returnValue = 1; 01336 break; 01337 01338 case GDK_F1: 01339 // long PAGETURN_FORWARD keypress 01340 newPage = 01341 ((theContentLister->currentPage + 5) <= theContentLister->pagecount) ? (theContentLister->currentPage + 5) 01342 : theContentLister->pagecount; 01343 ctrl_goto_page(newPage); 01344 01345 // return TRUE => stop event handling 01346 returnValue = 1; 01347 break; 01348 01349 case GDK_Page_Up: 01350 newPage = theContentLister->currentPage - 1; 01351 ctrl_goto_page(newPage); 01352 01353 // return TRUE => stop event handling 01354 returnValue = 1; 01355 break; 01356 01357 case GDK_F2: 01358 // long PAGETURN_BACK keypress 01359 newPage = ((theContentLister->currentPage - 5) < 1) ? (1) : (theContentLister->currentPage - 5); 01360 ctrl_goto_page(newPage); 01361 01362 // return TRUE => stop event handling 01363 returnValue = 1; 01364 break; 01365 01366 case GDK_Home: 01367 // long press 01368 CL_CONTROLPRINTF("jumping back to root (Home)"); 01369 stackClear(theContentLister->currentContentType); 01370 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01371 // return TRUE => stop event handling 01372 returnValue = 1; 01373 break; 01374 01375 case GDK_F5: 01376 // OVERVIEW keypress 01377 CL_CONTROLPRINTF("jumping one level up (F5)"); 01378 if ( (st_StorageTypeCF == theContentLister->currentContentType || 01379 st_StorageTypeSD == theContentLister->currentContentType || 01380 st_StorageTypeUSB == theContentLister->currentContentType || 01381 st_StorageTypeMain == theContentLister->currentContentType || 01382 st_RecentDocuments == theContentLister->currentContentType ) && 01383 0 >= stackHeight(theContentLister->currentContentType)) 01384 { 01385 // goto device manager 01386 theContentLister->currentContentType = st_MenuTypeMode; 01387 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01388 } 01389 else if (st_SearchResult == theContentLister->currentContentType 01390 && 0 >= stackHeight(theContentLister->currentContentType)) 01391 { 01392 CL_WARNPRINTF(" -- Search result: return to previous"); 01393 theContentLister->currentContentType = theContentLister->previousContentType; 01394 theContentLister->previousContentType = st_SearchResult; 01395 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01396 } 01397 else 01398 { 01399 ctrl_scan_content(theContentLister, ctrlScanPrevious, NULL); 01400 } 01401 // return TRUE => stop event handling 01402 returnValue = 1; 01403 break; 01404 01405 case GDK_Return: 01406 case GDK_F6: 01407 if (theContentLister->itemCount > 0) 01408 { 01409 CL_CONTROLPRINTF("jumping to focused item %d", theContentLister->currentFocus); 01410 01411 // find the item that has the focus 01412 if (theContentLister->currentFocus >= 0 && theContentLister->currentFocus < MAX_ITEMS_ON_ONE_PAGE) 01413 { 01414 ctrl_listItem_clicked(theContentLister->currentFocus, theContentLister); 01415 } 01416 } 01417 else 01418 { 01419 erbusy_off(); 01420 } 01421 // return TRUE => stop event handling 01422 returnValue = 1; 01423 break; 01424 01425 case GDK_Up: 01426 if ( !ctrl_current_location_is_outbox() ) 01427 { 01428 if (theContentLister->itemCount > 0) 01429 { 01430 CL_CONTROLPRINTF("prev item -- current %d itemCount %d", 01431 theContentLister->currentFocus, theContentLister->itemCount); 01432 if (theContentLister->currentFocus == -1) 01433 { 01434 newFocus = 0; 01435 } 01436 else if (theContentLister->currentFocus == 0) 01437 { 01438 newFocus = theContentLister->itemCount - 1; 01439 } 01440 else 01441 { 01442 newFocus = theContentLister->currentFocus - 1; 01443 } 01444 ctrl_listItem_focus(newFocus, theContentLister); 01445 } 01446 } 01447 erbusy_off(); 01448 // return TRUE => stop event handling 01449 returnValue = 1; 01450 break; 01451 01452 case GDK_F4: 01453 // long PREVIOUS_LINK_BUTTON keypress 01454 CL_CURSORPRINTF("long prev item -- current %d", theContentLister->currentFocus); 01455 if ( !ctrl_current_location_is_outbox() ) 01456 { 01457 if (theContentLister->currentFocus != 0) 01458 { 01459 ctrl_listItem_focus(0, theContentLister); 01460 } 01461 } 01462 erbusy_off(); 01463 // return TRUE => stop event handling 01464 returnValue = 1; 01465 break; 01466 01467 case GDK_Down: 01468 if ( !ctrl_current_location_is_outbox() ) 01469 { 01470 if (theContentLister->itemCount > 0) 01471 { 01472 CL_CONTROLPRINTF("next item -- current %d itemCount %d", 01473 theContentLister->currentFocus, theContentLister->itemCount); 01474 newFocus = theContentLister->currentFocus + 1; 01475 if (newFocus >= theContentLister->itemCount) 01476 { 01477 newFocus = 0; 01478 } 01479 ctrl_listItem_focus(newFocus, theContentLister); 01480 } 01481 } 01482 erbusy_off(); 01483 // return TRUE => stop event handling 01484 returnValue = 1; 01485 break; 01486 01487 case GDK_F3: 01488 // long NEXT_LINK_BUTTON keypress 01489 CL_CURSORPRINTF("long next item -- current %d", theContentLister->currentFocus); 01490 if ( !ctrl_current_location_is_outbox() ) 01491 { 01492 if (theContentLister->currentFocus != (theContentLister->itemCount - 1)) 01493 { 01494 ctrl_listItem_focus(theContentLister->itemCount - 1, theContentLister); 01495 } 01496 } 01497 erbusy_off(); 01498 // return TRUE => stop event handling 01499 returnValue = 1; 01500 break; 01501 01502 #ifdef COMMAND_LINE_INPUT 01503 case GDK_F12: 01504 // test case 01505 ctrl_contentType_button_clicked(st_ContentTypeBooks); 01506 break; 01507 case GDK_F11: 01508 // test case 01509 ctrl_contentType_button_clicked(st_ContentTypeNews); 01510 break; 01511 case GDK_F10: 01512 // test case 01513 ctrl_contentType_button_clicked(st_ContentTypeDocs); 01514 break; 01515 case GDK_F9: 01516 // test case 01517 ctrl_contentType_button_clicked(st_ContentTypeNotes); 01518 break; 01519 case GDK_F8: 01520 // test case 01521 ctrl_mode_button_clicked(); 01522 break; 01523 case GDK_F7: 01524 // test case 01525 ctrl_display_download_history(); 01526 break; 01527 #endif // COMMAND_LINE_INPUT 01528 01529 } // end switch 01530 01531 return returnValue; 01532 }

| void ctrl_listItem_clicked | ( | int | index, | |
| gpointer | data | |||
| ) |
Gtk list item clicked callback routine
| data | index of the item in the pageitem list | |
| reference | passed during lsInit |
Definition at line 634 of file control.c.
00635 { 00636 ContentLister *theContentLister = (ContentLister *) data; 00637 clDisplayItem_t *theItem; 00638 int itemIndex = 0; 00639 st_ContentType_e storageType; 00640 gboolean ret; 00641 00642 CL_CONTROLPRINTF("Entry: index [%d]", index); 00643 00644 // action required only when content lister in normal state and visible 00645 if ( g_listerState != STATE_NORMAL 00646 || strcmp(pm_getUaOnTop(), CONTENTLISTER_UAID) != 0) 00647 { 00648 CL_WARNPRINTF("Ignore because contentLister in special state or not visible"); 00649 return; 00650 } 00651 00652 if (g_select.active) 00653 { 00654 // select mode: blink or hide cursor for this item 00655 if (g_select.item_selected[index]) 00656 { 00657 g_select.item_selected[index] = FALSE; 00658 cursor_set_state(index, e_cursor_hide); 00659 cursor_redraw(); 00660 } 00661 else 00662 { 00663 g_select.item_selected[index] = TRUE; 00664 cursor_set_state(index, e_cursor_blink); 00665 cursor_redraw(); 00666 00667 if ( !g_select.confirm_with_icon ) 00668 { 00669 g_select.icon_clicked = TRUE; 00670 } 00671 } 00672 00673 // restart the select timeout 00674 g_select.ticks = ITEM_SELECT_TIMEOUT_TICKS; 00675 } 00676 else if ( !ctrl_current_location_is_outbox() ) 00677 { 00678 // Not in select mode: open the item 00679 erbusy_blink(); 00680 00681 theItem = &theContentLister->items[index]; 00682 00683 // position cursor on the selected item 00684 ctrl_listItem_focus(index, theContentLister); 00685 00686 // update the stored index value 00687 itemIndex = ctrl_get_item_index(theContentLister); 00688 mdsSetIndex(theContentLister->currentContentType, itemIndex); 00689 00690 // now act on the selected item 00691 switch (theItem->fit) 00692 { 00693 case mdsFitFolder: 00694 ctrl_scan_content(theContentLister, ctrlScanNext, theItem->szFilename); 00695 break; 00696 00697 case mdsFitApplication: 00698 CL_CONTROLPRINTF("mdsFitApplication"); 00699 // before enter setup, ask user input pincode 00700 if (0 == strcmp(theItem->szExtID, SETUP_APP)) 00701 { 00702 gboolean enable = FALSE; 00703 gchar pincode[PINCODE_MAX_LENGTH + 1]; 00704 00705 gtk_pincode_screen_get_pincode_settings(theContentLister->pincodeScreen, &enable, pincode); 00706 if (FALSE == enable || 0 == strlen(pincode)) 00707 { 00708 ctrl_start_application(theItem->szExtID, NULL); 00709 } 00710 else 00711 { 00712 ctrl_show_pincode_screen(enterSettings_t, ctrl_start_setup, NULL); 00713 } 00714 } 00715 else 00716 { 00717 ctrl_start_application(theItem->szExtID, NULL); 00718 } 00719 break; 00720 00721 case mdsFitManifestDirectory: 00722 CL_CONTROLPRINTF("mdsFitManifestDirectory -> %s", theItem->szFilename); 00723 ctrl_scan_content(theContentLister, ctrlScanNext, theItem->szFilename); 00724 break; 00725 00726 case mdsFitStorage: 00727 storageType = ctrl_get_storageType(theItem->szExtID); 00728 00729 if (stackIsStorage(storageType) == TRUE) 00730 { 00731 CL_CONTROLPRINTF("scan storage type %d", storageType); 00732 00733 // update the contentType 00734 theContentLister->previousContentType = theContentLister->currentContentType; 00735 theContentLister->currentContentType = storageType; 00736 ctrl_scan_content(theContentLister, ctrlScanCurrent, 0); 00737 } 00738 else 00739 { 00740 CL_ERRORPRINTF("invalid storage type"); 00741 } 00742 break; 00743 00744 case mdsFitContainer: 00745 ret = ctrl_start_viewer(theContentLister->currentContentType, theItem, NULL); 00746 if (ret == FALSE) 00747 { 00748 // Not busy! 00749 erbusy_off(); 00750 } 00751 break; 00752 00753 case mdsFitFile: 00754 ctrl_before_file_clicked(theItem); 00755 ret = ctrl_start_viewer(theContentLister->currentContentType, theItem, NULL); 00756 if (ret == FALSE) 00757 { 00758 // Not busy! 00759 erbusy_off(); 00760 } 00761 break; 00762 00763 case mdsFitSymlink: 00764 default: 00765 CL_ERRORPRINTF("theItem->fit %d - UNKNOWN", theItem->fit); 00766 } 00767 } 00768 }

| static void ctrl_listItem_delete | ( | const int * | index_tbl, | |
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 529 of file control.c.
00530 { 00531 clDisplayItem_t* theItem; 00532 int itemIndex = 0; 00533 int index; 00534 const int* indexPtr; 00535 gboolean deleted = FALSE; 00536 char* argv[10]; 00537 int argc; 00538 char* dir = NULL; 00539 char* cp; 00540 00541 CL_CONTROLPRINTF("entry: index [%d]", index_tbl[0]); 00542 00543 for (indexPtr = index_tbl ; *indexPtr >= 0 ; indexPtr++) 00544 { 00545 index = *indexPtr; 00546 00547 if (index >= 0 && index < theContentLister->itemCount) 00548 { 00549 CL_CURSORPRINTF("index [%d] [%s] itemCount [%d] trashcan [%d]", 00550 index, 00551 theContentLister->items[index].szFilename, 00552 theContentLister->itemCount, 00553 toolbar_is_trashcan_selected() ); 00554 00555 // Trashcan mode: delete the item 00556 erbusy_blink(); 00557 theItem = &theContentLister->items[index]; 00558 00559 if (theItem->modifyEnable.bDelete == FALSE) 00560 { 00561 CL_WARNPRINTF("Delete disabled by manifest: item [%s]", theItem->szFilename); 00562 } 00563 else 00564 { 00565 // update the stored index value 00566 itemIndex = MAX_ITEMS_ON_ONE_PAGE * (theContentLister->currentPage - 1) + index; 00567 mdsSetIndex(theContentLister->currentContentType, itemIndex); 00568 switch (theItem->fit) 00569 { 00570 case mdsFitFolder: 00571 CL_WARNPRINTF("-- deleting folder [%s]", theItem->szFilename); 00572 argc = 0; 00573 argv[argc++] = "rm"; 00574 argv[argc++] = "-rf"; 00575 argv[argc++] = theItem->szFilename; 00576 argv[argc] = NULL; 00577 g_assert( argc < (sizeof(argv)/sizeof(argv[0])) ); 00578 fork_exec(argc, argv); 00579 deleted = TRUE; 00580 break; 00581 00582 case mdsFitContainer: 00583 case mdsFitManifestDirectory: 00584 CL_WARNPRINTF("-- deleting container [%s]", theItem->szManifest); 00585 dir = alloca( strlen(theItem->szManifest) + 1 ); 00586 g_assert(dir != NULL); 00587 strcpy(dir, theItem->szManifest); 00588 cp = strrchr(dir, '/'); 00589 if (cp) 00590 { 00591 *cp = '\0'; 00592 argc = 0; 00593 argv[argc++] = "rm"; 00594 argv[argc++] = "-rf"; 00595 argv[argc++] = dir; 00596 argv[argc] = NULL; 00597 g_assert( argc < (sizeof(argv)/sizeof(argv[0])) ); 00598 fork_exec(argc, argv); 00599 deleted = TRUE; 00600 } 00601 else 00602 { 00603 CL_ERRORPRINTF("-- invalid container [%s]", theItem->szFilename); 00604 } 00605 break; 00606 00607 case mdsFitFile: 00608 CL_WARNPRINTF("-- deleting file [%s]", theItem->szFilename); 00609 unlink(theItem->szFilename); 00610 deleted = TRUE; 00611 break; 00612 00613 case mdsFitApplication: 00614 case mdsFitStorage: 00615 case mdsFitSymlink: 00616 CL_ERRORPRINTF("-- not allowed to delete item [%s] fit [%d] ", theItem->szFilename, theItem->fit); 00617 break; 00618 00619 default: 00620 CL_ERRORPRINTF("-- unknown fit [%d] item [%s]", theItem->fit, theItem->szFilename); 00621 break; 00622 } 00623 } 00624 } 00625 } 00626 00627 if (deleted) 00628 { 00629 sync(); 00630 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 00631 } 00632 }

| static void ctrl_listItem_edit | ( | const int * | index_tbl, | |
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 2894 of file control.c.
02895 { 02896 const int index = *index_tbl; // only one item expected 02897 02898 CL_CONTROLPRINTF("entry"); 02899 02900 if (getListerState() == STATE_MISC) 02901 { 02902 // already editing an item: ignore 02903 return; 02904 } 02905 02906 clDisplayItem_t *theItem = &theContentLister->items[index]; 02907 if (theItem->modifyEnable.bTagging == FALSE) 02908 { 02909 CL_WARNPRINTF("Rename disabled by manifest: item [%s]", theItem->szFilename); 02910 goto error_exit; 02911 } 02912 02913 // check current item state 02914 switch (theItem->fit) 02915 { 02916 case mdsFitFile: 02917 CL_CONTROLPRINTF("File [%s]", theItem->szFilename); 02918 int i = ctrl_before_file_clicked(theItem); // create manifest file for it 02919 if (i != 0) 02920 { 02921 CL_ERRORPRINTF("ctrl_before_file_clicked failed for [%s]", theItem->szFilename); 02922 toolbar_setIconState(iconID_tagging, iconState_normal); 02923 toolbar_synchronise(); 02924 return; 02925 } 02926 break; 02927 02928 case mdsFitContainer: 02929 CL_CONTROLPRINTF("Container [%s]", theItem->szFilename); 02930 break; 02931 02932 case mdsFitFolder: 02933 case mdsFitApplication: 02934 case mdsFitManifestDirectory: 02935 case mdsFitStorage: 02936 default: 02937 CL_WARNPRINTF("Cannot rename item [%s]", theItem->szFilename); 02938 goto error_exit; 02939 } 02940 02941 // update toolbar, show keyboard 02942 toolbar_setIconState(iconID_tagging, iconState_selected); 02943 ctrl_show_keyboard(); 02944 02945 // remember the item we are editing 02946 g_md_editor_mgr.item = &(theContentLister->items[index]); 02947 02948 // get manifest data 02949 content_metadata_read_manifest(theItem->szManifest); 02950 02951 // update pagebar. maybe it should be moved into gtkMetadataWnd, multi 02952 // pages? 02953 pagebar_set_pagecount(1); 02954 pagebar_goto_page(1); 02955 pagebar_redraw(); 02956 02957 // hide not-selected lister items, then show edit screen 02958 int i; 02959 GtkWidget *listItem; 02960 for (i = 0; i < MAX_ITEMS_ON_ONE_PAGE; i++) 02961 { 02962 if (i != index) 02963 { 02964 listItem = lsGetListerItem(theContentLister->lister, i); 02965 gtk_widget_hide(listItem); 02966 } 02967 } 02968 gtk_widget_show(GTK_WIDGET(theContentLister->contentEditWnd)); 02969 02970 // remember contentLister state 02971 setListerState(STATE_MISC); 02972 return; 02973 02974 error_exit: 02975 ctrl_select_stop(TRUE); 02976 return; 02977 }

| static void ctrl_listItem_focus | ( | int | index, | |
| gpointer | data | |||
| ) | [static] |
Definition at line 520 of file control.c.
00521 { 00522 CL_CURSORPRINTF("entry: index [%d]", index); 00523 00524 ctrl_listItem_focus_no_redraw(index, data); 00525 cursor_redraw(); 00526 }

| static void ctrl_listItem_focus_no_redraw | ( | int | index, | |
| gpointer | data | |||
| ) | [static] |
update cursor (previously the focus)
| index | : index of the item in the pageitem list (0.., or -1 for none selected | |
| data | : reference to contentlister structure |
Definition at line 500 of file control.c.
00501 { 00502 ContentLister *theContentLister = (ContentLister *) data; 00503 CL_CURSORPRINTF("entry: index [%d]", index); 00504 00505 // move cursor to specified item 00506 cursor_set_state(theContentLister->currentFocus, e_cursor_hide); 00507 cursor_set_state(index, e_cursor_show); 00508 00509 // remember where the focus is 00510 theContentLister->currentFocus = index; 00511 00512 // update the stored index value 00513 if (index >= 0) 00514 { 00515 mdsSetIndex( theContentLister->currentContentType, 00516 (MAX_ITEMS_ON_ONE_PAGE * (theContentLister->currentPage - 1)) + index ); 00517 } 00518 }

| gboolean ctrl_location_is_outbox | ( | const char * | location | ) |
Definition at line 3471 of file control.c.
03472 { 03473 if ( location != NULL && strncmp(location, "/" OUTBOX_NAME, 1 + strlen(OUTBOX_NAME)) == 0 ) 03474 { 03475 return TRUE; 03476 } 03477 else 03478 { 03479 return FALSE; 03480 } 03481 }
| static void ctrl_lock_screen | ( | void | ) | [static] |
Definition at line 3859 of file control.c.
03860 { 03861 if (g_listerState != STATE_DOWNLOADMGR) 03862 { 03863 erbusy_blink(); 03864 ctrl_show_pincode_screen(lockScreen_t, NULL, NULL); 03865 } 03866 }

| static gboolean ctrl_main_window_expose_event | ( | GtkWidget * | widget, | |
| GdkEventExpose * | event, | |||
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 1609 of file control.c.
01610 { 01611 CL_SCREENPRINTF("entry"); 01612 01613 display_update_request_screen_refresh(MAIN_WINDOW_EXPOSE_LEVEL); 01614 return FALSE; 01615 }

| static void ctrl_main_window_realize_event | ( | GtkWidget * | widget, | |
| ContentLister * | theContentLister | |||
| ) | [static] |
Definition at line 1618 of file control.c.
01619 { 01620 Window xwin; 01621 static int count = 0; 01622 01623 CL_SCREENPRINTF("entry"); 01624 01625 if (count == 0) 01626 { 01627 // init the program manager 01628 xwin = GDK_WINDOW_XID(widget->window); 01629 CL_SCREENPRINTF("Toplevel XWindow: 0x%x", (int)xwin); 01630 01631 pm_SetMyWindow(xwin); 01632 01633 count = 1; 01634 } 01635 }

| static void ctrl_metadata_editor_close | ( | gboolean | bSave | ) | [static] |
Definition at line 2846 of file control.c.
02847 { 02848 CL_CONTROLPRINTF("entry"); 02849 02850 gchar szContainerDir[ERMDS_MAX_FILENAME_SIZE]; 02851 02852 if ( (getListerState() == STATE_MISC) 02853 && (gContentLister->contentEditWnd) 02854 && GTK_WIDGET_VISIBLE(gContentLister->contentEditWnd) ) 02855 { 02856 erbusy_blink(); 02857 ctrl_hide_keyboard(iconState_grey); 02858 02859 // store modified metadata 02860 if (bSave) 02861 { 02862 // rename container as needed 02863 content_metadata_rename_container(g_md_editor_mgr.item->szManifest, szContainerDir, sizeof(szContainerDir)); 02864 02865 // update manifest file 02866 content_metadata_write_manifest(szContainerDir); 02867 02868 // show updated item on screen 02869 ctrl_rescan_current(); 02870 ctrl_goto_item(szContainerDir); 02871 02872 // update the stored index value 02873 int itemIndex = ctrl_get_item_index(gContentLister); 02874 mdsSetIndex(gContentLister->currentContentType, itemIndex); 02875 } 02876 else 02877 { 02878 // re-display all items 02879 ctrl_rescan_current(); 02880 } 02881 02882 // show contentlister page 02883 gtk_widget_hide(GTK_WIDGET(gContentLister->contentEditWnd)); 02884 gtk_widget_grab_focus(GTK_WIDGET(gContentLister->listerArea)); 02885 setListerState(STATE_NORMAL); 02886 02887 toolbar_synchronise(); 02888 } 02889 02890 CL_CONTROLPRINTF("leave"); 02891 }

| void ctrl_mode_button_clicked | ( | void | ) |
Definition at line 1894 of file control.c.
01895 { 01896 ContentLister *theContentLister = gContentLister; 01897 char *UaOnTop; 01898 01899 CL_CONTROLPRINTF("entry 0x%x", (unsigned int)theContentLister); 01900 01901 UaOnTop = pm_getUaOnTop(); 01902 01903 CL_CONTROLPRINTF("UaOnTop = %s", UaOnTop); 01904 01905 if ((strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 01906 { 01907 // contentLister not "On Top" => scan mode directory content and 01908 // show contentlister 01909 CL_CONTROLPRINTF("CL NOT on top"); 01910 theContentLister->previousContentType = theContentLister->currentContentType; 01911 theContentLister->currentContentType = st_MenuTypeMode; 01912 // reset the st_MenuTypeMode stack 01913 stackClear(theContentLister->currentContentType); 01914 01915 pm_RaiseContentLister(); 01916 01917 // Disabled this scan_content, because the signal handler already 01918 // rescans (see programMgr.c) 01919 // ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01920 CL_CONTROLPRINTF("Not scanning content, this will be done in the sigchld handler"); 01921 } 01922 else 01923 { 01924 // contentLister "On Top" => scan new contentType 01925 CL_CONTROLPRINTF("CL on top - current type (%d)", theContentLister->currentContentType); 01926 01927 if ((theContentLister->currentError != ctrlNoError) && (stackIsStorage(theContentLister->currentContentType))) 01928 { 01929 CL_CONTROLPRINTF("Error screen for storage (%d)", theContentLister->currentContentType); 01930 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01931 } 01932 else 01933 { 01934 // back to the mode menu 01935 CL_CONTROLPRINTF("Back to mode menu"); 01936 ctrl_hide_misc_screen(); 01937 theContentLister->previousContentType = theContentLister->currentContentType; 01938 theContentLister->currentContentType = st_MenuTypeMode; 01939 // reset the st_MenuType1 stack 01940 stackClear(theContentLister->currentContentType); 01941 ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL); 01942 } 01943 } 01944 }

| void ctrl_mode_button_long_clicked | ( | void | ) |
Definition at line 1889 of file control.c.
01890 { 01891 ctrl_display_recent_documents(); 01892 }

| void ctrl_new_content_received | ( | void | ) |
Definition at line 464 of file control.c.
00465 { 00466 CL_LOGPRINTF("entry"); 00467 00468 g_new_content_received = TRUE; 00469 g_new_content_acknowledged = FALSE; 00470 }
| static gboolean ctrl_not_create_manifest | ( | const char * | path | ) | [static] |
Definition at line 3361 of file control.c.
03362 { 03363 int i; 03364 03365 // Folders that can be matched. 03366 // Must be full path names _including_ trailing slash 03367 static const char *path_table[] = { 03368 "/mnt/free" MOBIPOCKET_FOLDER "/", 03369 "/mnt/cf" MOBIPOCKET_FOLDER "/", 03370 "/media/card" MOBIPOCKET_FOLDER "/", 03371 "/mnt/usb" MOBIPOCKET_FOLDER "/" 03372 }; 03373 03374 const int size = sizeof(path_table) / sizeof(path_table[0]); 03375 03376 for (i = 0; i < size; i++) 03377 { 03378 if (strcasecmp(path, path_table[i]) == 0) 03379 return TRUE; 03380 } 03381 return FALSE; 03382 }
| void ctrl_on_icon_clicked | ( | int | iconID, | |
| int | iconState | |||
| ) |
Definition at line 2599 of file control.c.
02600 { 02601 CL_TBPRINTF("entry: iconID [%d] iconState [%d]", iconID, iconState); 02602 02603 if ( g_select.active 02604 && iconID == g_select.iconID 02605 && iconState == iconState_selected) 02606 { 02607 // icon clicked again -> listitem select procedure ends 02608 // Note: ipc messages like toolbar icon clicked are received on a separate thread, therefore the current 02609 // function is NOT called on the GTK thread, so the order of events cannot be guaranteed. 02610 // More precisely: pen-click listitem, pen-click toolbar icon sometimes is received in the inverse order. 02611 // To avoid these issues we set a flag, which is checked by the timer function who then ends the select. 02612 g_select.icon_clicked = TRUE; 02613 } 02614 else 02615 { 02616 // icon actions regardless the icon state 02617 switch (iconID) 02618 { 02619 case iconID_search: 02620 ctrl_on_search_clicked(iconState); 02621 break; 02622 02623 case iconID_sort: 02624 ctrl_on_sort_clicked(iconState); 02625 break; 02626 02627 case iconID_locked: 02628 switch (iconState) 02629 { 02630 case iconState_normal: 02631 toolbar_setIconState(iconID_locked, iconState_selected); 02632 toolbar_synchronise(); 02633 break; 02634 case iconState_selected: 02635 toolbar_setIconState(iconID_locked, iconState_normal); 02636 toolbar_synchronise(); 02637 break; 02638 case iconState_grey: 02639 // ignore 02640 break; 02641 default: 02642 CL_ERRORPRINTF("iconID_locked: state [%d] unknown", iconState); 02643 } 02644 break; 02645 02646 case iconID_lock_screen: 02647 ctrl_on_lock_screen_clicked(iconState); 02648 break; 02649 02650 case iconID_connect: 02651 switch (iconState) 02652 { 02653 case iconState_normal: 02654 case iconState_IDconnect_time: 02655 ctrl_background_connect_timeout_start_withinterval(FALSE, TRUE, 0); 02656 break; 02657 case iconState_selected: 02658 ctrl_disconnect(connectScrUnchanged); 02659 break; 02660 case iconState_IDconnect_newcontent: 02661 ctrl_display_download_history(); 02662 break; 02663 case iconState_IDconnect_newcontent_selected: 02664 g_new_content_received = FALSE; 02665 ctrl_set_connect_icon(); 02666 toolbar_synchronise(); 02667 break; 02668 default: 02669 CL_ERRORPRINTF("iconID_connect state [%d] unknown", iconState); 02670 } 02671 break; 02672 02673 default: 02674 break; //ignore 02675 } 02676 02677 // icon actions for icon state normal 02678 if (iconState == iconState_normal) 02679 { 02680 switch (iconID) 02681 { 02682 case iconID_share: 02683 ctrl_select_listitem(iconID_share, FALSE, ctrl_listItem_share); 02684 break; 02685 02686 case iconID_tagging: 02687 ctrl_select_listitem(iconID_tagging, FALSE, ctrl_listItem_edit); 02688 break; 02689 02690 case iconID_trashcan: 02691 ctrl_select_listitem(iconID_trashcan, TRUE, ctrl_listItem_delete); 02692 break; 02693 02694 default: 02695 break; // ignore 02696 } 02697 } 02698 02699 // icon actions for icon state selected 02700 if (iconState == iconState_selected) 02701 { 02702 switch (iconID) 02703 { 02704 case iconID_share: 02705 ctrl_doc_share_now(gContentLister); 02706 break; 02707 02708 case iconID_tagging: 02709 ctrl_metadata_editor_close(TRUE); 02710 break; 02711 02712 default: 02713 break; // ignore 02714 } 02715 } 02716 } 02717 }

| static gboolean ctrl_on_idle_hide_keyboard | ( | gpointer | data | ) | [static] |
Definition at line 2825 of file control.c.
02826 { 02827 int iconState = (int)data; 02828 02829 // hide keyboard but first show keyboard, 02830 // this makes sure the keyboard (re-)disappears and does a display 02831 // update 02832 toolbar_setIconState(iconID_keyboard, iconState_selected); 02833 toolbar_setIconState(iconID_keyboard, iconState); 02834 02835 display_update_request_screen_refresh(KEYBOARD_SHOW_HIDE_LEVEL); 02836 02837 return FALSE; // don't call me again 02838 }

| static gboolean ctrl_on_idle_select_language | ( | gpointer | data | ) | [static] |
Definition at line 4206 of file control.c.
04207 { 04208 // start settings application 04209 ctrl_start_application(SETUP_APP, "--select-language-only"); 04210 04211 // lower display level, but no display update now 04212 startup_idle_display(FALSE); 04213 04214 return FALSE; // return FALSE to remove handler 04215 }

| static gboolean ctrl_on_idle_show_keyboard | ( | gpointer | data | ) | [static] |
Definition at line 2794 of file control.c.
02795 { 02796 // request keyboard but first disable keyboard, 02797 // this makes sure the keyboard (re-)appears and does a display update 02798 toolbar_setIconState(iconID_keyboard, iconState_normal); 02799 toolbar_setIconState(iconID_keyboard, iconState_selected); 02800 02801 // allow display updates again 02802 display_update_decrease_level(LOWEST_LEVEL); 02803 02804 return FALSE; // don't call me again 02805 }

| void ctrl_on_lock_screen_clicked | ( | int | iconState | ) |
Definition at line 3833 of file control.c.
03834 { 03835 CL_IPCPRINTF("entry: iconState [%d]", iconState); 03836 03837 switch (iconState) 03838 { 03839 case iconState_normal: 03840 // change icon to "selected", 03841 // toolbar_setIconState(iconID_lock_screen, iconState_selected); 03842 // toolbar_synchronise(); 03843 ctrl_lock_screen(); 03844 break; 03845 03846 // case iconState_selected: 03847 // change icon to "normal", 03848 // toolbar_setIconState(iconID_lock_screen, iconState_normal); 03849 // toolbar_synchronise(); 03850 break; 03851 03852 default: 03853 /* 03854 * ignore 03855 */ ; 03856 } 03857 }

| void ctrl_on_search_clicked | ( | int | iconState | ) | [static] |
Definition at line 3058 of file control.c.
03059 { 03060 switch (iconState) 03061 { 03062 case iconState_normal: 03063 if (getListerState() == STATE_NORMAL) 03064 { 03065 // de-select contentlister items 03066 ctrl_listItem_focus(-1, gContentLister); 03067 03068 // update toolbar, show search window after toolbar updated 03069 toolbar_disableUpdate(); 03070 toolbar_setIconState(iconID_search, iconState_selected); 03071 toolbar_setIconState(iconID_sort, iconState_grey ); 03072 toolbar_setIconState(iconID_share, iconState_grey ); 03073 toolbar_setIconState(iconID_tagging, iconState_grey ); 03074 toolbar_setIconState(iconID_trashcan, iconState_grey ); 03075 ctrl_add_on_toolbar_sync_action(ctrl_show_search_wnd_trigger); 03076 toolbar_enableUpdate(); 03077 toolbar_synchronise(); 03078 } 03079 break; 03080 03081 case iconState_selected: 03082 ctrl_hide_search_wnd(); 03083 break; 03084 03085 default: 03086 /* 03087 * ignore 03088 */ ; 03089 } 03090 }

| static gboolean ctrl_on_select_timer | ( | gpointer | data | ) | [static] |
Definition at line 2488 of file control.c.
02489 { 02490 int i; 02491 int item_idx[MAX_ITEMS_ON_ONE_PAGE + 1]; 02492 int* ip; 02493 gboolean item_selected = FALSE; 02494 gboolean call_me_again = FALSE; 02495 02496 CL_CONTROLPRINTF("entry"); 02497 02498 if (g_select.active) 02499 { 02500 if (g_select.icon_clicked) 02501 { 02502 // listitem select procedure ends 02503 if (g_select.on_item_selected != NULL) 02504 { 02505 // report the currently selected item(s) 02506 ip = item_idx; 02507 for (i = MAX_ITEMS_ON_ONE_PAGE - 1 ; i >= 0 ; i--) 02508 { 02509 if (g_select.item_selected[i]) 02510 { 02511 item_selected = TRUE; 02512 *ip = i; 02513 ip++; 02514 } 02515 } 02516 *ip = -1; 02517 if (item_selected) 02518 { 02519 // start the registered function, i.e. callback function 02520 g_select.on_item_selected(item_idx, gContentLister); 02521 ctrl_select_stop(g_select.confirm_with_icon); 02522 } 02523 else 02524 { 02525 // no items selected: abort select mode 02526 ctrl_select_stop(TRUE); 02527 toolbar_synchronise(); 02528 } 02529 } 02530 else 02531 { 02532 // no callback registered: abort select mode 02533 ctrl_select_stop(TRUE); 02534 toolbar_synchronise(); 02535 } 02536 } 02537 else if (g_select.ticks > 0) 02538 { 02539 // decrement time-out counter 02540 g_select.ticks--; 02541 call_me_again = TRUE; 02542 } 02543 else 02544 { 02545 // abort select mode and show cursor at the top-most contentlister item 02546 ctrl_select_stop(TRUE); 02547 toolbar_synchronise(); 02548 } 02549 } 02550 02551 return call_me_again; 02552 }

| static void ctrl_on_sort_clicked | ( | int | iconState | ) | [static] |
Definition at line 3992 of file control.c.
03993 { 03994 switch (iconState) 03995 { 03996 case iconState_normal: 03997 if (getListerState() == STATE_NORMAL) 03998 { 03999 // de-select contentlister items 04000 ctrl_listItem_focus(-1, gContentLister); 04001 04002 // update toolbar, show sort window after toolbar updated 04003 toolbar_disableUpdate(); 04004 toolbar_setIconState(iconID_search, iconState_grey ); 04005 toolbar_setIconState(iconID_sort, iconState_selected); 04006 toolbar_setIconState(iconID_share, iconState_grey ); 04007 toolbar_setIconState(iconID_tagging, iconState_grey ); 04008 toolbar_setIconState(iconID_trashcan, iconState_grey ); 04009 ctrl_add_on_toolbar_sync_action(ctrl_show_sort_wnd_trigger); 04010 toolbar_enableUpdate(); 04011 toolbar_synchronise(); 04012 } 04013 break; 04014 04015 case iconState_selected: 04016 ctrl_hide_sort_wnd(TRUE); 04017 break; 04018 04019 default: 04020 /* 04021 * ignore 04022 */ ; 04023 } 04024 }

| void ctrl_on_toolbar_synchronised | ( | ) |
Definition at line 2739 of file control.c.
02740 { 02741 int i; 02742 02743 CL_IPCPRINTF("entry"); 02744 02745 display_update_request_screen_refresh(TOOLBAR_UPDATE_LEVEL); 02746 02747 // call functions for registered on_toolbar_sync_actions 02748 for (i = 0; i < sizeof(on_toolbar_sync_actions) / sizeof(on_toolbar_sync_actions[0]); i++) 02749 { 02750 if (on_toolbar_sync_actions[i] != NULL) 02751 { 02752 on_toolbar_sync_actions[i] (); 02753 on_toolbar_sync_actions[i] = NULL; 02754 } 02755 } 02756 }

| static gboolean ctrl_open_last_read_document | ( | void | ) | [static] |
Definition at line 4427 of file control.c.
04428 { 04429 CL_CONTROLPRINTF("entry"); 04430 04431 gboolean bRet = TRUE; 04432 ContentLister *theContentLister = gContentLister; 04433 04434 // scan the recent documents 04435 ctrl_display_recent_documents(); 04436 04437 if (theContentLister->itemCount > 0) 04438 { 04439 // open the first item in recent documents 04440 ctrl_listItem_clicked(0, theContentLister); 04441 } 04442 else 04443 { 04444 bRet = FALSE; 04445 CL_WARNPRINTF("User hasn't read any documents yet."); 04446 } 04447 04448 CL_CONTROLPRINTF("leave: bRet [%d]", bRet); 04449 return bRet; 04450 }

| static gboolean ctrl_open_quick_start_guide | ( | const char * | documentPath | ) | [static] |
Definition at line 4350 of file control.c.
04351 { 04352 CL_CONTROLPRINTF("entry"); 04353 04354 char dirname[ERMDS_MAX_FILENAME_SIZE]; 04355 char szLinkName[ERMDS_MAX_FILENAME_SIZE]; 04356 struct stat statbuf; 04357 gboolean done = FALSE; 04358 gboolean bRet = TRUE; 04359 04360 // create symlinks for quick start guide in recent documents 04361 if ( documentPath != NULL 04362 && stat(documentPath, &statbuf) == 0 ) 04363 { 04364 // QuickRef file exists 04365 if ( mdsGetRootLocation(st_RecentDocuments, dirname, sizeof(dirname)) > 0 ) 04366 { 04367 g_snprintf(szLinkName, ERMDS_MAX_FILENAME_SIZE, "%s/%s", dirname, "ZZZZZZ"); 04368 unlink(szLinkName); 04369 if (symlink(documentPath, szLinkName) == 0) 04370 { 04371 CL_LOGPRINTF("Created symlink [%s] -> [%s]", szLinkName, documentPath); 04372 done = TRUE; 04373 } 04374 else 04375 { 04376 CL_ERRORPRINTF( "Error [%s] on create symlink [%s] -> [%s]", 04377 strerror(errno), szLinkName, documentPath ); 04378 } 04379 } 04380 } 04381 04382 if (done) 04383 { 04384 // open the last read document, it's Quick Start Guide. 04385 bRet = ctrl_open_last_read_document(); 04386 } 04387 else 04388 { 04389 CL_WARNPRINTF("Can't open Quick Start Guide [%s], display recent documents", documentPath); 04390 ctrl_display_recent_documents(); 04391 bRet = FALSE; 04392 } 04393 04394 CL_CONTROLPRINTF("leave: bRet [%d]", bRet); 04395 return bRet; 04396 }
