2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * $TOG: RoamMenuWindow.C /main/80 1999/07/07 14:23:51 mgreess $
28 * RESTRICTED CONFIDENTIAL INFORMATION:
30 * The information in this document is subject to special
31 * restrictions in a confidential disclosure agreement between
32 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
33 * document outside HP, IBM, Sun, USL, SCO, or Univel without
34 * Sun's specific written approval. This document and all copies
35 * and derivative works thereof must be returned or destroyed at
38 * Copyright 1993, 1994, 1995 Sun Microsystems, Inc. All rights reserved.
43 * Common Desktop Environment
45 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
46 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
47 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
48 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
49 * (c) Copyright 1995 Digital Equipment Corp.
50 * (c) Copyright 1995 Fujitsu Limited
51 * (c) Copyright 1995 Hitachi, Ltd.
54 * RESTRICTED RIGHTS LEGEND
56 *Use, duplication, or disclosure by the U.S. Government is subject to
57 *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
58 *Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
59 *for non-DOD U.S. Government Departments and Agencies are as set forth in
60 *FAR 52.227-19(c)(1,2).
62 *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
63 *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
64 *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
65 *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
66 *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
67 *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
68 *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
73 #include <sys/param.h>
79 #if !defined(USL) && !defined(__uxp__)
84 #include <sys/utsname.h>
86 #include <sys/systeminfo.h>
89 #include <X11/Intrinsic.h>
90 #include <X11/cursorfont.h>
94 #include <Xm/RepType.h>
95 #include <Xm/PanedW.h>
97 #include <Xm/RowColumn.h>
99 #include <Xm/LabelG.h>
103 #include <DtMail/DtMailTypes.h>
104 #include <DtMail/IO.hh>
105 #include "SelectFileCmd.h"
106 #include "RoamMenuWindow.h"
108 #include "ButtonInterface.h"
109 #include "WorkingDialogManager.h"
111 #include "QuestionDialogManager.h"
112 #endif /* DEAD_WOOD */
113 #include "MemUtils.hh"
115 #include "DtMailHelp.hh"
117 #include "SendMsgDialog.h"
118 #include "AttachArea.h"
119 #include "Attachment.h"
121 #include <DtMail/OptCmd.h>
122 #include "ComposeCmds.hh"
123 #include "EUSDebug.hh"
125 #include "SortCmd.hh"
127 extern int force( Widget );
129 static const char * NormalIcon = "DtMail";
130 static const char * EmptyIcon = "DtMnone";
131 static const char * NewMailIcon = "DtMnew";
132 static const char * MailDragIcon = "DtMmsg";
134 extern nl_catd DtMailMsgCat;
135 #define MAXIMUM_PATH_LENGTH 2048
137 #define RMW_CONCAT_MAILRC_KEY(buf, pfx, key) \
138 { if (NULL==(pfx)) (void) sprintf((buf), "%s", (key)); \
139 else (void) sprintf((buf), "%s_%s", (pfx), (key)); }
142 RoamMenuWindow:: _supported[] =
144 "TARGETS", "MESSAGES", "STRING", "DELETE"
146 enum {TARGETS,MESSAGES, STR, DEL};
149 RoamMenuWindow::_resources[] =
156 XtOffset ( RoamMenuWindow *, _full_header_resource ),
166 XtOffset ( RoamMenuWindow *, _mailbox_name_resource ),
176 XtOffset ( RoamMenuWindow *, _mail_files_resource ),
184 // We need to maintain a constant WM_CLASS_NAME for SQE test
185 // suites to run consistently for all RMWs. We do that by
186 // maintaining a constant "name", as in WM_CLASS_NAME, for all
187 // RMWs by passing "dtmail" to a RMW's parent
188 // at creation time. We distinguish individual RMWs via the
189 // title which indicates what mail container they are currently
190 // looking at. The title is passed here as name; its dynamic
191 // (i.e., each RMW has its own "name", as in WM_NAME).
192 // If you are going to change the name, talk to SQE
193 // and get their consent for whatever change you are making.
195 // Note also that the name chosen must match whatever is specified
196 // in dtwm.fp (front panel configuration file) as the CLIENT_NAME
197 // for the Mail CONTROL. This is so PUSH_RECALL works.
198 // Typically this is the executable name.
200 RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
202 DtMailEnv mail_error;
204 // Initialize mail_error.
207 // Get a handle to the Inbox.
208 char *mail_file = NULL;
209 DtMailObjectSpace space;
210 DtMail::Session *d_session = theRoamApp.session()->session();
211 DtMail::MailRc *mailrc = d_session->mailRc(mail_error);
212 const char *value = NULL;
215 _forward_filename = NULL;
216 // Set the _mailbox_name here.
217 // In the absence of the RMW's title being set via title(),
218 // the _mailbox_name is what will be used in initialize().
219 _mailbox_name = NULL;
224 _mailbox_fullpath = NULL;
226 _mailbox_name_resource = NULL;
227 _mail_files_resource = NULL;
228 _full_header_resource = FALSE;
230 _required_conversion = FALSE;
231 _checkformail_when_mapped = FALSE;
232 _delete_on_quit = FALSE;
233 _we_called_newmail = FALSE;
242 _display_cached_list = FALSE;
243 _max_cached_list_size = 0;
244 _first_cached_item = 0;
245 _user_containerlist = NULL;
246 _cached_containerlist = NULL;
252 _file_cmdlist = NULL;
253 _file_separator = NULL;
254 _file_check_new_mail = NULL;
255 _file_open_inbox = NULL;
256 _file_new_container = NULL;
258 _file_destroy_deleted_msgs = NULL;
261 _file_cascade = NULL;
264 // OpenContainer Cascade Menu
266 _open_container_cmdlist = NULL;
267 _open_container_separator = NULL;
268 _open_container_inbox = NULL;
269 _open_container_other = NULL;
271 _open_container_containerlist = NULL;
272 _open_container_containerlist_cached = NULL;
273 _opencontainerMenu = NULL;
279 _msg_separator = NULL;
284 _msg_select_all = NULL;
286 _msg_undelete_last = NULL;
287 _msg_undelete_from_list = NULL;
291 // CopyTo Cascade Menu
293 _copyto_cmdlist = NULL;
294 _copyto_separator = NULL;
295 _copyto_inbox = NULL;
296 _copyto_other = NULL;
298 _copyto_containerlist = NULL;
299 _copyto_containerlist_cached = NULL;
301 _message_cascade = NULL;
307 _edit_cmdlist = NULL;
309 _edit_select_all = NULL;
317 _att_select_all = NULL;
322 _view_cmdlist = NULL;
323 _view_separator = NULL;
325 _view_previous = NULL;
326 _view_abbrev_headers = NULL;
328 _view_sortSender = NULL;
329 _view_sortSubject = NULL;
330 _view_sortSize = NULL;
331 _view_sortStatus = NULL;
336 _comp_cmdlist = NULL;
337 _comp_separator = NULL;
339 _comp_new_include = NULL;
340 _comp_forward = NULL;
341 _comp_replySender = NULL;
342 _comp_replyAll = NULL;
343 _comp_replySinclude = NULL;
344 _comp_replyAinclude = NULL;
350 _move_cmdlist = NULL;
351 _move_separator = NULL;
355 _move_containerlist = NULL;
356 _move_containerlist_cached = NULL;
358 _move_cascade = NULL;
362 _help_cmdlist = NULL;
363 _help_separator = NULL;
364 _help_overview = NULL;
366 _help_reference = NULL;
367 _help_on_item = NULL;
368 _help_using_help = NULL;
369 _help_about_mailer = NULL;
374 _msgsPopup_cmdlist = NULL;
375 _msgsPopup_separator = NULL;
377 _menuPopupMsgs = NULL;
378 _msgsPopupMenu = NULL;
379 _msgsPopupMoveMenu = NULL;
384 _textPopup_cmdlist = NULL;
385 _textPopup_separator = NULL;
390 _attPopup_cmdlist = NULL;
391 _attPopup_separator = NULL;
392 _attActions_cmdlist = NULL;
394 _attachmentMenu = NULL;
397 // ConvertContainerCmd
399 _convertContainerCmd = NULL;
400 _openContainerCmd = NULL;
403 // Message view pane buttons
405 _delete_button = NULL;
407 _previous_button = NULL;
408 _replySender_button = NULL;
409 _print_button = NULL;
410 _move_copy_button = NULL;
414 d_session->queryImpl(mail_error,
415 d_session->getDefaultImpl(mail_error),
416 DtMailCapabilityInboxName,
419 if (strcmp(mail_file, mailboxName()) == 0)
424 free((void*)mail_file);
430 // Initialize private variables
437 _message_summary = NULL;
439 _rowOfButtons = NULL;
440 _rowOfMessageStatus = NULL;
443 _clear_message_p = FALSE;
447 buffer = XtMalloc(BUFSIZ);
452 RMW_CONCAT_MAILRC_KEY(buffer, DTMAS_INBOX, "sortby");
456 RMW_CONCAT_MAILRC_KEY(buffer, mailboxName(), "sortby");
461 mailrc->getValue(mail_error, buffer, &value);
462 if (mail_error.isSet() || NULL == value)
463 _last_sorted_by = SortTimeDate;
465 _last_sorted_by = (SortBy) atoi(value);
468 if (NULL != buffer) XtFree(buffer);
472 RoamMenuWindow::~RoamMenuWindow()
477 theRoamApp.session()->close(error, _mailbox);
479 // Cannot return error to caller since there's
480 // no caller. What do we do?
484 if (NULL != _forward_filename)
485 free(_forward_filename);
487 free((void*) _mailbox_name);
488 if (_mailbox_fullpath)
489 free((void*) _mailbox_fullpath);
491 if (NULL != _dialogs)
493 if (NULL != _findDialog)
498 if (NULL != _user_containerlist)
499 delete _user_containerlist;
500 if (NULL != _cached_containerlist)
501 delete _cached_containerlist;
502 if (NULL != _filemenu2)
503 free((void*) _filemenu2);
506 delete _file_cmdlist;
507 delete _file_separator;
508 delete _file_check_new_mail;
509 delete _file_open_inbox;
510 delete _file_new_container;
511 #if defined(USE_OLD_FILE_OPEN)
514 delete _file_destroy_deleted_msgs;
517 // OpenContainer Cascade Menu
518 delete _open_container_cmdlist;
519 delete _open_container_separator;
520 delete _open_container_inbox;
521 delete _open_container_other;
523 if (NULL != _open_container_containerlist)
524 delete _open_container_containerlist;
525 if (NULL != _open_container_containerlist_cached)
526 delete _open_container_containerlist_cached;
531 delete _msg_separator;
537 delete _msg_undelete_last;
538 delete _msg_undelete_from_list;
540 // CopyTo Cascade Menu
541 delete _copyto_cmdlist;
542 delete _copyto_separator;
543 delete _copyto_inbox;
544 delete _copyto_other;
546 if (NULL != _copyto_containerlist)
547 delete _copyto_containerlist;
548 if (NULL != _copyto_containerlist_cached)
549 delete _copyto_containerlist_cached;
552 delete _edit_cmdlist;
554 delete _edit_select_all;
559 delete _att_select_all;
562 delete _view_cmdlist;
563 delete _view_separator;
565 delete _view_previous;
566 delete _view_abbrev_headers;
568 delete _view_sortSender;
569 delete _view_sortSubject;
570 delete _view_sortSize;
571 delete _view_sortStatus;
574 delete _comp_cmdlist;
575 delete _comp_separator;
577 delete _comp_new_include;
578 delete _comp_forward;
579 delete _comp_replySender;
580 delete _comp_replyAll;
581 delete _comp_replySinclude;
582 delete _comp_replyAinclude;
585 delete _move_cmdlist;
586 delete _move_separator;
590 if (NULL != _move_containerlist)
591 delete _move_containerlist;
592 if (NULL != _move_containerlist_cached)
593 delete _move_containerlist_cached;
596 delete _help_separator;
597 delete _help_cmdlist;
598 delete _help_overview;
600 delete _help_reference;
601 delete _help_on_item;
602 delete _help_using_help;
603 delete _help_about_mailer;
606 delete _msgsPopup_cmdlist;
607 delete _msgsPopup_separator;
609 delete _menuPopupMsgs;
612 delete _textPopup_cmdlist;
613 delete _textPopup_separator;
616 delete _attPopup_cmdlist;
617 delete _attPopup_separator;
618 delete _attActions_cmdlist;
620 // ConvertContainerCmd
621 delete _convertContainerCmd;
622 delete _openContainerCmd;
624 // Message view pane buttons
625 delete _delete_button;
627 delete _previous_button;
628 delete _replySender_button;
629 delete _print_button;
630 delete _move_copy_button;
642 XmDestroyPixmap(XtScreen(baseWidget()), _mbox_image);
644 XmDestroyPixmap(XtScreen(baseWidget()), _mbox_mask);
649 RoamMenuWindow::initialize()
651 XmRepTypeInstallTearOffModelConverter();
652 MenuWindow::initialize();
654 if (!this->baseWidget())
658 GETMSG(DT_catd, 2, 3,
659 "Unable to initialize windows. Exiting.\n"));
664 setStatus(GETMSG(DT_catd, 3, 2, "Initializing..."));
666 // XInternAtom(XtDisplay(this->baseWidget()) ,"STRING", False);
667 // XInternAtom(XtDisplay(this->baseWidget()) ,"MESSAGES", False);
668 getResources(_resources, XtNumber(_resources));
669 if (_mailbox_name_resource) mailboxName(_mailbox_name_resource);
671 // Mailbox image & mask
673 Screen *screen = XtScreen(baseWidget());
676 sprintf(icon_name, "%s.m", MailDragIcon);
677 _mbox_image = XmGetPixmap(screen, icon_name,
678 BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
680 sprintf(icon_name, "%s.m_m.bm", MailDragIcon);
681 _mbox_mask = XmGetPixmapByDepth(screen, icon_name, 1, 0, 1);
683 if (_mbox_image == XmUNSPECIFIED_PIXMAP ||
684 _mbox_mask == XmUNSPECIFIED_PIXMAP)
685 _mbox_image = _mbox_mask = 0;
688 // Add an event handler for structureNotify.
689 // This EH will handle exposure, configure notifies ...
691 this->baseWidget(), StructureNotifyMask, False,
692 (XtEventHandler) &RoamMenuWindow::structurenotify,
695 _convertContainerCmd = new ConvertContainerCmd(
699 _openContainerCmd = new OpenContainerCmd(
703 _genDialog = new DtMailGenDialog("Dialog", _main);
704 setIconName(NormalIcon);
708 RoamMenuWindow::inbox()
714 RoamMenuWindow::createWorkArea(Widget parent)
716 Widget form1, panedW;
718 Dimension x, y, width, height, bwid;
719 VacationCmd *vacation_cmd = theRoamApp.vacation();
721 form1 = XmCreateForm(parent, "Work_Area", NULL, 0);
722 XtVaSetValues(form1, XmNresizePolicy, XmRESIZE_NONE, NULL);
724 printHelpId("form1", form1);
725 /* add help callback */
726 // XtAddCallback(form1, XmNhelpCallback, HelpCB, helpId);
727 XtAddCallback(form1, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWID);
729 panedW = XtCreateManagedWidget("panedW", xmPanedWindowWidgetClass,
731 printHelpId ("panedW", panedW);
732 /* add help callback */
733 // XtAddCallback(panedW, XmNhelpCallback, HelpCB, helpId);
735 XtVaSetValues(panedW,
736 XmNrightAttachment,XmATTACH_FORM,
737 XmNleftAttachment,XmATTACH_FORM,
738 XmNtopAttachment,XmATTACH_FORM,
739 XmNbottomAttachment, XmATTACH_FORM,
746 form2 = XtCreateManagedWidget("form2", xmFormWidgetClass, panedW, NULL, 0);
747 XtVaSetValues(form2, XmNallowResize, True, NULL);
748 printHelpId ("form2", form2);
749 /* add help callback */
750 // XtAddCallback(form2, XmNhelpCallback, HelpCB, helpId);
753 XtCreateManagedWidget("RowOfLabels", xmFormWidgetClass, form2, NULL, 0);
755 printHelpId("rowOfLabels", _rowOfLabels);
756 /* add help callback */
757 // XtAddCallback(_rowOfLabels, XmNhelpCallback, HelpCB, helpId);
759 _rowOfLabels, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWROWOFLABELSID);
761 XtVaSetValues(_rowOfLabels,
762 XmNrightAttachment,XmATTACH_FORM,
763 XmNleftAttachment,XmATTACH_FORM,
764 XmNtopAttachment,XmATTACH_FORM,
766 XmNorientation, XmHORIZONTAL,
769 XmNentryAlignment, XmALIGNMENT_CENTER,
772 _list = new MsgScrollingList( this, form2, "Message_List");
776 DtMail::Session *d_session = theRoamApp.session()->session();
777 DtMail::MailRc *mailrc = d_session->mailRc(error);
778 const char *value = NULL;
781 this->addToRowOfLabels(_list);
783 // See if the header size has changed.
785 mailrc->getValue(error, "headerlines", &value);
786 if (error.isSet()) value = strdup("15");
788 int header_lines = (int) strtol(value, NULL, 10);
789 _list->visibleItems(header_lines);
793 _list->get_scrolling_list(), XmNhelpCallback,
794 HelpCB, (void *)DTMAILMSGLISTID);
796 XtVaSetValues(_list->get_scrolling_list(), XmNuserData, this, NULL);
798 XtCreateManagedWidget("RowColumn", xmFormWidgetClass, form2, NULL, 0);
799 printHelpId ("rowOfButtons", _rowOfButtons);
801 // XtAddCallback(_rowOfButtons, XmNhelpCallback, HelpCB, helpId);
804 // Place it closer to the scrolling list than to the text widget
806 XtVaSetValues(XtParent(_list->get_scrolling_list()),
807 XmNrightAttachment,XmATTACH_FORM,
808 XmNleftAttachment,XmATTACH_FORM,
809 XmNtopAttachment,XmATTACH_WIDGET,
810 XmNtopWidget, _rowOfLabels,
812 XmNbottomAttachment, XmATTACH_WIDGET,
813 XmNbottomWidget, _rowOfButtons,
817 XtVaSetValues(_rowOfButtons,
818 XmNrightAttachment,XmATTACH_FORM,
819 XmNleftAttachment,XmATTACH_FORM,
820 XmNbottomAttachment, XmATTACH_FORM,
824 this->addToRowOfButtons();
826 form3 = XtCreateManagedWidget("form3", xmFormWidgetClass, panedW, NULL, 0);
827 XtVaSetValues(form3, XmNallowResize, True, NULL);
828 printHelpId ("form3", form3);
830 // XtAddCallback(form3, XmNhelpCallback, HelpCB, helpId);
834 XmNrightAttachment,XmATTACH_FORM,
835 XmNleftAttachment,XmATTACH_FORM,
836 XmNtopAttachment,XmATTACH_FORM,
840 _rowOfMessageStatus =
841 XtCreateManagedWidget("Message_Status", xmFormWidgetClass, form3, NULL,0);
843 XtVaSetValues(_rowOfMessageStatus,
844 XmNrightAttachment,XmATTACH_FORM,
845 XmNleftAttachment,XmATTACH_FORM,
846 XmNtopAttachment,XmATTACH_FORM,
850 this->addToRowOfMessageStatus();
852 _my_editor = new DtMailEditor(form3, this);
853 _my_editor->initialize();
854 _my_editor->attachArea()->setOwnerShell(this);
856 // DtMailEditor contains a widget that contains the textEditor and
857 // attachArea. Get that widget...
859 Widget wid = _my_editor->container();
861 printHelpId ("wid", wid);
862 /* add help callback */
863 // XtAddCallback(wid, XmNhelpCallback, HelpCB, helpId);
866 XmNrightAttachment,XmATTACH_FORM,
867 XmNleftAttachment,XmATTACH_FORM,
868 XmNtopAttachment,XmATTACH_WIDGET,
869 XmNtopWidget, _rowOfMessageStatus,
870 XmNbottomAttachment, XmATTACH_FORM,
873 DtMailEnv mail_error;
875 // Initialize the mail_error.
877 mailboxFullpath(mailboxName());
879 // Set the appShell's title to be _mailbox_fullpath
880 if (vacation_cmd != NULL && vacation_cmd->priorVacationRunning())
885 // Set the icon name to the folder name. Extract foldername from full path.
886 char *fname = strrchr(_mailbox_fullpath, '/');
888 setIconTitle(_mailbox_fullpath);
891 // Extract the filename from it.
896 XtManageChild(_list->baseWidget());
897 XtManageChild(form1);
900 mailrc->getValue(error, "retrieveinterval", &value);
901 if (error.isNotSet() && value && *value != '\0')
903 long ping = (time_t) strtol(value, NULL, 10);
905 _checkformail_when_mapped = FALSE;
907 _checkformail_when_mapped = TRUE;
910 if (NULL != value) free((void*) value);
917 XmNborderWidth, &bwid,
923 _border_width = bwid;
927 // This routine is just a place holder callback to pass when creating
928 // a mailbox when we doing want to do anything when the mailbox gets
943 // msgListTransferCallback
945 // Handles the transfer of data that is dragged and dropped to the
946 // MsgScrollingList. Files and buffers are transferred by inserting
947 // them as messages into the scrolling list.
950 RoamMenuWindow::msgListTransferCallback(
952 XtPointer clientData,
955 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
956 DtDndTransferCallbackStruct *transferInfo =
957 (DtDndTransferCallbackStruct *) callData;
958 DtDndContext *dropData = transferInfo->dropData;
961 DtMail::MailBox *mbox, *tmpmbox;
962 DtMailEnv mail_error;
963 MailSession *session = theRoamApp.session();
965 DebugPrintf(3, "In RoamMenuWindow::msgListTransferCallback\n");
967 // Initialize the mail_error.
970 numItems = dropData->numItems;
972 switch (dropData->protocol) {
973 case DtDND_FILENAME_TRANSFER:
975 // Loop through the files that were dropped onto the msg list
977 for (ii = 0; ii < numItems; ii++) {
979 // Try to open the file as a mail container.
980 filepath = dropData->data.files[ii];
981 tmpmbox = session->open(
982 mail_error, filepath,
983 &RoamMenuWindow::syncViewAndStoreCallback,
984 rmw, DTM_FALSE, DTM_TRUE);
986 // Reject the drop if we weren't able to open the file.
987 if (!tmpmbox || mail_error.isSet()) {
988 transferInfo->status = DtDND_FAILURE;
991 // We were able to open the container, so now we get the
992 // current mailbox and copy all the messages into it.
993 mbox = rmw->mailbox();
994 mbox->copyMailBox(mail_error, tmpmbox);
995 rmw->checkForMail(mail_error);
1001 case DtDND_BUFFER_TRANSFER:
1003 // Loop through the buffers that were dropped onto the msg list
1005 for (ii = 0; ii < numItems; ii++) {
1007 // Turn the dropped data into a mail buffer to pass to
1008 // the mailbox constructor.
1010 buf.buffer = (char *) transferInfo->dropData->data.buffers->bp;
1011 buf.size = transferInfo->dropData->data.buffers->size;
1013 // Convert the buffer into a mailbox object.
1014 tmpmbox = session->session()->mailBoxConstruct(mail_error,
1015 DtMailBufferObject, &buf,
1016 openCallback, NULL);
1018 // Reject the drop if we weren't able to convert it to a mailbox
1019 if (!tmpmbox || mail_error.isSet()) {
1020 transferInfo->status = DtDND_FAILURE;
1023 // Parse the dropped data into the tmpmbox.
1024 tmpmbox->open(mail_error);
1025 if (mail_error.isSet()) {
1026 transferInfo->status = DtDND_FAILURE;
1030 mbox = rmw->mailbox();
1031 mbox->copyMailBox(mail_error, tmpmbox);
1032 rmw->checkForMail(mail_error);
1039 transferInfo->status = DtDND_FAILURE;
1044 // msgListDropRegister
1046 // Register the message list to accept file & buffer drops
1049 RoamMenuWindow::msgListDropRegister()
1051 static XtCallbackRec transferCBRec[] = {
1052 {&RoamMenuWindow::msgListTransferCallback, NULL}, {NULL, NULL} };
1054 // Pass the RoamMenuWindow object (this) as clientData.
1055 transferCBRec[0].closure = this;
1057 DtDndVaDropRegister(_list->get_scrolling_list(),
1058 DtDND_FILENAME_TRANSFER | DtDND_BUFFER_TRANSFER,
1059 (unsigned char)(XmDROP_MOVE | XmDROP_COPY), transferCBRec,
1060 DtNtextIsBuffer, True,
1064 // msgListDropEnable
1066 // Enable the message list for drops by restoring the operation
1069 RoamMenuWindow::msgListDropEnable()
1073 XtSetArg(args[0], XmNdropSiteOperations, XmDROP_MOVE | XmDROP_COPY);
1074 XmDropSiteUpdate(_list->get_scrolling_list(), args, 1);
1077 // msgListDropDisable
1079 // Disable the message list for drops by setting the operation to noop
1082 RoamMenuWindow::msgListDropDisable()
1086 XtSetArg(args[0], XmNdropSiteOperations, XmDROP_NOOP);
1087 XmDropSiteUpdate(_list->get_scrolling_list(), args, 1);
1091 // msgListConvertCallback
1093 // Provide the msg list as a mailbox for the drag
1096 RoamMenuWindow::msgListConvertCallback(
1097 Widget /* dragContext */,
1098 XtPointer clientData,
1101 DtDndConvertCallbackStruct *convertInfo =
1102 (DtDndConvertCallbackStruct *) callData;
1103 DtDndBuffer *buffer = &(convertInfo->dragData->data.buffers[0]);
1104 RoamMenuWindow *rmw = (RoamMenuWindow *)clientData;
1105 MsgScrollingList *msgList;
1107 DtMail::MailBox *mbox;
1108 DtMail::Message *msg;
1109 DtMailMessageHandle msgHandle;
1110 DtMailBuffer *mbufList;
1111 int *pos_list, pos_count, ii;
1112 unsigned long bufSize = 0;
1116 DebugPrintf(3, "In RoamMenuWindow:msgListConvertCallback\n");
1120 switch (convertInfo->reason) {
1121 case DtCR_DND_CONVERT_DATA:
1123 msgList = rmw->list();
1124 listW = msgList->get_scrolling_list();
1125 mbox = rmw->mailbox();
1127 if (!XmListGetSelectedPos(listW, &pos_list, &pos_count)) {
1128 convertInfo->status = DtDND_FAILURE;
1132 mbufList = (DtMailBuffer*)XtMalloc(pos_count*sizeof(DtMailBuffer));
1134 for (ii = 0; ii < pos_count; ii++) {
1135 msgHandle = msgList->msgno(pos_list[ii]);
1136 msg = mbox->getMessage(error, msgHandle);
1137 if (error.isSet()) {
1138 convertInfo->status = DtDND_FAILURE;
1141 msg->toBuffer(error, mbufList[ii]);
1142 if (error.isSet()) {
1143 convertInfo->status = DtDND_FAILURE;
1146 bufSize += mbufList[ii].size + 1;
1149 bufPtr = XtMalloc((unsigned int)bufSize);
1151 buffer->bp = bufPtr;
1152 buffer->size = (int)bufSize;
1153 buffer->name = "Mailbox";
1155 for (ii = 0; ii < pos_count; ii++) {
1156 strncpy(bufPtr, (char *)mbufList[ii].buffer,
1157 (unsigned int)mbufList[ii].size);
1158 bufPtr += mbufList[ii].size;
1161 delete mbufList[ii].buffer;
1164 XtFree((char *)mbufList);
1165 XtFree((char *)pos_list);
1168 case DtCR_DND_CONVERT_DELETE:
1169 // The drag and drop succeeded, so we can now delete the messages
1170 // from the scrolling list.
1171 rmw->list()->deleteSelected();
1176 // msgListDragFinishCallback
1178 // Clean up from the convert callback and restore state
1181 RoamMenuWindow::msgListDragFinishCallback(
1182 Widget /* widget */,
1183 XtPointer clientData,
1186 DtDndDragFinishCallbackStruct *finishInfo =
1187 (DtDndDragFinishCallbackStruct *) callData;
1188 DtDndContext *dragData = finishInfo->dragData;
1189 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
1190 MsgScrollingList *msgList = rmw->list();
1191 DtMailEnv mail_error;
1194 DebugPrintf(3, "In RoamMenuWindow::msgListDragFinishCallback\n");
1198 // Re-enable drops on this message list
1199 if (rmw->mailbox()->mailBoxWritable(mail_error) == DTM_TRUE) {
1200 rmw->msgListDropEnable();
1203 if (finishInfo->sourceIcon)
1204 XtDestroyWidget(finishInfo->sourceIcon);
1206 // Free any memory allocated for the drag.
1207 for (ii = 0; ii < dragData->numItems; ii++) {
1208 XtFree((char *)dragData->data.buffers[ii].bp);
1215 // Use the mailbox pixmap to create a drag icon
1218 RoamMenuWindow::getDragIcon(
1221 if (_mbox_image && _mbox_mask) {
1222 return DtDndCreateSourceIcon(widget, _mbox_image, _mbox_mask);
1230 // Translation start a drag from the msg list
1233 RoamMenuWindow::msgListDragStart(
1236 String * /* params */,
1237 Cardinal * /* numParams */)
1239 static XtCallbackRec convertCBRec[] = {
1240 {&RoamMenuWindow::msgListConvertCallback, NULL},{NULL, NULL} };
1241 static XtCallbackRec dragFinishCBRec[] = {
1242 {&RoamMenuWindow::msgListDragFinishCallback, NULL}, {NULL, NULL} };
1243 RoamMenuWindow *rmw = NULL;
1244 unsigned char operations;
1246 DtMailEnv mail_error;
1248 DebugPrintf(3, "In RoamMenuWindow::msgListProcessDrag\n");
1252 XtVaGetValues(widget, XmNuserData, &rmw, NULL);
1257 drag_icon = rmw->getDragIcon(widget);
1260 rmw->msgListDropDisable();
1262 // Choose the drag operations based on the writeability of the mailbox
1264 if (rmw->mailbox()->mailBoxWritable(mail_error) == DTM_TRUE) {
1265 // RW Folder. Permit Copy and Move.
1266 operations = (unsigned char)(XmDROP_COPY | XmDROP_MOVE);
1268 // RO Folder. Permit only Copy drags.
1269 operations = (unsigned char)XmDROP_COPY;
1274 convertCBRec[0].closure = (XtPointer) rmw;
1275 dragFinishCBRec[0].closure = (XtPointer) rmw;
1277 if (DtDndVaDragStart(widget, event, DtDND_BUFFER_TRANSFER, 1,
1278 operations, convertCBRec, dragFinishCBRec,
1279 DtNsourceIcon, drag_icon,
1281 DebugPrintf(3, "DragStart returned NULL.\n");
1289 RoamMenuWindow::msgListLookForButton (
1296 #define ABS_DELTA(x1, x2) (x1 < x2 ? x2 - x1 : x1 - x2)
1298 if( event->type == MotionNotify) {
1299 XEvent * press = (XEvent *) arg;
1301 if (ABS_DELTA(press->xbutton.x_root, event->xmotion.x_root) > DAMPING ||
1302 ABS_DELTA(press->xbutton.y_root, event->xmotion.y_root) > DAMPING)
1305 else if (event->type == ButtonRelease)
1310 // msgListProcessPress
1312 // Translation implementing Motif 1.2.5 ProcessPress function
1315 #define SELECTION_ACTION 0
1316 #define TRANSFER_ACTION 1
1319 RoamMenuWindow::msgListProcessPress(
1323 Cardinal *num_params)
1325 int i, action, cur_item;
1326 int *selected_positions, nselected_positions;
1328 DebugPrintf(3, "In RoamMenuWindow::msgListProcessPress\n");
1330 // This action happens when Button1 is pressed and the Selection
1331 // and Transfer are integrated on Button1. It is passed two
1332 // parameters: the action to call when the event is a selection,
1333 // and the action to call when the event is a transfer.
1335 if (*num_params != 2 || !XmIsList(w))
1338 action = SELECTION_ACTION;
1339 cur_item = XmListYToPos(w, event->xbutton.y);
1344 XmNselectedPositions, &selected_positions,
1345 XmNselectedPositionCount, &nselected_positions,
1348 for (i=0; i<nselected_positions; i++)
1350 if (cur_item == selected_positions[i])
1352 // The determination of whether this is a transfer drag
1353 // cannot be made until a Motion event comes in. It is
1354 // not a drag as soon as a ButtonUp event happens.
1360 &RoamMenuWindow::msgListLookForButton,
1362 switch (new_event.type)
1365 action = TRANSFER_ACTION;
1368 action = SELECTION_ACTION;
1376 XtCallActionProc(w, params[action], event, params, *num_params);
1381 // Override default list translations to start our own drags
1384 RoamMenuWindow::msgListDragSetup()
1386 Widget msgList = _list->get_scrolling_list();
1387 static char translations[] = "\
1388 ~c ~s ~m ~a <Btn1Down>:\
1389 dt-process-press(ListBeginSelect,MsgListDragStart)\n\
1390 c ~s ~m ~a <Btn1Down>:\
1391 dt-process-press(ListBeginToggle,MsgListDragStart)";
1392 static char btn2_translations[] = "\
1393 ~c ~s ~m ~a <Btn2Down>:\
1394 dt-process-press(ListBeginSelect,MsgListDragStart)\n\
1395 c ~s ~m ~a <Btn2Down>:\
1396 dt-process-press(ListBeginToggle,MsgListDragStart)\n\
1397 <Btn2Motion>:ListButtonMotion()\n\
1398 ~c ~s ~m ~a <Btn2Up>:ListEndSelect()\n\
1399 c ~s ~m ~a <Btn2Up>:ListEndToggle()";
1400 int btn1_transfer = 0;
1401 XtTranslations new_translations;
1402 static XtActionsRec actionTable[] = {
1403 {"MsgListDragStart",
1404 (XtActionProc) &RoamMenuWindow::msgListDragStart},
1405 {"dt-process-press",
1406 (XtActionProc) &RoamMenuWindow::msgListProcessPress}
1409 DebugPrintf(3, "In RoamMenuWindow::msgListDragSetup\n");
1412 theRoamApp.appContext(),
1414 sizeof(actionTable)/sizeof(actionTable[0]));
1415 new_translations = XtParseTranslationTable(translations);
1416 XtOverrideTranslations(msgList, new_translations);
1419 (Widget)XmGetXmDisplay(XtDisplayOfObject(msgList)),
1420 "enableBtn1Transfer", &btn1_transfer,
1423 if (btn1_transfer != True) {
1424 new_translations = XtParseTranslationTable(btn2_translations);
1425 XtOverrideTranslations(msgList, new_translations);
1430 RoamMenuWindow::open_and_load(
1432 DtMailBoolean create,
1435 _openContainerCmd->set_create_lock_flags(create, lock);
1436 _openContainerCmd->execute();
1438 // if it required conversion, let conversion handle the error
1439 // (its a callback routine and we have "lost control" of what
1440 // it returns anyway.)
1442 // if it did not require conversion, then open() should have succeeded.
1443 // If it did succeed, then its _mailbox should be set by now.
1444 // If its not set, then either open() failed somewhere or it was
1445 // cancelled by the user. We now have an error condition.
1446 if ((!_required_conversion) && (_mailbox == NULL))
1448 error.setError(DTME_NoMailBox);
1452 // If it required conversion, then let the conversion process handle
1453 // errors if any occur.
1454 // Reset the DtMailEnv for this method.
1455 if (_required_conversion) error.clear();
1457 // If it required conversion, and conversion succeeded, then the
1458 // mailbox was also loaded and _is_loaded gets set to TRUE.
1459 // If it required no conversion, then it implies that we already
1460 // have a container in hand and we just load it (implicitly
1461 // setting _is_loaded to TRUE)
1462 if ((!_required_conversion) && (_is_loaded == FALSE))
1464 this->load_mailbox(error);
1470 // Ideally, open() should set the error if the user cancels the open.
1471 // And we should error after open() returns at the caller's end...
1474 RoamMenuWindow::open(
1476 DtMailBoolean create_flag,
1477 DtMailBoolean lock_flag
1480 FORCE_SEGV_DECL(char, tmp);
1481 Dimension win_x, win_y, win_wid, win_ht, win_bwid;
1482 MailSession *ses = theRoamApp.session();
1486 char *buf = new char[2*MAXPATHLEN];
1488 _openContainerCmd->set_create_lock_flags(create_flag, lock_flag);
1490 // Obtain the current dimensions of the RMW
1491 XtVaGetValues(_main,
1496 XmNborderWidth, &win_bwid,
1502 _border_width = win_bwid;
1504 // Check to see if the mbox is already open. If it is, we will
1505 // simply make sure it's displayed in the current workspace.
1506 if (ses->isMboxOpen(_mailbox_fullpath))
1508 RoamMenuWindow *rmw = NULL;
1509 rmw = ses->getRMW(_mailbox_fullpath);
1512 ses->activateRMW(rmw);
1513 rmw->displayInCurrentWorkspace();
1518 // Try to open this folder, but don't take the lock and and don't create it.
1519 _mailbox = ses->open(error, _mailbox_fullpath,
1520 &RoamMenuWindow::syncViewAndStoreCallback,
1521 this, create_flag, lock_flag);
1524 if((DTMailError_t) error == DTME_OutOfSpace )
1526 ShowErrMsg((char *)error.getClient(),FALSE,(void*)this );
1527 error.setClient(NULL);
1532 // Did we ask for a non-existent file?
1533 if ((DTMailError_t)error == DTME_NoSuchFile)
1535 // if (create_flag == DTM_TRUE)
1536 if (create_flag == DTM_FALSE)
1541 "The mailbox %s does not exist.\nCreate a mailbox with this name?"),
1543 _genDialog->setToQuestionDialog(GETMSG(DT_catd,
1546 helpId = DTMAILHELPERROR;
1547 answer = _genDialog->post_and_return(GETMSG(DT_catd,
1555 if (answer == 1) open(error, DTM_TRUE, lock_flag);
1562 // A special case should be taken care
1563 // The create_flag is TRUE but still can not be created
1564 // This is because the path is something like
1565 // /valid_path/not_such_dir/file_name.
1566 // The full file path is not valid so that we need flag
1571 "Unable to create %s."),
1573 _genDialog->setToQuestionDialog(GETMSG(DT_catd,
1576 helpId = DTMAILHELPNOCREATE;
1577 answer = _genDialog->post_and_return(GETMSG(DT_catd,
1585 else if (((DTMailError_t)error == DTME_OtherOwnsWrite) ||
1586 ((DTMailError_t)error == DTME_AlreadyLocked))
1588 // See if they want to take the lock.
1590 // GETMSG(DT_catd, 3, 6, "The mailbox %s is locked.\n\
1591 // You can manually unlock the mailbox and try again\n\
1592 // or contact your System Administrator."),
1593 // _mailbox_fullpath);
1595 // _genDialog->setToErrorDialog(
1596 // GETMSG(DT_catd, 3, 7, "Mailer"),
1598 // helpId = DTMAILHELPTAKELOCK;
1599 // _genDialog->post_and_return(
1600 // GETMSG(DT_catd, 3, 8, "OK"),
1603 // error.setError(DTME_GetLockRefused);
1604 // The above else-if code doesn't make sense. If ses->open() failed
1605 // because the folder was already locked or not writable then
1606 // posting the specified error dialog and setting the error to GetLockRefused
1607 // is meaningless. Especially since the calling function
1608 // OpenContainerCmd::doit() doesn't even check the error we
1609 // return. Lets post a meaningful error dialog and return.
1610 postErrorDialog(error);
1614 else if ((DTMailError_t)error == DTME_BadRunGroup)
1617 sprintf(buf, "%s", GETMSG(DT_catd, 2, 4,
1618 "Mailer has not been properly installed,\n\
1619 and cannot run because the execution group\n\
1620 is incorrectly set."));
1622 _genDialog->setToQuestionDialog(
1623 GETMSG(DT_catd, 1, 6, "Mailer"),
1626 // No choice at this state other than to OK.
1628 helpId = DTMAILHELPBADGROUPID;
1629 answer = _genDialog->post_and_return(
1630 GETMSG(DT_catd, 3, 9, "OK"),
1636 else if ((DTMailError_t)error == DTME_NoPermission)
1639 * The %s is the name of the mailbox the user doesn't have
1640 * permission to view.
1642 sprintf(buf, GETMSG(DT_catd, 2, 5,
1643 "You do not have permission to view %s"), _mailbox_fullpath);
1645 _genDialog->setToQuestionDialog(
1646 GETMSG(DT_catd, 1, 7, "Mailer"),
1649 // No choice at this state other than to OK.
1651 helpId = DTMAILHELPNOVIEW;
1652 answer = _genDialog->post_and_return(
1653 GETMSG(DT_catd, 3, 10, "OK"),
1658 else if ((DTMailError_t)error == DTME_IsDirectory)
1660 sprintf(buf, GETMSG(DT_catd, 2, 6,
1661 "The mailbox %s is a directory and can not be opened."),
1664 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 1, 8, "Mailer"),
1667 helpId = DTMAILHELPDIRECTORYONLY;
1668 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 11, "OK"),
1673 else if ((DTMailError_t)error == DTME_AlreadyOpened)
1675 sprintf(buf, GETMSG(DT_catd,20,1,
1676 "The mailbox %s is already open."), _mailbox_fullpath);
1678 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 1, 8, "Mailer"),
1681 // there is no help message for this error
1682 // open a defect and put helpId later
1684 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 11, "OK"),
1691 // This is a real error. Punt!
1692 this->postErrorDialog(error);
1698 if (_mailbox->mailBoxWritable(error) == DTM_TRUE)
1699 msgListDropRegister();
1700 _mailbox->registerErrMsgFunc(ShowErrMsg,this);
1702 _mailbox->hideAccessEvents(DTM_TRUE);
1704 _mailbox->hideAccessEvents(DTM_FALSE);
1710 void RoamMenuWindow::createMenuPanes()
1712 this->createContainerList();
1714 this->construct_file_menu();
1716 this->construct_message_menu();
1718 this->construct_edit_menu();
1720 this->construct_attachment_menu();
1722 this->construct_view_menu();
1724 this->construct_compose_menu();
1726 this->construct_move_menu();
1728 this->construct_help_menu();
1730 this->construct_message_popup();
1732 this->construct_text_popup();
1734 this->construct_attachment_popup();
1736 this->syncCachedContainerList();
1741 RoamMenuWindow::resetCacheList(int new_size)
1743 // Remove the extra items in the list
1744 for (int i = _cached_containerlist->length(); i > new_size; i--) {
1746 _cached_containerlist->remove(i-1);
1747 _open_container_containerlist_cached->remove(i-1);
1748 _copyto_containerlist_cached->remove(i-1);
1749 _move_containerlist_cached->remove(i-1);
1751 _menuBar->removeCommand(_opencontainerMenu, _first_cached_item+i-1);
1752 _menuBar->removeCommand(_copytoMenu, _first_cached_item+i-1);
1753 _menuBar->removeCommand(_moveMenu, _first_cached_item+i-1);
1754 _menuBar->removeCommand(_msgsPopupMoveMenu, _first_cached_item+i-1);
1759 RoamMenuWindow::propsChanged(void)
1761 MailSession *ses = theRoamApp.session();
1762 DtMail::Session *d_session = ses->session();
1763 DtMail::MailRc *mailrc = get_mail_rc();
1765 const char *value = NULL;
1766 char *inbox_path = NULL;
1767 DtMailObjectSpace space;
1768 Boolean should_be_inbox;
1770 if (! _is_loaded) return;
1771 enableWorkAreaResize();
1773 d_session->queryImpl(
1775 d_session->getDefaultImpl(error),
1776 DtMailCapabilityInboxName,
1779 should_be_inbox = (inbox_path && 0 == strcmp(inbox_path, mailboxName()));
1781 RoamMenuWindow *rmw = NULL;
1782 char *password = NULL;
1783 password = MailRetrievalOptions::getPassword(DTMAS_INBOX);
1785 if (_inbox != should_be_inbox)
1794 // Remove inbox attributes
1796 displayInCurrentWorkspace();
1799 GETMSG(DT_catd, 99, 99,"The INBOX path has changed.\nReopen?"));
1800 _genDialog->setToQuestionDialog(
1801 GETMSG(DT_catd, 3, 22, "Mailer"),
1803 answer = _genDialog->post_and_return(
1804 GETMSG(DT_catd, 3, 29, "OK"),
1805 GETMSG(DT_catd, 3, 19, "Cancel"),
1808 rmw = ses->getRMW(inbox_path);
1812 rmw->_mailbox->createMailRetrievalAgent(password);
1813 rmw->_open_container_inbox->deactivate();
1814 rmw->_file_open_inbox->deactivate();
1820 rmw->displayInCurrentWorkspace();
1822 view_mail_file(inbox_path, DTM_FALSE);
1826 _mailbox->deleteMailRetrievalAgent();
1827 _open_container_inbox->activate();
1828 _file_open_inbox->activate();
1834 _mailbox->createMailRetrievalAgent(password);
1835 _open_container_inbox->deactivate();
1836 _file_open_inbox->deactivate();
1841 if (_inbox) _mailbox->createMailRetrievalAgent(password);
1844 rmw = ses->getRMW(inbox_path);
1845 if (rmw) rmw->_mailbox->createMailRetrievalAgent(password);
1849 if (password) free(password);
1852 // See if the header size has changed.
1854 mailrc->getValue(error, "headerlines", &value);
1857 value = strdup("15");
1861 int header_lines = (int) strtol(value, NULL, 10);
1862 if (header_lines != _list->visibleItems())
1863 _list->visibleItems(header_lines);
1865 free((void*) value);
1867 _list->checkDisplayProp();
1868 _my_editor->textEditor()->update_display_from_props();
1871 mailrc->getValue(error, "dontdisplaycachedfiles", &value);
1872 if (error.isNotSet() && value != NULL)
1874 if (_display_cached_list)
1875 // They just turned off the Display Up To prop so
1876 //reset the cache list to zero length.
1879 _max_cached_list_size = 0;
1880 _display_cached_list = FALSE;
1881 free((void*) value);
1887 mailrc->getValue(error, "cachedfilemenusize", &value);
1888 if (error.isNotSet() && value != NULL && *value != '\0')
1892 new_size = (int) strtol(value, NULL, 10);
1893 if (new_size != _max_cached_list_size && new_size >=0)
1895 // They just changed the display number so chop the
1896 // list if it is bigger than the new size just set
1897 if (new_size < _max_cached_list_size)
1898 resetCacheList(new_size);
1900 _max_cached_list_size = new_size;
1904 free((void*) value);
1909 mailrc->getValue(error, "filemenu2", &value);
1910 if ( (value == NULL && _filemenu2 != NULL) ||
1911 (value != NULL && _filemenu2 == NULL) ||
1912 (value != NULL && _filemenu2 != NULL &&
1913 strcmp(value, _filemenu2) != 0) )
1915 // Recreate the containter list
1916 this->createContainerList();
1918 // Recreate the File menu
1919 this->construct_file_menu();
1921 // Recreate the Message menu
1922 this->construct_message_menu();
1924 // Recreate the Move menu...
1925 this->construct_move_menu();
1927 // Recreate the Message popup menu
1928 this->construct_message_popup();
1931 free((void*) value);
1934 mailrc->getValue(error, "retrieveinterval", &value);
1935 if (error.isNotSet() && value && *value != '\0')
1937 long ping = (time_t) strtol(value, NULL, 10);
1939 _checkformail_when_mapped = FALSE;
1941 _checkformail_when_mapped = TRUE;
1944 if (NULL != value) free((void*) value);
1946 disableWorkAreaResize();
1949 void RoamMenuWindow::registerDialog( ViewMsgDialog *dialog )
1952 ViewMsgDialog **newList = (ViewMsgDialog **)-1;
1954 // Allocate a new list large enough to hold the new
1955 // object, and copy the contents of the current list
1958 newList = new ViewMsgDialog*[_numDialogs + 1];
1960 for ( i = 0; i < _numDialogs; i++ )
1961 newList[i] = _dialogs[i];
1963 // Install the new list and add the window to the list
1965 if ( _numDialogs > 0 )
1968 _dialogs[_numDialogs] = dialog;
1972 void RoamMenuWindow::unregisterDialog ( ViewMsgDialog *dialog )
1975 ViewMsgDialog **newList = (ViewMsgDialog **)-1;
1977 // Allocate a new, smaller list
1979 newList = new ViewMsgDialog *[_numDialogs - 1];
1981 // Copy all objects, except the one to be
1982 // removed, to the new list
1985 for ( i = 0; i < _numDialogs; i++ )
1986 if ( _dialogs[i] != dialog )
1987 newList[index++] = _dialogs[i];
1989 // Install the new list
1998 RoamMenuWindow::forwardFilename( char *file )
2000 _forward_filename = (char *)realloc(_forward_filename, strlen(file)+1);
2001 strcpy( _forward_filename, file );
2005 RoamMenuWindow::forwardFilename()
2007 return _forward_filename;
2012 // If it is a configure notify, we are interested in it.
2013 // We need to then capture its new position.
2014 // And if the RMW has not been loaded, we need to load it.
2017 RoamMenuWindow::structurenotify(
2019 XtPointer clientData,
2021 Boolean * ) // continue_to_dispatch
2023 RoamMenuWindow *rmw=(RoamMenuWindow *) clientData;
2025 if (event->type == ConfigureNotify)
2027 rmw->configurenotify(
2028 event->xconfigurerequest.x,
2029 event->xconfigurerequest.y,
2030 event->xconfigurerequest.width,
2031 event->xconfigurerequest.height,
2032 event->xconfigurerequest.border_width);
2034 else if ((event->type == MapNotify) || ( event->type == UnmapNotify))
2037 if (event->type == UnmapNotify)
2039 rmw->_mailbox->save();
2040 rmw->_mailbox->hideAccessEvents(DTM_TRUE);
2044 rmw->_mailbox->hideAccessEvents(DTM_FALSE);
2045 if (FALSE==rmw->_inbox || TRUE==rmw->_checkformail_when_mapped)
2048 DtMail::Session *m_session = theRoamApp.session()->session();
2049 DtMail::MailRc *mailrc = m_session->mailRc(error);
2050 const char *value = NULL;
2052 mailrc->getValue(error, "retrievemailonmapnotify", &value);
2053 if (error.isNotSet()) rmw->checkForMail(error);
2061 // Capture its position coordinates.
2064 RoamMenuWindow::configurenotify(
2065 unsigned int win_x, unsigned int win_y,
2066 unsigned int win_wid, unsigned int win_ht,
2067 unsigned int win_bwid
2075 _border_width = win_bwid;
2079 // If it is not already loaded, then load it (it might involve
2080 // conversion, etc.; all handled by open_and_load())
2081 // If its been loaded already, then mapnotify gets called when
2082 // the state changes from iconic to open (i.e., the user double-clicks
2083 // on an RMW icon). If we want to load a folder at that time, this
2084 // is the place to do it.
2088 RoamMenuWindow::mapnotify()
2090 // If its not been loaded, then open and load it.
2093 DtMailEnv mail_error;
2097 theRoamApp.busyAllWindows();
2098 this->open_and_load(
2100 (DtMailBoolean) _create_mailbox_file,
2102 theRoamApp.unbusyAllWindows();
2104 // If there's been an error then we quit the container.
2105 if (mail_error.isSet())
2107 // Need to remove the base Widgets destroy callback since
2108 // we end up destroying it twice otherwise...
2109 XtRemoveAllCallbacks(this->baseWidget(), XmNdestroyCallback);
2113 // We need to disable the editable menu options if the mail
2116 if (_mailbox->mailBoxWritable(mail_error) == DTM_FALSE)
2118 _msg_delete->deactivate();
2119 _msg_undelete_last->deactivate();
2120 _msg_undelete_from_list->deactivate();
2121 _delete_button->deactivate();
2122 _file_destroy_deleted_msgs->deactivate();
2123 if (NULL != _move_cascade)
2124 XtSetSensitive(_move_cascade, FALSE);
2125 if (NULL != _msgsPopupMoveMenu)
2126 XtSetSensitive(_msgsPopupMoveMenu, FALSE);
2128 char * readonly = GETMSG(DT_catd, 20, 3, "Read Only");
2132 if (_list->get_num_messages())
2133 setIconName(NormalIcon);
2135 setIconName(EmptyIcon);
2140 // If the mailbox has messages, set to normal icon
2141 if (_list->get_num_messages() > 0)
2142 setIconName(NormalIcon);
2144 setIconName(EmptyIcon);
2149 RoamMenuWindow::last_sorted_by(SortBy type)
2152 char *buffer = NULL;
2154 DtMail::Session *m_session = theRoamApp.session()->session();
2155 DtMail::MailRc *mailrc = m_session->mailRc(error);
2157 _last_sorted_by = type;
2159 ((SortCmd*)_view_sortTD)->setButtonState(FALSE, FALSE);
2160 ((SortCmd*)_view_sortSender)->setButtonState(FALSE, FALSE);
2161 ((SortCmd*)_view_sortSubject)->setButtonState(FALSE, FALSE);
2162 ((SortCmd*)_view_sortSize)->setButtonState(FALSE, FALSE);
2163 ((SortCmd*)_view_sortStatus)->setButtonState(FALSE, FALSE);
2165 XtVaSetValues(_sender_lbl, XmNlabelString, _sender_xms, NULL);
2166 XtVaSetValues(_subject_lbl, XmNlabelString, _subject_xms, NULL);
2167 XtVaSetValues(_date_lbl, XmNlabelString, _date_xms, NULL);
2168 XtVaSetValues(_size_lbl, XmNlabelString, _size_xms, NULL);
2170 buffer = XtMalloc(BUFSIZ);
2175 RMW_CONCAT_MAILRC_KEY(buffer, DTMAS_INBOX, "sortby");
2179 RMW_CONCAT_MAILRC_KEY(buffer, mailboxName(), "sortby");
2183 switch (_last_sorted_by)
2186 XtVaSetValues(_date_lbl, XmNlabelString, _date_key_xms, NULL);
2187 ((SortCmd*)_view_sortTD)->setButtonState(TRUE,FALSE);
2188 if (buffer) mailrc->removeValue(error, buffer);
2191 XtVaSetValues(_sender_lbl, XmNlabelString, _sender_key_xms, NULL);
2192 ((SortCmd*)_view_sortSender)->setButtonState(TRUE,FALSE);
2193 sprintf(id, "%d", SortSender);
2194 if (buffer) mailrc->setValue(error, buffer, id);
2197 XtVaSetValues(_subject_lbl, XmNlabelString, _subject_key_xms, NULL);
2198 ((SortCmd*)_view_sortSubject)->setButtonState(TRUE,FALSE);
2199 sprintf(id, "%d", SortSubject);
2200 if (buffer) mailrc->setValue(error, buffer, id);
2203 XtVaSetValues(_size_lbl, XmNlabelString, _size_key_xms, NULL);
2204 ((SortCmd*)_view_sortSize)->setButtonState(TRUE,FALSE);
2205 sprintf(id, "%d", SortSize);
2206 if (buffer) mailrc->setValue(error, buffer, id);
2209 ((SortCmd*)_view_sortStatus)->setButtonState(TRUE,FALSE);
2210 sprintf(id, "%d", SortStatus);
2211 if (buffer) mailrc->setValue(error, buffer, id);
2214 XtVaSetValues(_date_lbl, XmNlabelString, _date_key_xms, NULL);
2215 ((SortCmd*)_view_sortTD)->setButtonState(TRUE,FALSE);
2216 if (buffer) mailrc->removeValue(error, buffer);
2219 if (buffer) XtFree(buffer);
2221 //_list->layoutLabels();
2222 mailrc->update(error);
2226 RoamMenuWindow::message( char *text )
2228 int text_size = strlen(text);
2232 if (text_size > 0) {
2233 str = GETMSG(DT_catd, 3, 12, "%s");
2234 buf = new char[strlen(str) + text_size + 1];
2235 sprintf(buf, str, text);
2236 labelStr = XmStringCreateLocalized(buf);
2237 _clear_message_p = TRUE;
2241 sprintf(buf, "%s", "");
2242 labelStr = XmStringCreateLocalized(buf);
2243 _clear_message_p = FALSE;
2246 XtVaSetValues(_message, XmNlabelString, labelStr, NULL);
2247 XmUpdateDisplay(this->baseWidget());
2249 XmStringFree(labelStr);
2254 RoamMenuWindow::setStatus(const char * msg)
2256 message((char *)msg);
2260 RoamMenuWindow::clearStatus(void)
2266 RoamMenuWindow::message_summary()
2268 this->message_summary(
2269 list()->selected_item_position(),
2270 list()->get_num_messages(),
2271 list()->get_num_new_messages(),
2272 list()->get_num_deleted_messages());
2276 RoamMenuWindow::message_summary(
2285 int num_live_msgs = num_msgs - num_deleted; // Undeleted msgs
2286 DtMail::MailRc * mailrc = get_mail_rc();
2288 const char * value = NULL;
2290 mailrc->getValue(error, "nerdmode", &value);
2291 if (error.isSet()) {
2292 str = GETMSG(DT_catd, 3, 13, "Message %d of %d, %d new, %d deleted");
2295 str = "Message 0x%x of 0x%x, ignoring 0x%x, 0x%x forgotten";
2298 free((void*) value);
2300 buf = new char[strlen(str) + 100];
2301 sprintf(buf, str, sel_pos, num_msgs, num_new, num_deleted);
2303 labelStr = XmStringCreateLocalized(buf);
2305 XtVaSetValues(_message_summary, XmNlabelString, labelStr, NULL);
2306 XmUpdateDisplay(this->baseWidget());
2308 XmStringFree(labelStr);
2313 RoamMenuWindow::message_selected(
2324 * The user will see the following message display as:
2325 * "Message 3 of 10, 2 new, 6 deleted"
2326 * This means ??? -- Explain to translator.
2328 str = GETMSG(DT_catd, 3, 14, "Message %d of %d, %d new, %d deleted");
2329 buf = new char[strlen(str) + 20];
2330 sprintf(buf, str, msg_num, num_msgs, num_new, num_deleted);
2332 labelStr = XmStringCreateLocalized(buf);
2334 XtVaSetValues(_message_summary, XmNlabelString, labelStr, NULL);
2335 XmUpdateDisplay(this->baseWidget());
2337 XmStringFree(labelStr);
2343 RoamMenuWindow::get_find_dialog()
2347 theRoamApp.busyAllWindows();
2348 // No find dialog. Create it
2349 _findDialog = new FindDialog(this);
2350 _findDialog->initialize();
2351 theRoamApp.unbusyAllWindows();
2355 _findDialog->manage();
2356 _findDialog->popup();
2361 RoamMenuWindow::quitWorkproc(XtPointer client_data)
2363 RoamMenuWindow *rmw = (RoamMenuWindow *) client_data;
2364 MailSession *ses = theRoamApp.session();
2365 static int called = 0;
2367 if (rmw->_numPendingTasks > 0)
2373 if (rmw->_quitWorkprocID != 0)
2375 XtRemoveWorkProc(rmw->_quitWorkprocID);
2376 rmw->_quitWorkprocID = 0;
2379 rmw->normalCursor();
2380 rmw->_genDialog->unmanage();
2383 if (rmw->_delete_on_quit)
2385 rmw->_list->shutdown();
2389 ses->deactivateRMW(rmw);
2391 theRoamApp.checkForShutdown();
2396 RoamMenuWindow::queryExpunge()
2402 if (NULL != _mailbox && _mailbox->mailBoxWritable(error) == DTM_TRUE)
2404 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2406 if (_list->get_num_deleted_messages())
2408 // We need to deal with deleted messages, based on what the
2409 // user wants to do. There are two properties that control
2412 // keepdeleted - Keep deleted messages on close.
2413 // quietdelete - Delete without asking.
2415 // If the user wants to keep the deleted messages, then we
2416 // can just blow by the second. If not, then we have to
2417 // clear the deleted messages, asking first based on the
2420 DtMail::MailRc * mailrc = get_mail_rc();
2421 const char * value = NULL;
2424 mailrc->getValue(error, "keepdeleted", &value);
2428 free((void*) value);
2430 // The user wants to expunge on close. See if they want
2431 // to be asked first.
2435 mailrc->getValue(error, "quietdelete", &value);
2436 if (error.isSet() && !theRoamApp.quitSilently())
2442 * This dialog comes up when the user tries to quit the
2443 * mailbox and the user is asked if he wants to destroy
2444 * the messages marked for deletion.
2447 * Messages 16 and 17 are no longer being used. They are
2448 * being replaced by message 86 and 87.
2450 _genDialog->setToQuestionDialog(
2452 GETMSG(DT_catd, 3, 16, "Mailer"),
2453 GETMSG(DT_catd, 3, 17, "Destroy the messages you have marked\nfor deletion in this mailbox?"));
2456 * This dialog comes up when the user tries to quit the
2457 * mailbox. The user is asked if they want to destroy
2458 * the deleted messages.
2460 GETMSG(DT_catd, 3, 87, "Mailer - Close"),
2461 GETMSG(DT_catd, 3, 88, "Destroy the deleted messages and close this mailbox?"));
2462 char * helpId = DTMAILHELPDESTROYMARKMSG;
2463 int answer = _genDialog->post_and_return(
2464 GETMSG(DT_catd, 3, 89, "Destroy and Close"),
2465 GETMSG(DT_catd, 3, 73, "Cancel"),
2466 GETMSG(DT_catd, 3, 90, "Retain and Close"),
2471 _mailbox->expunge(error);
2472 if ((DTMailError_t) error == DTME_OutOfSpace)
2475 (char *)error.getClient(),
2478 error.setClient(NULL);
2481 if (_msg_undelete_from_list->dialog())
2482 _msg_undelete_from_list->dialog()->expunge();
2486 postErrorDialog(error);
2488 else if (answer == 2)
2490 // This is a very bad way to code selection of the
2491 // cancel button. If someone changes its position
2492 // in the dialog, this code will break!
2493 theRoamApp.unbusyAllWindows();
2499 // If killed by a signal, don't post a dialog.
2501 _mailbox->expunge(error);
2502 if ((DTMailError_t) error == DTME_OutOfSpace)
2504 ShowErrMsg((char *)error.getClient(),FALSE,(void*)this );
2505 error.setClient(NULL);
2508 if (_msg_undelete_from_list->dialog())
2509 _msg_undelete_from_list->dialog()->expunge();
2513 if (! theRoamApp.quitSilently())
2514 postErrorDialog(error);
2518 free((void*) value);
2526 RoamMenuWindow::quit(Boolean delete_win)
2531 if (! queryExpunge())
2534 for (i = 0; i < _numDialogs; i++)
2535 _dialogs[i]->unmanage();
2537 XmUpdateDisplay(baseWidget());
2539 for (i = 0; i < _numDialogs; i++)
2540 _dialogs[i]->quit();
2542 theRoamApp.unbusyAllWindows();
2544 this->_delete_on_quit = delete_win;
2545 if (_numPendingTasks > 0)
2552 21, 22, "Close pending: waiting for task to terminate ...");
2555 if (_quitWorkprocID == 0)
2556 _quitWorkprocID = XtAppAddWorkProc(
2557 XtWidgetToApplicationContext(_w),
2558 &RoamMenuWindow::quitWorkproc,
2564 quitWorkproc((XtPointer) this);
2568 RoamMenuWindow::panicQuit()
2570 if (_mailbox != NULL)
2575 RoamMenuWindow::quit_silently()
2580 if (_mailbox->mailBoxWritable(error) == DTM_TRUE) {
2582 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2584 if (_list->get_num_deleted_messages()) {
2585 // We need to deal with deleted messages, based on what the
2586 // user wants to do. There are two properties that control
2589 // keepdeleted - Keep deleted messages on close.
2590 // quietdelete - Delete without asking.
2592 // If the user wants to keep the deleted messages, then we
2593 // can just blow by the second. If not, then we have to
2594 // clear the deleted messages, asking first based on the
2597 DtMail::MailRc * mailrc = get_mail_rc();
2598 const char * value = NULL;
2601 mailrc->getValue(error, "keepdeleted", &value);
2602 if (error.isSet()) {
2604 _mailbox->expunge(error);
2605 if (error.isSet()) {
2606 this->postErrorDialog(error);
2610 free((void*) value);
2615 for (i = 0; i < _numDialogs; i++) {
2616 _dialogs[i]->unmanage();
2619 XmUpdateDisplay(this->baseWidget());
2621 for (i = 0; i < _numDialogs; i++) {
2622 _dialogs[i]->quit();
2625 this->_delete_on_quit = FALSE;
2626 if (_numPendingTasks > 0)
2633 21, 22, "Close pending: waiting for task to terminate ...");
2636 if (_quitWorkprocID == 0)
2637 _quitWorkprocID = XtAppAddWorkProc(
2638 XtWidgetToApplicationContext(_w),
2639 &RoamMenuWindow::quitWorkproc,
2645 quitWorkproc((XtPointer) this);
2648 // Callback to open a new mail container.
2651 RoamMenuWindow::file_selection_callback(void *client_data, char *selection)
2653 if (NULL == selection || 0 == strlen(selection)) return;
2655 RoamMenuWindow *obj=(RoamMenuWindow *) client_data;
2656 obj->view_mail_file(selection, DTM_FALSE);
2661 void RoamMenuWindow::reopen_mail_file()
2665 theApplication->disableShutdown();
2667 filename = strdup(this->_mailbox_fullpath);
2670 view_mail_file(filename, DTM_FALSE);
2673 theApplication->enableShutdown();
2676 // Given the name of a container, create a new RoamMenuWindow
2677 // and open the container into it.
2679 void RoamMenuWindow::view_mail_file(char *filename, DtMailBoolean create)
2681 DtMailEnv mail_error;
2682 MailSession *ses = theRoamApp.session();
2683 DtMail::Session *d_session = ses->session();
2684 RoamMenuWindow *roamwin = NULL;
2685 char *expanded_filename = NULL;
2686 char *plus_filename = NULL;
2687 char *relative_filename = NULL;
2689 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 20, "Opening mailbox..."));
2691 // If the first character of destname is alphanumeric, we can
2692 // safely assume that it is relative to the root folder directory.
2693 // Prepend a '+' and call 'expandPath' to get the actual path.
2694 if (isalnum(filename[0]))
2696 plus_filename = (char *) malloc(strlen(filename)+2);
2697 sprintf(plus_filename, "+%s", filename);
2698 expanded_filename = d_session->expandPath(mail_error, plus_filename);
2699 free(plus_filename);
2702 expanded_filename = d_session->expandPath(mail_error, filename);
2704 // Check to see if the mbox is already open. If it is, we will
2705 // simply make sure it's displayed in the current workspace.
2706 if (ses->isMboxOpen(expanded_filename))
2708 roamwin = ses->getRMW(expanded_filename);
2709 ses->activateRMW(roamwin);
2710 if (NULL != roamwin) roamwin->displayInCurrentWorkspace();
2714 if (DTM_FALSE == create &&
2715 -1 == SafeAccess(expanded_filename, F_OK) &&
2718 char *buf = new char[2048];
2720 DtMailGenDialog *dialog = genDialog();
2724 GETMSG(DT_catd, 3, 3, "The mailbox %s does not exist.\nCreate a mailbox with this name?"),
2726 dialog->setToQuestionDialog(GETMSG(DT_catd, 3, 22, "Mailer"), buf);
2727 answer = dialog->post_and_return(DTMAILHELPERROR);
2729 if (2 == answer) goto do_unbusy;
2733 roamwin = new RoamMenuWindow(expanded_filename);
2734 roamwin->_create_mailbox_file = DTM_TRUE;
2735 roamwin->initialize();
2736 roamwin->mailboxFullpath(expanded_filename);
2737 roamwin->mailboxName(filename);
2741 free(expanded_filename);
2742 relative_filename = d_session->getRelativePath(mail_error, filename);
2743 theRoamApp.globalAddToCachedContainerList(relative_filename);
2744 free(relative_filename);
2747 theRoamApp.unbusyAllWindows();
2751 RoamMenuWindow::move_callback(void *client_data, char *selection)
2753 DtMailEnv mail_error;
2756 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
2758 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2759 obj->_mailbox->save();
2760 theRoamApp.unbusyAllWindows();
2762 obj->_list->copySelected(mail_error, selection, TRUE, FALSE);
2763 if (mail_error.isSet()) obj->postErrorDialog(mail_error);
2768 RoamMenuWindow::copy_callback(void *client_data, char *selection)
2770 DtMailEnv mail_error;
2773 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
2775 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 15, "Saving..."));
2776 obj->_mailbox->save();
2777 theRoamApp.unbusyAllWindows();
2779 obj->_list->copySelected(mail_error, selection, FALSE, FALSE);
2780 if (mail_error.isSet()) obj->postErrorDialog(mail_error);
2785 RoamMenuWindow::create_container_callback(void *client_data, char *selection)
2787 RoamMenuWindow *obj = (RoamMenuWindow*) client_data;
2788 obj->create_new_container(selection);
2793 RoamMenuWindow::create_new_container(char *filename)
2797 if (SafeAccess(filename, F_OK) == 0)
2799 char *buf = new char[2048];
2802 GETMSG(DT_catd, 3, 21, "%s already exists.\nOverwrite?"),
2804 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 22, "Mailer"), buf);
2805 answer = _genDialog->post_and_return(DTMAILHELPERROR);
2811 if (unlink(filename) < 0)
2814 GETMSG(DT_catd, 3, 23,
2815 "Unable to overwrite %s.\nCheck file permissions and retry."),
2818 _genDialog->setToErrorDialog(GETMSG(DT_catd, 3, 24, "Mailer"), buf);
2819 (void) _genDialog->post_and_return(DTMAILHELPERROR);
2826 // Path filename is ok -- now follow the same route as for Open
2827 this->view_mail_file(filename, DTM_TRUE);
2832 // SR - added methods below
2835 RoamMenuWindow::ifViewExists(DtMailMessageHandle msg_num)
2839 FORCE_SEGV_DECL(ViewMsgDialog, a_view);
2841 for (i = 0; i < _numDialogs; i++) {
2842 a_view = _dialogs[i];
2843 if (a_view->msgno() == msg_num) {
2852 RoamMenuWindow::addToRowOfButtons()
2854 FORCE_SEGV_DECL(CmdInterface, ci);
2855 Widget w, prev_widget;
2858 _delete_button = new DeleteCmd (
2860 GETMSG(DT_catd, 1, 9, "Delete"),
2862 ci = new ButtonInterface (_rowOfButtons, _delete_button);
2863 w = ci->baseWidget();
2864 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILDELBTNID);
2866 XmNleftAttachment, XmATTACH_FORM,
2867 XmNtopAttachment, XmATTACH_FORM,
2868 XmNbottomAttachment, XmATTACH_FORM,
2869 XmNmarginLeft, offset,
2870 XmNmarginRight, offset,
2875 _next_button = new NextCmd (
2877 GETMSG(DT_catd, 1, 10, "Next"),
2879 ci = new ButtonInterface (_rowOfButtons, _next_button);
2880 w = ci->baseWidget();
2881 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILNEXTBTNID);
2883 XmNleftAttachment, XmATTACH_WIDGET,
2884 XmNleftWidget, prev_widget,
2886 XmNtopAttachment, XmATTACH_FORM,
2887 XmNbottomAttachment, XmATTACH_FORM,
2888 XmNmarginLeft, offset,
2889 XmNmarginRight, offset,
2894 _previous_button = new PrevCmd (
2896 GETMSG(DT_catd, 1, 11, "Previous"),
2898 ci = new ButtonInterface (_rowOfButtons, _previous_button);
2899 w = ci->baseWidget();
2900 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPREVBTNID);
2902 XmNleftAttachment, XmATTACH_WIDGET,
2903 XmNleftWidget, prev_widget,
2905 XmNtopAttachment, XmATTACH_FORM,
2906 XmNbottomAttachment, XmATTACH_FORM,
2907 XmNmarginLeft, offset,
2908 XmNmarginRight, offset,
2913 _replySender_button = new ReplyCmd (
2915 GETMSG(DT_catd, 1, 12, "Reply to Sender"),
2919 ci = new ButtonInterface (_rowOfButtons, _replySender_button);
2920 w = ci->baseWidget();
2921 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILREPLYBTNID);
2923 XmNleftAttachment, XmATTACH_WIDGET,
2924 XmNleftWidget, prev_widget,
2926 XmNtopAttachment, XmATTACH_FORM,
2927 XmNbottomAttachment, XmATTACH_FORM,
2928 XmNmarginLeft, offset,
2929 XmNmarginRight, offset,
2935 _print_button = new PrintCmd ( "Print", GETMSG(DT_catd, 1, 13, "Print"),
2937 ci = new ButtonInterface (_rowOfButtons, _print_button);
2938 w = ci->baseWidget();
2939 XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPRINTBTNID);
2941 XmNleftAttachment, XmATTACH_WIDGET,
2942 XmNleftWidget, prev_widget,
2944 XmNtopAttachment, XmATTACH_FORM,
2945 XmNbottomAttachment, XmATTACH_FORM,
2946 XmNmarginLeft, offset,
2947 XmNmarginRight, offset,
2954 RoamMenuWindow::addToRowOfLabels(MsgScrollingList *msglist)
2957 XmString arrow, basexms, spaces, spaces_arrow;
2958 char arrow_symbol[2];
2961 glyph_font = theRoamApp.glyphName();
2965 XmFontListEntry xmfle;
2966 XmFontList xmfl, xmfl_old;
2969 xfs = XLoadQueryFont(XtDisplay(_rowOfLabels), glyph_font);
2970 xmfle = XmFontListEntryCreate("arrow", XmFONT_IS_FONT, (XtPointer) xfs);
2972 lbl = XtVaCreateManagedWidget("t", xmLabelGadgetClass, _rowOfLabels, NULL);
2973 XtVaGetValues(lbl, XmNfontList, &xmfl_old, NULL);
2974 xmfl = XmFontListAppendEntry(xmfl_old, xmfle);
2976 // Pixel foreground, background;
2977 XmRenderTable rt, rt_old;
2982 // lbl = XtVaCreateManagedWidget("t", xmLabelGadgetClass, _rowOfLabels, NULL);
2985 // XmNrenderTable, &rt_old,
2986 // XmNforeground, &foreground,
2987 // XmNbackground, &background,
2990 // XtSetArg(args[nargs], XmNrenditionBackground, background); nargs++;
2991 // XtSetArg(args[nargs], XmNrenditionForeground, foreground); nargs++;
2992 // XtSetArg(args[nargs], XmNloadModel, XmLOAD_IMMEDIATE); nargs++;
2994 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
2995 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
2996 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
2999 arrow_symbol[0] = (char) 209;
3000 arrow_symbol[1] = '\0';
3002 spaces = XmStringCreateLocalized(" ");
3003 arrow = XmStringCreate((char*) arrow_symbol, "arrow");
3004 spaces_arrow = XmStringConcat(spaces, arrow);
3006 XmStringFree(spaces);
3007 spaces = XmStringCreateLocalized(" ");
3009 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 14, "Sender"));
3010 _sender_xms = XmStringConcat(basexms, spaces);
3011 _sender_key_xms = XmStringConcat(basexms, spaces_arrow);
3012 XmStringFree(basexms);
3014 _sender_lbl = XtVaCreateManagedWidget(
3015 "Sender", xmLabelGadgetClass,
3021 XmNlabelString, _sender_xms,
3022 XmNalignment, XmALIGNMENT_BEGINNING,
3025 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3026 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3027 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3029 XtVaGetValues(_sender_lbl, XmNrenderTable, &rt_old, NULL);
3030 rt = XmRenderTableCopy(rt_old, NULL, 0);
3031 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3032 XtVaSetValues(_sender_lbl, XmNrenderTable, rt, NULL);
3034 // Add help callback
3035 // printHelpId("Sender", _sender_lbl);
3036 // XtAddCallback(_sender_lbl, XmNhelpCallback, HelpCB, helpId);
3038 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 15, "Subject"));
3039 _subject_xms = XmStringConcat(basexms, spaces);
3040 _subject_key_xms = XmStringConcat(basexms, spaces_arrow);
3041 XmStringFree(basexms);
3043 _subject_lbl = XtVaCreateManagedWidget(
3044 "Subject", xmLabelGadgetClass,
3050 XmNlabelString, _subject_xms,
3051 XmNalignment, XmALIGNMENT_BEGINNING,
3054 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3055 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3056 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3058 XtVaGetValues(_subject_lbl, XmNrenderTable, &rt_old, NULL);
3059 rt = XmRenderTableCopy(rt_old, NULL, 0);
3060 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3061 XtVaSetValues(_subject_lbl, XmNrenderTable, rt, NULL);
3063 // Add help callback
3064 // printHelpId("Subject", _subject_lbl);
3065 // XtAddCallback(_subject_lbl, XmNhelpCallback, HelpCB, helpId);
3067 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 16,"Date and Time"));
3068 _date_xms = XmStringConcat(basexms, spaces);
3069 _date_key_xms = XmStringConcat(basexms, spaces_arrow);
3070 XmStringFree(basexms);
3072 _date_lbl = XtVaCreateManagedWidget(
3073 "DateTime", xmLabelGadgetClass,
3079 XmNlabelString, _date_xms,
3080 XmNalignment, XmALIGNMENT_BEGINNING,
3083 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3084 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3085 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3087 XtVaGetValues(_date_lbl, XmNrenderTable, &rt_old, NULL);
3088 rt = XmRenderTableCopy(rt_old, NULL, 0);
3089 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3090 XtVaSetValues(_date_lbl, XmNrenderTable, rt, NULL);
3092 // Add help callback
3093 // printHelpId("DateTime", _subject_lbl);
3094 // XtAddCallback(_date_lbl, XmNhelpCallback, HelpCB, helpId);
3096 basexms = XmStringCreateLocalized(GETMSG(DT_catd, 1, 17, "Size"));
3097 _size_xms = XmStringConcat(basexms, spaces);
3098 _size_key_xms = XmStringConcat(basexms, spaces_arrow);
3099 XmStringFree(basexms);
3101 _size_lbl = XtVaCreateManagedWidget(
3102 "Size", xmLabelGadgetClass,
3108 XmNlabelString, _size_xms,
3109 XmNalignment, XmALIGNMENT_BEGINNING,
3112 XtSetArg(args[nargs], XmNfontName, glyph_font); nargs++;
3113 XtSetArg(args[nargs], XmNfontType, XmFONT_IS_FONT); nargs++;
3114 rend = XmRenditionCreate(_rowOfLabels, "arrow", args, nargs);
3116 XtVaGetValues(_size_lbl, XmNrenderTable, &rt_old, NULL);
3117 rt = XmRenderTableCopy(rt_old, NULL, 0);
3118 rt = XmRenderTableAddRenditions(rt, &rend, 1, XmMERGE_REPLACE);
3119 XtVaSetValues(_size_lbl, XmNrenderTable, rt, NULL);
3121 // Add help callback
3122 // printHelpId("Size", _size_lbl);
3123 // XtAddCallback(_size_lbl, XmNhelpCallback, HelpCB, helpId);
3125 // Adjust labels so the align on the columns
3126 msglist->layoutLabels(_sender_lbl, _subject_lbl, _date_lbl, _size_lbl);
3128 XmStringFree(arrow);
3129 XmStringFree(spaces);
3130 XmStringFree(spaces_arrow);
3135 RoamMenuWindow::addToRowOfMessageStatus()
3137 XmString labelStr1, labelStr2;
3139 // Size of first label
3141 labelStr1 = XmStringCreateLocalized(GETMSG(DT_catd, 3, 25,
3142 "Loading container..."));
3144 labelStr2 = XmStringCreateLocalized(
3145 GETMSG(DT_catd, 3, 26, "Folder Summary Information"));
3147 _message = XtCreateManagedWidget(
3148 "Message_Status_Text", xmLabelWidgetClass,
3149 _rowOfMessageStatus, NULL, 0);
3150 printHelpId("_message", _message);
3151 /* add help callback */
3152 // XtAddCallback(_message, XmNhelpCallback, HelpCB, helpId);
3155 XtVaSetValues(_message,
3156 XmNalignment, XmALIGNMENT_BEGINNING,
3157 XmNleftAttachment, XmATTACH_FORM,
3158 XmNtopAttachment, XmATTACH_FORM,
3159 XmNbottomAttachment, XmATTACH_FORM,
3160 XmNlabelString, labelStr1,
3163 _message_summary = XtCreateManagedWidget("Message_Summary",
3165 _rowOfMessageStatus, NULL, 0);
3166 XtVaSetValues(_message_summary,
3167 XmNalignment, XmALIGNMENT_END,
3168 XmNlabelString, labelStr2,
3169 XmNrightAttachment, XmATTACH_FORM,
3172 XtVaSetValues(_message,
3173 XmNrightAttachment, XmATTACH_WIDGET,
3174 XmNrightWidget, _message_summary,
3178 XmStringFree(labelStr1);
3179 XmStringFree(labelStr2);
3184 RoamMenuWindow::createContainerList()
3186 FORCE_SEGV_DECL(DtMail::Session, m_session);
3188 const char *val = NULL;
3189 const char *cached_containerlist_size = NULL;
3190 const char *display_cfs = NULL;
3191 DtMailBoolean user_list = DTM_FALSE;
3194 // Get names for permanent containers from .mailrc.
3195 // We get the items from the "filemenu2" variable.
3196 if (_filemenu2 != NULL) free (_filemenu2);
3198 m_session = theRoamApp.session()->session();
3199 m_session->mailRc(error)->getValue(error, "filemenu2", &val);
3200 if (error.isNotSet() && val != NULL && *val != '\0')
3202 user_list = DTM_TRUE;
3203 _filemenu2 = strdup(val);
3205 else _filemenu2 = NULL;
3210 // We will use _user_containerlist to keep track of the static set of
3211 // containers coming from the "filemenu2" value.
3212 // We will use _cached_containerlist to keep track of containers
3213 // which get cached from "Other Mailboxes... operations from the
3214 // Open, CopyTo, and Move menus.
3216 if (_user_containerlist != NULL)
3217 delete (_user_containerlist);
3218 _user_containerlist = new DtVirtArray<ContainerMenuCmd*> (3);
3220 m_session->mailRc(error)->getValue(
3222 "dontdisplaycachedfiles",
3225 if (error.isNotSet() && display_cfs != NULL)
3226 _max_cached_list_size = 0;
3230 m_session->mailRc(error)->getValue(
3232 "cachedfilemenusize",
3233 &cached_containerlist_size);
3234 if (error.isNotSet() &&
3235 cached_containerlist_size &&
3236 *cached_containerlist_size)
3237 _max_cached_list_size =
3238 (int) strtol(cached_containerlist_size, NULL, 10);
3240 _max_cached_list_size = 10;
3243 if (NULL != display_cfs)
3244 free((void*) display_cfs);
3245 if (NULL != cached_containerlist_size)
3246 free((void*) cached_containerlist_size);
3248 int size = (_max_cached_list_size ? _max_cached_list_size : 1);
3249 _cached_containerlist = new DtVirtArray<ContainerMenuCmd*> (size);
3251 if (user_list == DTM_TRUE) {
3252 char *expanded_list = m_session->expandPath(error, _filemenu2);
3256 // Create arrays to hold the user defined container list and the
3257 // recently visited (cached) container list.
3259 if ((token = (char *) strtok(expanded_list, " ")))
3261 ContainerMenuCmd *null_container;
3263 null_container= new ContainerMenuCmd(
3269 _user_containerlist->append(null_container);
3270 while (token = (char *) strtok(NULL, " "))
3272 null_container= new ContainerMenuCmd(
3278 _user_containerlist->append(null_container);
3281 free(expanded_list);
3284 if (_user_containerlist->length() > 0)
3285 _first_cached_item = _user_containerlist->length() +4;
3287 _first_cached_item = 3;
3291 RoamMenuWindow::createOpenContainerList(CmdList * open_container)
3294 char *container_name;
3295 ContainerMenuCmd *container_cmd;
3297 _open_container_separator = new SeparatorCmd("Separator","Separator", TRUE);
3299 _open_container_inbox = new OpenInboxCmd(
3301 GETMSG(DT_catd, 1, 221, "Inbox"),
3302 (FALSE == this->inbox()),
3305 _open_container_other = new UnifiedSelectMailboxCmd(
3307 GETMSG(DT_catd, 1, 246, "Other Mailboxes..."),
3308 GETMSG(DT_catd, 1, 26, "Mailer - Open"),
3309 GETMSG(DT_catd, 1, 27, "Open"),
3311 RoamMenuWindow::file_selection_callback,
3317 // We will use _open_container_containerlist to keep track of the
3318 // static set of OpenContainer commands coming from the "filemenu2"
3321 ncontainers = _user_containerlist->length();
3323 if (_open_container_containerlist != NULL)
3324 delete (_open_container_containerlist);
3325 _open_container_containerlist =
3326 new DtVirtArray<ContainerMenuCmd*>(ncontainers);
3328 for (i=0; i<ncontainers; i++)
3330 container_name = (*_user_containerlist)[i]->containerName();
3331 if (NULL != container_name)
3333 container_cmd = new ContainerMenuCmd(
3334 strdup(container_name),
3339 open_container->add(container_cmd);
3340 _open_container_containerlist->append(container_cmd);
3344 if (0 < ncontainers)
3345 open_container->add(_open_container_separator);
3346 open_container->add(_open_container_inbox);
3347 open_container->add(_open_container_other);
3348 open_container->add(_open_container_separator);
3351 // We will use _open_container_containerlist_cached
3352 // to keep track of OpenContainer which get cached from
3353 // "Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3356 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1);
3358 if (_open_container_containerlist_cached != NULL)
3359 delete (_open_container_containerlist_cached);
3360 _open_container_containerlist_cached =
3361 new DtVirtArray<ContainerMenuCmd*> (ncontainers);
3363 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
3364 for (i=0; i<ncontainers; i++)
3366 container_name = (*_cached_containerlist)[i]->containerName();
3367 if (NULL != container_name)
3369 container_cmd = new ContainerMenuCmd(
3370 strdup(container_name),
3375 open_container->add(container_cmd);
3376 _open_container_containerlist_cached->append(container_cmd);
3383 RoamMenuWindow::construct_file_menu()
3385 FORCE_SEGV_DECL(CmdList, cmdList);
3387 _file_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3389 // Create the "Container" item in the menubar. And fill
3390 // with items below the "Container" item in the menubar.
3392 cmdList = new CmdList( "Mailbox", GETMSG(DT_catd, 1, 18, "Mailbox") );
3393 _file_cmdlist = cmdList;
3395 _file_check_new_mail = new CheckForNewMailCmd(
3396 "Check for New Mail",
3397 GETMSG(DT_catd, 1, 19, "Check for New Mail"),
3400 if (this->inbox()) { // Deactivate the Open Inbox item
3401 _file_open_inbox = new OpenInboxCmd(
3403 GETMSG(DT_catd, 1, 20, "Open Inbox"),
3407 else { // Activate the Open Inbox item.
3408 _file_open_inbox = new OpenInboxCmd(
3410 GETMSG(DT_catd, 1, 21, "Open Inbox"),
3415 _file_new_container = new UnifiedSelectMailboxCmd(
3417 GETMSG(DT_catd, 1, 22, "New..."),
3418 GETMSG(DT_catd, 1, 23, "Mailer - New"),
3419 GETMSG(DT_catd, 1, 24, "New"),
3421 RoamMenuWindow::create_container_callback,
3425 #if defined(USE_OLD_FILE_OPEN)
3426 _file_open = new UnifiedSelectMailboxCmd(
3428 GETMSG(DT_catd, 1, 25, "Open..."),
3429 GETMSG(DT_catd, 1, 26, "Mailer - Open"),
3430 GETMSG(DT_catd, 1, 27, "Open"),
3432 RoamMenuWindow::file_selection_callback,
3434 this->baseWidget());
3437 _open_container_cmdlist = new CmdList(
3439 GETMSG(DT_catd, 1, 245, "Open"));
3440 createOpenContainerList(_open_container_cmdlist);
3442 _file_destroy_deleted_msgs = new DestroyCmd(
3443 "Destroy Deleted Message",
3444 GETMSG(DT_catd, 1, 28,
3445 "Destroy Deleted Messages"),
3450 _file_quit = new QuitCmd (
3452 GETMSG(DT_catd, 1, 29, "Close"),
3456 cmdList->add(_file_check_new_mail);
3457 cmdList->add(_file_open_inbox);
3458 cmdList->add(_file_separator);
3459 cmdList->add(_file_new_container);
3460 #if defined(USE_OLD_FILE_OPEN)
3461 cmdList->add(_file_open);
3463 cmdList->add(_open_container_cmdlist);
3464 cmdList->add(_file_separator);
3465 cmdList->add(_file_destroy_deleted_msgs);
3466 cmdList->add(theRoamApp.mailOptions());
3467 cmdList->add(_file_separator);
3468 cmdList->add(_file_quit);
3470 _menuBar->addCommands(&_file_cascade, cmdList);
3472 _opencontainerMenu = _open_container_cmdlist->getPaneWidget();
3476 XmNpacking, XmPACK_COLUMN,
3477 XmNorientation, XmVERTICAL,
3482 XmNmapCallback, &RoamMenuWindow::map_menu,
3485 XtSetSensitive(_opencontainerMenu, TRUE);
3489 RoamMenuWindow::createCopyList(CmdList * copy_to)
3492 char *container_name;
3493 ContainerMenuCmd *container_cmd;
3495 _copyto_separator = new SeparatorCmd("Separator","Separator", TRUE);
3497 _copyto_inbox = new CopyToInboxCmd(
3499 GETMSG(DT_catd, 1, 221, "Inbox"),
3503 // This is where we initialize _move_copy_button, so this needs to
3504 // be the first place that we use it. This routine needs to be
3505 // called before construct_move_menu(), which expects _move_copy_button
3506 // to be intialized.
3509 DtMail::Session * d_session = theRoamApp.session()->session();
3510 DtMail::MailRc * mailrc = d_session->mailRc(error);
3511 const char *value = NULL;
3512 DtMailBoolean only_show_mailboxes = DTM_FALSE;
3514 mailrc->getValue(error, "movecopytomailboxesonly", &value);
3515 only_show_mailboxes = (error.isSet()) ? DTM_FALSE : DTM_TRUE;
3517 value = strdup("15");
3521 free((void*) value);
3523 _move_copy_button = new MoveCopyCmd (
3524 "Other Mailboxes...",
3525 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3527 RoamMenuWindow::move_callback,
3528 RoamMenuWindow::copy_callback,
3531 only_show_mailboxes);
3532 _copyto_other = new CopyCmd(
3533 GETMSG(DT_catd, 1, 237, "Copy"),
3534 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3537 (MoveCopyCmd *) _move_copy_button);
3540 // We will use _copyto_containerlist to keep track of the
3541 // static set of CopyTo commands coming from the "filemenu2"
3544 ncontainers = _user_containerlist->length();
3546 if (_copyto_containerlist != NULL)
3547 delete (_copyto_containerlist);
3548 _copyto_containerlist =
3549 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3551 for (i=0; i<ncontainers; i++)
3553 container_name = (*_user_containerlist)[i]->containerName();
3554 if (NULL != container_name)
3556 container_cmd = new ContainerMenuCmd(
3557 strdup(container_name),
3562 copy_to->add(container_cmd);
3563 _copyto_containerlist->append(container_cmd);
3567 if (0 < ncontainers)
3568 copy_to->add(_copyto_separator);
3569 copy_to->add(_copyto_inbox);
3570 copy_to->add(_copyto_other);
3571 copy_to->add(_copyto_separator);
3574 // We will use _copyto_containerlist_cached
3575 // to keep track of CopyTo commands which get cached from
3576 //"Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3579 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1);
3581 if (_copyto_containerlist_cached != NULL)
3582 delete (_copyto_containerlist_cached);
3583 _copyto_containerlist_cached =
3584 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3586 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
3587 for (i=0; i<ncontainers; i++)
3589 container_name = (*_cached_containerlist)[i]->containerName();
3590 if (NULL != container_name)
3592 container_cmd = new ContainerMenuCmd(
3593 strdup(container_name),
3598 copy_to->add(container_cmd);
3599 _copyto_containerlist_cached->append(container_cmd);
3605 RoamMenuWindow::construct_message_menu()
3607 FORCE_SEGV_DECL(CmdList, cmdList);
3608 // Separator for menu items
3610 _msg_separator= new SeparatorCmd( "Separator","Separator", TRUE );
3612 _msg_open = new OpenMsgCmd(
3614 GETMSG(DT_catd, 1, 30, "Open"),
3617 _msg_save_as = new SaveAsTextCmd (
3619 GETMSG(DT_catd, 1, 31, "Save As Text..."),
3620 GETMSG(DT_catd, 1, 32, "Mailer - Message - Save As Text"),
3622 get_editor()->textEditor(),
3624 this->baseWidget());
3626 _copyto_cmdlist = new CmdList("Copy To", GETMSG(DT_catd, 1, 33, "Copy To"));
3627 createCopyList(_copyto_cmdlist);
3629 _msg_print = new PrintCmd(
3631 GETMSG(DT_catd, 1, 34, "Print..."),
3634 _msg_find = new FindCmd (
3636 GETMSG(DT_catd, 1, 35, "Find..."),
3639 _msg_select_all = new SelectAllCmd (
3641 GETMSG(DT_catd, 1, 36, "Select All"),
3644 _msg_delete = new DeleteCmd(
3646 GETMSG(DT_catd, 1, 37, "Delete"),
3649 _msg_undelete_last = new UndeleteCmd (
3651 GETMSG(DT_catd, 1, 38, "Undelete Last"),
3652 TRUE, this, FALSE );
3654 _msg_undelete_from_list = new UndeleteCmd(
3655 "Undelete From List...",
3656 GETMSG(DT_catd, 1, 39,
3657 "Undelete From List..."),
3662 cmdList = new CmdList( "Message", GETMSG(DT_catd, 1, 40, "Message") );
3663 _msg_cmdlist = cmdList;
3665 cmdList->add(_msg_open);
3666 cmdList->add(_msg_save_as);
3667 cmdList->add(_copyto_cmdlist);
3668 cmdList->add(_msg_print);
3669 cmdList->add(_msg_find);
3670 cmdList->add(_msg_select_all);
3672 cmdList->add(_msg_separator);
3674 cmdList->add(_msg_delete);
3675 cmdList->add(_msg_undelete_last);
3676 cmdList->add(_msg_undelete_from_list);
3678 _menuBar->addCommands(&_message_cascade, cmdList, FALSE, XmMENU_BAR);
3680 _copytoMenu = _copyto_cmdlist->getPaneWidget();
3682 XtVaSetValues(_copytoMenu,
3683 XmNpacking, XmPACK_COLUMN,
3684 XmNorientation, XmVERTICAL,
3687 XtAddCallback(_copytoMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
3689 XtSetSensitive(_copytoMenu, TRUE);
3693 RoamMenuWindow::construct_message_popup(void)
3695 _msgsPopup_cmdlist = new CmdList( "MsgsPopup", "MsgsPopup");
3697 LabelCmd *title = new LabelCmd (
3698 "Mailer - Messages",
3699 GETMSG(DT_catd, 1, 42, "Mailer - Messages"), TRUE);
3700 _msgsPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3701 _msgsPopup_cmdlist->add(title);
3702 _msgsPopup_cmdlist->add(_msgsPopup_separator);
3703 _msgsPopup_cmdlist->add(_msg_delete);
3704 _msgsPopup_cmdlist->add(_msg_undelete_last);
3705 _msgsPopup_cmdlist->add(_msg_print);
3706 _msgsPopup_cmdlist->add(_comp_replySender);
3707 _msgsPopup_cmdlist->add(_move_cmdlist);
3708 _msgsPopup_cmdlist->add(_msg_save_as);
3709 _msgsPopup_cmdlist->add(_file_check_new_mail);
3711 Widget parent = XtParent(_list->get_scrolling_list());
3712 _menuPopupMsgs = new MenuBar(parent, "RoamMsgsPopup", XmMENU_POPUP);
3713 _msgsPopupMenu = _menuPopupMsgs->addCommands(_msgsPopup_cmdlist,
3714 FALSE, XmMENU_POPUP);
3715 XtAddEventHandler(parent, ButtonPressMask,
3716 FALSE, MenuButtonHandler, (XtPointer) this);
3718 _msgsPopupMoveMenu = _move_cmdlist->getPaneWidget();
3720 XtVaSetValues(_msgsPopupMoveMenu,
3721 XmNpacking, XmPACK_COLUMN,
3722 XmNorientation, XmVERTICAL,
3724 XtAddCallback(_msgsPopupMoveMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
3726 XtSetSensitive(_msgsPopupMoveMenu, TRUE);
3731 RoamMenuWindow::construct_edit_menu()
3733 FORCE_SEGV_DECL(CmdList, cmdList);
3734 // Separator for menu items
3736 _edit_copy = new EditCopyCmd(
3738 GETMSG(DT_catd, 1, 43, "Copy"),
3743 _edit_select_all = new EditSelectAllCmd(
3745 GETMSG(DT_catd, 1, 44, "Select All"),
3750 cmdList = new CmdList("Edit", GETMSG(DT_catd, 1, 45, "Edit"));
3751 _edit_cmdlist = cmdList;
3753 cmdList->add(_edit_copy);
3754 cmdList->add(_edit_select_all);
3756 _menuBar->addCommands(cmdList);
3760 RoamMenuWindow::construct_text_popup(void)
3762 if (theApplication->bMenuButton() != Button3)
3765 _textPopup_cmdlist = new CmdList( "TextPopup", "TextPopup");
3767 LabelCmd *title = new LabelCmd (
3769 GETMSG(DT_catd, 1, 46, "Mailer - Text"), TRUE);
3770 _textPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
3772 _textPopup_cmdlist->add(title);
3773 _textPopup_cmdlist->add(_textPopup_separator);
3774 _textPopup_cmdlist->add(_edit_copy);
3775 _textPopup_cmdlist->add(_edit_select_all);
3777 Widget parent = _my_editor->textEditor()->get_editor();
3778 _menuPopupText = new MenuBar(parent, "RoamTextPopup", XmMENU_POPUP);
3779 _textPopupMenu = _menuPopupText->addCommands(_textPopup_cmdlist,
3780 FALSE, XmMENU_POPUP);
3784 void RoamMenuWindow::construct_view_menu()
3786 FORCE_SEGV_DECL(CmdList, cmdList);
3787 FORCE_SEGV_DECL(CmdList, subCmdList);
3789 _view_separator= new SeparatorCmd("Separator","Separator",TRUE);
3791 _view_next = new NextCmd (
3793 GETMSG(DT_catd, 1, 47, "Next"), TRUE, this );
3794 _view_previous = new PrevCmd (
3796 GETMSG(DT_catd, 1, 48, "Previous"), TRUE, this );
3798 _view_abbrev_headers = new AbbrevHeadersCmd(
3799 "Abbreviated Headers",
3800 GETMSG(DT_catd, 1, 49, "Abbreviated Headers"),
3804 _view_sortTD = new SortCmd ("By Date/Time",
3805 GETMSG(DT_catd, 1, 50, "By Date/Time"),
3809 _view_sortSender = new SortCmd ("By Sender",
3810 GETMSG(DT_catd, 1, 51, "By Sender"),
3814 _view_sortSubject = new SortCmd ("By Subject",
3815 GETMSG(DT_catd, 1, 52, "By Subject"),
3819 _view_sortSize = new SortCmd ("By Size",
3820 GETMSG(DT_catd, 1, 53, "By Size"),
3824 _view_sortStatus = new SortCmd ("By Status",
3825 GETMSG(DT_catd, 1, 54, "By Status"),
3832 cmdList = new CmdList( "View", GETMSG(DT_catd, 1, 55, "View") );
3833 _view_cmdlist = cmdList;
3835 cmdList->add(_view_next);
3836 cmdList->add(_view_previous);
3837 cmdList->add(_view_separator);
3838 cmdList->add(_view_abbrev_headers);
3839 cmdList->add(_view_separator);
3840 cmdList->add(_view_sortTD);
3841 cmdList->add(_view_sortSender);
3842 cmdList->add(_view_sortSubject);
3843 cmdList->add(_view_sortSize);
3844 cmdList->add(_view_sortStatus);
3846 _menuBar->addCommands ( cmdList );
3851 RoamMenuWindow::construct_compose_menu()
3853 FORCE_SEGV_DECL(CmdList, cmdList);
3854 FORCE_SEGV_DECL(CmdList, subCmdList);
3856 // Separator for menu items
3858 _comp_separator= new SeparatorCmd( "Separator","Separator", TRUE );
3860 _comp_new = new ComposeCmd (
3862 GETMSG(DT_catd, 1, 56, "New Message"),
3865 _comp_new_include = new ForwardCmd (
3867 GETMSG(DT_catd, 1, 57, "New, Include All"),
3871 _comp_forward = new ForwardCmd (
3873 GETMSG(DT_catd, 1, 58, "Forward Message"),
3878 _comp_replySender = new ReplyCmd (
3880 GETMSG(DT_catd, 1, 59, "Reply to Sender"),
3885 _comp_replyAll = new ReplyAllCmd (
3887 GETMSG(DT_catd, 1, 60, "Reply to All"),
3892 _comp_replySinclude= new ReplyCmd (
3893 "Reply to Sender, Include",
3894 GETMSG(DT_catd, 1, 61, "Reply to Sender, Include"),
3899 _comp_replyAinclude= new ReplyAllCmd (
3900 "Reply to All, Include",
3901 GETMSG(DT_catd, 1, 62, "Reply to All, Include"),
3909 cmdList = new CmdList( "Compose", GETMSG(DT_catd, 1, 63, "Compose") );
3910 _comp_cmdlist = cmdList;
3911 cmdList->add(_comp_new);
3912 cmdList->add(_comp_new_include);
3913 cmdList->add(_comp_forward);
3914 cmdList->add(_comp_separator);
3915 cmdList->add(_comp_replySender);
3916 cmdList->add(_comp_replyAll);
3917 cmdList->add(_comp_replySinclude);
3918 cmdList->add(_comp_replyAinclude);
3920 _menuBar->addCommands ( cmdList );
3923 // construct_move_menu() builds the Move menu on the menu bar.
3924 // There is a user defined set of items at the top, the Inbox,
3925 // the "Mail Filing..." item, and a dynamic list of most recently
3926 // accessed containers at the bottom.
3929 RoamMenuWindow::construct_move_menu()
3932 char *container_name;
3933 ContainerMenuCmd *container_cmd;
3936 if (_move_cmdlist != NULL)
3937 delete _move_cmdlist;
3938 _move_cmdlist = new CmdList( "Move", GETMSG(DT_catd, 1, 64, "Move") );
3940 _move_separator = new SeparatorCmd("Separator","Separator", TRUE );
3942 _move_inbox = new MoveToInboxCmd(
3944 GETMSG(DT_catd, 1, 221, "Inbox"),
3948 // We expect _move_copy_button to have been initialized already when
3949 // we constructed the copy menu.
3950 _move_other = new MoveCmd(
3951 GETMSG(DT_catd, 1, 90, "Move"),
3952 GETMSG(DT_catd, 1, 65, "Other Mailboxes..."),
3955 (MoveCopyCmd *) _move_copy_button);
3958 // We will use _move_containerlist to keep track of the
3959 // static set of Move commands coming from the "filemenu2"
3962 ncontainers = _user_containerlist->length();
3964 if (_move_containerlist != NULL)
3965 delete _move_containerlist;
3966 _move_containerlist = new DtVirtArray<ContainerMenuCmd *> (ncontainers);
3968 for (i=0; i<ncontainers; i++)
3970 container_name = (*_user_containerlist)[i]->containerName();
3971 if (NULL != container_name)
3973 container_cmd = new ContainerMenuCmd(
3974 strdup(container_name),
3979 _move_cmdlist->add(container_cmd);
3980 _move_containerlist->append(container_cmd);
3985 if (0 < ncontainers)
3986 _move_cmdlist->add(_move_separator);
3987 _move_cmdlist->add(_move_inbox);
3989 _move_cmdlist->add(_move_other);
3990 _move_cmdlist->add(_move_separator);
3993 // We will use _move_containerlist_cached
3994 // to keep track of Move commands which get cached from
3995 // "Other Mailboxes..." operations from the Open, CopyTo, and Move menus.
3998 ncontainers = (_max_cached_list_size ? _max_cached_list_size : 1 );
4000 if (_move_containerlist_cached != NULL)
4001 delete _move_containerlist_cached;
4002 _move_containerlist_cached =
4003 new DtVirtArray<ContainerMenuCmd *> (ncontainers);
4005 ncontainers = (_display_cached_list ? _cached_containerlist->length() : 0);
4006 for (i=0; i<ncontainers; i++)
4008 container_name = (*_cached_containerlist)[i]->containerName();
4009 if (NULL != container_name)
4011 container_cmd = new ContainerMenuCmd(
4012 strdup(container_name),
4017 _move_cmdlist->add(container_cmd);
4018 _move_containerlist_cached->append(container_cmd);
4023 _moveMenu = _menuBar->addCommands(
4024 &_move_cascade, _move_cmdlist,
4026 XtVaSetValues(_moveMenu,
4027 XmNpacking, XmPACK_COLUMN,
4028 XmNorientation, XmVERTICAL,
4030 XtAddCallback(_moveMenu, XmNmapCallback, &RoamMenuWindow::map_menu, NULL);
4036 RoamMenuWindow::construct_attachment_menu()
4039 _att_save = new SaveAttachCmd (
4041 GETMSG(DT_catd, 1, 66, "Save As..."),
4042 GETMSG(DT_catd, 1, 67, "Mailer - Attachments - Save As"),
4044 RoamMenuWindow::save_attachment_callback,
4046 this->baseWidget());
4048 _att_select_all = new SelectAllAttachsCmd(
4051 DT_catd, 1, 68, "Select All"
4055 _att_cmdlist = new CmdList(
4062 _att_cmdlist->add(_att_save);
4063 _att_cmdlist->add(_att_select_all);
4065 // Create a pulldown from the items in the list. Retain a handle
4066 // to that pulldown since we need to dynamically add/delete entries
4067 // to this menu based on the selection of attachments.
4069 _attachmentMenu = _menuBar->addCommands(_att_cmdlist);
4073 RoamMenuWindow::construct_attachment_popup(void)
4075 _attPopup_cmdlist = new CmdList( "AttachmentsPopup", "AttachmentsPopup");
4077 LabelCmd *title = new LabelCmd (
4078 "Mailer - Attachments",
4079 GETMSG(DT_catd, 1, 70, "Mailer - Attachments"), TRUE);
4080 _attPopup_separator = new SeparatorCmd( "Separator","Separator", TRUE );
4082 _attPopup_cmdlist->add(title);
4083 _attPopup_cmdlist->add(_attPopup_separator);
4084 _attPopup_cmdlist->add(_att_save);
4085 _attPopup_cmdlist->add(_att_select_all);
4086 _menuPopupAtt = new MenuBar(_my_editor->attachArea()->getClipWindow(),
4087 "RoamAttachmentPopup", XmMENU_POPUP);
4088 _attachmentPopupMenu = _menuPopupAtt->addCommands(_attPopup_cmdlist,
4089 FALSE, XmMENU_POPUP);
4093 RoamMenuWindow::construct_help_menu()
4095 FORCE_SEGV_DECL(CmdList, cmdList);
4097 // Separator for menu items
4099 _help_separator= new SeparatorCmd( "Separator","Separator", TRUE );
4100 _help_overview = new OnAppCmd("Overview", GETMSG(DT_catd, 1, 71, "Overview"),
4102 _help_tasks = new TasksCmd("Tasks", GETMSG(DT_catd, 1, 72, "Tasks"),
4104 _help_reference = new ReferenceCmd("Reference",
4105 GETMSG(DT_catd, 1, 73, "Reference"),
4107 _help_on_item = new OnItemCmd("On Item", GETMSG(DT_catd, 1, 74, "On Item"),
4109 _help_using_help = new UsingHelpCmd("Using Help",
4110 GETMSG(DT_catd, 1, 75, "Using Help"),
4112 cmdList = new CmdList( "Help", GETMSG(DT_catd, 1, 76, "Help") );
4113 _help_cmdlist = cmdList;
4115 cmdList->add ( _help_overview );
4116 cmdList->add ( _help_separator );
4117 cmdList->add ( _help_tasks );
4118 cmdList->add ( _help_reference );
4119 cmdList->add ( _help_separator );
4120 cmdList->add ( _help_on_item );
4121 cmdList->add ( _help_separator );
4122 cmdList->add ( _help_using_help );
4123 cmdList->add ( _help_separator );
4125 _help_about_mailer = new RelNoteCmd("About Mailer...",
4126 GETMSG(DT_catd, 1, 77, "About Mailer..."),
4128 cmdList->add ( _help_about_mailer );
4130 // Make help menu show up on right side of menubar.
4131 _menuBar->addCommands ( cmdList, TRUE );
4136 RoamMenuWindow::syncCachedContainerList(void)
4138 RoamMenuWindow *rmw = NULL;
4140 rmw = theRoamApp.nextRoamMenuWindow(NULL);
4144 // Sync the cached lists to an existing RoamMenuWindow.
4145 for (int i = rmw->_cached_containerlist->length(); i > 0; i--) {
4146 char *name = (*(rmw->_cached_containerlist))[i-1]->containerName();
4147 addToCachedContainerList(name);
4152 RoamMenuWindow::get_mail_rc()
4156 if (NULL == _mailbox) return NULL;
4157 return _mailbox->session()->mailRc(error);
4162 RoamMenuWindow::load_mailbox(
4163 DtMailEnv & mail_error
4168 // If there is no mailbox, return.
4174 // Now load the messages into the scrolling list.
4175 // This will get the DtMailMessageHandles into the _msgs array and
4176 // it will also get their XmStrings into the CharArray of the _list.
4177 theRoamApp.busyAllWindows(GETMSG(DT_catd, 3, 27, "Loading..."));
4179 // Call load_headers() to get the XmStrings into the XmList!
4181 count = _list->load_headers(mail_error);
4183 if (mail_error.isSet()) {
4184 // Return whatever error mailbox->get_next_msg() returned.
4185 theRoamApp.unbusyAllWindows();
4192 this->message(GETMSG(DT_catd, 3, 28, "Empty container"));
4193 setIconName(EmptyIcon);
4196 _list->sort_messages();
4198 theRoamApp.unbusyAllWindows();
4202 RoamMenuWindow::clear_message()
4208 RoamMenuWindow::text_selected()
4211 // turn on sensitivity for Cut/Clear/Copy/Paste/Delete
4216 RoamMenuWindow::text_unselected()
4219 // turn off sensitivity for those items
4223 // syncViewAndStore() does the sync-ing of the view of a mail
4224 // container and the storage of that container.
4225 // This method gets invoked every time a message gets expunged
4226 // by the back end based on "timed delete".
4227 // The method needs to then remove the expunged message from the
4228 // deleted messages list, thereby syncing the view to be always
4229 // current with the storage.
4230 // Similarly, the method also gets invoked when the container store
4231 // has received new mail. The view then needs to be updated....
4235 RoamMenuWindow::syncViewAndStoreCallback(
4236 DtMailCallbackOp op,
4238 const char *, // prompt_hint
4247 va_start(args, client_data);
4248 RoamMenuWindow * rmw = (RoamMenuWindow *)client_data;
4250 bval = rmw->syncViewAndStore(op, path, args);
4255 RoamMenuWindow::syncViewAndStore(
4256 DtMailCallbackOp op,
4263 DtMailMessageHandle tmpMH;
4273 // New mail has come in. Load it in and update the
4274 // view's list of headers to also display it.
4276 tmpMH = va_arg(args, DtMailMessageHandle);
4277 this->_list->load_headers(error, tmpMH);
4279 newMailIndicators();
4283 case DTMC_DELETEMSG:
4285 // A message has been expunged from the store by the back end.
4286 // The expunge has been done based on "timed delete".
4287 // Remove the expunged message from the displayed list of
4293 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.");
4294 this->_genDialog->setToErrorDialog(
4295 GETMSG(DT_catd, 2, 10, "Mailer"),
4297 answer = this->_genDialog->post_and_return(
4298 GETMSG(DT_catd, 3, 29, "OK"),
4299 DTMAILHELPUNKNOWNSTATE);
4301 this->reopen_mail_file();
4306 case DTMC_ACCESSFAILED:
4308 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.");
4309 this->_genDialog->setToErrorDialog(
4310 GETMSG(DT_catd, 2, 10, "Mailer"),
4312 answer = this->_genDialog->post_and_return(
4313 GETMSG(DT_catd, 3, 29, "OK"),
4314 GETMSG(DT_catd, 3, 19, "Cancel"),
4315 DTMAILHELPUNKNOWNSTATE);
4316 this->normalCursor();
4319 this->reopen_mail_file();
4326 case DTMC_SERVERPASSWORDNEEDED:
4329 char *buffer = new char[2048];
4330 char *errmsgarg = va_arg(args, char*);
4332 sprintf(buffer, "%s", errmsgarg);
4333 this->_genDialog->setToTextFieldDialog(
4334 GETMSG(DT_catd, 2, 10, "Mailer"),
4336 answer = this->_genDialog->post_and_return(
4337 GETMSG(DT_catd, 3, 29, "Ok"),
4338 GETMSG(DT_catd, 3, 19, "Cancel"),
4339 DTMAILHELPUNKNOWNSTATE);
4340 this->normalCursor();
4344 char *password = NULL;
4345 DtMailEnv mail_error;
4346 password = _genDialog->getTextFieldValue();
4347 _mailbox->updateMailRetrievalPassword(password);
4348 _mailbox->checkForMail(error);
4349 if (NULL != password) free(password);
4357 case DTMC_SERVERACCESSFAILED:
4360 char *buffer = new char[2048];
4361 char *errmsgarg = va_arg(args, char*);
4363 errmsg = GETMSG(DT_catd, 1, 256, "Mail server access failed:\n%s");
4365 sprintf(buffer, errmsg, errmsgarg);
4366 this->_genDialog->setToErrorDialog(
4367 GETMSG(DT_catd, 2, 10, "Mailer"),
4369 answer = this->_genDialog->post_and_return(
4370 GETMSG(DT_catd, 1, 257, "Options..."),
4371 GETMSG(DT_catd, 3, 19, "Cancel"),
4372 DTMAILHELPUNKNOWNSTATE);
4373 this->normalCursor();
4377 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4378 optCmd->displayMailRetrievalOptionsPane();
4386 case DTMC_GETMAILCOMMANDFAILED:
4389 char *buffer = new char[2048];
4390 char *errmsgarg = va_arg(args, char*);
4393 GETMSG(DT_catd, 1, 258, "User Getmail command failed:\n%s");
4395 sprintf(buffer, errmsg, errmsgarg);
4396 this->_genDialog->setToErrorDialog(
4397 GETMSG(DT_catd, 2, 10, "Mailer"),
4399 answer = this->_genDialog->post_and_return(
4400 GETMSG(DT_catd, 1, 257, "Options..."),
4401 GETMSG(DT_catd, 3, 19, "Cancel"),
4402 DTMAILHELPUNKNOWNSTATE);
4403 this->normalCursor();
4407 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4408 optCmd->displayMailRetrievalOptionsPane();
4416 case DTMC_SERVERACCESSINFO:
4419 char *infomsg = va_arg(args, char*);
4425 case DTMC_SERVERACCESSINFOERROR:
4428 char *buffer = new char[2048];
4429 char *errmsgarg = va_arg(args, char*);
4431 sprintf(buffer, "%s", errmsgarg);
4432 this->_genDialog->setToErrorDialog(
4433 GETMSG(DT_catd, 2, 10, "Mailer"),
4435 answer = this->_genDialog->post_and_return(
4436 GETMSG(DT_catd, 1, 257, "Options..."),
4437 GETMSG(DT_catd, 3, 19, "Cancel"),
4438 DTMAILHELPUNKNOWNSTATE);
4439 this->normalCursor();
4443 OptCmd *optCmd = (OptCmd *) theRoamApp.mailOptions();
4444 optCmd->displayMailRetrievalOptionsPane();
4452 case DTMC_INODECHANGED:
4454 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.");
4456 this->_genDialog->setToErrorDialog(
4457 GETMSG(DT_catd, 2, 10, "Mailer"),
4459 answer = this->_genDialog->post_and_return(
4460 GETMSG(DT_catd, 3, 29, "OK"),
4461 GETMSG(DT_catd, 3, 19, "Cancel"),
4462 DTMAILHELPUNKNOWNSTATE);
4463 this->normalCursor();
4466 this->reopen_mail_file();
4475 // We are asked to save changes and close the file.
4476 // The backend will take care of unlocking the file.
4477 this->quit_silently();
4480 case DTMC_QUERYLOCK:
4482 // The file is lock by another mailer.
4483 // Should we ask for the lock?
4484 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4485 GETMSG(DT_catd, 3, 82, "Someone else is using this mailbox.\nWould you like to demand exclusive access?"));
4486 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 18, "OK"),
4487 GETMSG(DT_catd, 3, 19, "Cancel"), DTMAILHELPTAKELOCK);
4489 this->normalCursor();
4498 // We are not able to obtain a TT lock on this folder,
4499 // ask user if he wants to open it as read only.
4500 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4501 GETMSG(DT_catd, 3, 83, "Mailer is unable to obtain exclusive access to this mailbox.\nWould you like to open this mailbox read-only?"));
4502 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 18, "OK"),
4503 GETMSG(DT_catd, 3, 19, "Cancel"),
4504 DTMAILHELPOPENREADONLY);
4505 this->normalCursor();
4512 case DTMC_READWRITEOVERRIDE:
4513 // We are not able to obtain a lock on this folder,
4514 // ask user if he wants to open it as read only.
4515 _genDialog->setToQuestionDialog(GETMSG(DT_catd, 3, 16, "Mailer"),
4516 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)."));
4517 answer = _genDialog->post_and_return(GETMSG(DT_catd, 3, 95, "Read-only"),
4518 GETMSG(DT_catd, 3, 19, "Cancel"),
4519 GETMSG(DT_catd, 3, 96, "Read-Write"),
4520 DTMAILHELPOPENREADWRITEOVERRIDE);
4521 this->normalCursor();
4522 // Now the tricky part - since this method can only return
4523 // DTM_TRUE or DTM_FALSE, we must have a way to indicate "readOnly",
4524 // "readWrite" or "cancel" - horrid hack: readOnly is DTM_FALSE,
4525 // "readWrite" is DTM_TRUE, and "cancel" is (DTM_TRUE+DTM_FALSE)*2
4529 case 1: // Read-only
4531 case 3: // Read-Write
4534 return((DtMailBoolean)((DTM_FALSE+DTM_TRUE)*2));
4537 case DTMC_DOTDTMAILLOCKFAILED:
4540 char *buffer = new char[2048];
4541 char *lockpath = va_arg(args, char*);
4542 char *errormsg = va_arg(args, char*);
4543 char *cancel = GETMSG(DT_catd, 3, 19, "Cancel");
4544 char *ok = GETMSG(DT_catd, 3, 18, "OK");
4545 char *mailer = GETMSG(DT_catd, 3, 16, "Mailer");
4546 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.");
4548 // We are not able to obtain a .dtmail lock on this folder,
4549 // ask user if he wants to open it as read only.
4550 sprintf(buffer, msgfmt, errormsg, path, ok, cancel, lockpath);
4551 _genDialog->setToQuestionDialog(mailer, buffer);
4552 answer =_genDialog->post_and_return(ok, cancel, DTMAILHELPOPENREADONLY);
4553 this->normalCursor();
4563 this->normalCursor();
4567 this->normalCursor();
4571 // Convert the rfc file.
4572 // Commented out for PAR 5. Needs to be uncommented out for PAR 6
4576 RoamMenuWindow::convert(
4581 // Obsoleted when Bento went away
4584 // The back end uses the return value to either continue conversion or
4585 // to stop converting.
4588 RoamMenuWindow::ConvertStatusCB(
4595 RoamMenuWindow *rmw = (RoamMenuWindow *)client_data;
4597 // Return 0 if the conversion is still to proceed.
4598 // Return 1 if the conversion is to stop (e.g., if the user
4599 // has interrupted it...)
4601 return(rmw->showConversionStatus(current, total));
4605 RoamMenuWindow::showConversionStatus(
4611 int num_already_converted; // num msgs already converted as set prev.
4612 int previously_complete; // percent of converted msgs as set prev.
4613 int now_complete; // percent of converted messages based on parameters
4615 // Remember, the number set may differ from the previous call to
4616 // this method. We are not doing set_convert_data() for every call
4617 // to this method and so, what's set will differ from the previous
4618 // call to this method...
4620 num_already_converted = _convertContainerCmd->get_num_converted();
4621 previously_complete = num_already_converted * 100 / total;
4623 now_complete = current * 100 / total;
4625 if ((now_complete > (previously_complete + 5)) ||
4626 (now_complete == 100)) {
4627 str = GETMSG(DT_catd, 1, 79, "Converting... %d percent complete");
4628 // Estimate 4 characters for numbers and 1 null terminator.
4629 buf = new char[strlen(str) + 5];
4630 sprintf(buf, str, now_complete);
4632 _convertContainerCmd->updateDialog(buf);
4635 _convertContainerCmd->set_convert_data(current, total);
4638 _convertContainerCmd->updateAnimation();
4641 // Check and see if the user had interrupted the conversion
4642 // If the user had interrupted, we need to stop the back-end
4645 if (_convertContainerCmd->interrupted()) {
4655 RoamMenuWindow::conversionFinishedCallback(
4656 RoamInterruptibleCmd *,
4657 Boolean interrupted,
4662 // Do something only it the conversion really finished.
4663 // If it was interrupted, just return...
4666 RoamMenuWindow *rmw = (RoamMenuWindow *) clientData;
4667 rmw->conversionFinished();
4671 // If the conversion finished successfully, then we try to open() again
4672 // and if no problems, load the headers into the scrolling list...
4675 RoamMenuWindow::conversionFinished()
4677 DtMailEnv mail_error;
4679 // Initialize the mail_error.
4682 mailboxFullpath(_convertContainerCmd->get_destination_name());
4684 this->open(mail_error,
4685 _openContainerCmd->_open_create_flag,
4686 _openContainerCmd->_open_lock_flag);
4688 // if the user had cancelled the open, then the RMW will not have
4689 // its mailbox set. Do not proceed to load the mailbox. Return.
4691 // Ideally, open() should set the mail_error if the user cancels
4692 // the open. And we should check the mail_error here...
4694 if (mail_error.isSet()) {
4698 this->load_mailbox(mail_error);
4700 if (mail_error.isSet()) {
4702 // Post a dialog indicating problems in loading...
4708 // Post the dialog displaying the error text.
4709 // Also display the minor_code, if resource/environment variable
4711 // User has no choice but to OK
4712 // postErrorDialog() is the benign uncle of postFatalErrorDialog() --
4713 // it does not quit the RMW.
4716 RoamMenuWindow::postErrorDialog(
4717 DtMailEnv &mail_error
4722 const char *text_str = (const char *)mail_error;
4724 // Assume that the char *text that comes in has already
4725 // been processed for i18n.
4727 _genDialog->setToErrorDialog(GETMSG(DT_catd, 2, 13, "Mailer"),
4730 helpId = DTMAILHELPERROR;
4731 int i = _genDialog->post_and_return(GETMSG(DT_catd, 3, 31, "OK"), helpId);
4740 RoamMenuWindow::manage()
4742 Dimension win_x, win_y, win_wid, win_ht, win_bwid;
4744 MainWindow::manage();
4745 XmUpdateDisplay(this->baseWidget());
4746 // Obtain the current dimensions of the RMW
4753 XmNborderWidth, &win_bwid,
4760 _border_width = win_bwid;
4765 RoamMenuWindow::expunge(void)
4770 // First order of business - busy out active windows
4772 theRoamApp.busyAllWindows(
4773 GETMSG(DT_catd, 3, 32, "Destroying deleted messages..."));
4775 // Before changing the state of any deleted/undeleted lists,
4776 // perform the destroy deleted operation and make sure that
4777 // it was successful - if there was an error, notify the user
4778 // and discontinue processing
4780 _mailbox->expunge(error);
4781 if((DTMailError_t) error == DTME_OutOfSpace )
4784 ShowErrMsg((char *)error.getClient(),FALSE,(void *)this );
4785 error.setClient(NULL);
4787 theRoamApp.unbusyAllWindows();
4791 if (error.isSet()) {
4792 // An error happened - must inform the user
4794 postErrorDialog(error);
4798 if (_msg_undelete_from_list->dialog())
4799 _msg_undelete_from_list->dialog()->expunge();
4804 // Last order of business - unbusy out active windows
4806 theRoamApp.unbusyAllWindows();
4810 RoamMenuWindow::attachment_selected()
4812 _att_save->activate();
4817 RoamMenuWindow::all_attachments_selected()
4819 _att_save->deactivate();
4821 if (_attActions_cmdlist != NULL) {
4822 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
4823 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
4824 _attActions_cmdlist);
4825 delete _attActions_cmdlist;
4826 _attActions_cmdlist = NULL;
4831 RoamMenuWindow::all_attachments_deselected()
4833 _att_save->deactivate();
4835 if (_attActions_cmdlist != NULL) {
4836 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
4837 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
4838 _attActions_cmdlist);
4839 delete _attActions_cmdlist;
4840 _attActions_cmdlist = NULL;
4845 RoamMenuWindow::activate_default_message_menu()
4848 _msg_open->activate();
4850 _msg_save_as->activate();
4852 XtSetSensitive(_copyto_cmdlist->getPaneWidget(), TRUE);
4854 _msg_print->activate();
4856 _msg_delete->activate();
4861 RoamMenuWindow::deactivate_default_message_menu()
4864 _msg_open->deactivate();
4866 _msg_save_as->deactivate();
4868 XtSetSensitive(_copyto_cmdlist->getPaneWidget(), FALSE);
4870 _msg_print->deactivate();
4872 _msg_delete->deactivate();
4877 RoamMenuWindow::activate_default_attach_menu()
4879 _att_select_all->activate();
4883 RoamMenuWindow::deactivate_default_attach_menu()
4885 _att_select_all->deactivate();
4889 RoamMenuWindow::newMailIndicators(void)
4891 // Set to new mail icon only if the window is iconified
4892 if (this->isIconified()) {
4893 setIconName(NewMailIcon);
4896 if ((_we_called_newmail == FALSE) || (this->isIconified())){
4898 // See if we are supposed to ring the bell.
4901 const char * val = NULL;
4902 DtMail::Session * m_session = theRoamApp.session()->session();
4903 m_session->mailRc(error)->getValue(error, "flash", &val);
4904 if (error.isNotSet()) {
4905 int flashes = (int) strtol(val, NULL, 10);
4912 m_session->mailRc(error)->getValue(error, "bell", &val);
4913 if (error.isNotSet()) {
4914 int beeps = (int) strtol(val, NULL, 10);
4916 XBell(XtDisplay(baseWidget()), 0);
4920 else // Default to 1 beep
4921 XBell(XtDisplay(baseWidget()), 0);
4927 m_session->mailRc(error)->getValue(error, "realsound", &val);
4928 if (error.isNotSet()) {
4930 if (SafeStat("/usr/bin/audioplay", &stat) == 0) {
4931 char *play_str = new char[1500];
4932 sprintf(play_str, "/usr/bin/audioplay %s", val);
4942 _we_called_newmail = FALSE;
4946 RoamMenuWindow::save_attachment_callback(
4952 RoamMenuWindow *obj = (RoamMenuWindow *) client_data;
4953 obj->save_selected_attachment(selection);
4957 RoamMenuWindow::save_selected_attachment(
4961 DtMailEnv mail_error;
4963 // Initialize the mail_error.
4966 DtMailEditor *editor = this->get_editor();
4967 AttachArea *attacharea = editor->attachArea();
4968 Attachment *attachment = attacharea->getSelectedAttachment();
4970 // Get selected attachment, if none selected, then return.
4971 if ( attachment == NULL ) {
4972 // Let User know that no attachment has been selected???
4974 char *helpId = NULL;
4977 _genDialog->setToErrorDialog(
4978 GETMSG(DT_catd, 1, 80, "Mailer"),
4979 GETMSG(DT_catd, 2, 14, "An attachment needs to be selected before issuing the\n\"Save As\" command to save to a file.") );
4980 helpId = DTMAILHELPSELECTATTACH;
4981 answer = _genDialog->post_and_return(
4982 GETMSG(DT_catd, 3, 33, "OK"), helpId );
4987 attachment->saveToFile(mail_error, selection);
4989 if (mail_error.isSet()) {
4996 RoamMenuWindow::addAttachmentActions(
5003 AttachmentActionCmd *attachActionCmd;
5005 if (_attActions_cmdlist == NULL) {
5006 _attActions_cmdlist = new CmdList("AttachmentActions", "AttachmentActions");
5009 _menuBar->removeCommands(_attachmentMenu, _attActions_cmdlist);
5010 _menuPopupAtt->removeCommands(_attachmentPopupMenu,
5011 _attActions_cmdlist);
5012 delete _attActions_cmdlist;
5013 _attActions_cmdlist = new CmdList("AttachmentActions", "AttachmentActions");
5017 for (i = 0; i < indx; i++) {
5018 anAction = actions[i];
5020 // Retrieve the localized action label
5021 actionLabel = DtActionLabel(anAction);
5022 attachActionCmd = new AttachmentActionCmd(
5027 _attActions_cmdlist->add(attachActionCmd);
5030 _attachmentMenu = _menuBar->addCommands(
5034 _attachmentPopupMenu = _menuPopupAtt->addCommands(
5035 _attachmentPopupMenu,
5041 RoamMenuWindow::removeAttachmentActions()
5044 // Stubbed out for now
5048 RoamMenuWindow::invokeAttachmentAction(
5053 DtMailEditor *editor = this->get_editor();
5054 AttachArea *attacharea = editor->attachArea();
5055 Attachment *attachment = attacharea->getSelectedAttachment();
5057 attachment->invokeAction(index);
5062 RoamMenuWindow::selectAllAttachments()
5065 DtMailEditor *editor = this->get_editor();
5066 AttachArea *attachArea = editor->attachArea();
5068 attachArea->selectAllAttachments();
5072 // Returns the index of the match, -1 if there is no match.
5074 RoamMenuWindow::inList(char *filename, DtVirtArray<ContainerMenuCmd *> *list)
5076 ContainerMenuCmd *cmd;
5078 if (list == NULL) return(-1);
5087 DtMail::Session * d_session = theRoamApp.session()->session();
5089 DtMail::MailRc * mailrc = d_session->mailRc(error);
5090 const char *value = NULL;
5093 mailrc->getValue(error, "folder", &value);
5094 if (error.isNotSet())
5096 newname = (char*)malloc(strlen(filename) + strlen(value) + 2);
5097 sprintf(newname, "%s/%s", value, filename);
5098 for (int i=0; i < list->length(); i++)
5101 if (strcmp(newname, cmd->containerName()) == 0) {
5106 free((void*) newname);
5110 free((void*) value);
5113 for (int i=0; i < list->length(); i++)
5116 if (strcmp(filename, cmd->containerName()) == 0)
5124 RoamMenuWindow::addToCachedContainerList(char *filename)
5127 ContainerMenuCmd *null_container, *open_container;
5128 ContainerMenuCmd *move_container, *copy_container;
5131 if (filename != NULL &&
5132 *filename != '\0' &&
5133 (_max_cached_list_size > 0))
5135 DtMail::Session *d_session = theRoamApp.session()->session();
5136 DtMailObjectSpace space;
5137 DtMailEnv mail_error;
5139 char *mail_file = NULL;
5141 // Is the file in the user defined list?
5142 if ((index = inList(filename, _user_containerlist)) != -1)
5145 d_session->queryImpl(
5147 d_session->getDefaultImpl(mail_error),
5148 DtMailCapabilityInboxName,
5152 is_inbox = (0 == strcmp(mail_file, filename));
5153 free((void*) mail_file);
5157 // Is the file in the recently used list?
5158 if ((index = inList(filename, _cached_containerlist)) != -1)
5160 // Move filename to top of list and move everything else down.
5161 if (index == 0) return;
5164 // Change the filenames that each of the Cmds points to in both
5165 // the move and copy cached lists.
5167 name = (*_cached_containerlist)[index]->containerName();
5169 for (i = index; i > 0; i--) {
5170 char *s = (*_cached_containerlist)[i-1]->containerName();
5172 (*_cached_containerlist)[i]->changeContainer(s);
5173 (*_open_container_containerlist_cached)[i]->changeContainer(s);
5174 (*_copyto_containerlist_cached)[i]->changeContainer(s);
5175 (*_move_containerlist_cached)[i]->changeContainer(s);
5178 (*_cached_containerlist)[0]->changeContainer(name);
5179 (*_open_container_containerlist_cached)[0]->changeContainer(name);
5180 (*_copyto_containerlist_cached)[0]->changeContainer(name);
5181 (*_move_containerlist_cached)[0]->changeContainer(name);
5184 // Rename the labels in the menu.
5186 if (_first_cached_item != _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);
5200 _menuBar->rotateLabels(
5203 _first_cached_item + index);
5208 // Add filename to Recently Used List.
5209 int cached_list_size = _cached_containerlist->length();
5211 // Is there room for the menu to grow?
5212 if (cached_list_size < _max_cached_list_size)
5214 // Create the new command.
5215 null_container = new ContainerMenuCmd(strdup(filename),
5220 open_container = new ContainerMenuCmd(strdup(filename),
5225 copy_container = new ContainerMenuCmd(strdup(filename),
5230 move_container = new ContainerMenuCmd(strdup(filename),
5236 // Add it to the end of the arrays.
5237 _cached_containerlist->append(null_container);
5238 _open_container_containerlist_cached->append(open_container);
5239 _copyto_containerlist_cached->append(copy_container);
5240 _move_containerlist_cached->append(move_container);
5242 // Add it to the end of the menus.
5243 _menuBar->addCommand(_opencontainerMenu, open_container);
5244 _menuBar->addCommand(_copytoMenu, copy_container);
5245 _menuBar->addCommand(_moveMenu, move_container);
5246 _menuBar->addCommand(_msgsPopupMoveMenu, move_container);
5248 // Recursively call addToCachedContainerList to rotate to top.
5249 cached_list_size = _cached_containerlist->length();
5250 if (cached_list_size > 1)
5251 addToCachedContainerList(filename);
5255 // Add new entry to the bottom of the cache.
5256 int i = cached_list_size-1;
5259 // Replace the end of the arrays.
5260 (*_cached_containerlist)[i]->changeContainer(strdup(s));
5261 (*_open_container_containerlist_cached)[i]->changeContainer(
5263 (*_copyto_containerlist_cached)[i]->changeContainer(strdup(s));
5264 (*_move_containerlist_cached)[i]->changeContainer(strdup(s));
5266 // Replace the end of the menus.
5267 i += _first_cached_item;
5268 _menuBar->changeLabel(_opencontainerMenu, i, s);
5269 _menuBar->changeLabel(_copytoMenu, i, s);
5270 _menuBar->changeLabel(_moveMenu, i, s);
5271 _menuBar->changeLabel(_msgsPopupMoveMenu, i, s);
5273 // Recursively call addToCachedContainerList to rotate to top.
5274 if (_first_cached_item != i)
5275 addToCachedContainerList(filename);
5282 RoamMenuWindow::showAttachArea()
5284 DtMailEditor *editor = this->get_editor();
5285 editor->showAttachArea();
5289 RoamMenuWindow::hideAttachArea()
5291 DtMailEditor *editor = this->get_editor();
5292 editor->hideAttachArea();
5296 RoamMenuWindow::fullHeader(
5300 DtMailMessageHandle msgHandle;
5301 DtMailEnv mail_error;
5303 // Initialize the mail_error.
5306 _full_header_resource = state;
5308 msgHandle = this->list()->current_msg_handle();
5310 this->list()->display_message(mail_error, msgHandle);
5316 RoamMenuWindow::postMsgsPopup(XEvent *event)
5318 XmMenuPosition(_msgsPopupMenu, (XButtonEvent *)event);
5319 XtManageChild(_msgsPopupMenu);
5323 RoamMenuWindow::MenuButtonHandler(
5329 RoamMenuWindow *obj = (RoamMenuWindow *)cd;
5331 if(event->xany.type != ButtonPress)
5334 XButtonEvent *be = (XButtonEvent *)event;
5336 if(be->button == theApplication->bMenuButton())
5337 obj->postMsgsPopup(event);
5341 RoamMenuWindow::attachmentFeedback(
5349 this->normalCursor();
5353 // map_menu is used to figure out how many columns to split the menu
5354 // into. It is a callback that is called when the menu is mapped.
5355 // If the menu is over half the height of the screen, it figures out
5356 // how many columns to make the menu, and sets its XmNnumColumns
5357 // attribute to that value. It calculates the maximum number of columns
5358 // that would fit and never goes beyond that number.
5361 RoamMenuWindow::map_menu(
5368 short maxcols, newcols, columns;
5369 int screenheight = HeightOfScreen(XtScreen(menu));
5370 int fudgefact = 20; /* to allow for decorations on menu */
5376 XmNnumColumns, &columns,
5380 if ((int) (h + fudgefact) > ((int) screenheight / 2)) {
5382 /* the menu is taller than half the screen. We need to find out how
5383 many more columns to specify for the menu to make it fit. */
5385 newcols = (columns * (int) ((int) (h + fudgefact)/(int) (screenheight/2))) + 1;
5386 maxcols = WidthOfScreen(XtScreen(menu))/(int) ((int)w/(int)columns);
5388 if (newcols > maxcols)
5391 XtVaSetValues(menu, XmNnumColumns, newcols, NULL);
5400 RoamMenuWindow::setTitle(char *suffix)
5402 DtMailEnv mail_error;
5403 MailSession *ses = theRoamApp.session();
5404 DtMail::Session *d_session = ses->session();
5405 char *prefix = GETMSG(DT_catd, 1, 6, "Mailer");
5411 if (mailbox_fullpath())
5412 path = d_session->getRelativePath(mail_error, mailbox_fullpath());
5413 else if (mailboxName())
5414 path = d_session->getRelativePath(mail_error, mailboxName());
5415 else path = strdup("UNTITLED");
5419 format = "%s - %s [%s]";
5420 len = strlen(format) + strlen(prefix) + strlen(path) + strlen(suffix);
5421 new_title = new char[len];
5422 sprintf(new_title, format, prefix, path, suffix);
5427 len = strlen(format) + strlen(prefix) + strlen(path);
5428 new_title = new char[len];
5429 sprintf(new_title, format, prefix, path);
5433 delete [] new_title;
5438 RoamMenuWindow::setVacationTitle()
5440 // Add "[Vacation]" to the title of the roam menu window
5441 char *vacation = GETMSG(DT_catd, 1, 3, "Vacation");
5446 RoamMenuWindow::removeVacationTitle()
5448 // Reset the title on the roam menu window; take out "[Vacation]"
5453 RoamMenuWindow::ShowErrMsg(char * fsname,Boolean compose,void *client_data)
5456 assert((NULL != fsname));
5459 RoamMenuWindow * self = (RoamMenuWindow *)client_data;
5460 parent = self->GetMainWin();
5464 SendMsgDialog * self = (SendMsgDialog *)client_data;
5465 parent = self->GetMainWin();
5468 parent = theApplication->baseWidget();
5469 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog",parent,XmDIALOG_FULL_APPLICATION_MODAL);
5471 char *errMsg = (char *) XtCalloc(1,10240+strlen(fsname));
5474 // Serious error here -- No Space on Filesystem --
5475 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);
5477 genDialog->setToErrorDialog(
5478 GETMSG(DT_catd, 1, 6, "Mailer"),
5482 genDialog->post_and_return(
5483 GETMSG(DT_catd, 3, 9, "OK"),
5488 RoamMenuWindow::stopAutoSave(void)
5491 _mailbox->startAutoSave(error,DTM_FALSE);
5494 RoamMenuWindow::startAutoSave(void)
5497 _mailbox->startAutoSave(error,DTM_TRUE);
5501 RoamMenuWindow::sync_work_area_size(void)
5503 Dimension width, height;
5505 XtVaGetValues(_workArea, XmNwidth, &width, XmNheight, &height, NULL);
5507 if (_workarea_width && _workarea_height &&
5508 (_workarea_width!=width || _workarea_height!=height))
5510 enableWorkAreaResize();
5511 XtVaSetValues(_workArea, XmNwidth, width, XmNheight, height, NULL);
5512 disableWorkAreaResize();
5514 _workarea_width = width;
5515 _workarea_height = height;