2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $TOG: OptCmd.C /main/20 1999/07/13 08:40:16 mgreess $ */
27 * RESTRICTED CONFIDENTIAL INFORMATION:
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
37 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
42 * Common Desktop Environment
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.
53 * RESTRICTED RIGHTS LEGEND
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).
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
69 ///////////////////////////////////////////////////////////////////////////////
70 //////////////////////////////////////////////////////////////////////////////
71 // This example code is from the book:
73 // Object-Oriented Programming with C++ and OSF/Motif
76 // Prentice Hall, 1992
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 //////////////////////////////////////////////////////////////////////////////
87 ///////////////////////////////////////////////////////////
88 // OptCmd.C : creates the mail options dialog
89 //////////////////////////////////////////////////////////
91 #include <sys/types.h>
96 #include <X11/IntrinsicP.h>
98 #include "Application.h"
99 #include "DmxPrintOptions.h"
100 #include "DtMailHelp.hh"
103 #include "MailRetrievalOptions.h"
104 #include "MainWindow.h"
106 #include "RoamCmds.h"
107 #include "dtmailopts.h"
108 #include "options_ui.h"
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>
129 nl_catd Dtb_project_catd;
130 extern Boolean props_changed;
133 static Dimension max_width = 0;
134 static Dimension max_height = 0;
137 OptCmd::OptCmd ( char *name, char *label, int active, Widget parent) :
138 WarnNoUndoCmd ( name, label, active )
140 _dialogParentWidget = parent;
142 _reopen_mailboxes = FALSE;
143 vacation_status_changed = FALSE;
144 vacation_msg_changed = FALSE;
153 OptCmd::help_button_CB(Widget current_pane)
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");
178 opt_help_button_CB(Widget wid, XtPointer clientData, XtPointer calldata)
180 OptCmd *cmd_ptr = (OptCmd*)clientData;
186 cmd_ptr->help_button_CB(cmd_ptr->currentPane());
189 void OptCmd::create_dlog()
191 theRoamApp.busyAllWindows(
192 GETMSG(DT_catd, 3, 78, "Initializing Mail Options..."));
194 // make a new widget structure
195 _opt_dlog = (DtbOptionsDialogInfo)malloc(sizeof(
196 DtbOptionsDialogInfoRec));
198 // make sure it's all cleaned up
199 dtbOptionsDialogInfo_clear(_opt_dlog);
202 * Open the standard message catalog for the project.
204 Dtb_project_catd = catopen(DTB_PROJECT_CATALOG, NL_CAT_LOCALE);
208 if (Dtb_project_catd == (nl_catd)-1)
210 fprintf(stderr, "Could not open message catalog: %s\n",
211 DTB_PROJECT_CATALOG);
216 // make us some a dem widgets! :-)
217 dtb_options_dialog_initialize(_opt_dlog,
218 _dialogParentWidget);
220 // The Printing Options pane is handled outside the
221 // Builder generated code.
223 _PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
224 _opt_dlog->printing_pane = _PrintingOptions->baseWidget();
227 // The Mail Server Options pane is handled outside the
228 // Builder generated code.
230 _MailRetrievalOptions = new MailRetrievalOptions(_opt_dlog->layer);
231 _opt_dlog->mailretrieval_pane = _MailRetrievalOptions->baseWidget();
234 // We need to do this for the help system
235 dtb_save_toplevel_widget(_dialogParentWidget);
237 XtSetMappedWhenManaged(_opt_dlog->dialog, False);
238 XtManageChild(_opt_dlog->dialog_shellform);
240 // hook them up to the back end!
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);
256 // initialize the "current" pane
257 options_set_category_pane(_opt_dlog->msg_header_pane);
259 XtAddCallback(_opt_dlog->subject_tf,
260 XmNvalueChangedCallback,
264 XtAddCallback(_opt_dlog->vacation_msg_tp,
265 XmNvalueChangedCallback,
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);
296 theRoamApp.unbusyAllWindows();
297 theRoamApp.setOptionsDialog((char*)_opt_dlog);
298 props_changed = FALSE;
301 //////////////////////////////////////////////////////////////////////////////
302 void vaca_msg_changedCB(Widget w, XtPointer ClientData, XtPointer calldata)
304 OptCmd *cmd_ptr = (OptCmd*)ClientData;
309 cmd_ptr->set_vaca_msg_Changed();
313 //////////////////////////////////////////////////////////////////////////////
315 //////////////////////////////////////////////////////////////////////////////
317 options_set_category_pane(
327 XmNuserData, &cmd_ptr,
330 current_pane = cmd_ptr->currentPane();
331 if (pane == current_pane)
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."));
337 cmd_ptr->genDialog()->setToQuestionDialog(
338 GETMSG(DT_catd, 5, 2, "Mailer"),
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"),
347 if (answer == 1) { //Save
348 if (! cmd_ptr->optionsAreValid()) return;
349 cmd_ptr->update_source();
350 cmd_ptr->doVacationCheck();
352 else if (answer == 3) { // Discard
353 cmd_ptr->update_panes();
355 else if (answer == 2) { // Cancel
356 //props_changed = FALSE;
357 cmd_ptr->setOldCategoryStr();
361 props_changed = FALSE;
364 if (current_pane != NULL)
365 XtUnmanageChild(current_pane);
367 cmd_ptr->setCurrentPane(pane);
368 cmd_ptr->setNewCategoryStr();
371 //////////////////////////////////////////////////////////////////////////////
379 //////////////////////////////////////////////////////////////////////////////
380 // hookup the front and back ends of the mail options
381 void OptCmd::init_panes()
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();
397 //////////////////////////////////////////////////////////////////////////////
398 void OptCmd::update_panes()
400 VacationCmd *vacation_cmd = theRoamApp.vacation();
401 Boolean vaca_running = FALSE;
407 if(vacation_cmd != NULL)
408 vaca_running = vacation_cmd->priorVacationRunning();
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);
420 // make sure Vacation pane is correct
421 XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
422 XmNset, vaca_running,
425 XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
426 XmNset, !vaca_running,
429 // set Subject and Message
430 if(vacation_cmd != NULL)
432 tmp_ptr = vacation_cmd->subject();
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,"
439 XtSetArg(args[0], XmNvalue, GETMSG(Dtb_project_catd, 2, 68, "Out of the office"));
442 XtVaSetValues(_opt_dlog->subject_tf,
445 // set back to the default value
447 XtSetValues(_opt_dlog->subject_tf,args,1);
450 tmp_ptr = vacation_cmd->body();
452 // Do same thing for the body part
455 XtVaSetValues(_opt_dlog->vacation_msg_tp,
458 else //set a space to the body
459 XtVaSetValues(_opt_dlog->vacation_msg_tp,
465 _reopen_mailboxes = FALSE;
466 vacation_status_changed = FALSE;
467 vacation_msg_changed = FALSE;
468 props_changed = FALSE;
472 //////////////////////////////////////////////////////////////////////////////
473 void OptCmd::update_source()
477 DtMail::Session * d_session = theRoamApp.session()->session();
478 DtMail::MailRc * mail_rc = d_session->mailRc(error);
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);
490 if (mail_rc->getParseError() != DTME_NoError)
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);
501 else mail_rc->update(error);
503 if (_reopen_mailboxes)
505 theRoamApp.reopenRoamMenuWindows();
506 _reopen_mailboxes = FALSE;
508 theRoamApp.globalPropChange();
509 props_changed = FALSE;
512 //////////////////////////////////////////////////////////////////////////////
513 // Handle the file locking stuff.
515 int OptCmd::doFileLockingCheck()
520 DtMail::Session *m_session = theRoamApp.session()->session();
521 const char *value = NULL;
522 Boolean use_file_locking;
523 unsigned char is_set;
525 m_session->mailRc(error)->getValue(error, "cdetooltalklock", &value);
526 use_file_locking = error.isNotSet();
527 if (NULL != value) free((void*) value);
529 if (XtIsManaged(_opt_dlog->advanced_pane))
532 _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
536 if (is_set != use_file_locking)
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"),
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");
556 _reopen_mailboxes = TRUE;
558 _reopen_mailboxes = FALSE;
561 theRoamApp.closeInactiveRoamMenuWindows();
568 //////////////////////////////////////////////////////////////////////////////
569 // Handle the vacation stuff.
571 void OptCmd::doVacationCheck()
575 VacationCmd *vacation_cmd = theRoamApp.vacation();
576 DtMailGenDialog *dialog = genDialog();
578 vacation_cmd->setGenDialog(dialog);
579 if(vacation_status_changed)
580 { // there was a change in status
581 if (XtIsManaged(_opt_dlog->vacation_pane))
583 XtVaGetValues(_opt_dlog->vacation_rb_items.On_item,
588 Boolean status = this->startVacation();
590 // startVacation also updates the mgs strings if changed
591 vacation_msg_changed = FALSE;
592 vacation_status_changed = status; // reset flag
596 this->stopVacation();
597 vacation_status_changed = FALSE; // reset flag
602 if (vacation_msg_changed)
607 XtVaGetValues(_opt_dlog->subject_tf, XmNvalue, &subj, NULL);
608 XtVaGetValues(_opt_dlog->vacation_msg_tp, XmNvalue, &body, NULL);
610 vacation_cmd->handleMessageFile(subj, body);
612 vacation_msg_changed = FALSE;
616 void OptCmd::setVacationChanged()
618 vacation_status_changed = TRUE;
619 props_changed = TRUE;
622 void OptCmd::set_vaca_msg_Changed()
624 vacation_msg_changed = TRUE;
625 props_changed = TRUE;
628 OptCmd::startVacation()
630 Boolean status = theRoamApp.startVacation(
631 _opt_dlog->subject_tf,
632 _opt_dlog->vacation_msg_tp);
638 OptCmd::stopVacation()
640 theRoamApp.stopVacation();
643 //////////////////////////////////////////////////////////////////////////////
644 // Check the printing options to make sure they are valid
646 Boolean OptCmd::optionsAreValid()
649 PropUiItem *propui_ptr = NULL;
652 for (propui_ptr = _PrintingOptions->getFirstProp();
653 propui_ptr != (PropUiItem *) NULL;
654 propui_ptr = _PrintingOptions->getNextProp())
656 errMsg = propui_ptr->uiValueIsValid();
659 this->genDialog()->setToQuestionDialog(
660 GETMSG(DT_catd, 5, 2, "Mailer"),
663 answer = this->genDialog()->post_and_return(
664 GETMSG(DT_catd, 26, 5, "Continue"),
672 for (propui_ptr = _MailRetrievalOptions->getFirstProp();
673 propui_ptr != (PropUiItem *) NULL;
674 propui_ptr = _MailRetrievalOptions->getNextProp())
676 errMsg = propui_ptr->uiValueIsValid();
679 this->genDialog()->setToQuestionDialog(
680 GETMSG(DT_catd, 5, 2, "Mailer"),
683 answer = this->genDialog()->post_and_return(
684 GETMSG(DT_catd, 26, 5, "Continue"),
694 //////////////////////////////////////////////////////////////////////////////
695 void register_pane_size(Widget pane)
697 Dimension width, height;
701 XmNwidth, &width, XmNheight, &height,
704 if (width > max_width)
707 if (height > max_height)
710 XtUnmanageChild(pane);
713 //////////////////////////////////////////////////////////////////////////////
714 // init the message header list pane
715 void OptCmd::init_msg_hdr_pane()
718 PropUiItem *propui_ptr = NULL;
720 // register overall size of pane
721 register_pane_size(_opt_dlog->msg_header_pane);
723 // test for the message header list pane
726 mh_pane_list = new DtVirtArray<PropUiItem *>(3);
728 // make the check for new mail SB
729 propui_ptr = (PropUiItem *)new CheckForMailUiItem(_opt_dlog->mail_check_sb,
732 propui_ptr->writeFromSourceToUi();
733 mh_pane_list->append(propui_ptr);
735 // make the signal with beep SB
736 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->signal_sb,
739 propui_ptr->writeFromSourceToUi();
740 mh_pane_list->append(propui_ptr);
742 // make the sig with flashes SB
743 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->spinbox2,
746 propui_ptr->writeFromSourceToUi();
747 mh_pane_list->append(propui_ptr);
749 // make the disp headers SB
750 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_sb,
753 propui_ptr->writeFromSourceToUi();
754 mh_pane_list->append(propui_ptr);
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,
761 propui_ptr->writeFromSourceToUi();
762 mh_pane_list->append(propui_ptr);
764 // make the sho "Display message numbers"
765 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
766 _opt_dlog->checkbox_items.Display_message_numbers_item,
769 propui_ptr->writeFromSourceToUi();
770 mh_pane_list->append(propui_ptr);
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,
777 propui_ptr->writeFromSourceToUi();
778 mh_pane_list->append(propui_ptr);
780 // make the sho "show confirm notice"
781 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
782 _opt_dlog->deleted_msg_cb_items.Show_confirmation_notice_item,
785 propui_ptr->writeFromSourceToUi();
786 mh_pane_list->append(propui_ptr);
790 //////////////////////////////////////////////////////////////////////////////
791 void OptCmd::init_msg_view_pane()
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;
799 // register overall size of pane
800 register_pane_size(_opt_dlog->msg_view_pane);
803 msg_view_pane_list = new DtVirtArray<PropUiItem *>(2);
806 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_row_sb,
809 propui_ptr->writeFromSourceToUi();
810 msg_view_pane_list->append(propui_ptr);
813 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->characters_wide_sb,
816 propui_ptr->writeFromSourceToUi();
817 msg_view_pane_list->append(propui_ptr);
819 list_ptr = (ListUiItem *)new IgnoreListUiItem(_opt_dlog->hidden_fields_list,
822 _opt_dlog->fields_hide);
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);
829 list_ptr->writeFromSourceToUi();
830 list_ptr->AddDefaults();
831 msg_view_pane_list->append(list_ptr);
835 //////////////////////////////////////////////////////////////////////////////
836 void OptCmd::init_compose_pane()
838 PropUiItem *propui_ptr = NULL;
840 DtMail::Session * d_session = theRoamApp.session()->session();
841 DtMail::MailRc * mail_rc = d_session->mailRc(error);
843 DtVirtArray<char *> fields_list(10);
844 ListUiItem *list_ptr = NULL;
846 // register overall size of pane
847 register_pane_size(_opt_dlog->compose_win_pane);
850 compose_pane_list = new DtVirtArray<PropUiItem *>(1);
852 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->indent_str_tf,
855 propui_ptr->writeFromSourceToUi();
856 compose_pane_list->append(propui_ptr);
858 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
859 _opt_dlog->wrap_checkbox_items.Show_Attachment_List_item,
862 propui_ptr->writeFromSourceToUi();
863 compose_pane_list->append(propui_ptr);
865 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
866 _opt_dlog->cfrm_att_checkbox_items.Confirm_Attachment_item,
868 "confirmattachments");
869 propui_ptr->writeFromSourceToUi();
870 compose_pane_list->append(propui_ptr);
873 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->cfrm_att_size_sb,
875 "confirmattachmentthreshold");
876 propui_ptr->writeFromSourceToUi();
877 compose_pane_list->append(propui_ptr);
879 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->deadletter_field,
882 propui_ptr->writeFromSourceToUi();
883 compose_pane_list->append(propui_ptr);
885 list_ptr = (ListUiItem *)new CustomListUiItem(_opt_dlog->list,
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);
895 list_ptr->writeFromSourceToUi();
896 compose_pane_list->append(list_ptr);
900 //////////////////////////////////////////////////////////////////////////////
901 void OptCmd::init_msg_filing_pane()
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;
910 // register overall size of pane
911 register_pane_size(_opt_dlog->msg_filing_pane);
913 ListUiItem *list_ptr = NULL;
916 msg_filing_pane_list = new DtVirtArray<PropUiItem *>(5);
919 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->srt_looking_tf,
922 propui_ptr->writeFromSourceToUi();
923 msg_filing_pane_list->append(propui_ptr);
925 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
926 _opt_dlog->dpy_up_mbox_cb_items.Display_up_to_item,
928 "dontdisplaycachedfiles");
929 propui_ptr->writeFromSourceToUi();
930 msg_filing_pane_list->append(propui_ptr);
933 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->recent_sb,
935 "cachedfilemenusize");
936 propui_ptr->writeFromSourceToUi();
937 msg_filing_pane_list->append(propui_ptr);
940 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->sent_mail_tf,
943 propui_ptr->writeFromSourceToUi();
944 msg_filing_pane_list->append(propui_ptr);
947 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
948 _opt_dlog->log_cb_items.Log_all_sent_messages_item,
952 // propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
953 // _opt_dlog->log_cb_items.Log_all_sent_messages_item,
955 // "nodontlogmessages");
956 propui_ptr->writeFromSourceToUi();
957 msg_filing_pane_list->append(propui_ptr);
959 list_ptr = (ListUiItem *)new MoveMenuListUiItem(_opt_dlog->mv_menu_lst,
962 _opt_dlog->path_file_name_tf);
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);
969 list_ptr->writeFromSourceToUi();
970 msg_filing_pane_list->append(list_ptr);
974 //////////////////////////////////////////////////////////////////////////////
975 void OptCmd::init_vacation_pane()
977 // register overall size of pane
978 register_pane_size(_opt_dlog->vacation_pane);
981 //////////////////////////////////////////////////////////////////////////////
982 void OptCmd::init_template_pane()
985 ListUiItem *list_ptr = NULL;
987 // register overall size of pane
988 register_pane_size(_opt_dlog->templates_pane);
991 template_pane_list = new DtVirtArray<PropUiItem *>(3);
993 list_ptr = (ListUiItem *)new TemplateListUiItem(_opt_dlog->templates_list,
996 _opt_dlog->menu_label,
997 _opt_dlog->path_filename_label);
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);
1004 list_ptr->writeFromSourceToUi();
1005 template_pane_list->append(list_ptr);
1009 //////////////////////////////////////////////////////////////////////////////
1010 void OptCmd::init_aliases_pane()
1013 ListUiItem *list_ptr = NULL;
1015 // register overall size of pane
1016 register_pane_size(_opt_dlog->aliases_pane);
1019 aliases_pane_list = new DtVirtArray<PropUiItem *>(3);
1021 list_ptr = (ListUiItem *)new AliasListUiItem(_opt_dlog->alias_list,
1024 _opt_dlog->alias_tf,
1025 _opt_dlog->addresses_tf);
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);
1032 list_ptr->writeFromSourceToUi();
1033 aliases_pane_list->append(list_ptr);
1037 //////////////////////////////////////////////////////////////////////////////
1038 void OptCmd::init_advanced_pane()
1041 DtVirtArray<char *> alternates_list(8);
1042 PropUiItem *propui_ptr = NULL;
1044 struct passwd *user_passwd = NULL;
1045 char *label_str = NULL;
1046 XmString label_xm_str;
1048 // register overall size of pane
1049 register_pane_size(_opt_dlog->advanced_pane);
1051 ListUiItem *list_ptr = NULL;
1053 label_str = (char *)malloc(256);
1055 // set the list to be a mono spaced font...
1059 advanced_pane_list = new DtVirtArray<PropUiItem *>(6);
1061 propui_ptr = (PropUiItem *)new ScaleUiItem(
1062 _opt_dlog->update_mbox_scale,
1065 propui_ptr->writeFromSourceToUi();
1066 advanced_pane_list->append(propui_ptr);
1068 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
1069 _opt_dlog->adv_def_cb_items.Show_confirmation_notices_item,
1072 propui_ptr->writeFromSourceToUi();
1073 advanced_pane_list->append(propui_ptr);
1075 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1076 _opt_dlog->adv_def_cb_items.Use_strict_MIME_character_encoding_item,
1079 propui_ptr->writeFromSourceToUi();
1080 advanced_pane_list->append(propui_ptr);
1082 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1083 _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
1086 propui_ptr->writeFromSourceToUi();
1087 advanced_pane_list->append(propui_ptr);
1089 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1090 _opt_dlog->adv_def_cb_items.Ignore_host_name_in_address_allnet_item,
1093 propui_ptr->writeFromSourceToUi();
1094 advanced_pane_list->append(propui_ptr);
1096 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1097 _opt_dlog->adv_def_cb_items.Include_me_when_I_Reply_to_all_metoo_item,
1100 propui_ptr->writeFromSourceToUi();
1101 advanced_pane_list->append(propui_ptr);
1103 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1104 _opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1107 propui_ptr->writeFromSourceToUi();
1108 advanced_pane_list->append(propui_ptr);
1110 // set uid in string...
1111 euid = geteuid(); // get uid of user
1113 user_passwd = getpwuid(euid); // get passwd entry for user
1115 sprintf(label_str, "%s \"%s\" =",
1116 GETMSG( DT_catd, 20, 2, "Use local name: "), user_passwd->pw_name);
1118 label_xm_str = XmStringCreateLocalized(label_str);
1120 XtVaSetValues(_opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1121 XmNlabelString, label_xm_str,
1125 list_ptr = (ListUiItem *)new AlternatesListUiItem(_opt_dlog->local_name_list,
1128 _opt_dlog->local_name_tf);
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);
1136 list_ptr->writeFromSourceToUi();
1137 advanced_pane_list->append(list_ptr);
1142 //////////////////////////////////////////////////////////////////////////////
1143 void OptCmd::init_printing_pane()
1146 PropUiItem *propui_ptr = NULL;
1149 //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1150 //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1152 // register overall size of pane
1153 register_pane_size(_opt_dlog->printing_pane);
1156 npropui = _PrintingOptions->getNumProps();
1157 printing_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1161 for (propui_ptr = _PrintingOptions->getFirstProp();
1162 propui_ptr != (PropUiItem *) NULL;
1163 propui_ptr = _PrintingOptions->getNextProp())
1165 propui_ptr->writeFromSourceToUi();
1166 printing_pane_list->append(propui_ptr);
1172 //////////////////////////////////////////////////////////////////////////////
1173 void OptCmd::init_mailretrieval_pane()
1176 PropUiItem *propui_ptr = NULL;
1179 //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1180 //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1182 // register overall size of pane
1183 register_pane_size(_opt_dlog->mailretrieval_pane);
1186 npropui = _MailRetrievalOptions->getNumProps();
1187 mailretrieval_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1191 for (propui_ptr = _MailRetrievalOptions->getFirstProp();
1192 propui_ptr != (PropUiItem *) NULL;
1193 propui_ptr = _MailRetrievalOptions->getNextProp())
1195 propui_ptr->writeFromSourceToUi();
1196 mailretrieval_pane_list->append(propui_ptr);
1200 _MailRetrievalOptions->initOptionInteractions();
1204 //////////////////////////////////////////////////////////////////////////////
1207 // make sure all the sheets are uptodate
1208 this->update_panes();
1210 XtVaSetValues(_opt_dlog->cancel_button,
1214 XtVaSetValues(_opt_dlog->ok_button,
1218 XtVaSetValues(_opt_dlog->apply_button,
1222 XtVaSetValues(_opt_dlog->reset_button,
1226 XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
1230 XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
1234 XtPopdown(_opt_dlog->dialog);
1235 XtPopup(_opt_dlog->dialog, XtGrabNone);
1236 XtManageChild(_opt_dlog->dialog_shellform);
1237 props_changed = FALSE;
1239 //////////////////////////////////////////////////////////////////
1240 void OptCmd::updateUiFromBackEnd(DtVirtArray<PropUiItem *> *list)
1246 len = list->length();
1248 for(i = 0; i < len; i++)
1249 (*list)[i]->writeFromSourceToUi();
1252 fprintf(stderr,"NULL list passed to updateUiFromBackEnd\n");
1255 //////////////////////////////////////////////////////////////////
1256 void OptCmd::updateBackEndFromUi(DtVirtArray<PropUiItem *> *list)
1262 len = list->length();
1264 for(i = 0; i < len; i++)
1265 (*list)[i]->writeFromUiToSource();
1268 fprintf(stderr,"NULL list passed to updateBackEndFromUi\n");
1273 //////////////////////////////////////////////////////////////////////////////
1274 void OptCmd::unmanage()
1277 XtPopdown(_opt_dlog->dialog);
1281 //////////////////////////////////////////////////////////////////////////////
1285 _opt_dlog = (DtbOptionsDialogInfo)theRoamApp.optionsDialog();
1286 if (_opt_dlog == NULL) {
1287 this->create_dlog();
1288 generalDialog = new DtMailGenDialog("Dialog", _opt_dlog->dialog);
1292 XtPopdown(_opt_dlog->dialog);
1293 XtPopup(_opt_dlog->dialog, XtGrabNone);
1294 XtManageChild(_opt_dlog->dialog_shellform);
1298 //////////////////////////////////////////////////////////////////////////////
1299 void OptCmd::setNewCategoryStr()
1301 XtVaGetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, &catstr, NULL);
1304 //////////////////////////////////////////////////////////////////////////////
1305 void OptCmd::setOldCategoryStr()
1307 XtVaSetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, catstr, NULL);
1310 //////////////////////////////////////////////////////////////////////////////
1311 void OptCmd::displayAliasesOptionsPane()
1314 options_set_category_pane(_opt_dlog->aliases_pane);
1316 _opt_dlog->category_opmenu,
1317 XmNmenuHistory, _opt_dlog->category_opmenu_items.Aliases_item,
1321 //////////////////////////////////////////////////////////////////////////////
1322 void OptCmd::displayPrintingOptionsPane()
1325 options_set_category_pane(_opt_dlog->printing_pane);
1327 _opt_dlog->category_opmenu,
1328 XmNmenuHistory, _opt_dlog->category_opmenu_items.Printing_item,
1332 //////////////////////////////////////////////////////////////////////////////
1333 void OptCmd::displayMailRetrievalOptionsPane()
1336 options_set_category_pane(_opt_dlog->mailretrieval_pane);
1338 _opt_dlog->category_opmenu,
1339 XmNmenuHistory,_opt_dlog->category_opmenu_items.MailRetrieval_item,