]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/DNSServiceBrowser/Windows/Sources/LoginDialog.cpp
mDNSResponder-107.6.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / DNSServiceBrowser / Windows / Sources / LoginDialog.cpp
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16
17 Change History (most recent first):
18
19 $Log: LoginDialog.cpp,v $
20 Revision 1.2 2006/08/14 23:25:49 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
22
23 Revision 1.1 2004/06/18 04:04:36 rpantos
24 Move up one level
25
26 Revision 1.2 2004/01/30 02:56:32 bradley
27 Updated to support full Unicode display. Added support for all services on www.dns-sd.org.
28
29 Revision 1.1 2003/12/25 03:47:28 bradley
30 Login dialog to get the username/password from the user.
31
32 */
33
34 #include <assert.h>
35 #include <stdlib.h>
36
37 #include "stdafx.h"
38
39 #include "LoginDialog.h"
40
41 #ifdef _DEBUG
42 #define new DEBUG_NEW
43 #undef THIS_FILE
44 static char THIS_FILE[] = __FILE__;
45 #endif
46
47 //===========================================================================================================================
48 // Message Map
49 //===========================================================================================================================
50
51 BEGIN_MESSAGE_MAP( LoginDialog, CDialog )
52 END_MESSAGE_MAP()
53
54 //===========================================================================================================================
55 // LoginDialog
56 //===========================================================================================================================
57
58 LoginDialog::LoginDialog( CWnd *inParent )
59 : CDialog( LoginDialog::IDD, inParent )
60 {
61 //
62 }
63
64 //===========================================================================================================================
65 // OnInitDialog
66 //===========================================================================================================================
67
68 BOOL LoginDialog::OnInitDialog( void )
69 {
70 CDialog::OnInitDialog();
71 return( TRUE );
72 }
73
74 //===========================================================================================================================
75 // DoDataExchange
76 //===========================================================================================================================
77
78 void LoginDialog::DoDataExchange( CDataExchange *inDX )
79 {
80 CDialog::DoDataExchange( inDX );
81 }
82
83 //===========================================================================================================================
84 // OnOK
85 //===========================================================================================================================
86
87 void LoginDialog::OnOK( void )
88 {
89 const CWnd * control;
90
91 // Username
92
93 control = GetDlgItem( IDC_LOGIN_USERNAME_TEXT );
94 assert( control );
95 if( control )
96 {
97 control->GetWindowText( mUsername );
98 }
99
100 // Password
101
102 control = GetDlgItem( IDC_LOGIN_PASSWORD_TEXT );
103 assert( control );
104 if( control )
105 {
106 control->GetWindowText( mPassword );
107 }
108
109 CDialog::OnOK();
110 }
111
112 //===========================================================================================================================
113 // GetLogin
114 //===========================================================================================================================
115
116 BOOL LoginDialog::GetLogin( CString &outUsername, CString &outPassword )
117 {
118 if( DoModal() == IDOK )
119 {
120 outUsername = mUsername;
121 outPassword = mPassword;
122 return( TRUE );
123 }
124 return( FALSE );
125 }