void addEmails(Dictionary <string, EmailList> emails, MorkDatabase database) { foreach (string id in database) { Hashtable contact_row = database.Compile(id, database.EnumNamespace); AddThunderbirdEmail(emails, contact_row); } }
public void LoadDatabase() { // Load the database file try { database = new MorkDatabase(uri.AbsolutePath); database.Read(); database.EnumNamespace = "ns:addrbk:db:row:scope:card:all"; } catch (Exception e) { MessageDialog dialog = new MessageDialog( MainWindow, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, false, String.Format(Catalog.GetString("Unable to open mork database:\n\n {0}"), e.Message)); dialog.Run(); dialog.Destroy(); Environment.Exit(1); } // Populate the gui with nice stuff Clear(); FillContactList(); try { Match m = Regex.Match(uri.Query, @"\?id=(?<id>[0-9A-Fa-f]+)"); ShowContact(m.Result("${id}")); } catch { Gtk.MessageDialog dialog = new MessageDialog( MainWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, Catalog.GetString("The specified ID does not exist in this database!")); dialog.Run(); dialog.Destroy(); } }
void _UpdateItems() { MorkDatabase abook, history; Dictionary <string, EmailList> emails = new Dictionary <string, EmailList> (); abook = new MorkDatabase(GetThunderbirdAddressBookFilePath()); abook.Read(); abook.EnumNamespace = "ns:addrbk:db:row:scope:card:all"; history = new MorkDatabase(GetThunderbirdHistoryFilePath()); history.Read(); history.EnumNamespace = "ns:addrbk:db:row:scope:card:all"; addEmails(emails, history); addEmails(emails, abook); contacts.Clear(); foreach (string name in emails.Keys) { CreateThunderbirdContactItem(name, emails [name]); } }