4 * $TOG: RoamApp.h /main/20 1999/07/13 08:41:18 mgreess $
6 * RESTRICTED CONFIDENTIAL INFORMATION:
8 * The information in this document is subject to special
9 * restrictions in a confidential disclosure agreement between
10 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
11 * document outside HP, IBM, Sun, USL, SCO, or Univel without
12 * Sun's specific written approval. This document and all copies
13 * and derivative works thereof must be returned or destroyed at
16 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
26 #include "Application.h"
27 #include "MailSession.hh"
28 #include <DtMail/DtVirtArray.hh>
32 class DtMailGenDialog;
35 class RoamApp : public Application
38 DtVirtArray<Display*> _activePrintDisplays;
40 DtMailGenDialog *_dialog;
41 Display *_errorPrintDisplay;
42 Boolean _firstSaveYourselfArrived;
45 RoamMenuWindow *_mailview;
46 Boolean _quitSilently;
48 static XtResource _resources[];
49 VacationCmd *_vacation;
51 XtWorkProcId _shutdownWorkprocID;
53 void initSession(void);
54 void openSessionFile(char *filename);
55 char *parseSessionArg(int *argc, char **argv);
56 void restoreSession(void);
57 static Boolean shutdownWorkproc(XtPointer);
58 static void smpDieCB(Widget, XtPointer, XtPointer);
59 static void smpInteractCB(Widget, XtPointer, XtPointer);
60 static void smpSaveSessionCB(Widget, XtPointer, XtPointer);
61 virtual int smpSaveSessionGlobal(void);
62 virtual void smpSaveSessionLocal(void);
66 XtIntervalId _appTimeoutId;
67 char *_default_mailbox;
68 char *_glyph_font; // Font for attchment glyph
69 char *_glyph_name; // Font for attchment glyph
70 char *_mailfiles_folder;
71 MailSession *_mail_session;
72 DtMail::Transport *_mail_transport;
74 char *_system_font; // Variable width font
75 XmFontList _system_fontlist;
77 char *_user_font; // Fixed width font
78 XmFontList _user_fontlist;
80 static void applicationTimeout ( XtPointer, XtIntervalId * );
81 static void disableGroupPrivileges(void *);
82 static void enableGroupPrivileges(void *);
83 static long lastInteractiveEventTime(void *);
84 static void setBusyState(DtMailEnv &, DtMailBusyState, void *);
85 static void showBusyState(DtMailEnv &, DtMailBusyState, void *);
86 void timeout(XtIntervalId *);
92 void busyAllWindows(const char * msg = NULL);
93 virtual const char *const
96 void closeAllWindows(void);
97 char *default_mailbox()
98 { return _default_mailbox; }
99 DtMail::Transport *default_transport(void)
100 { return _mail_transport; }
101 MainWindow *defaultStatusWindow();
102 int (*_default_x_error_handler)(Display*, XErrorEvent*);
103 DtMailGenDialog *genDialog();
104 Display *getErrorPrintDisplay(void)
105 { return _errorPrintDisplay; }
106 void globalAddToCachedContainerList(char*);
107 void globalPropChange(void);
108 char *glyphName(void)
109 { return _glyph_name; }
110 RoamMenuWindow *inboxWindow();
111 virtual void initialize( int *, char ** );
112 Boolean isActivePrintDisplay(Display *display)
113 { return (_activePrintDisplays.indexof(display)>=0); }
114 Cmd *mailOptions(void)
115 { return _options; };
117 { return _mailfiles_folder; }
118 RoamMenuWindow *nextRoamMenuWindow(RoamMenuWindow*);
119 void closeInactiveRoamMenuWindows(void);
120 void reopenRoamMenuWindows(void);
121 virtual void open_catalog();
122 char *optionsDialog(void)
123 { return _optionsHandle; }
124 char *print_script(){ return _print_script; }
125 Boolean quitSilently(void)
126 { return _quitSilently; }
127 Boolean quitQuickly(void)
128 { return _quitQuickly; }
129 void registerActivePrintDisplay(Display *display)
130 { _activePrintDisplays.append(display); }
131 MailSession *session(void) { return _mail_session; }
132 FILE *sessionFile(void) { return session_fp;}
133 void setErrorPrintDisplay(Display *display)
134 { _errorPrintDisplay = display; }
135 void setOptionsDialog(char *oHandle)
136 { _optionsHandle = oHandle; }
137 void setQuitSilently(void) { _quitSilently = TRUE; }
138 void setQuitQuickly(void) { _quitQuickly = TRUE; }
139 void setSession(MailSession *);
140 virtual void shutdown();
141 void checkForShutdown();
142 Boolean startVacation(Widget, Widget);
143 static void statusCallback(DtMailOperationId, DtMailEnv&, void*);
145 void unbusyAllWindows(void);
146 void unregisterActivePrintDisplay(Display *display)
147 { _activePrintDisplays.remove(display); }
148 void unsetQuitSilently(void) { _quitSilently = FALSE; }
149 void unsetQuitQuickly(void) { _quitQuickly = FALSE; }
150 VacationCmd* vacation();
153 // This method will parse a colon/space tuples that are used in
154 // the mail properties.
156 struct PropStringPair {
160 PropStringPair(void);
161 PropStringPair(const PropStringPair &);
162 ~PropStringPair(void);
165 char *formatPropPair(char * key, void * data);
166 void parsePropString(const char * input, DtVirtArray<PropStringPair *> & result);
167 char* getPropStringValue(DtVirtArray<PropStringPair *> &result, const char *value);
169 extern RoamApp theRoamApp;
171 // This variable indicates whether RoamMenuWindow is mapped or not.
172 // If a RMW is mapped, then Self_destruct will not be called by Compose
173 // if Compose was started by ToolTalk.
174 extern int dtmail_mapped;