Implemented connection type "tcp" (GCT_TCP), use <hostname>:<port> as "port"
[gnokii.git] / xgnokii / xgnokii_contacts.h
1 /*
2
3   X G N O K I I
4
5   A Linux/Unix GUI for Nokia mobile phones.
6   Copyright (C) 1999 Pavel Janík ml., Hugh Blemings
7   & Ján Derfiòák <ja@mail.upjs.sk>.
8
9   Released under the terms of the GNU GPL, see file COPYING for more details.
10
11   $Id$
12   
13   $Log$
14   Revision 1.1.1.4  2002/04/03 00:08:28  short
15   Found in "gnokii-working" directory, some November-patches version
16
17   Revision 1.12  2001/02/02 08:09:57  ja
18   New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
19
20   
21 */
22
23 #ifndef XGNOKII_CONTACTS_H
24 #define XGNOKII_CONTACTS_H
25
26 #include <gtk/gtk.h>
27 #include "misc.h"
28 #include "gsm-common.h"
29 #include "gsm-api.h"
30
31 #define IO_BUF_LEN      160
32
33 /* Structure to keep memory status information */
34 typedef struct {
35   int MaxME;            /* Maximum Phone memory entries. */
36   int UsedME;           /* Actualy used Phone memory entries. */
37   int FreeME;           /* FreeME = MaxME - UsedME */
38   int MaxSM;            /* Maximum SIM memory entries. */
39   int UsedSM;
40   int FreeSM;
41 } MemoryStatus;
42
43 /* Array to hold contacts entry */
44 typedef GPtrArray* ContactsMemory;
45
46 /* Structure to keep contacts memory entry status */
47 typedef enum {
48   E_Unchanged,          /* Entry is not empty and is unchanged. */
49   E_Changed,            /* Entry is not empty and is changed. */
50   E_Deleted,            /* Entry was deleted. */
51   E_Empty               /* Entry is empty. */
52 } EntryStatus;
53
54 /* Memory entry data */
55 typedef struct {
56   GSM_PhonebookEntry entry;     /* Phonebook entry self. */
57   EntryStatus status;           /* Entry status. */
58 } PhonebookEntry;
59
60 /* Structure to hold information of Edit and New dialogs */
61 typedef struct {
62   PhonebookEntry *pbEntry;
63   GtkWidget *dialog;
64   GtkWidget *name;
65   GtkWidget *number;
66   GtkWidget *extended;
67   GtkWidget *memoryBox;
68   GtkWidget *memoryTypePhone;
69   GtkWidget *memoryTypeSIM;
70   GtkWidget *group;
71   GtkWidget *groupLabel;
72   GtkWidget *groupMenu;
73   gint      newGroup;
74   gint      row;
75 } EditEntryData;
76
77
78 typedef struct {
79   PhonebookEntry *pbEntry;
80   GtkWidget *dialog;
81   GtkWidget *clist;
82 } EditNumbersData;
83
84
85 /* Structure to hold information for FindEntry dialog. */
86 typedef struct {
87   GtkWidget *dialog;
88   GtkWidget *pattern;
89   GtkWidget *nameB;
90   GtkWidget *numberB;
91 } FindEntryData;
92
93
94 /* Contains fileName for Export dialog. */
95 typedef struct {
96   gchar *fileName;
97 } ExportDialogData;
98
99
100 /* Hold widgets for SelectContactDialog */
101 typedef struct {
102   GtkWidget *dialog;
103   GtkWidget *clist;                     /* list of contacts */
104   GtkWidget *clistScrolledWindow;
105   GtkWidget *okButton;                  /* Ok and Cancel button widgets */
106   GtkWidget *cancelButton;
107 } SelectContactData;
108
109
110 /* Max length for status line. (Line that shows used/max information for
111    memories). */
112 #define STATUS_INFO_LENGTH      40
113
114
115 /* Structure to hold information for status line (bottom line of window) */
116 typedef struct {
117   GtkWidget *label;
118   gchar text[STATUS_INFO_LENGTH];       /* Status line text. */
119   gint ch_ME:1;                         /* 1 if phone memory was changed */
120   gint ch_SM:1;                         /* 1 if phone SIM was changed */
121 } StatusInfo;
122
123
124 /* Structure to hold information for progress dialog */
125 typedef struct {
126   GtkWidget *dialog;
127   GtkWidget *pbarME;
128   GtkWidget *pbarSM;
129 } ProgressDialog;
130
131
132 /* Search type. */
133 typedef enum {
134   FIND_NAME = 0,
135   FIND_NUMBER
136 } FindType;
137
138
139 typedef struct {
140   gchar pattern[GSM_MAX_PHONEBOOK_NAME_LENGTH + 1];
141   gint lastRow;
142   FindType type;
143 } FindEntryStruct;
144
145
146 typedef struct {
147   GdkPixmap *simMemPix, *phoneMemPix;
148   GdkBitmap *mask;
149 } MemoryPixmaps;
150
151
152 extern void GUI_CreateContactsWindow (void);
153
154 extern void GUI_ShowContacts (void);
155
156 /* return != 0 if user has unsaved changes in contacts memory */ 
157 extern gint GUI_ContactsIsChanged (void);
158
159 /* return TRUE if Contacts memory was read from phone or from file */
160 extern bool GUI_ContactsIsIntialized (void);
161
162 /* Read contacts from phone */
163 extern void GUI_ReadContacts (void);
164
165 /* Save contacts to phone */
166 extern void GUI_SaveContacts (void);
167
168 /* Create save question dialog and can end application */
169 extern void GUI_QuitSaveContacts (void);
170
171 extern void GUI_RefreshContacts (void);
172
173 /* Function take number and return name belonged to number.
174    If no name is found, return NULL;
175    Do not modify returned name!                                 */
176 extern gchar *GUI_GetName (gchar *number);
177
178 extern gchar *GUI_GetNameExact (gchar *number);
179
180 extern gchar *GUI_GetNumber (gchar *name);
181 /* Function show dialog with contacts and let select entries.
182    See xgnokii_contacts.c for sample of use.                    */
183 extern SelectContactData *GUI_SelectContactDialog (void);
184
185 extern void GUI_RefreshGroupMenu (void);
186
187 extern PhonebookEntry *GUI_GetEntry (GSM_MemoryType, gint);
188
189 void ExtPbkChanged (GtkWidget *widget, gpointer data );
190
191 #endif