Browse Source

Fixed Prefs.xib location

Thomas Buck 11 years ago
parent
commit
589d2a8eee

+ 12
- 4
RedditBar.xcodeproj/project.pbxproj View File

8
 
8
 
9
 /* Begin PBXBuildFile section */
9
 /* Begin PBXBuildFile section */
10
 		E9341914184A1A1A00D03488 /* StateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E9341913184A1A1A00D03488 /* StateModel.m */; };
10
 		E9341914184A1A1A00D03488 /* StateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E9341913184A1A1A00D03488 /* StateModel.m */; };
11
+		E934191B184A47DE00D03488 /* Prefs.xib in Resources */ = {isa = PBXBuildFile; fileRef = E9341919184A47DE00D03488 /* Prefs.xib */; };
11
 		E9CF1F21184961010004AE02 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9CF1F20184961010004AE02 /* Cocoa.framework */; };
12
 		E9CF1F21184961010004AE02 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9CF1F20184961010004AE02 /* Cocoa.framework */; };
12
 		E9CF1F2B184961010004AE02 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F29184961010004AE02 /* InfoPlist.strings */; };
13
 		E9CF1F2B184961010004AE02 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F29184961010004AE02 /* InfoPlist.strings */; };
13
 		E9CF1F2D184961010004AE02 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E9CF1F2C184961010004AE02 /* main.m */; };
14
 		E9CF1F2D184961010004AE02 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E9CF1F2C184961010004AE02 /* main.m */; };
22
 		E9CF1F561849654F0004AE02 /* icon-alt.png in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F541849654F0004AE02 /* icon-alt.png */; };
23
 		E9CF1F561849654F0004AE02 /* icon-alt.png in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F541849654F0004AE02 /* icon-alt.png */; };
23
 		E9CF1F571849654F0004AE02 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F551849654F0004AE02 /* icon.png */; };
24
 		E9CF1F571849654F0004AE02 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F551849654F0004AE02 /* icon.png */; };
24
 		E9CF1F5C1849685C0004AE02 /* PrefController.m in Sources */ = {isa = PBXBuildFile; fileRef = E9CF1F5B1849685C0004AE02 /* PrefController.m */; };
25
 		E9CF1F5C1849685C0004AE02 /* PrefController.m in Sources */ = {isa = PBXBuildFile; fileRef = E9CF1F5B1849685C0004AE02 /* PrefController.m */; };
25
-		E9CF1F5E184968DD0004AE02 /* Prefs.xib in Resources */ = {isa = PBXBuildFile; fileRef = E9CF1F5D184968DD0004AE02 /* Prefs.xib */; };
26
 /* End PBXBuildFile section */
26
 /* End PBXBuildFile section */
27
 
27
 
28
 /* Begin PBXContainerItemProxy section */
28
 /* Begin PBXContainerItemProxy section */
38
 /* Begin PBXFileReference section */
38
 /* Begin PBXFileReference section */
39
 		E9341912184A1A1A00D03488 /* StateModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StateModel.h; sourceTree = "<group>"; };
39
 		E9341912184A1A1A00D03488 /* StateModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StateModel.h; sourceTree = "<group>"; };
40
 		E9341913184A1A1A00D03488 /* StateModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StateModel.m; sourceTree = "<group>"; };
40
 		E9341913184A1A1A00D03488 /* StateModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StateModel.m; sourceTree = "<group>"; };
41
+		E934191A184A47DE00D03488 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Prefs.xib; sourceTree = "<group>"; };
41
 		E9CF1F1D184961010004AE02 /* RedditBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RedditBar.app; sourceTree = BUILT_PRODUCTS_DIR; };
42
 		E9CF1F1D184961010004AE02 /* RedditBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RedditBar.app; sourceTree = BUILT_PRODUCTS_DIR; };
42
 		E9CF1F20184961010004AE02 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
43
 		E9CF1F20184961010004AE02 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
43
 		E9CF1F23184961010004AE02 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
44
 		E9CF1F23184961010004AE02 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
61
 		E9CF1F551849654F0004AE02 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
62
 		E9CF1F551849654F0004AE02 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
62
 		E9CF1F5A1849685C0004AE02 /* PrefController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefController.h; sourceTree = "<group>"; };
63
 		E9CF1F5A1849685C0004AE02 /* PrefController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefController.h; sourceTree = "<group>"; };
63
 		E9CF1F5B1849685C0004AE02 /* PrefController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrefController.m; sourceTree = "<group>"; };
64
 		E9CF1F5B1849685C0004AE02 /* PrefController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrefController.m; sourceTree = "<group>"; };
64
-		E9CF1F5D184968DD0004AE02 /* Prefs.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Prefs.xib; path = ../Prefs.xib; sourceTree = "<group>"; };
65
 /* End PBXFileReference section */
65
 /* End PBXFileReference section */
66
 
66
 
67
 /* Begin PBXFrameworksBuildPhase section */
67
 /* Begin PBXFrameworksBuildPhase section */
134
 				E9341912184A1A1A00D03488 /* StateModel.h */,
134
 				E9341912184A1A1A00D03488 /* StateModel.h */,
135
 				E9341913184A1A1A00D03488 /* StateModel.m */,
135
 				E9341913184A1A1A00D03488 /* StateModel.m */,
136
 				E9CF1F35184961020004AE02 /* MainMenu.xib */,
136
 				E9CF1F35184961020004AE02 /* MainMenu.xib */,
137
+				E9341919184A47DE00D03488 /* Prefs.xib */,
137
 				E9CF1F5A1849685C0004AE02 /* PrefController.h */,
138
 				E9CF1F5A1849685C0004AE02 /* PrefController.h */,
138
 				E9CF1F5B1849685C0004AE02 /* PrefController.m */,
139
 				E9CF1F5B1849685C0004AE02 /* PrefController.m */,
139
-				E9CF1F5D184968DD0004AE02 /* Prefs.xib */,
140
 				E9CF1F38184961020004AE02 /* Images.xcassets */,
140
 				E9CF1F38184961020004AE02 /* Images.xcassets */,
141
 				E9CF1F27184961010004AE02 /* Supporting Files */,
141
 				E9CF1F27184961010004AE02 /* Supporting Files */,
142
 			);
142
 			);
250
 			isa = PBXResourcesBuildPhase;
250
 			isa = PBXResourcesBuildPhase;
251
 			buildActionMask = 2147483647;
251
 			buildActionMask = 2147483647;
252
 			files = (
252
 			files = (
253
-				E9CF1F5E184968DD0004AE02 /* Prefs.xib in Resources */,
254
 				E9CF1F2B184961010004AE02 /* InfoPlist.strings in Resources */,
253
 				E9CF1F2B184961010004AE02 /* InfoPlist.strings in Resources */,
255
 				E9CF1F39184961020004AE02 /* Images.xcassets in Resources */,
254
 				E9CF1F39184961020004AE02 /* Images.xcassets in Resources */,
256
 				E9CF1F571849654F0004AE02 /* icon.png in Resources */,
255
 				E9CF1F571849654F0004AE02 /* icon.png in Resources */,
257
 				E9CF1F31184961010004AE02 /* Credits.rtf in Resources */,
256
 				E9CF1F31184961010004AE02 /* Credits.rtf in Resources */,
258
 				E9CF1F37184961020004AE02 /* MainMenu.xib in Resources */,
257
 				E9CF1F37184961020004AE02 /* MainMenu.xib in Resources */,
259
 				E9CF1F561849654F0004AE02 /* icon-alt.png in Resources */,
258
 				E9CF1F561849654F0004AE02 /* icon-alt.png in Resources */,
259
+				E934191B184A47DE00D03488 /* Prefs.xib in Resources */,
260
 			);
260
 			);
261
 			runOnlyForDeploymentPostprocessing = 0;
261
 			runOnlyForDeploymentPostprocessing = 0;
262
 		};
262
 		};
317
 /* End PBXTargetDependency section */
317
 /* End PBXTargetDependency section */
318
 
318
 
319
 /* Begin PBXVariantGroup section */
319
 /* Begin PBXVariantGroup section */
320
+		E9341919184A47DE00D03488 /* Prefs.xib */ = {
321
+			isa = PBXVariantGroup;
322
+			children = (
323
+				E934191A184A47DE00D03488 /* Base */,
324
+			);
325
+			name = Prefs.xib;
326
+			sourceTree = "<group>";
327
+		};
320
 		E9CF1F29184961010004AE02 /* InfoPlist.strings */ = {
328
 		E9CF1F29184961010004AE02 /* InfoPlist.strings */ = {
321
 			isa = PBXVariantGroup;
329
 			isa = PBXVariantGroup;
322
 			children = (
330
 			children = (

Prefs.xib → RedditBar/Base.lproj/Prefs.xib View File

1
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
3
     <dependencies>
3
     <dependencies>
4
+        <deployment defaultVersion="1080" identifier="macosx"/>
4
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
5
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
5
     </dependencies>
6
     </dependencies>
6
     <objects>
7
     <objects>
153
                     <button translatesAutoresizingMaskIntoConstraints="NO" id="XZM-90-hQ8">
154
                     <button translatesAutoresizingMaskIntoConstraints="NO" id="XZM-90-hQ8">
154
                         <rect key="frame" x="118" y="234" width="204" height="18"/>
155
                         <rect key="frame" x="118" y="234" width="204" height="18"/>
155
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
156
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
156
-                        <buttonCell key="cell" type="check" title="Subscriptions" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="vW5-Cp-Bm1">
157
+                        <buttonCell key="cell" type="check" title="Subscriptions" bezelStyle="regularSquare" imagePosition="overlaps" alignment="right" state="on" inset="2" id="vW5-Cp-Bm1">
157
                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
158
                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
158
                             <font key="font" metaFont="system"/>
159
                             <font key="font" metaFont="system"/>
159
                         </buttonCell>
160
                         </buttonCell>

+ 33
- 5
RedditBar/PrefController.m View File

11
 
11
 
12
 @implementation PrefController
12
 @implementation PrefController
13
 
13
 
14
+NSString *modhashSetLiteral = @"__MODHASH__IS__SET__";
15
+
14
 @synthesize username, password, subscriptions, subreddits, win, parent, state, lengthFormat, lengthField, lengthStepper, length;
16
 @synthesize username, password, subscriptions, subreddits, win, parent, state, lengthFormat, lengthField, lengthStepper, length;
15
 
17
 
16
 -(Boolean)isValidList:(NSString *)input {
18
 -(Boolean)isValidList:(NSString *)input {
27
     
29
     
28
     [username setStringValue:state.username];
30
     [username setStringValue:state.username];
29
     
31
     
30
-    // TODO what to do with modhash and password field??
32
+    if (![state.modhash isEqualToString:@""]) {
33
+        [password setStringValue:modhashSetLiteral];
34
+    }
31
     
35
     
32
     [subscriptions setState:[NSNumber numberWithBool:state.useSubsciptions].integerValue];
36
     [subscriptions setState:[NSNumber numberWithBool:state.useSubsciptions].integerValue];
33
     [self toggleSubs:nil]; // Maybe the subreddits field needs to be editable
37
     [self toggleSubs:nil]; // Maybe the subreddits field needs to be editable
34
     
38
     
35
     NSMutableString *reddits = [[NSMutableString alloc] init];
39
     NSMutableString *reddits = [[NSMutableString alloc] init];
36
     for(int i = 0; i < [state.subreddits count]; i++) {
40
     for(int i = 0; i < [state.subreddits count]; i++) {
37
-        [reddits appendFormat:@"%@\n", [state.subreddits objectAtIndex:i]];
41
+        if (![[state.subreddits objectAtIndex:i] isEqualToString:@""])
42
+            [reddits appendFormat:@"%@\n", [state.subreddits objectAtIndex:i]];
38
     }
43
     }
39
     [subreddits setString:reddits];
44
     [subreddits setString:reddits];
40
     length = state.length;
45
     length = state.length;
43
 }
48
 }
44
 
49
 
45
 -(IBAction)buttonSave:(id)sender {
50
 -(IBAction)buttonSave:(id)sender {
51
+    if ([username.stringValue isEqualToString:@""]) {
52
+        NSAlert *alert = [[NSAlert alloc] init];
53
+        [alert addButtonWithTitle:@"OK"];
54
+        [alert setMessageText:@"Authentication Error"];
55
+        [alert setInformativeText:@"Please enter a username!"];
56
+        [alert setAlertStyle:NSCriticalAlertStyle];
57
+        [alert beginSheetModalForWindow:win modalDelegate:nil didEndSelector:nil contextInfo:nil];
58
+        return;
59
+    }
60
+    
61
+    if ([state.modhash isEqualToString:@""] && [password.stringValue isEqualToString:@""]) {
62
+        NSAlert *alert = [[NSAlert alloc] init];
63
+        [alert addButtonWithTitle:@"OK"];
64
+        [alert setMessageText:@"Authentication Error"];
65
+        [alert setInformativeText:@"Please enter a password!"];
66
+        [alert setAlertStyle:NSCriticalAlertStyle];
67
+        [alert beginSheetModalForWindow:win modalDelegate:nil didEndSelector:nil contextInfo:nil];
68
+        return;
69
+    }
70
+    
71
+    NSString *modhash = state.modhash;
72
+    if (![password.stringValue isEqualToString:modhashSetLiteral]) {
73
+        // TODO reauthenticate & get modhash from reddit
74
+        
75
+    }
76
+    
46
     Boolean subs;
77
     Boolean subs;
47
     if (subscriptions.state != 0) {
78
     if (subscriptions.state != 0) {
48
         subs = TRUE;
79
         subs = TRUE;
59
         }
90
         }
60
     }
91
     }
61
     
92
     
62
-    // TODO if username / password changed, get modhash! Else, use the one we got from init
63
-    NSString *modhash;
64
-    
65
     AppDelegate *app = (AppDelegate *)parent;
93
     AppDelegate *app = (AppDelegate *)parent;
66
     [app prefReturnName:username.stringValue Modhash:modhash subscriptions:subs subreddits:subreddits.textStorage.string length:length];
94
     [app prefReturnName:username.stringValue Modhash:modhash subscriptions:subs subreddits:subreddits.textStorage.string length:length];
67
     [win performClose:self];
95
     [win performClose:self];

+ 1
- 1
RedditBar/RedditBar-Info.plist View File

21
 	<key>CFBundleSignature</key>
21
 	<key>CFBundleSignature</key>
22
 	<string>????</string>
22
 	<string>????</string>
23
 	<key>CFBundleVersion</key>
23
 	<key>CFBundleVersion</key>
24
-	<string>30</string>
24
+	<string>42</string>
25
 	<key>LSApplicationCategoryType</key>
25
 	<key>LSApplicationCategoryType</key>
26
 	<string>public.app-category.utilities</string>
26
 	<string>public.app-category.utilities</string>
27
 	<key>LSMinimumSystemVersion</key>
27
 	<key>LSMinimumSystemVersion</key>

+ 1
- 1
RedditBar/en.lproj/Credits.rtf View File

7
 \f0\b\fs24 \cf0 Made by:
7
 \f0\b\fs24 \cf0 Made by:
8
 \b0 \
8
 \b0 \
9
 	Thomas Buck\
9
 	Thomas Buck\
10
-	<xythobuz@xythobuz.de>\
10
+	<{\field{\*\fldinst{HYPERLINK "mailto:xythobuz@xythobuz.de"}}{\fldrslt xythobuz@xythobuz.de}}>\
11
 \
11
 \
12
 
12
 
13
 \b Website:
13
 \b Website:

Loading…
Cancel
Save