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: RoamApp.h /main/20 1999/07/13 08:41:18 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.
48 #include "Application.h"
49 #include "MailSession.hh"
50 #include <DtMail/DtVirtArray.hh>
54 class DtMailGenDialog;
57 class RoamApp : public Application
60 DtVirtArray<Display*> _activePrintDisplays;
62 DtMailGenDialog *_dialog;
63 Display *_errorPrintDisplay;
64 Boolean _firstSaveYourselfArrived;
67 RoamMenuWindow *_mailview;
68 Boolean _quitSilently;
70 static XtResource _resources[];
71 VacationCmd *_vacation;
73 XtWorkProcId _shutdownWorkprocID;
75 void initSession(void);
76 void openSessionFile(char *filename);
77 char *parseSessionArg(int *argc, char **argv);
78 void restoreSession(void);
79 static Boolean shutdownWorkproc(XtPointer);
80 static void smpDieCB(Widget, XtPointer, XtPointer);
81 static void smpInteractCB(Widget, XtPointer, XtPointer);
82 static void smpSaveSessionCB(Widget, XtPointer, XtPointer);
83 virtual int smpSaveSessionGlobal(void);
84 virtual void smpSaveSessionLocal(void);
88 XtIntervalId _appTimeoutId;
89 char *_default_mailbox;
90 char *_glyph_font; // Font for attchment glyph
91 char *_glyph_name; // Font for attchment glyph
92 char *_mailfiles_folder;
93 MailSession *_mail_session;
94 DtMail::Transport *_mail_transport;
96 char *_system_font; // Variable width font
97 XmFontList _system_fontlist;
99 char *_user_font; // Fixed width font
100 XmFontList _user_fontlist;
102 static void applicationTimeout ( XtPointer, XtIntervalId * );
103 static void disableGroupPrivileges(void *);
104 static void enableGroupPrivileges(void *);
105 static long lastInteractiveEventTime(void *);
106 static void setBusyState(DtMailEnv &, DtMailBusyState, void *);
107 static void showBusyState(DtMailEnv &, DtMailBusyState, void *);
108 void timeout(XtIntervalId *);
114 void busyAllWindows(const char * msg = NULL);
115 virtual const char *const
117 { return "RoamApp"; }
118 void closeAllWindows(void);
119 char *default_mailbox()
120 { return _default_mailbox; }
121 DtMail::Transport *default_transport(void)
122 { return _mail_transport; }
123 MainWindow *defaultStatusWindow();
124 int (*_default_x_error_handler)(Display*, XErrorEvent*);
125 DtMailGenDialog *genDialog();
126 Display *getErrorPrintDisplay(void)
127 { return _errorPrintDisplay; }
128 void globalAddToCachedContainerList(char*);
129 void globalPropChange(void);
130 char *glyphName(void)
131 { return _glyph_name; }
132 RoamMenuWindow *inboxWindow();
133 virtual void initialize( int *, char ** );
134 Boolean isActivePrintDisplay(Display *display)
135 { return (_activePrintDisplays.indexof(display)>=0); }
136 Cmd *mailOptions(void)
137 { return _options; };
139 { return _mailfiles_folder; }
140 RoamMenuWindow *nextRoamMenuWindow(RoamMenuWindow*);
141 void closeInactiveRoamMenuWindows(void);
142 void reopenRoamMenuWindows(void);
143 virtual void open_catalog();
144 char *optionsDialog(void)
145 { return _optionsHandle; }
146 char *print_script(){ return _print_script; }
147 Boolean quitSilently(void)
148 { return _quitSilently; }
149 Boolean quitQuickly(void)
150 { return _quitQuickly; }
151 void registerActivePrintDisplay(Display *display)
152 { _activePrintDisplays.append(display); }
153 MailSession *session(void) { return _mail_session; }
154 FILE *sessionFile(void) { return session_fp;}
155 void setErrorPrintDisplay(Display *display)
156 { _errorPrintDisplay = display; }
157 void setOptionsDialog(char *oHandle)
158 { _optionsHandle = oHandle; }
159 void setQuitSilently(void) { _quitSilently = TRUE; }
160 void setQuitQuickly(void) { _quitQuickly = TRUE; }
161 void setSession(MailSession *);
162 virtual void shutdown();
163 void checkForShutdown();
164 Boolean startVacation(Widget, Widget);
165 static void statusCallback(DtMailOperationId, DtMailEnv&, void*);
167 void unbusyAllWindows(void);
168 void unregisterActivePrintDisplay(Display *display)
169 { _activePrintDisplays.remove(display); }
170 void unsetQuitSilently(void) { _quitSilently = FALSE; }
171 void unsetQuitQuickly(void) { _quitQuickly = FALSE; }
172 VacationCmd* vacation();
175 // This method will parse a colon/space tuples that are used in
176 // the mail properties.
178 struct PropStringPair {
182 PropStringPair(void);
183 PropStringPair(const PropStringPair &);
184 ~PropStringPair(void);
187 char *formatPropPair(char * key, void * data);
188 void parsePropString(const char * input, DtVirtArray<PropStringPair *> & result);
189 char* getPropStringValue(DtVirtArray<PropStringPair *> &result, const char *value);
191 extern RoamApp theRoamApp;
193 // This variable indicates whether RoamMenuWindow is mapped or not.
194 // If a RMW is mapped, then Self_destruct will not be called by Compose
195 // if Compose was started by ToolTalk.
196 extern int dtmail_mapped;