Clean print job names, modification dates for logs

This commit is contained in:
Matthias Neeracher 2015-03-16 16:02:09 +01:00 committed by Matthias Neeracher
parent d3894153fa
commit da0fb55ae0
2 changed files with 12 additions and 8 deletions

View File

@ -111,12 +111,6 @@ class ASLogNode : ASFileNode {
override func nodeName() -> String {
return "📜 "+name
}
override func modDate() -> NSDate? {
let url = NSURL(fileURLWithPath: path)
var date: AnyObject?
url?.getResourceValue(&date, forKey: NSURLContentModificationDateKey, error: nil)
return date as? NSDate
}
}
class ASFileGroup : ASFileNode {

View File

@ -293,7 +293,17 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
NSThread.detachNewThreadSelector(didPrintSelector, toTarget: del, withObject: contextInfo as? AnyObject)
}
}
if let logNode = mainEditor as? ASLogNode {
let url = fileURL!.URLByDeletingLastPathComponent?.URLByAppendingPathComponent(logNode.path)
var modified : AnyObject?
if url?.getResourceValue(&modified, forKey:NSURLAttributeModificationDateKey, error:nil) != nil {
printModDate = modified as? NSDate
} else {
printModDate = nil
}
} else {
printModDate = mainEditor?.modDate()
}
printRevision = mainEditor?.revision()
printShowPanel = showPrintPanel
@ -330,7 +340,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
}
func startPrintOperation(printOp: NSPrintOperation) {
printOp.jobTitle = mainEditor?.nodeName() ??
printOp.jobTitle = mainEditor?.name ??
fileURL?.lastPathComponent?.stringByDeletingPathExtension ??
"Untitled"
printOp.showsPrintPanel = printShowPanel