-fpermissive to allow GCC to compile old C++
[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 librararies 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 }
151
152 void
153 OptCmd::help_button_CB(Widget current_pane)
154 {
155     if (current_pane == _opt_dlog->msg_header_pane)
156         DisplayMain(current_pane, "Mailer", "MessageHeaderListOptions");
157     else if (current_pane == _opt_dlog->msg_view_pane)
158         DisplayMain(current_pane, "Mailer", "MessageViewOptions");
159     else if (current_pane == _opt_dlog->compose_win_pane)
160         DisplayMain(current_pane, "Mailer", "ComposeWindowOptions");
161     else if (current_pane == _opt_dlog->msg_filing_pane)
162         DisplayMain(current_pane, "Mailer", "MessageFilingOptions");
163     else if (current_pane == _opt_dlog->vacation_pane)
164         DisplayMain(current_pane, "Mailer", "VacationMailOptions");
165     else if (current_pane == _opt_dlog->templates_pane)
166         DisplayMain(current_pane, "Mailer", "MailTemplateOptions");
167     else if (current_pane == _opt_dlog->aliases_pane)
168         DisplayMain(current_pane, "Mailer", "MailAliasOptions");
169     else if (current_pane == _opt_dlog->advanced_pane)
170         DisplayMain(current_pane, "Mailer", "AdvancedMailOptions");
171     else if (current_pane == _opt_dlog->printing_pane)
172         DisplayMain(current_pane, "Mailer", "PrintingMailOptions");
173     else if (current_pane == _opt_dlog->printing_pane)
174         DisplayMain(current_pane, "Mailer", "MailRetrievalOptions");
175 }
176
177 void
178 opt_help_button_CB(Widget wid, XtPointer clientData, XtPointer calldata)
179 {
180     OptCmd *cmd_ptr = (OptCmd*)clientData;
181
182     // Suppress warnings
183     wid = wid;
184     calldata = calldata;
185
186     cmd_ptr->help_button_CB(cmd_ptr->currentPane());
187 }
188
189 void OptCmd::create_dlog()
190 {
191     theRoamApp.busyAllWindows(
192                    GETMSG(DT_catd, 3, 78, "Initializing Mail Options..."));
193
194     // make a new widget structure
195     _opt_dlog = (DtbOptionsDialogInfo)malloc(sizeof(
196                                DtbOptionsDialogInfoRec));
197         
198     // make sure it's all cleaned up
199     dtbOptionsDialogInfo_clear(_opt_dlog);
200
201     /*
202      * Open the standard message catalog for the project.
203      */
204     Dtb_project_catd = catopen(DTB_PROJECT_CATALOG, NL_CAT_LOCALE);
205
206 #ifdef NEVER
207     // Not a fatal error
208     if (Dtb_project_catd == (nl_catd)-1)
209       {
210         fprintf(stderr, "Could not open message catalog: %s\n",
211                 DTB_PROJECT_CATALOG);
212         exit(1);
213       }
214 #endif
215
216     // make us some a dem widgets!  :-)
217     dtb_options_dialog_initialize(_opt_dlog,
218                                   _dialogParentWidget);
219     //
220     // The Printing Options pane is handled outside the
221     // Builder generated code.
222     //
223     _PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
224     _opt_dlog->printing_pane = _PrintingOptions->baseWidget();
225
226     //
227     // The Mail Server Options pane is handled outside the
228     // Builder generated code.
229     //
230     _MailRetrievalOptions = new MailRetrievalOptions(_opt_dlog->layer);
231     _opt_dlog->mailretrieval_pane = _MailRetrievalOptions->baseWidget();
232
233
234     // We need to do this for the help system
235     dtb_save_toplevel_widget(_dialogParentWidget); 
236
237     XtSetMappedWhenManaged(_opt_dlog->dialog, False);
238     XtManageChild(_opt_dlog->dialog_shellform);
239
240     // hook them up to the back end!
241     this->init_panes();
242
243     // Attach the object to the mail options panes so they can later be referred
244     // to in options_set_category_pane().
245     XtVaSetValues(_opt_dlog->msg_header_pane, XmNuserData, this, NULL);
246     XtVaSetValues(_opt_dlog->msg_view_pane, XmNuserData, this, NULL);
247     XtVaSetValues(_opt_dlog->compose_win_pane, XmNuserData, this, NULL);
248     XtVaSetValues(_opt_dlog->msg_filing_pane, XmNuserData, this, NULL);
249     XtVaSetValues(_opt_dlog->vacation_pane, XmNuserData, this, NULL);
250     XtVaSetValues(_opt_dlog->templates_pane, XmNuserData, this, NULL);
251     XtVaSetValues(_opt_dlog->aliases_pane, XmNuserData, this, NULL);
252     XtVaSetValues(_opt_dlog->advanced_pane, XmNuserData, this, NULL);
253     XtVaSetValues(_opt_dlog->printing_pane, XmNuserData, this, NULL);
254     XtVaSetValues(_opt_dlog->mailretrieval_pane, XmNuserData, this, NULL);
255
256     // initialize the "current" pane
257     options_set_category_pane(_opt_dlog->msg_header_pane);
258
259     XtAddCallback(_opt_dlog->subject_tf,
260                   XmNvalueChangedCallback,
261                   vaca_msg_changedCB,
262                   (XtPointer)this);
263     
264     XtAddCallback(_opt_dlog->vacation_msg_tp,
265                   XmNvalueChangedCallback,
266                   vaca_msg_changedCB,
267                   (XtPointer)this);
268
269      XtAddCallback(_opt_dlog->help_button, XmNactivateCallback, 
270                 opt_help_button_CB,     (XtPointer)this);
271      XtAddCallback(_opt_dlog->ctrl_panel, XmNhelpCallback, 
272                 opt_help_button_CB,     (XtPointer)this);
273      XtAddCallback(_opt_dlog->msg_header_pane, XmNhelpCallback, 
274                 opt_help_button_CB,     (XtPointer)this);
275      XtAddCallback(_opt_dlog->msg_view_pane, XmNhelpCallback, 
276                 opt_help_button_CB,     (XtPointer)this);
277      XtAddCallback(_opt_dlog->compose_win_pane, XmNhelpCallback, 
278                 opt_help_button_CB,     (XtPointer)this);
279      XtAddCallback(_opt_dlog->msg_filing_pane, XmNhelpCallback, 
280                 opt_help_button_CB,     (XtPointer)this);
281      XtAddCallback(_opt_dlog->vacation_pane, XmNhelpCallback, 
282                 opt_help_button_CB,     (XtPointer)this);
283      XtAddCallback(_opt_dlog->templates_pane, XmNhelpCallback, 
284                 opt_help_button_CB,     (XtPointer)this);
285      XtAddCallback(_opt_dlog->aliases_pane, XmNhelpCallback, 
286                 opt_help_button_CB,     (XtPointer)this);
287      XtAddCallback(_opt_dlog->advanced_pane, XmNhelpCallback, 
288                 opt_help_button_CB,     (XtPointer)this);
289      XtAddCallback(_opt_dlog->dialog_button_panel, XmNhelpCallback, 
290                 opt_help_button_CB,     (XtPointer)this);
291      XtAddCallback(_opt_dlog->printing_pane, XmNhelpCallback, 
292                 opt_help_button_CB,     (XtPointer)this);
293      XtAddCallback(_opt_dlog->mailretrieval_pane, XmNhelpCallback, 
294                 opt_help_button_CB,     (XtPointer)this);
295
296      theRoamApp.unbusyAllWindows();
297      theRoamApp.setOptionsDialog((char*)_opt_dlog);
298      props_changed = FALSE;
299 }
300
301 //////////////////////////////////////////////////////////////////////////////
302 void vaca_msg_changedCB(Widget w, XtPointer ClientData, XtPointer calldata)
303 {
304   OptCmd *cmd_ptr = (OptCmd*)ClientData;
305   
306   w = w;
307   calldata = calldata;
308
309   cmd_ptr->set_vaca_msg_Changed();
310
311 }
312
313 //////////////////////////////////////////////////////////////////////////////
314
315 //////////////////////////////////////////////////////////////////////////////
316 void
317 options_set_category_pane(
318     Widget      pane
319 )
320 {
321   char buf[1024];
322   OptCmd *cmd_ptr;
323   Widget current_pane;
324   int answer;
325
326   XtVaGetValues(pane,
327         XmNuserData, &cmd_ptr,
328         NULL);
329
330   current_pane = cmd_ptr->currentPane();
331   if (pane == current_pane)
332         return;
333
334   if (current_pane != NULL && props_changed) {
335         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."));
336  
337         cmd_ptr->genDialog()->setToQuestionDialog(
338                         GETMSG(DT_catd, 5, 2, "Mailer"),
339                         buf);
340  
341         answer = cmd_ptr->genDialog()->post_and_return(
342                         GETMSG(DT_catd, 15, 2, "Save"),
343                         GETMSG(DT_catd, 1, 182, "Cancel"),
344                         GETMSG(DT_catd, 15, 3, "Discard"),
345                         DTMAILHELPERROR);
346  
347         if (answer == 1) { //Save
348                 if (! cmd_ptr->optionsAreValid()) return;
349                 cmd_ptr->update_source();
350                 cmd_ptr->doVacationCheck();
351         }
352         else if (answer == 3) { // Discard
353                 cmd_ptr->update_panes();
354         }
355         else if (answer == 2) { // Cancel
356                 //props_changed = FALSE;
357                 cmd_ptr->setOldCategoryStr();
358                 return;
359         }
360   }
361   props_changed = FALSE;
362   XtManageChild(pane);
363  
364   if (current_pane != NULL)
365     XtUnmanageChild(current_pane);
366  
367   cmd_ptr->setCurrentPane(pane);
368   cmd_ptr->setNewCategoryStr();
369 }
370
371 //////////////////////////////////////////////////////////////////////////////
372 OptCmd::~OptCmd()
373 {
374 //  free(_opt_dlog);
375
376   _opt_dlog = NULL;
377
378 }
379 //////////////////////////////////////////////////////////////////////////////
380 // hookup the front and back ends of the mail options
381 void OptCmd::init_panes()
382 {
383
384   this->init_msg_hdr_pane();
385   this->init_msg_view_pane();
386   this->init_compose_pane();
387   this->init_msg_filing_pane();
388   this->init_vacation_pane();
389   this->init_template_pane();
390   this->init_aliases_pane();
391   this->init_advanced_pane();
392   this->init_printing_pane();
393   this->init_mailretrieval_pane();
394
395 }
396
397 //////////////////////////////////////////////////////////////////////////////
398 void OptCmd::update_panes()
399 {
400   VacationCmd *vacation_cmd = theRoamApp.vacation();
401   Boolean vaca_running = FALSE;
402
403   char *tmp_ptr;
404
405   Arg args[1];
406
407   if(vacation_cmd != NULL)
408     vaca_running = vacation_cmd->priorVacationRunning();
409
410   this->updateUiFromBackEnd(mh_pane_list);    
411   this->updateUiFromBackEnd(msg_view_pane_list);    
412   this->updateUiFromBackEnd(compose_pane_list);    
413   this->updateUiFromBackEnd(msg_filing_pane_list);    
414   this->updateUiFromBackEnd(template_pane_list);
415   this->updateUiFromBackEnd(aliases_pane_list);
416   this->updateUiFromBackEnd(advanced_pane_list);
417   this->updateUiFromBackEnd(printing_pane_list);
418   this->updateUiFromBackEnd(mailretrieval_pane_list);
419
420   // make sure Vacation pane is correct
421   XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
422                 XmNset, vaca_running,
423                 NULL);
424
425   XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
426                 XmNset, !vaca_running,
427                 NULL);
428
429   // set Subject and Message
430   if(vacation_cmd != NULL)
431     {
432       tmp_ptr = vacation_cmd->subject();
433
434   // if the vaction subject is a null string ( for the case there is no
435   // .vacation.msg file but the user already typed his own subject but
436   // would like to reset. We need reset the subject back to the message
437   // "Dtb_project_catd, 2, 68,"
438   
439       XtSetArg(args[0], XmNvalue, GETMSG(Dtb_project_catd, 2, 68, "Out of the office"));
440
441       if(tmp_ptr != NULL)
442         XtVaSetValues(_opt_dlog->subject_tf,
443                       XmNvalue, tmp_ptr,
444                       NULL);
445   // set back to the default value
446       else
447         XtSetValues(_opt_dlog->subject_tf,args,1);
448         
449
450       tmp_ptr = vacation_cmd->body();
451
452 // Do same thing for the body part
453
454       if(tmp_ptr != NULL)
455         XtVaSetValues(_opt_dlog->vacation_msg_tp,
456                       XmNvalue, tmp_ptr,
457                       NULL);
458       else   //set a space to the body
459         XtVaSetValues(_opt_dlog->vacation_msg_tp,
460                       XmNvalue, " ",
461                       NULL);
462
463     }
464
465   _reopen_mailboxes = FALSE;
466   vacation_status_changed = FALSE;
467   vacation_msg_changed = FALSE;
468   props_changed = FALSE;
469   
470 }
471
472 //////////////////////////////////////////////////////////////////////////////
473 void OptCmd::update_source()
474 {
475
476   DtMailEnv error;
477   DtMail::Session * d_session = theRoamApp.session()->session();
478   DtMail::MailRc * mail_rc = d_session->mailRc(error);
479
480   this->updateBackEndFromUi(mh_pane_list);    
481   this->updateBackEndFromUi(msg_view_pane_list);    
482   this->updateBackEndFromUi(compose_pane_list);    
483   this->updateBackEndFromUi(msg_filing_pane_list);    
484   this->updateBackEndFromUi(template_pane_list);
485   this->updateBackEndFromUi(aliases_pane_list);
486   this->updateBackEndFromUi(advanced_pane_list);
487   this->updateBackEndFromUi(printing_pane_list);
488   this->updateBackEndFromUi(mailretrieval_pane_list);
489
490   if (mail_rc->getParseError() != DTME_NoError)
491   {
492     char* helpId;
493     int answer = 0;
494
495     genDialog()->setToErrorDialog(GETMSG(DT_catd, 2, 1, "Mailer"),
496       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."));
497     helpId = DTMAILHELPERROR;
498     genDialog()->post_and_return(GETMSG(DT_catd, 3, 5, "OK"), helpId);
499     return;
500   }
501   else mail_rc->update(error);
502
503   if (_reopen_mailboxes)
504   {
505       theRoamApp.reopenRoamMenuWindows();
506       _reopen_mailboxes = FALSE;
507   }
508   theRoamApp.globalPropChange();
509   props_changed = FALSE;
510 }
511
512 //////////////////////////////////////////////////////////////////////////////
513 // Handle the file locking stuff.
514
515 int OptCmd::doFileLockingCheck()
516 {
517     int answer = 0;
518
519     DtMailEnv        error;
520     DtMail::Session *m_session = theRoamApp.session()->session();
521     const char      *value = NULL;
522     Boolean          use_file_locking;
523     unsigned char    is_set;
524
525     m_session->mailRc(error)->getValue(error, "cdetooltalklock", &value);
526     use_file_locking = error.isNotSet();
527     if (NULL != value) free((void*) value);
528
529     if (XtIsManaged(_opt_dlog->advanced_pane))
530     {
531         XtVaGetValues(
532           _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
533           XmNset, &is_set,
534           NULL);
535
536         if (is_set != use_file_locking)
537         {
538             char            *message = GETMSG(DT_catd, 2, 26,
539 "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.");
540             genDialog()->setToQuestionDialog(
541                                 GETMSG(DT_catd, 2, 1, "Mailer"),
542                                 message);
543             answer =
544               genDialog()->post_and_return(
545                                 GETMSG(DT_catd, 2, 27, "Reopen"),
546                                 GETMSG(DT_catd, 2, 29, "Cancel"),
547                                 GETMSG(DT_catd, 2, 28, "Continue"),
548                                 "AdvancedMailOptions");
549
550             //
551             // 1 == Reopen
552             // 2 == Cancel
553             // 3 == Continue
554             //
555             if (1 == answer)
556               _reopen_mailboxes = TRUE;
557             else
558               _reopen_mailboxes = FALSE;
559
560             if (2 != answer)
561               theRoamApp.closeInactiveRoamMenuWindows();
562         }
563     }
564     return (2!=answer);
565 }
566
567
568 //////////////////////////////////////////////////////////////////////////////
569 // Handle the vacation stuff.
570
571 void OptCmd::doVacationCheck()
572 {
573   Boolean is_set;
574
575   VacationCmd *vacation_cmd = theRoamApp.vacation();
576   DtMailGenDialog *dialog = genDialog();
577
578   vacation_cmd->setGenDialog(dialog);
579   if(vacation_status_changed)
580   {   // there was a change in status
581       if (XtIsManaged(_opt_dlog->vacation_pane))
582       {
583          XtVaGetValues(_opt_dlog->vacation_rb_items.On_item,
584                           XmNset, &is_set,
585                           NULL);
586          if(is_set)
587          {
588             Boolean status = this->startVacation();
589
590             // startVacation also updates the mgs strings if changed
591             vacation_msg_changed = FALSE;
592             vacation_status_changed = status; // reset flag
593          }
594          else 
595          {
596             this->stopVacation();
597             vacation_status_changed = FALSE; // reset flag
598          }
599        }
600   }
601
602   if (vacation_msg_changed)
603   {
604     if (vacation_cmd)
605     {
606         char *subj, *body;
607         XtVaGetValues(_opt_dlog->subject_tf, XmNvalue, &subj, NULL);
608         XtVaGetValues(_opt_dlog->vacation_msg_tp, XmNvalue, &body, NULL);
609
610         vacation_cmd->handleMessageFile(subj, body);
611     }
612     vacation_msg_changed = FALSE;
613   }
614 }
615
616 void OptCmd::setVacationChanged()
617 {
618   vacation_status_changed = TRUE;
619   props_changed = TRUE;
620 }
621
622 void OptCmd::set_vaca_msg_Changed()
623 {
624   vacation_msg_changed = TRUE;
625   props_changed = TRUE;
626 }
627 Boolean
628 OptCmd::startVacation()
629 {
630   Boolean status = theRoamApp.startVacation(
631                            _opt_dlog->subject_tf, 
632                            _opt_dlog->vacation_msg_tp);
633   return status;
634 }
635
636
637 void
638 OptCmd::stopVacation()
639 {
640   theRoamApp.stopVacation();
641 }
642
643 //////////////////////////////////////////////////////////////////////////////
644 // Check the printing options to make sure they are valid
645
646 Boolean OptCmd::optionsAreValid()
647 {
648     char        *errMsg = NULL;
649     PropUiItem  *propui_ptr = NULL;
650     int         answer;
651
652     for (propui_ptr = _PrintingOptions->getFirstProp();
653          propui_ptr != (PropUiItem *) NULL;
654          propui_ptr = _PrintingOptions->getNextProp())
655     {
656         errMsg = propui_ptr->uiValueIsValid();
657         if (errMsg != NULL)
658         {
659             this->genDialog()->setToQuestionDialog(
660                         GETMSG(DT_catd, 5, 2, "Mailer"),
661                         errMsg);
662  
663             answer = this->genDialog()->post_and_return(
664                         GETMSG(DT_catd, 26, 5, "Continue"),
665                         DTMAILHELPERROR);
666  
667             XtFree(errMsg);
668             return FALSE;
669         }
670     }
671
672     for (propui_ptr = _MailRetrievalOptions->getFirstProp();
673          propui_ptr != (PropUiItem *) NULL;
674          propui_ptr = _MailRetrievalOptions->getNextProp())
675     {
676         errMsg = propui_ptr->uiValueIsValid();
677         if (errMsg != NULL)
678         {
679             this->genDialog()->setToQuestionDialog(
680                         GETMSG(DT_catd, 5, 2, "Mailer"),
681                         errMsg);
682  
683             answer = this->genDialog()->post_and_return(
684                         GETMSG(DT_catd, 26, 5, "Continue"),
685                         DTMAILHELPERROR);
686  
687             XtFree(errMsg);
688             return FALSE;
689         }
690     }
691     return TRUE;
692 }
693
694 //////////////////////////////////////////////////////////////////////////////
695 void register_pane_size(Widget pane)
696 {
697     Dimension   width, height;
698
699     XtManageChild(pane);
700     XtVaGetValues(pane,
701                 XmNwidth, &width, XmNheight, &height,
702                 NULL);
703
704     if (width > max_width)
705         max_width = width;
706
707     if (height > max_height)
708         max_height = height;
709
710     XtUnmanageChild(pane);
711 }
712
713 //////////////////////////////////////////////////////////////////////////////
714 // init the message header list pane
715 void OptCmd::init_msg_hdr_pane()
716 {
717
718   PropUiItem *propui_ptr = NULL;
719
720   // register overall size of pane
721   register_pane_size(_opt_dlog->msg_header_pane);
722
723   // test for the message header list pane
724   
725   // make the list...
726   mh_pane_list = new DtVirtArray<PropUiItem *>(3);
727
728   // make the check for new mail SB
729   propui_ptr = (PropUiItem *)new CheckForMailUiItem(_opt_dlog->mail_check_sb,
730                                                     _FROM_MAILRC,
731                                                     "retrieveinterval");
732   propui_ptr->writeFromSourceToUi();
733   mh_pane_list->append(propui_ptr);
734
735   // make the signal with beep SB
736   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->signal_sb,
737                                                _FROM_MAILRC,
738                                                "bell");
739   propui_ptr->writeFromSourceToUi();
740   mh_pane_list->append(propui_ptr);
741
742   // make the sig with flashes SB
743   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->spinbox2,
744                                                _FROM_MAILRC,
745                                                "flash");
746   propui_ptr->writeFromSourceToUi();
747   mh_pane_list->append(propui_ptr);
748
749   // make the disp headers SB
750   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_sb,
751                                                _FROM_MAILRC,
752                                                "headerlines");
753   propui_ptr->writeFromSourceToUi();
754   mh_pane_list->append(propui_ptr);
755
756   // make the sho "To: Recipient"
757   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
758          _opt_dlog->checkbox_items.Show_To_recipient_when_mail_is_from_me_item,
759                                                 _FROM_MAILRC,
760                                                 "showto");
761   propui_ptr->writeFromSourceToUi();
762   mh_pane_list->append(propui_ptr);
763
764   // make the sho "Display message numbers"
765   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
766          _opt_dlog->checkbox_items.Display_message_numbers_item,
767                                                 _FROM_MAILRC,
768                                                 "showmsgnum");
769   propui_ptr->writeFromSourceToUi();
770   mh_pane_list->append(propui_ptr);
771
772   // make the sho "destroy on close"
773   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
774          _opt_dlog->deleted_msg_cb_items.When_I_close_the_mailbox_item,
775                                                 _FROM_MAILRC,
776                                                 "keepdeleted");
777   propui_ptr->writeFromSourceToUi();
778   mh_pane_list->append(propui_ptr);
779
780   // make the sho "show confirm notice"
781   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
782          _opt_dlog->deleted_msg_cb_items.Show_confirmation_notice_item,
783                                                 _FROM_MAILRC,
784                                                 "quietdelete");
785   propui_ptr->writeFromSourceToUi();
786   mh_pane_list->append(propui_ptr);
787   
788 }
789
790 //////////////////////////////////////////////////////////////////////////////
791 void OptCmd::init_msg_view_pane()
792 {
793   DtMailEnv error;
794   DtMail::Session * d_session = theRoamApp.session()->session();
795   DtMail::MailRc * mail_rc = d_session->mailRc(error);
796   PropUiItem *propui_ptr = NULL;
797   ListUiItem *list_ptr = NULL;
798
799   // register overall size of pane 
800   register_pane_size(_opt_dlog->msg_view_pane); 
801   
802   // make the list...
803   msg_view_pane_list = new DtVirtArray<PropUiItem *>(2);
804
805   //---
806   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_row_sb,
807                                                _FROM_MAILRC,
808                                                "popuplines");
809   propui_ptr->writeFromSourceToUi();
810   msg_view_pane_list->append(propui_ptr);
811
812   //---
813   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->characters_wide_sb,
814                                                _FROM_MAILRC,
815                                                "toolcols");
816   propui_ptr->writeFromSourceToUi();
817   msg_view_pane_list->append(propui_ptr);
818
819   list_ptr = (ListUiItem *)new IgnoreListUiItem(_opt_dlog->hidden_fields_list,
820                                             _FROM_MAILRC,
821                                             "ignore",
822                                             _opt_dlog->fields_hide);
823   
824   add_cbs_to_list(list_ptr,
825                   _opt_dlog->h_field_add,
826                   _opt_dlog->h_field_delete,
827                   _opt_dlog->h_field_change);
828     
829   list_ptr->writeFromSourceToUi();
830   list_ptr->AddDefaults();
831   msg_view_pane_list->append(list_ptr);
832
833 }
834
835 //////////////////////////////////////////////////////////////////////////////
836 void OptCmd::init_compose_pane()
837 {
838   PropUiItem *propui_ptr = NULL;
839   DtMailEnv error;
840   DtMail::Session * d_session = theRoamApp.session()->session();
841   DtMail::MailRc * mail_rc = d_session->mailRc(error);
842
843   DtVirtArray<char *> fields_list(10);
844   ListUiItem *list_ptr = NULL;
845
846   // register overall size of pane 
847   register_pane_size(_opt_dlog->compose_win_pane); 
848
849   // make the list...
850   compose_pane_list = new DtVirtArray<PropUiItem *>(1);
851
852   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->indent_str_tf,
853                                                _FROM_MAILRC,
854                                                "indentprefix");
855   propui_ptr->writeFromSourceToUi();
856   compose_pane_list->append(propui_ptr);
857
858   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
859         _opt_dlog->wrap_checkbox_items.Show_Attachment_List_item,
860                                                _FROM_MAILRC,
861                                                "hideattachments");
862   propui_ptr->writeFromSourceToUi();
863   compose_pane_list->append(propui_ptr);
864
865   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
866         _opt_dlog->cfrm_att_checkbox_items.Confirm_Attachment_item,
867                                                _FROM_MAILRC,
868                                                "confirmattachments");
869   propui_ptr->writeFromSourceToUi();
870   compose_pane_list->append(propui_ptr);
871
872   //--
873   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->cfrm_att_size_sb,
874                                                _FROM_MAILRC,
875                                                "confirmattachmentthreshold");
876   propui_ptr->writeFromSourceToUi();
877   compose_pane_list->append(propui_ptr);
878
879   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->deadletter_field,
880                                                _FROM_MAILRC,
881                                                "deaddir");
882   propui_ptr->writeFromSourceToUi();
883   compose_pane_list->append(propui_ptr);
884
885   list_ptr = (ListUiItem *)new CustomListUiItem(_opt_dlog->list,
886                                                   _FROM_MAILRC,
887                                                   "",
888                                                   _opt_dlog->hdr_field,
889                                                   _opt_dlog->def_value_field);
890   add_cbs_to_list(list_ptr,
891                   _opt_dlog->add_button,
892                   _opt_dlog->del_button,
893                   _opt_dlog->change_button);
894   
895   list_ptr->writeFromSourceToUi();
896   compose_pane_list->append(list_ptr);
897
898 }
899
900 //////////////////////////////////////////////////////////////////////////////
901 void OptCmd::init_msg_filing_pane()
902 {
903   DtMailEnv error;
904   DtMail::Session * d_session = theRoamApp.session()->session();
905   DtMail::MailRc * mail_rc = d_session->mailRc(error);
906   const char *list_str = NULL;
907   DtVirtArray<char *> move_menu_list(10);
908   PropUiItem *propui_ptr = NULL;
909
910   // register overall size of pane 
911   register_pane_size(_opt_dlog->msg_filing_pane); 
912
913   ListUiItem *list_ptr = NULL;
914
915   // make the list...
916   msg_filing_pane_list = new DtVirtArray<PropUiItem *>(5);
917
918   //--
919   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->srt_looking_tf,
920                                                  _FROM_MAILRC,
921                                                  "folder");
922   propui_ptr->writeFromSourceToUi();
923   msg_filing_pane_list->append(propui_ptr);
924
925   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
926         _opt_dlog->dpy_up_mbox_cb_items.Display_up_to_item,
927                                                _FROM_MAILRC,
928                                                "dontdisplaycachedfiles");
929   propui_ptr->writeFromSourceToUi();
930   msg_filing_pane_list->append(propui_ptr);
931
932   //--
933   propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->recent_sb,
934                                                _FROM_MAILRC,
935                                                "cachedfilemenusize");
936   propui_ptr->writeFromSourceToUi();
937   msg_filing_pane_list->append(propui_ptr);
938
939   //--
940   propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->sent_mail_tf,
941                                                  _FROM_MAILRC,
942                                                  "record");
943   propui_ptr->writeFromSourceToUi();
944   msg_filing_pane_list->append(propui_ptr);
945
946
947    propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
948          _opt_dlog->log_cb_items.Log_all_sent_messages_item,
949                                                 _FROM_MAILRC,
950                                                 "dontlogmessages");
951
952 //    propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
953 //       _opt_dlog->log_cb_items.Log_all_sent_messages_item,
954 //                                              _FROM_MAILRC,
955 //                                              "nodontlogmessages");
956   propui_ptr->writeFromSourceToUi();
957   msg_filing_pane_list->append(propui_ptr);
958
959   list_ptr = (ListUiItem *)new MoveMenuListUiItem(_opt_dlog->mv_menu_lst,
960                                                   _FROM_MAILRC,
961                                                   "",
962                                                   _opt_dlog->path_file_name_tf);
963
964   add_cbs_to_list(list_ptr,
965                   _opt_dlog->mm_add_butt,
966                   _opt_dlog->mm_delete_butt,
967                   _opt_dlog->mm_change_butt);
968     
969   list_ptr->writeFromSourceToUi();
970   msg_filing_pane_list->append(list_ptr);
971
972 }
973
974 //////////////////////////////////////////////////////////////////////////////
975 void OptCmd::init_vacation_pane()
976 {
977   // register overall size of pane 
978   register_pane_size(_opt_dlog->vacation_pane); 
979 }
980
981 //////////////////////////////////////////////////////////////////////////////
982 void OptCmd::init_template_pane()
983 {
984   DtMailEnv error;
985   ListUiItem *list_ptr = NULL;
986
987   // register overall size of pane 
988   register_pane_size(_opt_dlog->templates_pane); 
989
990   // make the list...
991   template_pane_list = new DtVirtArray<PropUiItem *>(3);
992
993   list_ptr = (ListUiItem *)new TemplateListUiItem(_opt_dlog->templates_list,
994                                                   _FROM_MAILRC,
995                                                   "templates",
996                                                   _opt_dlog->menu_label,
997                                                   _opt_dlog->path_filename_label);
998
999     add_cbs_to_list(list_ptr,
1000                   _opt_dlog->tem_add_but,
1001                   _opt_dlog->tem_del_but,
1002                   _opt_dlog->tem_change_but);
1003
1004   list_ptr->writeFromSourceToUi();
1005   template_pane_list->append(list_ptr);
1006
1007 }
1008
1009 //////////////////////////////////////////////////////////////////////////////
1010 void OptCmd::init_aliases_pane()
1011 {
1012   DtMailEnv error;
1013   ListUiItem *list_ptr = NULL;
1014
1015   // register overall size of pane 
1016   register_pane_size(_opt_dlog->aliases_pane); 
1017
1018   // make the list...
1019    aliases_pane_list = new DtVirtArray<PropUiItem *>(3);
1020
1021   list_ptr = (ListUiItem *)new AliasListUiItem(_opt_dlog->alias_list,
1022                                                _FROM_MAILRC,
1023                                                "alias",
1024                                                _opt_dlog->alias_tf,
1025                                                _opt_dlog->addresses_tf);
1026
1027   add_cbs_to_list(list_ptr,
1028                   _opt_dlog->alias_add_but,
1029                   _opt_dlog->alias_delete_but,
1030                   _opt_dlog->al_change_but);
1031
1032   list_ptr->writeFromSourceToUi();
1033   aliases_pane_list->append(list_ptr);
1034
1035 }
1036
1037 //////////////////////////////////////////////////////////////////////////////
1038 void OptCmd::init_advanced_pane()
1039 {
1040   DtMailEnv error;
1041   DtVirtArray<char *> alternates_list(8);
1042   PropUiItem *propui_ptr = NULL;
1043   uid_t euid;
1044   struct passwd *user_passwd = NULL;
1045   char *label_str = NULL;
1046   XmString label_xm_str;
1047
1048   // register overall size of pane 
1049   register_pane_size(_opt_dlog->advanced_pane); 
1050
1051   ListUiItem *list_ptr = NULL;
1052
1053   label_str = (char *)malloc(256);
1054
1055   // set the list to be a mono spaced font...
1056
1057
1058   // make the list...
1059   advanced_pane_list = new DtVirtArray<PropUiItem *>(6);
1060
1061   propui_ptr = (PropUiItem *)new ScaleUiItem(
1062                 _opt_dlog->update_mbox_scale,
1063                                                 _FROM_MAILRC,
1064                                                 "saveinterval");
1065   propui_ptr->writeFromSourceToUi();
1066   advanced_pane_list->append(propui_ptr);
1067
1068   propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
1069               _opt_dlog->adv_def_cb_items.Show_confirmation_notices_item,
1070                                                 _FROM_MAILRC,   
1071                                                 "expert");
1072   propui_ptr->writeFromSourceToUi();
1073   advanced_pane_list->append(propui_ptr);
1074
1075   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1076       _opt_dlog->adv_def_cb_items.Use_strict_MIME_character_encoding_item,
1077                                                 _FROM_MAILRC,   
1078                                                 "strictmime");
1079   propui_ptr->writeFromSourceToUi();
1080   advanced_pane_list->append(propui_ptr);
1081
1082   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1083       _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
1084                                                 _FROM_MAILRC,   
1085                                                 "cdetooltalklock");
1086   propui_ptr->writeFromSourceToUi();
1087   advanced_pane_list->append(propui_ptr);
1088
1089   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1090       _opt_dlog->adv_def_cb_items.Ignore_host_name_in_address_allnet_item,
1091                                                 _FROM_MAILRC,   
1092                                                 "allnet");
1093   propui_ptr->writeFromSourceToUi();
1094   advanced_pane_list->append(propui_ptr);
1095
1096   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1097       _opt_dlog->adv_def_cb_items.Include_me_when_I_Reply_to_all_metoo_item,
1098                                                 _FROM_MAILRC,   
1099                                                 "metoo");
1100   propui_ptr->writeFromSourceToUi();
1101   advanced_pane_list->append(propui_ptr);
1102
1103   propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1104               _opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1105                                                 _FROM_MAILRC,   
1106                                                 "usealternates");
1107   propui_ptr->writeFromSourceToUi();
1108   advanced_pane_list->append(propui_ptr);
1109
1110   // set uid in string...
1111   euid = geteuid();  // get uid of user
1112
1113   user_passwd = getpwuid(euid); // get passwd entry for user 
1114
1115   sprintf(label_str, "%s \"%s\" =",
1116           GETMSG( DT_catd, 20, 2, "Use local name: "), user_passwd->pw_name);
1117
1118   label_xm_str = XmStringCreateLocalized(label_str);
1119
1120   XtVaSetValues(_opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1121                 XmNlabelString, label_xm_str,
1122                 NULL);
1123
1124
1125   list_ptr = (ListUiItem *)new AlternatesListUiItem(_opt_dlog->local_name_list,
1126                                                     _FROM_MAILRC,
1127                                                     "alternates",
1128                                                     _opt_dlog->local_name_tf);
1129   
1130   add_cbs_to_list(list_ptr,
1131                   _opt_dlog->local_name_add_but,
1132                   _opt_dlog->local_name_del_but,
1133                   _opt_dlog->local_name_chg_but);
1134     
1135
1136   list_ptr->writeFromSourceToUi();
1137   advanced_pane_list->append(list_ptr);
1138
1139 }
1140
1141
1142 //////////////////////////////////////////////////////////////////////////////
1143 void OptCmd::init_printing_pane()
1144 {
1145   DtMailEnv     error;
1146   PropUiItem    *propui_ptr = NULL;
1147   int           npropui;
1148
1149   //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1150   //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1151
1152   // register overall size of pane 
1153   register_pane_size(_opt_dlog->printing_pane); 
1154
1155   // make the list...
1156   npropui = _PrintingOptions->getNumProps();
1157   printing_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1158
1159   if (npropui)
1160   {
1161       for (propui_ptr = _PrintingOptions->getFirstProp();
1162            propui_ptr != (PropUiItem *) NULL;
1163            propui_ptr = _PrintingOptions->getNextProp())
1164       {
1165           propui_ptr->writeFromSourceToUi();
1166           printing_pane_list->append(propui_ptr);
1167       }
1168   }
1169 }
1170
1171
1172 //////////////////////////////////////////////////////////////////////////////
1173 void OptCmd::init_mailretrieval_pane()
1174 {
1175   DtMailEnv     error;
1176   PropUiItem    *propui_ptr = NULL;
1177   int           npropui;
1178
1179   //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1180   //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1181
1182   // register overall size of pane 
1183   register_pane_size(_opt_dlog->mailretrieval_pane); 
1184
1185   // make the list...
1186   npropui = _MailRetrievalOptions->getNumProps();
1187   mailretrieval_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1188
1189   if (npropui)
1190   {
1191       for (propui_ptr = _MailRetrievalOptions->getFirstProp();
1192            propui_ptr != (PropUiItem *) NULL;
1193            propui_ptr = _MailRetrievalOptions->getNextProp())
1194       {
1195           propui_ptr->writeFromSourceToUi();
1196           mailretrieval_pane_list->append(propui_ptr);
1197       }
1198   }
1199
1200   _MailRetrievalOptions->initOptionInteractions();
1201 }
1202
1203
1204 //////////////////////////////////////////////////////////////////////////////
1205 void OptCmd::doit()
1206 {
1207   // make sure all the sheets are uptodate
1208   this->update_panes();
1209
1210   XtVaSetValues(_opt_dlog->cancel_button,
1211                 XmNuserData, this,
1212                 NULL);
1213
1214   XtVaSetValues(_opt_dlog->ok_button,
1215                 XmNuserData, this,
1216                 NULL);
1217
1218   XtVaSetValues(_opt_dlog->apply_button,
1219                 XmNuserData, this,
1220                 NULL);
1221
1222   XtVaSetValues(_opt_dlog->reset_button,
1223                 XmNuserData, this,
1224                 NULL);
1225
1226   XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
1227                 XmNuserData, this,
1228                 NULL);
1229
1230   XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
1231                 XmNuserData, this,
1232                 NULL);
1233
1234   XtPopdown(_opt_dlog->dialog);
1235   XtPopup(_opt_dlog->dialog, XtGrabNone);
1236   XtManageChild(_opt_dlog->dialog_shellform);
1237   props_changed = FALSE;
1238 }       
1239 //////////////////////////////////////////////////////////////////
1240 void OptCmd::updateUiFromBackEnd(DtVirtArray<PropUiItem *> *list)
1241 {
1242   int len, i;
1243
1244   if(list != NULL)
1245     {
1246       len = list->length();
1247       
1248       for(i = 0; i < len; i++)
1249         (*list)[i]->writeFromSourceToUi();
1250     }
1251   else
1252     fprintf(stderr,"NULL list passed to updateUiFromBackEnd\n");
1253   
1254 }
1255 //////////////////////////////////////////////////////////////////
1256 void OptCmd::updateBackEndFromUi(DtVirtArray<PropUiItem *> *list)
1257 {
1258   int len, i;
1259
1260   if(list != NULL)
1261     {
1262       len = list->length();
1263       
1264       for(i = 0; i < len; i++)
1265         (*list)[i]->writeFromUiToSource();
1266     }
1267   else
1268     fprintf(stderr,"NULL list passed to updateBackEndFromUi\n");
1269   
1270 }
1271
1272
1273 //////////////////////////////////////////////////////////////////////////////
1274 void OptCmd::unmanage()
1275 {
1276
1277   XtPopdown(_opt_dlog->dialog);
1278
1279 }
1280
1281 //////////////////////////////////////////////////////////////////////////////
1282 void
1283 OptCmd::execute()
1284 {
1285     _opt_dlog = (DtbOptionsDialogInfo)theRoamApp.optionsDialog();       
1286     if (_opt_dlog == NULL) {
1287         this->create_dlog();
1288         generalDialog = new DtMailGenDialog("Dialog", _opt_dlog->dialog);
1289         this->doit();
1290     }
1291     else {
1292         XtPopdown(_opt_dlog->dialog);
1293         XtPopup(_opt_dlog->dialog, XtGrabNone);
1294         XtManageChild(_opt_dlog->dialog_shellform);
1295     }
1296 }
1297
1298 //////////////////////////////////////////////////////////////////////////////
1299 void OptCmd::setNewCategoryStr()
1300 {
1301         XtVaGetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, &catstr, NULL);
1302 }
1303
1304 //////////////////////////////////////////////////////////////////////////////
1305 void OptCmd::setOldCategoryStr()
1306 {
1307         XtVaSetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, catstr, NULL);
1308 }
1309
1310 //////////////////////////////////////////////////////////////////////////////
1311 void OptCmd::displayAliasesOptionsPane()
1312 {
1313     execute();
1314     options_set_category_pane(_opt_dlog->aliases_pane);
1315     XtVaSetValues(
1316                 _opt_dlog->category_opmenu,
1317                 XmNmenuHistory, _opt_dlog->category_opmenu_items.Aliases_item,
1318                 NULL);
1319 }
1320
1321 //////////////////////////////////////////////////////////////////////////////
1322 void OptCmd::displayPrintingOptionsPane()
1323 {
1324     execute();
1325     options_set_category_pane(_opt_dlog->printing_pane);
1326     XtVaSetValues(
1327                 _opt_dlog->category_opmenu,
1328                 XmNmenuHistory, _opt_dlog->category_opmenu_items.Printing_item,
1329                 NULL);
1330 }
1331
1332 //////////////////////////////////////////////////////////////////////////////
1333 void OptCmd::displayMailRetrievalOptionsPane()
1334 {
1335     execute();
1336     options_set_category_pane(_opt_dlog->mailretrieval_pane);
1337     XtVaSetValues(
1338         _opt_dlog->category_opmenu,
1339         XmNmenuHistory,_opt_dlog->category_opmenu_items.MailRetrieval_item,
1340         NULL);
1341 }