Anonymous avatar Anonymous committed 521ab84

Add 'Start Time' column bound to firstStartPeriod. Rename 'Time' column to 'Duration'. Sort by 'Start Time', by default. Add decimal hours and minutes to the text report.

Comments (0)

Files changed (6)

English.lproj/MyDocument.nib/classes.nib

     IBClasses = (
         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
         {CLASS = IntervalFormatter; LANGUAGE = ObjC; SUPERCLASS = NSFormatter; }, 
-        {CLASS = MyDocument; LANGUAGE = ObjC; SUPERCLASS = NSPersistentDocument; }, 
+        {
+            CLASS = MyDocument; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {tasksController = NSArrayController; }; 
+            SUPERCLASS = NSPersistentDocument; 
+        }, 
         {CLASS = NSPersistentDocument; LANGUAGE = ObjC; SUPERCLASS = NSDocument; }
     ); 
     IBVersion = 1; 

English.lproj/MyDocument.nib/info.nib

 <plist version="1.0">
 <dict>
 	<key>IBDocumentLocation</key>
-	<string>20 71 356 240 0 0 2560 1578 </string>
+	<string>10 34 356 240 0 0 1440 878 </string>
 	<key>IBFramework Version</key>
-	<string>443.0</string>
+	<string>446.1</string>
 	<key>IBOldestOS</key>
 	<integer>4</integer>
 	<key>IBOpenObjects</key>
 		<integer>5</integer>
 	</array>
 	<key>IBSystem Version</key>
-	<string>8G32</string>
+	<string>8N1037</string>
 </dict>
 </plist>
Add a comment to this file

English.lproj/MyDocument.nib/keyedobjects.nib

Binary file modified.

 #import "TaskDocumentMO.h"
 
 @interface MyDocument : NSPersistentDocument {
+    IBOutlet NSArrayController * tasksController;
 	NSTimer	*timer;
 }
 
 	return self;
 }
 
+- (void)awakeFromNib {
+    NSSortDescriptor * sd = [[NSSortDescriptor alloc] initWithKey:@"firstStartPeriod" ascending:YES];
+#if 0
+    [tasksController setSortDescriptors: [NSArray arrayWithObject: sd]];
+#else
+    // If executed immediately, an 'Unknown key in query. firstStartPeriod' exception is thrown
+    // Should this be called from a different method?
+    [tasksController performSelector: @selector(setSortDescriptors:)
+                          withObject: [NSArray arrayWithObject: sd]
+                          afterDelay: 0.0f];
+#endif
+    [sd release];
+}
+
 - (void)dealloc {
 	[timer invalidate]; [timer release]; timer = nil;
 	[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
 		[output appendFormat:@"  %@  %@\n", [IntervalFormatter format:billedTime], taskDescription ];
 	}
 	[output appendFormat:@"----------  -----------\n"];
-	[output appendFormat:@"  %@  Total Time\n", [IntervalFormatter format:totalBilledTime]];
+	[output appendFormat:@"  %@  Total Time (%.3f hours or %.3f minutes)\n",
+        [IntervalFormatter format:totalBilledTime],
+        totalBilledTime/3600, totalBilledTime/60];
+	[output appendFormat:@"%10.2f  Total Minutes\n", totalBilledTime/60];
 	NSNumberFormatter *moneyFormatter = [[[NSNumberFormatter alloc] init] autorelease]; [moneyFormatter setFormat:@"__,__0.00"];
 	
 	double dollarsPerHour = [[[self taskDocument] valueForKey:@"dollarsPerHour"] doubleValue];

TaskTracker2.xcodeproj/project.pbxproj

 		79E11D59098D414E000E8E93 /* IntervalFormatter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = IntervalFormatter.m; sourceTree = "<group>"; };
 		79E11D82098D440D000E8E93 /* nsenumerate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = nsenumerate.h; sourceTree = "<group>"; };
 		8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
-		8D15AC370486D014006FF6A4 /* TaskTracker2.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = TaskTracker2.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		8D15AC370486D014006FF6A4 /* TaskTracker2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TaskTracker2.app; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.