1 /*----------------------------------------------------------------------------
2 --
3 --  Module:           xtmDbMisc
4 --
5 --  Project:          Xdiary
6 --  System:           xtm - X Desktop Calendar
7 --    Subsystem:      <>
8 --    Function block: <>
9 --
10 --  Description:
11 --    Interface file for module xtmDbMisc
12 --
13 --  Filename:         xtmDbMisc.h
14 --
15 --  Authors:          Roger Larsson, Ulrika Bornetun
16 --  Creation date:    1992-01-08
17 --
18 --
19 --  (C) Copyright Ulrika Bornetun, Roger Larsson (1995)
20 --      All rights reserved
21 --
22 --  Permission to use, copy, modify, and distribute this software and its
23 --  documentation for any purpose and without fee is hereby granted,
24 --  provided that the above copyright notice appear in all copies. Ulrika
25 --  Bornetun and Roger Larsson make no representations about the usability
26 --  of this software for any purpose. It is provided "as is" without express
27 --  or implied warranty.
28 ----------------------------------------------------------------------------*/
29 
30 /* SCCS module identifier. */
31 /* SCCSID = @(#) Module: xtmDbMisc.h, Version: 1.1, Date: 95/02/18 15:52:09 */
32 
33 
34 /* Only include this module once. */
35 #ifndef define_xtmDbMisc_h
36 #  define define_xtmDbMisc_h
37 
38 
39 /*----------------------------------------------------------------------------
40 --  Include files
41 ----------------------------------------------------------------------------*/
42 
43 #include "Standard.h"
44 #include "LstLinked.h"
45 #include "TimDate.h"
46 
47 #include "xtmGlobal.h"
48 #include "xtmCalDb.h"
49 #include "xtmDbTools.h"
50 
51 
52 /*----------------------------------------------------------------------------
53 --  Macro definitions
54 ----------------------------------------------------------------------------*/
55 
56 /* Max search strings. */
57 #define XTM_DM_MAX_TEXT_SEARCH  50
58 #define XTM_DM_MAX_TAG_SEARCH   25
59 
60 
61 /* Flags for filters. */
62 #define XTM_DM_FLAG_ALL                   (1<<0)
63 #define XTM_DM_FLAG_APPOINTMENTS          (1<<5)
64 #define XTM_DM_FLAG_NOTES                 (1<<6)
65 #define XTM_DM_FLAG_PRIVATE               (1<<10)
66 #define XTM_DM_FLAG_IMPORTANT             (1<<11)
67 #define XTM_DM_FLAG_DONE                  (1<<12)
68 #define XTM_DM_FLAG_NOT_DONE              (1<<13)
69 #define XTM_DM_FLAG_ALARMS                (1<<14)
70 #define XTM_DM_FLAG_REPEATED              (1<<15)
71 #define XTM_DM_FLAG_STICKY                (1<<16)
72 #define XTM_DM_FLAG_SEARCH_TEXT           (1<<20)
73 #define XTM_DM_FLAG_SEARCH_TAG            (1<<21)
74 #define XTM_DM_FLAG_TEXT_CASE_SENS        (1<<22)
75 #define XTM_DM_FLAG_TAG_CASE_SENS         (1<<23)
76 
77 
78 /*----------------------------------------------------------------------------
79 --  Type declarations
80 ----------------------------------------------------------------------------*/
81 
82 /* Filter record. */
83 typedef struct {
84 
85   /* Search flags. */
86   UINT32  flags;
87 
88   /* Text string. */
89   char  text_string[ XTM_DM_MAX_TEXT_SEARCH + 1 ];
90 
91   /* Tag string. */
92   char  tag_string[ XTM_DM_MAX_TAG_SEARCH + 1 ];
93 
94 } XTM_DM_FILTER_REC;
95 
96 
97 /*----------------------------------------------------------------------------
98 --  Global definitions
99 ----------------------------------------------------------------------------*/
100 
101 
102 
103 /*----------------------------------------------------------------------------
104 --  Function prototypes
105 ----------------------------------------------------------------------------*/
106 
107 void
108   xtmDmDeleteEntriesList( LST_DESC_TYPE entries );
109 
110 Boolean
111   xtmDmDeleteEntry( Widget                  parentW,
112                     XTM_DB_ENTRY_DATABASES  *database,
113                     UINT32                  entry_id );
114 
115 void
116   xtmDmEntriesDefined( XTM_GL_BASE_DATA_REF  appl_data_ref,
117                        char                  *db_name,
118                        TIM_TIME_REF          date,
119                        int                   days,
120                        Boolean               include_db,
121                        Boolean               show_standing,
122                        Boolean               entry_defined[] );
123 
124 Boolean
125   xtmDmFetchEntry( Widget                  parentW,
126                    XTM_DB_ENTRY_DATABASES  *database,
127                    UINT32                  entry_id,
128                    XTM_DB_ALL_ENTRY_REF    entry_ref,
129                    char                    **entry_text );
130 
131 XTM_DB_STATUS
132   xtmDmFetchEntriesDay( XTM_GL_CUSTOM_DATA_REF  custom_data,
133                         XTM_CD_CAL_INFO         *cal_info,
134                         TIM_TIME_REF            date,
135                         UINT32                  flags,
136                         LST_DESC_TYPE           *notes,
137                         LST_DESC_TYPE           *appointments );
138 
139 Boolean
140   xtmDmFetchEntry( Widget                  parentW,
141                    XTM_DB_ENTRY_DATABASES  *database,
142                    UINT32                  entry_id,
143                    XTM_DB_ALL_ENTRY_REF    entry_ref,
144                    char                    **entry_text );
145 
146 XTM_DB_STATUS
147   xtmDmFetchFilteredEntriesRange( XTM_GL_BASE_DATA_REF  appl_data_ref,
148                                   char                  *db_name,
149                                   XtAppContext          context,
150                                   Widget                parent,
151                                   TIM_TIME_REF          starts,
152                                   TIM_TIME_REF          ends,
153                                   UINT32                flags,
154                                   XTM_DM_FILTER_REC     *filter_ref,
155                                   LST_DESC_TYPE         *entries );
156 
157 Boolean
158   xtmDmInsertEntry( Widget                  parentW,
159                     XTM_DB_ENTRY_DATABASES  *database,
160                     UINT32                  entry_id,
161                     XTM_DB_ALL_ENTRY_REF    entry_ref,
162                     char                    *entry_text );
163 
164 Boolean
165   xtmDmOpenDatabase( XTM_GL_BASE_DATA_REF    appl_data_ref,
166                      char                    *db_name,
167                      UINT32                  access_mode,
168                      XTM_DB_ENTRY_DATABASES  *database_ref );
169 
170 #endif
171