Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble-iphoneos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2012-01-12 01:16:41 +0400
committerMikkel Krautz <mikkel@krautz.dk>2012-01-12 01:16:41 +0400
commitebd1a4cb2e37f54893b1c8ca0009b0c639651573 (patch)
tree482536b5f96ce13c4413af19a875de1a636610fc /Source/Classes/MULanServerListController.m
parente9c5a823420b29d7d91da715cb97918d2a390c7a (diff)
Remove Username from Preferences. Let users pick a username at connect-time (for LAN and Public servers).
Diffstat (limited to 'Source/Classes/MULanServerListController.m')
-rw-r--r--Source/Classes/MULanServerListController.m35
1 files changed, 26 insertions, 9 deletions
diff --git a/Source/Classes/MULanServerListController.m b/Source/Classes/MULanServerListController.m
index ed87118..4dc7904 100644
--- a/Source/Classes/MULanServerListController.m
+++ b/Source/Classes/MULanServerListController.m
@@ -45,7 +45,7 @@ static NSInteger NetServiceAlphabeticalSort(id arg1, id arg2, void *reverse) {
}
}
-@interface MULanServerListController () <NSNetServiceBrowserDelegate, NSNetServiceDelegate, UIActionSheetDelegate> {
+@interface MULanServerListController () <NSNetServiceBrowserDelegate, NSNetServiceDelegate, UIActionSheetDelegate, UIAlertViewDelegate> {
NSNetServiceBrowser *_browser;
NSMutableArray *_netServices;
}
@@ -165,14 +165,15 @@ static NSInteger NetServiceAlphabeticalSort(id arg1, id arg2, void *reverse) {
// Connect
if (index == 0) {
- NSString *userName = [[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultUserName"];
- MUConnectionController *connCtrlr = [MUConnectionController sharedController];
- [connCtrlr connetToHostname:[netService hostName]
- port:[netService port]
- withUsername:userName
- andPassword:nil
- withParentViewController:self];
- [[self tableView] deselectRowAtIndexPath:indexPath animated:YES];
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Username"
+ message:@"Please enter the username you wish to use on this server"
+ delegate:self
+ cancelButtonTitle:@"Cancel"
+ otherButtonTitles:@"Connect", nil];
+ [alert setAlertViewStyle:UIAlertViewStylePlainTextInput];
+ [alert show];
+ [alert release];
+
// Add as favourite
} else if (index == 1) {
[self presentAddAsFavouriteDialogForServer:netService];
@@ -215,5 +216,21 @@ static NSInteger NetServiceAlphabeticalSort(id arg1, id arg2, void *reverse) {
[favController release];
}
+- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
+ NSIndexPath *indexPath = [[self tableView] indexPathForSelectedRow];
+ NSNetService *netService = [_netServices objectAtIndex:[indexPath row]];
+
+ if (buttonIndex == 1) {
+ MUConnectionController *connCtrlr = [MUConnectionController sharedController];
+ [connCtrlr connetToHostname:[netService hostName]
+ port:[netService port]
+ withUsername:[[alertView textFieldAtIndex:0] text]
+ andPassword:nil
+ withParentViewController:self];
+ }
+
+ [[self tableView] deselectRowAtIndexPath:indexPath animated:YES];
+}
+
@end