]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/frontends/osx/strongSwan/PasswordController.m
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / frontends / osx / strongSwan / PasswordController.m
CommitLineData
dacd667c
MW
1/*
2 * Copyright (C) 2013 Martin Willi
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
dacd667c
MW
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17#import "PasswordController.h"
18
19@interface PasswordController ()
20
21@end
22
23@implementation PasswordController
24
25- (void)moveWindowToActiveSpace
26{
27 NSInteger behavior, old;
28
29 /* seems that NSWindowCollectionBehaviorMoveToActiveSpace does not work
30 * when a window is opened a second time. Fix that by changing the
31 * behavior forth and back. */
32 old = behavior = [[self window] collectionBehavior];
33 behavior &= ~NSWindowCollectionBehaviorMoveToActiveSpace;
34 behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces;
35
36 [[self window] setCollectionBehavior: behavior];
37 [[self window] setCollectionBehavior: old];
38
39 [NSApp activateIgnoringOtherApps:YES];
40}
41
42- (IBAction)confirm:(id)sender
43{
44 [NSApp stopModal];
45}
46
47- (NSString *)query
48{
49 [password setStringValue:@""];
50 [self moveWindowToActiveSpace];
51 [NSApp runModalForWindow: [self window]];
52 [[self window] orderOut: self];
53
54 return [[password stringValue] retain];
55}
56
57@end