Parcourir la source

Fixed Prefs.xib location

Thomas Buck il y a 11 ans
Parent
révision
589d2a8eee

+ 12
- 4
RedditBar.xcodeproj/project.pbxproj Voir le fichier

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

Prefs.xib → RedditBar/Base.lproj/Prefs.xib Voir le fichier

@@ -1,6 +1,7 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 2
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
3 3
     <dependencies>
4
+        <deployment defaultVersion="1080" identifier="macosx"/>
4 5
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
5 6
     </dependencies>
6 7
     <objects>
@@ -153,7 +154,7 @@ Gw
153 154
                     <button translatesAutoresizingMaskIntoConstraints="NO" id="XZM-90-hQ8">
154 155
                         <rect key="frame" x="118" y="234" width="204" height="18"/>
155 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 158
                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
158 159
                             <font key="font" metaFont="system"/>
159 160
                         </buttonCell>

+ 33
- 5
RedditBar/PrefController.m Voir le fichier

@@ -11,6 +11,8 @@
11 11
 
12 12
 @implementation PrefController
13 13
 
14
+NSString *modhashSetLiteral = @"__MODHASH__IS__SET__";
15
+
14 16
 @synthesize username, password, subscriptions, subreddits, win, parent, state, lengthFormat, lengthField, lengthStepper, length;
15 17
 
16 18
 -(Boolean)isValidList:(NSString *)input {
@@ -27,14 +29,17 @@
27 29
     
28 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 36
     [subscriptions setState:[NSNumber numberWithBool:state.useSubsciptions].integerValue];
33 37
     [self toggleSubs:nil]; // Maybe the subreddits field needs to be editable
34 38
     
35 39
     NSMutableString *reddits = [[NSMutableString alloc] init];
36 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 44
     [subreddits setString:reddits];
40 45
     length = state.length;
@@ -43,6 +48,32 @@
43 48
 }
44 49
 
45 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 77
     Boolean subs;
47 78
     if (subscriptions.state != 0) {
48 79
         subs = TRUE;
@@ -59,9 +90,6 @@
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 93
     AppDelegate *app = (AppDelegate *)parent;
66 94
     [app prefReturnName:username.stringValue Modhash:modhash subscriptions:subs subreddits:subreddits.textStorage.string length:length];
67 95
     [win performClose:self];

+ 1
- 1
RedditBar/RedditBar-Info.plist Voir le fichier

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

+ 1
- 1
RedditBar/en.lproj/Credits.rtf Voir le fichier

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

Chargement…
Annuler
Enregistrer