Commits

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>

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 */