2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * $TOG: AttachCmds.C /main/8 1999/07/02 14:33:38 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 Sun Microsystems, Inc. All rights reserved.
44 #include <Xm/FileSB.h>
45 #include <Xm/SelectioB.h>
46 #include <Xm/MessageB.h>
50 #if defined(USL) || defined(__uxp__)
51 #define S_ISSOCK(mode) ((mode & S_IFMT) == S_IFSOCK)
53 #include <sys/types.h>
58 #include "Application.h"
59 #include "AttachArea.h"
60 #include "Attachment.h"
62 #include "AttachCmds.h"
63 #include "InfoDialogManager.h"
65 #include "QuestionDialogManager.h"
66 #endif /* DEAD_WOOD */
67 #include "RoamMenuWindow.h"
68 #include <DtMail/DtMailError.hh>
69 #include <DtMail/DtMail.hh>
71 #include "ViewMsgDialog.h"
76 extern XtPointer _XmStringUngenerate (
80 XmTextType output_type);
83 extern nl_catd DtMailMsgCat;
85 static void okcb(XtPointer);
87 AttachAddCmd::AttachAddCmd ( AttachArea *attachArea,
92 int active ) : Cmd ( name, label, active )
95 _attachArea = attachArea;
96 _clipWindow = clipWindow;
101 void AttachAddCmd::doit()
108 fsdialog = _attachArea->getFsDialog();
109 if(fsdialog == NULL) {
110 fsdialog = XmCreateFileSelectionDialog(_parent, "fsdialog", NULL, 0);
112 XmFileSelectionBoxGetChild(fsdialog, XmDIALOG_HELP_BUTTON));
113 XtVaSetValues(XmFileSelectionBoxGetChild(fsdialog, XmDIALOG_LIST),
114 XmNselectionPolicy, XmBROWSE_SELECT,
116 pwd = getpwuid(getuid());
118 XtVaSetValues(fsdialog,
119 XtVaTypedArg, XmNdirectory, XtRString,
120 home, strlen(home)+1,
122 _attachArea->setFsDialog(fsdialog);
123 XtAddCallback(fsdialog, XmNcancelCallback,
124 &AttachAddCmd::cancelCallback,
127 fsstate = _attachArea->getFsState();
130 case ADD: // Do nothing
134 XtRemoveAllCallbacks(fsdialog, XmNokCallback);
138 XtAddCallback(fsdialog, XmNokCallback,
139 &AttachAddCmd::okCallback,
143 XtVaSetValues(XtParent(fsdialog),
144 XmNtitle, GETMSG(DT_catd, 14, 1, "Add Attachment"),
146 XtManageChild(fsdialog);
148 XtVaSetValues(fsdialog,
149 XmNfileTypeMask, XmFILE_REGULAR,
151 _attachArea->setFsState(ADD);
152 _attachArea->activateDeactivate();
153 XRaiseWindow(XtDisplay(fsdialog), XtWindow(XtParent(fsdialog)) );
156 void AttachAddCmd::undoit()
158 // Just print a message that allows us to trace the execution
162 void AttachAddCmd::okCallback ( Widget w, XtPointer clientData, XtPointer callData )
164 AttachAddCmd *obj = (AttachAddCmd *) clientData;
166 obj->ok( w, callData );
167 //XtUnmanageChild( w );
170 void AttachAddCmd::ok( Widget , XtPointer callData )
172 XmFileSelectionBoxCallbackStruct *cbs =
173 (XmFileSelectionBoxCallbackStruct *)callData;
175 XmStringTable string_table;
178 XtVaGetValues(XmFileSelectionBoxGetChild(_attachArea->getFsDialog(),
180 XmNselectedItems, &string_table,
181 XmNselectedItemCount, &count,
186 filename = (char *) _XmStringUngenerate(
188 XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
189 if (NULL == filename) return; // internal error
192 for(i=0;i<count;i++) {
194 filename = (char *) _XmStringUngenerate(
195 string_table[i], NULL,
196 XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
197 if (NULL == filename) return; // internal error
204 void AttachAddCmd::add_file( char *filename )
208 // ExecState executable;
209 Boolean validtype = TRUE;
210 char *errormsg = new char[512];
212 if(stat(filename, &s) == -1) {
214 GETMSG(DT_catd, 14, 2, "Unable to open %s"),
218 // theInfoDialogManager->post(
226 if(S_ISFIFO(s.st_mode)) {
228 GETMSG(DT_catd, 14, 3,
229 "Cannot attach FIFO files: %s"), filename
232 } else if(S_ISCHR(s.st_mode)) {
234 GETMSG(DT_catd, 14, 4,
235 "Cannot attach character special files: %s"), filename
238 } else if(S_ISDIR(s.st_mode)) {
240 GETMSG(DT_catd, 14, 5,
241 "Cannot attach directories: %s"), filename
244 } else if(S_ISBLK(s.st_mode)) {
246 GETMSG(DT_catd, 14, 6,
247 "Cannot attach block special files: %s"), filename
250 } else if(S_ISSOCK(s.st_mode)) {
252 GETMSG(DT_catd, 14, 7,
253 "Cannot attach socket files: %s"), filename
257 if(validtype == FALSE) {
258 // theInfoDialogManager->post(
266 fd = open(filename, O_RDONLY);
269 GETMSG(DT_catd, 14, 8,
270 "Unable to open %s"),filename
273 // theInfoDialogManager->post(
281 // We open and close this file just to make sure that we can
282 // The attachment constructor must have a valid, openable, file
286 // Attachment *attachment = new Attachment(
290 // attachment->setAttachArea(_attachArea);
291 // attachment->initialize();
292 // _attachArea->calcSizeOfAA();
294 // // Call CalcAttachmentPosition() before adding the attachment
295 // // to the list so that we can successfully find the last attachment
297 // _attachArea->CalcAttachmentPosition(attachment);
298 // _attachArea->addToList( attachment );
300 _attachArea->CalcLastRow();
301 _attachArea->AdjustCurrentRow();
302 _attachArea->SetScrollBarSize(_attachArea->getLastRow()+1);
303 _attachArea->DisplayAttachmentsInRow(_attachArea->getCurrentRow());
307 void AttachAddCmd::cancelCallback ( Widget, XtPointer clientData, XtPointer callData )
309 AttachAddCmd *obj = (AttachAddCmd *) clientData;
311 obj->cancel( callData );
314 void AttachAddCmd::cancel( XtPointer )
316 Widget fsdialog = _attachArea->getFsDialog();
318 XtUnmanageChild(fsdialog);
321 AttachFetchCmd::AttachFetchCmd ( AttachArea *attachArea,
324 int active ) : Cmd ( name, label, active )
326 _attachArea = attachArea;
329 void AttachFetchCmd::doit()
332 // Attachment **list = _attachArea->getList();
334 // unsigned long size;
336 // Boolean compressed;
338 // if(_attachArea->get_mailbox()->get_disconnected() == TRUE)
340 // for(i=0;i<_attachArea->getIconCount();i++) {
341 // if(((list[i]->get_ac_state() == ROAM_AVAILABLE) ||
342 // (list[i]->get_ac_state() == ROAM_CACHED)) &&
343 // (list[i]->getIcon()->isSelected() == TRUE)) {
344 // RoamMenuWindow *rmw =
345 // (RoamMenuWindow*)_attachArea->owner()->owner();
347 // // contents = (char * ) _attachArea->get_mailbox()->get_data(
349 // // list[i]->getSection(),
354 // list[i]->set_compressed(compressed);
355 // // If contents is NULL then we were unable to get the contents
356 // if(contents == NULL) {
358 // GETMSG(DT_catd, 14, 9,
359 // "File contents unavailable: %s"),
360 // list[i]->getLabel()
362 // // theInfoDialogManager->post(
365 // // (DialogCallback)okcb);
368 // list[i]->setContents(contents);
369 // list[i]->setFilesize( size );
370 // list[i]->set_ac_state(ROAM_LOCAL);
371 // // if(list[i]->getRow() == _attachArea->getCurrentRow())
372 // // list[i]->getIcon()->expose((XtPointer)NULL);
377 void AttachFetchCmd::undoit()
379 // Just print a message that allows us to trace the execution
383 AttachDeleteCmd::AttachDeleteCmd ( AttachArea *attachArea,
386 int active ) : Cmd ( name, label, active )
388 _attachArea = attachArea;
391 void AttachDeleteCmd::doit()
394 WidgetList deleteList;
396 deleteList = (WidgetList)XtMalloc(sizeof(Widget)*_attachArea->getIconCount());
397 // Attachment **list = _attachArea->getList();
398 // for(i=0, j=0;i<_attachArea->getIconCount();i++)
399 // if(list[i]->getIcon()->isSelected() == TRUE) {
400 // deleteList[j++] = list[i]->baseWidget();
401 // list[i]->getIcon()->unselect();
402 // _attachArea->incDeleteCount();
403 // _attachArea->setAttachmentsLabel();
404 // list[i]->deleteIt();
406 // XtUnmanageChildren(deleteList, j);
407 // XtFree((char *)deleteList);
408 // _attachArea->activateDeactivate();
409 // _attachArea->CalcAllAttachmentPositions();
410 // _attachArea->CalcLastRow();
411 // _attachArea->AdjustCurrentRow();
412 // _attachArea->SetScrollBarSize(_attachArea->getLastRow()+1);
413 // _attachArea->DisplayAttachmentsInRow(_attachArea->getCurrentRow());
416 void AttachDeleteCmd::undoit()
418 // Just print a message that allows us to trace the execution
422 AttachOpenCmd::AttachOpenCmd ( AttachArea *attachArea,
425 int active ) : Cmd ( name, label, active )
427 _attachArea = attachArea;
430 void AttachOpenCmd::doit()
434 // Attachment **list = _attachArea->getList();
435 // for(i=0;i<_attachArea->getIconCount();i++)
436 // if(list[i]->getIcon()->isSelected() == TRUE) {
437 // list[i]->executeOpenMethod();
438 // // Break after finding a selected file
445 void AttachOpenCmd::undoit()
447 // Just print a message that allows us to trace the execution
451 AttachRenameCmd::AttachRenameCmd ( AttachArea *attachArea,
455 int active ) : Cmd ( name, label, active )
460 _attachArea = attachArea;
461 renameDialog = XmCreatePromptDialog(parent, "renameDialog", NULL, 0);
462 message = XmStringCreateLocalized(attachArea->getRenameMessageString());
463 XtVaSetValues(renameDialog, XmNselectionLabelString, message, NULL);
464 XmStringFree(message);
465 XtVaSetValues(XtParent(renameDialog),
466 XmNtitle, GETMSG(DT_catd, 14, 9, "Mailer - Rename Attachment"),
469 XmSelectionBoxGetChild(renameDialog, XmDIALOG_HELP_BUTTON)
471 _attachArea->setRenameDialog(renameDialog);
472 XtAddCallback(renameDialog, XmNcancelCallback,
473 &AttachRenameCmd::cancelCallback,
475 XtAddCallback(renameDialog, XmNokCallback,
476 &AttachRenameCmd::okCallback,
480 void AttachRenameCmd::doit()
484 renameDialog = _attachArea->getRenameDialog();
485 XtManageChild(renameDialog);
486 XtPopup(XtParent(renameDialog), XtGrabNone);
489 void AttachRenameCmd::undoit()
491 // Just print a message that allows us to trace the execution
495 void AttachRenameCmd::cancelCallback ( Widget, XtPointer clientData, XtPointer callData )
497 AttachRenameCmd *obj = (AttachRenameCmd *) clientData;
499 obj->cancel( callData );
502 void AttachRenameCmd::cancel( XtPointer )
504 Widget renameDialog = _attachArea->getRenameDialog();
506 XtUnmanageChild(renameDialog);
509 void AttachRenameCmd::okCallback ( Widget, XtPointer clientData, XtPointer callData )
511 AttachRenameCmd *obj = (AttachRenameCmd *) clientData;
516 void AttachRenameCmd::ok( XtPointer callData )
518 XmSelectionBoxCallbackStruct *cbs =
519 (XmSelectionBoxCallbackStruct *)callData;
522 if(_attachArea->getIconSelectedCount() != 1) {
523 // theInfoDialogManager->post(
524 // GETMSG(DT_catd, 14, 12,
525 // "Please select only one attachment to rename"),
530 // Attachment **list = _attachArea->getList();
531 // for(i=0;i<_attachArea->getIconCount();i++)
532 // if(list[i]->getIcon()->isSelected()) {
534 // label = (char *) _XmStringUngenerate(
536 // XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
537 // if (NULL == label) return; // internal error
538 // list[i]->setLabelAndCenter(label);
542 AttachDescriptionCmd::AttachDescriptionCmd ( AttachArea *attachArea,
547 : Cmd ( name, label, active )
549 Widget descriptionDialog;
552 _attachArea = attachArea;
553 descriptionDialog = XmCreatePromptDialog(parent, "descriptionDialog", NULL, 0);
554 message = XmStringCreateLocalized(attachArea->getDescriptionMessageString());
555 XtVaSetValues(descriptionDialog, XmNselectionLabelString, message, NULL);
556 XmStringFree(message);
557 XtVaSetValues(XtParent(descriptionDialog),
558 XmNtitle, GETMSG(DT_catd, 14, 10, "Description"),
560 XtUnmanageChild(XmSelectionBoxGetChild(descriptionDialog, XmDIALOG_HELP_BUTTON));
561 _attachArea->setDescriptionDialog(descriptionDialog);
562 XtAddCallback(descriptionDialog, XmNcancelCallback,
563 &AttachDescriptionCmd::cancelCallback,
565 XtAddCallback(descriptionDialog, XmNokCallback,
566 &AttachDescriptionCmd::okCallback,
570 void AttachDescriptionCmd::doit()
572 // Attachment **list = _attachArea->getList();
573 // Widget descriptionDialog;
577 // descriptionDialog = _attachArea->getDescriptionDialog();
578 // text = XmSelectionBoxGetChild(descriptionDialog, XmDIALOG_TEXT);
579 // for(i=0;i<_attachArea->getIconCount();i++) {
580 // if(list[i]->getIcon()->isSelected()) {
581 // XtVaSetValues(text,
582 // XmNvalue, list[i]->get_description() ?
583 // list[i]->get_description() : "",
588 // XtManageChild(descriptionDialog);
591 void AttachDescriptionCmd::undoit()
593 // Just print a message that allows us to trace the execution
597 void AttachDescriptionCmd::cancelCallback ( Widget, XtPointer clientData, XtPointer callData )
599 AttachDescriptionCmd *obj = (AttachDescriptionCmd *) clientData;
601 obj->cancel( callData );
604 void AttachDescriptionCmd::cancel( XtPointer )
606 Widget descriptionDialog = _attachArea->getDescriptionDialog();
608 XtUnmanageChild(descriptionDialog);
611 void AttachDescriptionCmd::okCallback ( Widget, XtPointer clientData, XtPointer callData )
613 AttachDescriptionCmd *obj = (AttachDescriptionCmd *) clientData;
618 void AttachDescriptionCmd::ok( XtPointer callData )
620 XmSelectionBoxCallbackStruct *cbs =
621 (XmSelectionBoxCallbackStruct *)callData;
624 if(_attachArea->getIconSelectedCount() != 1) {
625 // theInfoDialogManager->post(
626 // GETMSG(DT_catd, 14, 12,
627 // "Please select only one attachment to describe"),
632 // Attachment **list = _attachArea->getList();
633 // for(i=0;i<_attachArea->getIconCount();i++)
634 // if(list[i]->getIcon()->isSelected()) {
636 // label = (char *) _XmStringUngenerate(
638 // XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
639 // if (NULL == label) return; // internal error
640 // list[i]->set_description(label);
644 AttachSaveAsCmd::AttachSaveAsCmd ( AttachArea *attachArea,
649 int active ) : Cmd ( name, label, active )
651 _attachArea = attachArea;
652 _clipWindow = clipWindow;
656 void AttachSaveAsCmd::doit()
663 fsdialog = _attachArea->getFsDialog();
664 if(fsdialog == NULL) {
665 fsdialog = XmCreateFileSelectionDialog(_parent, "fsdialog", NULL, 0);
667 XmFileSelectionBoxGetChild(fsdialog, XmDIALOG_HELP_BUTTON));
668 XtVaSetValues(XmFileSelectionBoxGetChild(fsdialog, XmDIALOG_LIST),
669 XmNselectionPolicy, XmBROWSE_SELECT,
671 pwd = getpwuid(getuid());
673 XtVaSetValues(fsdialog,
674 XtVaTypedArg, XmNdirectory, XtRString,
675 home, strlen(home)+1,
677 _attachArea->setFsDialog(fsdialog);
678 XtAddCallback(fsdialog, XmNcancelCallback,
679 &AttachSaveAsCmd::cancelCallback,
683 fsstate = _attachArea->getFsState();
686 case SAVEAS: // Do nothing
690 XtRemoveAllCallbacks(fsdialog, XmNokCallback);
694 XtAddCallback(fsdialog, XmNokCallback,
695 &AttachSaveAsCmd::okCallback,
699 XtVaSetValues(XtParent(fsdialog),
700 XmNtitle, GETMSG(DT_catd, 14, 11, "Save Attachment As"),
702 XtManageChild(fsdialog);
704 XtVaSetValues(fsdialog,
705 XmNfileTypeMask, XmFILE_DIRECTORY,
707 _attachArea->setFsState(SAVEAS);
708 _attachArea->activateDeactivate();
709 XRaiseWindow( XtDisplay(fsdialog), XtWindow(XtParent(fsdialog)) );
713 void AttachSaveAsCmd::undoit()
715 // Just print a message that allows us to trace the execution
719 void AttachSaveAsCmd::okCallback ( Widget w, XtPointer clientData, XtPointer callData )
721 AttachSaveAsCmd *obj = (AttachSaveAsCmd *) clientData;
724 XtUnmanageChild( w );
727 void ConfirmCallback( XtPointer)
729 // Attachment *attachment = (Attachment *)clientData;
732 // AttachArea *attachArea = attachment->parent();
733 // String filecontents;
734 // unsigned long size;
736 // Boolean compressed;
738 // RoamMenuWindow *rmw = (RoamMenuWindow *)attachArea->owner()->owner();
740 // switch(attachment->get_ac_state()) {
743 // case ROAM_AVAILABLE:
746 // attachment->setContents(NULL);
748 // // attachArea->get_mailbox()->get_data(
750 // // attachment->getSection(),
753 // attachment->set_compressed(compressed);
754 // attachment->setFilesize( size );
755 // attachment->set_ac_state(ROAM_LOCAL);
756 // // attachment->getIcon()->expose((XtPointer)NULL);
758 // case ROAM_UNAVAILABLE:
759 // // theInfoDialogManager->post(
760 // // GETMSG(DT_catd, 14, 15, "File Contents Unavailable"),
762 // // (DialogCallback)okcb);
765 // (void)attachment->open_and_write(attachment->getSaveAsFilename());
768 void AttachSaveAsCmd::ok( XtPointer callData )
770 XmFileSelectionBoxCallbackStruct *cbs =
771 (XmFileSelectionBoxCallbackStruct *)callData;
772 char *dirname = NULL;
774 // Attachment **list = _attachArea->getList();
777 // SaveFileState sfs = OK;
779 // String completefilename;
780 // String filecontents;
781 // unsigned long size;
783 // Boolean compressed;
786 // dirname = (char *) _XmStringUngenerate(
788 // XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
789 // if (NULL == dirname) return; // internal error
791 // // If more than one attachment is selected then the selection
792 // // specification must be a directory and must already exist.
794 // //if(_attachArea->getIconSelectedCount() != 1) {
795 // // This should not be able to happen
796 // //printf("AttachSaveAsCmd::ok: getIconSelectedCount != 1. This can't happen\n");
798 // for(i=0;i<_attachArea->getIconCount();i++) {
799 // if(list[i]->getIcon()->isSelected() == TRUE) {
801 // // If a directory then keep the same file name and write to
804 // // If it is a file that does not exist then we will try to
805 // // create it (later)
807 // // If the file already exists then we must prompt the user
808 // // to see if he wants to overwrite the file.
810 // if(stat(dirname, &s) != -1) { // The file already exists
811 // // This shouldn't happen because we make the fsdialog
812 // // show directories only. However, the user could enter
813 // // the name of an existing file.
814 // if(S_ISREG(s.st_mode)) {
815 // // If the user is trying to write multiple attachments
816 // // to a single existing file then we barf!
817 // if(_attachArea->getIconSelectedCount() != 1) {
819 // GETMSG(DT_catd, 14, 16, "Cannot create"));
822 // // The file already exists
823 // completefilename = dirname;
825 // GETMSG(DT_catd, 14, 17,
826 // "File %s exists. Overwrite?"),
827 // completefilename);
830 // } else if(S_ISDIR(s.st_mode)) {
832 // sprintf(buf, "%s%s", dirname, list[i]->getLabel());
833 // completefilename = buf;
834 // if(stat(buf, &s) != -1) { // The file exists
835 // if(S_ISREG(s.st_mode)) {
837 // GETMSG(DT_catd, 14, 18,
838 // "File %s exists. Overwrite?"),
839 // completefilename);
842 // // We're trying to overwrite something other
843 // // than a regular file. FAIL!
845 // GETMSG(14, 19, "Cannot create"));
850 // // The file already exists but is not a regular file
851 // completefilename = dirname;
854 // DT_catd, 14, 20, "Cannot create %s"), completefilename);
857 // } else { // The file does not exist. Maybe the user entered
858 // // a new file name in an existing directory.
859 // completefilename = dirname;
861 // list[i]->setSaveAsFilename(strdup(completefilename));
864 // // theInfoDialogManager->post(
867 // // (DialogCallback)okcb);
870 // // theQuestionDialogManager->post(error,
871 // // (XtPointer)list[i],
872 // // ConfirmCallback,
873 // // okcb // Cancel button
877 // RoamMenuWindow *rmw =
878 // (RoamMenuWindow*)_attachArea->owner()->owner();
880 // switch(list[i]->get_ac_state()) {
884 // case ROAM_AVAILABLE:
885 // list[i]->setContents(NULL);
887 // // (char * )_attachArea->get_mailbox()->get_data(
889 // // list[i]->getSection(),
893 // list[i]->set_compressed(compressed);
894 // list[i]->setFilesize( size );
895 // list[i]->set_ac_state(ROAM_LOCAL);
896 // // list[i]->getIcon()->expose((XtPointer)NULL);
898 // case ROAM_UNAVAILABLE:
899 // // theInfoDialogManager->post(
900 // // GETMSG(DT_catd, 14. 21, "File Contents Unavailable"),
901 // // (void *)NULL, (DialogCallback)okcb);
904 // (void)list[i]->open_and_write(completefilename);
912 void AttachSaveAsCmd::cancelCallback ( Widget, XtPointer clientData, XtPointer callData )
914 AttachSaveAsCmd *obj = (AttachSaveAsCmd *) clientData;
916 obj->cancel( callData );
919 void AttachSaveAsCmd::cancel( XtPointer )
921 XtUnmanageChild(_attachArea->getFsDialog());
924 AttachSelectAllCmd::AttachSelectAllCmd ( AttachArea *attachArea,
928 : Cmd ( name, label, active )
930 _attachArea = attachArea;
933 void AttachSelectAllCmd::doit()
936 // Boolean disconnected;
938 // Attachment **list = _attachArea->getList();
939 // // disconnected = _attachArea->get_mailbox()->get_disconnected();
940 // for(i=0;i<_attachArea->getIconCount();i++) {
941 // // Select the icon if and only if it is currently:
942 // // 1) not selected, 2) not deleted, and 3) not disconnected
943 // if(list[i]->getIcon()->isSelected() == FALSE &&
944 // list[i]->isDeleted() == FALSE &&
945 // list[i]->get_ac_state() != ROAM_UNAVAILABLE) {
946 // list[i]->getIcon()->select();
951 void AttachSelectAllCmd::undoit()
953 // Just print a message that allows us to trace the execution
957 AttachUndeleteCmd::AttachUndeleteCmd ( AttachArea *attachArea,
961 : Cmd ( name, label, active )
963 _attachArea = attachArea;
966 void AttachUndeleteCmd::doit()
970 // Attachment **list = _attachArea->getList();
971 // for(i=0;i<_attachArea->getIconCount();i++)
972 // if(list[i]->isDeleted() == TRUE) {
973 // list[i]->manage();
974 // _attachArea->decDeleteCount();
975 // _attachArea->setAttachmentsLabel();
976 // list[i]->unDeleteIt();
979 // _attachArea->activateDeactivate();
980 // _attachArea->CalcAllAttachmentPositions();
981 // _attachArea->CalcLastRow();
982 // _attachArea->AdjustCurrentRow();
983 // _attachArea->SetScrollBarSize(_attachArea->getLastRow()+1);
984 // _attachArea->DisplayAttachmentsInRow(_attachArea->getCurrentRow());
987 void AttachUndeleteCmd::undoit()
989 // Just print a message that allows us to trace the execution
993 AttachUnselectAllCmd::AttachUnselectAllCmd ( AttachArea *attachArea,
997 : Cmd ( name, label, active )
999 _attachArea = attachArea;
1002 void AttachUnselectAllCmd::doit()
1006 // Attachment **list = _attachArea->getList();
1007 // for(i=0;i<_attachArea->getIconCount();i++)
1008 // if(list[i]->getIcon()->isSelected() == TRUE)
1009 // list[i]->getIcon()->unselect();
1012 void AttachUnselectAllCmd::undoit()
1014 // Just print a message that allows us to trace the execution
1018 AttachInfoCmd::AttachInfoCmd ( AttachArea *attachArea,
1022 : Cmd ( name, label, active )
1024 _attachArea = attachArea;
1025 _info_dialog = NULL;
1026 _attachInfoDialogManager = NULL;
1029 void AttachInfoCmd::doit()
1034 // ViewAttachArea *vaa = (ViewAttachArea *)_attachArea;
1037 // Attachment **list = _attachArea->getList();
1038 // for(i=0;i<_attachArea->getIconCount();i++)
1039 // if(list[i]->getIcon()->isSelected() == TRUE) {
1040 // vaa->show_info(list[i]);
1046 void AttachInfoCmd::undoit()
1048 // Just print a message that allows us to trace the execution
1052 AttachInfoCmd::~AttachInfoCmd()
1055 XtDestroyWidget(_info_dialog);
1058 static void okcb( XtPointer )
1061 // This function exists so that the OK button will appear on the
1062 // Info Dialog. It doesn't have to do anything because the dialog
1063 // automatically pops down. It is for information only.