11 #include "memory-display.h"
14 #define GAMMU_CALLER_GROUPS 20
16 static GSM_Bitmap caller
[GAMMU_CALLER_GROUPS
];
17 GSM_AllRingtonesInfo ringtones_info
= {0, NULL
};
18 static gboolean callerinit
[GAMMU_CALLER_GROUPS
] = {FALSE
, FALSE
, FALSE
, FALSE
, FALSE
};
19 static gboolean ringinit
= FALSE
;
21 GSM_Error
PrintMemorySubEntry(GSM_SubMemoryEntry
*entry
, GSM_StateMachine
*sm
)
23 GSM_Category Category
;
26 gboolean show_location
= TRUE
;
28 switch (entry
->EntryType
) {
30 printf(LISTFORMAT
, _("Call length"));
31 /* l10n: Call length format string hour:minute:second*/
32 printf(_("%02i:%02i:%02i\n"),
33 entry
->CallLength
/ (60 * 60),
34 entry
->CallLength
/ 60,
35 entry
->CallLength
% 60);
38 printf(LISTFORMAT
"%s\n", _("Date and time"),OSDateTime(entry
->Date
,FALSE
));
40 case PBK_LastModified
:
41 printf(LISTFORMAT
"%s\n", _("Last modified"), OSDateTime(entry
->Date
,FALSE
));
44 if (entry
->Number
== -1) {
45 printf(LISTFORMAT
"\"%s\"\n", _("Category"), DecodeUnicodeConsole(entry
->Text
));
48 error
= ERR_NOTSUPPORTED
;
50 Category
.Location
= entry
->Number
;
51 Category
.Type
= Category_Phonebook
;
52 error
=GSM_GetCategory(sm
, &Category
);
54 if (error
== ERR_NONE
) {
55 printf(LISTFORMAT
"\"%s\" (%i)\n", _("Category"), DecodeUnicodeConsole(Category
.Name
), entry
->Number
);
57 printf(LISTFORMAT
"%i\n", _("Category"), entry
->Number
);
62 printf(LISTFORMAT
"%s\n", _("Private"), entry
->Number
== 1 ? "Yes" : "No");
64 case PBK_Caller_Group
:
66 printf(LISTFORMAT
"\"%d\"\n", _("Caller group"),entry
->Number
);
69 if (entry
->Number
>= GAMMU_CALLER_GROUPS
) {
70 printf(LISTFORMAT
"\"%d\"\n", _("Caller group"),entry
->Number
);
71 fprintf(stderr
, "%s\n", _("Caller group number too high, please increase buffer in sources!"));
72 return ERR_MOREMEMORY
;
74 if (!callerinit
[entry
->Number
-1]) {
75 caller
[entry
->Number
-1].Type
= GSM_CallerGroupLogo
;
76 caller
[entry
->Number
-1].Location
= entry
->Number
;
77 error
=GSM_GetBitmap(sm
,&caller
[entry
->Number
-1]);
78 if (error
== ERR_NOTSUPPORTED
|| error
== ERR_NOTIMPLEMENTED
) {
79 printf(LISTFORMAT
"\"%d\"\n", _("Caller group"), entry
->Number
);
82 if (error
!= ERR_NONE
) {
85 if (caller
[entry
->Number
-1].DefaultName
) {
86 NOKIA_GetDefaultCallerGroupName(&caller
[entry
->Number
-1]);
88 callerinit
[entry
->Number
-1]=TRUE
;
90 printf(LISTFORMAT
"\"%s\"\n", _("Caller group"),DecodeUnicodeConsole(caller
[entry
->Number
-1].Text
));
93 if (!ringinit
&& sm
!= NULL
) {
94 error
=GSM_GetRingtonesInfo(sm
,&ringtones_info
);
95 if (error
!= ERR_NOTSUPPORTED
) return error
;
96 if (error
== ERR_NONE
) ringinit
= TRUE
;
99 for (z
=0;z
<ringtones_info
.Number
;z
++) {
100 if (ringtones_info
.Ringtone
[z
].ID
== entry
->Number
) {
101 printf(LISTFORMAT
"\"%s\"\n", _("Ringtone"),DecodeUnicodeConsole(ringtones_info
.Ringtone
[z
].Name
));
106 printf(LISTFORMAT
"%i\n", _("Ringtone ID"),entry
->Number
);
109 case PBK_Text_UserID
:
110 printf(LISTFORMAT
"%s\n", _("User ID"),DecodeUnicodeString(entry
->Text
));
112 case PBK_Text_PictureName
:
113 printf(LISTFORMAT
"%s\n", _("Picture name"),DecodeUnicodeString(entry
->Text
));
116 printf(LISTFORMAT
"0x%x\n", _("Picture ID"),entry
->Number
);
119 printf(LISTFORMAT
"%s\n", _("Photo"), _("Displaying not supported"));
121 case PBK_Number_Messaging
: printf(LISTFORMAT
, _("Favorite messaging number")); break;
122 case PBK_Number_General
:
123 show_location
= FALSE
;
124 switch (entry
->Location
) {
125 case PBK_Location_Home
:
126 printf(LISTFORMAT
, _("Home number"));
128 case PBK_Location_Work
:
129 printf(LISTFORMAT
, _("Work number"));
131 case PBK_Location_Unknown
:
132 printf(LISTFORMAT
, _("General number"));
136 case PBK_Number_Video
: printf(LISTFORMAT
, _("Video number")); break;
137 case PBK_Number_Mobile
:
138 show_location
= FALSE
;
139 switch (entry
->Location
) {
140 case PBK_Location_Home
:
141 printf(LISTFORMAT
, _("Home mobile number"));
143 case PBK_Location_Work
:
144 printf(LISTFORMAT
, _("Work mobile number"));
146 case PBK_Location_Unknown
:
147 printf(LISTFORMAT
, _("Mobile number"));
151 case PBK_Number_Fax
:
152 show_location
= FALSE
;
153 switch (entry
->Location
) {
154 case PBK_Location_Home
:
155 printf(LISTFORMAT
, _("Home fax number"));
157 case PBK_Location_Work
:
158 printf(LISTFORMAT
, _("Work fax number"));
160 case PBK_Location_Unknown
:
161 printf(LISTFORMAT
, _("Fax number"));
165 case PBK_Number_Pager
: printf(LISTFORMAT
, _("Pager number")); break;
166 case PBK_Number_Other
: printf(LISTFORMAT
, _("Other number")); break;
167 case PBK_Text_Note
: printf(LISTFORMAT
, _("Text")); break;
168 case PBK_Text_Postal
:
169 show_location
= FALSE
;
170 switch (entry
->Location
) {
171 case PBK_Location_Home
:
172 printf(LISTFORMAT
, _("Home address"));
174 case PBK_Location_Work
:
175 printf(LISTFORMAT
, _("Work address"));
177 case PBK_Location_Unknown
:
178 printf(LISTFORMAT
, _("Address"));
182 case PBK_Text_Email
:
183 show_location
= FALSE
;
184 switch (entry
->Location
) {
185 case PBK_Location_Home
:
186 printf(LISTFORMAT
, _("Home email"));
188 case PBK_Location_Work
:
189 printf(LISTFORMAT
, _("Work email"));
191 case PBK_Location_Unknown
:
192 printf(LISTFORMAT
, _("Email"));
196 case PBK_Text_Email2
: printf(LISTFORMAT
, _("Email address 2")); break;
198 show_location
= FALSE
;
199 switch (entry
->Location
) {
200 case PBK_Location_Home
:
201 printf(LISTFORMAT
, _("Home website"));
203 case PBK_Location_Work
:
204 printf(LISTFORMAT
, _("Work website"));
206 case PBK_Location_Unknown
:
207 printf(LISTFORMAT
, _("Website"));
211 case PBK_Text_LUID
: printf(LISTFORMAT
, _("LUID")); break;
212 case PBK_Text_VOIP
: printf(LISTFORMAT
, _("VOIP")); break;
213 case PBK_Text_SWIS
: printf(LISTFORMAT
, _("SWIS")); break;
214 case PBK_Text_WVID
: printf(LISTFORMAT
, _("WVID")); break;
215 case PBK_Text_SIP
: printf(LISTFORMAT
, _("SIP")); break;
216 case PBK_Text_DTMF
: printf(LISTFORMAT
, _("DTMF")); break;
217 case PBK_Text_Name
: printf(LISTFORMAT
, _("Name")); break;
218 case PBK_Text_LastName
: printf(LISTFORMAT
, _("Last name")); break;
219 case PBK_Text_FirstName
: printf(LISTFORMAT
, _("First name")); break;
220 case PBK_Text_SecondName
: printf(LISTFORMAT
, _("Second name")); break;
221 case PBK_Text_FormalName
: printf(LISTFORMAT
, _("Formal name")); break;
222 case PBK_Text_NamePrefix
: printf(LISTFORMAT
, _("Name prefix")); break;
223 case PBK_Text_NameSuffix
: printf(LISTFORMAT
, _("Name suffix")); break;
224 case PBK_Text_NickName
: printf(LISTFORMAT
, _("Nick name")); break;
225 case PBK_Text_Company
: printf(LISTFORMAT
, _("Company")); break;
226 case PBK_Text_JobTitle
: printf(LISTFORMAT
, _("Job title")); break;
227 case PBK_Text_StreetAddress
: printf(LISTFORMAT
, _("Street address")); break;
228 case PBK_Text_City
: printf(LISTFORMAT
, _("City")); break;
229 case PBK_Text_State
: printf(LISTFORMAT
, _("State")); break;
230 case PBK_Text_Zip
: printf(LISTFORMAT
, _("Zip code")); break;
231 case PBK_Text_Country
: printf(LISTFORMAT
, _("Country")); break;
232 case PBK_Text_Custom1
: printf(LISTFORMAT
, _("Custom text 1")); break;
233 case PBK_Text_Custom2
: printf(LISTFORMAT
, _("Custom text 2")); break;
234 case PBK_Text_Custom3
: printf(LISTFORMAT
, _("Custom text 3")); break;
235 case PBK_Text_Custom4
: printf(LISTFORMAT
, _("Custom text 4")); break;
236 case PBK_PushToTalkID
: printf(LISTFORMAT
, _("Push to talk ID")); break;
239 printf("%s\n", _("unknown field type"));
244 switch (entry
->Location
) {
245 case PBK_Location_Home
:
246 printf("[%s]", _("home"));
248 case PBK_Location_Work
:
249 printf("[%s]", _("work"));
251 case PBK_Location_Unknown
:
255 printf("\"%s\"\n", DecodeUnicodeConsole(entry
->Text
));
259 GSM_Error
PrintMemoryEntry(GSM_MemoryEntry
*entry
, GSM_StateMachine
*sm
)
264 for (i
= 0; i
< entry
->EntriesNum
; i
++) {
265 error
= PrintMemorySubEntry(&entry
->Entries
[i
], sm
);
266 if (error
!= ERR_NONE
) return error
;
272 GSM_Error
PrintMemoryEntryLocation(GSM_MemoryEntry
*entry
, GSM_StateMachine
*sm
)
274 printf(_("Memory %s, Location %i\n"), GSM_MemoryTypeToString(entry
->MemoryType
), entry
->Location
);
275 return PrintMemoryEntry(entry
, sm
);
278 /* How should editor hadle tabs in this file? Add editor commands here.
279 * vim: noexpandtab sw=8 ts=8 sts=8: