Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
4db8257a
Commit
4db8257a
authored
May 14, 2006
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* first implementation of a widget-free authentication-dialogue (core and OSX only, refs #553)
parent
4e0d4c98
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
40 deletions
+81
-40
extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib
...acOSX/Resources/English.lproj/Interaction.nib/classes.nib
+10
-1
extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib
...s/MacOSX/Resources/English.lproj/Interaction.nib/info.nib
+3
-3
extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib
.../Resources/English.lproj/Interaction.nib/keyedobjects.nib
+0
-0
include/vlc_interaction.h
include/vlc_interaction.h
+10
-6
modules/access/http.c
modules/access/http.c
+3
-2
modules/gui/macosx/interaction.h
modules/gui/macosx/interaction.h
+12
-0
modules/gui/macosx/interaction.m
modules/gui/macosx/interaction.m
+34
-0
src/interface/interaction.c
src/interface/interaction.c
+9
-28
No files found.
extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib
View file @
4db8257a
...
@@ -2,10 +2,19 @@
...
@@ -2,10 +2,19 @@
IBClasses = (
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
{
ACTIONS = {cancelAndClose = id; };
ACTIONS = {cancelAndClose = id;
okayAndClose = id;
};
CLASS = VLCInteraction;
CLASS = VLCInteraction;
LANGUAGE = ObjC;
LANGUAGE = ObjC;
OUTLETS = {
OUTLETS = {
"o_auth_cancel_btn" = id;
"o_auth_description" = id;
"o_auth_login_fld" = id;
"o_auth_login_txt" = id;
"o_auth_ok_btn" = id;
"o_auth_pw_fld" = id;
"o_auth_pw_txt" = id;
"o_auth_title" = id;
"o_auth_win" = id;
"o_prog_bar" = id;
"o_prog_bar" = id;
"o_prog_cancel_btn" = id;
"o_prog_cancel_btn" = id;
"o_prog_description" = id;
"o_prog_description" = id;
...
...
extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib
View file @
4db8257a
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
<plist
version=
"1.0"
>
<plist
version=
"1.0"
>
<dict>
<dict>
<key>
IBDocumentLocation
</key>
<key>
IBDocumentLocation
</key>
<string>
103 27
356 240 0 0 1440 878
</string>
<string>
97 142
356 240 0 0 1440 878
</string>
<key>
IBFramework Version
</key>
<key>
IBFramework Version
</key>
<string>
443.0
</string>
<string>
443.0
</string>
<key>
IBOpenObjects
</key>
<key>
IBOpenObjects
</key>
<array>
<array>
<integer>
5
</integer>
<integer>
5
5
</integer>
</array>
</array>
<key>
IBSystem Version
</key>
<key>
IBSystem Version
</key>
<string>
8
H14
</string>
<string>
8
I127
</string>
</dict>
</dict>
</plist>
</plist>
extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib
View file @
4db8257a
No preview for this file type
include/vlc_interaction.h
View file @
4db8257a
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* $Id$
* $Id$
*
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Authors: Clément Stenac <zorglub@videolan.org>
* Felix Kühne <fkuehne@videolan.org>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -52,6 +53,8 @@ struct interaction_dialog_t
...
@@ -52,6 +53,8 @@ struct interaction_dialog_t
char
*
psz_title
;
///< Title
char
*
psz_title
;
///< Title
char
*
psz_description
;
///< Descriptor string
char
*
psz_description
;
///< Descriptor string
char
*
psz_returned
[
1
];
///< returned responses from the user
int
i_widgets
;
///< Number of dialog widgets
int
i_widgets
;
///< Number of dialog widgets
user_widget_t
**
pp_widgets
;
///< Dialog widgets
user_widget_t
**
pp_widgets
;
///< Dialog widgets
...
@@ -76,6 +79,7 @@ struct interaction_dialog_t
...
@@ -76,6 +79,7 @@ struct interaction_dialog_t
#define DIALOG_YES_NO_CANCEL 0x04
#define DIALOG_YES_NO_CANCEL 0x04
#define DIALOG_CLEAR_NOSHOW 0x08
#define DIALOG_CLEAR_NOSHOW 0x08
#define DIALOG_GOT_ANSWER 0x10
#define DIALOG_GOT_ANSWER 0x10
#define DIALOG_LOGIN_PW_OK_CANCEL 0x20
/**
/**
* Possible return codes
* Possible return codes
...
...
modules/access/http.c
View file @
4db8257a
...
@@ -290,8 +290,9 @@ connect:
...
@@ -290,8 +290,9 @@ connect:
char
*
psz_login
=
NULL
;
char
*
psz_password
=
NULL
;
char
*
psz_login
=
NULL
;
char
*
psz_password
=
NULL
;
int
i_ret
;
int
i_ret
;
msg_Dbg
(
p_access
,
"authentication failed"
);
msg_Dbg
(
p_access
,
"authentication failed"
);
i_ret
=
intf_UserLoginPassword
(
p_access
,
"HTTP authentication"
,
i_ret
=
intf_UserLoginPassword
(
p_access
,
_
(
"HTTP authentication"
),
"Please enter a valid login and password."
,
&
psz_login
,
&
psz_password
);
_
(
"Please enter a valid login name and a password."
),
&
psz_login
,
&
psz_password
);
if
(
i_ret
==
DIALOG_OK_YES
)
if
(
i_ret
==
DIALOG_OK_YES
)
{
{
msg_Dbg
(
p_access
,
"retrying with user=%s, pwd=%s"
,
msg_Dbg
(
p_access
,
"retrying with user=%s, pwd=%s"
,
...
...
modules/gui/macosx/interaction.h
View file @
4db8257a
...
@@ -38,12 +38,24 @@
...
@@ -38,12 +38,24 @@
IBOutlet
id
o_prog_title
;
IBOutlet
id
o_prog_title
;
IBOutlet
id
o_prog_win
;
IBOutlet
id
o_prog_win
;
/* authentication dialogue */
IBOutlet
id
o_auth_cancel_btn
;
IBOutlet
id
o_auth_description
;
IBOutlet
id
o_auth_login_fld
;
IBOutlet
id
o_auth_login_txt
;
IBOutlet
id
o_auth_ok_btn
;
IBOutlet
id
o_auth_pw_fld
;
IBOutlet
id
o_auth_pw_txt
;
IBOutlet
id
o_auth_title
;
IBOutlet
id
o_auth_win
;
interaction_dialog_t
*
p_dialog
;
interaction_dialog_t
*
p_dialog
;
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
BOOL
nib_interact_loaded
;
BOOL
nib_interact_loaded
;
}
}
-
(
IBAction
)
cancelAndClose
:(
id
)
sender
;
-
(
IBAction
)
cancelAndClose
:(
id
)
sender
;
-
(
IBAction
)
okayAndClose
:(
id
)
sender
;
-
(
id
)
initDialog
:
(
interaction_dialog_t
*
)
_p_dialog
;
-
(
id
)
initDialog
:
(
interaction_dialog_t
*
)
_p_dialog
;
-
(
void
)
runDialog
;
-
(
void
)
runDialog
;
...
...
modules/gui/macosx/interaction.m
View file @
4db8257a
...
@@ -120,6 +120,10 @@
...
@@ -120,6 +120,10 @@
nib_interact_loaded
=
[
NSBundle
loadNibNamed
:
@"Interaction"
owner
:
self
];
nib_interact_loaded
=
[
NSBundle
loadNibNamed
:
@"Interaction"
owner
:
self
];
[
o_prog_cancel_btn
setTitle
:
_NS
(
"Cancel"
)];
[
o_prog_cancel_btn
setTitle
:
_NS
(
"Cancel"
)];
[
o_prog_bar
setUsesThreadedAnimation
:
YES
];
[
o_prog_bar
setUsesThreadedAnimation
:
YES
];
[
o_auth_login_txt
setStringValue
:
_NS
(
"Login:"
)];
[
o_auth_pw_txt
setStringValue
:
_NS
(
"Password:"
)];
[
o_auth_cancel_btn
setTitle
:
_NS
(
"Cancel"
)];
[
o_auth_ok_btn
setTitle
:
_NS
(
"OK"
)];
}
}
NSString
*
o_title
=
[
NSString
stringWithUTF8String
:
p_dialog
->
psz_title
?
p_dialog
->
psz_title
:
"title"
];
NSString
*
o_title
=
[
NSString
stringWithUTF8String
:
p_dialog
->
psz_title
?
p_dialog
->
psz_title
:
"title"
];
...
@@ -177,6 +181,17 @@
...
@@ -177,6 +181,17 @@
o_window
,
self
,
@selector
(
sheetDidEnd
:
returnCode
:
contextInfo
:
),
\
o_window
,
self
,
@selector
(
sheetDidEnd
:
returnCode
:
contextInfo
:
),
\
NULL
,
nil
,
o_description
);
NULL
,
nil
,
o_description
);
}
}
else
if
(
p_dialog
->
i_flags
&
DIALOG_LOGIN_PW_OK_CANCEL
)
{
msg_Dbg
(
p_intf
,
"requested flag: DIALOG_LOGIN_PW_OK_CANCEL"
);
[
o_auth_title
setStringValue
:
o_title
];
[
o_auth_description
setStringValue
:
o_description
];
[
o_auth_login_fld
setStringValue
:
@""
];
[
o_auth_pw_fld
setStringValue
:
@""
];
[
NSApp
beginSheet
:
o_auth_win
modalForWindow
:
o_window
\
modalDelegate
:
self
didEndSelector
:
nil
contextInfo
:
nil
];
[
o_auth_win
makeKeyWindow
];
}
else
if
(
p_dialog
->
i_type
&
WIDGET_PROGRESS
)
else
if
(
p_dialog
->
i_type
&
WIDGET_PROGRESS
)
{
{
msg_Dbg
(
p_intf
,
"requested type: WIDGET_PROGRESS"
);
msg_Dbg
(
p_intf
,
"requested type: WIDGET_PROGRESS"
);
...
@@ -244,6 +259,11 @@
...
@@ -244,6 +259,11 @@
[
NSApp
endSheet
:
o_prog_win
];
[
NSApp
endSheet
:
o_prog_win
];
[
o_prog_win
close
];
[
o_prog_win
close
];
}
}
if
(
p_dialog
->
i_flags
&
DIALOG_LOGIN_PW_OK_CANCEL
)
{
[
NSApp
endSheet
:
o_auth_win
];
[
o_auth_win
close
];
}
}
}
-
(
void
)
destroyDialog
-
(
void
)
destroyDialog
...
@@ -261,4 +281,18 @@
...
@@ -261,4 +281,18 @@
msg_Dbg
(
p_intf
,
"dialog cancelled"
);
msg_Dbg
(
p_intf
,
"dialog cancelled"
);
}
}
-
(
IBAction
)
okayAndClose
:(
id
)
sender
{
msg_Dbg
(
p_intf
,
"dialog's okay btn pressed, returning values"
);
vlc_mutex_lock
(
&
p_dialog
->
p_interaction
->
object_lock
);
if
(
p_dialog
->
i_flags
==
DIALOG_LOGIN_PW_OK_CANCEL
)
{
p_dialog
->
psz_returned
[
0
]
=
strdup
(
[[
o_auth_login_fld
stringValue
]
UTF8String
]
);
p_dialog
->
psz_returned
[
1
]
=
strdup
(
[[
o_auth_pw_fld
stringValue
]
UTF8String
]
);
}
p_dialog
->
i_return
=
DIALOG_OK_YES
;
p_dialog
->
i_status
=
ANSWERED_DIALOG
;
vlc_mutex_unlock
(
&
p_dialog
->
p_interaction
->
object_lock
);
}
@end
@end
src/interface/interaction.c
View file @
4db8257a
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* $Id$
* $Id$
*
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Authors: Clément Stenac <zorglub@videolan.org>
* Felix Kühne <fkuehne@videolan.org>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -406,47 +407,24 @@ int __intf_UserLoginPassword( vlc_object_t *p_this,
...
@@ -406,47 +407,24 @@ int __intf_UserLoginPassword( vlc_object_t *p_this,
char
**
ppsz_login
,
char
**
ppsz_login
,
char
**
ppsz_password
)
char
**
ppsz_password
)
{
{
int
i_ret
;
int
i_ret
;
interaction_dialog_t
*
p_new
=
NULL
;
interaction_dialog_t
*
p_new
=
NULL
;
user_widget_t
*
p_widget
=
NULL
;
INTERACT_INIT
(
p_new
);
INTERACT_INIT
(
p_new
);
p_new
->
i_type
=
INTERACT_DIALOG_TWOWAY
;
p_new
->
i_type
=
INTERACT_DIALOG_TWOWAY
;
p_new
->
psz_title
=
strdup
(
psz_title
);
p_new
->
psz_title
=
strdup
(
psz_title
);
p_new
->
psz_description
=
strdup
(
psz_description
);
/* Text */
p_new
->
i_flags
=
DIALOG_LOGIN_PW_OK_CANCEL
;
p_widget
=
(
user_widget_t
*
)
malloc
(
sizeof
(
user_widget_t
)
);
p_widget
->
i_type
=
WIDGET_TEXT
;
p_widget
->
psz_text
=
strdup
(
psz_description
);
p_widget
->
val
.
psz_string
=
NULL
;
INSERT_ELEM
(
p_new
->
pp_widgets
,
p_new
->
i_widgets
,
p_new
->
i_widgets
,
p_widget
);
/* Login */
p_widget
=
(
user_widget_t
*
)
malloc
(
sizeof
(
user_widget_t
)
);
p_widget
->
i_type
=
WIDGET_INPUT_TEXT
;
p_widget
->
psz_text
=
strdup
(
_
(
"Login"
)
);
p_widget
->
val
.
psz_string
=
NULL
;
INSERT_ELEM
(
p_new
->
pp_widgets
,
p_new
->
i_widgets
,
p_new
->
i_widgets
,
p_widget
);
/* Password */
p_widget
=
(
user_widget_t
*
)
malloc
(
sizeof
(
user_widget_t
)
);
p_widget
->
i_type
=
WIDGET_INPUT_TEXT
;
p_widget
->
psz_text
=
strdup
(
_
(
"Password"
)
);
p_widget
->
val
.
psz_string
=
NULL
;
INSERT_ELEM
(
p_new
->
pp_widgets
,
p_new
->
i_widgets
,
p_new
->
i_widgets
,
p_widget
);
p_new
->
i_flags
=
DIALOG_OK_CANCEL
;
i_ret
=
intf_Interact
(
p_this
,
p_new
);
i_ret
=
intf_Interact
(
p_this
,
p_new
);
if
(
i_ret
!=
DIALOG_CANCELLED
)
if
(
i_ret
!=
DIALOG_CANCELLED
)
{
{
*
ppsz_login
=
strdup
(
p_new
->
p
p_widgets
[
1
]
->
val
.
psz_string
);
*
ppsz_login
=
strdup
(
p_new
->
p
sz_returned
[
0
]
);
*
ppsz_password
=
strdup
(
p_new
->
p
p_widgets
[
2
]
->
val
.
psz_string
);
*
ppsz_password
=
strdup
(
p_new
->
p
sz_returned
[
1
]
);
}
}
return
i_ret
;
return
i_ret
;
}
}
...
@@ -672,5 +650,8 @@ static void intf_InteractionDialogDestroy( interaction_dialog_t *p_dialog )
...
@@ -672,5 +650,8 @@ static void intf_InteractionDialogDestroy( interaction_dialog_t *p_dialog )
FREE
(
p_dialog
->
psz_title
);
FREE
(
p_dialog
->
psz_title
);
FREE
(
p_dialog
->
psz_description
);
FREE
(
p_dialog
->
psz_description
);
FREE
(
p_dialog
->
psz_returned
[
0
]
);
FREE
(
p_dialog
->
psz_returned
[
1
]
);
free
(
p_dialog
);
free
(
p_dialog
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment