Пример #1
0
        private void on_PhonebookComboBox_changed(object o, EventArgs args)
        {
            ArrayList contacts = null;
            Phonebook p;

            // get the first book in the list and load the liststore
            if (myPhoneBooks.Length > 0)
            {
                string[] list = new string[myPhoneBooks.Length];

                if (myPhoneBooks != null)
                {
                    // populate the list
                    int i = 0;
                    foreach (Phonebook pb in myPhoneBooks)
                    {
                        list[i++] = pb.Name;
                    }
                }

                p = Phonetools.get_book_from_name(list[PhonebookComboBox.Active]);
                if (p == null)
                {
                    return;
                }

                // Clear the list_store
                ItemStore.Clear();

                contacts = Phonetools.get_contacts(p);

                if (contacts != null)
                {
                    IEnumerator enu = contacts.GetEnumerator();
                    while (enu.MoveNext())
                    {
                        GfaxContact c = new GfaxContact();
                        c = (GfaxContact)enu.Current;
                        ItemView.AddTextToRow(c.Organization, c.PhoneNumber, c.ContactPerson);
                    }
                    if (p.Type == "evolution")
                    {
                        pbIsReadOnly = true;
                        EditPhbCompanyEntry.Sensitive = false;
                        EditPhbNumberEntry.Sensitive  = false;
                        EditPhbNameEntry.Sensitive    = false;
                    }
                    else
                    {
                        pbIsReadOnly = false;
                        EditPhbCompanyEntry.Sensitive = true;
                        EditPhbNumberEntry.Sensitive  = true;
                        EditPhbNameEntry.Sensitive    = true;
                        eventsEnabled = true;
                    }
                }
            }
        }
Пример #2
0
        public GfaxSendPhoneBook(Glade.XML xml, string myparent)
        {
            //Phonebook[] pb; delete me

            //gxml = xml;
            //parent = myparent; delete me
            myPhoneBooks = Phonetools.get_phonebooks();

            if (myPhoneBooks == null)
            {
                G_Message m = new G_Message(Catalog.GetString("You don't have any phone books yet."));
                m = null;
                return;
            }

            gsxml = new Glade.XML(null, "send-druid.glade", "PhbookDialog", null);
            gsxml.Autoconnect(this);

            // Get the widget so we can manipulate it
            //phbd = (Gtk.Dialog) gsxml.GetWidget("PhbookDialog");
            //book = (Gtk.TreeView) gsxml.GetWidget("book_treeview");
            //list = (Gtk.TreeView) gsxml.GetWidget("list_treeview");
            phbd = PhbookDialog;
            book = book_treeview;
            list = list_treeview;

            book.Selection.Changed += new EventHandler(on_book_treeview_selection);

            phbd.Resizable      = true;
            book_store          = new ListStore(typeof(string));
            book.HeadersVisible = false;
            book.Selection.Mode = SelectionMode.Multiple;

            bs = new G_ListView(book, book_store);
            // Got have a column title or things won't show up
            bs.AddColumnTitle(Catalog.GetString("Phone books"), 0, COLUMN_0);


            list_store = new ListStore(
                typeof(string),
                typeof(string),
                typeof(string));

            ls = new G_ListView(list, list_store);
            ls.AddColumnTitle(Catalog.GetString("Organization"), 0, COLUMN_0);
            ls.AddColumnTitle(Catalog.GetString("Phone Number"), 1, COLUMN_1);
            ls.AddColumnTitle(Catalog.GetString("Contact"), 2, COLUMN_2);
            list.HeadersVisible = true;
            list.Selection.Mode = SelectionMode.Multiple;

            // populate the list
            foreach (Phonebook p in myPhoneBooks)
            {
                bs.AddTextToRow(p.Name);
            }

            phbd.Run();
        }
Пример #3
0
        public GfaxSendPhoneBook(Glade.XML xml, string myparent)
        {
            //Phonebook[] pb; delete me

            //gxml = xml;
            //parent = myparent; delete me
            myPhoneBooks = Phonetools.get_phonebooks();

            if ( myPhoneBooks == null ) {
                G_Message m = new G_Message(Catalog.GetString("You don't have any phone books yet."));
                m = null;
                return;
            }

            gsxml = new Glade.XML (null, "send-druid.glade","PhbookDialog",null);
            gsxml.Autoconnect (this);

            // Get the widget so we can manipulate it
            //phbd = (Gtk.Dialog) gsxml.GetWidget("PhbookDialog");
            //book = (Gtk.TreeView) gsxml.GetWidget("book_treeview");
            //list = (Gtk.TreeView) gsxml.GetWidget("list_treeview");
            phbd = PhbookDialog;
            book = book_treeview;
            list = list_treeview;

            book.Selection.Changed += new EventHandler (on_book_treeview_selection);

            phbd.Resizable = true;
            book_store = new ListStore(typeof(string));
            book.HeadersVisible = false;
            book.Selection.Mode = SelectionMode.Multiple;

            bs = new G_ListView(book, book_store);
            // Got have a column title or things won't show up
            bs.AddColumnTitle(Catalog.GetString("Phone books"), 0, COLUMN_0);

            list_store = new ListStore(
                    typeof (string),
                    typeof (string),
                    typeof (string));

            ls = new G_ListView(list, list_store);
            ls.AddColumnTitle(Catalog.GetString("Organization"), 0, COLUMN_0);
            ls.AddColumnTitle(Catalog.GetString("Phone Number"), 1, COLUMN_1);
            ls.AddColumnTitle(Catalog.GetString("Contact"), 2, COLUMN_2);
            list.HeadersVisible = true;
            list.Selection.Mode = SelectionMode.Multiple;

            // populate the list
            foreach (Phonebook p in myPhoneBooks)
                bs.AddTextToRow(p.Name);

            phbd.Run();
        }
Пример #4
0
        public Gfax(string fname, string[] args)
            : base(APPNAME, VERSION, Modules.UI, args, new object [0])
        {
            //Phonebook[] pb;  delete me

            // Set the program icon
            Gtk.Window.DefaultIconName = "gfax";

            Application.Init();

            // check to see if we've run before, if so gfax will be there
            if (Settings.RunSetupAtStart)
            {
                Settings.RunSetupAtStart = false;

                MessageDialog md;
                md = new MessageDialog(
                    null,
                    DialogFlags.DestroyWithParent,
                    MessageType.Info,
                    ButtonsType.Ok,
                    Catalog.GetString(
                        @"
This is the first time you have run Gfax.
You should set your MODEM TYPE and PORT under preferences.

Gfax is initially setup to use Efax, you may change it use 
Hylafax if you prefer or require connection to a network 
facsimile server.")
                    );
                md.Run();
                md.Destroy();
            }

            if (!Directory.Exists(gfax.SpoolDirectory))
            {
                G_Message gm = new G_Message(Catalog.GetString(
                                                 @"Your spool directory is missing!
					
Please login as the root user and create the "
                                                 + gfax.SpoolDirectory +
                                                 " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/doneq"))
            {
                G_Message gm = new G_Message(Catalog.GetString(
                                                 @"The doneq directory is missing in your spool directory!
					
Please login as the root user and create the "
                                                 + gfax.SpoolDirectory + "/doneq" +
                                                 " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/recq"))
            {
                G_Message gm = new G_Message(Catalog.GetString(
                                                 @"The recq directory is missing in your spool directory!
					
Please login as the root user and create the "
                                                 + gfax.SpoolDirectory + "/recq" +
                                                 " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }


            gxml = new Glade.XML(null, "gfax.glade", "GfaxWindow", null);
            gxml.Autoconnect(this);


            // Set initial gui state as per preferences
            // GConf.PropertyEditors.EditorShell doesn't handle
            // checkmenuitems;
            eventsEnabled = false;
            if (Settings.TransmitAgent == "hylafax")
            {
                AutoQRefreshCheckMenuItem.Active      = Settings.RefreshQueueEnabled;
                EmailNotificationCheckMenuItem.Active = Settings.EmailNotify;
                HiResolutionModeCheckMenuItem.Active  = Settings.HiResolution;
                LogEnabledCheckMenuItem.Active        = Settings.LogEnabled;
            }
            if (Settings.TransmitAgent == "efax")
            {
                AutoQRefreshCheckMenuItem.Active         = Settings.RefreshQueueEnabled;
                AutoQRefreshCheckMenuItem.Sensitive      = false;
                EmailNotificationCheckMenuItem.Active    = false;
                EmailNotificationCheckMenuItem.Sensitive = false;
                HiResolutionModeCheckMenuItem.Active     = Settings.HiResolution;
                LogEnabledCheckMenuItem.Visible          = false;
            }

            FaxTracingCheckMenuItem.Active = Settings.Faxtracing;

            eventsEnabled = true;

            StatusText.Editable = false;
            StatusText.CanFocus = false;
            StatusText.Buffer   = StatusTextBuffer;

            // Set the program icon
            Gdk.Pixbuf Icon = new Gdk.Pixbuf(null, "gfax.png");

            gfax.MainWindow = GfaxWindow;

            // Setup listview icons
            InitListViewIcons();

            StatusStore = new ListStore(
                typeof(Gdk.Pixbuf),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(DateTime),
                typeof(string));

            RecvStore = new ListStore(
                typeof(Gdk.Pixbuf),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(DateTime),
                typeof(string));


            lv = new G_ListView(StatusList, StatusStore);
            lv.AddColumnIcon(Gtk.Stock.Info, 0);
            lv.AddColumnTitle(Catalog.GetString("Jobid"), 1, 1);
            lv.AddColumnTitle(Catalog.GetString("Number"), 2, 2);
            lv.AddColumnTitle(Catalog.GetString("Status"), 3, 3);
            lv.AddColumnTitle(Catalog.GetString("Owner"), 4, 4);
            lv.AddColumnTitle(Catalog.GetString("Pages"), 5, 5);
            lv.AddColumnTitle(Catalog.GetString("Dials"), 6, 6);
            lv.AddColumnDateTime(Catalog.GetString("Send At"), "G", 7, 7);
            lv.AddColumnTitle(Catalog.GetString("Information"), 8, 8);

            // List view for completed jobs tab
            jobsCompletedView = new G_ListView(JobsCompleteList, StatusStore);
            jobsCompletedView.AddColumnIcon(Gtk.Stock.Info, 0);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Jobid"), 1, 1);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Number"), 2, 2);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Status"), 3, 3);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Owner"), 4, 4);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Pages"), 5, 5);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Dials"), 6, 6);
            jobsCompletedView.AddColumnDateTime(Catalog.GetString("Send At"), "G", 7, 7);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Information"), 8, 8);

            jobsReceivedView = new G_ListView(JobsReceivedList, RecvStore);
            jobsReceivedView.AddColumnIcon(Gtk.Stock.Info, 0);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Sender"), 1, 1);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Status"), 2, 2);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Pages  "), 3, 3);
            jobsReceivedView.AddColumnDateTime(Catalog.GetString("Arrived"), "G", 4, 4);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Filename"), 5, 5);

            StatusList.Selection.Changed +=
                new EventHandler(on_StatusList_selection);
            StatusList.Selection.Mode = SelectionMode.Multiple;
            StatusList.HeadersVisible = true;

            JobsCompleteList.Selection.Changed +=
                new EventHandler(on_JobsCompleteList_selection);
            JobsCompleteList.Selection.Mode = SelectionMode.Multiple;
            JobsCompleteList.HeadersVisible = true;

            JobsReceivedList.Selection.Changed +=
                new EventHandler(on_JobsReceivedList_selection);
            JobsReceivedList.Selection.Mode = SelectionMode.Multiple;
            JobsReceivedList.HeadersVisible = true;

            // Make sure headers are visible
            lv.AddTextToRow(null, "", "", "", "", "", "", null, "");
            jobsCompletedView.AddTextToRow(null, "", "", "", "", "", "", null, "");
            jobsReceivedView.AddTextToRow(null, "", "", "", null, "");
            StatusStore.Clear();
            RecvStore.Clear();

            DeleteJobButton.Sensitive = false;
            if (Settings.TransmitAgent == "hylafax")
            {
                ModifyJobButton.Sensitive = false;
            }
            else
            {
                ModifyJobButton.Visible = false;
            }
            ViewPrintButton.Sensitive = false;

            // Setup some global variables
            gfax.MainProgressBar   = Appbar.Progress;
            gfax.GStatusTextBuffer = StatusTextBuffer;
            gfax.GAppbar           = Appbar;

            gfax.Pulser = new Pulser();
            gfax.Status = new Status(StatusText, StatusTextBuffer);

            if (Settings.RefreshQueueEnabled)
            {
                GLib.Timeout.Add((uint)(Settings.RefreshQueueInterval * 1000),
                                 new TimeoutHandler(queue_refresh));
            }

            async_update_status();

            if (Settings.TransmitAgent == "hylafax")
            {
                while (gfax.activeNetwork)
                {
                    System.Threading.Thread.Sleep(100);
                }

                async_net_read_finished();
            }

            activeQ = ActiveQ.send;
            async_update_queue_status("sendq");

            StatusIcon sicon = new StatusIcon(Icon);

            sicon.Activate += new EventHandler(OnImageClick);
            sicon.Tooltip   = "Gfax Facsimile Sender";
            // showing the trayicon
            sicon.Visible = true;
            // setup system tray icon
            gfax.MainWindow.SkipTaskbarHint = true;
            gfax.MainWindow.Iconify();

            Application.Run();
        }
Пример #5
0
        public Gfax(string fname, string[] args)
            : base(APPNAME, VERSION, Modules.UI, args, new object [0])
        {
            //Phonebook[] pb;  delete me

             			// Set the program icon
             			Gtk.Window.DefaultIconName = "gfax";

            Application.Init ();

            // check to see if we've run before, if so gfax will be there
            if ( Settings.RunSetupAtStart ) {
                Settings.RunSetupAtStart = false;

                MessageDialog md;
                md = new MessageDialog (
                    null,
                    DialogFlags.DestroyWithParent,
                    MessageType.Info,
                    ButtonsType.Ok,
                    Catalog.GetString(
                        @"
            This is the first time you have run Gfax.
            You should set your MODEM TYPE and PORT under preferences.

            Gfax is initially setup to use Efax, you may change it use
            Hylafax if you prefer or require connection to a network
            facsimile server.")
                );
                md.Run ();
                md.Destroy();
            }

            if (!Directory.Exists(gfax.SpoolDirectory)) {
                G_Message gm = new G_Message(Catalog.GetString(
                    @"Your spool directory is missing!

            Please login as the root user and create the "
            + gfax.SpoolDirectory +
            " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/doneq")) {
                G_Message gm = new G_Message(Catalog.GetString(
                    @"The doneq directory is missing in your spool directory!

            Please login as the root user and create the "
            + gfax.SpoolDirectory + "/doneq" +
            " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/recq")) {
                G_Message gm = new G_Message(Catalog.GetString(
                    @"The recq directory is missing in your spool directory!

            Please login as the root user and create the "
            + gfax.SpoolDirectory + "/recq" +
            " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }

            gxml = new Glade.XML (null, "gfax.glade", "GfaxWindow", null);
            gxml.Autoconnect (this);

            // Set initial gui state as per preferences
            // GConf.PropertyEditors.EditorShell doesn't handle
            // checkmenuitems;
            eventsEnabled = false;
             	if (Settings.TransmitAgent == "hylafax") {
                AutoQRefreshCheckMenuItem.Active = Settings.RefreshQueueEnabled;
                EmailNotificationCheckMenuItem.Active = Settings.EmailNotify;
                HiResolutionModeCheckMenuItem.Active = Settings.HiResolution;
                LogEnabledCheckMenuItem.Active = Settings.LogEnabled;
            }
            if (Settings.TransmitAgent == "efax") {
                AutoQRefreshCheckMenuItem.Active = Settings.RefreshQueueEnabled;
                AutoQRefreshCheckMenuItem.Sensitive = false;
                EmailNotificationCheckMenuItem.Active = false;
                EmailNotificationCheckMenuItem.Sensitive = false;
                HiResolutionModeCheckMenuItem.Active = Settings.HiResolution;
                LogEnabledCheckMenuItem.Visible = false;
            }

            FaxTracingCheckMenuItem.Active = Settings.Faxtracing;

            eventsEnabled = true;

            StatusText.Editable = false;
            StatusText.CanFocus = false;
            StatusText.Buffer = StatusTextBuffer;

            // Set the program icon
            Gdk.Pixbuf Icon = new Gdk.Pixbuf(null, "gfax.png");

            gfax.MainWindow = GfaxWindow;

             			// Setup listview icons
             			InitListViewIcons();

            StatusStore = new ListStore(
             						typeof (Gdk.Pixbuf),
                        typeof (string),
                        typeof (string),
                        typeof (string),
                        typeof (string),
                        typeof (string),
                        typeof (string),
             						typeof (DateTime),
                        typeof (string));

            RecvStore = new ListStore(
             						typeof (Gdk.Pixbuf),
                        typeof (string),
                        typeof (string),
                        typeof (string),
             						typeof (DateTime),
                        typeof (string));

            lv = new G_ListView(StatusList, StatusStore);
             			lv.AddColumnIcon(Gtk.Stock.Info, 0);
             			lv.AddColumnTitle(Catalog.GetString("Jobid"),	1, 1);
             			lv.AddColumnTitle(Catalog.GetString("Number"),	2, 2);
             			lv.AddColumnTitle(Catalog.GetString("Status"),	3, 3);
             			lv.AddColumnTitle(Catalog.GetString("Owner"),	4, 4);
             			lv.AddColumnTitle(Catalog.GetString("Pages"),	5, 5);
             			lv.AddColumnTitle(Catalog.GetString("Dials"),	6, 6);
             			lv.AddColumnDateTime(Catalog.GetString("Send At"), "G",	7, 7);
             			lv.AddColumnTitle(Catalog.GetString("Information"),	8, 8);

            // List view for completed jobs tab
            jobsCompletedView = new G_ListView(JobsCompleteList, StatusStore);
             			jobsCompletedView.AddColumnIcon(Gtk.Stock.Info, 0);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Jobid"),	1, 1);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Number"),	2, 2);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Status"),	3, 3);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Owner"),	4, 4);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Pages"),	5, 5);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Dials"),	6, 6);
             			jobsCompletedView.AddColumnDateTime(Catalog.GetString("Send At"), "G",	7, 7);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Information"),	8, 8);

            jobsReceivedView = new G_ListView(JobsReceivedList, RecvStore);
             			jobsReceivedView.AddColumnIcon(Gtk.Stock.Info, 0);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Sender"),	1, 1);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Status"),	2, 2);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Pages  "),	3, 3);
             			jobsReceivedView.AddColumnDateTime(Catalog.GetString("Arrived"), "G",	4, 4);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Filename"),	5, 5);

            StatusList.Selection.Changed +=
                new EventHandler(on_StatusList_selection);
            StatusList.Selection.Mode = SelectionMode.Multiple;
            StatusList.HeadersVisible = true;

            JobsCompleteList.Selection.Changed +=
                new EventHandler(on_JobsCompleteList_selection);
            JobsCompleteList.Selection.Mode = SelectionMode.Multiple;
            JobsCompleteList.HeadersVisible = true;

            JobsReceivedList.Selection.Changed +=
                new EventHandler(on_JobsReceivedList_selection);
            JobsReceivedList.Selection.Mode = SelectionMode.Multiple;
            JobsReceivedList.HeadersVisible = true;

            // Make sure headers are visible
            lv.AddTextToRow(null,"","","","","","",null,"");
            jobsCompletedView.AddTextToRow(null,"","","","","","",null,"");
            jobsReceivedView.AddTextToRow(null,"","","",null,"");
            StatusStore.Clear();
            RecvStore.Clear();

            DeleteJobButton.Sensitive = false;
            if (Settings.TransmitAgent == "hylafax")
                ModifyJobButton.Sensitive = false;
            else
                ModifyJobButton.Visible = false;
            ViewPrintButton.Sensitive = false;

            // Setup some global variables
            gfax.MainProgressBar = Appbar.Progress;
            gfax.GStatusTextBuffer = StatusTextBuffer;
            gfax.GAppbar = Appbar;

            gfax.Pulser = new Pulser();
            gfax.Status = new Status(StatusText, StatusTextBuffer);

            if (Settings.RefreshQueueEnabled)
                GLib.Timeout.Add((uint)(Settings.RefreshQueueInterval * 1000),
                    new TimeoutHandler (queue_refresh));

            async_update_status();

            if (Settings.TransmitAgent == "hylafax" ) {
                while (gfax.activeNetwork)
                    System.Threading.Thread.Sleep(100);

                async_net_read_finished();
            }

            activeQ = ActiveQ.send;
            async_update_queue_status("sendq");

            StatusIcon sicon = new StatusIcon(Icon);
            sicon.Activate += new EventHandler (OnImageClick);
            sicon.Tooltip = "Gfax Facsimile Sender";
            // showing the trayicon
            sicon.Visible = true;
            // setup system tray icon
            gfax.MainWindow.SkipTaskbarHint = true;
            gfax.MainWindow.Iconify();

            Application.Run ();
        }