AHI: disable building of OSS sound driver
[AROS.git] / external / openurl / raPrefs / mailers.c
blob2893ec3c8227c78b5434f877d26586fe0eaca6d5
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/
17 $Id$
19 ***************************************************************************/
21 #include "mailers.h"
23 #include "gui_global.h"
24 #include "utility.h"
25 #include "macros.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)
56 return WindowObject,
57 WA_ScreenTitle, getString(MSG_App_ScreenTitle),
58 WA_Title, getString(MSG_Mailer_WinTitle),
59 WA_DragBar, TRUE,
60 WA_CloseGadget, TRUE,
61 WA_SizeGadget, TRUE,
62 WA_DepthGadget, TRUE,
63 WA_Activate, TRUE,
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,
77 GA_RelVerify, TRUE,
78 GA_TabCycle, TRUE,
79 // STRINGA_Buffer, buffer,
80 End, // String
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,
87 GA_RelVerify, TRUE,
88 // GETFILE_TitleText, "Select Path To Browser",
89 End, // GetFile
90 LAYOUT_AddChild, OBJ(OBJ_MAIL_PATH_CHOOSE) = ButtonObject,
91 GA_ID, OBJ_MAIL_PATH_CHOOSE,
92 GA_RelVerify, TRUE,
93 GA_Image, &chooser_image,
94 End, // Button
95 CHILD_WeightedWidth, 0,
96 End, // HLayout
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,
103 GA_RelVerify, TRUE,
104 GA_TabCycle, TRUE,
105 // STRINGA_Buffer, buffer,
106 End, // String
107 LAYOUT_AddChild, OBJ(OBJ_MAIL_AREXX_CHOOSE) = ButtonObject,
108 GA_ID, OBJ_MAIL_AREXX_CHOOSE,
109 GA_RelVerify, TRUE,
110 GA_Image, &chooser_image,
111 End, // Button
112 CHILD_WeightedWidth, 0,
113 End, // HLayout
114 Label(getString(MSG_Edit_Port)), // space before `ARexx` to give a better look
115 End, // VLayout
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,
125 GA_RelVerify, TRUE,
126 GA_TabCycle, TRUE,
127 // STRINGA_Buffer, buffer,
128 End, // String
129 Label(getString(MSG_Edit_Show)),
131 LAYOUT_AddChild, OBJ(OBJ_MAIL_FRONT_STR) = StringObject,
132 GA_ID, OBJ_MAIL_FRONT_STR,
133 GA_RelVerify, TRUE,
134 GA_TabCycle, TRUE,
135 // STRINGA_Buffer, buffer,
136 End, // String
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,
143 GA_RelVerify, TRUE,
144 GA_TabCycle, TRUE,
145 // STRINGA_Buffer, buffer,
146 End, // String
147 LAYOUT_AddChild, OBJ(OBJ_MAIL_WRITE_CHOOSE) = ButtonObject,
148 GA_ID, OBJ_MAIL_WRITE_CHOOSE,
149 GA_RelVerify, TRUE,
150 GA_Image, &chooser_image,
151 End, // Button
152 CHILD_WeightedWidth, 0,
153 End, // HLayout
154 Label(getString(MSG_Mailer_Write)),
156 End, // VLayout
158 LAYOUT_AddChild, HLayoutObject,
159 LAYOUT_AddChild, SpaceObject,
160 SPACE_MinWidth, 2,
161 End, // Space
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,
171 End, // HLayout
173 LAYOUT_AddChild, SpaceObject,
174 SPACE_MinWidth, 2,
175 End, // Space
176 CHILD_WeightedWidth, 0,
177 End, // HLayout
178 CHILD_MinWidth, 300, // sets a more attractive size for the whole Layout
180 End, // VLayout
181 WindowEnd;
184 BOOL updateMailerList(struct List * list, struct MinList PrefsMailerList)
186 struct URL_MailerNode * mn = NULL,
187 * newNode = NULL;
189 // libération de la liste
190 freeList(list);
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),
199 LBNA_CheckBox, TRUE,
200 LBNA_Checked, isFlagClear(mn->umn_Flags, UNF_DISABLED),
201 LBNA_Column, 1,
202 LBNCA_Text, "",
203 LBNA_Column, 2,
204 LBNCA_Text, "",
205 TAG_DONE)) != NULL)
207 IExec->CopyMem(mn, newNode, sizeof(struct URL_MailerNode));
208 IListBrowser->SetListBrowserNodeAttrs((struct Node*)newNode, LBNA_Column, 1,
209 LBNCA_Text, newNode->umn_Name,
210 LBNA_Column, 2,
211 LBNCA_Text, newNode->umn_Path,
212 TAG_END);
214 IExec->AddTail(list, (struct Node*)newNode);
216 else
218 IDOS->Printf(" AllocListBrowserNode() failed\n");
219 return(FALSE);
223 return TRUE;
226 void updateMailerWindow(struct URL_MailerNode * pMailer)
228 if(pMailer != NULL)
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)
246 STRPTR strValue;
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,
264 LBNA_Column, 2,
265 LBNCA_Text, pMailer->umn_Path,
266 TAG_END);