File: programming/cocoa/Filie.zip/Filie/Filie/UKSidebarDataSource.m


/* =============================================================================
    PROJECT:    Filie
    FILE:       UKSidebarDataSource.m
    
    COPYRIGHT:  (c) 2004 by M. Uli Kusterer, all rights reserved.
    
    AUTHORS:    M. Uli Kusterer - UK
    
    LICENSES:   GNU GPL
    
    REVISIONS:
        2004-12-10  UK  Created.
   ========================================================================== */
 
// -----------------------------------------------------------------------------
//  Headers:
// -----------------------------------------------------------------------------
 
#import "UKSidebarDataSource.h"
#import "UKDirectoryEnumerator.h"
#import "IconKit.h"
#import "NDAlias.h"
#import "NSWorkspace+PreviewFile.h"
#import "NSImage+NiceScaling.h"
// -----------------------------------------------------------------------------
//  reload:
//      Cause the data source to tell the delegate about the currently
//      available files. This is the main method you use to kick of processing.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// Add "Network" icon.
"/Network""/Network"// Now list all mounted volumes:
"/Users/"] )          // Skip mounted FileVault user directories.
"/Network"] )   // We add network manually, coz otherwise it doesn't always show up.
// Now list user-defined items:
"com.apple.sidebarlists""useritems""CustomListItems""Alias""Couldn't load sidebar item: %@"// -----------------------------------------------------------------------------
//  delegate:
//      Who's your daddy?
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setDelegate:
//      Specify the object to send our delegate messages to.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  placeholderIconForItem:attributes:
//      Return an image to display as the icon for the item at the specified
//      URL with the specified attributes.
//
//      This needn't be an exact icon, however, it must be one that can be
//      obtained *very* fast. For icons that have to be downloaded or generated,
//      return a generic icon here and do the actual work in iconForItem: to get
//      a second, more accurate icon.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  iconForItem:attributes:
//      Return the icon for the item at the specified URL with the specified
//      attributes.
//
//      This is the icon the file will have once everything's been loaded. This
//      method may be a tad slower, as it's called from a second thread while
//      the user can still work on.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// Couldn't generate a preview, although we want icon previews, and no custom icon?
// Load the full file and manually cobble together a preview:
//fileIcon = [fileIcon scaledImageToFitSize: iconSize];
// Still no icon?
// Ask Icon Services for an icon.
 

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.