00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023
00024
00025
00026
00027 #ifndef __ERMDSCONTENT__H__
00028 #define __ERMDSCONTENT__H__
00029
00030 #include <glib.h>
00031
00032 #ifdef __cplusplus
00033 extern "C"
00034 {
00035 #endif
00036
00037
00038
00039 #define OUTBOX_NAME "outbox"
00040
00041
00042 #define XMLNODE_SELECTION_LIST "/package/metadata/selection-list"
00043
00044
00045 #define SELECTION_TRANSFER_MODE "transfer-mode"
00046 #define ITEM_TRANSFER_MOVE "move"
00047
00048 #define SELECTION_DOCUMENT_SIGNING "document-signing"
00049 #define ITEM_SIGN_YES "sign"
00050
00051
00052 #define ERMDS_MAX_FILENAME_SIZE 1024
00053 #define ERMDS_MAX_EXTENSION_SIZE 5
00054 #define ERMDS_MAX_SEARCH_STRING_SIZE 512
00055 #define ERMDS_MAX_EXTENSION_ID_SIZE 128
00056
00057 #define ERMDS_MAX_SYMLINK_CHAIN 10
00058
00059 #define ERCL_MAX_TITLE_SIZE 512
00060 #define ERCL_MAX_SUBTITLE_SIZE 512
00061 #define ERCL_MAX_DESCRIPTION_SIZE 512
00062
00063 #define ERCL_MAX_FIELDNAME_SIZE 128
00064
00065 #define ERMDS_INITIAL_CONTENT_SCAN_ARRAY_SIZE 100
00066 #define ERMDS_MAX_CONTENT_SCAN_ARRAY_SIZE (1024-1) // Always take a power of two minus 1
00067
00068
00069 #define ERMDS_CONTENT_SCAN_OK 0
00070 #define ERMDS_CONTENT_SCAN_FAILED -1
00071 #define ERMDS_CONTENT_SCAN_TOO_MANY_ITEMS -2
00072
00073
00074 #define ERMDS_CONTENT_SORT_OK 0
00075 #define ERMDS_CONTENT_SORT_FAILED -1
00076 #define ERMDS_CONTENT_SORT_NOT_IMPLEMENTED -2
00077
00078
00079 #define ERCL_OK 0
00080 #define ERCL_INVALID_ARGS -10
00081 #define ERCL_NOMATCH -11
00082
00083 #define ERCL_INVALID_SIZE -1
00084
00085
00086
00087 #define MOBIPOCKET_FOLDER "/books/Mobipocket"
00088 #define MOBIPOCKET_FOLDER_LENGTH 17
00089
00090
00091 #define MOBIPOCKET_FOLDER_SORT_PRIORITY 10
00092
00093
00094 typedef enum
00095 {
00096 mdsFitFile = 0,
00097 mdsFitContainer,
00098 mdsFitFolder,
00099 mdsFitStorage,
00100 mdsFitApplication,
00101 mdsFitManifestDirectory,
00102 mdsFitSymlink,
00103 mdsFitManifestSymlink,
00104 mdsFitManifestSymlinkLocale,
00105 mdsFitUndefined
00106 } mdsFsItemType_e;
00107
00108 typedef enum
00109 {
00110 mdsFieldAuthor = 0,
00111 mdsFieldDate,
00112 mdsFieldDescription,
00113 mdsFieldFile,
00114 mdsFieldTitle,
00115 mdsFieldFsName,
00116
00117 mdsFieldExtName,
00118 mdsFieldSize,
00119 mdsFieldNone
00120 } mdsFieldType_e;
00121
00122 typedef enum
00123 {
00124 clFolderIcon = 0,
00125 clUnknownIcon,
00126 clBookIcon,
00127 clDocumentIcon,
00128 clMagazineIcon,
00129 clMiscIcon,
00130 clMp3Icon,
00131 clNewspaperIcon,
00132 clNoteIcon,
00133 clPhotoIcon,
00134 clReviewIcon,
00135 clOutboxIcon,
00136 clIconUrlDefined,
00137 } clIconID_e;
00138
00139 #define ICON_COUNT clIconUrlDefined // number of icons
00140
00141 typedef enum
00142 {
00143 mdsSingleSel_e = 0,
00144 mdsMultiSel_e,
00145 mdsSelUndefined
00146 }mdsSelType_e;
00147
00148
00149 typedef struct
00150 {
00151 mdsFieldType_e ft;
00152 int ascending;
00153 } mdsSortStruct_t;
00154
00155 typedef struct
00156 {
00157 char szFilename[ERMDS_MAX_FILENAME_SIZE];
00158 mdsFsItemType_e fit;
00159 char *sortField;
00160 int priority;
00161 } mdsFsItem_t;
00162
00163 typedef struct
00164 {
00165 clIconID_e iconID;
00166 char clIconURL[ERMDS_MAX_FILENAME_SIZE];
00167 char szFileExt[ERMDS_MAX_FILENAME_SIZE];
00168 char szTitle[ERCL_MAX_TITLE_SIZE];
00169 char szSubTitle[ERCL_MAX_SUBTITLE_SIZE];
00170 char szDate[ERCL_MAX_SUBTITLE_SIZE];
00171 char szDescription[ERCL_MAX_DESCRIPTION_SIZE];
00172 mdsFsItemType_e fit;
00173 char szFilename[ERMDS_MAX_FILENAME_SIZE];
00174 char szManifest[ERMDS_MAX_FILENAME_SIZE];
00175 char szExtID[ERMDS_MAX_EXTENSION_ID_SIZE];
00176 int size;
00177 struct
00178 {
00179 gboolean bDefault;
00180 gboolean bDelete;
00181 gboolean bScribble;
00182 gboolean bTagging;
00183 } modifyEnable;
00184 } clDisplayItem_t;
00185
00186 typedef struct
00187 {
00188 char szFilename[ERMDS_MAX_FILENAME_SIZE];
00189 } mdsDirectory_t;
00190
00191
00192
00193 typedef struct
00194 {
00195
00196 xmlChar* name;
00197
00198
00199 xmlChar* id;
00200 guint sequence;
00201 gboolean state;
00202 } mdsSelectionItem_t;
00203
00204 typedef struct
00205 {
00206
00207 gboolean constant;
00208 gboolean hide;
00209 xmlChar* display_as;
00210 xmlChar* title;
00211 xmlChar* instruction;
00212 guint min_selected;
00213 guint max_selected;
00214 guint num_items;
00215 const mdsSelectionItem_t* items;
00216
00217
00218 xmlChar* id;
00219 guint sequence;
00220 } mdsSelection_t;
00221
00222 typedef struct
00223 {
00224
00225 guint num_selections;
00226 const mdsSelection_t* selections;
00227
00228
00229 erManifest manifest;
00230 xmlNodePtr nodeRoot;
00231 } mdsSelectionList_t;
00232
00233
00243 int erMdsContentScan(GArray * dirArray, GArray ** contentItemArray);
00244
00254 int erMdsContentSort(GArray * contentItemArray, mdsSortStruct_t * sort);
00255
00256
00257 #define GFT_IGNORE -1
00258 #define GFT_NOSUCHFILE 0
00259 #define GFT_DIR 1
00260 #define GFT_FILE 2
00261 #define GFT_SYMLINK 3
00262
00263
00264 int erClGetDisplayItems(GArray * contentItemArray, int nBegin, int *nChunk, clDisplayItem_t * displayItemArray);
00265
00266
00267
00268
00269
00270
00271 int erClXmlParseManifest(char *szContainerPath, clDisplayItem_t * displayItem);
00272
00273 void erClXmlFetchField(char *szFilename, mdsFieldType_e fieldType, char *szField);
00274
00275 gboolean erClXmlSetFieldSize(const gchar* szContainer, int size);
00276
00277
00285 const mdsSelectionList_t* erClXmlFetchSelectionList(const char* szManifestPath);
00286
00294 int erClXmlSaveSelectionList(const mdsSelectionList_t* selectionList);
00295
00303 void erClXmlFreeSelectionList(const mdsSelectionList_t* selectionList);
00304
00315 int erClXmlSetSelectionItem( const mdsSelectionList_t* selectionList,
00316 const guint selectionIndex,
00317 const guint itemIndex,
00318 const gboolean state );
00319
00330 int erClXmlGetSelectionListItemState( const mdsSelectionList_t* selectionList,
00331 const char* selectionId,
00332 const char* itemId,
00333 gboolean* state );
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343 const gchar* ctrl_is_trusted_path(const char* path);
00344
00345
00346 #ifdef __cplusplus
00347 }
00348 #endif
00349
00350 #endif // __ERMDSCONTENT__H__