This commit was generated by cvs2svn to compensate for changes in r158,
[gnokii.git] / xgnokii / xgnokii_contacts.c
index 39ef62b..cf8289a 100644 (file)
@@ -3,11 +3,39 @@
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
+  Copyright (C) 1999 Pavel Janík ml., Hugh Blemings
+  & Ján Derfiòák <ja@mail.upjs.sk>.
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
   $Id$
   
+  $Log$
+  Revision 1.1.1.5  2002/04/03 00:08:28  short
+  Found in "gnokii-working" directory, some November-patches version
+
+  Revision 1.30  2001/09/14 13:14:04  pkot
+  Xgnokii WM fixes (Martin Lucina)
+
+  Revision 1.29  2001/03/23 08:24:56  ja
+  New preview for 6210 in xgnokii's logos module.
+
+  Revision 1.28  2001/03/19 23:43:47  pkot
+  Solaris/BSD '#if defined' cleanup
+
+  Revision 1.27  2001/03/13 01:21:39  pkot
+  *BSD updates (Bert Driehuis)
+
+  Revision 1.26  2001/03/05 10:42:03  ja
+  Pavel Machek's vcard and finegrained indicators patch.
+
+  Revision 1.25  2001/02/12 15:13:46  chris
+  Fixed my bug in xgnokii_contacts.c and added <string.h> to tekram.c
+
+  Revision 1.24  2001/02/02 08:09:57  ja
+  New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
+
+  
 */
 
 
@@ -32,7 +60,6 @@
 #endif
 #include <gtk/gtk.h>
 
-#include "gsm-api.h"
 #include "gsm-common.h"
 #include "xgnokii_contacts.h"
 #include "xgnokii_lowlevel.h"
@@ -251,7 +278,7 @@ static void OkEditEntryDialog (GtkWidget *widget, gpointer data)
             max_phonebook_name_length);
     entry->entry.Name[max_phonebook_name_length] = '\0';
 
-    if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+    if (phoneMonitor.supported & PM_EXTPBK)
     {
     }
     else
@@ -297,7 +324,7 @@ because you save it into SIM memory!"));
       gtk_widget_show (errorDialog.dialog);
     }
 
-    if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+    if (phoneMonitor.supported & PM_EXTPBK)
     {
     }
     else
@@ -331,7 +358,7 @@ because you save it into SIM memory!"));
               max_phonebook_name_length);
       ((EditEntryData*) data)->pbEntry->entry.Name[max_phonebook_name_length] = '\0';
 
-      if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+      if (phoneMonitor.supported & PM_EXTPBK)
       {
       }
       else
@@ -356,7 +383,7 @@ because you save it into SIM memory!"));
         gtk_widget_show (errorDialog.dialog);
       }
 
-      if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+      if (phoneMonitor.supported & PM_EXTPBK)
       {
       }
       else
@@ -393,7 +420,7 @@ because you save it into SIM memory!"));
     clist_row[2] = "P";
   else
     clist_row[2] = "S";
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
     clist_row[3] = xgnokiiConfig.callerGroups[((EditEntryData*) data)->pbEntry->entry.Group];
   else
     clist_row[3] = "";
@@ -473,7 +500,7 @@ static void OkNewEntryDialog(GtkWidget *widget, gpointer data )
             max_phonebook_name_length);
     entry->entry.Name[max_phonebook_name_length] = '\0';
 
-    if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+    if (phoneMonitor.supported & PM_EXTPBK)
     {
     }
     else
@@ -511,7 +538,7 @@ because you save it into SIM memory!"));
       gtk_widget_show (errorDialog.dialog);
     }
 
-    if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+    if (phoneMonitor.supported & PM_EXTPBK)
     {
     }
     else
@@ -537,7 +564,7 @@ because you save it into SIM memory!"));
               max_phonebook_name_length);
       ((EditEntryData*) data)->pbEntry->entry.Name[max_phonebook_name_length] = '\0';
 
-      if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+      if (phoneMonitor.supported & PM_EXTPBK)
       {
       }
       else
@@ -562,7 +589,7 @@ because you save it into SIM memory!"));
         gtk_widget_show (errorDialog.dialog);
       }
 
-      if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+      if (phoneMonitor.supported & PM_EXTPBK)
       {
       }
       else
@@ -605,7 +632,7 @@ because you save it into SIM memory!"));
     clist_row[2] = "P";
   else
     clist_row[2] = "S";
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
     clist_row[3] = xgnokiiConfig.callerGroups[((EditEntryData*) data)->pbEntry->entry.Group];
   else
     clist_row[3] = "";
@@ -704,7 +731,7 @@ static void OkChangeEntryDialog( GtkWidget *widget, gpointer data)
       clist_row[2] = "P";
     else
       clist_row[2] = "S";
-    if (GetModelFeature(FN_CALLERGROUPS)!=0)
+    if (phoneMonitor.supported & PM_CALLERGROUP)
       clist_row[3] = xgnokiiConfig.callerGroups[newPbEntry->entry.Group];
     else
       clist_row[3] = "";
@@ -1077,7 +1104,7 @@ static void CreateEditDialog (EditEntryData *editEntryData, gchar *title,
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
   gtk_widget_show (label);
 
-  if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+  if (phoneMonitor.supported & PM_EXTPBK)
   {
     button = gtk_button_new ();
     editEntryData->number = gtk_label_new ("");
@@ -1097,7 +1124,7 @@ static void CreateEditDialog (EditEntryData *editEntryData, gchar *title,
     gtk_widget_show (editEntryData->number);
   }
 
-/*  if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT) {
+/*  if (phoneMonitor.supported & PM_EXTPBK) {
 
     hbox = gtk_hbox_new (FALSE, 0);
     gtk_container_add (GTK_CONTAINER (GTK_DIALOG (editEntryData->dialog)->vbox), hbox);
@@ -1160,7 +1187,7 @@ static void EditPbEntry(PhonebookEntry *pbEntry, gint row)
 
   gtk_entry_set_text (GTK_ENTRY (editEditEntryData.name), pbEntry->entry.Name);
 
-  if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+  if (phoneMonitor.supported & PM_EXTPBK)
     gtk_label_set_text (GTK_LABEL (editEditEntryData.number), pbEntry->entry.Number);
   else
     gtk_entry_set_text (GTK_ENTRY (editEditEntryData.number), pbEntry->entry.Number);
@@ -1173,7 +1200,7 @@ static void EditPbEntry(PhonebookEntry *pbEntry, gint row)
   gtk_option_menu_set_history( GTK_OPTION_MENU (editEditEntryData.group),
                                pbEntry->entry.Group);
 
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
   {
     gtk_widget_show (editEditEntryData.group);
     gtk_widget_show (editEditEntryData.groupLabel);
@@ -1253,7 +1280,7 @@ void NewPbEntry(PhonebookEntry *pbEntry)
 
   gtk_entry_set_text (GTK_ENTRY (newEditEntryData.name), "");
   
-  if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+  if (phoneMonitor.supported & PM_EXTPBK)
     gtk_label_set_text (GTK_LABEL (newEditEntryData.number), "");
   else
     gtk_entry_set_text (GTK_ENTRY (newEditEntryData.number), "");
@@ -1266,7 +1293,7 @@ void NewPbEntry(PhonebookEntry *pbEntry)
   gtk_option_menu_set_history( GTK_OPTION_MENU (newEditEntryData.group),
                                pbEntry->entry.Group);
 
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
   {
     gtk_widget_show (newEditEntryData.group);
     gtk_widget_show (newEditEntryData.groupLabel);
@@ -1297,7 +1324,7 @@ void DuplicatePbEntry (PhonebookEntry *pbEntry)
 
   gtk_entry_set_text (GTK_ENTRY (duplicateEditEntryData.name), pbEntry->entry.Name);
 
-  if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+  if (phoneMonitor.supported & PM_EXTPBK)
     gtk_label_set_text (GTK_LABEL (duplicateEditEntryData.number), pbEntry->entry.Number);
   else
     gtk_entry_set_text (GTK_ENTRY (duplicateEditEntryData.number), pbEntry->entry.Number);
@@ -1310,7 +1337,7 @@ void DuplicatePbEntry (PhonebookEntry *pbEntry)
   gtk_option_menu_set_history( GTK_OPTION_MENU (duplicateEditEntryData.group),
                                pbEntry->entry.Group);
 
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
   {
     gtk_widget_show (duplicateEditEntryData.group);
     gtk_widget_show (duplicateEditEntryData.groupLabel);
@@ -2030,7 +2057,7 @@ void GUI_RefreshContacts (void)
         row[2] = "P";
       else
         row[2] = "S";
-      if (GetModelFeature(FN_CALLERGROUPS)!=0)
+      if (phoneMonitor.supported & PM_CALLERGROUP)
         row[3] = xgnokiiConfig.callerGroups[pbEntry->entry.Group];
       else
         row[3] = "";
@@ -2220,7 +2247,6 @@ Setting max SIM entries to 100!\n"));
     mla->min = 1;
     mla->max = memoryStatus.MaxME;
     mla->type = GMT_ME;
-    mla->used = memoryStatus.UsedME; //MW
     mla->InsertEntry = InsertPBEntryME;
     mla->ReadFailed = ReadFailedPBEntry;
 
@@ -2243,7 +2269,6 @@ Setting max SIM entries to 100!\n"));
   mla->min = 1;
   mla->max = memoryStatus.MaxSM;
   mla->type = GMT_SM;
-  mla->used = memoryStatus.UsedSM; //MW
   mla->InsertEntry = InsertPBEntrySM;
   mla->ReadFailed = ReadFailedPBEntry;
 
@@ -2327,7 +2352,7 @@ inline void GUI_ShowContacts (void)
     GUI_Refresh ();
     GUI_InitCallerGroupsInf ();
   }
-  gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, (GetModelFeature(FN_CALLERGROUPS)!=0));
+  gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, phoneMonitor.supported & PM_CALLERGROUP);
   GUI_RefreshContacts ();
   gtk_widget_show (GUI_ContactsWindow);
 //  if (!contactsMemoryInitialized)
@@ -2361,7 +2386,7 @@ static void ExportVCARD (FILE *f)
     fprintf (f, "X_GSM_CALLERGROUP:%d\n", pbEntry->entry.Group);
 
     /* Add ext. pbk info if required */
-    if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+    if (phoneMonitor.supported & PM_EXTPBK)
       for (j = 0; j < pbEntry->entry.SubEntriesCount; j++)
       {
        if (pbEntry->entry.SubEntries[j].EntryType == GSM_Number)
@@ -2420,7 +2445,7 @@ static void ExportNative (FILE *f)
       strcat (buf, buf2);
 
       /* Add ext. pbk info if required */
-      if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT)
+      if (phoneMonitor.supported & PM_EXTPBK)
       {
         for (j = 0; j < pbEntry->entry.SubEntriesCount; j++)
           if (pbEntry->entry.SubEntries[j].EntryType==GSM_Number)
@@ -3120,7 +3145,7 @@ SelectContactData *GUI_SelectContactDialog (void)
   gtk_clist_set_column_width (GTK_CLIST(selectContactData.clist), 1, 115);
   gtk_clist_set_column_width (GTK_CLIST(selectContactData.clist), 3, 70);
   gtk_clist_set_column_justification (GTK_CLIST(selectContactData.clist), 2, GTK_JUSTIFY_CENTER);
-  gtk_clist_set_column_visibility (GTK_CLIST(selectContactData.clist), 3, (GetModelFeature(FN_CALLERGROUPS)!=0));
+  gtk_clist_set_column_visibility (GTK_CLIST(selectContactData.clist), 3, phoneMonitor.supported & PM_CALLERGROUP);
 
   for (i = 0; i < 4; i++)
   {
@@ -3174,7 +3199,7 @@ SelectContactData *GUI_SelectContactDialog (void)
         row[2] = "P";
       else
         row[2] = "S";
-      if (GetModelFeature(FN_CALLERGROUPS)!=0)
+      if (phoneMonitor.supported & PM_CALLERGROUP)
         row[3] = xgnokiiConfig.callerGroups[pbEntry->entry.Group];
       else
         row[3] = "";
@@ -3275,6 +3300,7 @@ void GUI_CreateContactsWindow (void)
   InitMainMenu ();
   contactsMemoryInitialized = FALSE;
   GUI_ContactsWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_wmclass (GTK_WINDOW (GUI_ContactsWindow), "ContactsWindow", "Xgnokii");
   gtk_window_set_title (GTK_WINDOW (GUI_ContactsWindow), _("Contacts"));
   gtk_widget_set_usize (GTK_WIDGET (GUI_ContactsWindow), 436, 220);
   //gtk_container_set_border_width (GTK_CONTAINER (GUI_ContactsWindow), 10);
@@ -3370,7 +3396,7 @@ void GUI_CreateContactsWindow (void)
   gtk_clist_set_column_width (GTK_CLIST (clist), 1, 115);
   gtk_clist_set_column_width (GTK_CLIST (clist), 3, 70);
   gtk_clist_set_column_justification (GTK_CLIST (clist), 2, GTK_JUSTIFY_CENTER);
-//  gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, (GetModelFeature(FN_CALLERGROUPS)!=0));
+//  gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, phoneMonitor.supported & PM_CALLERGROUP);
 
   for (i = 0; i < 4; i++)
   {