Even more spelling fixed
[oweals/cde.git] / cde / programs / dtmail / dtmail / OptCmd.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: OptCmd.C /main/20 1999/07/13 08:40:16 mgreess $ */
24 /*
25  *+SNOTICE
26  *
27  *      RESTRICTED CONFIDENTIAL INFORMATION:
28  *      
29  *      The information in this document is subject to special
30  *      restrictions in a confidential disclosure agreement bertween
31  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
32  *      document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
33  *      Sun's specific written approval.  This documment and all copies
34  *      and derivative works thereof must be returned or destroyed at
35  *      Sun's request.
36  *
37  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
38  *
39  *+ENOTICE
40  */
41 /*
42  *                   Common Desktop Environment
43  *
44  *   (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
45  *   (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
46  *   (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
47  *   (c) Copyright 1993, 1994, 1995 Novell, Inc.
48  *   (c) Copyright 1995 Digital Equipment Corp.
49  *   (c) Copyright 1995 Fujitsu Limited
50  *   (c) Copyright 1995 Hitachi, Ltd.
51  *                                                                   
52  *
53  *                     RESTRICTED RIGHTS LEGEND                              
54  *
55  *Use, duplication, or disclosure by the U.S. Government is subject to
56  *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
57  *Technical Data and Computer Software clause in DFARS 252.227-7013.  Rights
58  *for non-DOD U.S. Government Departments and Agencies are as set forth in
59  *FAR 52.227-19(c)(1,2).
60
61  *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
62  *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A. 
63  *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
64  *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
65  *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
66  *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
67  *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
68  */
69 ///////////////////////////////////////////////////////////////////////////////
70 //////////////////////////////////////////////////////////////////////////////
71 //         This example code is from the book:
72 //
73 //           Object-Oriented Programming with C++ and OSF/Motif
74 //         by
75 //           Douglas Young
76 //           Prentice Hall, 1992
77 //           ISBN 0-13-630252-1 
78 //
79 //
80 //  Permission to use, copy, modify, and distribute this software for 
81 //  any purpose except publication and without fee is hereby granted, provided 
82 //  that the above copyright notice appear in all copies of the software.
83 ///////////////////////////////////////////////////////////////////////////////
84 //////////////////////////////////////////////////////////////////////////////
85
86
87 ///////////////////////////////////////////////////////////
88 // OptCmd.C : creates the mail options dialog
89 //////////////////////////////////////////////////////////
90 #include <stdlib.h>
91 #include <sys/types.h>
92 #include <nl_types.h>
93 #include <pwd.h>
94 #include <unistd.h>
95
96 #include <X11/IntrinsicP.h>
97
98 #include "Application.h"
99 #include "DmxPrintOptions.h"
100 #include "DtMailHelp.hh"
101 #include "Help.hh"
102 #include "MailMsg.h"
103 #include "MailRetrievalOptions.h"
104 #include "MainWindow.h"
105 #include "RoamApp.h"
106 #include "RoamCmds.h"
107 #include "dtmailopts.h"
108 #include "options_ui.h"
109
110 #include <DtMail/PropUi.hh>
111 #include <DtMail/CheckForMailUiItem.hh>
112 #include <DtMail/SpinBoxUiItem.hh>
113 #include <DtMail/TextFieldUiItem.hh>
114 #include <DtMail/CheckBoxUiItem.hh>
115 #include <DtMail/AntiCheckBoxUiItem.hh>
116 #include <DtMail/ListUiItem.hh>
117 #include <DtMail/IgnoreListUiItem.hh>
118 #include <DtMail/MoveMenuListUiItem.hh>
119 #include <DtMail/AlternatesListUiItem.hh>
120 #include <DtMail/CustomListUiItem.hh>
121 #include <DtMail/TemplateListUiItem.hh>
122 #include <DtMail/AliasListUiItem.hh>
123 #include <DtMail/ScaleUiItem.hh>
124 #include <DtMail/OptCmd.h>
125 #include <DtMail/DtVirtArray.hh>
126 #include <DtMail/options_util.h>
127 #include <DtMail/Common.h>
128
129 nl_catd Dtb_project_catd;
130 extern Boolean props_changed;
131
132 #include "MailMsg.h"
133 static Dimension max_width = 0;
134 static Dimension max_height = 0;
135
136
137 OptCmd::OptCmd ( char *name, char *label, int active, Widget parent) : 
138                  WarnNoUndoCmd ( name, label, active ) 
139 {
140     _dialogParentWidget = parent;
141
142     _reopen_mailboxes = FALSE;
143     vacation_status_changed = FALSE;
144     vacation_msg_changed = FALSE;
145
146     _opt_dlog = NULL;
147     catstr = NULL;
148     CurrentPane = NULL;
149
150     mh_pane_list = NULL;
151     msg_view_pane_list = NULL;
152     compose_pane_list = NULL;
153     msg_filing_pane_list = NULL;
154     vacation_pane_list = NULL;
155     template_pane_list = NULL;
156     aliases_pane_list = NULL;
157     advanced_pane_list = NULL;
158     mailretrieval_pane_list = NULL;
159     vaca_sub = NULL;
160     vaca_msg = NULL;
161     generalDialog = NULL;
162     _PrintingOptions = NULL;
163     _MailRetrievalOptions = NULL;
164     printing_pane_list = NULL;
165 }
166
167 void
168 OptCmd::help_button_CB(Widget current_pane)
169 {
170     if (current_pane == _opt_dlog->msg_header_pane)
171         DisplayMain(current_pane, "Mailer", "MessageHeaderListOptions");
172     else if (current_pane == _opt_dlog->msg_view_pane)
173         DisplayMain(current_pane, "Mailer", "MessageViewOptions");
174     else if (current_pane == _opt_dlog->compose_win_pane)
175         DisplayMain(current_pane, "Mailer", "ComposeWindowOptions");
176     else if (current_pane == _opt_dlog->msg_filing_pane)
177         DisplayMain(current_pane, "Mailer", "MessageFilingOptions");
178     else if (current_pane == _opt_dlog->vacation_pane)
179         DisplayMain(current_pane, "Mailer", "VacationMailOptions");
180     else if (current_pane == _opt_dlog->templates_pane)
181         DisplayMain(current_pane, "Mailer", "MailTemplateOptions");
182     else if (current_pane == _opt_dlog->aliases_pane)
183         DisplayMain(current_pane, "Mailer", "MailAliasOptions");
184     else if (current_pane == _opt_dlog->advanced_pane)
185         DisplayMain(current_pane, "Mailer", "AdvancedMailOptions");
186     else if (current_pane == _opt_dlog->printing_pane)
187         DisplayMain(current_pane, "Mailer", "PrintingMailOptions");
188     else if (current_pane == _opt_dlog->printing_pane)
189         DisplayMain(current_pane, "Mailer", "MailRetrievalOptions");
190 }
191
192 void
193 opt_help_button_CB(Widget wid, XtPointer clientData, XtPointer calldata)
194 {
195     OptCmd *cmd_ptr = (OptCmd*)clientData;
196
197     // Suppress warnings
198     wid = wid;
199     calldata = calldata;
200
201     cmd_ptr->help_button_CB(cmd_ptr->currentPane());
202 }
203
204 void OptCmd::create_dlog()
205 {
206     theRoamApp.busyAllWindows(
207                    GETMSG(DT_catd, 3, 78, "Initializing Mail Options..."));
208
209     // make a new widget structure
210     _opt_dlog = (DtbOptionsDialogInfo)malloc(sizeof(
211                                DtbOptionsDialogInfoRec));
212         
213     // make sure it's all cleaned up
214     dtbOptionsDialogInfo_clear(_opt_dlog);
215
216     /*
217      * Open the standard message catalog for the project.
218      */
219     Dtb_project_catd = catopen(DTB_PROJECT_CATALOG, NL_CAT_LOCALE);
220
221 #ifdef NEVER
222     // Not a fatal error
223     if (Dtb_project_catd == (nl_catd)-1)
224       {
225         fprintf(stderr, "Could not open message catalog: %s\n",
226                 DTB_PROJECT_CATALOG);
227         exit(1);
228       }
229 #endif
230
231     // make us some a dem widgets!  :-)
232     dtb_options_dialog_initialize(_opt_dlog,
233                                   _dialogParentWidget);
234     //
235     // The Printing Options pane is handled outside the
236     // Builder generated code.
237     //
238     _PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
239     _opt_dlog->printing_pane = _PrintingOptions->baseWidget();
240
241     //
242     // The Mail Server Options pane is handled outside the
243     // Builder generated code.
244     //
245     _MailRetrievalOptions = new MailRetrievalOptions(_opt_dlog->layer);
246     _opt_dlog->mailretrieval_pane = _MailRetrievalOptions->baseWidget();
247
248
249     // We need to do this for the help system
250     dtb_save_toplevel_widget(_dialogParentWidget); 
251
252     XtSetMappedWhenManaged(_opt_dlog->dialog, False);
253     XtManageChild(_opt_dlog->dialog_shellform);
254
255     // hook them up to the back end!
256     this->init_panes();
257
258     // Attach the object to the mail options panes so they can later be referred
259     // to in options_set_category_pane().
260     XtVaSetValues(_opt_dlog->msg_header_pane, XmNuserData, this, NULL);
261     XtVaSetValues(_opt_dlog->msg_view_pane, XmNuserData, this, NULL);
262     XtVaSetValues(_opt_dlog->compose_win_pane, XmNuserData, this, NULL);
263     XtVaSetValues(_opt_dlog->msg_filing_pane, XmNuserData, this, NULL);
264     XtVaSetValues(_opt_dlog->vacation_pane, XmNuserData, this, NULL);
265     XtVaSetValues(_opt_dlog->templates_pane, XmNuserData, this, NULL);
266     XtVaSetValues(_opt_dlog->aliases_pane, XmNuserData, this, NULL);
267     XtVaSetValues(_opt_dlog->advanced_pane, XmNuserData, this, NULL);
268     XtVaSetValues(_opt_dlog->printing_pane, XmNuserData, this, NULL);
269     XtVaSetValues(_opt_dlog->mailretrieval_pane, XmNuserData, this, NULL);
270
271     // initialize the "current" pane
272     options_set_category_pane(_opt_dlog->msg_header_pane);
273
274     XtAddCallback(_opt_dlog->subject_tf,
275                   XmNvalueChangedCallback,
276                   vaca_msg_changedCB,
277                   (XtPointer)this);
278     
279     XtAddCallback(_opt_dlog->vacation_msg_tp,
280                   XmNvalueChangedCallback,
281                   vaca_msg_changedCB,
282                   (XtPointer)this);
283
284      XtAddCallback(_opt_dlog->help_button, XmNactivateCallback, 
285                 opt_help_button_CB,     (XtPointer)this);
286      XtAddCallback(_opt_dlog->ctrl_panel, XmNhelpCallback, 
287                 opt_help_button_CB,     (XtPointer)this);
288      XtAddCallback(_opt_dlog->msg_header_pane, XmNhelpCallback, 
289                 opt_help_button_CB,     (XtPointer)this);
290      XtAddCallback(_opt_dlog->msg_view_pane, XmNhelpCallback, 
291                 opt_help_button_CB,     (XtPointer)this);
292      XtAddCallback(_opt_dlog->compose_win_pane, XmNhelpCallback, 
293                 opt_help_button_CB,     (XtPointer)this);
294      XtAddCallback(_opt_dlog->msg_filing_pane, XmNhelpCallback, 
295                 opt_help_button_CB,     (XtPointer)this);
296      XtAddCallback(_opt_dlog->vacation_pane, XmNhelpCallback, 
297                 opt_help_button_CB,     (XtPointer)this);
298      XtAddCallback(_opt_dlog->templates_pane, XmNhelpCallback, 
299                 opt_help_button_CB,     (XtPointer)this);
300      XtAddCallback(_opt_dlog->aliases_pane, XmNhelpCallback, 
301                 opt_help_button_CB,     (XtPointer)this);
302      XtAddCallback(_opt_dlog->advanced_pane, XmNhelpCallback, 
303                 opt_help_button_CB,     (XtPointer)this);
304      XtAddCallback(_opt_dlog->dialog_button_panel, XmNhelpCallback, 
305                 opt_help_button_CB,     (XtPointer)this);
306      XtAddCallback(_opt_dlog->printing_pane, XmNhelpCallback, 
307                 opt_help_button_CB,     (XtPointer)this);
308      XtAddCallback(_opt_dlog->mailretrieval_pane, XmNhelpCallback, 
309                 opt_help_button_CB,     (XtPointer)this);
310
311      theRoamApp.unbusyAllWindows();
312      theRoamApp.setOptionsDialog((char*)_opt_dlog);
313      props_changed = FALSE;
314 }
315
316 //////////////////////////////////////////////////////////////////////////////
317 void vaca_msg_changedCB(Widget w, XtPointer ClientData, XtPointer calldata)
318 {
319   OptCmd *cmd_ptr = (OptCmd*)ClientData;
320   
321   w = w;
322   calldata = calldata;
323
324   cmd_ptr->set_vaca_msg_Changed();
325
326 }
327
328 //////////////////////////////////////////////////////////////////////////////
329
330 //////////////////////////////////////////////////////////////////////////////
331 void
332 options_set_category_pane(
333     Widget      pane
334 )
335 {
336   char buf[1024];
337   OptCmd *cmd_ptr;
338   Widget current_pane;
339   int answer;
340
341   XtVaGetValues(pane,
342         XmNuserData, &cmd_ptr,
343         NULL);
344
345   current_pane = cmd_ptr->currentPane();
346   if (pane == current_pane)
347         return;
348
349   if (current_pane != NULL && props_changed) {
350         sprintf(buf, "%s", GETMSG(DT_catd, 15, 1, "You have made unsaved changes.\nYou may save your changes, discard your changes,\nor return to your previous place in the dialog."));
351  
352         cmd_ptr->genDialog()->setToQuestionDialog(
353                         GETMSG(DT_catd, 5, 2, "Mailer"),
354                         buf);
355  
356         answer = cmd_ptr->genDialog()->post_and_return(
357                         GETMSG(DT_catd, 15, 2, "Save"),
358                         GETMSG(DT_catd, 1, 182, "Cancel"),
359                         GETMSG(DT_catd, 15, 3, "Discard"),
360                         DTMAILHELPERROR);
361  
362         if (answer == 1) { //Save
363                 if (! cmd_ptr->optionsAreValid()) return;
364                 cmd_ptr->update_source();
365                 cmd_ptr->doVacationCheck();
366         }
367         else if (answer == 3) { // Discard
368                 cmd_ptr->update_panes();
369         }
370         else if (answer == 2) { // Cancel
371                 //props_changed = FALSE;
372                 cmd_ptr->setOldCategoryStr();
373                 return;
374         }
375   }
376   props_changed = FALSE;
377   XtManageChild(pane);
378  
379   if (current_pane != NULL)
380     XtUnmanageChild(current_pane);
381  
382   cmd_ptr->setCurrentPane(pane);
383   cmd_ptr->setNewCategoryStr();
384 }
385
386 //////////////////////////////////////////////////////////////////////////////
387 OptCmd::~OptCmd()
388 {
389 //  free(_opt_dlog);
390
391   _opt_dlog = NULL;
392
393 }
394 //////////////////////////////////////////////////////////////////////////////
395 // hookup the front and back ends of the mail options
396 void OptCmd::init_panes()
397 {
398
399   this->init_msg_hdr_pane();
400   this->init_msg_view_pane();
401   this->init_compose_pane();
402   this->init_msg_filing_pane();
403   this->init_vacation_pane();
404   this->init_template_pane();
405   this->init_aliases_pane();
406   this->init_advanced_pane();
407   this->init_printing_pane();
408   this->init_mailretrieval_pane();
409
410 }
411
412 //////////////////////////////////////////////////////////////////////////////
413 void OptCmd::update_panes()
414 {
415   VacationCmd *vacation_cmd = theRoamApp.vacation();
416   Boolean vaca_running = FALSE;
417
418   char *tmp_ptr;
419
420   Arg args[1];
421
422   if(vacation_cmd != NULL)
423     vaca_running = vacation_cmd->priorVacationRunning();
424
425   this->updateUiFromBackEnd(mh_pane_list);    
426   this->updateUiFromBackEnd(msg_view_pane_list);    
427   this->updateUiFromBackEnd(compose_pane_list);    
428   this->updateUiFromBackEnd(msg_filing_pane_list);    
429   this->updateUiFromBackEnd(template_pane_list);
430   this->updateUiFromBackEnd(aliases_pane_list);
431   this->updateUiFromBackEnd(advanced_pane_list);
432   this->updateUiFromBackEnd(printing_pane_list);
433   this->updateUiFromBackEnd(mailretrieval_pane_list);
434
435   // make sure Vacation pane is correct
436   XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
437                 XmNset, vaca_running,
438                 NULL);
439
440   XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
441                 XmNset, !vaca_running,
442                 NULL);
443
444   // set Subject and Message
445   if(vacation_cmd != NULL)
446     {
447       tmp_ptr = vacation_cmd->subject();
448
449   // if the vaction subject is a null string ( for the case there is no
450   // .vacation.msg file but the user already typed his own subject but
451   // would like to reset. We need reset the subject back to the message
452   // "Dtb_project_catd, 2, 68,"
453   
454       XtSetArg(args[0], XmNvalue, GETMSG(Dtb_project_catd, 2, 68, "Out of the office"));
455
456       if(tmp_ptr != NULL)
457         XtVaSetValues(_opt_dlog->subject_tf,
458                       XmNvalue, tmp_ptr,
459                       NULL);
460   // set back to the default value
461       else
462         XtSetValues(_opt_dlog->subject_tf,args,1);
463         
464
465       tmp_ptr = vacation_cmd->body();
466
467 // Do same thing for the body part
468
469       if(tmp_ptr != NULL)
470         XtVaSetValues(_opt_dlog->vacation_msg_tp,
471                       XmNvalue, tmp_ptr,
472                       NULL);
473       else   //set a space to the body
474         XtVaSetValues(_opt_dlog->vacation_msg_tp,
475                       XmNvalue, " ",
476                       NULL);
477
478     }
479
480   _reopen_mailboxes = FALSE;
481   vacation_status_changed = FALSE;
482   vacation_msg_changed = FALSE;
483   props_changed = FALSE;
484   
485 }
486
487 //////////////////////////////////////////////////////////////////////////////
488 void OptCmd::update_source()
489 {
490
491   DtMailEnv error;
492   DtMail::Session * d_session = theRoamApp.session()->session();
493   DtMail::MailRc * mail_rc = d_session->mailRc(error);
494
495   this->updateBackEndFromUi(mh_pane_list);    
496   this->updateBackEndFromUi(msg_view_pane_list);    
497   this->updateBackEndFromUi(compose_pane_list);    
498   this->updateBackEndFromUi(msg_filing_pane_list);    
499   this->updateBackEndFromUi(template_pane_list);
500   this->updateBackEndFromUi(aliases_pane_list);
501   this->updateBackEndFromUi(advanced_pane_list);
502   this->updateBackEndFromUi(printing_pane_list);
503   this->updateBackEndFromUi(mailretrieval_pane_list);
504
505   if (mail_rc->getParseError() != DTME_NoError)
506   {
507     char* helpId;
508     int answer = 0;
509
510     genDialog()->setToErrorDialog(GETMSG(DT_catd, 2, 1, "Mailer"),
511       GETMSG(DT_catd, 2, 25, "There were unrecoverable syntax errors found in the ~/.mailrc file.\nMail options settings can be applied in the current session but can\nnot be saved to file."));
512     helpId = DTMAILHELPERROR;
513     genDialog()->post_and_return(GETMSG(DT_catd, 3, 5, "OK"), helpId);
514     return;
515   }
516   else mail_rc->update(error);
517
518   if (_reopen_mailboxes)
519   {
520       theRoamApp.reopenRoamMenuWindows();
521       _reopen_mailboxes = FALSE;
522   }
523   theRoamApp.globalPropChange();
524   props_changed = FALSE;
525 }
526
527 //////////////////////////////////////////////////////////////////////////////
528 // Handle the file locking stuff.
529
530 int OptCmd::doFileLockingCheck()
531 {
532     int answer = 0;
533
534     DtMailEnv        error;
535     DtMail::Session *m_session = theRoamApp.session()->session();
536     const char      *value = NULL;
537     Boolean          use_file_locking;
538     unsigned char    is_set;
539
540     m_session->mailRc(error)->getValue(error, "cdetooltalklock", &value);
541     use_file_locking = error.isNotSet();
542     if (NULL != value) free((void*) value);
543
544     if (XtIsManaged(_opt_dlog->advanced_pane))
545     {
546         XtVaGetValues(
547           _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
548           XmNset, &is_set,
549           NULL);
550
551         if (is_set != use_file_locking)
552         {
553             char            *message = GETMSG(DT_catd, 2, 26,
554 "The value of the file locking option has changed.\nTo take immediate effect, folders need to be closed and reopened.\n  o Click on 'Reopen' to reopen folders,\n    making the new option take effect immediately.\n  o Click on 'Continue' to avoid reopening folders.\n    The new option will take effect the next time you open a folder.\n  o Click on 'Cancel' to cancel the Apply and return to editing options.");
555             genDialog()->setToQuestionDialog(
556                                 GETMSG(DT_catd, 2, 1, "Mailer"),
557                                 message);
558             answer =
559               genDialog()->post_and_return(
560                                 GETMSG(DT_catd, 2, 27, "Reopen"),
561                                 GETMSG(DT_catd, 2, 29, "Cancel"),
562                                 GETMSG(DT_catd, 2, 28, "Continue"),
563                                 "AdvancedMailOptions");
564
565             //
566             // 1 == Reopen
567             // 2 == Cancel
568             // 3 == Continue
569             //
570             if (1 == answer)
571               _reopen_mailboxes = TRUE;
572             else
573               _reopen_mailboxes = FALSE;
574
575             if (2 != answer)
576               theRoamApp.closeInactiveRoamMenuWindows();
577         }
578     }
579     return (2!=answer);
580 }
581
582
583 //////////////////////////////////////////////////////////////////////////////
584 // Handle the vacation stuff.
585
586 void OptCmd::doVacationCheck()
587 {
588   Boolean is_set;
589
590   VacationCmd *vacation_cmd = theRoamApp.vacation();
591   DtMailGenDialog *dialog = genDialog();
592
593   vacation_cmd->setGenDialog(dialog);
594   if(vacation_status_changed)
595   {   // there was a change in status
596       if (XtIsManaged(_opt_dlog->vacation_pane))
597       {
598          XtVaGetValues(_opt_dlog->vacation_rb_items.On_item,
599                           XmNset, &is_set,
600                           NULL);
601          if(is_set)
602          {
603             Boolean status = this->startVacation();
604
605             // startVacation also updates the mgs strings if changed
606             vacation_msg_changed = FALSE;
607             vacation_status_changed = status; // reset flag
608          }
609          else 
610          {
611             this->stopVacation();
612             vacation_status_changed = FALSE; // reset flag
613          }
614        }
615   }
616
617   if (vacation_msg_changed)
618   {
619     if (vacation_cmd)
620     {
621         char *subj, *body;
622         XtVaGetValues(_opt_dlog->subject_tf, XmNvalue, &subj, NULL);
623         XtVaGetValues(_opt_dlog->vacation_msg_tp, XmNvalue, &body, NULL);
624
625         vacation_cmd->handleMessageFile(subj, body);
626     }
627     vacation_msg_changed = FALSE;
628   }
629 }
630
631 void OptCmd::setVacationChanged()
632 {
633   vacation_status_changed = TRUE;
634   props_changed = TRUE;
635 }
636
637 void OptCmd::set_vaca_msg_Changed()
638 {
639   vacation_msg_changed = TRUE;
640   props_changed = TRUE;
641 }
642 Boolean
643 OptCmd::startVacation()
644 {
645   Boolean status = theRoamApp.startVacation(
646                            _opt_dlog->subject_tf, 
647                            _opt_dlog->vacation_msg_tp);
648   return status;
649 }
650
651
652 void
653 OptCmd::stopVacation()
654 {
655   theRoamApp.stopVacation();
656 }
657
658 //////////////////////////////////////////////////////////////////////////////
659 // Check the printing options to make sure they are valid
660
661 Boolean OptCmd::optionsAreValid()
662 {
663     char        *errMsg = NULL;
664     PropUiItem  *propui_ptr = NULL;
665     int         answer;
666
667     for (propui_ptr = _PrintingOptions->getFirstProp();
668          propui_ptr != (PropUiItem *) NULL;
669          propui_ptr = _PrintingOptions->getNextProp())
670     {
671         errMsg = propui_ptr->uiValueIsValid();
672         if (errMsg != NULL)
673         {
674             this->genDialog()->setToQuestionDialog(
675                         GETMSG(DT_catd, 5, 2, "Mailer"),
676                         errMsg);
677  
678             answer = this->genDialog()->post_and_return(
679                         GETMSG(DT_catd, 26, 5, "Continue"),
680                         DTMAILHELPERROR);
681  
682             XtFree(errMsg);
683             return FALSE;
684         }
685     }
686
687     for (propui_ptr = _MailRetrievalOptions->getFirstProp();
688          propui_ptr != (PropUiItem *) NULL;
689          propui_ptr = _MailRetrievalOptions->getNextProp())
690     {
691         errMsg = propui_ptr->uiValueIsValid();
692         if (errMsg != NULL)
693         {
694             this->genDialog()->setToQuestionDialog(
695                         GETMSG(DT_catd, 5, 2, "Mailer"),
696                         errMsg);
697  
698             answer = this->genDialog()->post_and_return(
699                         GETMSG(DT_catd, 26, 5, "Continue"),
700                         DTMAILHELPERROR);
701  
702             XtFree(errMsg);
703             return FALSE;
704         }
705     }
706     return TRUE;
707 }
708
709 //////////////////////////////////////////////////////////////////////////////
710 void register_pane_size(Widget pane)
711 {
712     Dimension   width, height;
713
714     XtManageChild(pane);
715     XtVaGetValues(pane,
716                 XmNwidth, &width, XmNheight, &height,
717                 NULL);
718
719     if (width > max_width)
720         max_width = width;
721
722     if (height > max_height)
723         max_height = height;
724
725     XtUnmanageChild(pane);
726 }
727
728 //////////////////////////////////////////////////////////////////////////////
729 // init the message header list pane
730 void OptCmd::init_msg_hdr_pane()
731 {
732
733   PropUiItem *propui_ptr = NULL;
734
735   // register overall size of pane
736   register_pane_size(_opt_dlog->msg_header_pane);
737
738   // test for the message header list pane
739   
740   // make the list...
741   mh_pane_list = new DtVirtArray<PropUiItem *>(3);
742
743   // make the check for new mail SB
744   propui_ptr = (PropUiItem *)new CheckForMailUiItem(_opt_dlog->mail_check_sb,
745                                                     _FROM_MAILRC,
746                                                     "retrieveinterval");
747   propui_ptr->writeFromSourceToUi();
748   mh_pane_list->append(propui_ptr);
749
750   // make the signal with beep SB
751   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->signal_sb,
752                                                _FROM_MAILRC,
753                                                "bell");
754   propui_ptr->writeFromSourceToUi();
755   mh_pane_list->append(propui_ptr);
756
757   // make the sig with flashes SB
758   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->spinbox2,
759                                                _FROM_MAILRC,
760                                                "flash");
761   propui_ptr->writeFromSourceToUi();
762   mh_pane_list->append(propui_ptr);
763
764   // make the disp headers SB
765   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_sb,
766                                                _FROM_MAILRC,
767                                                "headerlines");
768   propui_ptr->writeFromSourceToUi();
769   mh_pane_list->append(propui_ptr);
770
771   // make the sho "To: Recipient"
772   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
773          _opt_dlog->checkbox_items.Show_To_recipient_when_mail_is_from_me_item,
774                                                 _FROM_MAILRC,
775                                                 "showto");
776   propui_ptr->writeFromSourceToUi();
777   mh_pane_list->append(propui_ptr);
778
779   // make the sho "Display message numbers"
780   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
781          _opt_dlog->checkbox_items.Display_message_numbers_item,
782                                                 _FROM_MAILRC,
783                                                 "showmsgnum");
784   propui_ptr->writeFromSourceToUi();
785   mh_pane_list->append(propui_ptr);
786
787   // make the sho "destroy on close"
788   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
789          _opt_dlog->deleted_msg_cb_items.When_I_close_the_mailbox_item,
790                                                 _FROM_MAILRC,
791                                                 "keepdeleted");
792   propui_ptr->writeFromSourceToUi();
793   mh_pane_list->append(propui_ptr);
794
795   // make the sho "show confirm notice"
796   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
797          _opt_dlog->deleted_msg_cb_items.Show_confirmation_notice_item,
798                                                 _FROM_MAILRC,
799                                                 "quietdelete");
800   propui_ptr->writeFromSourceToUi();
801   mh_pane_list->append(propui_ptr);
802   
803 }
804
805 //////////////////////////////////////////////////////////////////////////////
806 void OptCmd::init_msg_view_pane()
807 {
808   DtMailEnv error;
809   DtMail::Session * d_session = theRoamApp.session()->session();
810   DtMail::MailRc * mail_rc = d_session->mailRc(error);
811   PropUiItem *propui_ptr = NULL;
812   ListUiItem *list_ptr = NULL;
813
814   // register overall size of pane 
815   register_pane_size(_opt_dlog->msg_view_pane); 
816   
817   // make the list...
818   msg_view_pane_list = new DtVirtArray<PropUiItem *>(2);
819
820   //---
821   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_row_sb,
822                                                _FROM_MAILRC,
823                                                "popuplines");
824   propui_ptr->writeFromSourceToUi();
825   msg_view_pane_list->append(propui_ptr);
826
827   //---
828   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->characters_wide_sb,
829                                                _FROM_MAILRC,
830                                                "toolcols");
831   propui_ptr->writeFromSourceToUi();
832   msg_view_pane_list->append(propui_ptr);
833
834   list_ptr = (ListUiItem *)new IgnoreListUiItem(_opt_dlog->hidden_fields_list,
835                                             _FROM_MAILRC,
836                                             "ignore",
837                                             _opt_dlog->fields_hide);
838   
839   add_cbs_to_list(list_ptr,
840                   _opt_dlog->h_field_add,
841                   _opt_dlog->h_field_delete,
842                   _opt_dlog->h_field_change);
843     
844   list_ptr->writeFromSourceToUi();
845   list_ptr->AddDefaults();
846   msg_view_pane_list->append(list_ptr);
847
848 }
849
850 //////////////////////////////////////////////////////////////////////////////
851 void OptCmd::init_compose_pane()
852 {
853   PropUiItem *propui_ptr = NULL;
854   DtMailEnv error;
855   DtMail::Session * d_session = theRoamApp.session()->session();
856   DtMail::MailRc * mail_rc = d_session->mailRc(error);
857
858   DtVirtArray<char *> fields_list(10);
859   ListUiItem *list_ptr = NULL;
860
861   // register overall size of pane 
862   register_pane_size(_opt_dlog->compose_win_pane); 
863
864   // make the list...
865   compose_pane_list = new DtVirtArray<PropUiItem *>(1);
866
867   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->indent_str_tf,
868                                                _FROM_MAILRC,
869                                                "indentprefix");
870   propui_ptr->writeFromSourceToUi();
871   compose_pane_list->append(propui_ptr);
872
873   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
874         _opt_dlog->wrap_checkbox_items.Show_Attachment_List_item,
875                                                _FROM_MAILRC,
876                                                "hideattachments");
877   propui_ptr->writeFromSourceToUi();
878   compose_pane_list->append(propui_ptr);
879
880   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
881         _opt_dlog->cfrm_att_checkbox_items.Confirm_Attachment_item,
882                                                _FROM_MAILRC,
883                                                "confirmattachments");
884   propui_ptr->writeFromSourceToUi();
885   compose_pane_list->append(propui_ptr);
886
887   //--
888   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->cfrm_att_size_sb,
889                                                _FROM_MAILRC,
890                                                "confirmattachmentthreshold");
891   propui_ptr->writeFromSourceToUi();
892   compose_pane_list->append(propui_ptr);
893
894   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->deadletter_field,
895                                                _FROM_MAILRC,
896                                                "deaddir");
897   propui_ptr->writeFromSourceToUi();
898   compose_pane_list->append(propui_ptr);
899
900   list_ptr = (ListUiItem *)new CustomListUiItem(_opt_dlog->list,
901                                                   _FROM_MAILRC,
902                                                   "",
903                                                   _opt_dlog->hdr_field,
904                                                   _opt_dlog->def_value_field);
905   add_cbs_to_list(list_ptr,
906                   _opt_dlog->add_button,
907                   _opt_dlog->del_button,
908                   _opt_dlog->change_button);
909   
910   list_ptr->writeFromSourceToUi();
911   compose_pane_list->append(list_ptr);
912
913 }
914
915 //////////////////////////////////////////////////////////////////////////////
916 void OptCmd::init_msg_filing_pane()
917 {
918   DtMailEnv error;
919   DtMail::Session * d_session = theRoamApp.session()->session();
920   DtMail::MailRc * mail_rc = d_session->mailRc(error);
921   const char *list_str = NULL;
922   DtVirtArray<char *> move_menu_list(10);
923   PropUiItem *propui_ptr = NULL;
924
925   // register overall size of pane 
926   register_pane_size(_opt_dlog->msg_filing_pane); 
927
928   ListUiItem *list_ptr = NULL;
929
930   // make the list...
931   msg_filing_pane_list = new DtVirtArray<PropUiItem *>(5);
932
933   //--
934   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->srt_looking_tf,
935                                                  _FROM_MAILRC,
936                                                  "folder");
937   propui_ptr->writeFromSourceToUi();
938   msg_filing_pane_list->append(propui_ptr);
939
940   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
941         _opt_dlog->dpy_up_mbox_cb_items.Display_up_to_item,
942                                                _FROM_MAILRC,
943                                                "dontdisplaycachedfiles");
944   propui_ptr->writeFromSourceToUi();
945   msg_filing_pane_list->append(propui_ptr);
946
947   //--
948   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->recent_sb,
949                                                _FROM_MAILRC,
950                                                "cachedfilemenusize");
951   propui_ptr->writeFromSourceToUi();
952   msg_filing_pane_list->append(propui_ptr);
953
954   //--
955   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->sent_mail_tf,
956                                                  _FROM_MAILRC,
957                                                  "record");
958   propui_ptr->writeFromSourceToUi();
959   msg_filing_pane_list->append(propui_ptr);
960
961
962    propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
963          _opt_dlog->log_cb_items.Log_all_sent_messages_item,
964                                                 _FROM_MAILRC,
965                                                 "dontlogmessages");
966
967 //    propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
968 //       _opt_dlog->log_cb_items.Log_all_sent_messages_item,
969 //                                              _FROM_MAILRC,
970 //                                              "nodontlogmessages");
971   propui_ptr->writeFromSourceToUi();
972   msg_filing_pane_list->append(propui_ptr);
973
974   list_ptr = (ListUiItem *)new MoveMenuListUiItem(_opt_dlog->mv_menu_lst,
975                                                   _FROM_MAILRC,
976                                                   "",
977                                                   _opt_dlog->path_file_name_tf);
978
979   add_cbs_to_list(list_ptr,
980                   _opt_dlog->mm_add_butt,
981                   _opt_dlog->mm_delete_butt,
982                   _opt_dlog->mm_change_butt);
983     
984   list_ptr->writeFromSourceToUi();
985   msg_filing_pane_list->append(list_ptr);
986
987 }
988
989 //////////////////////////////////////////////////////////////////////////////
990 void OptCmd::init_vacation_pane()
991 {
992   // register overall size of pane 
993   register_pane_size(_opt_dlog->vacation_pane); 
994 }
995
996 //////////////////////////////////////////////////////////////////////////////
997 void OptCmd::init_template_pane()
998 {
999   DtMailEnv error;
1000   ListUiItem *list_ptr = NULL;
1001
1002   // register overall size of pane 
1003   register_pane_size(_opt_dlog->templates_pane); 
1004
1005   // make the list...
1006   template_pane_list = new DtVirtArray<PropUiItem *>(3);
1007
1008   list_ptr = (ListUiItem *)new TemplateListUiItem(_opt_dlog->templates_list,
1009                                                   _FROM_MAILRC,
1010                                                   "templates",
1011                                                   _opt_dlog->menu_label,
1012                                                   _opt_dlog->path_filename_label);
1013
1014     add_cbs_to_list(list_ptr,
1015                   _opt_dlog->tem_add_but,
1016                   _opt_dlog->tem_del_but,
1017                   _opt_dlog->tem_change_but);
1018
1019   list_ptr->writeFromSourceToUi();
1020   template_pane_list->append(list_ptr);
1021
1022 }
1023
1024 //////////////////////////////////////////////////////////////////////////////
1025 void OptCmd::init_aliases_pane()
1026 {
1027   DtMailEnv error;
1028   ListUiItem *list_ptr = NULL;
1029
1030   // register overall size of pane 
1031   register_pane_size(_opt_dlog->aliases_pane); 
1032
1033   // make the list...
1034    aliases_pane_list = new DtVirtArray<PropUiItem *>(3);
1035
1036   list_ptr = (ListUiItem *)new AliasListUiItem(_opt_dlog->alias_list,
1037                                                _FROM_MAILRC,
1038                                                "alias",
1039                                                _opt_dlog->alias_tf,
1040                                                _opt_dlog->addresses_tf);
1041
1042   add_cbs_to_list(list_ptr,
1043                   _opt_dlog->alias_add_but,
1044                   _opt_dlog->alias_delete_but,
1045                   _opt_dlog->al_change_but);
1046
1047   list_ptr->writeFromSourceToUi();
1048   aliases_pane_list->append(list_ptr);
1049
1050 }
1051
1052 //////////////////////////////////////////////////////////////////////////////
1053 void OptCmd::init_advanced_pane()
1054 {
1055   DtMailEnv error;
1056   DtVirtArray<char *> alternates_list(8);
1057   PropUiItem *propui_ptr = NULL;
1058   uid_t euid;
1059   struct passwd *user_passwd = NULL;
1060   char *label_str = NULL;
1061   XmString label_xm_str;
1062
1063   // register overall size of pane 
1064   register_pane_size(_opt_dlog->advanced_pane); 
1065
1066   ListUiItem *list_ptr = NULL;
1067
1068   label_str = (char *)malloc(256);
1069
1070   // set the list to be a mono spaced font...
1071
1072
1073   // make the list...
1074   advanced_pane_list = new DtVirtArray<PropUiItem *>(6);
1075
1076   propui_ptr = (PropUiItem *)new ScaleUiItem(
1077                 _opt_dlog->update_mbox_scale,
1078                                                 _FROM_MAILRC,
1079                                                 "saveinterval");
1080   propui_ptr->writeFromSourceToUi();
1081   advanced_pane_list->append(propui_ptr);
1082
1083   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
1084               _opt_dlog->adv_def_cb_items.Show_confirmation_notices_item,
1085                                                 _FROM_MAILRC,   
1086                                                 "expert");
1087   propui_ptr->writeFromSourceToUi();
1088   advanced_pane_list->append(propui_ptr);
1089
1090   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1091       _opt_dlog->adv_def_cb_items.Use_strict_MIME_character_encoding_item,
1092                                                 _FROM_MAILRC,   
1093                                                 "strictmime");
1094   propui_ptr->writeFromSourceToUi();
1095   advanced_pane_list->append(propui_ptr);
1096
1097   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1098       _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
1099                                                 _FROM_MAILRC,   
1100                                                 "cdetooltalklock");
1101   propui_ptr->writeFromSourceToUi();
1102   advanced_pane_list->append(propui_ptr);
1103
1104   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1105       _opt_dlog->adv_def_cb_items.Ignore_host_name_in_address_allnet_item,
1106                                                 _FROM_MAILRC,   
1107                                                 "allnet");
1108   propui_ptr->writeFromSourceToUi();
1109   advanced_pane_list->append(propui_ptr);
1110
1111   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1112       _opt_dlog->adv_def_cb_items.Include_me_when_I_Reply_to_all_metoo_item,
1113                                                 _FROM_MAILRC,   
1114                                                 "metoo");
1115   propui_ptr->writeFromSourceToUi();
1116   advanced_pane_list->append(propui_ptr);
1117
1118   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1119               _opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1120                                                 _FROM_MAILRC,   
1121                                                 "usealternates");
1122   propui_ptr->writeFromSourceToUi();
1123   advanced_pane_list->append(propui_ptr);
1124
1125   // set uid in string...
1126   euid = geteuid();  // get uid of user
1127
1128   user_passwd = getpwuid(euid); // get passwd entry for user 
1129
1130   sprintf(label_str, "%s \"%s\" =",
1131           GETMSG( DT_catd, 20, 2, "Use local name: "), user_passwd->pw_name);
1132
1133   label_xm_str = XmStringCreateLocalized(label_str);
1134
1135   XtVaSetValues(_opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1136                 XmNlabelString, label_xm_str,
1137                 NULL);
1138
1139
1140   list_ptr = (ListUiItem *)new AlternatesListUiItem(_opt_dlog->local_name_list,
1141                                                     _FROM_MAILRC,
1142                                                     "alternates",
1143                                                     _opt_dlog->local_name_tf);
1144   
1145   add_cbs_to_list(list_ptr,
1146                   _opt_dlog->local_name_add_but,
1147                   _opt_dlog->local_name_del_but,
1148                   _opt_dlog->local_name_chg_but);
1149     
1150
1151   list_ptr->writeFromSourceToUi();
1152   advanced_pane_list->append(list_ptr);
1153
1154 }
1155
1156
1157 //////////////////////////////////////////////////////////////////////////////
1158 void OptCmd::init_printing_pane()
1159 {
1160   DtMailEnv     error;
1161   PropUiItem    *propui_ptr = NULL;
1162   int           npropui;
1163
1164   //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1165   //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1166
1167   // register overall size of pane 
1168   register_pane_size(_opt_dlog->printing_pane); 
1169
1170   // make the list...
1171   npropui = _PrintingOptions->getNumProps();
1172   printing_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1173
1174   if (npropui)
1175   {
1176       for (propui_ptr = _PrintingOptions->getFirstProp();
1177            propui_ptr != (PropUiItem *) NULL;
1178            propui_ptr = _PrintingOptions->getNextProp())
1179       {
1180           propui_ptr->writeFromSourceToUi();
1181           printing_pane_list->append(propui_ptr);
1182       }
1183   }
1184 }
1185
1186
1187 //////////////////////////////////////////////////////////////////////////////
1188 void OptCmd::init_mailretrieval_pane()
1189 {
1190   DtMailEnv     error;
1191   PropUiItem    *propui_ptr = NULL;
1192   int           npropui;
1193
1194   //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1195   //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1196
1197   // register overall size of pane 
1198   register_pane_size(_opt_dlog->mailretrieval_pane); 
1199
1200   // make the list...
1201   npropui = _MailRetrievalOptions->getNumProps();
1202   mailretrieval_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1203
1204   if (npropui)
1205   {
1206       for (propui_ptr = _MailRetrievalOptions->getFirstProp();
1207            propui_ptr != (PropUiItem *) NULL;
1208            propui_ptr = _MailRetrievalOptions->getNextProp())
1209       {
1210           propui_ptr->writeFromSourceToUi();
1211           mailretrieval_pane_list->append(propui_ptr);
1212       }
1213   }
1214
1215   _MailRetrievalOptions->initOptionInteractions();
1216 }
1217
1218
1219 //////////////////////////////////////////////////////////////////////////////
1220 void OptCmd::doit()
1221 {
1222   // make sure all the sheets are uptodate
1223   this->update_panes();
1224
1225   XtVaSetValues(_opt_dlog->cancel_button,
1226                 XmNuserData, this,
1227                 NULL);
1228
1229   XtVaSetValues(_opt_dlog->ok_button,
1230                 XmNuserData, this,
1231                 NULL);
1232
1233   XtVaSetValues(_opt_dlog->apply_button,
1234                 XmNuserData, this,
1235                 NULL);
1236
1237   XtVaSetValues(_opt_dlog->reset_button,
1238                 XmNuserData, this,
1239                 NULL);
1240
1241   XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
1242                 XmNuserData, this,
1243                 NULL);
1244
1245   XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
1246                 XmNuserData, this,
1247                 NULL);
1248
1249   XtPopdown(_opt_dlog->dialog);
1250   XtPopup(_opt_dlog->dialog, XtGrabNone);
1251   XtManageChild(_opt_dlog->dialog_shellform);
1252   props_changed = FALSE;
1253 }       
1254 //////////////////////////////////////////////////////////////////
1255 void OptCmd::updateUiFromBackEnd(DtVirtArray<PropUiItem *> *list)
1256 {
1257   int len, i;
1258
1259   if(list != NULL)
1260     {
1261       len = list->length();
1262       
1263       for(i = 0; i < len; i++)
1264         (*list)[i]->writeFromSourceToUi();
1265     }
1266   else
1267     fprintf(stderr,"NULL list passed to updateUiFromBackEnd\n");
1268   
1269 }
1270 //////////////////////////////////////////////////////////////////
1271 void OptCmd::updateBackEndFromUi(DtVirtArray<PropUiItem *> *list)
1272 {
1273   int len, i;
1274
1275   if(list != NULL)
1276     {
1277       len = list->length();
1278       
1279       for(i = 0; i < len; i++)
1280         (*list)[i]->writeFromUiToSource();
1281     }
1282   else
1283     fprintf(stderr,"NULL list passed to updateBackEndFromUi\n");
1284   
1285 }
1286
1287
1288 //////////////////////////////////////////////////////////////////////////////
1289 void OptCmd::unmanage()
1290 {
1291
1292   XtPopdown(_opt_dlog->dialog);
1293
1294 }
1295
1296 //////////////////////////////////////////////////////////////////////////////
1297 void
1298 OptCmd::execute()
1299 {
1300     _opt_dlog = (DtbOptionsDialogInfo)theRoamApp.optionsDialog();       
1301     if (_opt_dlog == NULL) {
1302         this->create_dlog();
1303         generalDialog = new DtMailGenDialog("Dialog", _opt_dlog->dialog);
1304         this->doit();
1305     }
1306     else {
1307         XtPopdown(_opt_dlog->dialog);
1308         XtPopup(_opt_dlog->dialog, XtGrabNone);
1309         XtManageChild(_opt_dlog->dialog_shellform);
1310     }
1311 }
1312
1313 //////////////////////////////////////////////////////////////////////////////
1314 void OptCmd::setNewCategoryStr()
1315 {
1316         XtVaGetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, &catstr, NULL);
1317 }
1318
1319 //////////////////////////////////////////////////////////////////////////////
1320 void OptCmd::setOldCategoryStr()
1321 {
1322         XtVaSetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, catstr, NULL);
1323 }
1324
1325 //////////////////////////////////////////////////////////////////////////////
1326 void OptCmd::displayAliasesOptionsPane()
1327 {
1328     execute();
1329     options_set_category_pane(_opt_dlog->aliases_pane);
1330     XtVaSetValues(
1331                 _opt_dlog->category_opmenu,
1332                 XmNmenuHistory, _opt_dlog->category_opmenu_items.Aliases_item,
1333                 NULL);
1334 }
1335
1336 //////////////////////////////////////////////////////////////////////////////
1337 void OptCmd::displayPrintingOptionsPane()
1338 {
1339     execute();
1340     options_set_category_pane(_opt_dlog->printing_pane);
1341     XtVaSetValues(
1342                 _opt_dlog->category_opmenu,
1343                 XmNmenuHistory, _opt_dlog->category_opmenu_items.Printing_item,
1344                 NULL);
1345 }
1346
1347 //////////////////////////////////////////////////////////////////////////////
1348 void OptCmd::displayMailRetrievalOptionsPane()
1349 {
1350     execute();
1351     options_set_category_pane(_opt_dlog->mailretrieval_pane);
1352     XtVaSetValues(
1353         _opt_dlog->category_opmenu,
1354         XmNmenuHistory,_opt_dlog->category_opmenu_items.MailRetrieval_item,
1355         NULL);
1356 }