2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
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>
78 #include <sys/utsname.h>
80 #include <sys/systeminfo.h>
83 #include <X11/Intrinsic.h>
84 #include <X11/cursorfont.h>
88 #include <Xm/RepType.h>
89 #include <Xm/PanedW.h>
91 #include <Xm/RowColumn.h>
93 #include <Xm/LabelG.h>
97 #include <DtMail/DtMailTypes.h>
98 #include <DtMail/IO.hh>
99 #include "SelectFileCmd.h"
100 #include "RoamMenuWindow.h"
102 #include "ButtonInterface.h"
103 #include "WorkingDialogManager.h"
105 #include "QuestionDialogManager.h"
106 #endif /* DEAD_WOOD */
107 #include "MemUtils.hh"
109 #include "DtMailHelp.hh"
111 #include "SendMsgDialog.h"
112 #include "AttachArea.h"
113 #include "Attachment.h"
115 #include <DtMail/OptCmd.h>
116 #include "ComposeCmds.hh"
117 #include "EUSDebug.hh"
119 #include "SortCmd.hh"
121 extern int force( Widget );
123 static const char * NormalIcon = "DtMail";
124 static const char * EmptyIcon = "DtMnone";
125 static const char * NewMailIcon = "DtMnew";
126 static const char * MailDragIcon = "DtMmsg";
128 extern nl_catd DtMailMsgCat;
129 #define MAXIMUM_PATH_LENGTH 2048
131 #define RMW_CONCAT_MAILRC_KEY(buf, pfx, key) \
132 { if (NULL==(pfx)) (void) sprintf((buf), "%s", (key)); \
133 else (void) sprintf((buf), "%s_%s", (pfx), (key)); }
136 RoamMenuWindow:: _supported[] =
138 "TARGETS", "MESSAGES", "STRING", "DELETE"
140 enum {TARGETS,MESSAGES, STR, DEL};
143 RoamMenuWindow::_resources[] =
150 XtOffset ( RoamMenuWindow *, _full_header_resource ),
160 XtOffset ( RoamMenuWindow *, _mailbox_name_resource ),
170 XtOffset ( RoamMenuWindow *, _mail_files_resource ),
178 // We need to maintain a constant WM_CLASS_NAME for SQE test
179 // suites to run consistently for all RMWs. We do that by
180 // maintaining a constant "name", as in WM_CLASS_NAME, for all
181 // RMWs by passing "dtmail" to a RMW's parent
182 // at creation time. We distinguish individual RMWs via the
183 // title which indicates what mail container they are currently
184 // looking at. The title is passed here as name; its dynamic
185 // (i.e., each RMW has its own "name", as in WM_NAME).
186 // If you are going to change the name, talk to SQE
187 // and get their consent for whatever change you are making.
189 // Note also that the name chosen must match whatever is specified
190 // in dtwm.fp (front panel configuration file) as the CLIENT_NAME
191 // for the Mail CONTROL. This is so PUSH_RECALL works.
192 // Typically this is the executable name.
194 RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
196 DtMailEnv mail_error;
198 // Initialize mail_error.
201 // Get a handle to the Inbox.
202 char *mail_file = NULL;
203 DtMailObjectSpace space;
204 DtMail::Session *d_session = theRoamApp.session()->session();
205 DtMail::MailRc *mailrc = d_session->mailRc(mail_error);
206 const char *value = NULL;
209 _forward_filename = NULL;
210 // Set the _mailbox_name here.
211 // In the absence of the RMW's title being set via title(),
212 // the _mailbox_name is what will be used in initialize().
213 _mailbox_name = NULL;
218 _mailbox_fullpath = NULL;
220 _mailbox_name_resource = NULL;
221 _mail_files_resource = NULL;
222 _full_header_resource = FALSE;
224 _required_conversion = FALSE;
225 _checkformail_when_mapped = FALSE;
226 _delete_on_quit = FALSE;
227 _we_called_newmail = FALSE;
236 _display_cached_list = FALSE;
237 _max_cached_list_size = 0;
238 _first_cached_item = 0;
239 _user_containerlist = NULL;
240 _cached_containerlist = NULL;
246 _file_cmdlist = NULL;
247 _file_separator = NULL;
248 _file_check_new_mail = NULL;
249 _file_open_inbox = NULL;
250 _file_new_container = NULL;
252 _file_destroy_deleted_msgs = NULL;
255 _file_cascade = NULL;
258 // OpenContainer Cascade Menu
260 _open_container_cmdlist = NULL;
261 _open_container_separator = NULL;
262 _open_container_inbox = NULL;
263 _open_container_other = NULL;
265 _open_container_containerlist = NULL;
266 _open_container_containerlist_cached = NULL;
267 _opencontainerMenu = NULL;
273 _msg_separator = NULL;
278 _msg_select_all = NULL;
280 _msg_undelete_last = NULL;
281 _msg_undelete_from_list = NULL;
285 // CopyTo Cascade Menu
287 _copyto_cmdlist = NULL;
288 _copyto_separator = NULL;
289 _copyto_inbox = NULL;
290 _copyto_other = NULL;
292 _copyto_containerlist = NULL;
293 _copyto_containerlist_cached = NULL;
295 _message_cascade = NULL;
301 _edit_cmdlist = NULL;
303 _edit_select_all = NULL;
311 _att_select_all = NULL;
316 _view_cmdlist = NULL;
317 _view_separator = NULL;
319 _view_previous = NULL;
320 _view_abbrev_headers = NULL;
322 _view_sortSender = NULL;
323 _view_sortSubject = NULL;
324 _view_sortSize = NULL;
325 _view_sortStatus = NULL;
330 _comp_cmdlist = NULL;
331 _comp_separator = NULL;
333 _comp_new_include = NULL;
334 _comp_forward = NULL;
335 _comp_replySender = NULL;
336 _comp_replyAll = NULL;
337 _comp_replySinclude = NULL;
338 _comp_replyAinclude = NULL;
344 _move_cmdlist = NULL;
345 _move_separator = NULL;
349 _move_containerlist = NULL;
350 _move_containerlist_cached = NULL;
352 _move_cascade = NULL;
356 _help_cmdlist = NULL;
357 _help_separator = NULL;
358 _help_overview = NULL;
360 _help_reference = NULL;
361 _help_on_item = NULL;
362 _help_using_help = NULL;
363 _help_about_mailer = NULL;
368 _msgsPopup_cmdlist = NULL;
369 _msgsPopup_separator = NULL;
371 _menuPopupMsgs = NULL;
372 _msgsPopupMenu = NULL;
373 _msgsPopupMoveMenu = NULL;
378 _textPopup_cmdlist = NULL;
379 _textPopup_separator = NULL;
384 _attPopup_cmdlist = NULL;
385 _attPopup_separator = NULL;
386 _attActions_cmdlist = NULL;
388 _attachmentMenu = NULL;
391 // ConvertContainerCmd
393 _convertContainerCmd = NULL;
394 _openContainerCmd = NULL;
397 // Message view pane buttons
399 _delete_button = NULL;
401 _previous_button = NULL;
402 _replySender_button = NULL;
403 _print_button = NULL;
404 _move_copy_button = NULL;
408 d_session->queryImpl(mail_error,
409 d_session->getDefaultImpl(mail_error),
410 DtMailCapabilityInboxName,
413 if (strcmp(mail_file, mailboxName()) == 0)
418 free((void*)mail_file);
424 // Initialize private variables
431 _message_summary = NULL;
433 _rowOfButtons = NULL;
434 _rowOfMessageStatus = NULL;
437 _clear_message_p = FALSE;
441 buffer = XtMalloc(BUFSIZ);
446 RMW_CONCAT_MAILRC_KEY(buffer, DTMAS_INBOX, "sortby");
450 RMW_CONCAT_MAILRC_KEY(buffer, mailboxName(), "sortby");
455 mailrc->getValue(mail_error, buffer, &value);
456 if (mail_error.isSet() || NULL == value)
457 _last_sorted_by = SortTimeDate;
459 _last_sorted_by = (SortBy) atoi(value);
466 RoamMenuWindow::~RoamMenuWindow()
471 theRoamApp.session()->close(error, _mailbox);
473 // Cannot return error to caller since there's
474 // no caller. What do we do?
478 if (NULL != _forward_filename)
479 free(_forward_filename);
481 free((void*) _mailbox_name);
482 if (_mailbox_fullpath)
483 free((void*) _mailbox_fullpath);
485 if (NULL != _dialogs)
487 if (NULL != _findDialog)
492 if (NULL != _user_containerlist)
493 delete _user_containerlist;
494 if (NULL != _cached_containerlist)
495 delete _cached_containerlist;
496 if (NULL != _filemenu2)
497 free((void*) _filemenu2);
500 delete _file_cmdlist;
501 delete _file_separator;
502 delete _file_check_new_mail;
503 delete _file_open_inbox;
504 delete _file_new_container;
505 #if defined(USE_OLD_FILE_OPEN)
508 delete _file_destroy_deleted_msgs;
511 // OpenContainer Cascade Menu
512 delete _open_container_cmdlist;
513 delete _open_container_separator;
514 delete _open_container_inbox;
515 delete _open_container_other;
517 if (NULL != _open_container_containerlist)
518 delete _open_container_containerlist;
519 if (NULL != _open_container_containerlist_cached)
520 delete _open_container_containerlist_cached;
525 delete _msg_separator;
531 delete _msg_undelete_last;
532 delete _msg_undelete_from_list;
534 // CopyTo Cascade Menu
535 delete _copyto_cmdlist;
536 delete _copyto_separator;
537 delete _copyto_inbox;
538 delete _copyto_other;
540 if (NULL != _copyto_containerlist)
541 delete _copyto_containerlist;
542 if (NULL != _copyto_containerlist_cached)
543 delete _copyto_containerlist_cached;
546 delete _edit_cmdlist;
548 delete _edit_select_all;
553 delete _att_select_all;
556 delete _view_cmdlist;
557 delete _view_separator;
559 delete _view_previous;
560 delete _view_abbrev_headers;
562 delete _view_sortSender;
563 delete _view_sortSubject;
564 delete _view_sortSize;
565 delete _view_sortStatus;
568 delete _comp_cmdlist;
569 delete _comp_separator;
571 delete _comp_new_include;
572 delete _comp_forward;
573 delete _comp_replySender;
574 delete _comp_replyAll;
575 delete _comp_replySinclude;
576 delete _comp_replyAinclude;
579 delete _move_cmdlist;
580 delete _move_separator;
584 if (NULL != _move_containerlist)
585 delete _move_containerlist;
586 if (NULL != _move_containerlist_cached)
587 delete _move_containerlist_cached;
590 delete _help_separator;
591 delete _help_cmdlist;
592 delete _help_overview;
594 delete _help_reference;
595 delete _help_on_item;
596 delete _help_using_help;
597 delete _help_about_mailer;
600 delete _msgsPopup_cmdlist;
601 delete _msgsPopup_separator;
603 delete _menuPopupMsgs;
606 delete _textPopup_cmdlist;
607 delete _textPopup_separator;
610 delete _attPopup_cmdlist;
611 delete _attPopup_separator;
612 delete _attActions_cmdlist;
614 // ConvertContainerCmd
615 delete _convertContainerCmd;
616 delete _openContainerCmd;
618 // Message view pane buttons
619 delete _delete_button;
621 delete _previous_button;
622 delete _replySender_button;
623 delete _print_button;
624 delete _move_copy_button;
636 XmDestroyPixmap(XtScreen(baseWidget()), _mbox_image);
638 XmDestroyPixmap(XtScreen(baseWidget()), _mbox_mask);
643 RoamMenuWindow::initialize()
645 XmRepTypeInstallTearOffModelConverter();
646 MenuWindow::initialize();
648 if (!this->baseWidget())
652 GETMSG(DT_catd, 2, 3,
653 "Unable to initialize windows. Exiting.\n"));
658 setStatus(GETMSG(DT_catd, 3, 2, "Initializing..."));
660 // XInternAtom(XtDisplay(this->baseWidget()) ,"STRING", False);
661 // XInternAtom(XtDisplay(this->baseWidget()) ,"MESSAGES", False);
662 getResources(_resources, XtNumber(_resources));
663 if (_mailbox_name_resource) mailboxName(_mailbox_name_resource);
665 // Mailbox image & mask
667 Screen *screen = XtScreen(baseWidget());
670 sprintf(icon_name, "%s.m", MailDragIcon);
671 _mbox_image = XmGetPixmap(screen, icon_name,
672 BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
674 sprintf(icon_name, "%s.m_m.bm", MailDragIcon);
675 _mbox_mask = XmGetPixmapByDepth(screen, icon_name, 1, 0, 1);
677 if (_mbox_image == XmUNSPECIFIED_PIXMAP ||
678 _mbox_mask == XmUNSPECIFIED_PIXMAP)
679 _mbox_image = _mbox_mask = 0;
682 // Add an event handler for structureNotify.
683 // This EH will handle exposure, configure notifies ...
685 this->baseWidget(), StructureNotifyMask, False,
686 (XtEventHandler) &RoamMenuWindow::structurenotify,
689 _convertContainerCmd = new ConvertContainerCmd(
693 _openContainerCmd = new OpenContainerCmd(
697 _genDialog = new DtMailGenDialog("Dialog", _main);
698 setIconName(NormalIcon);
702 RoamMenuWindow::inbox()
708 RoamMenuWindow::createWorkArea(Widget parent)
710 Widget form1, panedW;
712 Dimension x, y, width, height, bwid;
713 VacationCmd *vacation_cmd = theRoamApp.vacation();
715 form1 = XmCreateForm(parent, "Work_Area", NULL, 0);
716 XtVaSetValues(form1, XmNresizePolicy, XmRESIZE_NONE, NULL);
718 printHelpId("form1", form1);
719 /* add help callback */
720 // XtAddCallback(form1, XmNhelpCallback, HelpCB, helpId);
721 XtAddCallback(form1, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWID);
723 panedW = XtCreateManagedWidget("panedW", xmPanedWindowWidgetClass,
725 printHelpId ("panedW", panedW);
726 /* add help callback */
727 // XtAddCallback(panedW, XmNhelpCallback, HelpCB, helpId);
729 XtVaSetValues(panedW,
730 XmNrightAttachment,XmATTACH_FORM,
731 XmNleftAttachment,XmATTACH_FORM,
732 XmNtopAttachment,XmATTACH_FORM,
733 XmNbottomAttachment, XmATTACH_FORM,
740 form2 = XtCreateManagedWidget("form2", xmFormWidgetClass, panedW, NULL, 0);
741 XtVaSetValues(form2, XmNallowResize, True, NULL);
742 printHelpId ("form2", form2);
743 /* add help callback */
744 // XtAddCallback(form2, XmNhelpCallback, HelpCB, helpId);
747 XtCreateManagedWidget("RowOfLabels", xmFormWidgetClass, form2, NULL, 0);
749 printHelpId("rowOfLabels", _rowOfLabels);
750 /* add help callback */
751 // XtAddCallback(_rowOfLabels, XmNhelpCallback, HelpCB, helpId);
753 _rowOfLabels, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWROWOFLABELSID);
755 XtVaSetValues(_rowOfLabels,
756 XmNrightAttachment,XmATTACH_FORM,
757 XmNleftAttachment,XmATTACH_FORM,
758 XmNtopAttachment,XmATTACH_FORM,
760 XmNorientation, XmHORIZONTAL,
763 XmNentryAlignment, XmALIGNMENT_CENTER,
766 _list = new MsgScrollingList( this, form2, "Message_List");
770 DtMail::Session *d_session = theRoamApp.session()->session();
771 DtMail::MailRc *mailrc = d_session->mailRc(error);
772 const char *value = NULL;
775 this->addToRowOfLabels(_list);
777 // See if the header size has changed.
779 mailrc->getValue(error, "headerlines", &value);
780 if (error.isSet()) value = strdup("15");
782 int header_lines = (int) strtol(value, NULL, 10);
783 _list->visibleItems(header_lines);
787 _list->get_scrolling_list(), XmNhelpCallback,
788 HelpCB, (void *)DTMAILMSGLISTID);
790 XtVaSetValues(_list->get_scrolling_list(), XmNuserData, this, NULL);
792 XtCreateManagedWidget("RowColumn", xmFormWidgetClass, form2, NULL, 0);
793 printHelpId ("rowOfButtons", _rowOfButtons);
795 // XtAddCallback(_rowOfButtons, XmNhelpCallback, HelpCB, helpId);
798 // Place it closer to the scrolling list than to the text widget
800 XtVaSetValues(XtParent(_list->get_scrolling_list()),
801 XmNrightAttachment,XmATTACH_FORM,
802 XmNleftAttachment,XmATTACH_FORM,
803 XmNtopAttachment,XmATTACH_WIDGET,
804 XmNtopWidget, _rowOfLabels,
806 XmNbottomAttachment, XmATTACH_WIDGET,
807 XmNbottomWidget, _rowOfButtons,
811 XtVaSetValues(_rowOfButtons,
812 XmNrightAttachment,XmATTACH_FORM,
813 XmNleftAttachment,XmATTACH_FORM,
814 XmNbottomAttachment, XmATTACH_FORM,
818 this->addToRowOfButtons();
820 form3 = XtCreateManagedWidget("form3", xmFormWidgetClass, panedW, NULL, 0);
821 XtVaSetValues(form3, XmNallowResize, True, NULL);
822 printHelpId ("form3", form3);
824 // XtAddCallback(form3, XmNhelpCallback, HelpCB, helpId);
828 XmNrightAttachment,XmATTACH_FORM,
829 XmNleftAttachment,XmATTACH_FORM,
830 XmNtopAttachment,XmATTACH_FORM,
834 _rowOfMessageStatus =
835 XtCreateManagedWidget("Message_Status", xmFormWidgetClass, form3, NULL,0);
837 XtVaSetValues(_rowOfMessageStatus,
838 XmNrightAttachment,XmATTACH_FORM,
839 XmNleftAttachment,XmATTACH_FORM,
840 XmNtopAttachment,XmATTACH_FORM,
844 this->addToRowOfMessageStatus();
846 _my_editor = new DtMailEditor(form3, this);
847 _my_editor->initialize();
848 _my_editor->attachArea()->setOwnerShell(this);
850 // DtMailEditor contains a widget that contains the textEditor and
851 // attachArea. Get that widget...
853 Widget wid = _my_editor->container();
855 printHelpId ("wid", wid);
856 /* add help callback */
857 // XtAddCallback(wid, XmNhelpCallback, HelpCB, helpId);
860 XmNrightAttachment,XmATTACH_FORM,
861 XmNleftAttachment,XmATTACH_FORM,
862 XmNtopAttachment,XmATTACH_WIDGET,
863 XmNtopWidget, _rowOfMessageStatus,
864 XmNbottomAttachment, XmATTACH_FORM,
867 DtMailEnv mail_error;
869 // Initialize the mail_error.
871 mailboxFullpath(mailboxName());
873 // Set the appShell's title to be _mailbox_fullpath
874 if (vacation_cmd != NULL && vacation_cmd->priorVacationRunning())
879 // Set the icon name to the folder name. Extract foldername from full path.
880 char *fname = strrchr(_mailbox_fullpath, '/');
882 setIconTitle(_mailbox_fullpath);
885 // Extract the filename from it.
890 XtManageChild(_list->baseWidget());
891 XtManageChild(form1);
894 mailrc->getValue(error, "retrieveinterval", &value);
895 if (error.isNotSet() && value && *value != '\0')
897 long ping = (time_t) strtol(value, NULL, 10);
899 _checkformail_when_mapped = FALSE;
901 _checkformail_when_mapped = TRUE;
904 if (NULL != value) free((void*) value);
911 XmNborderWidth, &bwid,
917 _border_width = bwid;
921 // This routine is just a place holder callback to pass when creating
922 // a mailbox when we doing want to do anything when the mailbox gets
937 // msgListTransferCallback
939 // Handles the transfer of data that is dragged and dropped to the
940 // MsgScrollingList. Files and buffers are transferred by inserting
941 // them as messages into the scrolling list.
944 RoamMenuWindow::msgListTransferCallback(
946 XtPointer clientData,
949 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
950 DtDndTransferCallbackStruct *transferInfo =
951 (DtDndTransferCallbackStruct *) callData;
952 DtDndContext *dropData = transferInfo->dropData;
955 DtMail::MailBox *mbox, *tmpmbox;
956 DtMailEnv mail_error;
957 MailSession *session = theRoamApp.session();
959 DebugPrintf(3, "In RoamMenuWindow::msgListTransferCallback\n");
961 // Initialize the mail_error.
964 numItems = dropData->numItems;
966 switch (dropData->protocol) {
967 case DtDND_FILENAME_TRANSFER:
969 // Loop through the files that were dropped onto the msg list
971 for (ii = 0; ii < numItems; ii++) {
973 // Try to open the file as a mail container.
974 filepath = dropData->data.files[ii];
975 tmpmbox = session->open(
976 mail_error, filepath,
977 &RoamMenuWindow::syncViewAndStoreCallback,
978 rmw, DTM_FALSE, DTM_TRUE);
980 // Reject the drop if we weren't able to open the file.
981 if (!tmpmbox || mail_error.isSet()) {
982 transferInfo->status = DtDND_FAILURE;
985 // We were able to open the container, so now we get the
986 // current mailbox and copy all the messages into it.
987 mbox = rmw->mailbox();
988 mbox->copyMailBox(mail_error, tmpmbox);
989 rmw->checkForMail(mail_error);
995 case DtDND_BUFFER_TRANSFER:
997 // Loop through the buffers that were dropped onto the msg list
999 for (ii = 0; ii < numItems; ii++) {
1001 // Turn the dropped data into a mail buffer to pass to
1002 // the mailbox constructor.
1004 buf.buffer = (char *) transferInfo->dropData->data.buffers->bp;
1005 buf.size = transferInfo->dropData->data.buffers->size;
1007 // Convert the buffer into a mailbox object.
1008 tmpmbox = session->session()->mailBoxConstruct(mail_error,
1009 DtMailBufferObject, &buf,
1010 openCallback, NULL);
1012 // Reject the drop if we weren't able to convert it to a mailbox
1013 if (!tmpmbox || mail_error.isSet()) {
1014 transferInfo->status = DtDND_FAILURE;
1017 // Parse the dropped data into the tmpmbox.
1018 tmpmbox->open(mail_error);
1019 if (mail_error.isSet()) {
1020 transferInfo->status = DtDND_FAILURE;
1024 mbox = rmw->mailbox();
1025 mbox->copyMailBox(mail_error, tmpmbox);
1026 rmw->checkForMail(mail_error);
1033 transferInfo->status = DtDND_FAILURE;
1038 // msgListDropRegister
1040 // Register the message list to accept file & buffer drops
1043 RoamMenuWindow::msgListDropRegister()
1045 static XtCallbackRec transferCBRec[] = {
1046 {&RoamMenuWindow::msgListTransferCallback, NULL}, {NULL, NULL} };
1048 // Pass the RoamMenuWindow object (this) as clientData.
1049 transferCBRec[0].closure = this;
1051 DtDndVaDropRegister(_list->get_scrolling_list(),
1052 DtDND_FILENAME_TRANSFER | DtDND_BUFFER_TRANSFER,
1053 (unsigned char)(XmDROP_MOVE | XmDROP_COPY), transferCBRec,
1054 DtNtextIsBuffer, True,
1058 // msgListDropEnable
1060 // Enable the message list for drops by restoring the operation
1063 RoamMenuWindow::msgListDropEnable()
1067 XtSetArg(args[0], XmNdropSiteOperations, XmDROP_MOVE | XmDROP_COPY);
1068 XmDropSiteUpdate(_list->get_scrolling_list(), args, 1);
1071 // msgListDropDisable
1073 // Disable the message list for drops by setting the operation to noop
1076 RoamMenuWindow::msgListDropDisable()
1080 XtSetArg(args[0], XmNdropSiteOperations, XmDROP_NOOP);
1081 XmDropSiteUpdate(_list->get_scrolling_list(), args, 1);
1085 // msgListConvertCallback
1087 // Provide the msg list as a mailbox for the drag
1090 RoamMenuWindow::msgListConvertCallback(
1091 Widget /* dragContext */,
1092 XtPointer clientData,
1095 DtDndConvertCallbackStruct *convertInfo =
1096 (DtDndConvertCallbackStruct *) callData;
1097 DtDndBuffer *buffer = &(convertInfo->dragData->data.buffers[0]);
1098 RoamMenuWindow *rmw = (RoamMenuWindow *)clientData;
1099 MsgScrollingList *msgList;
1101 DtMail::MailBox *mbox;
1102 DtMail::Message *msg;
1103 DtMailMessageHandle msgHandle;
1104 DtMailBuffer *mbufList;
1105 int *pos_list, pos_count, ii;
1106 unsigned long bufSize = 0;
1110 DebugPrintf(3, "In RoamMenuWindow:msgListConvertCallback\n");
1114 switch (convertInfo->reason) {
1115 case DtCR_DND_CONVERT_DATA:
1117 msgList = rmw->list();
1118 listW = msgList->get_scrolling_list();
1119 mbox = rmw->mailbox();
1121 if (!XmListGetSelectedPos(listW, &pos_list, &pos_count)) {
1122 convertInfo->status = DtDND_FAILURE;
1126 mbufList = (DtMailBuffer*)XtMalloc(pos_count*sizeof(DtMailBuffer));
1128 for (ii = 0; ii < pos_count; ii++) {
1129 msgHandle = msgList->msgno(pos_list[ii]);
1130 msg = mbox->getMessage(error, msgHandle);
1131 if (error.isSet()) {
1132 convertInfo->status = DtDND_FAILURE;
1135 msg->toBuffer(error, mbufList[ii]);
1136 if (error.isSet()) {
1137 convertInfo->status = DtDND_FAILURE;
1140 bufSize += mbufList[ii].size + 1;
1143 bufPtr = XtMalloc((unsigned int)bufSize);
1145 buffer->bp = bufPtr;
1146 buffer->size = (int)bufSize;
1147 buffer->name = "Mailbox";
1149 for (ii = 0; ii < pos_count; ii++) {
1150 strncpy(bufPtr, (char *)mbufList[ii].buffer,
1151 (unsigned int)mbufList[ii].size);
1152 bufPtr += mbufList[ii].size;
1155 delete mbufList[ii].buffer;
1158 XtFree((char *)mbufList);
1159 XtFree((char *)pos_list);
1162 case DtCR_DND_CONVERT_DELETE:
1163 // The drag and drop succeeded, so we can now delete the messages
1164 // from the scrolling list.
1165 rmw->list()->deleteSelected();
1170 // msgListDragFinishCallback
1172 // Clean up from the convert callback and restore state
1175 RoamMenuWindow::msgListDragFinishCallback(
1176 Widget /* widget */,
1177 XtPointer clientData,
1180 DtDndDragFinishCallbackStruct *finishInfo =
1181 (DtDndDragFinishCallbackStruct *) callData;
1182 DtDndContext *dragData = finishInfo->dragData;
1183 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
1184 MsgScrollingList *msgList = rmw->list();
1185 DtMailEnv mail_error;
1188 DebugPrintf(3, "In RoamMenuWindow::msgListDragFinishCallback\n");
1192 // Re-enable drops on this message list
1193 if (rmw->mailbox()->mailBoxWritable(mail_error) == DTM_TRUE) {
1194 rmw->msgListDropEnable();
1197 if (finishInfo->sourceIcon)
1198 XtDestroyWidget(finishInfo->sourceIcon);
1200 // Free any memory allocated for the drag.
1201 for (ii = 0; ii < dragData->numItems; ii++) {
1202 XtFree((char *)dragData->data.buffers[ii].bp);
1209 // Use the mailbox pixmap to create a drag icon
1212 RoamMenuWindow::getDragIcon(
1215 if (_mbox_image && _mbox_mask) {
1216 return DtDndCreateSourceIcon(widget, _mbox_image, _mbox_mask);
1224 // Translation start a drag from the msg list
1227 RoamMenuWindow::msgListDragStart(
1230 String * /* params */,
1231 Cardinal * /* numParams */)
1233 static XtCallbackRec convertCBRec[] = {
1234 {&RoamMenuWindow::msgListConvertCallback, NULL},{NULL, NULL} };
1235 static XtCallbackRec dragFinishCBRec[] = {
1236 {&RoamMenuWindow::msgListDragFinishCallback, NULL}, {NULL, NULL} };
1237 RoamMenuWindow *rmw = NULL;
1238 unsigned char operations;
1240 DtMailEnv mail_error;
1242 DebugPrintf(3, "In RoamMenuWindow::msgListProcessDrag\n");
1246 XtVaGetValues(widget, XmNuserData, &rmw, NULL);
1251 drag_icon = rmw->getDragIcon(widget);
1254 rmw->msgListDropDisable();
1256 // Choose the drag operations based on the writeability of the mailbox
1258 if (rmw->mailbox()->mailBoxWritable(mail_error) == DTM_TRUE) {
1259 // RW Folder. Permit Copy and Move.
1260 operations = (unsigned char)(XmDROP_COPY | XmDROP_MOVE);
1262 // RO Folder. Permit only Copy drags.
1263 operations = (unsigned char)XmDROP_COPY;
1268 convertCBRec[0].closure = (XtPointer) rmw;
1269 dragFinishCBRec[0].closure = (XtPointer) rmw;
1271 if (DtDndVaDragStart(widget, event, DtDND_BUFFER_TRANSFER, 1,
1272 operations, convertCBRec, dragFinishCBRec,
1273 DtNsourceIcon, drag_icon,
1275 DebugPrintf(3, "DragStart returned NULL.\n");
1283 RoamMenuWindow::msgListLookForButton (
1290 #define ABS_DELTA(x1, x2) (x1 < x2 ? x2 - x1 : x1 - x2)
1292 if( event->type == MotionNotify) {
1293 XEvent * press = (XEvent *) arg;
1295 if (ABS_DELTA(press->xbutton.x_root, event->xmotion.x_root) > DAMPING ||
1296 ABS_DELTA(press->xbutton.y_root, event->xmotion.y_root) > DAMPING)
1299 else if (event->type == ButtonRelease)
1304 // msgListProcessPress
1306 // Translation implementing Motif 1.2.5 ProcessPress function
1309 #define SELECTION_ACTION 0
1310 #define TRANSFER_ACTION 1
1313 RoamMenuWindow::msgListProcessPress(
1317 Cardinal *num_params)
1319 int i, action, cur_item;
1320 int *selected_positions, nselected_positions;
1322 DebugPrintf(3, "In RoamMenuWindow::msgListProcessPress\n");
1324 // This action happens when Button1 is pressed and the Selection
1325 // and Transfer are integrated on Button1. It is passed two
1326 // parameters: the action to call when the event is a selection,
1327 // and the action to call when the event is a transfer.
1329 if (*num_params != 2 || !XmIsList(w))
1332 action = SELECTION_ACTION;
1333 cur_item = XmListYToPos(w, event->xbutton.y);
1338 XmNselectedPositions, &selected_positions,
1339 XmNselectedPositionCount, &nselected_positions,
1342 for (i=0; i<nselected_positions; i++)
1344 if (cur_item == selected_positions[i])
1346 // The determination of whether this is a transfer drag
1347 // cannot be made until a Motion event comes in. It is
1348 // not a drag as soon as a ButtonUp event happens.
1354 &RoamMenuWindow::msgListLookForButton,
1356 switch (new_event.type)
1359 action = TRANSFER_ACTION;
1362 action = SELECTION_ACTION;
1370 XtCallActionProc(w, params[action], event, params, *num_params);
1375 // Override default list translations to start our own drags
1378 RoamMenuWindow::msgListDragSetup()
1380 Widget msgList = _list->get_scrolling_list();
1381 static char translations[] = "\
1382 ~c ~s ~m ~a <Btn1Down>:\
1383 dt-process-press(ListBeginSelect,MsgListDragStart)\n\
1384 c ~s ~m ~a <Btn1Down>:\
1385 dt-process-press(ListBeginToggle,MsgListDragStart)";
1386 static char btn2_translations[] = "\
1387 ~c ~s ~m ~a <Btn2Down>:\
1388 dt-process-press(ListBeginSelect,MsgListDragStart)\n\
1389 c ~s ~m ~a <Btn2Down>:\
1390 dt-process-press(ListBeginToggle,MsgListDragStart)\n\
1391 <Btn2Motion>:ListButtonMotion()\n\
1392 ~c ~s ~m ~a <Btn2Up>:ListEndSelect()\n\
1393 c ~s ~m ~a <Btn2Up>:ListEndToggle()";
1394 int btn1_transfer = 0;
1395 XtTranslations new_translations;
1396 static XtActionsRec actionTable[] = {
1397 {"MsgListDragStart",
1398 (XtActionProc) &RoamMenuWindow::msgListDragStart},
1399 {"dt-process-press",
1400 (XtActionProc) &RoamMenuWindow::msgListProcessPress}
1403 DebugPrintf(3, "In RoamMenuWindow::msgListDragSetup\n");
1406 theRoamApp.appContext(),
1408 sizeof(actionTable)/sizeof(actionTable[0]));
1409 new_translations = XtParseTranslationTable(translations);
1410 XtOverrideTranslations(msgList, new_translations);
1413 (Widget)XmGetXmDisplay(XtDisplayOfObject(msgList)),
1414 "enableBtn1Transfer", &btn1_transfer,
1417 if (btn1_transfer != True) {
1418 new_translations = XtParseTranslationTable(btn2_translations);
1419 XtOverrideTranslations(msgList, new_translations);
1424 RoamMenuWindow::open_and_load(
1426 DtMailBoolean create,
1429 _openContainerCmd->set_create_lock_flags(create, lock);
1430 _openContainerCmd->execute();
1432 // if it required conversion, let conversion handle the error
1433 // (its a callback routine and we have "lost control" of what
1434 // it returns anyway.)
1436 // if it did not require conversion, then open() should have succeeded.
1437 // If it did succeed, then its _mailbox should be set by now.
1438 // If its not set, then either open() failed somewhere or it was
1439 // cancelled by the user. We now have an error condition.
1440 if ((!_required_conversion) && (_mailbox == NULL))
1442 error.setError(DTME_NoMailBox);
1446 // If it required conversion, then let the conversion process handle
1447 // errors if any occur.
1448 // Reset the DtMailEnv for this method.
1449 if (_required_conversion) error.clear();
1451 // If it required conversion, and conversion succeeded, then the
1452 // mailbox was also loaded and _is_loaded gets set to TRUE.
1453 // If it required no conversion, then it implies that we already
1454 // have a container in hand and we just load it (implicitly
1455 // setting _is_loaded to TRUE)
1456 if ((!_required_conversion) && (_is_loaded == FALSE))
1458 this->load_mailbox(error);
1464 // Ideally, open() should set the error if the user cancels the open.
1465 // And we should error after open() returns at the caller's end...
1468 RoamMenuWindow::open(
1470 DtMailBoolean create_flag,
1471 DtMailBoolean lock_flag
1474 FORCE_SEGV_DECL(char, tmp);
1475 Dimension win_x, win_y, win_wid, win_ht, win_bwid;
1476 MailSession *ses = theRoamApp.session();
1480 char *buf = new char[2*MAXPATHLEN];
1482 _openContainerCmd->set_create_lock_flags(create_flag, lock_flag);
1484 // Obtain the current dimensions of the RMW
1485 XtVaGetValues(_main,
1490 XmNborderWidth, &win_bwid,
1496 _border_width = win_bwid;
1498 // Check to see if the mbox is already open. If it is, we will
1499 // simply make sure it's displayed in the current workspace.
1500 if (ses->isMboxOpen(_mailbox_fullpath))
1502 RoamMenuWindow *rmw = NULL;
1503 rmw = ses->getRMW(_mailbox_fullpath);
1506 ses->activateRMW(rmw);
1507 rmw->displayInCurrentWorkspace();
1512 // Try to open this folder, but don't take the lock and and don't create it.
1513 _mailbox = ses->open(error, _mailbox_fullpath,
1514 &RoamMenuWindow::syncViewAndStoreCallback,
1515 this, create_flag, lock_flag);
1518 if((DTMailError_t) error == DTME_OutOfSpace )
1520 ShowErrMsg((char *)error.getClient(),FALSE,(void*)this );
1521 error.setClient(NULL);
1526 // Did we ask for a non-existent file?
1527 if ((DTMailError_t)error == DTME_NoSuchFile)
1529 // if (create_flag == DTM_TRUE)
1530 if (create_flag == DTM_FALSE)
1535 "The mailbox %s does not exist.\nCreate a mailbox with this name?"),
1537 _genDialog->setToQuestionDialog(GETMSG(DT_catd,
1540 helpId = DTMAILHELPERROR;
1541 answer = _genDialog->post_and_return(GETMSG(DT_catd,
1549 if (answer == 1) open(error, DTM_TRUE, lock_flag);
1556 // A special case should be taken care
1557 // The create_flag is TRUE but still can not be created
1558 // This is because the path is something like
1559 // /valid_path/not_such_dir/file_name.
1560 // The full file path is not valid so that we need flag
1565 "Unable to create %s."),
1567 _genDialog->setToQuestionDialog(GETMSG(DT_catd,
1570 helpId = DTMAILHELPNOCREATE;
1571 answer = _genDialog->post_and_return(GETMSG(DT_catd,
1579 else if (((DTMailError_t)error == DTME_OtherOwnsWrite) ||
1580 ((DTMailError_t)error == DTME_AlreadyLocked))
1582 // See if they want to take the lock.
1584 // GETMSG(DT_catd, 3, 6, "The mailbox %s is locked.\n\
1585 // You can manually unlock the mailbox and try again\n\
1586 // or contact your System Administrator."),
1587 // _mailbox_fullpath);
1589 // _genDialog->setToErrorDialog(
1590 // GETMSG(DT_catd, 3, 7, "Mailer"),
1592 // helpId = DTMAILHELPTAKELOCK;
1593 // _genDialog->post_and_return(
1594 // GETMSG(DT_catd, 3, 8, "OK"),
1597 // error.setError(DTME_GetLockRefused);
1598 // The above else-if code doesn't make sense. If ses->open() failed
1599 // because the folder was already locked or not writable then
1600 // posting the specified error dialog and setting the error to GetLockRefused
1601 // is meaningless. Especially since the calling function
1602 // OpenContainerCmd::doit() doesn't even check the error we
1603 // return. Lets post a meaningful error dialog and return.
1604 postErrorDialog(error);
1608 else if ((DTMailError_t)error == DTME_BadRunGroup)
1611 sprintf(buf, "%s", GETMSG(DT_catd, 2, 4,
1612 "Mailer has not been properly installed,\n\
1613 and cannot run because the execution group\n\
1614 is incorrectly set."));
1616 _genDialog->setToQuestionDialog(
1617 GETMSG(DT_catd, 1, 6, "Mailer"),
1620 // No choice at this state other than to OK.
1622 helpId = DTMAILHELPBADGROUPID;
1623 answer = _genDialog->post_and_return(
1624 GETMSG(DT_catd, 3, 9, "OK"),
1630 else if ((DTMailError_t)error == DTME_NoPermission)
1633 * The %s is the name of the mailbox the user doesn't have
1634 * permission to view.
1636 sprintf(buf, GETMSG(DT_catd, 2, 5,
1637 "You do not have permission to view %s"), _mailbox_fullpath);
1639 _genDialog->setToQuestionDialog(
1640 GETMSG(DT_catd, 1, 7, "Mailer"),
1643 // No choice at this state other than to OK.
1645 helpId = DTMAILHELPNOVIEW;
1646 answer = _genDialog->post_and_return(
1647 GETMSG(DT_catd, 3, 10, "OK"),
1652 else if ((DTMailError_t)error == DTME_IsDirectory)
1654 sprintf(buf, GETMSG(DT_catd, 2, 6,
1655 "The mailbox %s is a directory and can not be opened."),
1658 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 1, 8, "Mailer"),
1661 helpId = DTMAILHELPDIRECTORYONLY;
1662 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 11, "OK"),
1667 else if ((DTMailError_t)error == DTME_AlreadyOpened)
1669 sprintf(buf, GETMSG(DT_catd,20,1,
1670 "The mailbox %s is already open."), _mailbox_fullpath);
1672 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 1, 8, "Mailer"),
1675 // there is no help message for this error
1676 // open a defect and put helpId later
1678 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 11, "OK"),
1685 // This is a real error. Punt!
1686 this->postErrorDialog(error);
1692 if (_mailbox->mailBoxWritable(error) == DTM_TRUE)
1693 msgListDropRegister();
1694 _mailbox->registerErrMsgFunc(ShowErrMsg,this);
1696 _mailbox->hideAccessEvents(DTM_TRUE);
1698 _mailbox->hideAccessEvents(DTM_FALSE);
1704 void RoamMenuWindow::createMenuPanes()
1706 this->createContainerList();
1708 this->construct_file_menu();
1710 this->construct_message_menu();
1712 this->construct_edit_menu();
1714 this->construct_attachment_menu();
1716 this->construct_view_menu();
1718 this->construct_compose_menu();
1720 this->construct_move_menu();
1722 this->construct_help_menu();
1724 this->construct_message_popup();
1726 this->construct_text_popup();
1728 this->construct_attachment_popup();
1730 this->syncCachedContainerList();
1735 RoamMenuWindow::resetCacheList(int new_size)
1737 // Remove the extra items in the list
1738 for (int i = _cached_containerlist->length(); i > new_size; i--) {
1740 _cached_containerlist->remove(i-1);
1741 _open_container_containerlist_cached->remove(i-1);
1742 _copyto_containerlist_cached->remove(i-1);
1743 _move_containerlist_cached->remove(i-1);
1745 _menuBar->removeCommand(_opencontainerMenu, _first_cached_item+i-1);
1746 _menuBar->removeCommand(_copytoMenu, _first_cached_item+i-1);
1747 _menuBar->removeCommand(_moveMenu, _first_cached_item+i-1);
1748 _menuBar->removeCommand(_msgsPopupMoveMenu, _first_cached_item+i-1);
1753 RoamMenuWindow::propsChanged(void)
1755 MailSession *ses = theRoamApp.session();
1756 DtMail::Session *d_session = ses->session();
1757 DtMail::MailRc *mailrc = get_mail_rc();
1759 const char *value = NULL;
1760 char *inbox_path = NULL;
1761 DtMailObjectSpace space;
1762 Boolean should_be_inbox;
1764 if (! _is_loaded) return;
1765 enableWorkAreaResize();
1767 d_session->queryImpl(
1769 d_session->getDefaultImpl(error),
1770 DtMailCapabilityInboxName,
1773 should_be_inbox = (inbox_path && 0 == strcmp(inbox_path, mailboxName()));
1775 RoamMenuWindow *rmw = NULL;
1776 char *password = NULL;
1777 password = MailRetrievalOptions::getPassword(DTMAS_INBOX);
1779 if (_inbox != should_be_inbox)
1788 // Remove inbox attributes
1790 displayInCurrentWorkspace();
1793 GETMSG(DT_catd, 99, 99,"The INBOX path has changed.\nReopen?"));
1794 _genDialog->setToQuestionDialog(
1795 GETMSG(DT_catd, 3, 22, "Mailer"),
1797 answer = _genDialog->post_and_return(
1798 GETMSG(DT_catd, 3, 29, "OK"),
1799 GETMSG(DT_catd, 3, 19, "Cancel"),
1802 rmw = ses->getRMW(inbox_path);
1806 rmw->_mailbox->createMailRetrievalAgent(password);
1807 rmw->_open_container_inbox->deactivate();
1808 rmw->_file_open_inbox->deactivate();
1814 rmw->displayInCurrentWorkspace();
1816 view_mail_file(inbox_path, DTM_FALSE);
1820 _mailbox->deleteMailRetrievalAgent();
1821 _open_container_inbox->activate();
1822 _file_open_inbox->activate();
1828 _mailbox->createMailRetrievalAgent(password);
1829 _open_container_inbox->deactivate();
1830 _file_open_inbox->deactivate();
1835 if (_inbox) _mailbox->createMailRetrievalAgent(password);
1838 rmw = ses->getRMW(inbox_path);
1839 if (rmw) rmw->_mailbox->createMailRetrievalAgent(password);
1843 if (password) free(password);
1846 // See if the header size has changed.
1848 mailrc->getValue(error, "headerlines", &value);
1851 value = strdup("15");
1855 int header_lines = (int) strtol(value, NULL, 10);
1856 if (header_lines != _list->visibleItems())
1857 _list->visibleItems(header_lines);
1859 free((void*) value);
1861 _list->checkDisplayProp();
1862 _my_editor->textEditor()->update_display_from_props();
1865 mailrc->getValue(error, "dontdisplaycachedfiles", &value);
1866 if (error.isNotSet() && value != NULL)
1868 if (_display_cached_list)
1869 // They just turned off the Display Up To prop so
1870 //reset the cache list to zero length.
1873 _max_cached_list_size = 0;
1874 _display_cached_list = FALSE;
1875 free((void*) value);
1881 mailrc->getValue(error, "cachedfilemenusize", &value);
1882 if (error.isNotSet() && value != NULL && *value != '\0')
1886 new_size = (int) strtol(value, NULL, 10);
1887 if (new_size != _max_cached_list_size && new_size >=0)
1889 // They just changed the display number so chop the
1890 // list if it is bigger than the new size just set
1891 if (new_size < _max_cached_list_size)
1892 resetCacheList(new_size);
1894 _max_cached_list_size = new_size;
1898 free((void*) value);
1903 mailrc->getValue(error, "filemenu2", &value);
1904 if ( (value == NULL && _filemenu2 != NULL) ||
1905 (value != NULL && _filemenu2 == NULL) ||
1906 (value != NULL && _filemenu2 != NULL &&
1907 strcmp(value, _filemenu2) != 0) )
1909 // Recreate the containter list
1910 this->createContainerList();
1912 // Recreate the File menu
1913 this->construct_file_menu();
1915 // Recreate the Message menu
1916 this->construct_message_menu();
1918 // Recreate the Move menu...
1919 this->construct_move_menu();
1921 // Recreate the Message popup menu
1922 this->construct_message_popup();
1925 free((void*) value);
1928 mailrc->getValue(error, "retrieveinterval", &value);
1929 if (error.isNotSet() && value && *value != '\0')
1931 long ping = (time_t) strtol(value, NULL, 10);
1933 _checkformail_when_mapped = FALSE;
1935 _checkformail_when_mapped = TRUE;
1938 if (NULL != value) free((void*) value);
1940 disableWorkAreaResize();
1943 void RoamMenuWindow::registerDialog( ViewMsgDialog *dialog )
1946 ViewMsgDialog **newList = (ViewMsgDialog **)-1;
1948 // Allocate a new list large enough to hold the new
1949 // object, and copy the contents of the current list
1952 newList = new ViewMsgDialog*[_numDialogs + 1];
1954 for ( i = 0; i < _numDialogs; i++ )
1955 newList[i] = _dialogs[i];
1957 // Install the new list and add the window to the list
1959 if ( _numDialogs > 0 )
1962 _dialogs[_numDialogs] = dialog;
1966 void RoamMenuWindow::unregisterDialog ( ViewMsgDialog *dialog )
1969 ViewMsgDialog **newList = (ViewMsgDialog **)-1;
1971 // Allocate a new, smaller list
1973 newList = new ViewMsgDialog *[_numDialogs - 1];
1975 // Copy all objects, except the one to be
1976 // removed, to the new list
1979 for ( i = 0; i < _numDialogs; i++ )
1980 if ( _dialogs[i] != dialog )
1981 newList[index++] = _dialogs[i];
1983 // Install the new list
1992 RoamMenuWindow::forwardFilename( char *file )
1994 _forward_filename = (char *)realloc(_forward_filename, strlen(file)+1);
1995 strcpy( _forward_filename, file );
1999 RoamMenuWindow::forwardFilename()
2001 return _forward_filename;
2006 // If it is a configure notify, we are interested in it.
2007 // We need to then capture its new position.
2008 // And if the RMW has not been loaded, we need to load it.
2011 RoamMenuWindow::structurenotify(
2013 XtPointer clientData,
2015 Boolean * ) // continue_to_dispatch
2017 RoamMenuWindow *rmw=(RoamMenuWindow *) clientData;
2019 if (event->type == ConfigureNotify)
2021 rmw->configurenotify(
2022 event->xconfigurerequest.x,
2023 event->xconfigurerequest.y,
2024 event->xconfigurerequest.width,
2025 event->xconfigurerequest.height,
2026 event->xconfigurerequest.border_width);
2028 else if ((event->type == MapNotify) || ( event->type == UnmapNotify))
2031 if (event->type == UnmapNotify)
2033 rmw->_mailbox->save();
2034 rmw->_mailbox->hideAccessEvents(DTM_TRUE);
2038 rmw->_mailbox->hideAccessEvents(DTM_FALSE);
2039 if (FALSE==rmw->_inbox || TRUE==rmw->_checkformail_when_mapped)
2042 DtMail::Session *m_session = theRoamApp.session()->session();
2043 DtMail::MailRc *mailrc = m_session->mailRc(error);
2044 const char *value = NULL;
2046 mailrc->getValue(error, "retrievemailonmapnotify", &value);
2047 if (error.isNotSet()) rmw->checkForMail(error);
2055 // Capture its position coordinates.
2058 RoamMenuWindow::configurenotify(
2059 unsigned int win_x, unsigned int win_y,
2060 unsigned int win_wid, unsigned int win_ht,
2061 unsigned int win_bwid
2069 _border_width = win_bwid;
2073 // If it is not already loaded, then load it (it might involve
2074 // conversion, etc.; all handled by open_and_load())
2075 // If its been loaded already, then mapnotify gets called when
2076 // the state changes from iconic to open (i.e., the user double-clicks
2077 // on an RMW icon). If we want to load a folder at that time, this
2078 // is the place to do it.
2082 RoamMenuWindow::mapnotify()
2084 // If its not been loaded, then open and load it.
2087 DtMailEnv mail_error;
2091 theRoamApp.busyAllWindows();
2092 this->open_and_load(
2094 (DtMailBoolean) _create_mailbox_file,
2096 theRoamApp.unbusyAllWindows();
2098 // If there's been an error then we quit the container.
2099 if (mail_error.isSet())
2101 // Need to remove the base Widgets destroy callback since
2102 // we end up destroying it twice otherwise...
2103 XtRemoveAllCallbacks(this->baseWidget(), XmNdestroyCallback);
2107 // We need to disable the editable menu options if the mail
2110 if (_mailbox->mailBoxWritable(mail_error) == DTM_FALSE)
2112 _msg_delete->deactivate();
2113 _msg_undelete_last->deactivate();
2114 _msg_undelete_from_list->deactivate();
2115 _delete_button->deactivate();
2116 _file_destroy_deleted_msgs->deactivate();
2117 if (NULL != _move_cascade)
2118 XtSetSensitive(_move_cascade, FALSE);
2119 if (NULL != _msgsPopupMoveMenu)
2120 XtSetSensitive(_msgsPopupMoveMenu, FALSE);
2122 char * readonly = GETMSG(DT_catd, 20, 3, "Read Only");
2126 if (_list->get_num_messages())
2127 setIconName(NormalIcon);
2129 setIconName(EmptyIcon);
2134 // If the mailbox has messages, set to normal icon
2135 if (_list->get_num_messages() > 0)
2136 setIconName(NormalIcon);
2138 setIconName(EmptyIcon);
2143 RoamMenuWindow::last_sorted_by(SortBy type)
2146 char *buffer = NULL;
2148 DtMail::Session *m_session = theRoamApp.session()->session();
2149 DtMail::MailRc *mailrc = m_session->mailRc(error);
2151 _last_sorted_by = type;
2153 ((SortCmd*)_view_sortTD)->setButtonState(FALSE, FALSE);
2154 ((SortCmd*)_view_sortSender)->setButtonState(FALSE, FALSE);
2155 ((SortCmd*)_view_sortSubject)->setButtonState(FALSE, FALSE);
2156 ((SortCmd*)_view_sortSize)->setButtonState(FALSE, FALSE);
2157 ((SortCmd*)_view_sortStatus)->setButtonState(FALSE, FALSE);
2159 XtVaSetValues(_sender_lbl, XmNlabelString, _sender_xms, NULL);
2160 XtVaSetValues(_subject_lbl, XmNlabelString, _subject_xms, NULL);
2161 XtVaSetValues(_date_lbl, XmNlabelString, _date_xms, NULL);
2162 XtVaSetValues(_size_lbl, XmNlabelString, _size_xms, NULL);
2164 buffer = XtMalloc(BUFSIZ);
2169 RMW_CONCAT_MAILRC_KEY(buffer, DTMAS_INBOX, "sortby");
2173 RMW_CONCAT_MAILRC_KEY(buffer, mailboxName(), "sortby");
2177 switch (_last_sorted_by)
2180 XtVaSetValues(_date_lbl, XmNlabelString, _date_key_xms, NULL);
2181 ((SortCmd*)_view_sortTD)->setButtonState(TRUE,FALSE);
2182 if (buffer) mailrc->removeValue(error, buffer);
2185 XtVaSetValues(_sender_lbl, XmNlabelString, _sender_key_xms, NULL);
2186 ((SortCmd*)_view_sortSender)->setButtonState(TRUE,FALSE);
2187 sprintf(id, "%d", SortSender);
2188 if (buffer) mailrc->setValue(error, buffer, id);
2191 XtVaSetValues(_subject_lbl, XmNlabelString, _subject_key_xms, NULL);
2192 ((SortCmd*)_view_sortSubject)->setButtonState(TRUE,FALSE);
2193 sprintf(id, "%d", SortSubject);
2194 if (buffer) mailrc->setValue(error, buffer, id);
2197 XtVaSetValues(_size_lbl, XmNlabelString, _size_key_xms, NULL);
2198 ((SortCmd*)_view_sortSize)->setButtonState(TRUE,FALSE);
2199 sprintf(id, "%d", SortSize);
2200 if (buffer) mailrc->setValue(error, buffer, id);
2203 ((SortCmd*)_view_sortStatus)->setButtonState(TRUE,FALSE);
2204 sprintf(id, "%d", SortStatus);
2205 if (buffer) mailrc->setValue(error, buffer, id);
2208 XtVaSetValues(_date_lbl, XmNlabelString, _date_key_xms, NULL);
2209 ((SortCmd*)_view_sortTD)->setButtonState(TRUE,FALSE);
2210 if (buffer) mailrc->removeValue(error, buffer);
2213 if (buffer) XtFree(buffer);
2215 //_list->layoutLabels();
2216 mailrc->update(error);
2220 RoamMenuWindow::message( char *text )
2222 int text_size = strlen(text);
2226 if (text_size > 0) {
2227 str = GETMSG(DT_catd, 3, 12, "%s");
2228 buf = new char[strlen(str) + text_size + 1];
2229 sprintf(buf, str, text);
2230 labelStr = XmStringCreateLocalized(buf);
2231 _clear_message_p = TRUE;
2235 sprintf(buf, "%s", "");
2236 labelStr = XmStringCreateLocalized(buf);
2237 _clear_message_p = FALSE;
2240 XtVaSetValues(_message, XmNlabelString, labelStr, NULL);
2241 XmUpdateDisplay(this->baseWidget());
2243 XmStringFree(labelStr);
2248 RoamMenuWindow::setStatus(const char * msg)
2250 message((char *)msg);
2254 RoamMenuWindow::clearStatus(void)
2260 RoamMenuWindow::message_summary()
2262 this->message_summary(
2263 list()->selected_item_position(),
2264 list()->get_num_messages(),
2265 list()->get_num_new_messages(),
2266 list()->get_num_deleted_messages());
2270 RoamMenuWindow::message_summary(
2279 int num_live_msgs = num_msgs - num_deleted; // Undeleted msgs
2280 DtMail::MailRc * mailrc = get_mail_rc();
2282 const char * value = NULL;
2284 mailrc->getValue(error, "nerdmode", &value);
2285 if (error.isSet()) {
2286 str = GETMSG(DT_catd, 3, 13, "Message %d of %d, %d new, %d deleted");
2289 str = "Message 0x%x of 0x%x, ignoring 0x%x, 0x%x forgotten";
2292 free((void*) value);
2294 buf = new char[strlen(str) + 100];
2295 sprintf(buf, str, sel_pos, num_msgs, num_new, num_deleted);
2297 labelStr = XmStringCreateLocalized(buf);
2299 XtVaSetValues(_message_summary, XmNlabelString, labelStr, NULL);
2300 XmUpdateDisplay(this->baseWidget());
2302 XmStringFree(labelStr);
2307 RoamMenuWindow::message_selected(
2318 * The user will see the following message display as:
2319 * "Message 3 of 10, 2 new, 6 deleted"
2320 * This means ??? -- Explain to translator.
2322 str = GETMSG(DT_catd, 3, 14, "Message %d of %d, %d new, %d deleted");
2323 buf = new char[strlen(str) + 20];
2324 sprintf(buf, str, msg_num, num_msgs, num_new, num_deleted);
2326 labelStr = XmStringCreateLocalized(buf);
2328 XtVaSetValues(_message_summary, XmNlabelString, labelStr, NULL);
2329 XmUpdateDisplay(this->baseWidget());
2331 XmStringFree(labelStr);
2337 RoamMenuWindow::get_find_dialog()
2341 theRoamApp.busyAllWindows();
2342 // No find dialog. Create it
2343 _findDialog = new FindDialog(this);
2344 _findDialog->initialize();
2345 theRoamApp.unbusyAllWindows();
2349 _findDialog->manage();
2350 _findDialog->popup();
2355 RoamMenuWindow::quitWorkproc(XtPointer client_data)
2357 RoamMenuWindow *rmw = (RoamMenuWindow *) client_data;
2358 MailSession *ses = theRoamApp.session();
2359 static int called = 0;
2361 if (rmw->_numPendingTasks > 0)
2367 if (rmw->_quitWorkprocID != 0)
2369 XtRemoveWorkProc(rmw->_quitWorkprocID);
2370 rmw->_quitWorkprocID = 0;
2373 rmw->normalCursor();
2374 rmw->_genDialog->unmanage();
2377 if (rmw->_delete_on_quit)
2379 rmw->_list->shutdown();
2383 ses->deactivateRMW(rmw);
2385 theRoamApp.checkForShutdown();
2390 RoamMenuWindow::queryExpunge()
2396 if (NULL != _mailbox && _mailbox->mailBoxWritable(error) == DTM_TRUE)
2398 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2400 if (_list->get_num_deleted_messages())
2402 // We need to deal with deleted messages, based on what the
2403 // user wants to do. There are two properties that control
2406 // keepdeleted - Keep deleted messages on close.
2407 // quietdelete - Delete without asking.
2409 // If the user wants to keep the deleted messages, then we
2410 // can just blow by the second. If not, then we have to
2411 // clear the deleted messages, asking first based on the
2414 DtMail::MailRc * mailrc = get_mail_rc();
2415 const char * value = NULL;
2418 mailrc->getValue(error, "keepdeleted", &value);
2422 free((void*) value);
2424 // The user wants to expunge on close. See if they want
2425 // to be asked first.
2429 mailrc->getValue(error, "quietdelete", &value);
2430 if (error.isSet() && !theRoamApp.quitSilently())
2436 * This dialog comes up when the user tries to quit the
2437 * mailbox and the user is asked if he wants to destroy
2438 * the messages marked for deletion.
2441 * Messages 16 and 17 are no longer being used. They are
2442 * being replaced by message 86 and 87.
2444 _genDialog->setToQuestionDialog(
2446 GETMSG(DT_catd, 3, 16, "Mailer"),
2447 GETMSG(DT_catd, 3, 17, "Destroy the messages you have marked\nfor deletion in this mailbox?"));
2450 * This dialog comes up when the user tries to quit the
2451 * mailbox. The user is asked if they want to destroy
2452 * the deleted messages.
2454 GETMSG(DT_catd, 3, 87, "Mailer - Close"),
2455 GETMSG(DT_catd, 3, 88, "Destroy the deleted messages and close this mailbox?"));
2456 char * helpId = DTMAILHELPDESTROYMARKMSG;
2457 int answer = _genDialog->post_and_return(
2458 GETMSG(DT_catd, 3, 89, "Destroy and Close"),
2459 GETMSG(DT_catd, 3, 73, "Cancel"),
2460 GETMSG(DT_catd, 3, 90, "Retain and Close"),
2465 _mailbox->expunge(error);
2466 if ((DTMailError_t) error == DTME_OutOfSpace)
2469 (char *)error.getClient(),
2472 error.setClient(NULL);
2475 if (_msg_undelete_from_list->dialog())
2476 _msg_undelete_from_list->dialog()->expunge();
2480 postErrorDialog(error);
2482 else if (answer == 2)
2484 // This is a very bad way to code selection of the
2485 // cancel button. If someone changes its position
2486 // in the dialog, this code will break!
2487 theRoamApp.unbusyAllWindows();
2493 // If killed by a signal, don't post a dialog.
2495 _mailbox->expunge(error);
2496 if ((DTMailError_t) error == DTME_OutOfSpace)
2498 ShowErrMsg((char *)error.getClient(),FALSE,(void*)this );
2499 error.setClient(NULL);
2502 if (_msg_undelete_from_list->dialog())
2503 _msg_undelete_from_list->dialog()->expunge();
2507 if (! theRoamApp.quitSilently())
2508 postErrorDialog(error);
2512 free((void*) value);
2520 RoamMenuWindow::quit(Boolean delete_win)
2525 if (! queryExpunge())
2528 for (i = 0; i < _numDialogs; i++)
2529 _dialogs[i]->unmanage();
2531 XmUpdateDisplay(baseWidget());
2533 for (i = 0; i < _numDialogs; i++)
2534 _dialogs[i]->quit();
2536 theRoamApp.unbusyAllWindows();
2538 this->_delete_on_quit = delete_win;
2539 if (_numPendingTasks > 0)
2546 21, 22, "Close pending: waiting for task to terminate ...");
2549 if (_quitWorkprocID == 0)
2550 _quitWorkprocID = XtAppAddWorkProc(
2551 XtWidgetToApplicationContext(_w),
2552 &RoamMenuWindow::quitWorkproc,
2558 quitWorkproc((XtPointer) this);
2562 RoamMenuWindow::panicQuit()
2564 if (_mailbox != NULL)
2569 RoamMenuWindow::quit_silently()
2574 if (_mailbox->mailBoxWritable(error) == DTM_TRUE) {
2576 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2578 if (_list->get_num_deleted_messages()) {
2579 // We need to deal with deleted messages, based on what the
2580 // user wants to do. There are two properties that control
2583 // keepdeleted - Keep deleted messages on close.
2584 // quietdelete - Delete without asking.
2586 // If the user wants to keep the deleted messages, then we
2587 // can just blow by the second. If not, then we have to
2588 // clear the deleted messages, asking first based on the
2591 DtMail::MailRc * mailrc = get_mail_rc();
2592 const char * value = NULL;
2595 mailrc->getValue(error, "keepdeleted", &value);
2596 if (error.isSet()) {
2598 _mailbox->expunge(error);
2599 if (error.isSet()) {
2600 this->postErrorDialog(error);
2604 free((void*) value);
2609 for (i = 0; i < _numDialogs; i++) {
2610 _dialogs[i]->unmanage();
2613 XmUpdateDisplay(this->baseWidget());
2615 for (i = 0; i < _numDialogs; i++) {
2616 _dialogs[i]->quit();
2619 this->_delete_on_quit = FALSE;
2620 if (_numPendingTasks > 0)
2627 21, 22, "Close pending: waiting for task to terminate ...");
2630 if (_quitWorkprocID == 0)
2631 _quitWorkprocID = XtAppAddWorkProc(
2632 XtWidgetToApplicationContext(_w),
2633 &RoamMenuWindow::quitWorkproc,
2639 quitWorkproc((XtPointer) this);
2642 // Callback to open a new mail container.
2645 RoamMenuWindow::file_selection_callback(void *client_data, char *selection)
2647 if (NULL == selection || 0 == strlen(selection)) return;
2649 RoamMenuWindow *obj=(RoamMenuWindow *) client_data;
2650 obj->view_mail_file(selection, DTM_FALSE);
2655 void RoamMenuWindow::reopen_mail_file()
2659 theApplication->disableShutdown();
2661 filename = strdup(this->_mailbox_fullpath);
2664 view_mail_file(filename, DTM_FALSE);
2667 theApplication->enableShutdown();
2670 // Given the name of a container, create a new RoamMenuWindow
2671 // and open the container into it.
2673 void RoamMenuWindow::view_mail_file(char *filename, DtMailBoolean create)
2675 DtMailEnv mail_error;
2676 MailSession *ses = theRoamApp.session();
2677 DtMail::Session *d_session = ses->session();
2678 RoamMenuWindow *roamwin = NULL;
2679 char *expanded_filename = NULL;
2680 char *plus_filename = NULL;
2681 char *relative_filename = NULL;
2683 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 20, "Opening mailbox..."));
2685 // If the first character of destname is alphanumeric, we can
2686 // safely assume that it is relative to the root folder directory.
2687 // Prepend a '+' and call 'expandPath' to get the actual path.
2688 if (isalnum(filename[0]))
2690 plus_filename = (char *) malloc(strlen(filename)+2);
2691 sprintf(plus_filename, "+%s", filename);
2692 expanded_filename = d_session->expandPath(mail_error, plus_filename);
2693 free(plus_filename);
2696 expanded_filename = d_session->expandPath(mail_error, filename);
2698 // Check to see if the mbox is already open. If it is, we will
2699 // simply make sure it's displayed in the current workspace.
2700 if (ses->isMboxOpen(expanded_filename))
2702 roamwin = ses->getRMW(expanded_filename);
2703 ses->activateRMW(roamwin);
2704 if (NULL != roamwin) roamwin->displayInCurrentWorkspace();
2708 if (DTM_FALSE == create &&
2709 -1 == SafeAccess(expanded_filename, F_OK) &&
2712 char *buf = new char[2048];
2714 DtMailGenDialog *dialog = genDialog();
2718 GETMSG(DT_catd, 3, 3, "The mailbox %s does not exist.\nCreate a mailbox with this name?"),
2720 dialog->setToQuestionDialog(GETMSG(DT_catd, 3, 22, "Mailer"), buf);
2721 answer = dialog->post_and_return(DTMAILHELPERROR);
2723 if (2 == answer) goto do_unbusy;
2727 roamwin = new RoamMenuWindow(expanded_filename);
2728 roamwin->_create_mailbox_file = DTM_TRUE;
2729 roamwin->initialize();
2730 roamwin->mailboxFullpath(expanded_filename);
2731 roamwin->mailboxName(filename);
2735 free(expanded_filename);
2736 relative_filename = d_session->getRelativePath(mail_error, filename);
2737 theRoamApp.globalAddToCachedContainerList(relative_filename);
2738 free(relative_filename);
2741 theRoamApp.unbusyAllWindows();
2745 RoamMenuWindow::move_callback(void *client_data, char *selection)
2747 DtMailEnv mail_error;
2750 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
2752 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2753 obj->_mailbox->save();
2754 theRoamApp.unbusyAllWindows();
2756 obj->_list->copySelected(mail_error, selection, TRUE, FALSE);
2757 if (mail_error.isSet()) obj->postErrorDialog(mail_error);
2762 RoamMenuWindow::copy_callback(void *client_data, char *selection)
2764 DtMailEnv mail_error;
2767 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
2769 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2770 obj->_mailbox->save();
2771 theRoamApp.unbusyAllWindows();
2773 obj->_list->copySelected(mail_error, selection, FALSE, FALSE);
2774 if (mail_error.isSet()) obj->postErrorDialog(mail_error);
2779 RoamMenuWindow::create_container_callback(void *client_data, char *selection)
2781 RoamMenuWindow *obj = (RoamMenuWindow*) client_data;
2782 obj->create_new_container(selection);
2787 RoamMenuWindow::create_new_container(char *filename)
2791 if (SafeAccess(filename, F_OK) == 0)
2793 char *buf = new char[2048];
2796 GETMSG(DT_catd, 3, 21, "%s already exists.\nOverwrite?"),
2798 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 22, "Mailer"), buf);
2799 answer = _genDialog->post_and_return(DTMAILHELPERROR);
2805 if (unlink(filename) < 0)
2808 GETMSG(DT_catd, 3, 23,
2809 "Unable to overwrite %s.\nCheck file permissions and retry."),
2812 _genDialog->setToErrorDialog(GETMSG(DT_catd, 3, 24, "Mailer"), buf);
2813 (void) _genDialog->post_and_return(DTMAILHELPERROR);
2820 // Path filename is ok -- now follow the same route as for Open
2821 this->view_mail_file(filename, DTM_TRUE);
2826 // SR - added methods below
2829 RoamMenuWindow::ifViewExists(DtMailMessageHandle msg_num)
2833 FORCE_SEGV_DECL(ViewMsgDialog, a_view);
2835 for (i = 0; i < _numDialogs; i++) {
2836 a_view = _dialogs[i];
2837 if (a_view->msgno() == msg_num) {
2846 RoamMenuWindow::addToRowOfButtons()
2848 FORCE_SEGV_DECL(CmdInterface, ci);
2849 Widget w, prev_widget;
2852 _delete_button = new DeleteCmd (
2854 GETMSG(DT_catd, 1, 9, "Delete"),
2856 ci = new ButtonInterface (_rowOfButtons, _delete_button);
2857 w = ci->baseWidget();
2858 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILDELBTNID);
2860 XmNleftAttachment, XmATTACH_FORM,
2861 XmNtopAttachment, XmATTACH_FORM,
2862 XmNbottomAttachment, XmATTACH_FORM,
2863 XmNmarginLeft, offset,
2864 XmNmarginRight, offset,
2869 _next_button = new NextCmd (
2871 GETMSG(DT_catd, 1, 10, "Next"),
2873 ci = new ButtonInterface (_rowOfButtons, _next_button);
2874 w = ci->baseWidget();
2875 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILNEXTBTNID);
2877 XmNleftAttachment, XmATTACH_WIDGET,
2878 XmNleftWidget, prev_widget,
2880 XmNtopAttachment, XmATTACH_FORM,
2881 XmNbottomAttachment, XmATTACH_FORM,
2882 XmNmarginLeft, offset,
2883 XmNmarginRight, offset,
2888 _previous_button = new PrevCmd (
2890 GETMSG(DT_catd, 1, 11, "Previous"),
2892 ci = new ButtonInterface (_rowOfButtons, _previous_button);
2893 w = ci->baseWidget();
2894 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPREVBTNID);
2896 XmNleftAttachment, XmATTACH_WIDGET,
2897 XmNleftWidget, prev_widget,
2899 XmNtopAttachment, XmATTACH_FORM,
2900 XmNbottomAttachment, XmATTACH_FORM,
2901 XmNmarginLeft, offset,
2902 XmNmarginRight, offset,
2907 _replySender_button = new ReplyCmd (
2909 GETMSG(DT_catd, 1, 12, "Reply to Sender"),
2913 ci = new ButtonInterface (_rowOfButtons, _replySender_button);
2914 w = ci->baseWidget();
2915 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILREPLYBTNID);
2917 XmNleftAttachment, XmATTACH_WIDGET,
2918 XmNleftWidget, prev_widget,
2920 XmNtopAttachment, XmATTACH_FORM,
2921 XmNbottomAttachment, XmATTACH_FORM,
2922 XmNmarginLeft, offset,
2923 XmNmarginRight, offset,
2929 _print_button = new PrintCmd ( "Print", GETMSG(DT_catd, 1, 13, "Print"),
2931 ci = new ButtonInterface (_rowOfButtons, _print_button);
2932 w = ci->baseWidget();
2933 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPRINTBTNID);
2935 XmNleftAttachment, XmATTACH_WIDGET,
2936 XmNleftWidget, prev_widget,
2938 XmNtopAttachment, XmATTACH_FORM,
2939 XmNbottomAttachment, XmATTACH_FORM,
2940 XmNmarginLeft, offset,
2941 XmNmarginRight, offset,
2948 RoamMenuWindow::addToRowOfLabels(MsgScrollingList *msglist)
2951 XmString arrow, basexms, spaces, spaces_arrow;
2952 char arrow_symbol[2];
2955 glyph_font = theRoamApp.glyphName();
2959 XmFontListEntry xmfle;
2960 XmFontList xmfl, xmfl_old;
2963 xfs = XLoadQueryFont(XtDisplay(_rowOfLabels), glyph_font);
2964 xmfle = XmFontListEntryCreate("arrow", XmFONT_IS_FONT, (XtPointer) xfs);
2966 lbl = XtVaCreateManagedWidget("t", xmLabelGadgetClass, _rowOfLabels, NULL);
2967 XtVaGetValues(lbl, XmNfontList, &xmfl_old, NULL);
2968 xmfl = XmFontListAppendEntry(xmfl_old, xmfle);
2970 // Pixel foreground, background;
2971 XmRenderTable rt, rt_old;
2976 // lbl = XtVaCreateManagedWidget("t", xmLabelGadgetClass, _rowOfLabels, NULL);
2979 // XmNrenderTable, &rt_old,
2980 // XmNforeground, &foreground,
2981 // XmNbackground, &background,
2984 // XtSetArg(args[nargs], XmNrenditionBackground, background); nargs++;
2985 // XtSetArg(args[nargs], XmNrenditionForeground, foreground); nargs++;
2986 // XtSetArg(args[nargs], XmNloadModel, XmLOAD_IMMEDIATE); nargs++;
2988 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
2989 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
2990 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
2993 arrow_symbol[0] = (char) 209;
2994 arrow_symbol[1] = '\0';
2996 spaces = XmStringCreateLocalized(" ");
2997 arrow = XmStringCreate((char*) arrow_symbol, "arrow");
2998 spaces_arrow = XmStringConcat(spaces, arrow);
3000 XmStringFree(spaces);
3001 spaces = XmStringCreateLocalized(" ");
3003 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 14, "Sender"));
3004 _sender_xms = XmStringConcat(basexms, spaces);
3005 _sender_key_xms = XmStringConcat(basexms, spaces_arrow);
3006 XmStringFree(basexms);
3008 _sender_lbl = XtVaCreateManagedWidget(
3009 "Sender", xmLabelGadgetClass,
3015 XmNlabelString, _sender_xms,
3016 XmNalignment, XmALIGNMENT_BEGINNING,
3019 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3020 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3021 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3023 XtVaGetValues(_sender_lbl, XmNrenderTable, &rt_old, NULL);
3024 rt = XmRenderTableCopy(rt_old, NULL, 0);
3025 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3026 XtVaSetValues(_sender_lbl, XmNrenderTable, rt, NULL);
3028 // Add help callback
3029 // printHelpId("Sender", _sender_lbl);
3030 // XtAddCallback(_sender_lbl, XmNhelpCallback, HelpCB, helpId);
3032 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 15, "Subject"));
3033 _subject_xms = XmStringConcat(basexms, spaces);
3034 _subject_key_xms = XmStringConcat(basexms, spaces_arrow);
3035 XmStringFree(basexms);
3037 _subject_lbl = XtVaCreateManagedWidget(
3038 "Subject", xmLabelGadgetClass,
3044 XmNlabelString, _subject_xms,
3045 XmNalignment, XmALIGNMENT_BEGINNING,
3048 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3049 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3050 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3052 XtVaGetValues(_subject_lbl, XmNrenderTable, &rt_old, NULL);
3053 rt = XmRenderTableCopy(rt_old, NULL, 0);
3054 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3055 XtVaSetValues(_subject_lbl, XmNrenderTable, rt, NULL);
3057 // Add help callback
3058 // printHelpId("Subject", _subject_lbl);
3059 // XtAddCallback(_subject_lbl, XmNhelpCallback, HelpCB, helpId);
3061 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 16,"Date and Time"));
3062 _date_xms = XmStringConcat(basexms, spaces);
3063 _date_key_xms = XmStringConcat(basexms, spaces_arrow);
3064 XmStringFree(basexms);
3066 _date_lbl = XtVaCreateManagedWidget(
3067 "DateTime", xmLabelGadgetClass,
3073 XmNlabelString, _date_xms,
3074 XmNalignment, XmALIGNMENT_BEGINNING,
3077 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3078 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3079 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3081 XtVaGetValues(_date_lbl, XmNrenderTable, &rt_old, NULL);
3082 rt = XmRenderTableCopy(rt_old, NULL, 0);
3083 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3084 XtVaSetValues(_date_lbl, XmNrenderTable, rt, NULL);
3086 // Add help callback
3087 // printHelpId("DateTime", _subject_lbl);
3088 // XtAddCallback(_date_lbl, XmNhelpCallback, HelpCB, helpId);
3090 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 17, "Size"));
3091 _size_xms = XmStringConcat(basexms, spaces);
3092 _size_key_xms = XmStringConcat(basexms, spaces_arrow);
3093 XmStringFree(basexms);
3095 _size_lbl = XtVaCreateManagedWidget(
3096 "Size", xmLabelGadgetClass,
3102 XmNlabelString, _size_xms,
3103 XmNalignment, XmALIGNMENT_BEGINNING,
3106 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3107 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3108 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3110 XtVaGetValues(_size_lbl, XmNrenderTable, &rt_old, NULL);
3111 rt = XmRenderTableCopy(rt_old, NULL, 0);
3112 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3113 XtVaSetValues(_size_lbl, XmNrenderTable, rt, NULL);
3115 // Add help callback
3116 // printHelpId("Size", _size_lbl);
3117 // XtAddCallback(_size_lbl, XmNhelpCallback, HelpCB, helpId);
3119 // Adjust labels so the align on the columns
3120 msglist->layoutLabels(_sender_lbl, _subject_lbl, _date_lbl, _size_lbl);
3122 XmStringFree(arrow);
3123 XmStringFree(spaces);
3124 XmStringFree(spaces_arrow);
3129 RoamMenuWindow::addToRowOfMessageStatus()
3131 XmString labelStr1, labelStr2;
3133 // Size of first label
3135 labelStr1 = XmStringCreateLocalized(GETMSG(DT_catd, 3, 25,
3136 "Loading container..."));
3138 labelStr2 = XmStringCreateLocalized(
3139 GETMSG(DT_catd, 3, 26, "Folder Summary Information"));
3141 _message = XtCreateManagedWidget(
3142 "Message_Status_Text", xmLabelWidgetClass,
3143 _rowOfMessageStatus, NULL, 0);
3144 printHelpId("_message", _message);
3145 /* add help callback */
3146 // XtAddCallback(_message, XmNhelpCallback, HelpCB, helpId);
3149 XtVaSetValues(_message,
3150 XmNalignment, XmALIGNMENT_BEGINNING,
3151 XmNleftAttachment, XmATTACH_FORM,
3152 XmNtopAttachment, XmATTACH_FORM,
3153 XmNbottomAttachment, XmATTACH_FORM,
3154 XmNlabelString, labelStr1,
3157 _message_summary = XtCreateManagedWidget("Message_Summary",
3159 _rowOfMessageStatus, NULL, 0);
3160 XtVaSetValues(_message_summary,
3161 XmNalignment, XmALIGNMENT_END,
3162 XmNlabelString, labelStr2,
3163 XmNrightAttachment, XmATTACH_FORM,
3166 XtVaSetValues(_message,
3167 XmNrightAttachment, XmATTACH_WIDGET,
3168 XmNrightWidget, _message_summary,
3172 XmStringFree(labelStr1);
3173 XmStringFree(labelStr2);
3178 RoamMenuWindow::createContainerList()
3180 FORCE_SEGV_DECL(DtMail::Session, m_session);
3182 const char *val = NULL;
3183 const char *cached_containerlist_size = NULL;
3184 const char *display_cfs = NULL;
3185 DtMailBoolean user_list = DTM_FALSE;
3188 // Get names for permanent containers from .mailrc.
3189 // We get the items from the "filemenu2" variable.
3190 if (_filemenu2 != NULL) free (_filemenu2);
3192 m_session = theRoamApp.session()->session();
3193 m_session->mailRc(error)->getValue(error, "filemenu2", &val);
3194 if (error.isNotSet() && val != NULL && *val != '\0')
3196 user_list = DTM_TRUE;
3197 _filemenu2 = strdup(val);
3199 else _filemenu2 = NULL;
3204 // We will use _user_containerlist to keep track of the static set of
3205 // containers coming from the "filemenu2" value.
3206 // We will use _cached_containerlist to keep track of containers
3207 // which get cached from "Other Mailboxes... operations from the
3208 // Open, CopyTo, and Move menus.
3210 if (_user_containerlist != NULL)
3211 delete (_user_containerlist);
3212 _user_containerlist = new DtVirtArray<ContainerMenuCmd*> (3);
3214 m_session->mailRc(error)->getValue(
3216 "dontdisplaycachedfiles",
3219 if (error.isNotSet() && display_cfs != NULL)
3220 _max_cached_list_size = 0;
3224 m_session->mailRc(error)->getValue(
3226 "cachedfilemenusize",
3227 &cached_containerlist_size);
3228 if (error.isNotSet() &&
3229 cached_containerlist_size &&
3230 *cached_containerlist_size)
3231 _max_cached_list_size =
3232 (int) strtol(cached_containerlist_size, NULL, 10);
3234 _max_cached_list_size = 10;
3237 if (NULL != display_cfs)
3238 free((void*) display_cfs);
3239 if (NULL != cached_containerlist_size)
3240 free((void*) cached_containerlist_size);
3242 int size = (_max_cached_list_size ? _max_cached_list_size : 1);
3243 _cached_containerlist = new DtVirtArray<ContainerMenuCmd*> (size);
3245 if (user_list == DTM_TRUE) {
3246 char *expanded_list = m_session->expandPath(error, _filemenu2);
3250 // Create arrays to hold the user defined container list and the
3251 // recently visited (cached) container list.
3253 if ((token = (char *) strtok(expanded_list, " ")))
3255 ContainerMenuCmd *null_container;
3257 null_container= new ContainerMenuCmd(
3263 _user_containerlist->append(null_container);
3264 while (token = (char *) strtok(NULL, " "))
3266 null_container= new ContainerMenuCmd(
3272 _user_containerlist->append(null_container);
3275 free(expanded_list);
3278 if (_user_containerlist->length() > 0)
3279 _first_cached_item = _user_containerlist->length() +4;
3281 _first_cached_item = 3;
3285 RoamMenuWindow::createOpenContainerList(CmdList * open_container)
3288 char *container_name;
3289 ContainerMenuCmd *container_cmd;
3291 _open_container_separator = new SeparatorCmd("Separator","Separator", TRUE);
3293 _open_container_inbox = new OpenInboxCmd(
3295 GETMSG(DT_catd, 1, 221, "Inbox"),
3296 (FALSE == this->inbox()),
3299 _open_container_other = new UnifiedSelectMailboxCmd(
3301 GETMSG(DT_catd, 1, 246, "Other Mailboxes..."),
3302 GETMSG(DT_catd, 1, 26, "Mailer - Open"),
3303 GETMSG(DT_catd, 1, 27, "Open"),
3305 RoamMenuWindow::file_selection_callback,
3311 // We will use _open_container_containerlist to keep track of the
3312 // static set of OpenContainer commands coming from the "filemenu2"
3315 ncontainers = _user_containerlist->length();
3317 if (_open_container_containerlist != NULL)
3318 delete (_open_container_containerlist);
3319 _open_container_containerlist =
3320 new DtVirtArray<ContainerMenuCmd*>(ncontainers);
3322 for (i=0; i<ncontainers; i++)
3324 container_name = (*_user_containerlist)[i]->containerName();
3325 if (NULL != container_name)
3327 container_cmd = new ContainerMenuCmd(
3328 strdup(container_name),
3333 open_container->add(container_cmd);
3334 _open_container_containerlist->append(container_cmd);
3338 if (0 < ncontainers)
3339 open_container->add(_open_container_separator);
3340 open_container->add(_open_container_inbox);
3341 open_container->add(_open_container_other);
3342 open_container->add(_open_container_separator);
3345 // We will use _open_container_containerlist_cached
3346 // to keep track of OpenContainer which get cached from
3347 // "Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3350 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1);
3352 if (_open_container_containerlist_cached != NULL)
3353 delete (_open_container_containerlist_cached);
3354 _open_container_containerlist_cached =
3355 new DtVirtArray<ContainerMenuCmd*> (ncontainers);
3357 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
3358 for (i=0; i<ncontainers; i++)
3360 container_name = (*_cached_containerlist)[i]->containerName();
3361 if (NULL != container_name)
3363 container_cmd = new ContainerMenuCmd(
3364 strdup(container_name),
3369 open_container->add(container_cmd);
3370 _open_container_containerlist_cached->append(container_cmd);
3377 RoamMenuWindow::construct_file_menu()
3379 FORCE_SEGV_DECL(CmdList, cmdList);
3381 _file_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3383 // Create the "Container" item in the menubar. And fill
3384 // with items below the "Container" item in the menubar.
3386 cmdList = new CmdList( "Mailbox", GETMSG(DT_catd, 1, 18, "Mailbox") );
3387 _file_cmdlist = cmdList;
3389 _file_check_new_mail = new CheckForNewMailCmd(
3390 "Check for New Mail",
3391 GETMSG(DT_catd, 1, 19, "Check for New Mail"),
3394 if (this->inbox()) { // Deactivate the Open Inbox item
3395 _file_open_inbox = new OpenInboxCmd(
3397 GETMSG(DT_catd, 1, 20, "Open Inbox"),
3401 else { // Activate the Open Inbox item.
3402 _file_open_inbox = new OpenInboxCmd(
3404 GETMSG(DT_catd, 1, 21, "Open Inbox"),
3409 _file_new_container = new UnifiedSelectMailboxCmd(
3411 GETMSG(DT_catd, 1, 22, "New..."),
3412 GETMSG(DT_catd, 1, 23, "Mailer - New"),
3413 GETMSG(DT_catd, 1, 24, "New"),
3415 RoamMenuWindow::create_container_callback,
3419 #if defined(USE_OLD_FILE_OPEN)
3420 _file_open = new UnifiedSelectMailboxCmd(
3422 GETMSG(DT_catd, 1, 25, "Open..."),
3423 GETMSG(DT_catd, 1, 26, "Mailer - Open"),
3424 GETMSG(DT_catd, 1, 27, "Open"),
3426 RoamMenuWindow::file_selection_callback,
3428 this->baseWidget());
3431 _open_container_cmdlist = new CmdList(
3433 GETMSG(DT_catd, 1, 245, "Open"));
3434 createOpenContainerList(_open_container_cmdlist);
3436 _file_destroy_deleted_msgs = new DestroyCmd(
3437 "Destroy Deleted Message",
3438 GETMSG(DT_catd, 1, 28,
3439 "Destroy Deleted Messages"),
3444 _file_quit = new QuitCmd (
3446 GETMSG(DT_catd, 1, 29, "Close"),
3450 cmdList->add(_file_check_new_mail);
3451 cmdList->add(_file_open_inbox);
3452 cmdList->add(_file_separator);
3453 cmdList->add(_file_new_container);
3454 #if defined(USE_OLD_FILE_OPEN)
3455 cmdList->add(_file_open);
3457 cmdList->add(_open_container_cmdlist);
3458 cmdList->add(_file_separator);
3459 cmdList->add(_file_destroy_deleted_msgs);
3460 cmdList->add(theRoamApp.mailOptions());
3461 cmdList->add(_file_separator);
3462 cmdList->add(_file_quit);
3464 _menuBar->addCommands(&_file_cascade, cmdList);
3466 _opencontainerMenu = _open_container_cmdlist->getPaneWidget();
3470 XmNpacking, XmPACK_COLUMN,
3471 XmNorientation, XmVERTICAL,
3476 XmNmapCallback, &RoamMenuWindow::map_menu,
3479 XtSetSensitive(_opencontainerMenu, TRUE);
3483 RoamMenuWindow::createCopyList(CmdList * copy_to)
3486 char *container_name;
3487 ContainerMenuCmd *container_cmd;
3489 _copyto_separator = new SeparatorCmd("Separator","Separator", TRUE);
3491 _copyto_inbox = new CopyToInboxCmd(
3493 GETMSG(DT_catd, 1, 221, "Inbox"),
3497 // This is where we initialize _move_copy_button, so this needs to
3498 // be the first place that we use it. This routine needs to be
3499 // called before construct_move_menu(), which expects _move_copy_button
3500 // to be intialized.
3503 DtMail::Session * d_session = theRoamApp.session()->session();
3504 DtMail::MailRc * mailrc = d_session->mailRc(error);
3505 const char *value = NULL;
3506 DtMailBoolean only_show_mailboxes = DTM_FALSE;
3508 mailrc->getValue(error, "movecopytomailboxesonly", &value);
3509 only_show_mailboxes = (error.isSet()) ? DTM_FALSE : DTM_TRUE;
3511 value = strdup("15");
3515 free((void*) value);
3517 _move_copy_button = new MoveCopyCmd (
3518 "Other Mailboxes...",
3519 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3521 RoamMenuWindow::move_callback,
3522 RoamMenuWindow::copy_callback,
3525 only_show_mailboxes);
3526 _copyto_other = new CopyCmd(
3527 GETMSG(DT_catd, 1, 237, "Copy"),
3528 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3531 (MoveCopyCmd *) _move_copy_button);
3534 // We will use _copyto_containerlist to keep track of the
3535 // static set of CopyTo commands coming from the "filemenu2"
3538 ncontainers = _user_containerlist->length();
3540 if (_copyto_containerlist != NULL)
3541 delete (_copyto_containerlist);
3542 _copyto_containerlist =
3543 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3545 for (i=0; i<ncontainers; i++)
3547 container_name = (*_user_containerlist)[i]->containerName();
3548 if (NULL != container_name)
3550 container_cmd = new ContainerMenuCmd(
3551 strdup(container_name),
3556 copy_to->add(container_cmd);
3557 _copyto_containerlist->append(container_cmd);
3561 if (0 < ncontainers)
3562 copy_to->add(_copyto_separator);
3563 copy_to->add(_copyto_inbox);
3564 copy_to->add(_copyto_other);
3565 copy_to->add(_copyto_separator);
3568 // We will use _copyto_containerlist_cached
3569 // to keep track of CopyTo commands which get cached from
3570 //"Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3573 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1);
3575 if (_copyto_containerlist_cached != NULL)
3576 delete (_copyto_containerlist_cached);
3577 _copyto_containerlist_cached =
3578 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3580 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
3581 for (i=0; i<ncontainers; i++)
3583 container_name = (*_cached_containerlist)[i]->containerName();
3584 if (NULL != container_name)
3586 container_cmd = new ContainerMenuCmd(
3587 strdup(container_name),
3592 copy_to->add(container_cmd);
3593 _copyto_containerlist_cached->append(container_cmd);
3599 RoamMenuWindow::construct_message_menu()
3601 FORCE_SEGV_DECL(CmdList, cmdList);
3602 // Separator for menu items
3604 _msg_separator= new SeparatorCmd( "Separator","Separator", TRUE );
3606 _msg_open = new OpenMsgCmd(
3608 GETMSG(DT_catd, 1, 30, "Open"),
3611 _msg_save_as = new SaveAsTextCmd (
3613 GETMSG(DT_catd, 1, 31, "Save As Text..."),
3614 GETMSG(DT_catd, 1, 32, "Mailer - Message - Save As Text"),
3616 get_editor()->textEditor(),
3618 this->baseWidget());
3620 _copyto_cmdlist = new CmdList("Copy To", GETMSG(DT_catd, 1, 33, "Copy To"));
3621 createCopyList(_copyto_cmdlist);
3623 _msg_print = new PrintCmd(
3625 GETMSG(DT_catd, 1, 34, "Print..."),
3628 _msg_find = new FindCmd (
3630 GETMSG(DT_catd, 1, 35, "Find..."),
3633 _msg_select_all = new SelectAllCmd (
3635 GETMSG(DT_catd, 1, 36, "Select All"),
3638 _msg_delete = new DeleteCmd(
3640 GETMSG(DT_catd, 1, 37, "Delete"),
3643 _msg_undelete_last = new UndeleteCmd (
3645 GETMSG(DT_catd, 1, 38, "Undelete Last"),
3646 TRUE, this, FALSE );
3648 _msg_undelete_from_list = new UndeleteCmd(
3649 "Undelete From List...",
3650 GETMSG(DT_catd, 1, 39,
3651 "Undelete From List..."),
3656 cmdList = new CmdList( "Message", GETMSG(DT_catd, 1, 40, "Message") );
3657 _msg_cmdlist = cmdList;
3659 cmdList->add(_msg_open);
3660 cmdList->add(_msg_save_as);
3661 cmdList->add(_copyto_cmdlist);
3662 cmdList->add(_msg_print);
3663 cmdList->add(_msg_find);
3664 cmdList->add(_msg_select_all);
3666 cmdList->add(_msg_separator);
3668 cmdList->add(_msg_delete);
3669 cmdList->add(_msg_undelete_last);
3670 cmdList->add(_msg_undelete_from_list);
3672 _menuBar->addCommands(&_message_cascade, cmdList, FALSE, XmMENU_BAR);
3674 _copytoMenu = _copyto_cmdlist->getPaneWidget();
3676 XtVaSetValues(_copytoMenu,
3677 XmNpacking, XmPACK_COLUMN,
3678 XmNorientation, XmVERTICAL,
3681 XtAddCallback(_copytoMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
3683 XtSetSensitive(_copytoMenu, TRUE);
3687 RoamMenuWindow::construct_message_popup(void)
3689 _msgsPopup_cmdlist = new CmdList( "MsgsPopup", "MsgsPopup");
3691 LabelCmd *title = new LabelCmd (
3692 "Mailer - Messages",
3693 GETMSG(DT_catd, 1, 42, "Mailer - Messages"), TRUE);
3694 _msgsPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3695 _msgsPopup_cmdlist->add(title);
3696 _msgsPopup_cmdlist->add(_msgsPopup_separator);
3697 _msgsPopup_cmdlist->add(_msg_delete);
3698 _msgsPopup_cmdlist->add(_msg_undelete_last);
3699 _msgsPopup_cmdlist->add(_msg_print);
3700 _msgsPopup_cmdlist->add(_comp_replySender);
3701 _msgsPopup_cmdlist->add(_move_cmdlist);
3702 _msgsPopup_cmdlist->add(_msg_save_as);
3703 _msgsPopup_cmdlist->add(_file_check_new_mail);
3705 Widget parent = XtParent(_list->get_scrolling_list());
3706 _menuPopupMsgs = new MenuBar(parent, "RoamMsgsPopup", XmMENU_POPUP);
3707 _msgsPopupMenu = _menuPopupMsgs->addCommands(_msgsPopup_cmdlist,
3708 FALSE, XmMENU_POPUP);
3709 XtAddEventHandler(parent, ButtonPressMask,
3710 FALSE, MenuButtonHandler, (XtPointer) this);
3712 _msgsPopupMoveMenu = _move_cmdlist->getPaneWidget();
3714 XtVaSetValues(_msgsPopupMoveMenu,
3715 XmNpacking, XmPACK_COLUMN,
3716 XmNorientation, XmVERTICAL,
3718 XtAddCallback(_msgsPopupMoveMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
3720 XtSetSensitive(_msgsPopupMoveMenu, TRUE);
3725 RoamMenuWindow::construct_edit_menu()
3727 FORCE_SEGV_DECL(CmdList, cmdList);
3728 // Separator for menu items
3730 _edit_copy = new EditCopyCmd(
3732 GETMSG(DT_catd, 1, 43, "Copy"),
3737 _edit_select_all = new EditSelectAllCmd(
3739 GETMSG(DT_catd, 1, 44, "Select All"),
3744 cmdList = new CmdList("Edit", GETMSG(DT_catd, 1, 45, "Edit"));
3745 _edit_cmdlist = cmdList;
3747 cmdList->add(_edit_copy);
3748 cmdList->add(_edit_select_all);
3750 _menuBar->addCommands(cmdList);
3754 RoamMenuWindow::construct_text_popup(void)
3756 if (theApplication->bMenuButton() != Button3)
3759 _textPopup_cmdlist = new CmdList( "TextPopup", "TextPopup");
3761 LabelCmd *title = new LabelCmd (
3763 GETMSG(DT_catd, 1, 46, "Mailer - Text"), TRUE);
3764 _textPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3766 _textPopup_cmdlist->add(title);
3767 _textPopup_cmdlist->add(_textPopup_separator);
3768 _textPopup_cmdlist->add(_edit_copy);
3769 _textPopup_cmdlist->add(_edit_select_all);
3771 Widget parent = _my_editor->textEditor()->get_editor();
3772 _menuPopupText = new MenuBar(parent, "RoamTextPopup", XmMENU_POPUP);
3773 _textPopupMenu = _menuPopupText->addCommands(_textPopup_cmdlist,
3774 FALSE, XmMENU_POPUP);
3778 void RoamMenuWindow::construct_view_menu()
3780 FORCE_SEGV_DECL(CmdList, cmdList);
3781 FORCE_SEGV_DECL(CmdList, subCmdList);
3783 _view_separator= new SeparatorCmd("Separator","Separator",TRUE);
3785 _view_next = new NextCmd (
3787 GETMSG(DT_catd, 1, 47, "Next"), TRUE, this );
3788 _view_previous = new PrevCmd (
3790 GETMSG(DT_catd, 1, 48, "Previous"), TRUE, this );
3792 _view_abbrev_headers = new AbbrevHeadersCmd(
3793 "Abbreviated Headers",
3794 GETMSG(DT_catd, 1, 49, "Abbreviated Headers"),
3798 _view_sortTD = new SortCmd ("By Date/Time",
3799 GETMSG(DT_catd, 1, 50, "By Date/Time"),
3803 _view_sortSender = new SortCmd ("By Sender",
3804 GETMSG(DT_catd, 1, 51, "By Sender"),
3808 _view_sortSubject = new SortCmd ("By Subject",
3809 GETMSG(DT_catd, 1, 52, "By Subject"),
3813 _view_sortSize = new SortCmd ("By Size",
3814 GETMSG(DT_catd, 1, 53, "By Size"),
3818 _view_sortStatus = new SortCmd ("By Status",
3819 GETMSG(DT_catd, 1, 54, "By Status"),
3826 cmdList = new CmdList( "View", GETMSG(DT_catd, 1, 55, "View") );
3827 _view_cmdlist = cmdList;
3829 cmdList->add(_view_next);
3830 cmdList->add(_view_previous);
3831 cmdList->add(_view_separator);
3832 cmdList->add(_view_abbrev_headers);
3833 cmdList->add(_view_separator);
3834 cmdList->add(_view_sortTD);
3835 cmdList->add(_view_sortSender);
3836 cmdList->add(_view_sortSubject);
3837 cmdList->add(_view_sortSize);
3838 cmdList->add(_view_sortStatus);
3840 _menuBar->addCommands ( cmdList );
3845 RoamMenuWindow::construct_compose_menu()
3847 FORCE_SEGV_DECL(CmdList, cmdList);
3848 FORCE_SEGV_DECL(CmdList, subCmdList);
3850 // Separator for menu items
3852 _comp_separator= new SeparatorCmd( "Separator","Separator", TRUE );
3854 _comp_new = new ComposeCmd (
3856 GETMSG(DT_catd, 1, 56, "New Message"),
3859 _comp_new_include = new ForwardCmd (
3861 GETMSG(DT_catd, 1, 57, "New, Include All"),
3865 _comp_forward = new ForwardCmd (
3867 GETMSG(DT_catd, 1, 58, "Forward Message"),
3872 _comp_replySender = new ReplyCmd (
3874 GETMSG(DT_catd, 1, 59, "Reply to Sender"),
3879 _comp_replyAll = new ReplyAllCmd (
3881 GETMSG(DT_catd, 1, 60, "Reply to All"),
3886 _comp_replySinclude= new ReplyCmd (
3887 "Reply to Sender, Include",
3888 GETMSG(DT_catd, 1, 61, "Reply to Sender, Include"),
3893 _comp_replyAinclude= new ReplyAllCmd (
3894 "Reply to All, Include",
3895 GETMSG(DT_catd, 1, 62, "Reply to All, Include"),
3903 cmdList = new CmdList( "Compose", GETMSG(DT_catd, 1, 63, "Compose") );
3904 _comp_cmdlist = cmdList;
3905 cmdList->add(_comp_new);
3906 cmdList->add(_comp_new_include);
3907 cmdList->add(_comp_forward);
3908 cmdList->add(_comp_separator);
3909 cmdList->add(_comp_replySender);
3910 cmdList->add(_comp_replyAll);
3911 cmdList->add(_comp_replySinclude);
3912 cmdList->add(_comp_replyAinclude);
3914 _menuBar->addCommands ( cmdList );
3917 // construct_move_menu() builds the Move menu on the menu bar.
3918 // There is a user defined set of items at the top, the Inbox,
3919 // the "Mail Filing..." item, and a dynamic list of most recently
3920 // accessed containers at the bottom.
3923 RoamMenuWindow::construct_move_menu()
3926 char *container_name;
3927 ContainerMenuCmd *container_cmd;
3930 if (_move_cmdlist != NULL)
3931 delete _move_cmdlist;
3932 _move_cmdlist = new CmdList( "Move", GETMSG(DT_catd, 1, 64, "Move") );
3934 _move_separator = new SeparatorCmd("Separator","Separator", TRUE );
3936 _move_inbox = new MoveToInboxCmd(
3938 GETMSG(DT_catd, 1, 221, "Inbox"),
3942 // We expect _move_copy_button to have been initialized already when
3943 // we constructed the copy menu.
3944 _move_other = new MoveCmd(
3945 GETMSG(DT_catd, 1, 90, "Move"),
3946 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3949 (MoveCopyCmd *) _move_copy_button);
3952 // We will use _move_containerlist to keep track of the
3953 // static set of Move commands coming from the "filemenu2"
3956 ncontainers = _user_containerlist->length();
3958 if (_move_containerlist != NULL)
3959 delete _move_containerlist;
3960 _move_containerlist = new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3962 for (i=0; i<ncontainers; i++)
3964 container_name = (*_user_containerlist)[i]->containerName();
3965 if (NULL != container_name)
3967 container_cmd = new ContainerMenuCmd(
3968 strdup(container_name),
3973 _move_cmdlist->add(container_cmd);
3974 _move_containerlist->append(container_cmd);
3979 if (0 < ncontainers)
3980 _move_cmdlist->add(_move_separator);
3981 _move_cmdlist->add(_move_inbox);
3983 _move_cmdlist->add(_move_other);
3984 _move_cmdlist->add(_move_separator);
3987 // We will use _move_containerlist_cached
3988 // to keep track of Move commands which get cached from
3989 // "Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3992 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1 );
3994 if (_move_containerlist_cached != NULL)
3995 delete _move_containerlist_cached;
3996 _move_containerlist_cached =
3997 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3999 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
4000 for (i=0; i<ncontainers; i++)
4002 container_name = (*_cached_containerlist)[i]->containerName();
4003 if (NULL != container_name)
4005 container_cmd = new ContainerMenuCmd(
4006 strdup(container_name),
4011 _move_cmdlist->add(container_cmd);
4012 _move_containerlist_cached->append(container_cmd);
4017 _moveMenu = _menuBar->addCommands(
4018 &_move_cascade, _move_cmdlist,
4020 XtVaSetValues(_moveMenu,
4021 XmNpacking, XmPACK_COLUMN,
4022 XmNorientation, XmVERTICAL,
4024 XtAddCallback(_moveMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
4030 RoamMenuWindow::construct_attachment_menu()
4033 _att_save = new SaveAttachCmd (
4035 GETMSG(DT_catd, 1, 66, "Save As..."),
4036 GETMSG(DT_catd, 1, 67, "Mailer - Attachments - Save As"),
4038 RoamMenuWindow::save_attachment_callback,
4040 this->baseWidget());
4042 _att_select_all = new SelectAllAttachsCmd(
4045 DT_catd, 1, 68, "Select All"
4049 _att_cmdlist = new CmdList(
4056 _att_cmdlist->add(_att_save);
4057 _att_cmdlist->add(_att_select_all);
4059 // Create a pulldown from the items in the list. Retain a handle
4060 // to that pulldown since we need to dynamically add/delete entries
4061 // to this menu based on the selection of attachments.
4063 _attachmentMenu = _menuBar->addCommands(_att_cmdlist);
4067 RoamMenuWindow::construct_attachment_popup(void)
4069 _attPopup_cmdlist = new CmdList( "AttachmentsPopup", "AttachmentsPopup");
4071 LabelCmd *title = new LabelCmd (
4072 "Mailer - Attachments",
4073 GETMSG(DT_catd, 1, 70, "Mailer - Attachments"), TRUE);
4074 _attPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
4076 _attPopup_cmdlist->add(title);
4077 _attPopup_cmdlist->add(_attPopup_separator);
4078 _attPopup_cmdlist->add(_att_save);
4079 _attPopup_cmdlist->add(_att_select_all);
4080 _menuPopupAtt = new MenuBar(_my_editor->attachArea()->getClipWindow(),
4081 "RoamAttachmentPopup", XmMENU_POPUP);
4082 _attachmentPopupMenu = _menuPopupAtt->addCommands(_attPopup_cmdlist,
4083 FALSE, XmMENU_POPUP);
4087 RoamMenuWindow::construct_help_menu()
4089 FORCE_SEGV_DECL(CmdList, cmdList);
4091 // Separator for menu items
4093 _help_separator= new SeparatorCmd( "Separator","Separator", TRUE );
4094 _help_overview = new OnAppCmd("Overview", GETMSG(DT_catd, 1, 71, "Overview"),
4096 _help_tasks = new TasksCmd("Tasks", GETMSG(DT_catd, 1, 72, "Tasks"),
4098 _help_reference = new ReferenceCmd("Reference",
4099 GETMSG(DT_catd, 1, 73, "Reference"),
4101 _help_on_item = new OnItemCmd("On Item", GETMSG(DT_catd, 1, 74, "On Item"),
4103 _help_using_help = new UsingHelpCmd("Using Help",
4104 GETMSG(DT_catd, 1, 75, "Using Help"),
4106 cmdList = new CmdList( "Help", GETMSG(DT_catd, 1, 76, "Help") );
4107 _help_cmdlist = cmdList;
4109 cmdList->add ( _help_overview );
4110 cmdList->add ( _help_separator );
4111 cmdList->add ( _help_tasks );
4112 cmdList->add ( _help_reference );
4113 cmdList->add ( _help_separator );
4114 cmdList->add ( _help_on_item );
4115 cmdList->add ( _help_separator );
4116 cmdList->add ( _help_using_help );
4117 cmdList->add ( _help_separator );
4119 _help_about_mailer = new RelNoteCmd("About Mailer...",
4120 GETMSG(DT_catd, 1, 77, "About Mailer..."),
4122 cmdList->add ( _help_about_mailer );
4124 // Make help menu show up on right side of menubar.
4125 _menuBar->addCommands ( cmdList, TRUE );
4130 RoamMenuWindow::syncCachedContainerList(void)
4132 RoamMenuWindow *rmw = NULL;
4134 rmw = theRoamApp.nextRoamMenuWindow(NULL);
4138 // Sync the cached lists to an existing RoamMenuWindow.
4139 for (int i = rmw->_cached_containerlist->length(); i > 0; i--) {
4140 char *name = (*(rmw->_cached_containerlist))[i-1]->containerName();
4141 addToCachedContainerList(name);
4146 RoamMenuWindow::get_mail_rc()
4150 if (NULL == _mailbox) return NULL;
4151 return _mailbox->session()->mailRc(error);
4156 RoamMenuWindow::load_mailbox(
4157 DtMailEnv & mail_error
4162 // If there is no mailbox, return.
4168 // Now load the messages into the scrolling list.
4169 // This will get the DtMailMessageHandles into the _msgs array and
4170 // it will also get their XmStrings into the CharArray of the _list.
4171 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 27, "Loading..."));
4173 // Call load_headers() to get the XmStrings into the XmList!
4175 count = _list->load_headers(mail_error);
4177 if (mail_error.isSet()) {
4178 // Return whatever error mailbox->get_next_msg() returned.
4179 theRoamApp.unbusyAllWindows();
4186 this->message(GETMSG(DT_catd, 3, 28, "Empty container"));
4187 setIconName(EmptyIcon);
4190 _list->sort_messages();
4192 theRoamApp.unbusyAllWindows();
4196 RoamMenuWindow::clear_message()
4202 RoamMenuWindow::text_selected()
4205 // turn on sensitivity for Cut/Clear/Copy/Paste/Delete
4210 RoamMenuWindow::text_unselected()
4213 // turn off sensitivity for those items
4217 // syncViewAndStore() does the sync-ing of the view of a mail
4218 // container and the storage of that container.
4219 // This method gets invoked every time a message gets expunged
4220 // by the back end based on "timed delete".
4221 // The method needs to then remove the expunged message from the
4222 // deleted messages list, thereby syncing the view to be always
4223 // current with the storage.
4224 // Similarly, the method also gets invoked when the container store
4225 // has received new mail. The view then needs to be updated....
4229 RoamMenuWindow::syncViewAndStoreCallback(
4230 DtMailCallbackOp op,
4232 const char *, // prompt_hint
4241 va_start(args, client_data);
4242 RoamMenuWindow * rmw = (RoamMenuWindow *)client_data;
4244 bval = rmw->syncViewAndStore(op, path, args);
4251 RoamMenuWindow::syncViewAndStore(
4252 DtMailCallbackOp op,
4259 DtMailMessageHandle tmpMH;
4269 // New mail has come in. Load it in and update the
4270 // view's list of headers to also display it.
4272 tmpMH = va_arg(args, DtMailMessageHandle);
4273 this->_list->load_headers(error, tmpMH);
4275 newMailIndicators();
4279 case DTMC_DELETEMSG:
4281 // A message has been expunged from the store by the back end.
4282 // The expunge has been done based on "timed delete".
4283 // Remove the expunged message from the displayed list of
4289 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.");
4290 this->_genDialog->setToErrorDialog(
4291 GETMSG(DT_catd, 2, 10, "Mailer"),
4293 answer = this->_genDialog->post_and_return(
4294 GETMSG(DT_catd, 3, 29, "OK"),
4295 DTMAILHELPUNKNOWNSTATE);
4297 this->reopen_mail_file();
4302 case DTMC_ACCESSFAILED:
4304 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.");
4305 this->_genDialog->setToErrorDialog(
4306 GETMSG(DT_catd, 2, 10, "Mailer"),
4308 answer = this->_genDialog->post_and_return(
4309 GETMSG(DT_catd, 3, 29, "OK"),
4310 GETMSG(DT_catd, 3, 19, "Cancel"),
4311 DTMAILHELPUNKNOWNSTATE);
4312 this->normalCursor();
4315 this->reopen_mail_file();
4322 case DTMC_SERVERPASSWORDNEEDED:
4325 char *buffer = new char[2048];
4326 char *errmsgarg = va_arg(args, char*);
4328 sprintf(buffer, "%s", errmsgarg);
4329 this->_genDialog->setToTextFieldDialog(
4330 GETMSG(DT_catd, 2, 10, "Mailer"),
4332 answer = this->_genDialog->post_and_return(
4333 GETMSG(DT_catd, 3, 29, "Ok"),
4334 GETMSG(DT_catd, 3, 19, "Cancel"),
4335 DTMAILHELPUNKNOWNSTATE);
4336 this->normalCursor();
4340 char *password = NULL;
4341 DtMailEnv mail_error;
4342 password = _genDialog->getTextFieldValue();
4343 _mailbox->updateMailRetrievalPassword(password);
4344 _mailbox->checkForMail(error);
4345 if (NULL != password) free(password);
4353 case DTMC_SERVERACCESSFAILED:
4356 char *buffer = new char[2048];
4357 char *errmsgarg = va_arg(args, char*);
4359 errmsg = GETMSG(DT_catd, 1, 256, "Mail server access failed:\n%s");
4361 sprintf(buffer, errmsg, errmsgarg);
4362 this->_genDialog->setToErrorDialog(
4363 GETMSG(DT_catd, 2, 10, "Mailer"),
4365 answer = this->_genDialog->post_and_return(
4366 GETMSG(DT_catd, 1, 257, "Options..."),
4367 GETMSG(DT_catd, 3, 19, "Cancel"),
4368 DTMAILHELPUNKNOWNSTATE);
4369 this->normalCursor();
4373 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4374 optCmd->displayMailRetrievalOptionsPane();
4382 case DTMC_GETMAILCOMMANDFAILED:
4385 char *buffer = new char[2048];
4386 char *errmsgarg = va_arg(args, char*);
4389 GETMSG(DT_catd, 1, 258, "User Getmail command failed:\n%s");
4391 sprintf(buffer, errmsg, errmsgarg);
4392 this->_genDialog->setToErrorDialog(
4393 GETMSG(DT_catd, 2, 10, "Mailer"),
4395 answer = this->_genDialog->post_and_return(
4396 GETMSG(DT_catd, 1, 257, "Options..."),
4397 GETMSG(DT_catd, 3, 19, "Cancel"),
4398 DTMAILHELPUNKNOWNSTATE);
4399 this->normalCursor();
4403 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4404 optCmd->displayMailRetrievalOptionsPane();
4412 case DTMC_SERVERACCESSINFO:
4415 char *infomsg = va_arg(args, char*);
4421 case DTMC_SERVERACCESSINFOERROR:
4424 char *buffer = new char[2048];
4425 char *errmsgarg = va_arg(args, char*);
4427 sprintf(buffer, "%s", errmsgarg);
4428 this->_genDialog->setToErrorDialog(
4429 GETMSG(DT_catd, 2, 10, "Mailer"),
4431 answer = this->_genDialog->post_and_return(
4432 GETMSG(DT_catd, 1, 257, "Options..."),
4433 GETMSG(DT_catd, 3, 19, "Cancel"),
4434 DTMAILHELPUNKNOWNSTATE);
4435 this->normalCursor();
4439 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4440 optCmd->displayMailRetrievalOptionsPane();
4448 case DTMC_INODECHANGED:
4450 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.");
4452 this->_genDialog->setToErrorDialog(
4453 GETMSG(DT_catd, 2, 10, "Mailer"),
4455 answer = this->_genDialog->post_and_return(
4456 GETMSG(DT_catd, 3, 29, "OK"),
4457 GETMSG(DT_catd, 3, 19, "Cancel"),
4458 DTMAILHELPUNKNOWNSTATE);
4459 this->normalCursor();
4462 this->reopen_mail_file();
4471 // We are asked to save changes and close the file.
4472 // The backend will take care of unlocking the file.
4473 this->quit_silently();
4476 case DTMC_QUERYLOCK:
4478 // The file is lock by another mailer.
4479 // Should we ask for the lock?
4480 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4481 GETMSG(DT_catd, 3, 82, "Someone else is using this mailbox.\nWould you like to demand exclusive access?"));
4482 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 18, "OK"),
4483 GETMSG(DT_catd, 3, 19, "Cancel"), DTMAILHELPTAKELOCK);
4485 this->normalCursor();
4494 // We are not able to obtain a TT lock on this folder,
4495 // ask user if he wants to open it as read only.
4496 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4497 GETMSG(DT_catd, 3, 83, "Mailer is unable to obtain exclusive access to this mailbox.\nWould you like to open this mailbox read-only?"));
4498 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 18, "OK"),
4499 GETMSG(DT_catd, 3, 19, "Cancel"),
4500 DTMAILHELPOPENREADONLY);
4501 this->normalCursor();
4508 case DTMC_READWRITEOVERRIDE:
4509 // We are not able to obtain a lock on this folder,
4510 // ask user if he wants to open it as read only.
4511 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4512 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)."));
4513 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 95, "Read-only"),
4514 GETMSG(DT_catd, 3, 19, "Cancel"),
4515 GETMSG(DT_catd, 3, 96, "Read-Write"),
4516 DTMAILHELPOPENREADWRITEOVERRIDE);
4517 this->normalCursor();
4518 // Now the tricky part - since this method can only return
4519 // DTM_TRUE or DTM_FALSE, we must have a way to indicate "readOnly",
4520 // "readWrite" or "cancel" - horrid hack: readOnly is DTM_FALSE,
4521 // "readWrite" is DTM_TRUE, and "cancel" is (DTM_TRUE+DTM_FALSE)*2
4525 case 1: // Read-only
4527 case 3: // Read-Write
4530 return((DtMailBoolean)((DTM_FALSE+DTM_TRUE)*2));
4533 case DTMC_DOTDTMAILLOCKFAILED:
4536 char *buffer = new char[2048];
4537 char *lockpath = va_arg(args, char*);
4538 char *errormsg = va_arg(args, char*);
4539 char *cancel = GETMSG(DT_catd, 3, 19, "Cancel");
4540 char *ok = GETMSG(DT_catd, 3, 18, "OK");
4541 char *mailer = GETMSG(DT_catd, 3, 16, "Mailer");
4542 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.");
4544 // We are not able to obtain a .dtmail lock on this folder,
4545 // ask user if he wants to open it as read only.
4546 sprintf(buffer, msgfmt, errormsg, path, ok, cancel, lockpath);
4547 _genDialog->setToQuestionDialog(mailer, buffer);
4548 answer =_genDialog->post_and_return(ok, cancel, DTMAILHELPOPENREADONLY);
4549 this->normalCursor();
4559 this->normalCursor();
4563 this->normalCursor();
4567 // Convert the rfc file.
4568 // Commented out for PAR 5. Needs to be uncommented out for PAR 6
4572 RoamMenuWindow::convert(
4577 // Obsoleted when Bento went away
4580 // The back end uses the return value to either continue conversion or
4581 // to stop converting.
4584 RoamMenuWindow::ConvertStatusCB(
4591 RoamMenuWindow *rmw = (RoamMenuWindow *)client_data;
4593 // Return 0 if the conversion is still to proceed.
4594 // Return 1 if the conversion is to stop (e.g., if the user
4595 // has interrupted it...)
4597 return(rmw->showConversionStatus(current, total));
4601 RoamMenuWindow::showConversionStatus(
4607 int num_already_converted; // num msgs already converted as set prev.
4608 int previously_complete; // percent of converted msgs as set prev.
4609 int now_complete; // percent of converted messages based on parameters
4611 // Remember, the number set may differ from the previous call to
4612 // this method. We are not doing set_convert_data() for every call
4613 // to this method and so, what's set will differ from the previous
4614 // call to this method...
4616 num_already_converted = _convertContainerCmd->get_num_converted();
4617 previously_complete = num_already_converted * 100 / total;
4619 now_complete = current * 100 / total;
4621 if ((now_complete > (previously_complete + 5)) ||
4622 (now_complete == 100)) {
4623 str = GETMSG(DT_catd, 1, 79, "Converting... %d percent complete");
4624 // Estimate 4 characters for numbers and 1 null terminator.
4625 buf = new char[strlen(str) + 5];
4626 sprintf(buf, str, now_complete);
4628 _convertContainerCmd->updateDialog(buf);
4631 _convertContainerCmd->set_convert_data(current, total);
4634 _convertContainerCmd->updateAnimation();
4637 // Check and see if the user had interrupted the conversion
4638 // If the user had interrupted, we need to stop the back-end
4641 if (_convertContainerCmd->interrupted()) {
4651 RoamMenuWindow::conversionFinishedCallback(
4652 RoamInterruptibleCmd *,
4653 Boolean interrupted,
4658 // Do something only it the conversion really finished.
4659 // If it was interrupted, just return...
4662 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
4663 rmw->conversionFinished();
4667 // If the conversion finished successfully, then we try to open() again
4668 // and if no problems, load the headers into the scrolling list...
4671 RoamMenuWindow::conversionFinished()
4673 DtMailEnv mail_error;
4675 // Initialize the mail_error.
4678 mailboxFullpath(_convertContainerCmd->get_destination_name());
4680 this->open(mail_error,
4681 _openContainerCmd->_open_create_flag,
4682 _openContainerCmd->_open_lock_flag);
4684 // if the user had cancelled the open, then the RMW will not have
4685 // its mailbox set. Do not proceed to load the mailbox. Return.
4687 // Ideally, open() should set the mail_error if the user cancels
4688 // the open. And we should check the mail_error here...
4690 if (mail_error.isSet()) {
4694 this->load_mailbox(mail_error);
4696 if (mail_error.isSet()) {
4698 // Post a dialog indicating problems in loading...
4704 // Post the dialog displaying the error text.
4705 // Also display the minor_code, if resource/environment variable
4707 // User has no choice but to OK
4708 // postErrorDialog() is the benign uncle of postFatalErrorDialog() --
4709 // it does not quit the RMW.
4712 RoamMenuWindow::postErrorDialog(
4713 DtMailEnv &mail_error
4718 const char *text_str = (const char *)mail_error;
4720 // Assume that the char *text that comes in has already
4721 // been processed for i18n.
4723 _genDialog->setToErrorDialog(GETMSG(DT_catd, 2, 13, "Mailer"),
4726 helpId = DTMAILHELPERROR;
4727 int i = _genDialog->post_and_return(GETMSG(DT_catd, 3, 31, "OK"), helpId);
4736 RoamMenuWindow::manage()
4738 Dimension win_x, win_y, win_wid, win_ht, win_bwid;
4740 MainWindow::manage();
4741 XmUpdateDisplay(this->baseWidget());
4742 // Obtain the current dimensions of the RMW
4749 XmNborderWidth, &win_bwid,
4756 _border_width = win_bwid;
4761 RoamMenuWindow::expunge(void)
4766 // First order of business - busy out active windows
4768 theRoamApp.busyAllWindows(
4769 GETMSG(DT_catd, 3, 32, "Destroying deleted messages..."));
4771 // Before changing the state of any deleted/undeleted lists,
4772 // perform the destroy deleted operation and make sure that
4773 // it was successful - if there was an error, notify the user
4774 // and discontinue processing
4776 _mailbox->expunge(error);
4777 if((DTMailError_t) error == DTME_OutOfSpace )
4780 ShowErrMsg((char *)error.getClient(),FALSE,(void *)this );
4781 error.setClient(NULL);
4783 theRoamApp.unbusyAllWindows();
4787 if (error.isSet()) {
4788 // An error happened - must inform the user
4790 postErrorDialog(error);
4794 if (_msg_undelete_from_list->dialog())
4795 _msg_undelete_from_list->dialog()->expunge();
4800 // Last order of business - unbusy out active windows
4802 theRoamApp.unbusyAllWindows();
4806 RoamMenuWindow::attachment_selected()
4808 _att_save->activate();
4813 RoamMenuWindow::all_attachments_selected()
4815 _att_save->deactivate();
4817 if (_attActions_cmdlist != NULL) {
4818 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
4819 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
4820 _attActions_cmdlist);
4821 delete _attActions_cmdlist;
4822 _attActions_cmdlist = NULL;
4827 RoamMenuWindow::all_attachments_deselected()
4829 _att_save->deactivate();
4831 if (_attActions_cmdlist != NULL) {
4832 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
4833 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
4834 _attActions_cmdlist);
4835 delete _attActions_cmdlist;
4836 _attActions_cmdlist = NULL;
4841 RoamMenuWindow::activate_default_message_menu()
4844 _msg_open->activate();
4846 _msg_save_as->activate();
4848 XtSetSensitive(_copyto_cmdlist->getPaneWidget(), TRUE);
4850 _msg_print->activate();
4852 _msg_delete->activate();
4857 RoamMenuWindow::deactivate_default_message_menu()
4860 _msg_open->deactivate();
4862 _msg_save_as->deactivate();
4864 XtSetSensitive(_copyto_cmdlist->getPaneWidget(), FALSE);
4866 _msg_print->deactivate();
4868 _msg_delete->deactivate();
4873 RoamMenuWindow::activate_default_attach_menu()
4875 _att_select_all->activate();
4879 RoamMenuWindow::deactivate_default_attach_menu()
4881 _att_select_all->deactivate();
4885 RoamMenuWindow::newMailIndicators(void)
4887 // Set to new mail icon only if the window is iconified
4888 if (this->isIconified()) {
4889 setIconName(NewMailIcon);
4892 if ((_we_called_newmail == FALSE) || (this->isIconified())){
4894 // See if we are supposed to ring the bell.
4897 const char * val = NULL;
4898 DtMail::Session * m_session = theRoamApp.session()->session();
4899 m_session->mailRc(error)->getValue(error, "flash", &val);
4900 if (error.isNotSet()) {
4901 int flashes = (int) strtol(val, NULL, 10);
4908 m_session->mailRc(error)->getValue(error, "bell", &val);
4909 if (error.isNotSet()) {
4910 int beeps = (int) strtol(val, NULL, 10);
4912 XBell(XtDisplay(baseWidget()), 0);
4916 else // Default to 1 beep
4917 XBell(XtDisplay(baseWidget()), 0);
4923 m_session->mailRc(error)->getValue(error, "realsound", &val);
4924 if (error.isNotSet()) {
4926 if (SafeStat("/usr/bin/audioplay", &stat) == 0) {
4927 char *play_str = new char[1500];
4928 sprintf(play_str, "/usr/bin/audioplay %s", val);
4938 _we_called_newmail = FALSE;
4942 RoamMenuWindow::save_attachment_callback(
4948 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
4949 obj->save_selected_attachment(selection);
4953 RoamMenuWindow::save_selected_attachment(
4957 DtMailEnv mail_error;
4959 // Initialize the mail_error.
4962 DtMailEditor *editor = this->get_editor();
4963 AttachArea *attacharea = editor->attachArea();
4964 Attachment *attachment = attacharea->getSelectedAttachment();
4966 // Get selected attachment, if none selected, then return.
4967 if ( attachment == NULL ) {
4968 // Let User know that no attachment has been selected???
4970 char *helpId = NULL;
4973 _genDialog->setToErrorDialog(
4974 GETMSG(DT_catd, 1, 80, "Mailer"),
4975 GETMSG(DT_catd, 2, 14, "An attachment needs to be selected before issuing the\n\"Save As\" command to save to a file.") );
4976 helpId = DTMAILHELPSELECTATTACH;
4977 answer = _genDialog->post_and_return(
4978 GETMSG(DT_catd, 3, 33, "OK"), helpId );
4983 attachment->saveToFile(mail_error, selection);
4985 if (mail_error.isSet()) {
4992 RoamMenuWindow::addAttachmentActions(
4999 AttachmentActionCmd *attachActionCmd;
5001 if (_attActions_cmdlist == NULL) {
5002 _attActions_cmdlist = new CmdList("AttachmentActions", "AttachmentActions");
5005 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
5006 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
5007 _attActions_cmdlist);
5008 delete _attActions_cmdlist;
5009 _attActions_cmdlist = new CmdList("AttachmentActions", "AttachmentActions");
5013 for (i = 0; i < indx; i++) {
5014 anAction = actions[i];
5016 // Retrieve the localized action label
5017 actionLabel = DtActionLabel(anAction);
5018 attachActionCmd = new AttachmentActionCmd(
5023 _attActions_cmdlist->add(attachActionCmd);
5026 _attachmentMenu = _menuBar->addCommands(
5030 _attachmentPopupMenu = _menuPopupAtt->addCommands(
5031 _attachmentPopupMenu,
5037 RoamMenuWindow::removeAttachmentActions()
5040 // Stubbed out for now
5044 RoamMenuWindow::invokeAttachmentAction(
5049 DtMailEditor *editor = this->get_editor();
5050 AttachArea *attacharea = editor->attachArea();
5051 Attachment *attachment = attacharea->getSelectedAttachment();
5053 attachment->invokeAction(index);
5058 RoamMenuWindow::selectAllAttachments()
5061 DtMailEditor *editor = this->get_editor();
5062 AttachArea *attachArea = editor->attachArea();
5064 attachArea->selectAllAttachments();
5068 // Returns the index of the match, -1 if there is no match.
5070 RoamMenuWindow::inList(char *filename, DtVirtArray<ContainerMenuCmd *> *list)
5072 ContainerMenuCmd *cmd;
5074 if (list == NULL) return(-1);
5083 DtMail::Session * d_session = theRoamApp.session()->session();
5085 DtMail::MailRc * mailrc = d_session->mailRc(error);
5086 const char *value = NULL;
5089 mailrc->getValue(error, "folder", &value);
5090 if (error.isNotSet())
5092 newname = (char*)malloc(strlen(filename) + strlen(value) + 2);
5093 sprintf(newname, "%s/%s", value, filename);
5094 for (int i=0; i < list->length(); i++)
5097 if (strcmp(newname, cmd->containerName()) == 0) {
5102 free((void*) newname);
5106 free((void*) value);
5109 for (int i=0; i < list->length(); i++)
5112 if (filename && strcmp(filename, cmd->containerName()) == 0)
5120 RoamMenuWindow::addToCachedContainerList(char *filename)
5123 ContainerMenuCmd *null_container, *open_container;
5124 ContainerMenuCmd *move_container, *copy_container;
5127 if (filename != NULL &&
5128 *filename != '\0' &&
5129 (_max_cached_list_size > 0))
5131 DtMail::Session *d_session = theRoamApp.session()->session();
5132 DtMailObjectSpace space;
5133 DtMailEnv mail_error;
5135 char *mail_file = NULL;
5137 // Is the file in the user defined list?
5138 if ((index = inList(filename, _user_containerlist)) != -1)
5141 d_session->queryImpl(
5143 d_session->getDefaultImpl(mail_error),
5144 DtMailCapabilityInboxName,
5148 is_inbox = (0 == strcmp(mail_file, filename));
5149 free((void*) mail_file);
5153 // Is the file in the recently used list?
5154 if ((index = inList(filename, _cached_containerlist)) != -1)
5156 // Move filename to top of list and move everything else down.
5157 if (index == 0) return;
5160 // Change the filenames that each of the Cmds points to in both
5161 // the move and copy cached lists.
5163 name = (*_cached_containerlist)[index]->containerName();
5165 for (i = index; i > 0; i--) {
5166 char *s = (*_cached_containerlist)[i-1]->containerName();
5168 (*_cached_containerlist)[i]->changeContainer(s);
5169 (*_open_container_containerlist_cached)[i]->changeContainer(s);
5170 (*_copyto_containerlist_cached)[i]->changeContainer(s);
5171 (*_move_containerlist_cached)[i]->changeContainer(s);
5174 (*_cached_containerlist)[0]->changeContainer(name);
5175 (*_open_container_containerlist_cached)[0]->changeContainer(name);
5176 (*_copyto_containerlist_cached)[0]->changeContainer(name);
5177 (*_move_containerlist_cached)[0]->changeContainer(name);
5180 // Rename the labels in the menu.
5182 if (_first_cached_item != _first_cached_item + index)
5184 _menuBar->rotateLabels(
5187 _first_cached_item + index);
5188 _menuBar->rotateLabels(
5191 _first_cached_item + index);
5192 _menuBar->rotateLabels(
5195 _first_cached_item + index);
5196 _menuBar->rotateLabels(
5199 _first_cached_item + index);
5204 // Add filename to Recently Used List.
5205 int cached_list_size = _cached_containerlist->length();
5207 // Is there room for the menu to grow?
5208 if (cached_list_size < _max_cached_list_size)
5210 // Create the new command.
5211 null_container = new ContainerMenuCmd(strdup(filename),
5216 open_container = new ContainerMenuCmd(strdup(filename),
5221 copy_container = new ContainerMenuCmd(strdup(filename),
5226 move_container = new ContainerMenuCmd(strdup(filename),
5232 // Add it to the end of the arrays.
5233 _cached_containerlist->append(null_container);
5234 _open_container_containerlist_cached->append(open_container);
5235 _copyto_containerlist_cached->append(copy_container);
5236 _move_containerlist_cached->append(move_container);
5238 // Add it to the end of the menus.
5239 _menuBar->addCommand(_opencontainerMenu, open_container);
5240 _menuBar->addCommand(_copytoMenu, copy_container);
5241 _menuBar->addCommand(_moveMenu, move_container);
5242 _menuBar->addCommand(_msgsPopupMoveMenu, move_container);
5244 // Recursively call addToCachedContainerList to rotate to top.
5245 cached_list_size = _cached_containerlist->length();
5246 if (cached_list_size > 1)
5247 addToCachedContainerList(filename);
5251 // Add new entry to the bottom of the cache.
5252 int i = cached_list_size-1;
5255 // Replace the end of the arrays.
5256 (*_cached_containerlist)[i]->changeContainer(strdup(s));
5257 (*_open_container_containerlist_cached)[i]->changeContainer(
5259 (*_copyto_containerlist_cached)[i]->changeContainer(strdup(s));
5260 (*_move_containerlist_cached)[i]->changeContainer(strdup(s));
5262 // Replace the end of the menus.
5263 i += _first_cached_item;
5264 _menuBar->changeLabel(_opencontainerMenu, i, s);
5265 _menuBar->changeLabel(_copytoMenu, i, s);
5266 _menuBar->changeLabel(_moveMenu, i, s);
5267 _menuBar->changeLabel(_msgsPopupMoveMenu, i, s);
5269 // Recursively call addToCachedContainerList to rotate to top.
5270 if (_first_cached_item != i)
5271 addToCachedContainerList(filename);
5278 RoamMenuWindow::showAttachArea()
5280 DtMailEditor *editor = this->get_editor();
5281 editor->showAttachArea();
5285 RoamMenuWindow::hideAttachArea()
5287 DtMailEditor *editor = this->get_editor();
5288 editor->hideAttachArea();
5292 RoamMenuWindow::fullHeader(
5296 DtMailMessageHandle msgHandle;
5297 DtMailEnv mail_error;
5299 // Initialize the mail_error.
5302 _full_header_resource = state;
5304 msgHandle = this->list()->current_msg_handle();
5306 this->list()->display_message(mail_error, msgHandle);
5312 RoamMenuWindow::postMsgsPopup(XEvent *event)
5314 XmMenuPosition(_msgsPopupMenu, (XButtonEvent *)event);
5315 XtManageChild(_msgsPopupMenu);
5319 RoamMenuWindow::MenuButtonHandler(
5325 RoamMenuWindow *obj = (RoamMenuWindow *)cd;
5327 if(event->xany.type != ButtonPress)
5330 XButtonEvent *be = (XButtonEvent *)event;
5332 if(be->button == theApplication->bMenuButton())
5333 obj->postMsgsPopup(event);
5337 RoamMenuWindow::attachmentFeedback(
5345 this->normalCursor();
5349 // map_menu is used to figure out how many columns to split the menu
5350 // into. It is a callback that is called when the menu is mapped.
5351 // If the menu is over half the height of the screen, it figures out
5352 // how many columns to make the menu, and sets its XmNnumColumns
5353 // attribute to that value. It calculates the maximum number of columns
5354 // that would fit and never goes beyond that number.
5357 RoamMenuWindow::map_menu(
5364 short maxcols, newcols, columns;
5365 int screenheight = HeightOfScreen(XtScreen(menu));
5366 int fudgefact = 20; /* to allow for decorations on menu */
5372 XmNnumColumns, &columns,
5376 if ((int) (h + fudgefact) > ((int) screenheight / 2)) {
5378 /* the menu is taller than half the screen. We need to find out how
5379 many more columns to specify for the menu to make it fit. */
5381 newcols = (columns * (int) ((int) (h + fudgefact)/(int) (screenheight/2))) + 1;
5382 maxcols = WidthOfScreen(XtScreen(menu))/(int) ((int)w/(int)columns);
5384 if (newcols > maxcols)
5387 XtVaSetValues(menu, XmNnumColumns, newcols, NULL);
5396 RoamMenuWindow::setTitle(char *suffix)
5398 DtMailEnv mail_error;
5399 MailSession *ses = theRoamApp.session();
5400 DtMail::Session *d_session = ses->session();
5401 char *prefix = GETMSG(DT_catd, 1, 6, "Mailer");
5407 if (mailbox_fullpath())
5408 path = d_session->getRelativePath(mail_error, mailbox_fullpath());
5409 else if (mailboxName())
5410 path = d_session->getRelativePath(mail_error, mailboxName());
5411 else path = strdup("UNTITLED");
5415 format = "%s - %s [%s]";
5416 len = strlen(format) + strlen(prefix) + strlen(path) + strlen(suffix);
5417 new_title = new char[len];
5418 sprintf(new_title, format, prefix, path, suffix);
5423 len = strlen(format) + strlen(prefix) + strlen(path);
5424 new_title = new char[len];
5425 sprintf(new_title, format, prefix, path);
5429 delete [] new_title;
5434 RoamMenuWindow::setVacationTitle()
5436 // Add "[Vacation]" to the title of the roam menu window
5437 char *vacation = GETMSG(DT_catd, 1, 3, "Vacation");
5442 RoamMenuWindow::removeVacationTitle()
5444 // Reset the title on the roam menu window; take out "[Vacation]"
5449 RoamMenuWindow::ShowErrMsg(char * fsname,Boolean compose,void *client_data)
5452 assert((NULL != fsname));
5455 RoamMenuWindow * self = (RoamMenuWindow *)client_data;
5456 parent = self->GetMainWin();
5460 SendMsgDialog * self = (SendMsgDialog *)client_data;
5461 parent = self->GetMainWin();
5464 parent = theApplication->baseWidget();
5465 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog",parent,XmDIALOG_FULL_APPLICATION_MODAL);
5467 char *errMsg = (char *) XtCalloc(1,10240+strlen(fsname));
5470 // Serious error here -- No Space on Filesystem --
5471 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);
5473 genDialog->setToErrorDialog(
5474 GETMSG(DT_catd, 1, 6, "Mailer"),
5478 genDialog->post_and_return(
5479 GETMSG(DT_catd, 3, 9, "OK"),
5484 RoamMenuWindow::stopAutoSave(void)
5487 _mailbox->startAutoSave(error,DTM_FALSE);
5490 RoamMenuWindow::startAutoSave(void)
5493 _mailbox->startAutoSave(error,DTM_TRUE);
5497 RoamMenuWindow::sync_work_area_size(void)
5499 Dimension width, height;
5501 XtVaGetValues(_workArea, XmNwidth, &width, XmNheight, &height, NULL);
5503 if (_workarea_width && _workarea_height &&
5504 (_workarea_width!=width || _workarea_height!=height))
5506 enableWorkAreaResize();
5507 XtVaSetValues(_workArea, XmNwidth, width, XmNheight, height, NULL);
5508 disableWorkAreaResize();
5510 _workarea_width = width;
5511 _workarea_height = height;