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
26 * $TOG: RoamMenuWindow.C /main/80 1999/07/07 14:23:51 mgreess $
28 * RESTRICTED CONFIDENTIAL INFORMATION:
30 * The information in this document is subject to special
31 * restrictions in a confidential disclosure agreement between
32 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
33 * document outside HP, IBM, Sun, USL, SCO, or Univel without
34 * Sun's specific written approval. This document and all copies
35 * and derivative works thereof must be returned or destroyed at
38 * Copyright 1993, 1994, 1995 Sun Microsystems, Inc. All rights reserved.
43 * Common Desktop Environment
45 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
46 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
47 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
48 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
49 * (c) Copyright 1995 Digital Equipment Corp.
50 * (c) Copyright 1995 Fujitsu Limited
51 * (c) Copyright 1995 Hitachi, Ltd.
54 * RESTRICTED RIGHTS LEGEND
56 *Use, duplication, or disclosure by the U.S. Government is subject to
57 *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
58 *Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
59 *for non-DOD U.S. Government Departments and Agencies are as set forth in
60 *FAR 52.227-19(c)(1,2).
62 *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
63 *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
64 *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
65 *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
66 *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
67 *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
68 *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
73 #include <sys/param.h>
79 #if !defined(USL) && !defined(__uxp__)
84 #include <sys/utsname.h>
86 #include <sys/systeminfo.h>
89 #include <X11/Intrinsic.h>
90 #include <X11/cursorfont.h>
94 #include <Xm/RepType.h>
95 #include <Xm/PanedW.h>
97 #include <Xm/RowColumn.h>
99 #include <Xm/LabelG.h>
103 #include <DtMail/DtMailTypes.h>
104 #include <DtMail/IO.hh>
105 #include "SelectFileCmd.h"
106 #include "RoamMenuWindow.h"
108 #include "ButtonInterface.h"
109 #include "WorkingDialogManager.h"
111 #include "QuestionDialogManager.h"
112 #endif /* DEAD_WOOD */
113 #include "MemUtils.hh"
115 #include "DtMailHelp.hh"
117 #include "SendMsgDialog.h"
118 #include "AttachArea.h"
119 #include "Attachment.h"
121 #include <DtMail/OptCmd.h>
122 #include "ComposeCmds.hh"
123 #include "EUSDebug.hh"
125 #include "SortCmd.hh"
127 extern int force( Widget );
129 static const char * NormalIcon = "DtMail";
130 static const char * EmptyIcon = "DtMnone";
131 static const char * NewMailIcon = "DtMnew";
132 static const char * MailDragIcon = "DtMmsg";
134 extern nl_catd DtMailMsgCat;
135 #define MAXIMUM_PATH_LENGTH 2048
137 #define RMW_CONCAT_MAILRC_KEY(buf, pfx, key) \
138 { if (NULL==(pfx)) (void) sprintf((buf), "%s", (key)); \
139 else (void) sprintf((buf), "%s_%s", (pfx), (key)); }
142 RoamMenuWindow:: _supported[] =
144 "TARGETS", "MESSAGES", "STRING", "DELETE"
146 enum {TARGETS,MESSAGES, STR, DEL};
149 RoamMenuWindow::_resources[] =
156 XtOffset ( RoamMenuWindow *, _full_header_resource ),
166 XtOffset ( RoamMenuWindow *, _mailbox_name_resource ),
176 XtOffset ( RoamMenuWindow *, _mail_files_resource ),
184 // We need to maintain a constant WM_CLASS_NAME for SQE test
185 // suites to run consistently for all RMWs. We do that by
186 // maintaining a constant "name", as in WM_CLASS_NAME, for all
187 // RMWs by passing "dtmail" to a RMW's parent
188 // at creation time. We distinguish individual RMWs via the
189 // title which indicates what mail container they are currently
190 // looking at. The title is passed here as name; its dynamic
191 // (i.e., each RMW has its own "name", as in WM_NAME).
192 // If you are going to change the name, talk to SQE
193 // and get their consent for whatever change you are making.
195 // Note also that the name chosen must match whatever is specified
196 // in dtwm.fp (front panel configuration file) as the CLIENT_NAME
197 // for the Mail CONTROL. This is so PUSH_RECALL works.
198 // Typically this is the executable name.
200 RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
202 DtMailEnv mail_error;
204 // Initialize mail_error.
207 // Get a handle to the Inbox.
208 char *mail_file = NULL;
209 DtMailObjectSpace space;
210 DtMail::Session *d_session = theRoamApp.session()->session();
211 DtMail::MailRc *mailrc = d_session->mailRc(mail_error);
212 const char *value = NULL;
215 _forward_filename = NULL;
216 // Set the _mailbox_name here.
217 // In the absence of the RMW's title being set via title(),
218 // the _mailbox_name is what will be used in initialize().
219 _mailbox_name = NULL;
224 _mailbox_fullpath = NULL;
226 _mailbox_name_resource = NULL;
227 _mail_files_resource = NULL;
228 _full_header_resource = FALSE;
230 _required_conversion = FALSE;
231 _checkformail_when_mapped = FALSE;
232 _delete_on_quit = FALSE;
233 _we_called_newmail = FALSE;
242 _display_cached_list = FALSE;
243 _max_cached_list_size = 0;
244 _first_cached_item = 0;
245 _user_containerlist = NULL;
246 _cached_containerlist = NULL;
252 _file_cmdlist = NULL;
253 _file_separator = NULL;
254 _file_check_new_mail = NULL;
255 _file_open_inbox = NULL;
256 _file_new_container = NULL;
258 _file_destroy_deleted_msgs = NULL;
261 _file_cascade = NULL;
264 // OpenContainer Cascade Menu
266 _open_container_cmdlist = NULL;
267 _open_container_separator = NULL;
268 _open_container_inbox = NULL;
269 _open_container_other = NULL;
271 _open_container_containerlist = NULL;
272 _open_container_containerlist_cached = NULL;
273 _opencontainerMenu = NULL;
279 _msg_separator = NULL;
284 _msg_select_all = NULL;
286 _msg_undelete_last = NULL;
287 _msg_undelete_from_list = NULL;
291 // CopyTo Cascade Menu
293 _copyto_cmdlist = NULL;
294 _copyto_separator = NULL;
295 _copyto_inbox = NULL;
296 _copyto_other = NULL;
298 _copyto_containerlist = NULL;
299 _copyto_containerlist_cached = NULL;
301 _message_cascade = NULL;
307 _edit_cmdlist = NULL;
309 _edit_select_all = NULL;
317 _att_select_all = NULL;
322 _view_cmdlist = NULL;
323 _view_separator = NULL;
325 _view_previous = NULL;
326 _view_abbrev_headers = NULL;
328 _view_sortSender = NULL;
329 _view_sortSubject = NULL;
330 _view_sortSize = NULL;
331 _view_sortStatus = NULL;
336 _comp_cmdlist = NULL;
337 _comp_separator = NULL;
339 _comp_new_include = NULL;
340 _comp_forward = NULL;
341 _comp_replySender = NULL;
342 _comp_replyAll = NULL;
343 _comp_replySinclude = NULL;
344 _comp_replyAinclude = NULL;
350 _move_cmdlist = NULL;
351 _move_separator = NULL;
355 _move_containerlist = NULL;
356 _move_containerlist_cached = NULL;
358 _move_cascade = NULL;
362 _help_cmdlist = NULL;
363 _help_separator = NULL;
364 _help_overview = NULL;
366 _help_reference = NULL;
367 _help_on_item = NULL;
368 _help_using_help = NULL;
369 _help_about_mailer = NULL;
374 _msgsPopup_cmdlist = NULL;
375 _msgsPopup_separator = NULL;
377 _menuPopupMsgs = NULL;
378 _msgsPopupMenu = NULL;
379 _msgsPopupMoveMenu = NULL;
384 _textPopup_cmdlist = NULL;
385 _textPopup_separator = NULL;
390 _attPopup_cmdlist = NULL;
391 _attPopup_separator = NULL;
392 _attActions_cmdlist = NULL;
394 _attachmentMenu = NULL;
397 // ConvertContainerCmd
399 _convertContainerCmd = NULL;
400 _openContainerCmd = NULL;
403 // Message view pane buttons
405 _delete_button = NULL;
407 _previous_button = NULL;
408 _replySender_button = NULL;
409 _print_button = NULL;
410 _move_copy_button = NULL;
414 d_session->queryImpl(mail_error,
415 d_session->getDefaultImpl(mail_error),
416 DtMailCapabilityInboxName,
419 if (strcmp(mail_file, mailboxName()) == 0)
424 if (NULL != mail_file)
425 free((void*)mail_file);
431 // Initialize private variables
438 _message_summary = NULL;
440 _rowOfButtons = NULL;
441 _rowOfMessageStatus = NULL;
444 _clear_message_p = FALSE;
448 buffer = XtMalloc(BUFSIZ);
453 RMW_CONCAT_MAILRC_KEY(buffer, DTMAS_INBOX, "sortby");
457 RMW_CONCAT_MAILRC_KEY(buffer, mailboxName(), "sortby");
462 mailrc->getValue(mail_error, buffer, &value);
463 if (mail_error.isSet() || NULL == value)
464 _last_sorted_by = SortTimeDate;
466 _last_sorted_by = (SortBy) atoi(value);
468 if (NULL != value) free((void*) value);
469 if (NULL != buffer) XtFree(buffer);
473 RoamMenuWindow::~RoamMenuWindow()
478 theRoamApp.session()->close(error, _mailbox);
480 // Cannot return error to caller since there's
481 // no caller. What do we do?
485 if (NULL != _forward_filename)
486 free(_forward_filename);
488 free((void*) _mailbox_name);
489 if (_mailbox_fullpath)
490 free((void*) _mailbox_fullpath);
492 if (NULL != _dialogs)
494 if (NULL != _findDialog)
499 if (NULL != _user_containerlist)
500 delete _user_containerlist;
501 if (NULL != _cached_containerlist)
502 delete _cached_containerlist;
503 if (NULL != _filemenu2)
504 free((void*) _filemenu2);
507 delete _file_cmdlist;
508 delete _file_separator;
509 delete _file_check_new_mail;
510 delete _file_open_inbox;
511 delete _file_new_container;
512 #if defined(USE_OLD_FILE_OPEN)
515 delete _file_destroy_deleted_msgs;
518 // OpenContainer Cascade Menu
519 delete _open_container_cmdlist;
520 delete _open_container_separator;
521 delete _open_container_inbox;
522 delete _open_container_other;
524 if (NULL != _open_container_containerlist)
525 delete _open_container_containerlist;
526 if (NULL != _open_container_containerlist_cached)
527 delete _open_container_containerlist_cached;
532 delete _msg_separator;
538 delete _msg_undelete_last;
539 delete _msg_undelete_from_list;
541 // CopyTo Cascade Menu
542 delete _copyto_cmdlist;
543 delete _copyto_separator;
544 delete _copyto_inbox;
545 delete _copyto_other;
547 if (NULL != _copyto_containerlist)
548 delete _copyto_containerlist;
549 if (NULL != _copyto_containerlist_cached)
550 delete _copyto_containerlist_cached;
553 delete _edit_cmdlist;
555 delete _edit_select_all;
560 delete _att_select_all;
563 delete _view_cmdlist;
564 delete _view_separator;
566 delete _view_previous;
567 delete _view_abbrev_headers;
569 delete _view_sortSender;
570 delete _view_sortSubject;
571 delete _view_sortSize;
572 delete _view_sortStatus;
575 delete _comp_cmdlist;
576 delete _comp_separator;
578 delete _comp_new_include;
579 delete _comp_forward;
580 delete _comp_replySender;
581 delete _comp_replyAll;
582 delete _comp_replySinclude;
583 delete _comp_replyAinclude;
586 delete _move_cmdlist;
587 delete _move_separator;
591 if (NULL != _move_containerlist)
592 delete _move_containerlist;
593 if (NULL != _move_containerlist_cached)
594 delete _move_containerlist_cached;
597 delete _help_separator;
598 delete _help_cmdlist;
599 delete _help_overview;
601 delete _help_reference;
602 delete _help_on_item;
603 delete _help_using_help;
604 delete _help_about_mailer;
607 delete _msgsPopup_cmdlist;
608 delete _msgsPopup_separator;
610 delete _menuPopupMsgs;
613 delete _textPopup_cmdlist;
614 delete _textPopup_separator;
617 delete _attPopup_cmdlist;
618 delete _attPopup_separator;
619 delete _attActions_cmdlist;
621 // ConvertContainerCmd
622 delete _convertContainerCmd;
623 delete _openContainerCmd;
625 // Message view pane buttons
626 delete _delete_button;
628 delete _previous_button;
629 delete _replySender_button;
630 delete _print_button;
631 delete _move_copy_button;
643 XmDestroyPixmap(XtScreen(baseWidget()), _mbox_image);
645 XmDestroyPixmap(XtScreen(baseWidget()), _mbox_mask);
650 RoamMenuWindow::initialize()
652 XmRepTypeInstallTearOffModelConverter();
653 MenuWindow::initialize();
655 if (!this->baseWidget())
659 GETMSG(DT_catd, 2, 3,
660 "Unable to initialize windows. Exiting.\n"));
665 setStatus(GETMSG(DT_catd, 3, 2, "Initializing..."));
667 // XInternAtom(XtDisplay(this->baseWidget()) ,"STRING", False);
668 // XInternAtom(XtDisplay(this->baseWidget()) ,"MESSAGES", False);
669 getResources(_resources, XtNumber(_resources));
670 if (_mailbox_name_resource) mailboxName(_mailbox_name_resource);
672 // Mailbox image & mask
674 Screen *screen = XtScreen(baseWidget());
677 sprintf(icon_name, "%s.m", MailDragIcon);
678 _mbox_image = XmGetPixmap(screen, icon_name,
679 BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
681 sprintf(icon_name, "%s.m_m.bm", MailDragIcon);
682 _mbox_mask = XmGetPixmapByDepth(screen, icon_name, 1, 0, 1);
684 if (_mbox_image == XmUNSPECIFIED_PIXMAP ||
685 _mbox_mask == XmUNSPECIFIED_PIXMAP)
686 _mbox_image = _mbox_mask = NULL;
689 // Add an event handler for structureNotify.
690 // This EH will handle exposure, configure notifies ...
692 this->baseWidget(), StructureNotifyMask, False,
693 (XtEventHandler) &RoamMenuWindow::structurenotify,
696 _convertContainerCmd = new ConvertContainerCmd(
700 _openContainerCmd = new OpenContainerCmd(
704 _genDialog = new DtMailGenDialog("Dialog", _main);
705 setIconName(NormalIcon);
709 RoamMenuWindow::inbox()
715 RoamMenuWindow::createWorkArea(Widget parent)
717 Widget form1, panedW;
719 Dimension x, y, width, height, bwid;
720 VacationCmd *vacation_cmd = theRoamApp.vacation();
722 form1 = XmCreateForm(parent, "Work_Area", NULL, 0);
723 XtVaSetValues(form1, XmNresizePolicy, XmRESIZE_NONE, NULL);
725 printHelpId("form1", form1);
726 /* add help callback */
727 // XtAddCallback(form1, XmNhelpCallback, HelpCB, helpId);
728 XtAddCallback(form1, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWID);
730 panedW = XtCreateManagedWidget("panedW", xmPanedWindowWidgetClass,
732 printHelpId ("panedW", panedW);
733 /* add help callback */
734 // XtAddCallback(panedW, XmNhelpCallback, HelpCB, helpId);
736 XtVaSetValues(panedW,
737 XmNrightAttachment,XmATTACH_FORM,
738 XmNleftAttachment,XmATTACH_FORM,
739 XmNtopAttachment,XmATTACH_FORM,
740 XmNbottomAttachment, XmATTACH_FORM,
747 form2 = XtCreateManagedWidget("form2", xmFormWidgetClass, panedW, NULL, 0);
748 XtVaSetValues(form2, XmNallowResize, True, NULL);
749 printHelpId ("form2", form2);
750 /* add help callback */
751 // XtAddCallback(form2, XmNhelpCallback, HelpCB, helpId);
754 XtCreateManagedWidget("RowOfLabels", xmFormWidgetClass, form2, NULL, 0);
756 printHelpId("rowOfLabels", _rowOfLabels);
757 /* add help callback */
758 // XtAddCallback(_rowOfLabels, XmNhelpCallback, HelpCB, helpId);
760 _rowOfLabels, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWROWOFLABELSID);
762 XtVaSetValues(_rowOfLabels,
763 XmNrightAttachment,XmATTACH_FORM,
764 XmNleftAttachment,XmATTACH_FORM,
765 XmNtopAttachment,XmATTACH_FORM,
767 XmNorientation, XmHORIZONTAL,
770 XmNentryAlignment, XmALIGNMENT_CENTER,
773 _list = new MsgScrollingList( this, form2, "Message_List");
777 DtMail::Session *d_session = theRoamApp.session()->session();
778 DtMail::MailRc *mailrc = d_session->mailRc(error);
779 const char *value = NULL;
782 this->addToRowOfLabels(_list);
784 // See if the header size has changed.
786 mailrc->getValue(error, "headerlines", &value);
787 if (error.isSet()) value = strdup("15");
789 int header_lines = (int) strtol(value, NULL, 10);
790 _list->visibleItems(header_lines);
791 if (NULL != value) free((void*) value);
794 _list->get_scrolling_list(), XmNhelpCallback,
795 HelpCB, (void *)DTMAILMSGLISTID);
797 XtVaSetValues(_list->get_scrolling_list(), XmNuserData, this, NULL);
799 XtCreateManagedWidget("RowColumn", xmFormWidgetClass, form2, NULL, 0);
800 printHelpId ("rowOfButtons", _rowOfButtons);
802 // XtAddCallback(_rowOfButtons, XmNhelpCallback, HelpCB, helpId);
805 // Place it closer to the scrolling list than to the text widget
807 XtVaSetValues(XtParent(_list->get_scrolling_list()),
808 XmNrightAttachment,XmATTACH_FORM,
809 XmNleftAttachment,XmATTACH_FORM,
810 XmNtopAttachment,XmATTACH_WIDGET,
811 XmNtopWidget, _rowOfLabels,
813 XmNbottomAttachment, XmATTACH_WIDGET,
814 XmNbottomWidget, _rowOfButtons,
818 XtVaSetValues(_rowOfButtons,
819 XmNrightAttachment,XmATTACH_FORM,
820 XmNleftAttachment,XmATTACH_FORM,
821 XmNbottomAttachment, XmATTACH_FORM,
825 this->addToRowOfButtons();
827 form3 = XtCreateManagedWidget("form3", xmFormWidgetClass, panedW, NULL, 0);
828 XtVaSetValues(form3, XmNallowResize, True, NULL);
829 printHelpId ("form3", form3);
831 // XtAddCallback(form3, XmNhelpCallback, HelpCB, helpId);
835 XmNrightAttachment,XmATTACH_FORM,
836 XmNleftAttachment,XmATTACH_FORM,
837 XmNtopAttachment,XmATTACH_FORM,
841 _rowOfMessageStatus =
842 XtCreateManagedWidget("Message_Status", xmFormWidgetClass, form3, NULL,0);
844 XtVaSetValues(_rowOfMessageStatus,
845 XmNrightAttachment,XmATTACH_FORM,
846 XmNleftAttachment,XmATTACH_FORM,
847 XmNtopAttachment,XmATTACH_FORM,
851 this->addToRowOfMessageStatus();
853 _my_editor = new DtMailEditor(form3, this);
854 _my_editor->initialize();
855 _my_editor->attachArea()->setOwnerShell(this);
857 // DtMailEditor contains a widget that contains the textEditor and
858 // attachArea. Get that widget...
860 Widget wid = _my_editor->container();
862 printHelpId ("wid", wid);
863 /* add help callback */
864 // XtAddCallback(wid, XmNhelpCallback, HelpCB, helpId);
867 XmNrightAttachment,XmATTACH_FORM,
868 XmNleftAttachment,XmATTACH_FORM,
869 XmNtopAttachment,XmATTACH_WIDGET,
870 XmNtopWidget, _rowOfMessageStatus,
871 XmNbottomAttachment, XmATTACH_FORM,
874 DtMailEnv mail_error;
876 // Initialize the mail_error.
878 mailboxFullpath(mailboxName());
880 // Set the appShell's title to be _mailbox_fullpath
881 if (vacation_cmd != NULL && vacation_cmd->priorVacationRunning())
886 // Set the icon name to the folder name. Extract foldername from full path.
887 char *fname = strrchr(_mailbox_fullpath, '/');
889 setIconTitle(_mailbox_fullpath);
892 // Extract the filename from it.
897 XtManageChild(_list->baseWidget());
898 XtManageChild(form1);
901 mailrc->getValue(error, "retrieveinterval", &value);
902 if (error.isNotSet() && value && *value != '\0')
904 long ping = (time_t) strtol(value, NULL, 10);
906 _checkformail_when_mapped = FALSE;
908 _checkformail_when_mapped = TRUE;
911 if (NULL != value) free((void*) value);
918 XmNborderWidth, &bwid,
924 _border_width = bwid;
928 // This routine is just a place holder callback to pass when creating
929 // a mailbox when we doing want to do anything when the mailbox gets
944 // msgListTransferCallback
946 // Handles the transfer of data that is dragged and dropped to the
947 // MsgScrollingList. Files and buffers are transferred by inserting
948 // them as messages into the scrolling list.
951 RoamMenuWindow::msgListTransferCallback(
953 XtPointer clientData,
956 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
957 DtDndTransferCallbackStruct *transferInfo =
958 (DtDndTransferCallbackStruct *) callData;
959 DtDndContext *dropData = transferInfo->dropData;
962 DtMail::MailBox *mbox, *tmpmbox;
963 DtMailEnv mail_error;
964 MailSession *session = theRoamApp.session();
966 DebugPrintf(3, "In RoamMenuWindow::msgListTransferCallback\n");
968 // Initialize the mail_error.
971 numItems = dropData->numItems;
973 switch (dropData->protocol) {
974 case DtDND_FILENAME_TRANSFER:
976 // Loop through the files that were dropped onto the msg list
978 for (ii = 0; ii < numItems; ii++) {
980 // Try to open the file as a mail container.
981 filepath = dropData->data.files[ii];
982 tmpmbox = session->open(
983 mail_error, filepath,
984 &RoamMenuWindow::syncViewAndStoreCallback,
985 rmw, DTM_FALSE, DTM_TRUE);
987 // Reject the drop if we weren't able to open the file.
988 if (!tmpmbox || mail_error.isSet()) {
989 transferInfo->status = DtDND_FAILURE;
992 // We were able to open the container, so now we get the
993 // current mailbox and copy all the messages into it.
994 mbox = rmw->mailbox();
995 mbox->copyMailBox(mail_error, tmpmbox);
996 rmw->checkForMail(mail_error);
1002 case DtDND_BUFFER_TRANSFER:
1004 // Loop through the buffers that were dropped onto the msg list
1006 for (ii = 0; ii < numItems; ii++) {
1008 // Turn the dropped data into a mail buffer to pass to
1009 // the mailbox constructor.
1011 buf.buffer = (char *) transferInfo->dropData->data.buffers->bp;
1012 buf.size = transferInfo->dropData->data.buffers->size;
1014 // Convert the buffer into a mailbox object.
1015 tmpmbox = session->session()->mailBoxConstruct(mail_error,
1016 DtMailBufferObject, &buf,
1017 openCallback, NULL);
1019 // Reject the drop if we weren't able to convert it to a mailbox
1020 if (!tmpmbox || mail_error.isSet()) {
1021 transferInfo->status = DtDND_FAILURE;
1024 // Parse the dropped data into the tmpmbox.
1025 tmpmbox->open(mail_error);
1026 if (mail_error.isSet()) {
1027 transferInfo->status = DtDND_FAILURE;
1031 mbox = rmw->mailbox();
1032 mbox->copyMailBox(mail_error, tmpmbox);
1033 rmw->checkForMail(mail_error);
1040 transferInfo->status = DtDND_FAILURE;
1045 // msgListDropRegister
1047 // Register the message list to accept file & buffer drops
1050 RoamMenuWindow::msgListDropRegister()
1052 static XtCallbackRec transferCBRec[] = {
1053 {&RoamMenuWindow::msgListTransferCallback, NULL}, {NULL, NULL} };
1055 // Pass the RoamMenuWindow object (this) as clientData.
1056 transferCBRec[0].closure = this;
1058 DtDndVaDropRegister(_list->get_scrolling_list(),
1059 DtDND_FILENAME_TRANSFER | DtDND_BUFFER_TRANSFER,
1060 (unsigned char)(XmDROP_MOVE | XmDROP_COPY), transferCBRec,
1061 DtNtextIsBuffer, True,
1065 // msgListDropEnable
1067 // Enable the message list for drops by restoring the operation
1070 RoamMenuWindow::msgListDropEnable()
1074 XtSetArg(args[0], XmNdropSiteOperations, XmDROP_MOVE | XmDROP_COPY);
1075 XmDropSiteUpdate(_list->get_scrolling_list(), args, 1);
1078 // msgListDropDisable
1080 // Disable the message list for drops by setting the operation to noop
1083 RoamMenuWindow::msgListDropDisable()
1087 XtSetArg(args[0], XmNdropSiteOperations, XmDROP_NOOP);
1088 XmDropSiteUpdate(_list->get_scrolling_list(), args, 1);
1092 // msgListConvertCallback
1094 // Provide the msg list as a mailbox for the drag
1097 RoamMenuWindow::msgListConvertCallback(
1098 Widget /* dragContext */,
1099 XtPointer clientData,
1102 DtDndConvertCallbackStruct *convertInfo =
1103 (DtDndConvertCallbackStruct *) callData;
1104 DtDndBuffer *buffer = &(convertInfo->dragData->data.buffers[0]);
1105 RoamMenuWindow *rmw = (RoamMenuWindow *)clientData;
1106 MsgScrollingList *msgList;
1108 DtMail::MailBox *mbox;
1109 DtMail::Message *msg;
1110 DtMailMessageHandle msgHandle;
1111 DtMailBuffer *mbufList;
1112 int *pos_list, pos_count, ii;
1113 unsigned long bufSize = 0;
1117 DebugPrintf(3, "In RoamMenuWindow:msgListConvertCallback\n");
1121 switch (convertInfo->reason) {
1122 case DtCR_DND_CONVERT_DATA:
1124 msgList = rmw->list();
1125 listW = msgList->get_scrolling_list();
1126 mbox = rmw->mailbox();
1128 if (!XmListGetSelectedPos(listW, &pos_list, &pos_count)) {
1129 convertInfo->status = DtDND_FAILURE;
1133 mbufList = (DtMailBuffer*)XtMalloc(pos_count*sizeof(DtMailBuffer));
1135 for (ii = 0; ii < pos_count; ii++) {
1136 msgHandle = msgList->msgno(pos_list[ii]);
1137 msg = mbox->getMessage(error, msgHandle);
1138 if (error.isSet()) {
1139 convertInfo->status = DtDND_FAILURE;
1142 msg->toBuffer(error, mbufList[ii]);
1143 if (error.isSet()) {
1144 convertInfo->status = DtDND_FAILURE;
1147 bufSize += mbufList[ii].size + 1;
1150 bufPtr = XtMalloc((unsigned int)bufSize);
1152 buffer->bp = bufPtr;
1153 buffer->size = (int)bufSize;
1154 buffer->name = "Mailbox";
1156 for (ii = 0; ii < pos_count; ii++) {
1157 strncpy(bufPtr, (char *)mbufList[ii].buffer,
1158 (unsigned int)mbufList[ii].size);
1159 bufPtr += mbufList[ii].size;
1162 delete mbufList[ii].buffer;
1165 XtFree((char *)mbufList);
1166 XtFree((char *)pos_list);
1169 case DtCR_DND_CONVERT_DELETE:
1170 // The drag and drop succeeded, so we can now delete the messages
1171 // from the scrolling list.
1172 rmw->list()->deleteSelected();
1177 // msgListDragFinishCallback
1179 // Clean up from the convert callback and restore state
1182 RoamMenuWindow::msgListDragFinishCallback(
1183 Widget /* widget */,
1184 XtPointer clientData,
1187 DtDndDragFinishCallbackStruct *finishInfo =
1188 (DtDndDragFinishCallbackStruct *) callData;
1189 DtDndContext *dragData = finishInfo->dragData;
1190 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
1191 MsgScrollingList *msgList = rmw->list();
1192 DtMailEnv mail_error;
1195 DebugPrintf(3, "In RoamMenuWindow::msgListDragFinishCallback\n");
1199 // Re-enable drops on this message list
1200 if (rmw->mailbox()->mailBoxWritable(mail_error) == DTM_TRUE) {
1201 rmw->msgListDropEnable();
1204 if (finishInfo->sourceIcon)
1205 XtDestroyWidget(finishInfo->sourceIcon);
1207 // Free any memory allocated for the drag.
1208 for (ii = 0; ii < dragData->numItems; ii++) {
1209 XtFree((char *)dragData->data.buffers[ii].bp);
1216 // Use the mailbox pixmap to create a drag icon
1219 RoamMenuWindow::getDragIcon(
1222 if (_mbox_image && _mbox_mask) {
1223 return DtDndCreateSourceIcon(widget, _mbox_image, _mbox_mask);
1231 // Translation start a drag from the msg list
1234 RoamMenuWindow::msgListDragStart(
1237 String * /* params */,
1238 Cardinal * /* numParams */)
1240 static XtCallbackRec convertCBRec[] = {
1241 {&RoamMenuWindow::msgListConvertCallback, NULL},{NULL, NULL} };
1242 static XtCallbackRec dragFinishCBRec[] = {
1243 {&RoamMenuWindow::msgListDragFinishCallback, NULL}, {NULL, NULL} };
1244 RoamMenuWindow *rmw = NULL;
1245 unsigned char operations;
1247 DtMailEnv mail_error;
1249 DebugPrintf(3, "In RoamMenuWindow::msgListProcessDrag\n");
1253 XtVaGetValues(widget, XmNuserData, &rmw, NULL);
1258 drag_icon = rmw->getDragIcon(widget);
1261 rmw->msgListDropDisable();
1263 // Choose the drag operations based on the writeability of the mailbox
1265 if (rmw->mailbox()->mailBoxWritable(mail_error) == DTM_TRUE) {
1266 // RW Folder. Permit Copy and Move.
1267 operations = (unsigned char)(XmDROP_COPY | XmDROP_MOVE);
1269 // RO Folder. Permit only Copy drags.
1270 operations = (unsigned char)XmDROP_COPY;
1275 convertCBRec[0].closure = (XtPointer) rmw;
1276 dragFinishCBRec[0].closure = (XtPointer) rmw;
1278 if (DtDndVaDragStart(widget, event, DtDND_BUFFER_TRANSFER, 1,
1279 operations, convertCBRec, dragFinishCBRec,
1280 DtNsourceIcon, drag_icon,
1282 DebugPrintf(3, "DragStart returned NULL.\n");
1290 RoamMenuWindow::msgListLookForButton (
1297 #define ABS_DELTA(x1, x2) (x1 < x2 ? x2 - x1 : x1 - x2)
1299 if( event->type == MotionNotify) {
1300 XEvent * press = (XEvent *) arg;
1302 if (ABS_DELTA(press->xbutton.x_root, event->xmotion.x_root) > DAMPING ||
1303 ABS_DELTA(press->xbutton.y_root, event->xmotion.y_root) > DAMPING)
1306 else if (event->type == ButtonRelease)
1311 // msgListProcessPress
1313 // Translation implementing Motif 1.2.5 ProcessPress function
1316 #define SELECTION_ACTION 0
1317 #define TRANSFER_ACTION 1
1320 RoamMenuWindow::msgListProcessPress(
1324 Cardinal *num_params)
1326 int i, action, cur_item;
1327 int *selected_positions, nselected_positions;
1329 DebugPrintf(3, "In RoamMenuWindow::msgListProcessPress\n");
1331 // This action happens when Button1 is pressed and the Selection
1332 // and Transfer are integrated on Button1. It is passed two
1333 // parameters: the action to call when the event is a selection,
1334 // and the action to call when the event is a transfer.
1336 if (*num_params != 2 || !XmIsList(w))
1339 action = SELECTION_ACTION;
1340 cur_item = XmListYToPos(w, event->xbutton.y);
1345 XmNselectedPositions, &selected_positions,
1346 XmNselectedPositionCount, &nselected_positions,
1349 for (i=0; i<nselected_positions; i++)
1351 if (cur_item == selected_positions[i])
1353 // The determination of whether this is a transfer drag
1354 // cannot be made until a Motion event comes in. It is
1355 // not a drag as soon as a ButtonUp event happens.
1361 &RoamMenuWindow::msgListLookForButton,
1363 switch (new_event.type)
1366 action = TRANSFER_ACTION;
1369 action = SELECTION_ACTION;
1377 XtCallActionProc(w, params[action], event, params, *num_params);
1382 // Override default list translations to start our own drags
1385 RoamMenuWindow::msgListDragSetup()
1387 Widget msgList = _list->get_scrolling_list();
1388 static char translations[] = "\
1389 ~c ~s ~m ~a <Btn1Down>:\
1390 dt-process-press(ListBeginSelect,MsgListDragStart)\n\
1391 c ~s ~m ~a <Btn1Down>:\
1392 dt-process-press(ListBeginToggle,MsgListDragStart)";
1393 static char btn2_translations[] = "\
1394 ~c ~s ~m ~a <Btn2Down>:\
1395 dt-process-press(ListBeginSelect,MsgListDragStart)\n\
1396 c ~s ~m ~a <Btn2Down>:\
1397 dt-process-press(ListBeginToggle,MsgListDragStart)\n\
1398 <Btn2Motion>:ListButtonMotion()\n\
1399 ~c ~s ~m ~a <Btn2Up>:ListEndSelect()\n\
1400 c ~s ~m ~a <Btn2Up>:ListEndToggle()";
1401 int btn1_transfer = 0;
1402 XtTranslations new_translations;
1403 static XtActionsRec actionTable[] = {
1404 {"MsgListDragStart",
1405 (XtActionProc) &RoamMenuWindow::msgListDragStart},
1406 {"dt-process-press",
1407 (XtActionProc) &RoamMenuWindow::msgListProcessPress}
1410 DebugPrintf(3, "In RoamMenuWindow::msgListDragSetup\n");
1413 theRoamApp.appContext(),
1415 sizeof(actionTable)/sizeof(actionTable[0]));
1416 new_translations = XtParseTranslationTable(translations);
1417 XtOverrideTranslations(msgList, new_translations);
1420 (Widget)XmGetXmDisplay(XtDisplayOfObject(msgList)),
1421 "enableBtn1Transfer", &btn1_transfer,
1424 if (btn1_transfer != True) {
1425 new_translations = XtParseTranslationTable(btn2_translations);
1426 XtOverrideTranslations(msgList, new_translations);
1431 RoamMenuWindow::open_and_load(
1433 DtMailBoolean create,
1436 _openContainerCmd->set_create_lock_flags(create, lock);
1437 _openContainerCmd->execute();
1439 // if it required conversion, let conversion handle the error
1440 // (its a callback routine and we have "lost control" of what
1441 // it returns anyway.)
1443 // if it did not require conversion, then open() should have succeeded.
1444 // If it did succeed, then its _mailbox should be set by now.
1445 // If its not set, then either open() failed somewhere or it was
1446 // cancelled by the user. We now have an error condition.
1447 if ((!_required_conversion) && (_mailbox == NULL))
1449 error.setError(DTME_NoMailBox);
1453 // If it required conversion, then let the conversion process handle
1454 // errors if any occur.
1455 // Reset the DtMailEnv for this method.
1456 if (_required_conversion) error.clear();
1458 // If it required conversion, and conversion succeeded, then the
1459 // mailbox was also loaded and _is_loaded gets set to TRUE.
1460 // If it required no conversion, then it implies that we already
1461 // have a container in hand and we just load it (implicitly
1462 // setting _is_loaded to TRUE)
1463 if ((!_required_conversion) && (_is_loaded == FALSE))
1465 this->load_mailbox(error);
1471 // Ideally, open() should set the error if the user cancels the open.
1472 // And we should error after open() returns at the caller's end...
1475 RoamMenuWindow::open(
1477 DtMailBoolean create_flag,
1478 DtMailBoolean lock_flag
1481 FORCE_SEGV_DECL(char, tmp);
1482 Dimension win_x, win_y, win_wid, win_ht, win_bwid;
1483 MailSession *ses = theRoamApp.session();
1487 char *buf = new char[2*MAXPATHLEN];
1489 _openContainerCmd->set_create_lock_flags(create_flag, lock_flag);
1491 // Obtain the current dimensions of the RMW
1492 XtVaGetValues(_main,
1497 XmNborderWidth, &win_bwid,
1503 _border_width = win_bwid;
1505 // Check to see if the mbox is already open. If it is, we will
1506 // simply make sure it's displayed in the current workspace.
1507 if (ses->isMboxOpen(_mailbox_fullpath))
1509 RoamMenuWindow *rmw = NULL;
1510 rmw = ses->getRMW(_mailbox_fullpath);
1513 ses->activateRMW(rmw);
1514 rmw->displayInCurrentWorkspace();
1519 // Try to open this folder, but don't take the lock and and don't create it.
1520 _mailbox = ses->open(error, _mailbox_fullpath,
1521 &RoamMenuWindow::syncViewAndStoreCallback,
1522 this, create_flag, lock_flag);
1525 if((DTMailError_t) error == DTME_OutOfSpace )
1527 ShowErrMsg((char *)error.getClient(),FALSE,(void*)this );
1528 error.setClient(NULL);
1533 // Did we ask for a non-existent file?
1534 if ((DTMailError_t)error == DTME_NoSuchFile)
1536 // if (create_flag == DTM_TRUE)
1537 if (create_flag == DTM_FALSE)
1542 "The mailbox %s does not exist.\nCreate a mailbox with this name?"),
1544 _genDialog->setToQuestionDialog(GETMSG(DT_catd,
1547 helpId = DTMAILHELPERROR;
1548 answer = _genDialog->post_and_return(GETMSG(DT_catd,
1556 if (answer == 1) open(error, DTM_TRUE, lock_flag);
1563 // A special case should be taken care
1564 // The create_flag is TRUE but still can not be created
1565 // This is because the path is something like
1566 // /valid_path/not_such_dir/file_name.
1567 // The full file path is not valid so that we need flag
1572 "Unable to create %s."),
1574 _genDialog->setToQuestionDialog(GETMSG(DT_catd,
1577 helpId = DTMAILHELPNOCREATE;
1578 answer = _genDialog->post_and_return(GETMSG(DT_catd,
1586 else if (((DTMailError_t)error == DTME_OtherOwnsWrite) ||
1587 ((DTMailError_t)error == DTME_AlreadyLocked))
1589 // See if they want to take the lock.
1591 // GETMSG(DT_catd, 3, 6, "The mailbox %s is locked.\n\
1592 // You can manually unlock the mailbox and try again\n\
1593 // or contact your System Administrator."),
1594 // _mailbox_fullpath);
1596 // _genDialog->setToErrorDialog(
1597 // GETMSG(DT_catd, 3, 7, "Mailer"),
1599 // helpId = DTMAILHELPTAKELOCK;
1600 // _genDialog->post_and_return(
1601 // GETMSG(DT_catd, 3, 8, "OK"),
1604 // error.setError(DTME_GetLockRefused);
1605 // The above else-if code doesn't make sense. If ses->open() failed
1606 // because the folder was already locked or not writable then
1607 // posting the specified error dialog and setting the error to GetLockRefused
1608 // is meaningless. Especially since the calling function
1609 // OpenContainerCmd::doit() doesn't even check the error we
1610 // return. Lets post a meaningful error dialog and return.
1611 postErrorDialog(error);
1615 else if ((DTMailError_t)error == DTME_BadRunGroup)
1618 sprintf(buf, GETMSG(DT_catd, 2, 4,
1619 "Mailer has not been properly installed,\n\
1620 and cannot run because the execution group\n\
1621 is incorrectly set."));
1623 _genDialog->setToQuestionDialog(
1624 GETMSG(DT_catd, 1, 6, "Mailer"),
1627 // No choice at this state other than to OK.
1629 helpId = DTMAILHELPBADGROUPID;
1630 answer = _genDialog->post_and_return(
1631 GETMSG(DT_catd, 3, 9, "OK"),
1637 else if ((DTMailError_t)error == DTME_NoPermission)
1640 * The %s is the name of the mailbox the user doesn't have
1641 * permission to view.
1643 sprintf(buf, GETMSG(DT_catd, 2, 5,
1644 "You do not have permission to view %s"), _mailbox_fullpath);
1646 _genDialog->setToQuestionDialog(
1647 GETMSG(DT_catd, 1, 7, "Mailer"),
1650 // No choice at this state other than to OK.
1652 helpId = DTMAILHELPNOVIEW;
1653 answer = _genDialog->post_and_return(
1654 GETMSG(DT_catd, 3, 10, "OK"),
1659 else if ((DTMailError_t)error == DTME_IsDirectory)
1661 sprintf(buf, GETMSG(DT_catd, 2, 6,
1662 "The mailbox %s is a directory and can not be opened."),
1665 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 1, 8, "Mailer"),
1668 helpId = DTMAILHELPDIRECTORYONLY;
1669 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 11, "OK"),
1674 else if ((DTMailError_t)error == DTME_AlreadyOpened)
1676 sprintf(buf, GETMSG(DT_catd,20,1,
1677 "The mailbox %s is already open."), _mailbox_fullpath);
1679 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 1, 8, "Mailer"),
1682 // there is no help message for this error
1683 // open a defect and put helpId later
1685 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 11, "OK"),
1692 // This is a real error. Punt!
1693 this->postErrorDialog(error);
1699 if (_mailbox->mailBoxWritable(error) == DTM_TRUE)
1700 msgListDropRegister();
1701 _mailbox->registerErrMsgFunc(ShowErrMsg,this);
1703 _mailbox->hideAccessEvents(DTM_TRUE);
1705 _mailbox->hideAccessEvents(DTM_FALSE);
1711 void RoamMenuWindow::createMenuPanes()
1713 this->createContainerList();
1715 this->construct_file_menu();
1717 this->construct_message_menu();
1719 this->construct_edit_menu();
1721 this->construct_attachment_menu();
1723 this->construct_view_menu();
1725 this->construct_compose_menu();
1727 this->construct_move_menu();
1729 this->construct_help_menu();
1731 this->construct_message_popup();
1733 this->construct_text_popup();
1735 this->construct_attachment_popup();
1737 this->syncCachedContainerList();
1742 RoamMenuWindow::resetCacheList(int new_size)
1744 // Remove the extra items in the list
1745 for (int i = _cached_containerlist->length(); i > new_size; i--) {
1747 _cached_containerlist->remove(i-1);
1748 _open_container_containerlist_cached->remove(i-1);
1749 _copyto_containerlist_cached->remove(i-1);
1750 _move_containerlist_cached->remove(i-1);
1752 _menuBar->removeCommand(_opencontainerMenu, _first_cached_item+i-1);
1753 _menuBar->removeCommand(_copytoMenu, _first_cached_item+i-1);
1754 _menuBar->removeCommand(_moveMenu, _first_cached_item+i-1);
1755 _menuBar->removeCommand(_msgsPopupMoveMenu, _first_cached_item+i-1);
1760 RoamMenuWindow::propsChanged(void)
1762 MailSession *ses = theRoamApp.session();
1763 DtMail::Session *d_session = ses->session();
1764 DtMail::MailRc *mailrc = get_mail_rc();
1766 const char *value = NULL;
1767 char *inbox_path = NULL;
1768 DtMailObjectSpace space;
1769 Boolean should_be_inbox;
1771 if (! _is_loaded) return;
1772 enableWorkAreaResize();
1774 d_session->queryImpl(
1776 d_session->getDefaultImpl(error),
1777 DtMailCapabilityInboxName,
1780 should_be_inbox = (inbox_path && 0 == strcmp(inbox_path, mailboxName()));
1782 RoamMenuWindow *rmw = NULL;
1783 char *password = NULL;
1784 password = MailRetrievalOptions::getPassword(DTMAS_INBOX);
1786 if (_inbox != should_be_inbox)
1795 // Remove inbox attributes
1797 displayInCurrentWorkspace();
1800 GETMSG(DT_catd, 99, 99,"The INBOX path has changed.\nReopen?"));
1801 _genDialog->setToQuestionDialog(
1802 GETMSG(DT_catd, 3, 22, "Mailer"),
1804 answer = _genDialog->post_and_return(
1805 GETMSG(DT_catd, 3, 29, "OK"),
1806 GETMSG(DT_catd, 3, 19, "Cancel"),
1809 rmw = ses->getRMW(inbox_path);
1813 rmw->_mailbox->createMailRetrievalAgent(password);
1814 rmw->_open_container_inbox->deactivate();
1815 rmw->_file_open_inbox->deactivate();
1821 rmw->displayInCurrentWorkspace();
1823 view_mail_file(inbox_path, DTM_FALSE);
1827 _mailbox->deleteMailRetrievalAgent();
1828 _open_container_inbox->activate();
1829 _file_open_inbox->activate();
1835 _mailbox->createMailRetrievalAgent(password);
1836 _open_container_inbox->deactivate();
1837 _file_open_inbox->deactivate();
1842 if (_inbox) _mailbox->createMailRetrievalAgent(password);
1845 rmw = ses->getRMW(inbox_path);
1846 if (rmw) rmw->_mailbox->createMailRetrievalAgent(password);
1850 if (password) free(password);
1853 // See if the header size has changed.
1855 mailrc->getValue(error, "headerlines", &value);
1858 value = strdup("15");
1862 int header_lines = (int) strtol(value, NULL, 10);
1863 if (header_lines != _list->visibleItems())
1864 _list->visibleItems(header_lines);
1867 free((void*) value);
1869 _list->checkDisplayProp();
1870 _my_editor->textEditor()->update_display_from_props();
1873 mailrc->getValue(error, "dontdisplaycachedfiles", &value);
1874 if (error.isNotSet() && value != NULL)
1876 if (_display_cached_list)
1877 // They just turned off the Display Up To prop so
1878 //reset the cache list to zero length.
1881 _max_cached_list_size = 0;
1882 _display_cached_list = FALSE;
1883 free((void*) value);
1889 mailrc->getValue(error, "cachedfilemenusize", &value);
1890 if (error.isNotSet() && value != NULL && *value != '\0')
1894 new_size = (int) strtol(value, NULL, 10);
1895 if (new_size != _max_cached_list_size && new_size >=0)
1897 // They just changed the display number so chop the
1898 // list if it is bigger than the new size just set
1899 if (new_size < _max_cached_list_size)
1900 resetCacheList(new_size);
1902 _max_cached_list_size = new_size;
1906 free((void*) value);
1911 mailrc->getValue(error, "filemenu2", &value);
1912 if ( (value == NULL && _filemenu2 != NULL) ||
1913 (value != NULL && _filemenu2 == NULL) ||
1914 (value != NULL && _filemenu2 != NULL &&
1915 strcmp(value, _filemenu2) != 0) )
1917 // Recreate the containter list
1918 this->createContainerList();
1920 // Recreate the File menu
1921 this->construct_file_menu();
1923 // Recreate the Message menu
1924 this->construct_message_menu();
1926 // Recreate the Move menu...
1927 this->construct_move_menu();
1929 // Recreate the Message popup menu
1930 this->construct_message_popup();
1933 free((void*) value);
1936 mailrc->getValue(error, "retrieveinterval", &value);
1937 if (error.isNotSet() && value && *value != '\0')
1939 long ping = (time_t) strtol(value, NULL, 10);
1941 _checkformail_when_mapped = FALSE;
1943 _checkformail_when_mapped = TRUE;
1946 if (NULL != value) free((void*) value);
1948 disableWorkAreaResize();
1951 void RoamMenuWindow::registerDialog( ViewMsgDialog *dialog )
1954 ViewMsgDialog **newList = (ViewMsgDialog **)-1;
1956 // Allocate a new list large enough to hold the new
1957 // object, and copy the contents of the current list
1960 newList = new ViewMsgDialog*[_numDialogs + 1];
1962 for ( i = 0; i < _numDialogs; i++ )
1963 newList[i] = _dialogs[i];
1965 // Install the new list and add the window to the list
1967 if ( _numDialogs > 0 )
1970 _dialogs[_numDialogs] = dialog;
1974 void RoamMenuWindow::unregisterDialog ( ViewMsgDialog *dialog )
1977 ViewMsgDialog **newList = (ViewMsgDialog **)-1;
1979 // Allocate a new, smaller list
1981 newList = new ViewMsgDialog *[_numDialogs - 1];
1983 // Copy all objects, except the one to be
1984 // removed, to the new list
1987 for ( i = 0; i < _numDialogs; i++ )
1988 if ( _dialogs[i] != dialog )
1989 newList[index++] = _dialogs[i];
1991 // Install the new list
2000 RoamMenuWindow::forwardFilename( char *file )
2002 _forward_filename = (char *)realloc(_forward_filename, strlen(file)+1);
2003 strcpy( _forward_filename, file );
2007 RoamMenuWindow::forwardFilename()
2009 return _forward_filename;
2014 // If it is a configure notify, we are interested in it.
2015 // We need to then capture its new position.
2016 // And if the RMW has not been loaded, we need to load it.
2019 RoamMenuWindow::structurenotify(
2021 XtPointer clientData,
2023 Boolean * ) // continue_to_dispatch
2025 RoamMenuWindow *rmw=(RoamMenuWindow *) clientData;
2027 if (event->type == ConfigureNotify)
2029 rmw->configurenotify(
2030 event->xconfigurerequest.x,
2031 event->xconfigurerequest.y,
2032 event->xconfigurerequest.width,
2033 event->xconfigurerequest.height,
2034 event->xconfigurerequest.border_width);
2036 else if ((event->type == MapNotify) || ( event->type == UnmapNotify))
2039 if (event->type == UnmapNotify)
2041 rmw->_mailbox->save();
2042 rmw->_mailbox->hideAccessEvents(DTM_TRUE);
2046 rmw->_mailbox->hideAccessEvents(DTM_FALSE);
2047 if (FALSE==rmw->_inbox || TRUE==rmw->_checkformail_when_mapped)
2050 DtMail::Session *m_session = theRoamApp.session()->session();
2051 DtMail::MailRc *mailrc = m_session->mailRc(error);
2052 const char *value = NULL;
2054 mailrc->getValue(error, "retrievemailonmapnotify", &value);
2055 if (error.isNotSet()) rmw->checkForMail(error);
2063 // Capture its position coordinates.
2066 RoamMenuWindow::configurenotify(
2067 unsigned int win_x, unsigned int win_y,
2068 unsigned int win_wid, unsigned int win_ht,
2069 unsigned int win_bwid
2077 _border_width = win_bwid;
2081 // If it is not already loaded, then load it (it might involve
2082 // conversion, etc.; all handled by open_and_load())
2083 // If its been loaded already, then mapnotify gets called when
2084 // the state changes from iconic to open (i.e., the user double-clicks
2085 // on an RMW icon). If we want to load a folder at that time, this
2086 // is the place to do it.
2090 RoamMenuWindow::mapnotify()
2092 // If its not been loaded, then open and load it.
2095 DtMailEnv mail_error;
2099 theRoamApp.busyAllWindows();
2100 this->open_and_load(
2102 (DtMailBoolean) _create_mailbox_file,
2104 theRoamApp.unbusyAllWindows();
2106 // If there's been an error then we quit the container.
2107 if (mail_error.isSet())
2109 // Need to remove the base Widgets destroy callback since
2110 // we end up destroying it twice otherwise...
2111 XtRemoveAllCallbacks(this->baseWidget(), XmNdestroyCallback);
2115 // We need to disable the editable menu options if the mail
2118 if (_mailbox->mailBoxWritable(mail_error) == DTM_FALSE)
2120 _msg_delete->deactivate();
2121 _msg_undelete_last->deactivate();
2122 _msg_undelete_from_list->deactivate();
2123 _delete_button->deactivate();
2124 _file_destroy_deleted_msgs->deactivate();
2125 if (NULL != _move_cascade)
2126 XtSetSensitive(_move_cascade, FALSE);
2127 if (NULL != _msgsPopupMoveMenu)
2128 XtSetSensitive(_msgsPopupMoveMenu, FALSE);
2130 char * readonly = GETMSG(DT_catd, 20, 3, "Read Only");
2134 if (_list->get_num_messages())
2135 setIconName(NormalIcon);
2137 setIconName(EmptyIcon);
2142 // If the mailbox has messages, set to normal icon
2143 if (_list->get_num_messages() > 0)
2144 setIconName(NormalIcon);
2146 setIconName(EmptyIcon);
2151 RoamMenuWindow::last_sorted_by(SortBy type)
2154 char *buffer = NULL;
2156 DtMail::Session *m_session = theRoamApp.session()->session();
2157 DtMail::MailRc *mailrc = m_session->mailRc(error);
2159 _last_sorted_by = type;
2161 ((SortCmd*)_view_sortTD)->setButtonState(FALSE, FALSE);
2162 ((SortCmd*)_view_sortSender)->setButtonState(FALSE, FALSE);
2163 ((SortCmd*)_view_sortSubject)->setButtonState(FALSE, FALSE);
2164 ((SortCmd*)_view_sortSize)->setButtonState(FALSE, FALSE);
2165 ((SortCmd*)_view_sortStatus)->setButtonState(FALSE, FALSE);
2167 XtVaSetValues(_sender_lbl, XmNlabelString, _sender_xms, NULL);
2168 XtVaSetValues(_subject_lbl, XmNlabelString, _subject_xms, NULL);
2169 XtVaSetValues(_date_lbl, XmNlabelString, _date_xms, NULL);
2170 XtVaSetValues(_size_lbl, XmNlabelString, _size_xms, NULL);
2172 buffer = XtMalloc(BUFSIZ);
2177 RMW_CONCAT_MAILRC_KEY(buffer, DTMAS_INBOX, "sortby");
2181 RMW_CONCAT_MAILRC_KEY(buffer, mailboxName(), "sortby");
2185 switch (_last_sorted_by)
2188 XtVaSetValues(_date_lbl, XmNlabelString, _date_key_xms, NULL);
2189 ((SortCmd*)_view_sortTD)->setButtonState(TRUE,FALSE);
2190 if (buffer) mailrc->removeValue(error, buffer);
2193 XtVaSetValues(_sender_lbl, XmNlabelString, _sender_key_xms, NULL);
2194 ((SortCmd*)_view_sortSender)->setButtonState(TRUE,FALSE);
2195 sprintf(id, "%d", SortSender);
2196 if (buffer) mailrc->setValue(error, buffer, id);
2199 XtVaSetValues(_subject_lbl, XmNlabelString, _subject_key_xms, NULL);
2200 ((SortCmd*)_view_sortSubject)->setButtonState(TRUE,FALSE);
2201 sprintf(id, "%d", SortSubject);
2202 if (buffer) mailrc->setValue(error, buffer, id);
2205 XtVaSetValues(_size_lbl, XmNlabelString, _size_key_xms, NULL);
2206 ((SortCmd*)_view_sortSize)->setButtonState(TRUE,FALSE);
2207 sprintf(id, "%d", SortSize);
2208 if (buffer) mailrc->setValue(error, buffer, id);
2211 ((SortCmd*)_view_sortStatus)->setButtonState(TRUE,FALSE);
2212 sprintf(id, "%d", SortStatus);
2213 if (buffer) mailrc->setValue(error, buffer, id);
2216 XtVaSetValues(_date_lbl, XmNlabelString, _date_key_xms, NULL);
2217 ((SortCmd*)_view_sortTD)->setButtonState(TRUE,FALSE);
2218 if (buffer) mailrc->removeValue(error, buffer);
2221 if (buffer) XtFree(buffer);
2223 //_list->layoutLabels();
2224 mailrc->update(error);
2228 RoamMenuWindow::message( char *text )
2230 int text_size = strlen(text);
2234 if (text_size > 0) {
2235 str = GETMSG(DT_catd, 3, 12, "%s");
2236 buf = new char[strlen(str) + text_size + 1];
2237 sprintf(buf, str, text);
2238 labelStr = XmStringCreateLocalized(buf);
2239 _clear_message_p = TRUE;
2244 labelStr = XmStringCreateLocalized(buf);
2245 _clear_message_p = FALSE;
2248 XtVaSetValues(_message, XmNlabelString, labelStr, NULL);
2249 XmUpdateDisplay(this->baseWidget());
2251 XmStringFree(labelStr);
2256 RoamMenuWindow::setStatus(const char * msg)
2258 message((char *)msg);
2262 RoamMenuWindow::clearStatus(void)
2268 RoamMenuWindow::message_summary()
2270 this->message_summary(
2271 list()->selected_item_position(),
2272 list()->get_num_messages(),
2273 list()->get_num_new_messages(),
2274 list()->get_num_deleted_messages());
2278 RoamMenuWindow::message_summary(
2287 int num_live_msgs = num_msgs - num_deleted; // Undeleted msgs
2288 DtMail::MailRc * mailrc = get_mail_rc();
2290 const char * value = NULL;
2292 mailrc->getValue(error, "nerdmode", &value);
2293 if (error.isSet()) {
2294 str = GETMSG(DT_catd, 3, 13, "Message %d of %d, %d new, %d deleted");
2297 str = "Message 0x%x of 0x%x, ignoring 0x%x, 0x%x forgotten";
2300 free((void*) value);
2302 buf = new char[strlen(str) + 100];
2303 sprintf(buf, str, sel_pos, num_msgs, num_new, num_deleted);
2305 labelStr = XmStringCreateLocalized(buf);
2307 XtVaSetValues(_message_summary, XmNlabelString, labelStr, NULL);
2308 XmUpdateDisplay(this->baseWidget());
2310 XmStringFree(labelStr);
2315 RoamMenuWindow::message_selected(
2326 * The user will see the following message display as:
2327 * "Message 3 of 10, 2 new, 6 deleted"
2328 * This means ??? -- Explain to translator.
2330 str = GETMSG(DT_catd, 3, 14, "Message %d of %d, %d new, %d deleted");
2331 buf = new char[strlen(str) + 20];
2332 sprintf(buf, str, msg_num, num_msgs, num_new, num_deleted);
2334 labelStr = XmStringCreateLocalized(buf);
2336 XtVaSetValues(_message_summary, XmNlabelString, labelStr, NULL);
2337 XmUpdateDisplay(this->baseWidget());
2339 XmStringFree(labelStr);
2345 RoamMenuWindow::get_find_dialog()
2349 theRoamApp.busyAllWindows();
2350 // No find dialog. Create it
2351 _findDialog = new FindDialog(this);
2352 _findDialog->initialize();
2353 theRoamApp.unbusyAllWindows();
2357 _findDialog->manage();
2358 _findDialog->popup();
2363 RoamMenuWindow::quitWorkproc(XtPointer client_data)
2365 RoamMenuWindow *rmw = (RoamMenuWindow *) client_data;
2366 MailSession *ses = theRoamApp.session();
2367 static int called = 0;
2369 if (rmw->_numPendingTasks > 0)
2375 if (rmw->_quitWorkprocID != 0)
2377 XtRemoveWorkProc(rmw->_quitWorkprocID);
2378 rmw->_quitWorkprocID = 0;
2381 rmw->normalCursor();
2382 rmw->_genDialog->unmanage();
2385 if (rmw->_delete_on_quit)
2387 rmw->_list->shutdown();
2391 ses->deactivateRMW(rmw);
2393 theRoamApp.checkForShutdown();
2398 RoamMenuWindow::queryExpunge()
2404 if (NULL != _mailbox && _mailbox->mailBoxWritable(error) == DTM_TRUE)
2406 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2408 if (_list->get_num_deleted_messages())
2410 // We need to deal with deleted messages, based on what the
2411 // user wants to do. There are two properties that control
2414 // keepdeleted - Keep deleted messages on close.
2415 // quietdelete - Delete without asking.
2417 // If the user wants to keep the deleted messages, then we
2418 // can just blow by the second. If not, then we have to
2419 // clear the deleted messages, asking first based on the
2422 DtMail::MailRc * mailrc = get_mail_rc();
2423 const char * value = NULL;
2426 mailrc->getValue(error, "keepdeleted", &value);
2430 free((void*) value);
2432 // The user wants to expunge on close. See if they want
2433 // to be asked first.
2437 mailrc->getValue(error, "quietdelete", &value);
2438 if (error.isSet() && !theRoamApp.quitSilently())
2444 * This dialog comes up when the user tries to quit the
2445 * mailbox and the user is asked if he wants to destroy
2446 * the messages marked for deletion.
2449 * Messages 16 and 17 are no longer being used. They are
2450 * being replaced by message 86 and 87.
2452 _genDialog->setToQuestionDialog(
2454 GETMSG(DT_catd, 3, 16, "Mailer"),
2455 GETMSG(DT_catd, 3, 17, "Destroy the messages you have marked\nfor deletion in this mailbox?"));
2458 * This dialog comes up when the user tries to quit the
2459 * mailbox. The user is asked if they want to destroy
2460 * the deleted messages.
2462 GETMSG(DT_catd, 3, 87, "Mailer - Close"),
2463 GETMSG(DT_catd, 3, 88, "Destroy the deleted messages and close this mailbox?"));
2464 char * helpId = DTMAILHELPDESTROYMARKMSG;
2465 int answer = _genDialog->post_and_return(
2466 GETMSG(DT_catd, 3, 89, "Destroy and Close"),
2467 GETMSG(DT_catd, 3, 73, "Cancel"),
2468 GETMSG(DT_catd, 3, 90, "Retain and Close"),
2473 _mailbox->expunge(error);
2474 if ((DTMailError_t) error == DTME_OutOfSpace)
2477 (char *)error.getClient(),
2480 error.setClient(NULL);
2483 if (_msg_undelete_from_list->dialog())
2484 _msg_undelete_from_list->dialog()->expunge();
2488 postErrorDialog(error);
2490 else if (answer == 2)
2492 // This is a very bad way to code selection of the
2493 // cancel button. If someone changes its position
2494 // in the dialog, this code will break!
2495 theRoamApp.unbusyAllWindows();
2501 // If killed by a signal, don't post a dialog.
2503 _mailbox->expunge(error);
2504 if ((DTMailError_t) error == DTME_OutOfSpace)
2506 ShowErrMsg((char *)error.getClient(),FALSE,(void*)this );
2507 error.setClient(NULL);
2510 if (_msg_undelete_from_list->dialog())
2511 _msg_undelete_from_list->dialog()->expunge();
2515 if (! theRoamApp.quitSilently())
2516 postErrorDialog(error);
2520 free((void*) value);
2528 RoamMenuWindow::quit(Boolean delete_win)
2533 if (! queryExpunge())
2536 for (i = 0; i < _numDialogs; i++)
2537 _dialogs[i]->unmanage();
2539 XmUpdateDisplay(baseWidget());
2541 for (i = 0; i < _numDialogs; i++)
2542 _dialogs[i]->quit();
2544 theRoamApp.unbusyAllWindows();
2546 this->_delete_on_quit = delete_win;
2547 if (_numPendingTasks > 0)
2554 21, 22, "Close pending: waiting for task to terminate ...");
2557 if (_quitWorkprocID == 0)
2558 _quitWorkprocID = XtAppAddWorkProc(
2559 XtWidgetToApplicationContext(_w),
2560 &RoamMenuWindow::quitWorkproc,
2566 quitWorkproc((XtPointer) this);
2570 RoamMenuWindow::panicQuit()
2572 if (_mailbox != NULL)
2577 RoamMenuWindow::quit_silently()
2582 if (_mailbox->mailBoxWritable(error) == DTM_TRUE) {
2584 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2586 if (_list->get_num_deleted_messages()) {
2587 // We need to deal with deleted messages, based on what the
2588 // user wants to do. There are two properties that control
2591 // keepdeleted - Keep deleted messages on close.
2592 // quietdelete - Delete without asking.
2594 // If the user wants to keep the deleted messages, then we
2595 // can just blow by the second. If not, then we have to
2596 // clear the deleted messages, asking first based on the
2599 DtMail::MailRc * mailrc = get_mail_rc();
2600 const char * value = NULL;
2603 mailrc->getValue(error, "keepdeleted", &value);
2604 if (error.isSet()) {
2606 _mailbox->expunge(error);
2607 if (error.isSet()) {
2608 this->postErrorDialog(error);
2612 free((void*) value);
2617 for (i = 0; i < _numDialogs; i++) {
2618 _dialogs[i]->unmanage();
2621 XmUpdateDisplay(this->baseWidget());
2623 for (i = 0; i < _numDialogs; i++) {
2624 _dialogs[i]->quit();
2627 this->_delete_on_quit = FALSE;
2628 if (_numPendingTasks > 0)
2635 21, 22, "Close pending: waiting for task to terminate ...");
2638 if (_quitWorkprocID == 0)
2639 _quitWorkprocID = XtAppAddWorkProc(
2640 XtWidgetToApplicationContext(_w),
2641 &RoamMenuWindow::quitWorkproc,
2647 quitWorkproc((XtPointer) this);
2650 // Callback to open a new mail container.
2653 RoamMenuWindow::file_selection_callback(void *client_data, char *selection)
2655 if (NULL == selection || 0 == strlen(selection)) return;
2657 RoamMenuWindow *obj=(RoamMenuWindow *) client_data;
2658 obj->view_mail_file(selection, DTM_FALSE);
2663 void RoamMenuWindow::reopen_mail_file()
2667 theApplication->disableShutdown();
2669 filename = strdup(this->_mailbox_fullpath);
2672 view_mail_file(filename, DTM_FALSE);
2675 theApplication->enableShutdown();
2678 // Given the name of a container, create a new RoamMenuWindow
2679 // and open the container into it.
2681 void RoamMenuWindow::view_mail_file(char *filename, DtMailBoolean create)
2683 DtMailEnv mail_error;
2684 MailSession *ses = theRoamApp.session();
2685 DtMail::Session *d_session = ses->session();
2686 RoamMenuWindow *roamwin = NULL;
2687 char *expanded_filename = NULL;
2688 char *plus_filename = NULL;
2689 char *relative_filename = NULL;
2691 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 20, "Opening mailbox..."));
2693 // If the first character of destname is alphanumeric, we can
2694 // safely assume that it is relative to the root folder directory.
2695 // Prepend a '+' and call 'expandPath' to get the actual path.
2696 if (isalnum(filename[0]))
2698 plus_filename = (char *) malloc(strlen(filename)+2);
2699 sprintf(plus_filename, "+%s", filename);
2700 expanded_filename = d_session->expandPath(mail_error, plus_filename);
2701 free(plus_filename);
2704 expanded_filename = d_session->expandPath(mail_error, filename);
2706 // Check to see if the mbox is already open. If it is, we will
2707 // simply make sure it's displayed in the current workspace.
2708 if (ses->isMboxOpen(expanded_filename))
2710 roamwin = ses->getRMW(expanded_filename);
2711 ses->activateRMW(roamwin);
2712 if (NULL != roamwin) roamwin->displayInCurrentWorkspace();
2716 if (DTM_FALSE == create &&
2717 -1 == SafeAccess(expanded_filename, F_OK) &&
2720 char *buf = new char[2048];
2722 DtMailGenDialog *dialog = genDialog();
2726 GETMSG(DT_catd, 3, 3, "The mailbox %s does not exist.\nCreate a mailbox with this name?"),
2728 dialog->setToQuestionDialog(GETMSG(DT_catd, 3, 22, "Mailer"), buf);
2729 answer = dialog->post_and_return(DTMAILHELPERROR);
2731 if (2 == answer) goto do_unbusy;
2735 roamwin = new RoamMenuWindow(expanded_filename);
2736 roamwin->_create_mailbox_file = DTM_TRUE;
2737 roamwin->initialize();
2738 roamwin->mailboxFullpath(expanded_filename);
2739 roamwin->mailboxName(filename);
2743 free(expanded_filename);
2744 relative_filename = d_session->getRelativePath(mail_error, filename);
2745 theRoamApp.globalAddToCachedContainerList(relative_filename);
2746 free(relative_filename);
2749 theRoamApp.unbusyAllWindows();
2753 RoamMenuWindow::move_callback(void *client_data, char *selection)
2755 DtMailEnv mail_error;
2758 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
2760 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2761 obj->_mailbox->save();
2762 theRoamApp.unbusyAllWindows();
2764 obj->_list->copySelected(mail_error, selection, TRUE, FALSE);
2765 if (mail_error.isSet()) obj->postErrorDialog(mail_error);
2770 RoamMenuWindow::copy_callback(void *client_data, char *selection)
2772 DtMailEnv mail_error;
2775 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
2777 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2778 obj->_mailbox->save();
2779 theRoamApp.unbusyAllWindows();
2781 obj->_list->copySelected(mail_error, selection, FALSE, FALSE);
2782 if (mail_error.isSet()) obj->postErrorDialog(mail_error);
2787 RoamMenuWindow::create_container_callback(void *client_data, char *selection)
2789 RoamMenuWindow *obj = (RoamMenuWindow*) client_data;
2790 obj->create_new_container(selection);
2791 if (NULL != selection) XtFree(selection);
2795 RoamMenuWindow::create_new_container(char *filename)
2799 if (SafeAccess(filename, F_OK) == 0)
2801 char *buf = new char[2048];
2804 GETMSG(DT_catd, 3, 21, "%s already exists.\nOverwrite?"),
2806 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 22, "Mailer"), buf);
2807 answer = _genDialog->post_and_return(DTMAILHELPERROR);
2813 if (unlink(filename) < 0)
2816 GETMSG(DT_catd, 3, 23,
2817 "Unable to overwrite %s.\nCheck file permissions and retry."),
2820 _genDialog->setToErrorDialog(GETMSG(DT_catd, 3, 24, "Mailer"), buf);
2821 (void) _genDialog->post_and_return(DTMAILHELPERROR);
2828 // Path filename is ok -- now follow the same route as for Open
2829 this->view_mail_file(filename, DTM_TRUE);
2834 // SR - added methods below
2837 RoamMenuWindow::ifViewExists(DtMailMessageHandle msg_num)
2841 FORCE_SEGV_DECL(ViewMsgDialog, a_view);
2843 for (i = 0; i < _numDialogs; i++) {
2844 a_view = _dialogs[i];
2845 if (a_view->msgno() == msg_num) {
2854 RoamMenuWindow::addToRowOfButtons()
2856 FORCE_SEGV_DECL(CmdInterface, ci);
2857 Widget w, prev_widget;
2860 _delete_button = new DeleteCmd (
2862 GETMSG(DT_catd, 1, 9, "Delete"),
2864 ci = new ButtonInterface (_rowOfButtons, _delete_button);
2865 w = ci->baseWidget();
2866 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILDELBTNID);
2868 XmNleftAttachment, XmATTACH_FORM,
2869 XmNtopAttachment, XmATTACH_FORM,
2870 XmNbottomAttachment, XmATTACH_FORM,
2871 XmNmarginLeft, offset,
2872 XmNmarginRight, offset,
2877 _next_button = new NextCmd (
2879 GETMSG(DT_catd, 1, 10, "Next"),
2881 ci = new ButtonInterface (_rowOfButtons, _next_button);
2882 w = ci->baseWidget();
2883 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILNEXTBTNID);
2885 XmNleftAttachment, XmATTACH_WIDGET,
2886 XmNleftWidget, prev_widget,
2888 XmNtopAttachment, XmATTACH_FORM,
2889 XmNbottomAttachment, XmATTACH_FORM,
2890 XmNmarginLeft, offset,
2891 XmNmarginRight, offset,
2896 _previous_button = new PrevCmd (
2898 GETMSG(DT_catd, 1, 11, "Previous"),
2900 ci = new ButtonInterface (_rowOfButtons, _previous_button);
2901 w = ci->baseWidget();
2902 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPREVBTNID);
2904 XmNleftAttachment, XmATTACH_WIDGET,
2905 XmNleftWidget, prev_widget,
2907 XmNtopAttachment, XmATTACH_FORM,
2908 XmNbottomAttachment, XmATTACH_FORM,
2909 XmNmarginLeft, offset,
2910 XmNmarginRight, offset,
2915 _replySender_button = new ReplyCmd (
2917 GETMSG(DT_catd, 1, 12, "Reply to Sender"),
2921 ci = new ButtonInterface (_rowOfButtons, _replySender_button);
2922 w = ci->baseWidget();
2923 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILREPLYBTNID);
2925 XmNleftAttachment, XmATTACH_WIDGET,
2926 XmNleftWidget, prev_widget,
2928 XmNtopAttachment, XmATTACH_FORM,
2929 XmNbottomAttachment, XmATTACH_FORM,
2930 XmNmarginLeft, offset,
2931 XmNmarginRight, offset,
2937 _print_button = new PrintCmd ( "Print", GETMSG(DT_catd, 1, 13, "Print"),
2939 ci = new ButtonInterface (_rowOfButtons, _print_button);
2940 w = ci->baseWidget();
2941 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPRINTBTNID);
2943 XmNleftAttachment, XmATTACH_WIDGET,
2944 XmNleftWidget, prev_widget,
2946 XmNtopAttachment, XmATTACH_FORM,
2947 XmNbottomAttachment, XmATTACH_FORM,
2948 XmNmarginLeft, offset,
2949 XmNmarginRight, offset,
2956 RoamMenuWindow::addToRowOfLabels(MsgScrollingList *msglist)
2959 XmString arrow, basexms, spaces, spaces_arrow;
2960 char arrow_symbol[2];
2963 glyph_font = theRoamApp.glyphName();
2967 XmFontListEntry xmfle;
2968 XmFontList xmfl, xmfl_old;
2971 xfs = XLoadQueryFont(XtDisplay(_rowOfLabels), glyph_font);
2972 xmfle = XmFontListEntryCreate("arrow", XmFONT_IS_FONT, (XtPointer) xfs);
2974 lbl = XtVaCreateManagedWidget("t", xmLabelGadgetClass, _rowOfLabels, NULL);
2975 XtVaGetValues(lbl, XmNfontList, &xmfl_old, NULL);
2976 xmfl = XmFontListAppendEntry(xmfl_old, xmfle);
2978 // Pixel foreground, background;
2979 XmRenderTable rt, rt_old;
2984 // lbl = XtVaCreateManagedWidget("t", xmLabelGadgetClass, _rowOfLabels, NULL);
2987 // XmNrenderTable, &rt_old,
2988 // XmNforeground, &foreground,
2989 // XmNbackground, &background,
2992 // XtSetArg(args[nargs], XmNrenditionBackground, background); nargs++;
2993 // XtSetArg(args[nargs], XmNrenditionForeground, foreground); nargs++;
2994 // XtSetArg(args[nargs], XmNloadModel, XmLOAD_IMMEDIATE); nargs++;
2996 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
2997 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
2998 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3001 arrow_symbol[0] = (char) 209;
3002 arrow_symbol[1] = '\0';
3004 spaces = XmStringCreateLocalized(" ");
3005 arrow = XmStringCreate((char*) arrow_symbol, "arrow");
3006 spaces_arrow = XmStringConcat(spaces, arrow);
3008 XmStringFree(spaces);
3009 spaces = XmStringCreateLocalized(" ");
3011 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 14, "Sender"));
3012 _sender_xms = XmStringConcat(basexms, spaces);
3013 _sender_key_xms = XmStringConcat(basexms, spaces_arrow);
3014 XmStringFree(basexms);
3016 _sender_lbl = XtVaCreateManagedWidget(
3017 "Sender", xmLabelGadgetClass,
3023 XmNlabelString, _sender_xms,
3024 XmNalignment, XmALIGNMENT_BEGINNING,
3027 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3028 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3029 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3031 XtVaGetValues(_sender_lbl, XmNrenderTable, &rt_old, NULL);
3032 rt = XmRenderTableCopy(rt_old, NULL, 0);
3033 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3034 XtVaSetValues(_sender_lbl, XmNrenderTable, rt, NULL);
3036 // Add help callback
3037 // printHelpId("Sender", _sender_lbl);
3038 // XtAddCallback(_sender_lbl, XmNhelpCallback, HelpCB, helpId);
3040 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 15, "Subject"));
3041 _subject_xms = XmStringConcat(basexms, spaces);
3042 _subject_key_xms = XmStringConcat(basexms, spaces_arrow);
3043 XmStringFree(basexms);
3045 _subject_lbl = XtVaCreateManagedWidget(
3046 "Subject", xmLabelGadgetClass,
3052 XmNlabelString, _subject_xms,
3053 XmNalignment, XmALIGNMENT_BEGINNING,
3056 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3057 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3058 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3060 XtVaGetValues(_subject_lbl, XmNrenderTable, &rt_old, NULL);
3061 rt = XmRenderTableCopy(rt_old, NULL, 0);
3062 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3063 XtVaSetValues(_subject_lbl, XmNrenderTable, rt, NULL);
3065 // Add help callback
3066 // printHelpId("Subject", _subject_lbl);
3067 // XtAddCallback(_subject_lbl, XmNhelpCallback, HelpCB, helpId);
3069 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 16,"Date and Time"));
3070 _date_xms = XmStringConcat(basexms, spaces);
3071 _date_key_xms = XmStringConcat(basexms, spaces_arrow);
3072 XmStringFree(basexms);
3074 _date_lbl = XtVaCreateManagedWidget(
3075 "DateTime", xmLabelGadgetClass,
3081 XmNlabelString, _date_xms,
3082 XmNalignment, XmALIGNMENT_BEGINNING,
3085 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3086 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3087 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3089 XtVaGetValues(_date_lbl, XmNrenderTable, &rt_old, NULL);
3090 rt = XmRenderTableCopy(rt_old, NULL, 0);
3091 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3092 XtVaSetValues(_date_lbl, XmNrenderTable, rt, NULL);
3094 // Add help callback
3095 // printHelpId("DateTime", _subject_lbl);
3096 // XtAddCallback(_date_lbl, XmNhelpCallback, HelpCB, helpId);
3098 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 17, "Size"));
3099 _size_xms = XmStringConcat(basexms, spaces);
3100 _size_key_xms = XmStringConcat(basexms, spaces_arrow);
3101 XmStringFree(basexms);
3103 _size_lbl = XtVaCreateManagedWidget(
3104 "Size", xmLabelGadgetClass,
3110 XmNlabelString, _size_xms,
3111 XmNalignment, XmALIGNMENT_BEGINNING,
3114 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3115 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3116 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3118 XtVaGetValues(_size_lbl, XmNrenderTable, &rt_old, NULL);
3119 rt = XmRenderTableCopy(rt_old, NULL, 0);
3120 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3121 XtVaSetValues(_size_lbl, XmNrenderTable, rt, NULL);
3123 // Add help callback
3124 // printHelpId("Size", _size_lbl);
3125 // XtAddCallback(_size_lbl, XmNhelpCallback, HelpCB, helpId);
3127 // Adjust labels so the align on the columns
3128 msglist->layoutLabels(_sender_lbl, _subject_lbl, _date_lbl, _size_lbl);
3130 XmStringFree(arrow);
3131 XmStringFree(spaces);
3132 XmStringFree(spaces_arrow);
3137 RoamMenuWindow::addToRowOfMessageStatus()
3139 XmString labelStr1, labelStr2;
3141 // Size of first label
3143 labelStr1 = XmStringCreateLocalized(GETMSG(DT_catd, 3, 25,
3144 "Loading container..."));
3146 labelStr2 = XmStringCreateLocalized(
3147 GETMSG(DT_catd, 3, 26, "Folder Summary Information"));
3149 _message = XtCreateManagedWidget(
3150 "Message_Status_Text", xmLabelWidgetClass,
3151 _rowOfMessageStatus, NULL, 0);
3152 printHelpId("_message", _message);
3153 /* add help callback */
3154 // XtAddCallback(_message, XmNhelpCallback, HelpCB, helpId);
3157 XtVaSetValues(_message,
3158 XmNalignment, XmALIGNMENT_BEGINNING,
3159 XmNleftAttachment, XmATTACH_FORM,
3160 XmNtopAttachment, XmATTACH_FORM,
3161 XmNbottomAttachment, XmATTACH_FORM,
3162 XmNlabelString, labelStr1,
3165 _message_summary = XtCreateManagedWidget("Message_Summary",
3167 _rowOfMessageStatus, NULL, 0);
3168 XtVaSetValues(_message_summary,
3169 XmNalignment, XmALIGNMENT_END,
3170 XmNlabelString, labelStr2,
3171 XmNrightAttachment, XmATTACH_FORM,
3174 XtVaSetValues(_message,
3175 XmNrightAttachment, XmATTACH_WIDGET,
3176 XmNrightWidget, _message_summary,
3180 XmStringFree(labelStr1);
3181 XmStringFree(labelStr2);
3186 RoamMenuWindow::createContainerList()
3188 FORCE_SEGV_DECL(DtMail::Session, m_session);
3190 const char *val = NULL;
3191 const char *cached_containerlist_size = NULL;
3192 const char *display_cfs = NULL;
3193 DtMailBoolean user_list = DTM_FALSE;
3196 // Get names for permanent containers from .mailrc.
3197 // We get the items from the "filemenu2" variable.
3198 if (_filemenu2 != NULL) free (_filemenu2);
3200 m_session = theRoamApp.session()->session();
3201 m_session->mailRc(error)->getValue(error, "filemenu2", &val);
3202 if (error.isNotSet() && val != NULL && *val != '\0')
3204 user_list = DTM_TRUE;
3205 _filemenu2 = strdup(val);
3207 else _filemenu2 = NULL;
3212 // We will use _user_containerlist to keep track of the static set of
3213 // containers coming from the "filemenu2" value.
3214 // We will use _cached_containerlist to keep track of containers
3215 // which get cached from "Other Mailboxes... operations from the
3216 // Open, CopyTo, and Move menus.
3218 if (_user_containerlist != NULL)
3219 delete (_user_containerlist);
3220 _user_containerlist = new DtVirtArray<ContainerMenuCmd*> (3);
3222 m_session->mailRc(error)->getValue(
3224 "dontdisplaycachedfiles",
3227 if (error.isNotSet() && display_cfs != NULL)
3228 _max_cached_list_size = 0;
3232 m_session->mailRc(error)->getValue(
3234 "cachedfilemenusize",
3235 &cached_containerlist_size);
3236 if (error.isNotSet() &&
3237 cached_containerlist_size &&
3238 *cached_containerlist_size)
3239 _max_cached_list_size =
3240 (int) strtol(cached_containerlist_size, NULL, 10);
3242 _max_cached_list_size = 10;
3245 if (NULL != display_cfs)
3246 free((void*) display_cfs);
3247 if (NULL != cached_containerlist_size)
3248 free((void*) cached_containerlist_size);
3250 int size = (_max_cached_list_size ? _max_cached_list_size : 1);
3251 _cached_containerlist = new DtVirtArray<ContainerMenuCmd*> (size);
3253 if (user_list == DTM_TRUE) {
3254 char *expanded_list = m_session->expandPath(error, _filemenu2);
3258 // Create arrays to hold the user defined container list and the
3259 // recently visited (cached) container list.
3261 if ((token = (char *) strtok(expanded_list, " ")))
3263 ContainerMenuCmd *null_container;
3265 null_container= new ContainerMenuCmd(
3271 _user_containerlist->append(null_container);
3272 while (token = (char *) strtok(NULL, " "))
3274 null_container= new ContainerMenuCmd(
3280 _user_containerlist->append(null_container);
3283 free(expanded_list);
3286 if (_user_containerlist->length() > 0)
3287 _first_cached_item = _user_containerlist->length() +4;
3289 _first_cached_item = 3;
3293 RoamMenuWindow::createOpenContainerList(CmdList * open_container)
3296 char *container_name;
3297 ContainerMenuCmd *container_cmd;
3299 _open_container_separator = new SeparatorCmd("Separator","Separator", TRUE);
3301 _open_container_inbox = new OpenInboxCmd(
3303 GETMSG(DT_catd, 1, 221, "Inbox"),
3304 (FALSE == this->inbox()),
3307 _open_container_other = new UnifiedSelectMailboxCmd(
3309 GETMSG(DT_catd, 1, 246, "Other Mailboxes..."),
3310 GETMSG(DT_catd, 1, 26, "Mailer - Open"),
3311 GETMSG(DT_catd, 1, 27, "Open"),
3313 RoamMenuWindow::file_selection_callback,
3319 // We will use _open_container_containerlist to keep track of the
3320 // static set of OpenContainer commands coming from the "filemenu2"
3323 ncontainers = _user_containerlist->length();
3325 if (_open_container_containerlist != NULL)
3326 delete (_open_container_containerlist);
3327 _open_container_containerlist =
3328 new DtVirtArray<ContainerMenuCmd*>(ncontainers);
3330 for (i=0; i<ncontainers; i++)
3332 container_name = (*_user_containerlist)[i]->containerName();
3333 if (NULL != container_name)
3335 container_cmd = new ContainerMenuCmd(
3336 strdup(container_name),
3341 open_container->add(container_cmd);
3342 _open_container_containerlist->append(container_cmd);
3346 if (0 < ncontainers)
3347 open_container->add(_open_container_separator);
3348 open_container->add(_open_container_inbox);
3349 open_container->add(_open_container_other);
3350 open_container->add(_open_container_separator);
3353 // We will use _open_container_containerlist_cached
3354 // to keep track of OpenContainer which get cached from
3355 // "Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3358 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1);
3360 if (_open_container_containerlist_cached != NULL)
3361 delete (_open_container_containerlist_cached);
3362 _open_container_containerlist_cached =
3363 new DtVirtArray<ContainerMenuCmd*> (ncontainers);
3365 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
3366 for (i=0; i<ncontainers; i++)
3368 container_name = (*_cached_containerlist)[i]->containerName();
3369 if (NULL != container_name)
3371 container_cmd = new ContainerMenuCmd(
3372 strdup(container_name),
3377 open_container->add(container_cmd);
3378 _open_container_containerlist_cached->append(container_cmd);
3385 RoamMenuWindow::construct_file_menu()
3387 FORCE_SEGV_DECL(CmdList, cmdList);
3389 _file_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3391 // Create the "Container" item in the menubar. And fill
3392 // with items below the "Container" item in the menubar.
3394 cmdList = new CmdList( "Mailbox", GETMSG(DT_catd, 1, 18, "Mailbox") );
3395 _file_cmdlist = cmdList;
3397 _file_check_new_mail = new CheckForNewMailCmd(
3398 "Check for New Mail",
3399 GETMSG(DT_catd, 1, 19, "Check for New Mail"),
3402 if (this->inbox()) { // Deactivate the Open Inbox item
3403 _file_open_inbox = new OpenInboxCmd(
3405 GETMSG(DT_catd, 1, 20, "Open Inbox"),
3409 else { // Activate the Open Inbox item.
3410 _file_open_inbox = new OpenInboxCmd(
3412 GETMSG(DT_catd, 1, 21, "Open Inbox"),
3417 _file_new_container = new UnifiedSelectMailboxCmd(
3419 GETMSG(DT_catd, 1, 22, "New..."),
3420 GETMSG(DT_catd, 1, 23, "Mailer - New"),
3421 GETMSG(DT_catd, 1, 24, "New"),
3423 RoamMenuWindow::create_container_callback,
3427 #if defined(USE_OLD_FILE_OPEN)
3428 _file_open = new UnifiedSelectMailboxCmd(
3430 GETMSG(DT_catd, 1, 25, "Open..."),
3431 GETMSG(DT_catd, 1, 26, "Mailer - Open"),
3432 GETMSG(DT_catd, 1, 27, "Open"),
3434 RoamMenuWindow::file_selection_callback,
3436 this->baseWidget());
3439 _open_container_cmdlist = new CmdList(
3441 GETMSG(DT_catd, 1, 245, "Open"));
3442 createOpenContainerList(_open_container_cmdlist);
3444 _file_destroy_deleted_msgs = new DestroyCmd(
3445 "Destroy Deleted Message",
3446 GETMSG(DT_catd, 1, 28,
3447 "Destroy Deleted Messages"),
3452 _file_quit = new QuitCmd (
3454 GETMSG(DT_catd, 1, 29, "Close"),
3458 cmdList->add(_file_check_new_mail);
3459 cmdList->add(_file_open_inbox);
3460 cmdList->add(_file_separator);
3461 cmdList->add(_file_new_container);
3462 #if defined(USE_OLD_FILE_OPEN)
3463 cmdList->add(_file_open);
3465 cmdList->add(_open_container_cmdlist);
3466 cmdList->add(_file_separator);
3467 cmdList->add(_file_destroy_deleted_msgs);
3468 cmdList->add(theRoamApp.mailOptions());
3469 cmdList->add(_file_separator);
3470 cmdList->add(_file_quit);
3472 _menuBar->addCommands(&_file_cascade, cmdList);
3474 _opencontainerMenu = _open_container_cmdlist->getPaneWidget();
3478 XmNpacking, XmPACK_COLUMN,
3479 XmNorientation, XmVERTICAL,
3484 XmNmapCallback, &RoamMenuWindow::map_menu,
3487 XtSetSensitive(_opencontainerMenu, TRUE);
3491 RoamMenuWindow::createCopyList(CmdList * copy_to)
3494 char *container_name;
3495 ContainerMenuCmd *container_cmd;
3497 _copyto_separator = new SeparatorCmd("Separator","Separator", TRUE);
3499 _copyto_inbox = new CopyToInboxCmd(
3501 GETMSG(DT_catd, 1, 221, "Inbox"),
3505 // This is where we initialize _move_copy_button, so this needs to
3506 // be the first place that we use it. This routine needs to be
3507 // called before construct_move_menu(), which expects _move_copy_button
3508 // to be intialized.
3511 DtMail::Session * d_session = theRoamApp.session()->session();
3512 DtMail::MailRc * mailrc = d_session->mailRc(error);
3513 const char *value = NULL;
3514 DtMailBoolean only_show_mailboxes = DTM_FALSE;
3516 mailrc->getValue(error, "movecopytomailboxesonly", &value);
3517 only_show_mailboxes = (error.isSet()) ? DTM_FALSE : DTM_TRUE;
3519 value = strdup("15");
3523 free((void*) value);
3525 _move_copy_button = new MoveCopyCmd (
3526 "Other Mailboxes...",
3527 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3529 RoamMenuWindow::move_callback,
3530 RoamMenuWindow::copy_callback,
3533 only_show_mailboxes);
3534 _copyto_other = new CopyCmd(
3535 GETMSG(DT_catd, 1, 237, "Copy"),
3536 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3539 (MoveCopyCmd *) _move_copy_button);
3542 // We will use _copyto_containerlist to keep track of the
3543 // static set of CopyTo commands coming from the "filemenu2"
3546 ncontainers = _user_containerlist->length();
3548 if (_copyto_containerlist != NULL)
3549 delete (_copyto_containerlist);
3550 _copyto_containerlist =
3551 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3553 for (i=0; i<ncontainers; i++)
3555 container_name = (*_user_containerlist)[i]->containerName();
3556 if (NULL != container_name)
3558 container_cmd = new ContainerMenuCmd(
3559 strdup(container_name),
3564 copy_to->add(container_cmd);
3565 _copyto_containerlist->append(container_cmd);
3569 if (0 < ncontainers)
3570 copy_to->add(_copyto_separator);
3571 copy_to->add(_copyto_inbox);
3572 copy_to->add(_copyto_other);
3573 copy_to->add(_copyto_separator);
3576 // We will use _copyto_containerlist_cached
3577 // to keep track of CopyTo commands which get cached from
3578 //"Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3581 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1);
3583 if (_copyto_containerlist_cached != NULL)
3584 delete (_copyto_containerlist_cached);
3585 _copyto_containerlist_cached =
3586 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3588 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
3589 for (i=0; i<ncontainers; i++)
3591 container_name = (*_cached_containerlist)[i]->containerName();
3592 if (NULL != container_name)
3594 container_cmd = new ContainerMenuCmd(
3595 strdup(container_name),
3600 copy_to->add(container_cmd);
3601 _copyto_containerlist_cached->append(container_cmd);
3607 RoamMenuWindow::construct_message_menu()
3609 FORCE_SEGV_DECL(CmdList, cmdList);
3610 // Separator for menu items
3612 _msg_separator= new SeparatorCmd( "Separator","Separator", TRUE );
3614 _msg_open = new OpenMsgCmd(
3616 GETMSG(DT_catd, 1, 30, "Open"),
3619 _msg_save_as = new SaveAsTextCmd (
3621 GETMSG(DT_catd, 1, 31, "Save As Text..."),
3622 GETMSG(DT_catd, 1, 32, "Mailer - Message - Save As Text"),
3624 get_editor()->textEditor(),
3626 this->baseWidget());
3628 _copyto_cmdlist = new CmdList("Copy To", GETMSG(DT_catd, 1, 33, "Copy To"));
3629 createCopyList(_copyto_cmdlist);
3631 _msg_print = new PrintCmd(
3633 GETMSG(DT_catd, 1, 34, "Print..."),
3636 _msg_find = new FindCmd (
3638 GETMSG(DT_catd, 1, 35, "Find..."),
3641 _msg_select_all = new SelectAllCmd (
3643 GETMSG(DT_catd, 1, 36, "Select All"),
3646 _msg_delete = new DeleteCmd(
3648 GETMSG(DT_catd, 1, 37, "Delete"),
3651 _msg_undelete_last = new UndeleteCmd (
3653 GETMSG(DT_catd, 1, 38, "Undelete Last"),
3654 TRUE, this, FALSE );
3656 _msg_undelete_from_list = new UndeleteCmd(
3657 "Undelete From List...",
3658 GETMSG(DT_catd, 1, 39,
3659 "Undelete From List..."),
3664 cmdList = new CmdList( "Message", GETMSG(DT_catd, 1, 40, "Message") );
3665 _msg_cmdlist = cmdList;
3667 cmdList->add(_msg_open);
3668 cmdList->add(_msg_save_as);
3669 cmdList->add(_copyto_cmdlist);
3670 cmdList->add(_msg_print);
3671 cmdList->add(_msg_find);
3672 cmdList->add(_msg_select_all);
3674 cmdList->add(_msg_separator);
3676 cmdList->add(_msg_delete);
3677 cmdList->add(_msg_undelete_last);
3678 cmdList->add(_msg_undelete_from_list);
3680 _menuBar->addCommands(&_message_cascade, cmdList, FALSE, XmMENU_BAR);
3682 _copytoMenu = _copyto_cmdlist->getPaneWidget();
3684 XtVaSetValues(_copytoMenu,
3685 XmNpacking, XmPACK_COLUMN,
3686 XmNorientation, XmVERTICAL,
3689 XtAddCallback(_copytoMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
3691 XtSetSensitive(_copytoMenu, TRUE);
3695 RoamMenuWindow::construct_message_popup(void)
3697 _msgsPopup_cmdlist = new CmdList( "MsgsPopup", "MsgsPopup");
3699 LabelCmd *title = new LabelCmd (
3700 "Mailer - Messages",
3701 GETMSG(DT_catd, 1, 42, "Mailer - Messages"), TRUE);
3702 _msgsPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3703 _msgsPopup_cmdlist->add(title);
3704 _msgsPopup_cmdlist->add(_msgsPopup_separator);
3705 _msgsPopup_cmdlist->add(_msg_delete);
3706 _msgsPopup_cmdlist->add(_msg_undelete_last);
3707 _msgsPopup_cmdlist->add(_msg_print);
3708 _msgsPopup_cmdlist->add(_comp_replySender);
3709 _msgsPopup_cmdlist->add(_move_cmdlist);
3710 _msgsPopup_cmdlist->add(_msg_save_as);
3711 _msgsPopup_cmdlist->add(_file_check_new_mail);
3713 Widget parent = XtParent(_list->get_scrolling_list());
3714 _menuPopupMsgs = new MenuBar(parent, "RoamMsgsPopup", XmMENU_POPUP);
3715 _msgsPopupMenu = _menuPopupMsgs->addCommands(_msgsPopup_cmdlist,
3716 FALSE, XmMENU_POPUP);
3717 XtAddEventHandler(parent, ButtonPressMask,
3718 FALSE, MenuButtonHandler, (XtPointer) this);
3720 _msgsPopupMoveMenu = _move_cmdlist->getPaneWidget();
3722 XtVaSetValues(_msgsPopupMoveMenu,
3723 XmNpacking, XmPACK_COLUMN,
3724 XmNorientation, XmVERTICAL,
3726 XtAddCallback(_msgsPopupMoveMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
3728 XtSetSensitive(_msgsPopupMoveMenu, TRUE);
3733 RoamMenuWindow::construct_edit_menu()
3735 FORCE_SEGV_DECL(CmdList, cmdList);
3736 // Separator for menu items
3738 _edit_copy = new EditCopyCmd(
3740 GETMSG(DT_catd, 1, 43, "Copy"),
3745 _edit_select_all = new EditSelectAllCmd(
3747 GETMSG(DT_catd, 1, 44, "Select All"),
3752 cmdList = new CmdList("Edit", GETMSG(DT_catd, 1, 45, "Edit"));
3753 _edit_cmdlist = cmdList;
3755 cmdList->add(_edit_copy);
3756 cmdList->add(_edit_select_all);
3758 _menuBar->addCommands(cmdList);
3762 RoamMenuWindow::construct_text_popup(void)
3764 if (theApplication->bMenuButton() != Button3)
3767 _textPopup_cmdlist = new CmdList( "TextPopup", "TextPopup");
3769 LabelCmd *title = new LabelCmd (
3771 GETMSG(DT_catd, 1, 46, "Mailer - Text"), TRUE);
3772 _textPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3774 _textPopup_cmdlist->add(title);
3775 _textPopup_cmdlist->add(_textPopup_separator);
3776 _textPopup_cmdlist->add(_edit_copy);
3777 _textPopup_cmdlist->add(_edit_select_all);
3779 Widget parent = _my_editor->textEditor()->get_editor();
3780 _menuPopupText = new MenuBar(parent, "RoamTextPopup", XmMENU_POPUP);
3781 _textPopupMenu = _menuPopupText->addCommands(_textPopup_cmdlist,
3782 FALSE, XmMENU_POPUP);
3786 void RoamMenuWindow::construct_view_menu()
3788 FORCE_SEGV_DECL(CmdList, cmdList);
3789 FORCE_SEGV_DECL(CmdList, subCmdList);
3791 _view_separator= new SeparatorCmd("Separator","Separator",TRUE);
3793 _view_next = new NextCmd (
3795 GETMSG(DT_catd, 1, 47, "Next"), TRUE, this );
3796 _view_previous = new PrevCmd (
3798 GETMSG(DT_catd, 1, 48, "Previous"), TRUE, this );
3800 _view_abbrev_headers = new AbbrevHeadersCmd(
3801 "Abbreviated Headers",
3802 GETMSG(DT_catd, 1, 49, "Abbreviated Headers"),
3806 _view_sortTD = new SortCmd ("By Date/Time",
3807 GETMSG(DT_catd, 1, 50, "By Date/Time"),
3811 _view_sortSender = new SortCmd ("By Sender",
3812 GETMSG(DT_catd, 1, 51, "By Sender"),
3816 _view_sortSubject = new SortCmd ("By Subject",
3817 GETMSG(DT_catd, 1, 52, "By Subject"),
3821 _view_sortSize = new SortCmd ("By Size",
3822 GETMSG(DT_catd, 1, 53, "By Size"),
3826 _view_sortStatus = new SortCmd ("By Status",
3827 GETMSG(DT_catd, 1, 54, "By Status"),
3834 cmdList = new CmdList( "View", GETMSG(DT_catd, 1, 55, "View") );
3835 _view_cmdlist = cmdList;
3837 cmdList->add(_view_next);
3838 cmdList->add(_view_previous);
3839 cmdList->add(_view_separator);
3840 cmdList->add(_view_abbrev_headers);
3841 cmdList->add(_view_separator);
3842 cmdList->add(_view_sortTD);
3843 cmdList->add(_view_sortSender);
3844 cmdList->add(_view_sortSubject);
3845 cmdList->add(_view_sortSize);
3846 cmdList->add(_view_sortStatus);
3848 _menuBar->addCommands ( cmdList );
3853 RoamMenuWindow::construct_compose_menu()
3855 FORCE_SEGV_DECL(CmdList, cmdList);
3856 FORCE_SEGV_DECL(CmdList, subCmdList);
3858 // Separator for menu items
3860 _comp_separator= new SeparatorCmd( "Separator","Separator", TRUE );
3862 _comp_new = new ComposeCmd (
3864 GETMSG(DT_catd, 1, 56, "New Message"),
3867 _comp_new_include = new ForwardCmd (
3869 GETMSG(DT_catd, 1, 57, "New, Include All"),
3873 _comp_forward = new ForwardCmd (
3875 GETMSG(DT_catd, 1, 58, "Forward Message"),
3880 _comp_replySender = new ReplyCmd (
3882 GETMSG(DT_catd, 1, 59, "Reply to Sender"),
3887 _comp_replyAll = new ReplyAllCmd (
3889 GETMSG(DT_catd, 1, 60, "Reply to All"),
3894 _comp_replySinclude= new ReplyCmd (
3895 "Reply to Sender, Include",
3896 GETMSG(DT_catd, 1, 61, "Reply to Sender, Include"),
3901 _comp_replyAinclude= new ReplyAllCmd (
3902 "Reply to All, Include",
3903 GETMSG(DT_catd, 1, 62, "Reply to All, Include"),
3911 cmdList = new CmdList( "Compose", GETMSG(DT_catd, 1, 63, "Compose") );
3912 _comp_cmdlist = cmdList;
3913 cmdList->add(_comp_new);
3914 cmdList->add(_comp_new_include);
3915 cmdList->add(_comp_forward);
3916 cmdList->add(_comp_separator);
3917 cmdList->add(_comp_replySender);
3918 cmdList->add(_comp_replyAll);
3919 cmdList->add(_comp_replySinclude);
3920 cmdList->add(_comp_replyAinclude);
3922 _menuBar->addCommands ( cmdList );
3925 // construct_move_menu() builds the Move menu on the menu bar.
3926 // There is a user defined set of items at the top, the Inbox,
3927 // the "Mail Filing..." item, and a dynamic list of most recently
3928 // accessed containers at the bottom.
3931 RoamMenuWindow::construct_move_menu()
3934 char *container_name;
3935 ContainerMenuCmd *container_cmd;
3938 if (_move_cmdlist != NULL)
3939 delete _move_cmdlist;
3940 _move_cmdlist = new CmdList( "Move", GETMSG(DT_catd, 1, 64, "Move") );
3942 _move_separator = new SeparatorCmd("Separator","Separator", TRUE );
3944 _move_inbox = new MoveToInboxCmd(
3946 GETMSG(DT_catd, 1, 221, "Inbox"),
3950 // We expect _move_copy_button to have been initialized already when
3951 // we constructed the copy menu.
3952 _move_other = new MoveCmd(
3953 GETMSG(DT_catd, 1, 90, "Move"),
3954 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3957 (MoveCopyCmd *) _move_copy_button);
3960 // We will use _move_containerlist to keep track of the
3961 // static set of Move commands coming from the "filemenu2"
3964 ncontainers = _user_containerlist->length();
3966 if (_move_containerlist != NULL)
3967 delete _move_containerlist;
3968 _move_containerlist = new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3970 for (i=0; i<ncontainers; i++)
3972 container_name = (*_user_containerlist)[i]->containerName();
3973 if (NULL != container_name)
3975 container_cmd = new ContainerMenuCmd(
3976 strdup(container_name),
3981 _move_cmdlist->add(container_cmd);
3982 _move_containerlist->append(container_cmd);
3987 if (0 < ncontainers)
3988 _move_cmdlist->add(_move_separator);
3989 _move_cmdlist->add(_move_inbox);
3991 _move_cmdlist->add(_move_other);
3992 _move_cmdlist->add(_move_separator);
3995 // We will use _move_containerlist_cached
3996 // to keep track of Move commands which get cached from
3997 // "Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
4000 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1 );
4002 if (_move_containerlist_cached != NULL)
4003 delete _move_containerlist_cached;
4004 _move_containerlist_cached =
4005 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
4007 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
4008 for (i=0; i<ncontainers; i++)
4010 container_name = (*_cached_containerlist)[i]->containerName();
4011 if (NULL != container_name)
4013 container_cmd = new ContainerMenuCmd(
4014 strdup(container_name),
4019 _move_cmdlist->add(container_cmd);
4020 _move_containerlist_cached->append(container_cmd);
4025 _moveMenu = _menuBar->addCommands(
4026 &_move_cascade, _move_cmdlist,
4028 XtVaSetValues(_moveMenu,
4029 XmNpacking, XmPACK_COLUMN,
4030 XmNorientation, XmVERTICAL,
4032 XtAddCallback(_moveMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
4038 RoamMenuWindow::construct_attachment_menu()
4041 _att_save = new SaveAttachCmd (
4043 GETMSG(DT_catd, 1, 66, "Save As..."),
4044 GETMSG(DT_catd, 1, 67, "Mailer - Attachments - Save As"),
4046 RoamMenuWindow::save_attachment_callback,
4048 this->baseWidget());
4050 _att_select_all = new SelectAllAttachsCmd(
4053 DT_catd, 1, 68, "Select All"
4057 _att_cmdlist = new CmdList(
4064 _att_cmdlist->add(_att_save);
4065 _att_cmdlist->add(_att_select_all);
4067 // Create a pulldown from the items in the list. Retain a handle
4068 // to that pulldown since we need to dynamically add/delete entries
4069 // to this menu based on the selection of attachments.
4071 _attachmentMenu = _menuBar->addCommands(_att_cmdlist);
4075 RoamMenuWindow::construct_attachment_popup(void)
4077 _attPopup_cmdlist = new CmdList( "AttachmentsPopup", "AttachmentsPopup");
4079 LabelCmd *title = new LabelCmd (
4080 "Mailer - Attachments",
4081 GETMSG(DT_catd, 1, 70, "Mailer - Attachments"), TRUE);
4082 _attPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
4084 _attPopup_cmdlist->add(title);
4085 _attPopup_cmdlist->add(_attPopup_separator);
4086 _attPopup_cmdlist->add(_att_save);
4087 _attPopup_cmdlist->add(_att_select_all);
4088 _menuPopupAtt = new MenuBar(_my_editor->attachArea()->getClipWindow(),
4089 "RoamAttachmentPopup", XmMENU_POPUP);
4090 _attachmentPopupMenu = _menuPopupAtt->addCommands(_attPopup_cmdlist,
4091 FALSE, XmMENU_POPUP);
4095 RoamMenuWindow::construct_help_menu()
4097 FORCE_SEGV_DECL(CmdList, cmdList);
4099 // Separator for menu items
4101 _help_separator= new SeparatorCmd( "Separator","Separator", TRUE );
4102 _help_overview = new OnAppCmd("Overview", GETMSG(DT_catd, 1, 71, "Overview"),
4104 _help_tasks = new TasksCmd("Tasks", GETMSG(DT_catd, 1, 72, "Tasks"),
4106 _help_reference = new ReferenceCmd("Reference",
4107 GETMSG(DT_catd, 1, 73, "Reference"),
4109 _help_on_item = new OnItemCmd("On Item", GETMSG(DT_catd, 1, 74, "On Item"),
4111 _help_using_help = new UsingHelpCmd("Using Help",
4112 GETMSG(DT_catd, 1, 75, "Using Help"),
4114 cmdList = new CmdList( "Help", GETMSG(DT_catd, 1, 76, "Help") );
4115 _help_cmdlist = cmdList;
4117 cmdList->add ( _help_overview );
4118 cmdList->add ( _help_separator );
4119 cmdList->add ( _help_tasks );
4120 cmdList->add ( _help_reference );
4121 cmdList->add ( _help_separator );
4122 cmdList->add ( _help_on_item );
4123 cmdList->add ( _help_separator );
4124 cmdList->add ( _help_using_help );
4125 cmdList->add ( _help_separator );
4127 _help_about_mailer = new RelNoteCmd("About Mailer...",
4128 GETMSG(DT_catd, 1, 77, "About Mailer..."),
4130 cmdList->add ( _help_about_mailer );
4132 // Make help menu show up on right side of menubar.
4133 _menuBar->addCommands ( cmdList, TRUE );
4138 RoamMenuWindow::syncCachedContainerList(void)
4140 RoamMenuWindow *rmw = NULL;
4142 rmw = theRoamApp.nextRoamMenuWindow(NULL);
4146 // Sync the cached lists to an existing RoamMenuWindow.
4147 for (int i = rmw->_cached_containerlist->length(); i > 0; i--) {
4148 char *name = (*(rmw->_cached_containerlist))[i-1]->containerName();
4149 addToCachedContainerList(name);
4154 RoamMenuWindow::get_mail_rc()
4158 if (NULL == _mailbox) return NULL;
4159 return _mailbox->session()->mailRc(error);
4164 RoamMenuWindow::load_mailbox(
4165 DtMailEnv & mail_error
4170 // If there is no mailbox, return.
4176 // Now load the messages into the scrolling list.
4177 // This will get the DtMailMessageHandles into the _msgs array and
4178 // it will also get their XmStrings into the CharArray of the _list.
4179 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 27, "Loading..."));
4181 // Call load_headers() to get the XmStrings into the XmList!
4183 count = _list->load_headers(mail_error);
4185 if (mail_error.isSet()) {
4186 // Return whatever error mailbox->get_next_msg() returned.
4187 theRoamApp.unbusyAllWindows();
4194 this->message(GETMSG(DT_catd, 3, 28, "Empty container"));
4195 setIconName(EmptyIcon);
4198 _list->sort_messages();
4200 theRoamApp.unbusyAllWindows();
4204 RoamMenuWindow::clear_message()
4210 RoamMenuWindow::text_selected()
4213 // turn on sensitivity for Cut/Clear/Copy/Paste/Delete
4218 RoamMenuWindow::text_unselected()
4221 // turn off sensitivity for those items
4225 // syncViewAndStore() does the sync-ing of the view of a mail
4226 // container and the storage of that container.
4227 // This method gets invoked every time a message gets expunged
4228 // by the back end based on "timed delete".
4229 // The method needs to then remove the expunged message from the
4230 // deleted messages list, thereby syncing the view to be always
4231 // current with the storage.
4232 // Similarly, the method also gets invoked when the container store
4233 // has received new mail. The view then needs to be updated....
4237 RoamMenuWindow::syncViewAndStoreCallback(
4238 DtMailCallbackOp op,
4240 const char *, // prompt_hint
4249 va_start(args, client_data);
4250 RoamMenuWindow * rmw = (RoamMenuWindow *)client_data;
4252 bval = rmw->syncViewAndStore(op, path, args);
4257 RoamMenuWindow::syncViewAndStore(
4258 DtMailCallbackOp op,
4265 DtMailMessageHandle tmpMH;
4275 // New mail has come in. Load it in and update the
4276 // view's list of headers to also display it.
4278 tmpMH = va_arg(args, DtMailMessageHandle);
4279 this->_list->load_headers(error, tmpMH);
4281 newMailIndicators();
4285 case DTMC_DELETEMSG:
4287 // A message has been expunged from the store by the back end.
4288 // The expunge has been done based on "timed delete".
4289 // Remove the expunged message from the displayed list of
4295 errmsg = GETMSG(DT_catd, 1, 238, "Mailer is confused about the state of this mailbox.\nIt may be that another process has rewritten this mailbox in an unexpected way.\n\nSelecting OK will cause the Mailer to close and reopen the mailbox.\nNOTE that any changes made to the mailbox since the last save may be lost.");
4296 this->_genDialog->setToErrorDialog(
4297 GETMSG(DT_catd, 2, 10, "Mailer"),
4299 answer = this->_genDialog->post_and_return(
4300 GETMSG(DT_catd, 3, 29, "OK"),
4301 DTMAILHELPUNKNOWNSTATE);
4303 this->reopen_mail_file();
4308 case DTMC_ACCESSFAILED:
4310 errmsg = GETMSG(DT_catd, 1, 239, "Mailer can no longer access this mailbox.\nIt may be that another process has deleted the mailbox file.\n\nSelecting OK will cause the Mailer to close and reopen the mailbox.\nNOTE that any changes made to the mailbox since the last save may be lost.\n\nSelecting CANCEL will leave the mailbox unchanged.");
4311 this->_genDialog->setToErrorDialog(
4312 GETMSG(DT_catd, 2, 10, "Mailer"),
4314 answer = this->_genDialog->post_and_return(
4315 GETMSG(DT_catd, 3, 29, "OK"),
4316 GETMSG(DT_catd, 3, 19, "Cancel"),
4317 DTMAILHELPUNKNOWNSTATE);
4318 this->normalCursor();
4321 this->reopen_mail_file();
4328 case DTMC_SERVERPASSWORDNEEDED:
4331 char *buffer = new char[2048];
4332 char *errmsgarg = va_arg(args, char*);
4334 sprintf(buffer, "%s", errmsgarg);
4335 this->_genDialog->setToTextFieldDialog(
4336 GETMSG(DT_catd, 2, 10, "Mailer"),
4338 answer = this->_genDialog->post_and_return(
4339 GETMSG(DT_catd, 3, 29, "Ok"),
4340 GETMSG(DT_catd, 3, 19, "Cancel"),
4341 DTMAILHELPUNKNOWNSTATE);
4342 this->normalCursor();
4346 char *password = NULL;
4347 DtMailEnv mail_error;
4348 password = _genDialog->getTextFieldValue();
4349 _mailbox->updateMailRetrievalPassword(password);
4350 _mailbox->checkForMail(error);
4351 if (NULL != password) free(password);
4359 case DTMC_SERVERACCESSFAILED:
4362 char *buffer = new char[2048];
4363 char *errmsgarg = va_arg(args, char*);
4365 errmsg = GETMSG(DT_catd, 1, 256, "Mail server access failed:\n%s");
4367 sprintf(buffer, errmsg, errmsgarg);
4368 this->_genDialog->setToErrorDialog(
4369 GETMSG(DT_catd, 2, 10, "Mailer"),
4371 answer = this->_genDialog->post_and_return(
4372 GETMSG(DT_catd, 1, 257, "Options..."),
4373 GETMSG(DT_catd, 3, 19, "Cancel"),
4374 DTMAILHELPUNKNOWNSTATE);
4375 this->normalCursor();
4379 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4380 optCmd->displayMailRetrievalOptionsPane();
4388 case DTMC_GETMAILCOMMANDFAILED:
4391 char *buffer = new char[2048];
4392 char *errmsgarg = va_arg(args, char*);
4395 GETMSG(DT_catd, 1, 258, "User Getmail command failed:\n%s");
4397 sprintf(buffer, errmsg, errmsgarg);
4398 this->_genDialog->setToErrorDialog(
4399 GETMSG(DT_catd, 2, 10, "Mailer"),
4401 answer = this->_genDialog->post_and_return(
4402 GETMSG(DT_catd, 1, 257, "Options..."),
4403 GETMSG(DT_catd, 3, 19, "Cancel"),
4404 DTMAILHELPUNKNOWNSTATE);
4405 this->normalCursor();
4409 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4410 optCmd->displayMailRetrievalOptionsPane();
4418 case DTMC_SERVERACCESSINFO:
4421 char *infomsg = va_arg(args, char*);
4427 case DTMC_SERVERACCESSINFOERROR:
4430 char *buffer = new char[2048];
4431 char *errmsgarg = va_arg(args, char*);
4433 sprintf(buffer, "%s", errmsgarg);
4434 this->_genDialog->setToErrorDialog(
4435 GETMSG(DT_catd, 2, 10, "Mailer"),
4437 answer = this->_genDialog->post_and_return(
4438 GETMSG(DT_catd, 1, 257, "Options..."),
4439 GETMSG(DT_catd, 3, 19, "Cancel"),
4440 DTMAILHELPUNKNOWNSTATE);
4441 this->normalCursor();
4445 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4446 optCmd->displayMailRetrievalOptionsPane();
4454 case DTMC_INODECHANGED:
4456 errmsg = GETMSG(DT_catd, 1, 240, "Mailer can no longer access this mailbox.\nAnother process has rewritten the mailbox file changing the inode.\n\nSelecting OK will cause the Mailer to close and reopen the mailbox.\nNOTE that any changes made to the mailbox since the last save may be lost.\n\nSelecting CANCEL will leave the mailbox unchanged.");
4458 this->_genDialog->setToErrorDialog(
4459 GETMSG(DT_catd, 2, 10, "Mailer"),
4461 answer = this->_genDialog->post_and_return(
4462 GETMSG(DT_catd, 3, 29, "OK"),
4463 GETMSG(DT_catd, 3, 19, "Cancel"),
4464 DTMAILHELPUNKNOWNSTATE);
4465 this->normalCursor();
4468 this->reopen_mail_file();
4477 // We are asked to save changes and close the file.
4478 // The backend will take care of unlocking the file.
4479 this->quit_silently();
4482 case DTMC_QUERYLOCK:
4484 // The file is lock by another mailer.
4485 // Should we ask for the lock?
4486 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4487 GETMSG(DT_catd, 3, 82, "Someone else is using this mailbox.\nWould you like to demand exclusive access?"));
4488 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 18, "OK"),
4489 GETMSG(DT_catd, 3, 19, "Cancel"), DTMAILHELPTAKELOCK);
4491 this->normalCursor();
4500 // We are not able to obtain a TT lock on this folder,
4501 // ask user if he wants to open it as read only.
4502 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4503 GETMSG(DT_catd, 3, 83, "Mailer is unable to obtain exclusive access to this mailbox.\nWould you like to open this mailbox read-only?"));
4504 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 18, "OK"),
4505 GETMSG(DT_catd, 3, 19, "Cancel"),
4506 DTMAILHELPOPENREADONLY);
4507 this->normalCursor();
4514 case DTMC_READWRITEOVERRIDE:
4515 // We are not able to obtain a lock on this folder,
4516 // ask user if he wants to open it as read only.
4517 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4518 GETMSG(DT_catd, 3, 94, "Mailer is unable to obtain exclusive access to this\nmailbox because the system is not responding.\n\nFor this time only, you can choose to open this mailbox\nread-only, or to open it read-write without exclusive\naccess (use only if no one else is using this mailbox)."));
4519 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 95, "Read-only"),
4520 GETMSG(DT_catd, 3, 19, "Cancel"),
4521 GETMSG(DT_catd, 3, 96, "Read-Write"),
4522 DTMAILHELPOPENREADWRITEOVERRIDE);
4523 this->normalCursor();
4524 // Now the tricky part - since this method can only return
4525 // DTM_TRUE or DTM_FALSE, we must have a way to indicate "readOnly",
4526 // "readWrite" or "cancel" - horrid hack: readOnly is DTM_FALSE,
4527 // "readWrite" is DTM_TRUE, and "cancel" is (DTM_TRUE+DTM_FALSE)*2
4531 case 1: // Read-only
4533 case 3: // Read-Write
4536 return((DtMailBoolean)((DTM_FALSE+DTM_TRUE)*2));
4539 case DTMC_DOTDTMAILLOCKFAILED:
4542 char *buffer = new char[2048];
4543 char *lockpath = va_arg(args, char*);
4544 char *errormsg = va_arg(args, char*);
4545 char *cancel = GETMSG(DT_catd, 3, 19, "Cancel");
4546 char *ok = GETMSG(DT_catd, 3, 18, "OK");
4547 char *mailer = GETMSG(DT_catd, 3, 16, "Mailer");
4548 char *msgfmt = GETMSG(DT_catd, 3, 97, "%s\n\nThis may indicate that another Mailer has opened\n%s\n\nYou may open this mailbox READ ONLY by choosing '%s'.\n\nOtherwise, you may choose '%s',\nmake sure that another Mailer has not opened this mailbox,\ndelete %s,\nand reopen this mailbox.");
4550 // We are not able to obtain a .dtmail lock on this folder,
4551 // ask user if he wants to open it as read only.
4552 sprintf(buffer, msgfmt, errormsg, path, ok, cancel, lockpath);
4553 _genDialog->setToQuestionDialog(mailer, buffer);
4554 answer =_genDialog->post_and_return(ok, cancel, DTMAILHELPOPENREADONLY);
4555 this->normalCursor();
4565 this->normalCursor();
4569 this->normalCursor();
4573 // Convert the rfc file.
4574 // Commented out for PAR 5. Needs to be uncommented out for PAR 6
4578 RoamMenuWindow::convert(
4583 // Obsoleted when Bento went away
4586 // The back end uses the return value to either continue conversion or
4587 // to stop converting.
4590 RoamMenuWindow::ConvertStatusCB(
4597 RoamMenuWindow *rmw = (RoamMenuWindow *)client_data;
4599 // Return 0 if the conversion is still to proceed.
4600 // Return 1 if the conversion is to stop (e.g., if the user
4601 // has interrupted it...)
4603 return(rmw->showConversionStatus(current, total));
4607 RoamMenuWindow::showConversionStatus(
4613 int num_already_converted; // num msgs already converted as set prev.
4614 int previously_complete; // percent of converted msgs as set prev.
4615 int now_complete; // percent of converted messages based on parameters
4617 // Remember, the number set may differ from the previous call to
4618 // this method. We are not doing set_convert_data() for every call
4619 // to this method and so, what's set will differ from the previous
4620 // call to this method...
4622 num_already_converted = _convertContainerCmd->get_num_converted();
4623 previously_complete = num_already_converted * 100 / total;
4625 now_complete = current * 100 / total;
4627 if ((now_complete > (previously_complete + 5)) ||
4628 (now_complete == 100)) {
4629 str = GETMSG(DT_catd, 1, 79, "Converting... %d percent complete");
4630 // Estimate 4 characters for numbers and 1 null terminator.
4631 buf = new char[strlen(str) + 5];
4632 sprintf(buf, str, now_complete);
4634 _convertContainerCmd->updateDialog(buf);
4637 _convertContainerCmd->set_convert_data(current, total);
4640 _convertContainerCmd->updateAnimation();
4643 // Check and see if the user had interrupted the conversion
4644 // If the user had interrupted, we need to stop the back-end
4647 if (_convertContainerCmd->interrupted()) {
4657 RoamMenuWindow::conversionFinishedCallback(
4658 RoamInterruptibleCmd *,
4659 Boolean interrupted,
4664 // Do something only it the conversion really finished.
4665 // If it was interrupted, just return...
4668 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
4669 rmw->conversionFinished();
4673 // If the conversion finished successfully, then we try to open() again
4674 // and if no problems, load the headers into the scrolling list...
4677 RoamMenuWindow::conversionFinished()
4679 DtMailEnv mail_error;
4681 // Initialize the mail_error.
4684 mailboxFullpath(_convertContainerCmd->get_destination_name());
4686 this->open(mail_error,
4687 _openContainerCmd->_open_create_flag,
4688 _openContainerCmd->_open_lock_flag);
4690 // if the user had cancelled the open, then the RMW will not have
4691 // its mailbox set. Do not proceed to load the mailbox. Return.
4693 // Ideally, open() should set the mail_error if the user cancels
4694 // the open. And we should check the mail_error here...
4696 if (mail_error.isSet()) {
4700 this->load_mailbox(mail_error);
4702 if (mail_error.isSet()) {
4704 // Post a dialog indicating problems in loading...
4710 // Post the dialog displaying the error text.
4711 // Also display the minor_code, if resource/environment variable
4713 // User has no choice but to OK
4714 // postErrorDialog() is the benign uncle of postFatalErrorDialog() --
4715 // it does not quit the RMW.
4718 RoamMenuWindow::postErrorDialog(
4719 DtMailEnv &mail_error
4724 const char *text_str = (const char *)mail_error;
4726 // Assume that the char *text that comes in has already
4727 // been processed for i18n.
4729 _genDialog->setToErrorDialog(GETMSG(DT_catd, 2, 13, "Mailer"),
4732 helpId = DTMAILHELPERROR;
4733 int i = _genDialog->post_and_return(GETMSG(DT_catd, 3, 31, "OK"), helpId);
4742 RoamMenuWindow::manage()
4744 Dimension win_x, win_y, win_wid, win_ht, win_bwid;
4746 MainWindow::manage();
4747 XmUpdateDisplay(this->baseWidget());
4748 // Obtain the current dimensions of the RMW
4755 XmNborderWidth, &win_bwid,
4762 _border_width = win_bwid;
4767 RoamMenuWindow::expunge(void)
4772 // First order of business - busy out active windows
4774 theRoamApp.busyAllWindows(
4775 GETMSG(DT_catd, 3, 32, "Destroying deleted messages..."));
4777 // Before changing the state of any deleted/undeleted lists,
4778 // perform the destroy deleted operation and make sure that
4779 // it was successful - if there was an error, notify the user
4780 // and discontinue processing
4782 _mailbox->expunge(error);
4783 if((DTMailError_t) error == DTME_OutOfSpace )
4786 ShowErrMsg((char *)error.getClient(),FALSE,(void *)this );
4787 error.setClient(NULL);
4789 theRoamApp.unbusyAllWindows();
4793 if (error.isSet()) {
4794 // An error happened - must inform the user
4796 postErrorDialog(error);
4800 if (_msg_undelete_from_list->dialog())
4801 _msg_undelete_from_list->dialog()->expunge();
4806 // Last order of business - unbusy out active windows
4808 theRoamApp.unbusyAllWindows();
4812 RoamMenuWindow::attachment_selected()
4814 _att_save->activate();
4819 RoamMenuWindow::all_attachments_selected()
4821 _att_save->deactivate();
4823 if (_attActions_cmdlist != NULL) {
4824 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
4825 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
4826 _attActions_cmdlist);
4827 delete _attActions_cmdlist;
4828 _attActions_cmdlist = NULL;
4833 RoamMenuWindow::all_attachments_deselected()
4835 _att_save->deactivate();
4837 if (_attActions_cmdlist != NULL) {
4838 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
4839 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
4840 _attActions_cmdlist);
4841 delete _attActions_cmdlist;
4842 _attActions_cmdlist = NULL;
4847 RoamMenuWindow::activate_default_message_menu()
4850 _msg_open->activate();
4852 _msg_save_as->activate();
4854 XtSetSensitive(_copyto_cmdlist->getPaneWidget(), TRUE);
4856 _msg_print->activate();
4858 _msg_delete->activate();
4863 RoamMenuWindow::deactivate_default_message_menu()
4866 _msg_open->deactivate();
4868 _msg_save_as->deactivate();
4870 XtSetSensitive(_copyto_cmdlist->getPaneWidget(), FALSE);
4872 _msg_print->deactivate();
4874 _msg_delete->deactivate();
4879 RoamMenuWindow::activate_default_attach_menu()
4881 _att_select_all->activate();
4885 RoamMenuWindow::deactivate_default_attach_menu()
4887 _att_select_all->deactivate();
4891 RoamMenuWindow::newMailIndicators(void)
4893 // Set to new mail icon only if the window is iconified
4894 if (this->isIconified()) {
4895 setIconName(NewMailIcon);
4898 if ((_we_called_newmail == FALSE) || (this->isIconified())){
4900 // See if we are supposed to ring the bell.
4903 const char * val = NULL;
4904 DtMail::Session * m_session = theRoamApp.session()->session();
4905 m_session->mailRc(error)->getValue(error, "flash", &val);
4906 if (error.isNotSet()) {
4907 int flashes = (int) strtol(val, NULL, 10);
4914 m_session->mailRc(error)->getValue(error, "bell", &val);
4915 if (error.isNotSet()) {
4916 int beeps = (int) strtol(val, NULL, 10);
4918 XBell(XtDisplay(baseWidget()), 0);
4922 else // Default to 1 beep
4923 XBell(XtDisplay(baseWidget()), 0);
4929 m_session->mailRc(error)->getValue(error, "realsound", &val);
4930 if (error.isNotSet()) {
4932 if (SafeStat("/usr/bin/audioplay", &stat) == 0) {
4933 char *play_str = new char[1500];
4934 sprintf(play_str, "/usr/bin/audioplay %s", val);
4944 _we_called_newmail = FALSE;
4948 RoamMenuWindow::save_attachment_callback(
4954 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
4955 obj->save_selected_attachment(selection);
4959 RoamMenuWindow::save_selected_attachment(
4963 DtMailEnv mail_error;
4965 // Initialize the mail_error.
4968 DtMailEditor *editor = this->get_editor();
4969 AttachArea *attacharea = editor->attachArea();
4970 Attachment *attachment = attacharea->getSelectedAttachment();
4972 // Get selected attachment, if none selected, then return.
4973 if ( attachment == NULL ) {
4974 // Let User know that no attachment has been selected???
4976 char *helpId = NULL;
4979 _genDialog->setToErrorDialog(
4980 GETMSG(DT_catd, 1, 80, "Mailer"),
4981 GETMSG(DT_catd, 2, 14, "An attachment needs to be selected before issuing the\n\"Save As\" command to save to a file.") );
4982 helpId = DTMAILHELPSELECTATTACH;
4983 answer = _genDialog->post_and_return(
4984 GETMSG(DT_catd, 3, 33, "OK"), helpId );
4989 attachment->saveToFile(mail_error, selection);
4991 if (mail_error.isSet()) {
4998 RoamMenuWindow::addAttachmentActions(
5005 AttachmentActionCmd *attachActionCmd;
5007 if (_attActions_cmdlist == NULL) {
5008 _attActions_cmdlist = new CmdList("AttachmentActions", "AttachmentActions");
5011 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
5012 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
5013 _attActions_cmdlist);
5014 delete _attActions_cmdlist;
5015 _attActions_cmdlist = new CmdList("AttachmentActions", "AttachmentActions");
5019 for (i = 0; i < indx; i++) {
5020 anAction = actions[i];
5022 // Retrieve the localized action label
5023 actionLabel = DtActionLabel(anAction);
5024 attachActionCmd = new AttachmentActionCmd(
5029 _attActions_cmdlist->add(attachActionCmd);
5032 _attachmentMenu = _menuBar->addCommands(
5036 _attachmentPopupMenu = _menuPopupAtt->addCommands(
5037 _attachmentPopupMenu,
5043 RoamMenuWindow::removeAttachmentActions()
5046 // Stubbed out for now
5050 RoamMenuWindow::invokeAttachmentAction(
5055 DtMailEditor *editor = this->get_editor();
5056 AttachArea *attacharea = editor->attachArea();
5057 Attachment *attachment = attacharea->getSelectedAttachment();
5059 attachment->invokeAction(index);
5064 RoamMenuWindow::selectAllAttachments()
5067 DtMailEditor *editor = this->get_editor();
5068 AttachArea *attachArea = editor->attachArea();
5070 attachArea->selectAllAttachments();
5074 // Returns the index of the match, -1 if there is no match.
5076 RoamMenuWindow::inList(char *filename, DtVirtArray<ContainerMenuCmd *> *list)
5078 ContainerMenuCmd *cmd;
5080 if (list == NULL) return(-1);
5089 DtMail::Session * d_session = theRoamApp.session()->session();
5091 DtMail::MailRc * mailrc = d_session->mailRc(error);
5092 const char *value = NULL;
5095 mailrc->getValue(error, "folder", &value);
5096 if (error.isNotSet())
5098 newname = (char*)malloc(strlen(filename) + strlen(value) + 2);
5099 sprintf(newname, "%s/%s", value, filename);
5100 for (int i=0; i < list->length(); i++)
5103 if (strcmp(newname, cmd->containerName()) == 0) {
5108 free((void*) newname);
5112 free((void*) value);
5115 for (int i=0; i < list->length(); i++)
5118 if (strcmp(filename, cmd->containerName()) == 0)
5126 RoamMenuWindow::addToCachedContainerList(char *filename)
5129 ContainerMenuCmd *null_container, *open_container;
5130 ContainerMenuCmd *move_container, *copy_container;
5133 if (filename != NULL &&
5134 *filename != '\0' &&
5135 (_max_cached_list_size > 0))
5137 DtMail::Session *d_session = theRoamApp.session()->session();
5138 DtMailObjectSpace space;
5139 DtMailEnv mail_error;
5141 char *mail_file = NULL;
5143 // Is the file in the user defined list?
5144 if ((index = inList(filename, _user_containerlist)) != -1)
5147 d_session->queryImpl(
5149 d_session->getDefaultImpl(mail_error),
5150 DtMailCapabilityInboxName,
5154 is_inbox = (0 == strcmp(mail_file, filename));
5155 if (NULL != mail_file)
5156 free((void*) mail_file);
5160 // Is the file in the recently used list?
5161 if ((index = inList(filename, _cached_containerlist)) != -1)
5163 // Move filename to top of list and move everything else down.
5164 if (index == 0) return;
5167 // Change the filenames that each of the Cmds points to in both
5168 // the move and copy cached lists.
5170 name = (*_cached_containerlist)[index]->containerName();
5172 for (i = index; i > 0; i--) {
5173 char *s = (*_cached_containerlist)[i-1]->containerName();
5175 (*_cached_containerlist)[i]->changeContainer(s);
5176 (*_open_container_containerlist_cached)[i]->changeContainer(s);
5177 (*_copyto_containerlist_cached)[i]->changeContainer(s);
5178 (*_move_containerlist_cached)[i]->changeContainer(s);
5181 (*_cached_containerlist)[0]->changeContainer(name);
5182 (*_open_container_containerlist_cached)[0]->changeContainer(name);
5183 (*_copyto_containerlist_cached)[0]->changeContainer(name);
5184 (*_move_containerlist_cached)[0]->changeContainer(name);
5187 // Rename the labels in the menu.
5189 if (_first_cached_item != _first_cached_item + index)
5191 _menuBar->rotateLabels(
5194 _first_cached_item + index);
5195 _menuBar->rotateLabels(
5198 _first_cached_item + index);
5199 _menuBar->rotateLabels(
5202 _first_cached_item + index);
5203 _menuBar->rotateLabels(
5206 _first_cached_item + index);
5211 // Add filename to Recently Used List.
5212 int cached_list_size = _cached_containerlist->length();
5214 // Is there room for the menu to grow?
5215 if (cached_list_size < _max_cached_list_size)
5217 // Create the new command.
5218 null_container = new ContainerMenuCmd(strdup(filename),
5223 open_container = new ContainerMenuCmd(strdup(filename),
5228 copy_container = new ContainerMenuCmd(strdup(filename),
5233 move_container = new ContainerMenuCmd(strdup(filename),
5239 // Add it to the end of the arrays.
5240 _cached_containerlist->append(null_container);
5241 _open_container_containerlist_cached->append(open_container);
5242 _copyto_containerlist_cached->append(copy_container);
5243 _move_containerlist_cached->append(move_container);
5245 // Add it to the end of the menus.
5246 _menuBar->addCommand(_opencontainerMenu, open_container);
5247 _menuBar->addCommand(_copytoMenu, copy_container);
5248 _menuBar->addCommand(_moveMenu, move_container);
5249 _menuBar->addCommand(_msgsPopupMoveMenu, move_container);
5251 // Recursively call addToCachedContainerList to rotate to top.
5252 cached_list_size = _cached_containerlist->length();
5253 if (cached_list_size > 1)
5254 addToCachedContainerList(filename);
5258 // Add new entry to the bottom of the cache.
5259 int i = cached_list_size-1;
5262 // Replace the end of the arrays.
5263 (*_cached_containerlist)[i]->changeContainer(strdup(s));
5264 (*_open_container_containerlist_cached)[i]->changeContainer(
5266 (*_copyto_containerlist_cached)[i]->changeContainer(strdup(s));
5267 (*_move_containerlist_cached)[i]->changeContainer(strdup(s));
5269 // Replace the end of the menus.
5270 i += _first_cached_item;
5271 _menuBar->changeLabel(_opencontainerMenu, i, s);
5272 _menuBar->changeLabel(_copytoMenu, i, s);
5273 _menuBar->changeLabel(_moveMenu, i, s);
5274 _menuBar->changeLabel(_msgsPopupMoveMenu, i, s);
5276 // Recursively call addToCachedContainerList to rotate to top.
5277 if (_first_cached_item != i)
5278 addToCachedContainerList(filename);
5285 RoamMenuWindow::showAttachArea()
5287 DtMailEditor *editor = this->get_editor();
5288 editor->showAttachArea();
5292 RoamMenuWindow::hideAttachArea()
5294 DtMailEditor *editor = this->get_editor();
5295 editor->hideAttachArea();
5299 RoamMenuWindow::fullHeader(
5303 DtMailMessageHandle msgHandle;
5304 DtMailEnv mail_error;
5306 // Initialize the mail_error.
5309 _full_header_resource = state;
5311 msgHandle = this->list()->current_msg_handle();
5313 this->list()->display_message(mail_error, msgHandle);
5319 RoamMenuWindow::postMsgsPopup(XEvent *event)
5321 XmMenuPosition(_msgsPopupMenu, (XButtonEvent *)event);
5322 XtManageChild(_msgsPopupMenu);
5326 RoamMenuWindow::MenuButtonHandler(
5332 RoamMenuWindow *obj = (RoamMenuWindow *)cd;
5334 if(event->xany.type != ButtonPress)
5337 XButtonEvent *be = (XButtonEvent *)event;
5339 if(be->button == theApplication->bMenuButton())
5340 obj->postMsgsPopup(event);
5344 RoamMenuWindow::attachmentFeedback(
5352 this->normalCursor();
5356 // map_menu is used to figure out how many columns to split the menu
5357 // into. It is a callback that is called when the menu is mapped.
5358 // If the menu is over half the height of the screen, it figures out
5359 // how many columns to make the menu, and sets its XmNnumColumns
5360 // attribute to that value. It calculates the maximum number of columns
5361 // that would fit and never goes beyond that number.
5364 RoamMenuWindow::map_menu(
5371 short maxcols, newcols, columns;
5372 int screenheight = HeightOfScreen(XtScreen(menu));
5373 int fudgefact = 20; /* to allow for decorations on menu */
5379 XmNnumColumns, &columns,
5383 if ((int) (h + fudgefact) > ((int) screenheight / 2)) {
5385 /* the menu is taller than half the screen. We need to find out how
5386 many more columns to specify for the menu to make it fit. */
5388 newcols = (columns * (int) ((int) (h + fudgefact)/(int) (screenheight/2))) + 1;
5389 maxcols = WidthOfScreen(XtScreen(menu))/(int) ((int)w/(int)columns);
5391 if (newcols > maxcols)
5394 XtVaSetValues(menu, XmNnumColumns, newcols, NULL);
5403 RoamMenuWindow::setTitle(char *suffix)
5405 DtMailEnv mail_error;
5406 MailSession *ses = theRoamApp.session();
5407 DtMail::Session *d_session = ses->session();
5408 char *prefix = GETMSG(DT_catd, 1, 6, "Mailer");
5414 if (mailbox_fullpath())
5415 path = d_session->getRelativePath(mail_error, mailbox_fullpath());
5416 else if (mailboxName())
5417 path = d_session->getRelativePath(mail_error, mailboxName());
5418 else path = strdup("UNTITLED");
5422 format = "%s - %s [%s]";
5423 len = strlen(format) + strlen(prefix) + strlen(path) + strlen(suffix);
5424 new_title = new char[len];
5425 sprintf(new_title, format, prefix, path, suffix);
5430 len = strlen(format) + strlen(prefix) + strlen(path);
5431 new_title = new char[len];
5432 sprintf(new_title, format, prefix, path);
5436 delete [] new_title;
5441 RoamMenuWindow::setVacationTitle()
5443 // Add "[Vacation]" to the title of the roam menu window
5444 char *vacation = GETMSG(DT_catd, 1, 3, "Vacation");
5449 RoamMenuWindow::removeVacationTitle()
5451 // Reset the title on the roam menu window; take out "[Vacation]"
5456 RoamMenuWindow::ShowErrMsg(char * fsname,Boolean compose,void *client_data)
5459 assert((NULL != fsname));
5462 RoamMenuWindow * self = (RoamMenuWindow *)client_data;
5463 parent = self->GetMainWin();
5467 SendMsgDialog * self = (SendMsgDialog *)client_data;
5468 parent = self->GetMainWin();
5471 parent = theApplication->baseWidget();
5472 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog",parent,XmDIALOG_FULL_APPLICATION_MODAL);
5474 char *errMsg = (char *) XtCalloc(1,10240+strlen(fsname));
5477 // Serious error here -- No Space on Filesystem --
5478 sprintf(errMsg,"Insufficient space on %s filesystem. Dtmail unable to show any new \n messages, delete messages, or save further changes to the open \n mailbox. Please contact your System Administrator to correct the \n filesystem space problem.",fsname);
5480 genDialog->setToErrorDialog(
5481 GETMSG(DT_catd, 1, 6, "Mailer"),
5485 genDialog->post_and_return(
5486 GETMSG(DT_catd, 3, 9, "OK"),
5491 RoamMenuWindow::stopAutoSave(void)
5494 _mailbox->startAutoSave(error,DTM_FALSE);
5497 RoamMenuWindow::startAutoSave(void)
5500 _mailbox->startAutoSave(error,DTM_TRUE);
5504 RoamMenuWindow::sync_work_area_size(void)
5506 Dimension width, height;
5508 XtVaGetValues(_workArea, XmNwidth, &width, XmNheight, &height, NULL);
5510 if (_workarea_width && _workarea_height &&
5511 (_workarea_width!=width || _workarea_height!=height))
5513 enableWorkAreaResize();
5514 XtVaSetValues(_workArea, XmNwidth, width, XmNheight, height, NULL);
5515 disableWorkAreaResize();
5517 _workarea_width = width;
5518 _workarea_height = height;