1 /***************************************************************************
3 openurl.library - universal URL display and browser launcher library
4 Copyright (C) 1998-2005 by Troels Walsted Hansen, et al.
5 Copyright (C) 2005-2013 by openurl.library Open Source Team
7 This library is free software; it has been placed in the public domain
8 and you can freely redistribute it and/or modify it. Please note, however,
9 that some components may be under the LGPL or GPL license.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 openurl.library project: http://sourceforge.net/projects/openurllib/
19 ***************************************************************************/
23 #include "gui_global.h"
27 #include <classes/window.h>
28 #include <libraries/openurl.h>
30 #include <reaction/reaction_macros.h>
32 #include <images/label.h>
33 #include <gadgets/space.h>
35 #include <gadgets/getfile.h>
37 #include <proto/dos.h>
38 #include <proto/exec.h>
39 #include <proto/label.h>
40 #include <proto/space.h>
41 #include <proto/layout.h>
42 #include <proto/window.h>
43 #include <proto/string.h>
44 #include <proto/getfile.h>
45 #include <proto/utility.h>
46 #include <proto/intuition.h>
47 #include <proto/listbrowser.h>
49 extern struct Window
*window
;
51 Object
*edit_mail_win
;
52 struct Window
*edit_mail_window
;
54 Object
* make_edit_mail_win(void)
57 WA_ScreenTitle
, getString(MSG_App_ScreenTitle
),
58 WA_Title
, getString(MSG_Mailer_WinTitle
),
64 // WINDOW_AppPort, AppPort,
65 WINDOW_SharedPort
, AppPort
,
66 WINDOW_Position
, WPOS_CENTERSCREEN
,
67 WINDOW_LockHeight
, TRUE
,
68 WINDOW_Layout
, VLayoutObject
,
69 LAYOUT_SpaceOuter
, TRUE
,
70 LAYOUT_AddChild
, OBJ(OBJ_MAIL_ALIGN1
) = VLayoutObject
,
71 LAYOUT_SpaceOuter
, TRUE
,
72 LAYOUT_BevelStyle
, BVS_GROUP
,
73 LAYOUT_Label
, getString(MSG_Edit_Definitions
),
75 LAYOUT_AddChild
, OBJ(OBJ_MAIL_NAME_STR
) = StringObject
,
76 GA_ID
, OBJ_MAIL_NAME_STR
,
79 // STRINGA_Buffer, buffer,
81 Label(getString(MSG_Edit_Name
)),
83 LAYOUT_AddChild
, HLayoutObject
,
84 LAYOUT_SpaceInner
, FALSE
,
85 LAYOUT_AddChild
, OBJ(OBJ_MAIL_PATH_GET
) = GetFileObject
,
86 GA_ID
, OBJ_MAIL_PATH_GET
,
88 // GETFILE_TitleText, "Select Path To Browser",
90 LAYOUT_AddChild
, OBJ(OBJ_MAIL_PATH_CHOOSE
) = ButtonObject
,
91 GA_ID
, OBJ_MAIL_PATH_CHOOSE
,
93 GA_Image
, &chooser_image
,
95 CHILD_WeightedWidth
, 0,
97 Label(getString(MSG_Edit_Path
)),
99 LAYOUT_AddChild
, HLayoutObject
,
100 LAYOUT_SpaceInner
, FALSE
,
101 LAYOUT_AddChild
, OBJ(OBJ_MAIL_AREXX_STR
) = StringObject
,
102 GA_ID
, OBJ_MAIL_AREXX_STR
,
105 // STRINGA_Buffer, buffer,
107 LAYOUT_AddChild
, OBJ(OBJ_MAIL_AREXX_CHOOSE
) = ButtonObject
,
108 GA_ID
, OBJ_MAIL_AREXX_CHOOSE
,
110 GA_Image
, &chooser_image
,
112 CHILD_WeightedWidth
, 0,
114 Label(getString(MSG_Edit_Port
)), // space before `ARexx` to give a better look
118 LAYOUT_AddChild
, OBJ(OBJ_MAIL_ALIGN2
) = VLayoutObject
,
119 LAYOUT_SpaceOuter
, TRUE
,
120 LAYOUT_BevelStyle
, BVS_GROUP
,
121 LAYOUT_Label
, getString(MSG_Edit_ARexx
),
123 LAYOUT_AddChild
, OBJ(OBJ_MAIL_SHOW_STR
) = StringObject
,
124 GA_ID
, OBJ_MAIL_SHOW_STR
,
127 // STRINGA_Buffer, buffer,
129 Label(getString(MSG_Edit_Show
)),
131 LAYOUT_AddChild
, OBJ(OBJ_MAIL_FRONT_STR
) = StringObject
,
132 GA_ID
, OBJ_MAIL_FRONT_STR
,
135 // STRINGA_Buffer, buffer,
137 Label(getString(MSG_Edit_Screen
)),
139 LAYOUT_AddChild
, HLayoutObject
,
140 LAYOUT_SpaceInner
, FALSE
,
141 LAYOUT_AddChild
, OBJ(OBJ_MAIL_WRITE_STR
) = StringObject
,
142 GA_ID
, OBJ_MAIL_WRITE_STR
,
145 // STRINGA_Buffer, buffer,
147 LAYOUT_AddChild
, OBJ(OBJ_MAIL_WRITE_CHOOSE
) = ButtonObject
,
148 GA_ID
, OBJ_MAIL_WRITE_CHOOSE
,
150 GA_Image
, &chooser_image
,
152 CHILD_WeightedWidth
, 0,
154 Label(getString(MSG_Mailer_Write
)),
158 LAYOUT_AddChild
, HLayoutObject
,
159 LAYOUT_AddChild
, SpaceObject
,
162 CHILD_WeightedWidth
, 0,
164 LAYOUT_AddChild
, HLayoutObject
,
165 LAYOUT_EvenSize
, TRUE
,
166 LAYOUT_AddChild
, Button(getString(MSG_Edit_Use
),OBJ_MAIL_USE
),
167 CHILD_WeightedWidth
, 0,
169 LAYOUT_AddChild
, Button(getString(MSG_Edit_Cancel
),OBJ_MAIL_CANCEL
),
170 CHILD_WeightedWidth
, 0,
173 LAYOUT_AddChild
, SpaceObject
,
176 CHILD_WeightedWidth
, 0,
178 CHILD_MinWidth
, 300, // sets a more attractive size for the whole Layout
184 BOOL
updateMailerList(struct List
* list
, struct MinList PrefsMailerList
)
186 struct URL_MailerNode
* mn
= NULL
,
189 // libération de la liste
192 // ajout des nouvelles données
193 for (mn
= (struct URL_MailerNode
*)PrefsMailerList
.mlh_Head
;
194 mn
->umn_Node
.mln_Succ
;
195 mn
= (struct URL_MailerNode
*)mn
->umn_Node
.mln_Succ
)
197 if((newNode
= (struct URL_MailerNode
*)IListBrowser
->AllocListBrowserNode(3,
198 LBNA_NodeSize
, sizeof(struct URL_MailerNode
),
200 LBNA_Checked
, isFlagClear(mn
->umn_Flags
, UNF_DISABLED
),
207 IExec
->CopyMem(mn
, newNode
, sizeof(struct URL_MailerNode
));
208 IListBrowser
->SetListBrowserNodeAttrs((struct Node
*)newNode
, LBNA_Column
, 1,
209 LBNCA_Text
, newNode
->umn_Name
,
211 LBNCA_Text
, newNode
->umn_Path
,
214 IExec
->AddTail(list
, (struct Node
*)newNode
);
218 IDOS
->Printf(" AllocListBrowserNode() failed\n");
226 void updateMailerWindow(struct URL_MailerNode
* pMailer
)
230 iset(edit_mail_win
, WINDOW_UserData
, pMailer
);
231 gadset(GAD(OBJ_MAIL_NAME_STR
), edit_mail_window
, STRINGA_TextVal
, pMailer
->umn_Name
);
232 gadset(GAD(OBJ_MAIL_PATH_GET
), edit_mail_window
, GETFILE_File
, pMailer
->umn_Path
);
233 gadset(GAD(OBJ_MAIL_AREXX_STR
), edit_mail_window
, STRINGA_TextVal
, pMailer
->umn_Port
);
234 gadset(GAD(OBJ_MAIL_SHOW_STR
), edit_mail_window
, STRINGA_TextVal
, pMailer
->umn_ShowCmd
);
235 gadset(GAD(OBJ_MAIL_FRONT_STR
), edit_mail_window
, STRINGA_TextVal
, pMailer
->umn_ToFrontCmd
);
236 gadset(GAD(OBJ_MAIL_WRITE_STR
), edit_mail_window
, STRINGA_TextVal
, pMailer
->umn_WriteMailCmd
);
240 void updateMailerNode()
242 struct URL_MailerNode
*pMailer
;
244 if((pMailer
= (struct URL_MailerNode
*)iget(edit_mail_win
, WINDOW_UserData
)) != NULL
)
248 strValue
= (STRPTR
)iget(GAD(OBJ_MAIL_NAME_STR
), STRINGA_TextVal
);
249 IUtility
->Strlcpy(pMailer
->umn_Name
, strValue
, sizeof(pMailer
->umn_Name
));
250 strValue
= (STRPTR
)iget(GAD(OBJ_MAIL_PATH_GET
), STRINGA_TextVal
);
251 IUtility
->Strlcpy(pMailer
->umn_Path
, strValue
, sizeof(pMailer
->umn_Path
));
252 strValue
= (STRPTR
)iget(GAD(OBJ_MAIL_AREXX_STR
), STRINGA_TextVal
);
253 IUtility
->Strlcpy(pMailer
->umn_Port
, strValue
, sizeof(pMailer
->umn_Port
));
254 strValue
= (STRPTR
)iget(GAD(OBJ_MAIL_SHOW_STR
), STRINGA_TextVal
);
255 IUtility
->Strlcpy(pMailer
->umn_ShowCmd
, strValue
, sizeof(pMailer
->umn_ShowCmd
));
256 strValue
= (STRPTR
)iget(GAD(OBJ_MAIL_FRONT_STR
), STRINGA_TextVal
);
257 IUtility
->Strlcpy(pMailer
->umn_ToFrontCmd
, strValue
, sizeof(pMailer
->umn_ToFrontCmd
));
258 strValue
= (STRPTR
)iget(GAD(OBJ_MAIL_WRITE_STR
), STRINGA_TextVal
);
259 IUtility
->Strlcpy(pMailer
->umn_WriteMailCmd
, strValue
, sizeof(pMailer
->umn_WriteMailCmd
));
261 // now update the ListBrowser attributes
262 IListBrowser
->SetListBrowserNodeAttrs((struct Node
*)pMailer
, LBNA_Column
, 1,
263 LBNCA_Text
, pMailer
->umn_Name
,
265 LBNCA_Text
, pMailer
->umn_Path
,