From 02f971b534e12fc0438b71c76a4b005735e4b413 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 30 Sep 2014 12:53:35 +0200 Subject: [PATCH] OS X Overlay Icons: Fix request for sync dir itself --- .../MacOSX/OwnCloudFinder/ContentManager.m | 19 +++++++++++++------ .../OwnCloudFinder/IconOverlayHandlers.m | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m index b9e49e7cb..d0a6659d0 100644 --- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m +++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m @@ -118,7 +118,7 @@ static ContentManager* sharedInstance = nil; if (![_fileNamesCache objectForKey:normalizedPath] || ![[_fileNamesCache objectForKey:normalizedPath] isEqualTo:res]) { [_fileNamesCache setObject:res forKey:normalizedPath]; - // NSLog(@"SET value %d", [res intValue]); + //NSLog(@"SET value %d %@", [res intValue], normalizedPath); _hasChangedContent = YES; [self performSelector:@selector(repaintAllWindowsIfNeeded) withObject:0 afterDelay:1.0]; // 1 sec } @@ -144,7 +144,7 @@ static ContentManager* sharedInstance = nil; } NSNumber* result = [_fileNamesCache objectForKey:normalizedPath]; - // NSLog(@"XXXXXXX Asking for icon for path %@ = %d",path, [result intValue]); + // NSLog(@"XXXXXXX Asking for icon for path %@ = %d",normalizedPath, [result intValue]); if( result == nil ) { // start the async call @@ -192,15 +192,22 @@ static ContentManager* sharedInstance = nil; - (void)reFetchFileNameCacheForPath:(NSString*)path { - // NSLog(@"%@", NSStringFromSelector(_cmd)); + NSLog(@"%@", NSStringFromSelector(_cmd)); for (id p in [_fileNamesCache keyEnumerator]) { if ( path && [p hasPrefix:path] ) { - NSNumber *askState = [[RequestManager sharedInstance] askForIcon:p isDirectory:false]; // FIXME - //[_fileNamesCache setObject:askState forKey:p]; - NSLog(@"%@ %@", NSStringFromSelector(_cmd), p); + [[RequestManager sharedInstance] askForIcon:p isDirectory:false]; // FIXME isDirectory parameter + //[_fileNamesCache setObject:askState forKey:p]; We don't do this since we want to keep the old icon meanwhile + //NSLog(@"%@ %@", NSStringFromSelector(_cmd), p); } } + + // Ask for directory itself + if ([path hasSuffix:@"/"]) { + path = [path substringToIndex:path.length - 1]; + } + [[RequestManager sharedInstance] askForIcon:path isDirectory:true]; + //NSLog(@"%@ %@", NSStringFromSelector(_cmd), path); } diff --git a/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m b/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m index ca9592396..d51cea9a9 100644 --- a/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m +++ b/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m @@ -77,7 +77,7 @@ } NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir]; - // NSLog(@"2 The icon index is %d", [imageIndex intValue]); + //NSLog(@"2 The icon index is %d %@ %@", [imageIndex intValue], [url path], isDir ? @"isDir" : @""); if ([imageIndex intValue] > 0) {