contentLister/inc/control.h File Reference

control - handle input and keep state More...

#include "lister.h"
#include "gtkErrorScreen.h"
#include "metadataStoreManager.h"

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _contentLister

Defines

#define CATEGORIES_LIST   (-1)
#define CF_ID   "CF"
#define SD_ID   "SD"
#define USB_ID   "USB"
#define MAIN_MEMORY_ID   "MAIN"
#define RECENT_DOCS_ID   "RECENT"
#define ITEM_SELECT_TIMEOUT   6
#define ITEM_SELECT_TIMER_INTERVAL   500
#define ITEM_SELECT_TIMEOUT_TICKS   ((ITEM_SELECT_TIMEOUT * 1000) / ITEM_SELECT_TIMER_INTERVAL)
#define BG_CONNECT_RETRY_INTERVAL   5
#define PINCODE_MAX_IDLE_TIME   (5*60*1000)
#define ILLEGAL_FILENAME_CHARS   "*?/\\\"<>:|";
#define CONTENTLISTER_GROUP   "CONTENTLISTER"
#define DO_SHARE_KEY   "doc_sharing"
#define DO_SIGN_KEY   "doc_signing"
#define MODE_MENU_REFERENCE_MATERIALS_DIRNAME   "_reference/"
#define ERROR_STRING_BUFLEN   256

Typedefs

typedef struct _contentLister ContentLister

Enumerations

enum  ctrlScanType_e { ctrlScanCurrent = 0, ctrlScanPrevious = 1, ctrlScanNext = 2 }
enum  listerState_t {
  STATE_NORMAL = 0, STATE_USB_CONNECTED, STATE_DOWNLOADMGR, STATE_MISC,
  STATE_PINCODE, STATE_LANG_SEL, STATE_LAST
}
enum  e_ctrl_connect_reason_t {
  connect_manual, connect_background, connect_from_pincode, connect_after_reboot,
  connect_timed_ids_with_sw, connect_timed_ids_content_only, connect_timed_ids_background
}

Functions

ContentListerctrlInit (GtkWidget *topLevelWindow)
void ctrlSetScreenTexts (void)
void ctrlDestroy (ContentLister *contentLister)
void ctrl_listItem_clicked (int index, gpointer data)
st_ContentType_e ctrl_get_storageType (gchar *szExtID)
void ctrl_storage_changed (st_ContentType_e storageType, gboolean storagePresent)
void ctrl_contentType_button_clicked (st_ContentType_e type)
void ctrl_goto_page (int pagenumber)
void ctrl_connect_button_clicked (void)
void ctrl_disconnect (connectScr_e screen)
void ctrl_disconnect_wait (void)
void ctrl_background_connect_timeout_start (gboolean read_settings)
void ctrl_set_connect_icon (void)
void ctrl_new_content_received (void)
void ctrl_mode_button_long_clicked (void)
void ctrl_usbmode_keypress (void)
void ctrl_rescan_current (void)
unsigned int ctrl_get_item_index (ContentLister *theContentLister)
int ctrl_before_file_clicked (clDisplayItem_t *theItem)
void ctrl_mode_button_clicked (void)
void ctrl_display_download_history (void)
void ctrl_cleanup_download_history (void)
void ctrl_battery_low_screen (gint percentage, gint time_left, gboolean shutdown)
void ctrl_on_icon_clicked (int iconID, int iconState)
void ctrl_on_lock_screen_clicked (int iconState)
void ctrl_on_toolbar_synchronised ()
void ctrl_show_lister_area (void)
void ctrl_hide_lister_area (void)
void ctrl_hide_misc_screen (void)
listerState_t getListerState ()
void setListerState (listerState_t newstate)
gboolean listerIsErrorScreenVisible (void)
void listerHideErrorScreen (void)
void listerShowErrorScreen (ctrlErrorType_e errorType)
void listerShowUSBScreen (void)
void listerHideUSBScreen (void)
void ctrl_update_pagebar (void)
void ctrl_shutdown (void)
void ctrl_display_search_result (void)
void ctrl_hide_search_wnd (void)
const char * ctrl_get_abscurr_location (char *sPath, int iSize)
gboolean ctrl_location_is_outbox (const char *location)
void ctrl_pincode_setting_init (void)
void ctrl_show_pincode_screen (showPincodeReason_t reason, on_passed_callback_t *on_passed_callback, on_cancel_callback_t *on_cancel_callback)
void ctrl_hide_pincode_screen (void)
gboolean ctrl_pincode_is_for_locking (void)
void ctrl_pincode_overview_button_clicked (void)
void ctrl_pincode_connect_button_clicked (void)
void ctrl_pincode_button_clicked (void)
gboolean ctrl_is_connect_from_pincode (void)
void ctrl_connect_back_to_pincode_screen (void)
void ctrl_startup (void)
void ctrl_export_config (void)
void ctrl_handle_import_config (void)
gboolean on_idle_connect_start_background (gpointer p)
void ctrl_connect (connectScr_e screen, e_ctrl_connect_reason_t reason)


Detailed Description

control - handle input and keep state

<File description>="">

Definition in file control.h.


Define Documentation

#define BG_CONNECT_RETRY_INTERVAL   5

Definition at line 57 of file control.h.

#define CATEGORIES_LIST   (-1)

Definition at line 42 of file control.h.

#define CF_ID   "CF"

Definition at line 45 of file control.h.

#define CONTENTLISTER_GROUP   "CONTENTLISTER"

Definition at line 66 of file control.h.

#define DO_SHARE_KEY   "doc_sharing"

Definition at line 67 of file control.h.

#define DO_SIGN_KEY   "doc_signing"

Definition at line 68 of file control.h.

#define ERROR_STRING_BUFLEN   256

Definition at line 72 of file control.h.

#define ILLEGAL_FILENAME_CHARS   "*?/\\\"<>:|";

Definition at line 63 of file control.h.

#define ITEM_SELECT_TIMEOUT   6

Definition at line 52 of file control.h.

#define ITEM_SELECT_TIMEOUT_TICKS   ((ITEM_SELECT_TIMEOUT * 1000) / ITEM_SELECT_TIMER_INTERVAL)

Definition at line 54 of file control.h.

#define ITEM_SELECT_TIMER_INTERVAL   500

Definition at line 53 of file control.h.

#define MAIN_MEMORY_ID   "MAIN"

Definition at line 48 of file control.h.

#define MODE_MENU_REFERENCE_MATERIALS_DIRNAME   "_reference/"

Definition at line 70 of file control.h.

#define PINCODE_MAX_IDLE_TIME   (5*60*1000)

Definition at line 59 of file control.h.

#define RECENT_DOCS_ID   "RECENT"

Definition at line 49 of file control.h.

#define SD_ID   "SD"

Definition at line 46 of file control.h.

#define USB_ID   "USB"

Definition at line 47 of file control.h.


Typedef Documentation

typedef struct _contentLister ContentLister


Enumeration Type Documentation

Enumerator:
ctrlScanCurrent 
ctrlScanPrevious 
ctrlScanNext 

Definition at line 74 of file control.h.

00075 {
00076     ctrlScanCurrent = 0,
00077     ctrlScanPrevious = 1,
00078     ctrlScanNext = 2,
00079 } ctrlScanType_e;

Enumerator:
connect_manual 
connect_background 
connect_from_pincode 
connect_after_reboot 
connect_timed_ids_with_sw 
connect_timed_ids_content_only 
connect_timed_ids_background 

Definition at line 118 of file control.h.

Enumerator:
STATE_NORMAL 
STATE_USB_CONNECTED 
STATE_DOWNLOADMGR 
STATE_MISC 
STATE_PINCODE 
STATE_LANG_SEL 
STATE_LAST 

Definition at line 107 of file control.h.

00107              {
00108     STATE_NORMAL = 0,
00109     STATE_USB_CONNECTED,
00110     STATE_DOWNLOADMGR,
00111     STATE_MISC,// combine rename, search, sort states into one state STATE_MISC
00112     STATE_PINCODE,
00113     STATE_LANG_SEL,
00114     STATE_LAST
00115 } listerState_t;


Function Documentation

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

void ctrl_contentType_button_clicked ( st_ContentType_e  type  ) 

category button selected

Parameters:
data - reference contentLister data
Returns:
-

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

void ctrl_export_config ( void   ) 

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 }

Here is the call graph for this function:

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 }

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

Parameters:
pagenumber the requested page number
Returns:
--

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 }

Here is the call graph for this function:

void ctrl_handle_import_config ( void   ) 

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

void ctrl_listItem_clicked ( int  index,
gpointer  data 
)

Gtk list item clicked callback routine

Parameters:
data index of the item in the pageitem list
reference passed during lsInit
Returns:
-

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 }

Here is the call graph for this function:

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 }

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 }

Here is the call graph for this function:

void ctrl_mode_button_long_clicked ( void   ) 

Definition at line 1889 of file control.c.

01890 {
01891     ctrl_display_recent_documents();
01892 }

Here is the call graph for this function:

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 }

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:

void ctrl_pincode_button_clicked ( void   ) 

Definition at line 3780 of file control.c.

03781 {
03782     accumulate_idle_time_reset();
03783     erbusy_off();
03784 }

Here is the call graph for this function:

void ctrl_pincode_connect_button_clicked ( void   ) 

Definition at line 3759 of file control.c.

03760 {
03761     gboolean bIsForLocking;
03762 
03763     accumulate_idle_time_reset();
03764 
03765     bIsForLocking = ctrl_pincode_is_for_locking();
03766     if (!bIsForLocking)
03767     {
03768         erbusy_off();
03769         return;
03770     }
03771     
03772     CL_LOGPRINTF("Connect from PINCODE...");
03773     // when downloading, we should remove accumulate_idle_time
03774     // to prevent shutdown device due to idle
03775     accumulate_idle_time_end();
03776 
03777     ctrl_connect(connectScrUnchanged, connect_from_pincode);
03778 }

Here is the call graph for this function:

gboolean ctrl_pincode_is_for_locking ( void   ) 

Definition at line 3702 of file control.c.

03703 {
03704     gboolean bIsForLocking=TRUE;
03705     ContentLister *theContentLister;
03706     showPincodeReason_t reason;
03707     
03708     theContentLister = gContentLister;
03709     if (NULL == theContentLister)
03710         return bIsForLocking;
03711     if (NULL == theContentLister->pincodeScreen)
03712         return bIsForLocking;
03713     reason = (showPincodeReason_t)gtk_pincode_screen_get_reason(theContentLister->pincodeScreen);
03714     switch (reason)
03715     {
03716         case startup_t:
03717         case lockScreen_t:
03718             bIsForLocking = TRUE;
03719         break;
03720         
03721         case signDocument_t:
03722         case enterSettings_t:
03723         case importSettings_t:
03724             bIsForLocking = FALSE;
03725         break;
03726         
03727         default:
03728             bIsForLocking = TRUE;
03729     }
03730     return bIsForLocking;
03731 }

Here is the call graph for this function:

void ctrl_pincode_overview_button_clicked ( void   ) 

Definition at line 3738 of file control.c.

03739 {
03740    showPincodeReason_t reason;
03741    gboolean bIsForLocking;
03742 
03743     accumulate_idle_time_reset();
03744 
03745     bIsForLocking = ctrl_pincode_is_for_locking();
03746     if (bIsForLocking)
03747     {
03748         erbusy_off();
03749         return;
03750     }
03751 
03752     ContentLister *theContentLister = gContentLister;
03753     reason = gtk_pincode_screen_get_reason(theContentLister->pincodeScreen);
03754     ctrl_hide_pincode_screen();
03755     gtk_pincode_screen_on_cancel_callback(theContentLister->pincodeScreen);
03756 }

Here is the call graph for this function:

void ctrl_pincode_setting_init ( void   ) 

Definition at line 3564 of file control.c.

03565 {
03566     gboolean enable = FALSE;
03567     gchar pincode[PINCODE_MAX_LENGTH + 1];
03568     ContentLister *theContentLister = gContentLister;
03569 
03570     g_return_if_fail(NULL != theContentLister);
03571     g_return_if_fail(NULL != theContentLister->pincodeScreen);
03572     sysset_read_pincode_onoff(&enable);
03573     sysset_read_pincode_string(pincode);
03574     
03575     gtk_pincode_screen_set_pincode_settings(theContentLister->pincodeScreen, enable, pincode);
03576     ctrl_pincode_set_toolbar_icon();
03577 }

Here is the call graph for this function:

void ctrl_rescan_current ( void   ) 

Definition at line 1638 of file control.c.

01639 {
01640     CL_CONTROLPRINTF("entry: currentError [%d]", gContentLister->currentError);
01641 
01642     if (gContentLister->currentError == ctrlNoError)
01643     {
01644         CL_CONTROLPRINTF("rescan folder only, current content type = %d", gContentLister->currentContentType);
01645         ctrl_scan_content(gContentLister, ctrlScanCurrent, NULL);
01646     }
01647 }

Here is the call graph for this function:

void ctrl_set_connect_icon ( void   ) 

Definition at line 435 of file control.c.

00436 {
00437 
00438     CL_LOGPRINTF("entry");
00439     
00440     // update connect-state on toolbar
00441     if (g_new_content_received)
00442     {
00443         if (gContentLister->currentContentType == st_DownloadHistory)
00444         {
00445             toolbar_setIconState(iconID_connect, 
00446                 g_new_content_acknowledged ? iconState_IDconnect_newcontent_selected : iconState_IDconnect_newcontent);
00447         }
00448         else if (g_new_content_acknowledged)
00449         {
00450             toolbar_setIconState(iconID_connect, g_background_connect_enable ? iconState_IDconnect_time : iconState_normal);
00451             g_new_content_received = FALSE;
00452         }
00453         else
00454         {
00455             toolbar_setIconState(iconID_connect, iconState_IDconnect_newcontent);
00456         }
00457     }
00458     else
00459     {
00460         toolbar_setIconState(iconID_connect, g_background_connect_enable ? iconState_IDconnect_time : iconState_normal);
00461     }
00462 }

Here is the call graph for this function:

void ctrl_show_lister_area ( void   ) 

Definition at line 2758 of file control.c.

02759 {
02760     if (gContentLister->listerArea)
02761     {
02762         gtk_widget_show(gContentLister->listerArea);
02763     }
02764 }

void ctrl_show_pincode_screen ( showPincodeReason_t  reason,
on_passed_callback_t on_passed_callback,
on_cancel_callback_t on_cancel_callback 
)

Definition at line 3579 of file control.c.

03580 {
03581     CL_LOGPRINTF("PINCODE screen show");
03582 
03583     ContentLister *theContentLister = gContentLister;
03584     char *UaOnTop = NULL;
03585 
03586     g_return_if_fail(theContentLister != NULL);
03587     g_return_if_fail(theContentLister->pincodeScreen != NULL);
03588     g_return_if_fail(g_listerState != STATE_PINCODE);
03589 
03590     if (reason != startup_t)
03591     {
03592         // abort miscellaneous contentLister windows
03593         ctrl_hide_misc_screen();
03594 
03595         // bring contentlister on top
03596         UaOnTop = pm_getUaOnTop ();
03597         CL_CONTROLPRINTF ("%s on top", UaOnTop);
03598         strncpy (restoreUaOnTop, UaOnTop, sizeof (restoreUaOnTop)); 
03599         if ((strncmp (UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0)) 
03600         { 
03601             // contentLister not "On Top" => show contentlister 
03602             CL_CONTROLPRINTF ("CL NOT on top");
03603             display_update_increase_level(NO_DISPLAY_UPDATE_LEVEL);
03604             pm_RaiseContentLister (); 
03605         }
03606     }
03607 
03608     if (GTK_WIDGET_VISIBLE(theContentLister->pincodeScreen) == FALSE)
03609     {
03610         // => only request a refresh on the main window expose event
03611         CL_SCREENPRINTF("Display pincode screen");
03612         if (display_update_get_level() == NO_DISPLAY_UPDATE_LEVEL)
03613         {
03614             display_update_decrease_level(MAIN_WINDOW_EXPOSE_LEVEL);
03615         }
03616         else
03617         {
03618             display_update_increase_level(MAIN_WINDOW_EXPOSE_LEVEL);
03619         }
03620         gtk_window_fullscreen(GTK_WINDOW(theContentLister->topLevelWindow));
03621         gtk_widget_hide(GTK_WIDGET(theContentLister->listerScreen ));
03622         gtk_widget_hide(GTK_WIDGET(theContentLister->errorScreen  ));
03623         gtk_widget_show(GTK_WIDGET(theContentLister->pincodeScreen));
03624         gtk_widget_grab_focus(GTK_WIDGET(theContentLister->pincodeScreen));
03625     }
03626     // it's possible user change or reset pincode after we create gtkPincdeScreen
03627     ctrl_pincode_setting_init();
03628 
03629     // when show pincode screen
03630     // and disable usb connect with pc
03631     // and begin to accumulate idle time 
03632     // and reset the pincode passed
03633 
03634     // attention: when launched downloadMgr, will change contentlister status to STATE_DOWNLOADMGR
03635     setListerState(STATE_PINCODE);
03636     erStopMSDiskApp();
03637    
03638     accumulate_idle_time_set_callback(ctrl_pincode_idle_time_callback);
03639     accumulate_idle_time_set_threshold(PINCODE_MAX_IDLE_TIME);
03640     gtk_pincode_screen_layout_reset(theContentLister->pincodeScreen);
03641     gtk_pincode_screen_data_reset(theContentLister->pincodeScreen);
03642     gtk_pincode_screen_set_reason(theContentLister->pincodeScreen, reason);
03643     gtk_pincode_screen_set_on_passed_callback(theContentLister->pincodeScreen, on_passed_callback);
03644 
03645     if (ctrl_pincode_is_for_locking())
03646     {
03647         gtk_pincode_screen_set_on_cancel_callback(theContentLister->pincodeScreen, NULL);
03648     }
03649     else
03650     {
03651         gtk_pincode_screen_set_on_cancel_callback(theContentLister->pincodeScreen, on_cancel_callback);
03652     }
03653 }

Here is the call graph for this function:

void ctrl_shutdown ( void   ) 

Definition at line 3384 of file control.c.

03385 {
03386     CL_WARNPRINTF("entry");
03387 
03388     g_shutdownPending = TRUE;
03389 
03390     // keep busy led on
03391     erbusy_shutdown();
03392 
03393     // block all keys
03394     button_block_all_keys(TRUE);
03395     
03396     // hide pincode screen
03397     ctrl_hide_pincode_screen();
03398 
03399     // show a "System will shutdown now message"
03400     listerShowErrorScreen(ctrlSystemShutdownError);
03401 
03402     // store last view content logging data before killing the
03403     // contentLister process
03404     ctrlDestroy(gContentLister);
03405 
03406     // re-create RTC alarm if needed
03407     timed_ids_final();
03408 
03409     // stop usb export of filesystem
03410     erStopMSDiskApp();
03411 
03412     // and stop the system
03413     system("halt");
03414 
03415     CL_WARNPRINTF("end");
03416 }

Here is the call graph for this function:

void ctrl_startup ( void   ) 

Definition at line 4159 of file control.c.

04160 {
04161     CL_CONTROLPRINTF("entry");
04162     
04163     gboolean      enable = FALSE;
04164     gchar         pincode[PINCODE_MAX_LENGTH + 1];   
04165     ContentLister *theContentLister = gContentLister;
04166 
04167     static gboolean firsttime = TRUE;
04168 
04169     g_return_if_fail(theContentLister != NULL);
04170     g_return_if_fail(g_shutdownPending == FALSE);
04171 
04172     // If user hasn't set language yet or the current language hasn't been installed,
04173     // run 'setup --select-language-only' to let user set language.
04174     // Do this only once, user may exit setup without selecting a language.
04175     if (firsttime  &&  !languageSelected())
04176     {
04177         setListerState(STATE_LANG_SEL);
04178         display_update_increase_level(NO_DISPLAY_UPDATE_LEVEL);
04179         gtk_idle_add(ctrl_on_idle_select_language, (gpointer)FALSE);
04180     }
04181     else
04182     {
04183         // read the pincode settings
04184         sysset_read_pincode_onoff(&enable);
04185         sysset_read_pincode_string(pincode);
04186 
04187         gtk_pincode_screen_set_pincode_settings(theContentLister->pincodeScreen, enable, pincode);
04188         if (enable  &&  strlen(pincode) > 0)
04189         {
04190             CL_LOGPRINTF("PINCODE on-show pincode screen");
04191             ctrl_show_pincode_screen(startup_t, ctrl_start_up_behaviour, NULL);
04192         }
04193         else
04194         {
04195             CL_LOGPRINTF("PINCODE off or empty - user customized start-up behaviour");
04196             ctrl_pincode_set_toolbar_icon();
04197             ctrl_start_up_behaviour();
04198         }
04199     }
04200 
04201     firsttime = FALSE;
04202     CL_CONTROLPRINTF("leave");
04203 }

Here is the call graph for this function:

void ctrl_storage_changed ( st_ContentType_e  storageType,
gboolean  storagePresent 
)

A storage module has been inserted or removed

Parameters:
storage module identification
1/0 = module present yes/no
Returns:
-

Definition at line 770 of file control.c.

00771 {
00772     ContentLister *theContentLister = gContentLister;
00773     
00774     CL_CONTROLPRINTF("Entry: storageType [%d] Present [%d]", storageType, storagePresent);
00775 
00776     if (storagePresent)
00777     {
00778         // if the archive locations are redirected to the storage device,
00779         // check the archive folders exits or not, if not create them
00780         mdsRecreateArchives(storageType);
00781     }
00782 
00783     if (theContentLister != NULL 
00784         && (theContentLister->currentContentType == storageType 
00785             || mdsArcLocIsChanged(theContentLister->currentContentType, storageType)) )
00786     {
00787         if (!storagePresent)
00788         {
00789             ctrl_hide_misc_screen();
00790         }
00791         ctrl_select_stop(TRUE);
00792 
00793         if (stackIsStorage(storageType) == TRUE)
00794         {
00795             CL_CONTROLPRINTF("scan storage type %d", storageType);
00796             stackClear(theContentLister->currentContentType);
00797             ctrl_scan_content(theContentLister, ctrlScanCurrent, NULL);
00798         }
00799         else
00800         {
00801             CL_ERRORPRINTF("invalid storage type");
00802         }
00803     }
00804 
00805     erMSDisk_storage_changed(storageType, storagePresent);
00806 }

Here is the call graph for this function:

void ctrl_update_pagebar ( void   ) 

void ctrl_usbmode_keypress ( void   ) 

Definition at line 2171 of file control.c.

02172 {
02173     CL_CONTROLPRINTF("entry");
02174 
02175     ctrl_errorScreen_buttonpress(NULL, NULL, gContentLister);
02176 }

Here is the call graph for this function:

void ctrlDestroy ( ContentLister contentLister  ) 

destroy contentlister modules - clean up allocated memory and store the loggin information in Flash

Parameters:
contentLister reference contentLister data
Returns:
-

Definition at line 472 of file control.c.

00473 {
00474     g_return_if_fail(contentLister != NULL);
00475 
00476     // TODO : store the last read content 
00477 
00478     // destroy the history information
00479     hsDestroy();
00480 
00481     pm_DestroyProgramManager();
00482 
00483     // store the loggin information 
00484     // g_free(contentLister);
00485 
00486     // free page content
00487     // mdsDestroy();
00488 
00489     // free pixmaps
00490     // icons_destroy();
00491 }

Here is the call graph for this function:

ContentLister* ctrlInit ( GtkWidget *  topLevelWindow  ) 

Init contentlister modules/data : - init meta data store (logging information)

  • init screen layout
  • init button handling
  • init history data
  • init IPC communication
  • allocate ContentLister, for maintaining state

Parameters:
window reference to the top level window
Returns:
reference to contentLister structure, NULL in case of failure

Definition at line 195 of file control.c.

00196 {
00197     ContentLister *theContentLister = NULL;
00198     guint         signal_id;
00199 
00200     // create one theContentLister struct and fill it with zeros
00201     theContentLister = g_new0(ContentLister, 1);
00202     theContentLister->topLevelWindow = topLevelWindow;
00203     gContentLister = theContentLister;
00204 
00205     // init the connect fsm thread
00206     erConnectInit(&connectStruct);
00207 
00208     // init the msdisk application
00209     erMSDiskInit();
00210 
00211     // load the frequently used icons
00212     icons_init();
00213 
00214     // init the meta data store (including the contenttype history/stack)
00215     mdsInit();
00216 
00217     // init the history information
00218     hsInit();
00219 
00220     viewerInstallIpcServer();
00221 
00222     // whether or not the viewers are actually there is not important
00223     // during the init phase
00224     viewerInit(BROWSER_APP);
00225 
00226     erbusy_init();
00227     pagebar_init();
00228     toolbar_init();
00229 
00230     // power Manager init
00231     // MvdW: power manager disabled for now, needs more testing...
00232     // power_init();
00233 
00234     // init content key handling
00235     button_init(theContentLister);
00236 
00237     // init the program manager
00238     if (pm_InitProgramManager() != TRUE)
00239     {
00240         CL_ERRORPRINTF("Error initializing programManager, this will most likely cause a crash...");
00241     }
00242 
00243     // init the screen layout
00244     ctrl_init_screen_layout(topLevelWindow, theContentLister);
00245     theContentLister->lister = lsInit(theContentLister->listerArea, theContentLister);
00246     create_content_metadata_wnd(theContentLister->contentEditWnd);
00247     create_search_wnd(theContentLister->searchWnd);
00248     create_sort_wnd(theContentLister->sortWnd);
00249     create_dist_list_wnd(theContentLister->distListWnd);
00250     ctrlSetScreenTexts();
00251 
00252     // install class-specific screen update handlers
00253     //   erGtkEntry
00254     signal_id = g_signal_lookup("screen-refresh", ERGTK_ENTRY_TYPE);
00255     g_assert(signal_id > 0);
00256     g_signal_add_emission_hook(signal_id, 0, hook_screen_refresh_typing, (gpointer)TEXTENTRY_CHANGED_LEVEL, NULL);
00257     //   erGtkToggleButton
00258     signal_id = g_signal_lookup("toggled", ERGTK_TOGGLE_BUTTON_TYPE);
00259     g_assert(signal_id > 0);
00260     g_signal_add_emission_hook(signal_id, 0, hook_screen_refresh_typing, (gpointer)TEXTENTRY_CHANGED_LEVEL, NULL);
00261 
00262     cursor_init(theContentLister);
00263 
00264     theContentLister->itemCount = 0;
00265     theContentLister->currentContentType = st_ContentTypeUndefined;
00266     theContentLister->previousContentType = st_ContentTypeUndefined;
00267     theContentLister->currentFocus = 0;
00268     theContentLister->pagecount = 0;
00269     theContentLister->currentPage = 0;
00270     theContentLister->currentError = ctrlNoError;
00271 
00272     // Re-connect to server when requested
00273     gboolean do_connect = FALSE;
00274     int err = scGet_Reconnect(&do_connect);
00275     if (err == 0 && do_connect)
00276     {
00277         display_update_increase_level(NO_DISPLAY_UPDATE_LEVEL);
00278         g_idle_add(on_idle_connect_start, NULL);
00279     }
00280     else if (get_timedids_connect_reason() == connect_after_wakeup)
00281     {
00282         // iLiad is waken up by RTC alarm, need to connect to iDS
00283         display_update_increase_level(NO_DISPLAY_UPDATE_LEVEL);
00284         g_idle_add(on_timedids_connect_after_wakeup, NULL);
00285     }
00286     else
00287     {
00288         // Normal startup actions: select language, open QuickRef, etc.
00289         ctrl_startup();
00290     }
00291 
00292     return theContentLister;
00293 }

Here is the call graph for this function:

void ctrlSetScreenTexts ( void   ) 

Set fixed screen texts

Definition at line 307 of file control.c.

00308 {
00309     content_metadata_set_text();
00310     search_wnd_set_text();
00311     sort_wnd_set_text();
00312 }

Here is the call graph for this function:

listerState_t getListerState (  ) 

Definition at line 2062 of file control.c.

02063 {
02064     CL_CONTROLPRINTF("return [%d]", g_listerState);
02065     return g_listerState;
02066 }

void listerHideErrorScreen ( void   ) 

Definition at line 2367 of file control.c.

02368 {
02369     CL_CONTROLPRINTF("entry");
02370 
02371     if (gContentLister && listerIsErrorScreenVisible())
02372     {
02373         // hide error screen
02374         // => only request a refresh on the main window expose event
02375         CL_SCREENPRINTF("");
02376         display_update_increase_level(MAIN_WINDOW_EXPOSE_LEVEL);
02377         
02378         if (ctrl_is_connect_from_pincode())
02379         {
02380             setListerState(STATE_PINCODE);
02381         }
02382 
02383         if (STATE_PINCODE == getListerState())
02384         {
02385             CL_WARNPRINTF("hide error, show pincode");
02386             gtk_window_fullscreen(GTK_WINDOW(gContentLister->topLevelWindow));
02387             gtk_widget_hide(GTK_WIDGET(gContentLister->listerScreen ));
02388             gtk_widget_hide(GTK_WIDGET(gContentLister->errorScreen  ));
02389             gtk_widget_show(GTK_WIDGET(gContentLister->pincodeScreen));
02390             gtk_widget_grab_focus(GTK_WIDGET(gContentLister->pincodeScreen));
02391         }
02392         else
02393         {
02394             CL_WARNPRINTF("hide error, show listArea");
02395             gtk_window_unfullscreen(GTK_WINDOW(gContentLister->topLevelWindow));
02396             gtk_widget_show(GTK_WIDGET(gContentLister->listerScreen ));
02397             gtk_widget_hide(GTK_WIDGET(gContentLister->errorScreen  ));
02398             gtk_widget_hide(GTK_WIDGET(gContentLister->pincodeScreen));
02399             gtk_widget_grab_focus(GTK_WIDGET(gContentLister->listerArea));
02400         }
02401         g_errorTypeDisplayed = ctrlNoError;
02402         
02403         if ((strncmp(restoreUaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0))
02404         {
02405             pm_RaiseUserApp(restoreUaOnTop);
02406             strncpy(restoreUaOnTop, CONTENTLISTER_UAID, sizeof(restoreUaOnTop));
02407         }
02408 
02409         if (g_idle_check_battery_id > 0)
02410         {
02411             g_source_remove(g_idle_check_battery_id);
02412             g_idle_check_battery_id = 0;
02413         }
02414     }
02415 }

Here is the call graph for this function:

void listerHideUSBScreen ( void   ) 

Definition at line 2100 of file control.c.

02101 {
02102     CL_CONTROLPRINTF("entry");
02103 
02104     if (gContentLister)
02105     {
02106         if (gContentLister->currentError == ctrlNoError)
02107         {
02108             listerHideErrorScreen();
02109         }
02110         else
02111         {
02112             listerShowErrorScreen(gContentLister->currentError);
02113         }
02114     }
02115 }

Here is the call graph for this function:

gboolean listerIsErrorScreenVisible ( void   ) 

Definition at line 2158 of file control.c.

02159 {
02160     gboolean ret = FALSE;
02161 
02162     if (gContentLister->errorScreen)
02163     {
02164         ret = GTK_WIDGET_VISIBLE(gContentLister->errorScreen);
02165     }
02166 
02167     CL_CONTROLPRINTF("return [%d]", ret);
02168     return ret;
02169 }

void listerShowErrorScreen ( ctrlErrorType_e  errorType  ) 

Definition at line 2240 of file control.c.

02241 {
02242     char *UaOnTop;
02243 
02244     CL_SCREENPRINTF("entry: errorType [%d]", errorType);
02245 
02246     if (gContentLister)
02247     {
02248         toolbar_disableUpdate();
02249 
02250         // abort miscellaneous contentLister windows
02251         ctrl_hide_misc_screen();
02252         toolbar_setIconState(iconID_search,   iconState_grey);
02253         toolbar_setIconState(iconID_sort,     iconState_grey);
02254         toolbar_setIconState(iconID_share,    iconState_grey);
02255         toolbar_setIconState(iconID_tagging,  iconState_grey);
02256         toolbar_setIconState(iconID_trashcan, iconState_grey);
02257 
02258         // hide keyboard
02259         ctrl_hide_keyboard(iconState_grey);
02260         toolbar_enableUpdate();
02261 
02262         // bring contentlister on top
02263         UaOnTop = pm_getUaOnTop();
02264         strncpy(restoreUaOnTop, UaOnTop, sizeof(restoreUaOnTop));
02265         if ((strncmp(UaOnTop, CONTENTLISTER_UAID, UAID_MAX_SIZE) != 0))
02266         {
02267             display_update_increase_level(NO_DISPLAY_UPDATE_LEVEL);
02268             CL_SCREENPRINTF("restoreUaOnTop=%s", restoreUaOnTop);
02269             pm_RaiseContentLister();
02270         }
02271 
02272         const char* card_name = NULL;
02273         char buf[ERROR_STRING_BUFLEN];
02274         switch (errorType)
02275         {
02276             case ctrlConnectedUSBError:
02277                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen), _("Connected to PC..."));
02278                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlDontDisconnectNWIcon);
02279                 break;
02280 
02281             case ctrlExportingDevUnavailError:
02282                 switch (get_exported_memory_type())
02283                 {
02284                     case expMMC:
02285                         card_name = _("MMC card");
02286                         break;
02287                     case expUSB:
02288                         card_name = _("USB stick");
02289                         break;
02290                     case expCF:
02291                         card_name = _("CF card");
02292                         break;
02293                     default:
02294                         break;
02295                 }
02296                 snprintf(buf, ERROR_STRING_BUFLEN, _("Connected to PC.\nThe %s storage is not available, Internal Memory is exported instead."), card_name);
02297 
02298                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen), buf);
02299                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlWarningIcon);
02300                 break;
02301 
02302             case ctrlBatteryLowError:
02303                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02304                         _("Your battery is almost empty, please connect the power adapter to keep working."));
02305                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlBatteryLowIcon);
02306                 g_idle_check_battery_id = g_idle_add(idle_CheckBattery_HideErrorScreen, NULL);
02307                 break;
02308 
02309             case ctrlSystemShutdownError:
02310                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02311                         _("The iLiad is preparing for power down."));
02312                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlSystemShutdownIcon);
02313                 break;
02314 
02315             case ctrlScanTooManyItemsError:
02316                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02317                         _("There are too many items to display. Only the first 1000 items will be listed."));
02318                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlWarningIcon);
02319                 break;
02320 
02321             case ctrlScanFailedError:
02322                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02323                         _("Reading of content has failed due to an unknown reason."));
02324                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlErrorIcon);
02325                 break;
02326 
02327             case ctrlContentNotAvailableError:
02328                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02329                         _("Content isn't accessible any more."));
02330                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlInfoIcon);
02331                 break;
02332 
02333             case ctrlNoNetworkConfiguredError:
02334                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02335                         _("No network configured."));
02336                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlErrorIcon);
02337                 break;
02338 
02339             default:
02340                 gtk_error_screen_set_text(GTK_ERROR_SCREEN(gContentLister->errorScreen),
02341                         _("An unknown event occurred."));
02342                 gtk_error_screen_set_image(GTK_ERROR_SCREEN(gContentLister->errorScreen), ctrlInfoIcon);
02343         }
02344         g_errorTypeDisplayed = errorType;
02345 
02346         if (listerIsErrorScreenVisible() == FALSE)
02347         {
02348             // => only request a refresh on the main window expose event
02349             CL_SCREENPRINTF("Display error screen");
02350             if (display_update_get_level() == NO_DISPLAY_UPDATE_LEVEL)
02351             {
02352                 display_update_decrease_level(MAIN_WINDOW_EXPOSE_LEVEL);
02353             }
02354             else
02355             {
02356                 display_update_increase_level(MAIN_WINDOW_EXPOSE_LEVEL);
02357             }
02358             gtk_window_fullscreen(GTK_WINDOW(gContentLister->topLevelWindow));
02359             gtk_widget_hide(GTK_WIDGET(gContentLister->listerScreen ));
02360             gtk_widget_show(GTK_WIDGET(gContentLister->errorScreen  ));
02361             gtk_widget_hide(GTK_WIDGET(gContentLister->pincodeScreen));
02362             gtk_widget_grab_focus(GTK_WIDGET(gContentLister->errorScreen));
02363         }
02364     }
02365 }

Here is the call graph for this function:

void listerShowUSBScreen ( void   ) 

Definition at line 2086 of file control.c.

02087 {
02088     CL_CONTROLPRINTF("entry");
02089 
02090     if (get_exported_memory_type() == get_memory_type_used())
02091     {
02092         listerShowErrorScreen(ctrlConnectedUSBError);
02093     }
02094     else
02095     {
02096         listerShowErrorScreen(ctrlExportingDevUnavailError);
02097     }
02098 }

Here is the call graph for this function:

gboolean on_idle_connect_start_background ( gpointer  p  ) 

Alexis 30nov07 DOWNLOADMGR_APP no longer used for manual connect, now PROFILES_APP ** else if ( strcmp(uaOnTop, DOWNLOADMGR_APP) == 0 ) { manual connect busy --> ignore CL_WARNPRINTF("Download manager active, no background connect"); }

Definition at line 323 of file control.c.

00324 {
00325     CL_LOGPRINTF("entry");
00326 
00327     g_assert(p);
00328 
00329     e_ctrl_connect_reason_t connReason = (e_ctrl_connect_reason_t)p;
00330 
00331     const gchar* uaOnTop = pm_getUaOnTop();
00332 
00333     if (   strcmp(uaOnTop, PROFILES_APP) == 0
00334         || strcmp(uaOnTop, SETUP_APP   ) == 0
00335         || listerIsErrorScreenVisible()
00336         || g_select.active                   )
00337     {
00338         // profile editor or manual connect is running
00339         // or settings applicationf is running
00340         // or error screen is visible
00341         //     --> try again after retry interval
00342         CL_WARNPRINTF("Retry after [%d] minutes", BG_CONNECT_RETRY_INTERVAL);
00343         if (connReason == connect_timed_ids_background)
00344         {
00345             timed_ids_handle_recreate_timer(BG_CONNECT_RETRY_INTERVAL);
00346         }
00347         else
00348         {
00349             ctrl_background_connect_timeout_start_withinterval(FALSE, FALSE, BG_CONNECT_RETRY_INTERVAL);
00350         }
00351     }
00359     else
00360     {
00361         // no problems -> do background connect to iDS
00362         CL_WARNPRINTF("Do background connect");
00363 
00364         if (connReason == connect_timed_ids_background)
00365         {
00366             set_timedids_connect_reason(connect_when_running);
00367         }
00368         
00369         ctrl_connect(connectScrUnchanged, connReason);
00370     }
00371 
00372     return FALSE;  // don't call again
00373 }

Here is the call graph for this function:

void setListerState ( listerState_t  newstate  ) 

Definition at line 2068 of file control.c.

02069 {
02070     CL_CONTROLPRINTF("entry: state old [%d] new [%d]", g_listerState, newstate);
02071 
02072     // need to rescan if state changes from STATE_USB_CONNECTED to normal
02073     if (STATE_USB_CONNECTED == g_listerState && STATE_NORMAL == newstate)
02074     {
02075         // set new state and rescan
02076         g_listerState = newstate; // set new state before rescan (ref. BT 802)
02077         CL_CONTROLPRINTF("rescan after disconnected from PC");
02078         ctrl_scan_content(gContentLister, ctrlScanCurrent, 0);
02079     }
02080     else
02081     {
02082         g_listerState = newstate;
02083     }
02084 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:12:46 2008 by  doxygen 1.5.6