Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

457 lines
14 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /*****************************************************************/
  5. /*
  6. * sharecrt.hxx
  7. * Contains the following classes related to creating a new share.
  8. * ADD_SHARE_DIALOG_BASE
  9. * FILEMGR_NEW_SHARE_DIALOG
  10. * SVRMGR_NEW_SHARE_DIALOG
  11. * SVRMGR_SHARE_PROP_DIALOG
  12. *
  13. * FILEMGR_SHARE_PROP_DIALOG
  14. *
  15. * FILEMGR_NEW_SHARE_GROUP
  16. * SVRMGR_NEW_SHARE_GROUP
  17. *
  18. * History:
  19. * Yi-HsinS 1/6/92 Created
  20. * Yi-HsinS 3/12/92 Added CREATE_SHARE_GROUP
  21. * Yi-HsinS 4/2/92 Added MayRun
  22. * Yi-HsinS 8/3/92 Modified the whole hierarchy to
  23. * match Winball share dialogs.
  24. *
  25. */
  26. #ifndef _SHARECRT_HXX_
  27. #define _SHARECRT_HXX_
  28. #include "sharebas.hxx"
  29. /*************************************************************************
  30. NAME: ADD_SHARE_DIALOG_BASE
  31. SYNOPSIS: This is the base dialog for dialogs involved in creating
  32. new shares. It contains an SLE for share names.
  33. INTERFACE: ADD_SHARE_DIALOG_BASE() - Constructor
  34. ~ADD_SHARE_DIALOG_BASE() - Destructor
  35. QueryShare() - Query the share name in the SLE
  36. SetShare() - Set the share name in the SLE
  37. QuerySLEShare() - Return the pointer to the SLE
  38. QueryServer2() - Return the SERVER_WITH_PASSWORD_PROMPT object
  39. QueryPathErrorMsg() - Return the error message to be popped up
  40. when the user entered an invalid path.
  41. Since different dialogs accepts different
  42. kinds of path in the dialog, we need this
  43. virtual method to get the right error
  44. message to display.
  45. PARENT: SHARE_DIALOG_BASE
  46. USES: SLE
  47. CAVEATS:
  48. NOTES:
  49. HISTORY:
  50. Yi-HsinS 8/6/92 Created
  51. **************************************************************************/
  52. class ADD_SHARE_DIALOG_BASE: public SHARE_DIALOG_BASE
  53. {
  54. private:
  55. SLE _sleShare;
  56. protected:
  57. //
  58. // Helper method for adding a new share on the server.
  59. //
  60. BOOL OnAddShare( SERVER_WITH_PASSWORD_PROMPT *psvr,
  61. NLS_STR *pnlsNewShareName = NULL );
  62. //
  63. // Validate the path the user typed in the dialog and then return
  64. // the computer name/path name.
  65. //
  66. virtual APIERR GetAndValidateComputerPath(
  67. SERVER_WITH_PASSWORD_PROMPT *psvr,
  68. NLS_STR *pnlsComputer, NLS_STR *pnlsPath );
  69. public:
  70. ADD_SHARE_DIALOG_BASE( const TCHAR *pszDlgResource,
  71. HWND hwndParent,
  72. ULONG ulHelpContextBase );
  73. virtual ~ADD_SHARE_DIALOG_BASE();
  74. virtual APIERR QueryShare( NLS_STR *pnlsShare ) const
  75. { return _sleShare.QueryText( pnlsShare ); }
  76. VOID SetShare( const TCHAR *pszShare )
  77. { _sleShare.SetText( pszShare ); }
  78. SLE *QuerySLEShare( VOID )
  79. { return &_sleShare; }
  80. virtual APIERR QueryServer2( SERVER_WITH_PASSWORD_PROMPT **ppsvr ) = 0;
  81. virtual APIERR QueryPathErrorMsg( VOID );
  82. };
  83. class FILEMGR_NEW_SHARE_DIALOG; // forward definition
  84. /*************************************************************************
  85. NAME: FILEMGR_NEW_SHARE_GROUP
  86. SYNOPSIS: This group is for detecting the changes the user made to
  87. the SLE path and enable/disable or make default the push
  88. buttons accordingly.
  89. INTERFACE: FILEMGR_NEW_SHARE_GROUP() - Constructor
  90. ~FILEMGR_NEW_SHARE_GROUP() - Destructor
  91. PARENT: CONTROL_GROUP
  92. USES: SLE, ADD_SHARE_DIALOG_BASE
  93. CAVEATS:
  94. NOTES:
  95. HISTORY:
  96. Yi-HsinS 8/6/92 Created
  97. **************************************************************************/
  98. class FILEMGR_NEW_SHARE_GROUP: public CONTROL_GROUP
  99. {
  100. private:
  101. SLE *_psleShare;
  102. SLE *_pslePath;
  103. ADD_SHARE_DIALOG_BASE *_pdlg;
  104. protected:
  105. virtual APIERR OnUserAction( CONTROL_WINDOW *pcw, const CONTROL_EVENT &e );
  106. public:
  107. FILEMGR_NEW_SHARE_GROUP( ADD_SHARE_DIALOG_BASE *pdlg,
  108. SLE *psleShare,
  109. SLE *pslePath );
  110. ~FILEMGR_NEW_SHARE_GROUP();
  111. };
  112. /*************************************************************************
  113. NAME: FILEMGR_NEW_SHARE_DIALOG
  114. SYNOPSIS: This is the dialog for creating a new share in the
  115. file manager. The path can be a local path, a redirected
  116. path or a UNC path.
  117. INTERFACE: FILEMGR_NEW_SHARE_DIALOG() - Constructor
  118. ~FILEMGR_NEW_SHARE_DIALOG() - Destructor
  119. QueryServer2() - Return the SERVER_WITH_PASSWORD_PROMPT
  120. object
  121. QueryPathErrorMsg() - Return the error message to be popped up
  122. when the user entered an invalid path.
  123. PARENT: ADD_SHARE_DIALOG_BASE
  124. USES: FILEMGR_NEW_SHARE_GROUP, SERVER_WITH_PASSWORD_PROMPT
  125. CAVEATS:
  126. NOTES:
  127. HISTORY:
  128. Yi-HsinS 8/6/92 Created
  129. **************************************************************************/
  130. class FILEMGR_NEW_SHARE_DIALOG: public ADD_SHARE_DIALOG_BASE
  131. {
  132. private:
  133. FILEMGR_NEW_SHARE_GROUP _newShareGrp;
  134. SERVER_WITH_PASSWORD_PROMPT *_psvr;
  135. NLS_STR *_pnlsNewShareName;
  136. //
  137. // Helper method to set the default share path and share name in the SLEs
  138. //
  139. APIERR SetDefaults( const TCHAR *pszSelectedDir,
  140. BOOL fShowDefaultShare = TRUE );
  141. protected:
  142. virtual BOOL OnOK( VOID );
  143. virtual ULONG QueryHelpContext( VOID );
  144. //
  145. // Validate the path the user typed in the dialog and then return
  146. // the computer name/path name.
  147. //
  148. virtual APIERR GetAndValidateComputerPath(
  149. SERVER_WITH_PASSWORD_PROMPT *psvr,
  150. NLS_STR *pnlsComputer, NLS_STR *pnlsPath );
  151. public:
  152. FILEMGR_NEW_SHARE_DIALOG( HWND hwndParent,
  153. const TCHAR *pszSelectedDir,
  154. ULONG ulHelpContextBase,
  155. BOOL fShowDefaultShare = TRUE,
  156. NLS_STR *pnlsNewShareName = NULL );
  157. virtual ~FILEMGR_NEW_SHARE_DIALOG();
  158. virtual APIERR QueryServer2( SERVER_WITH_PASSWORD_PROMPT **ppsvr );
  159. virtual APIERR QueryPathErrorMsg( VOID );
  160. };
  161. class SVRMGR_NEW_SHARE_DIALOG; // forward definition
  162. /*************************************************************************
  163. NAME: SVRMGR_NEW_SHARE_GROUP
  164. SYNOPSIS: This group contains pointers to the share name SLE,
  165. the OK push button and the CANCEL push button.
  166. When the contents in the share name SLE is changed, we will
  167. set the default button to OK if the SLE is not
  168. empty, else we will set the default button to CANCEL.
  169. We will also enable the Permissions push button if
  170. share name is not empty and disable the button if the
  171. share name is empty..
  172. INTERFACE: SVRMGR_NEW_SHARE_GROUP() - Constructor
  173. ~SVRMGR_NEW_SHARE_GROUP() - Destructor
  174. PARENT: CONTROL_GROUP
  175. USES: SLE, SVRMGR_NEW_SHARE_DIALOG
  176. CAVEATS:
  177. NOTES:
  178. HISTORY:
  179. Yi-HsinS 8/6/92 Created
  180. **************************************************************************/
  181. class SVRMGR_NEW_SHARE_GROUP: public CONTROL_GROUP
  182. {
  183. private:
  184. SLE *_psleShare;
  185. SVRMGR_NEW_SHARE_DIALOG *_pdlg;
  186. protected:
  187. virtual APIERR OnUserAction( CONTROL_WINDOW *pcw, const CONTROL_EVENT &e );
  188. public:
  189. SVRMGR_NEW_SHARE_GROUP( SVRMGR_NEW_SHARE_DIALOG *pdlg, SLE *psleShare );
  190. ~SVRMGR_NEW_SHARE_GROUP();
  191. };
  192. /*************************************************************************
  193. NAME: SVRMGR_NEW_SHARE_DIALOG
  194. SYNOPSIS: This is the dialog for creating a new share in the server
  195. manager. The path SLE accepts on a local path that exist on
  196. the server of focus.
  197. INTERFACE: SVRMGR_NEW_SHARE_DIALOG() - Constructor
  198. ~SVRMGR_NEW_SHARE_DIALOG() - Destructor
  199. QueryServer2() - Return the SERVER_WITH_PASSWORD_PROMPT object
  200. PARENT: ADD_SHARE_DIALOG_BASE
  201. USES: SVRMGR_NEW_SHARE_GROUP, SERVER_WITH_PASSWORD_PROMPT
  202. CAVEATS:
  203. NOTES:
  204. HISTORY:
  205. Yi-HsinS 8/25/91 Created
  206. Yi-HsinS 1/6/92 Move all functionalities to
  207. SHARE_CREATE_BASE
  208. Yi-HsinS 8/6/92 Reorganized to match Winball
  209. **************************************************************************/
  210. class SVRMGR_NEW_SHARE_DIALOG: public ADD_SHARE_DIALOG_BASE
  211. {
  212. private:
  213. SVRMGR_NEW_SHARE_GROUP _shareGrp;
  214. SERVER_WITH_PASSWORD_PROMPT *_psvr;
  215. protected:
  216. virtual BOOL OnOK( VOID );
  217. virtual ULONG QueryHelpContext( VOID );
  218. public:
  219. SVRMGR_NEW_SHARE_DIALOG( HWND hwndParent,
  220. SERVER_WITH_PASSWORD_PROMPT *psvr,
  221. ULONG ulHelpContextBase );
  222. virtual ~SVRMGR_NEW_SHARE_DIALOG();
  223. virtual APIERR QueryServer2( SERVER_WITH_PASSWORD_PROMPT **ppsvr );
  224. };
  225. /*************************************************************************
  226. NAME: SVRMGR_SHARE_PROP_DIALOG
  227. SYNOPSIS: This is the dialog for changing share properties in the
  228. server manager. The path of the share can be changed.
  229. INTERFACE: SVRMGR_SHARE_PROP_DIALOG() - Constructor
  230. ~SVRMGR_SHARE_PROP_DIALOG() - Destructor
  231. QueryServer2() - Return the SERVER_WITH_PASSWORD_PROMPT object
  232. PARENT: ADD_SHARE_DIALOG_BASE
  233. USES: NLS_STR, SERVER_WITH_PASSWORD_PROMPT
  234. CAVEATS:
  235. NOTES:
  236. HISTORY:
  237. Yi-HsinS 8/25/91 Created
  238. Yi-HsinS 1/6/91 Move all functionalities to
  239. SHARE_CREATE_BASE
  240. Yi-HsinS 8/6/92 Reorganized to match Winball
  241. **************************************************************************/
  242. class SVRMGR_SHARE_PROP_DIALOG: public ADD_SHARE_DIALOG_BASE
  243. {
  244. private:
  245. NLS_STR _nlsStoredPath;
  246. SERVER_WITH_PASSWORD_PROMPT *_psvr;
  247. //
  248. // Flag indicating whether we have deleted the share or not.
  249. // Used for refreshing the main window if the path has changed.
  250. //
  251. BOOL _fDeleted;
  252. protected:
  253. virtual BOOL OnOK( VOID );
  254. virtual BOOL OnCancel( VOID );
  255. virtual ULONG QueryHelpContext( VOID );
  256. //
  257. // Helper method to check if the user has changed the path
  258. // of the share. If so, delete the share. We will create
  259. // one later with the same name but different path.
  260. //
  261. APIERR StopShareIfNecessary( const TCHAR *pszShare,
  262. BOOL *pfDeleteShare,
  263. BOOL *pfCancel );
  264. public:
  265. SVRMGR_SHARE_PROP_DIALOG( HWND hwndParent,
  266. SERVER_WITH_PASSWORD_PROMPT *psvr,
  267. const TCHAR *pszShare,
  268. ULONG ulHelpContextBase );
  269. virtual ~SVRMGR_SHARE_PROP_DIALOG();
  270. virtual APIERR QueryServer2( SERVER_WITH_PASSWORD_PROMPT **ppsvr );
  271. };
  272. /*************************************************************************
  273. NAME: FILEMGR_SHARE_PROP_DIALOG
  274. SYNOPSIS:
  275. INTERFACE: FILEMGR_SHARE_PROP_DIALOG() - Constructor
  276. ~FILEMGR_SHARE_PROP_DIALOG() - Destructor
  277. QueryServer2() - Return the SERVER_WITH_PASSWORD_PROMPT object
  278. QueryShare() - Query the selected share name
  279. PARENT: SHARE_DIALOG_BASE
  280. USES: COMBOBOX, NLS_STR, SERVER_WITH_PASSWORD_PROMPT
  281. CAVEATS:
  282. NOTES:
  283. HISTORY:
  284. Yi-HsinS 8/25/91 Created
  285. Yi-HsinS 1/6/91 Move all functionalities to
  286. SHARE_CREATE_BASE
  287. Yi-HsinS 8/6/92 Reorganized to match Winball
  288. **************************************************************************/
  289. class FILEMGR_SHARE_PROP_DIALOG: public SHARE_DIALOG_BASE
  290. {
  291. private:
  292. COMBOBOX _cbShare;
  293. SERVER_WITH_PASSWORD_PROMPT *_psvr;
  294. //
  295. // Store the path of shares that are displayed in the dialog
  296. //
  297. NLS_STR _nlsLocalPath;
  298. //
  299. // Flag indicating whether we should show the default share name in
  300. // the new share dialog ( when the user clicked on the new share button)
  301. //
  302. BOOL _fShowDefault;
  303. //
  304. // Flag indicating whether we have created new share or not from the
  305. // new share dialog. We use this flag to determine whether we should
  306. // ask the file manager to refresh or not.
  307. //
  308. BOOL _fCreatedShare;
  309. //
  310. // Initialize all information in the dialog
  311. //
  312. APIERR Init( const TCHAR *pszComputer );
  313. //
  314. // Refresh the shares in the combobox after creating new shares.
  315. // pszNewShareName indicates the share name to be selected as
  316. // default if the combobox contains it.
  317. //
  318. APIERR Refresh( const TCHAR *pszNewShareName = NULL );
  319. protected:
  320. virtual BOOL OnOK( VOID );
  321. virtual BOOL OnCancel( VOID );
  322. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  323. virtual ULONG QueryHelpContext( VOID );
  324. public:
  325. FILEMGR_SHARE_PROP_DIALOG( HWND hwndParent,
  326. const TCHAR *pszSelectedDir,
  327. ULONG ulHelpContextBase );
  328. virtual ~FILEMGR_SHARE_PROP_DIALOG();
  329. virtual APIERR QueryServer2( SERVER_WITH_PASSWORD_PROMPT **ppsvr );
  330. virtual APIERR QueryShare( NLS_STR *pnlsShare ) const
  331. { return _cbShare.QueryItemText( pnlsShare ); }
  332. };
  333. #endif