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 libraries 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;
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;
161 generalDialog = NULL;
162 _PrintingOptions = NULL;
163 _MailRetrievalOptions = NULL;
164 printing_pane_list = NULL;
168 OptCmd::help_button_CB(Widget current_pane)
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");
193 opt_help_button_CB(Widget wid, XtPointer clientData, XtPointer calldata)
195 OptCmd *cmd_ptr = (OptCmd*)clientData;
201 cmd_ptr->help_button_CB(cmd_ptr->currentPane());
204 void OptCmd::create_dlog()
206 theRoamApp.busyAllWindows(
207 GETMSG(DT_catd, 3, 78, "Initializing Mail Options..."));
209 // make a new widget structure
210 _opt_dlog = (DtbOptionsDialogInfo)malloc(sizeof(
211 DtbOptionsDialogInfoRec));
213 // make sure it's all cleaned up
214 dtbOptionsDialogInfo_clear(_opt_dlog);
217 * Open the standard message catalog for the project.
219 Dtb_project_catd = catopen(DTB_PROJECT_CATALOG, NL_CAT_LOCALE);
223 if (Dtb_project_catd == (nl_catd)-1)
225 fprintf(stderr, "Could not open message catalog: %s\n",
226 DTB_PROJECT_CATALOG);
231 // make us some a dem widgets! :-)
232 dtb_options_dialog_initialize(_opt_dlog,
233 _dialogParentWidget);
235 // The Printing Options pane is handled outside the
236 // Builder generated code.
238 _PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
239 _opt_dlog->printing_pane = _PrintingOptions->baseWidget();
242 // The Mail Server Options pane is handled outside the
243 // Builder generated code.
245 _MailRetrievalOptions = new MailRetrievalOptions(_opt_dlog->layer);
246 _opt_dlog->mailretrieval_pane = _MailRetrievalOptions->baseWidget();
249 // We need to do this for the help system
250 dtb_save_toplevel_widget(_dialogParentWidget);
252 XtSetMappedWhenManaged(_opt_dlog->dialog, False);
253 XtManageChild(_opt_dlog->dialog_shellform);
255 // hook them up to the back end!
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);
271 // initialize the "current" pane
272 options_set_category_pane(_opt_dlog->msg_header_pane);
274 XtAddCallback(_opt_dlog->subject_tf,
275 XmNvalueChangedCallback,
279 XtAddCallback(_opt_dlog->vacation_msg_tp,
280 XmNvalueChangedCallback,
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);
311 theRoamApp.unbusyAllWindows();
312 theRoamApp.setOptionsDialog((char*)_opt_dlog);
313 props_changed = FALSE;
316 //////////////////////////////////////////////////////////////////////////////
317 void vaca_msg_changedCB(Widget w, XtPointer ClientData, XtPointer calldata)
319 OptCmd *cmd_ptr = (OptCmd*)ClientData;
324 cmd_ptr->set_vaca_msg_Changed();
328 //////////////////////////////////////////////////////////////////////////////
330 //////////////////////////////////////////////////////////////////////////////
332 options_set_category_pane(
342 XmNuserData, &cmd_ptr,
345 current_pane = cmd_ptr->currentPane();
346 if (pane == current_pane)
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."));
352 cmd_ptr->genDialog()->setToQuestionDialog(
353 GETMSG(DT_catd, 5, 2, "Mailer"),
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"),
362 if (answer == 1) { //Save
363 if (! cmd_ptr->optionsAreValid()) return;
364 cmd_ptr->update_source();
365 cmd_ptr->doVacationCheck();
367 else if (answer == 3) { // Discard
368 cmd_ptr->update_panes();
370 else if (answer == 2) { // Cancel
371 //props_changed = FALSE;
372 cmd_ptr->setOldCategoryStr();
376 props_changed = FALSE;
379 if (current_pane != NULL)
380 XtUnmanageChild(current_pane);
382 cmd_ptr->setCurrentPane(pane);
383 cmd_ptr->setNewCategoryStr();
386 //////////////////////////////////////////////////////////////////////////////
394 //////////////////////////////////////////////////////////////////////////////
395 // hookup the front and back ends of the mail options
396 void OptCmd::init_panes()
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();
412 //////////////////////////////////////////////////////////////////////////////
413 void OptCmd::update_panes()
415 VacationCmd *vacation_cmd = theRoamApp.vacation();
416 Boolean vaca_running = FALSE;
422 if(vacation_cmd != NULL)
423 vaca_running = vacation_cmd->priorVacationRunning();
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);
435 // make sure Vacation pane is correct
436 XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
437 XmNset, vaca_running,
440 XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
441 XmNset, !vaca_running,
444 // set Subject and Message
445 if(vacation_cmd != NULL)
447 tmp_ptr = vacation_cmd->subject();
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,"
454 XtSetArg(args[0], XmNvalue, GETMSG(Dtb_project_catd, 2, 68, "Out of the office"));
457 XtVaSetValues(_opt_dlog->subject_tf,
460 // set back to the default value
462 XtSetValues(_opt_dlog->subject_tf,args,1);
465 tmp_ptr = vacation_cmd->body();
467 // Do same thing for the body part
470 XtVaSetValues(_opt_dlog->vacation_msg_tp,
473 else //set a space to the body
474 XtVaSetValues(_opt_dlog->vacation_msg_tp,
480 _reopen_mailboxes = FALSE;
481 vacation_status_changed = FALSE;
482 vacation_msg_changed = FALSE;
483 props_changed = FALSE;
487 //////////////////////////////////////////////////////////////////////////////
488 void OptCmd::update_source()
492 DtMail::Session * d_session = theRoamApp.session()->session();
493 DtMail::MailRc * mail_rc = d_session->mailRc(error);
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);
505 if (mail_rc->getParseError() != DTME_NoError)
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);
516 else mail_rc->update(error);
518 if (_reopen_mailboxes)
520 theRoamApp.reopenRoamMenuWindows();
521 _reopen_mailboxes = FALSE;
523 theRoamApp.globalPropChange();
524 props_changed = FALSE;
527 //////////////////////////////////////////////////////////////////////////////
528 // Handle the file locking stuff.
530 int OptCmd::doFileLockingCheck()
535 DtMail::Session *m_session = theRoamApp.session()->session();
536 const char *value = NULL;
537 Boolean use_file_locking;
538 unsigned char is_set;
540 m_session->mailRc(error)->getValue(error, "cdetooltalklock", &value);
541 use_file_locking = error.isNotSet();
542 if (NULL != value) free((void*) value);
544 if (XtIsManaged(_opt_dlog->advanced_pane))
547 _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
551 if (is_set != use_file_locking)
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"),
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");
571 _reopen_mailboxes = TRUE;
573 _reopen_mailboxes = FALSE;
576 theRoamApp.closeInactiveRoamMenuWindows();
583 //////////////////////////////////////////////////////////////////////////////
584 // Handle the vacation stuff.
586 void OptCmd::doVacationCheck()
590 VacationCmd *vacation_cmd = theRoamApp.vacation();
591 DtMailGenDialog *dialog = genDialog();
593 vacation_cmd->setGenDialog(dialog);
594 if(vacation_status_changed)
595 { // there was a change in status
596 if (XtIsManaged(_opt_dlog->vacation_pane))
598 XtVaGetValues(_opt_dlog->vacation_rb_items.On_item,
603 Boolean status = this->startVacation();
605 // startVacation also updates the mgs strings if changed
606 vacation_msg_changed = FALSE;
607 vacation_status_changed = status; // reset flag
611 this->stopVacation();
612 vacation_status_changed = FALSE; // reset flag
617 if (vacation_msg_changed)
622 XtVaGetValues(_opt_dlog->subject_tf, XmNvalue, &subj, NULL);
623 XtVaGetValues(_opt_dlog->vacation_msg_tp, XmNvalue, &body, NULL);
625 vacation_cmd->handleMessageFile(subj, body);
627 vacation_msg_changed = FALSE;
631 void OptCmd::setVacationChanged()
633 vacation_status_changed = TRUE;
634 props_changed = TRUE;
637 void OptCmd::set_vaca_msg_Changed()
639 vacation_msg_changed = TRUE;
640 props_changed = TRUE;
643 OptCmd::startVacation()
645 Boolean status = theRoamApp.startVacation(
646 _opt_dlog->subject_tf,
647 _opt_dlog->vacation_msg_tp);
653 OptCmd::stopVacation()
655 theRoamApp.stopVacation();
658 //////////////////////////////////////////////////////////////////////////////
659 // Check the printing options to make sure they are valid
661 Boolean OptCmd::optionsAreValid()
664 PropUiItem *propui_ptr = NULL;
667 for (propui_ptr = _PrintingOptions->getFirstProp();
668 propui_ptr != (PropUiItem *) NULL;
669 propui_ptr = _PrintingOptions->getNextProp())
671 errMsg = propui_ptr->uiValueIsValid();
674 this->genDialog()->setToQuestionDialog(
675 GETMSG(DT_catd, 5, 2, "Mailer"),
678 answer = this->genDialog()->post_and_return(
679 GETMSG(DT_catd, 26, 5, "Continue"),
687 for (propui_ptr = _MailRetrievalOptions->getFirstProp();
688 propui_ptr != (PropUiItem *) NULL;
689 propui_ptr = _MailRetrievalOptions->getNextProp())
691 errMsg = propui_ptr->uiValueIsValid();
694 this->genDialog()->setToQuestionDialog(
695 GETMSG(DT_catd, 5, 2, "Mailer"),
698 answer = this->genDialog()->post_and_return(
699 GETMSG(DT_catd, 26, 5, "Continue"),
709 //////////////////////////////////////////////////////////////////////////////
710 void register_pane_size(Widget pane)
712 Dimension width, height;
716 XmNwidth, &width, XmNheight, &height,
719 if (width > max_width)
722 if (height > max_height)
725 XtUnmanageChild(pane);
728 //////////////////////////////////////////////////////////////////////////////
729 // init the message header list pane
730 void OptCmd::init_msg_hdr_pane()
733 PropUiItem *propui_ptr = NULL;
735 // register overall size of pane
736 register_pane_size(_opt_dlog->msg_header_pane);
738 // test for the message header list pane
741 mh_pane_list = new DtVirtArray<PropUiItem *>(3);
743 // make the check for new mail SB
744 propui_ptr = (PropUiItem *)new CheckForMailUiItem(_opt_dlog->mail_check_sb,
747 propui_ptr->writeFromSourceToUi();
748 mh_pane_list->append(propui_ptr);
750 // make the signal with beep SB
751 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->signal_sb,
754 propui_ptr->writeFromSourceToUi();
755 mh_pane_list->append(propui_ptr);
757 // make the sig with flashes SB
758 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->spinbox2,
761 propui_ptr->writeFromSourceToUi();
762 mh_pane_list->append(propui_ptr);
764 // make the disp headers SB
765 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_sb,
768 propui_ptr->writeFromSourceToUi();
769 mh_pane_list->append(propui_ptr);
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,
776 propui_ptr->writeFromSourceToUi();
777 mh_pane_list->append(propui_ptr);
779 // make the sho "Display message numbers"
780 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
781 _opt_dlog->checkbox_items.Display_message_numbers_item,
784 propui_ptr->writeFromSourceToUi();
785 mh_pane_list->append(propui_ptr);
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,
792 propui_ptr->writeFromSourceToUi();
793 mh_pane_list->append(propui_ptr);
795 // make the sho "show confirm notice"
796 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
797 _opt_dlog->deleted_msg_cb_items.Show_confirmation_notice_item,
800 propui_ptr->writeFromSourceToUi();
801 mh_pane_list->append(propui_ptr);
805 //////////////////////////////////////////////////////////////////////////////
806 void OptCmd::init_msg_view_pane()
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;
814 // register overall size of pane
815 register_pane_size(_opt_dlog->msg_view_pane);
818 msg_view_pane_list = new DtVirtArray<PropUiItem *>(2);
821 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->display_row_sb,
824 propui_ptr->writeFromSourceToUi();
825 msg_view_pane_list->append(propui_ptr);
828 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->characters_wide_sb,
831 propui_ptr->writeFromSourceToUi();
832 msg_view_pane_list->append(propui_ptr);
834 list_ptr = (ListUiItem *)new IgnoreListUiItem(_opt_dlog->hidden_fields_list,
837 _opt_dlog->fields_hide);
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);
844 list_ptr->writeFromSourceToUi();
845 list_ptr->AddDefaults();
846 msg_view_pane_list->append(list_ptr);
850 //////////////////////////////////////////////////////////////////////////////
851 void OptCmd::init_compose_pane()
853 PropUiItem *propui_ptr = NULL;
855 DtMail::Session * d_session = theRoamApp.session()->session();
856 DtMail::MailRc * mail_rc = d_session->mailRc(error);
858 DtVirtArray<char *> fields_list(10);
859 ListUiItem *list_ptr = NULL;
861 // register overall size of pane
862 register_pane_size(_opt_dlog->compose_win_pane);
865 compose_pane_list = new DtVirtArray<PropUiItem *>(1);
867 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->indent_str_tf,
870 propui_ptr->writeFromSourceToUi();
871 compose_pane_list->append(propui_ptr);
873 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
874 _opt_dlog->wrap_checkbox_items.Show_Attachment_List_item,
877 propui_ptr->writeFromSourceToUi();
878 compose_pane_list->append(propui_ptr);
880 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
881 _opt_dlog->cfrm_att_checkbox_items.Confirm_Attachment_item,
883 "confirmattachments");
884 propui_ptr->writeFromSourceToUi();
885 compose_pane_list->append(propui_ptr);
888 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->cfrm_att_size_sb,
890 "confirmattachmentthreshold");
891 propui_ptr->writeFromSourceToUi();
892 compose_pane_list->append(propui_ptr);
894 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->deadletter_field,
897 propui_ptr->writeFromSourceToUi();
898 compose_pane_list->append(propui_ptr);
900 list_ptr = (ListUiItem *)new CustomListUiItem(_opt_dlog->list,
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);
910 list_ptr->writeFromSourceToUi();
911 compose_pane_list->append(list_ptr);
915 //////////////////////////////////////////////////////////////////////////////
916 void OptCmd::init_msg_filing_pane()
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;
925 // register overall size of pane
926 register_pane_size(_opt_dlog->msg_filing_pane);
928 ListUiItem *list_ptr = NULL;
931 msg_filing_pane_list = new DtVirtArray<PropUiItem *>(5);
934 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->srt_looking_tf,
937 propui_ptr->writeFromSourceToUi();
938 msg_filing_pane_list->append(propui_ptr);
940 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
941 _opt_dlog->dpy_up_mbox_cb_items.Display_up_to_item,
943 "dontdisplaycachedfiles");
944 propui_ptr->writeFromSourceToUi();
945 msg_filing_pane_list->append(propui_ptr);
948 propui_ptr = (PropUiItem *)new SpinBoxUiItem(_opt_dlog->recent_sb,
950 "cachedfilemenusize");
951 propui_ptr->writeFromSourceToUi();
952 msg_filing_pane_list->append(propui_ptr);
955 propui_ptr = (PropUiItem *)new TextFieldUiItem(_opt_dlog->sent_mail_tf,
958 propui_ptr->writeFromSourceToUi();
959 msg_filing_pane_list->append(propui_ptr);
962 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
963 _opt_dlog->log_cb_items.Log_all_sent_messages_item,
967 // propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
968 // _opt_dlog->log_cb_items.Log_all_sent_messages_item,
970 // "nodontlogmessages");
971 propui_ptr->writeFromSourceToUi();
972 msg_filing_pane_list->append(propui_ptr);
974 list_ptr = (ListUiItem *)new MoveMenuListUiItem(_opt_dlog->mv_menu_lst,
977 _opt_dlog->path_file_name_tf);
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);
984 list_ptr->writeFromSourceToUi();
985 msg_filing_pane_list->append(list_ptr);
989 //////////////////////////////////////////////////////////////////////////////
990 void OptCmd::init_vacation_pane()
992 // register overall size of pane
993 register_pane_size(_opt_dlog->vacation_pane);
996 //////////////////////////////////////////////////////////////////////////////
997 void OptCmd::init_template_pane()
1000 ListUiItem *list_ptr = NULL;
1002 // register overall size of pane
1003 register_pane_size(_opt_dlog->templates_pane);
1006 template_pane_list = new DtVirtArray<PropUiItem *>(3);
1008 list_ptr = (ListUiItem *)new TemplateListUiItem(_opt_dlog->templates_list,
1011 _opt_dlog->menu_label,
1012 _opt_dlog->path_filename_label);
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);
1019 list_ptr->writeFromSourceToUi();
1020 template_pane_list->append(list_ptr);
1024 //////////////////////////////////////////////////////////////////////////////
1025 void OptCmd::init_aliases_pane()
1028 ListUiItem *list_ptr = NULL;
1030 // register overall size of pane
1031 register_pane_size(_opt_dlog->aliases_pane);
1034 aliases_pane_list = new DtVirtArray<PropUiItem *>(3);
1036 list_ptr = (ListUiItem *)new AliasListUiItem(_opt_dlog->alias_list,
1039 _opt_dlog->alias_tf,
1040 _opt_dlog->addresses_tf);
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);
1047 list_ptr->writeFromSourceToUi();
1048 aliases_pane_list->append(list_ptr);
1052 //////////////////////////////////////////////////////////////////////////////
1053 void OptCmd::init_advanced_pane()
1056 DtVirtArray<char *> alternates_list(8);
1057 PropUiItem *propui_ptr = NULL;
1059 struct passwd *user_passwd = NULL;
1060 char *label_str = NULL;
1061 XmString label_xm_str;
1063 // register overall size of pane
1064 register_pane_size(_opt_dlog->advanced_pane);
1066 ListUiItem *list_ptr = NULL;
1068 label_str = (char *)malloc(256);
1070 // set the list to be a mono spaced font...
1074 advanced_pane_list = new DtVirtArray<PropUiItem *>(6);
1076 propui_ptr = (PropUiItem *)new ScaleUiItem(
1077 _opt_dlog->update_mbox_scale,
1080 propui_ptr->writeFromSourceToUi();
1081 advanced_pane_list->append(propui_ptr);
1083 propui_ptr = (PropUiItem *)new AntiCheckBoxUiItem(
1084 _opt_dlog->adv_def_cb_items.Show_confirmation_notices_item,
1087 propui_ptr->writeFromSourceToUi();
1088 advanced_pane_list->append(propui_ptr);
1090 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1091 _opt_dlog->adv_def_cb_items.Use_strict_MIME_character_encoding_item,
1094 propui_ptr->writeFromSourceToUi();
1095 advanced_pane_list->append(propui_ptr);
1097 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1098 _opt_dlog->adv_def_cb_items.Use_network_aware_mail_file_locking_item,
1101 propui_ptr->writeFromSourceToUi();
1102 advanced_pane_list->append(propui_ptr);
1104 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1105 _opt_dlog->adv_def_cb_items.Ignore_host_name_in_address_allnet_item,
1108 propui_ptr->writeFromSourceToUi();
1109 advanced_pane_list->append(propui_ptr);
1111 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1112 _opt_dlog->adv_def_cb_items.Include_me_when_I_Reply_to_all_metoo_item,
1115 propui_ptr->writeFromSourceToUi();
1116 advanced_pane_list->append(propui_ptr);
1118 propui_ptr = (PropUiItem *)new CheckBoxUiItem(
1119 _opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1122 propui_ptr->writeFromSourceToUi();
1123 advanced_pane_list->append(propui_ptr);
1125 // set uid in string...
1126 euid = geteuid(); // get uid of user
1128 user_passwd = getpwuid(euid); // get passwd entry for user
1130 sprintf(label_str, "%s \"%s\" =",
1131 GETMSG( DT_catd, 20, 2, "Use local name: "), user_passwd->pw_name);
1133 label_xm_str = XmStringCreateLocalized(label_str);
1135 XtVaSetValues(_opt_dlog->adv_def_cb_items.Use_local_name_username_item,
1136 XmNlabelString, label_xm_str,
1140 list_ptr = (ListUiItem *)new AlternatesListUiItem(_opt_dlog->local_name_list,
1143 _opt_dlog->local_name_tf);
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);
1151 list_ptr->writeFromSourceToUi();
1152 advanced_pane_list->append(list_ptr);
1157 //////////////////////////////////////////////////////////////////////////////
1158 void OptCmd::init_printing_pane()
1161 PropUiItem *propui_ptr = NULL;
1164 //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1165 //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1167 // register overall size of pane
1168 register_pane_size(_opt_dlog->printing_pane);
1171 npropui = _PrintingOptions->getNumProps();
1172 printing_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1176 for (propui_ptr = _PrintingOptions->getFirstProp();
1177 propui_ptr != (PropUiItem *) NULL;
1178 propui_ptr = _PrintingOptions->getNextProp())
1180 propui_ptr->writeFromSourceToUi();
1181 printing_pane_list->append(propui_ptr);
1187 //////////////////////////////////////////////////////////////////////////////
1188 void OptCmd::init_mailretrieval_pane()
1191 PropUiItem *propui_ptr = NULL;
1194 //_PrintingOptions = new DmxPrintOptions(_opt_dlog->layer);
1195 //_opt_dlog->printing_pane = _PrintingOptions->baseWidget();
1197 // register overall size of pane
1198 register_pane_size(_opt_dlog->mailretrieval_pane);
1201 npropui = _MailRetrievalOptions->getNumProps();
1202 mailretrieval_pane_list = new DtVirtArray<PropUiItem *>(npropui);
1206 for (propui_ptr = _MailRetrievalOptions->getFirstProp();
1207 propui_ptr != (PropUiItem *) NULL;
1208 propui_ptr = _MailRetrievalOptions->getNextProp())
1210 propui_ptr->writeFromSourceToUi();
1211 mailretrieval_pane_list->append(propui_ptr);
1215 _MailRetrievalOptions->initOptionInteractions();
1219 //////////////////////////////////////////////////////////////////////////////
1222 // make sure all the sheets are uptodate
1223 this->update_panes();
1225 XtVaSetValues(_opt_dlog->cancel_button,
1229 XtVaSetValues(_opt_dlog->ok_button,
1233 XtVaSetValues(_opt_dlog->apply_button,
1237 XtVaSetValues(_opt_dlog->reset_button,
1241 XtVaSetValues(_opt_dlog->vacation_rb_items.On_item,
1245 XtVaSetValues(_opt_dlog->vacation_rb_items.Off_item,
1249 XtPopdown(_opt_dlog->dialog);
1250 XtPopup(_opt_dlog->dialog, XtGrabNone);
1251 XtManageChild(_opt_dlog->dialog_shellform);
1252 props_changed = FALSE;
1254 //////////////////////////////////////////////////////////////////
1255 void OptCmd::updateUiFromBackEnd(DtVirtArray<PropUiItem *> *list)
1261 len = list->length();
1263 for(i = 0; i < len; i++)
1264 (*list)[i]->writeFromSourceToUi();
1267 fprintf(stderr,"NULL list passed to updateUiFromBackEnd\n");
1270 //////////////////////////////////////////////////////////////////
1271 void OptCmd::updateBackEndFromUi(DtVirtArray<PropUiItem *> *list)
1277 len = list->length();
1279 for(i = 0; i < len; i++)
1280 (*list)[i]->writeFromUiToSource();
1283 fprintf(stderr,"NULL list passed to updateBackEndFromUi\n");
1288 //////////////////////////////////////////////////////////////////////////////
1289 void OptCmd::unmanage()
1292 XtPopdown(_opt_dlog->dialog);
1296 //////////////////////////////////////////////////////////////////////////////
1300 _opt_dlog = (DtbOptionsDialogInfo)theRoamApp.optionsDialog();
1301 if (_opt_dlog == NULL) {
1302 this->create_dlog();
1303 generalDialog = new DtMailGenDialog("Dialog", _opt_dlog->dialog);
1307 XtPopdown(_opt_dlog->dialog);
1308 XtPopup(_opt_dlog->dialog, XtGrabNone);
1309 XtManageChild(_opt_dlog->dialog_shellform);
1313 //////////////////////////////////////////////////////////////////////////////
1314 void OptCmd::setNewCategoryStr()
1316 XtVaGetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, &catstr, NULL);
1319 //////////////////////////////////////////////////////////////////////////////
1320 void OptCmd::setOldCategoryStr()
1322 XtVaSetValues(XmOptionButtonGadget(_opt_dlog->category_opmenu), XmNlabelString, catstr, NULL);
1325 //////////////////////////////////////////////////////////////////////////////
1326 void OptCmd::displayAliasesOptionsPane()
1329 options_set_category_pane(_opt_dlog->aliases_pane);
1331 _opt_dlog->category_opmenu,
1332 XmNmenuHistory, _opt_dlog->category_opmenu_items.Aliases_item,
1336 //////////////////////////////////////////////////////////////////////////////
1337 void OptCmd::displayPrintingOptionsPane()
1340 options_set_category_pane(_opt_dlog->printing_pane);
1342 _opt_dlog->category_opmenu,
1343 XmNmenuHistory, _opt_dlog->category_opmenu_items.Printing_item,
1347 //////////////////////////////////////////////////////////////////////////////
1348 void OptCmd::displayMailRetrievalOptionsPane()
1351 options_set_category_pane(_opt_dlog->mailretrieval_pane);
1353 _opt_dlog->category_opmenu,
1354 XmNmenuHistory,_opt_dlog->category_opmenu_items.MailRetrieval_item,