-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathResultsWindowController.m
executable file
·102 lines (81 loc) · 2.42 KB
/
ResultsWindowController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// ResultsWindowController.m
// KnockKnock
//
// Created by Patrick Wardle on 2/6/15.
// Copyright (c) 2015 Objective-See, LLC. All rights reserved.
//
#import "Utilities.h"
#import "AppDelegate.h"
#import "ResultsWindowController.h"
@implementation ResultsWindowController
@synthesize details;
@synthesize detailsLabel;
//automatically called when nib is loaded
// ->center window
-(void)awakeFromNib
{
//center
[self.window center];
}
//initialize window
-(void)windowDidLoad
{
//super
[super windowDidLoad];
//not in dark mode?
// make window white
if(YES != isDarkMode())
{
//make white
self.window.backgroundColor = NSColor.whiteColor;
}
//set details
self.detailsLabel.stringValue = self.details;
//set VT results
if(nil != self.vtDetails)
{
//set
self.vtDetailsLabel.stringValue = self.vtDetails;
//line spacing
setLineSpacing(self.vtDetailsLabel, 5.0);
//show/hide 'unknown items' button
self.submitToVT.hidden = !(self.unknownItems.count);
}
//no VT results
// disabled? something else?
else
{
//disabled
if(YES == ((AppDelegate*)[[NSApplication sharedApplication] delegate]).prefsWindowController.disableVTQueries)
{
self.vtDetailsLabel.stringValue = NSLocalizedString(@"VirusTotal Results: N/A (Disabled)", @"VirusTotal Results: N/A (Disabled)");
}
//?
else
{
self.vtDetailsLabel.stringValue = @"VirusTotal: Error(?)";
}
}
return;
}
//show 'unknown items' window
-(IBAction)viewUnknownItems:(id)sender
{
//make normal
[self.window setLevel:NSNormalWindowLevel];
//alloc/init unknown items
self.unknownItemsWindowController = [[UnknownItemsWindowController alloc] initWithWindowNibName:@"UnknownItems"];
//set unknown items
self.unknownItemsWindowController.items = self.unknownItems;
//show it
[self.unknownItemsWindowController showWindow:self];
//center
[self.unknownItemsWindowController.window center];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (100 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
//and make it first responder
[self.unknownItemsWindowController.window makeFirstResponder:self.unknownItemsWindowController.submit];
});
return;
}
@end