Revision: 7443
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7443&view=rev
Author:   hofman
Date:     2011-08-25 17:44:57 +0000 (Thu, 25 Aug 2011)
Log Message:
-----------
Show content of session bookmark in submenu when holding Option key, 
complementary to folder bookmark behavior

Modified Paths:
--------------
    trunk/SKBookmark.m
    trunk/SKBookmarkController.m

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2011-08-23 11:33:09 UTC (rev 7442)
+++ trunk/SKBookmark.m  2011-08-25 17:44:57 UTC (rev 7443)
@@ -503,7 +503,7 @@
 }
 
 - (NSString *)label {
-    return label ?: @"";
+    return [label length] > 0 ? label : [[NSFileManager defaultManager] 
displayNameAtPath:[self path]] ?: @"";
 }
 
 - (void)setLabel:(NSString *)newLabel {
@@ -762,6 +762,10 @@
     return [NSImage imageNamed:NSImageNameMultipleDocuments];
 }
 
+- (NSImage *)alternateIcon {
+    return [[NSWorkspace sharedWorkspace] 
iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)];
+}
+
 - (void)insertObject:(SKBookmark *)child inChildrenAtIndex:(NSUInteger)anIndex 
{}
 - (void)removeObjectFromChildrenAtIndex:(NSUInteger)anIndex {}
 

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2011-08-23 11:33:09 UTC (rev 7442)
+++ trunk/SKBookmarkController.m        2011-08-25 17:44:57 UTC (rev 7443)
@@ -432,6 +432,17 @@
                     [item setAlternate:YES];
                     [item setImageAndSize:[bm alternateIcon]];
                     break;
+                case SKBookmarkTypeSession:
+                    item = [menu addItemWithTitle:[bm label] 
action:@selector(openBookmark:) target:self];
+                    [item setRepresentedObject:bm];
+                    [item setImageAndSize:[bm icon]];
+                    item = [menu addItemWithTitle:[bm label] submenu:[[[NSMenu 
allocWithZone:[NSMenu menuZone]] initWithTitle:[bm label]] autorelease]];
+                    [item setRepresentedObject:bm];
+                    [item setKeyEquivalentModifierMask:NSAlternateKeyMask];
+                    [item setAlternate:YES];
+                    [item setImageAndSize:[bm alternateIcon]];
+                    [[item submenu] setDelegate:self];
+                    break;
                 case SKBookmarkTypeSeparator:
                     [menu addItem:[NSMenuItem separatorItem]];
                     break;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to