Testing QuickLook

This commit is contained in:
michael starke
2014-03-19 01:56:39 +01:00
parent 34ba9f0575
commit 6ff00b7819
5 changed files with 44 additions and 12 deletions

View File

@@ -245,6 +245,7 @@
4CC6DB7A17D23719002C6091 /* KPKNode+IconImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6DB7917D23719002C6091 /* KPKNode+IconImage.m */; };
4CC6DB7D17D23DCE002C6091 /* KPKUTIs.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6DB7C17D23DCE002C6091 /* KPKUTIs.m */; };
4CC7EA1B17807E7E0089D4F3 /* HNHRoundedTextFieldCellHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC7EA1A17807E7E0089D4F3 /* HNHRoundedTextFieldCellHelper.m */; };
4CCA8E9B18D91ED9001A6754 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CCA8E9A18D91ED9001A6754 /* Quartz.framework */; };
4CCEDE2A179F203B008402BE /* MPOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCEDE29179F203B008402BE /* MPOutlineView.m */; };
4CCEDE2E179F213B008402BE /* MPNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCEDE2D179F213B008402BE /* MPNotifications.m */; };
4CCEDE32179F5B6C008402BE /* KPKDataStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCEDE31179F5B6C008402BE /* KPKDataStreamReader.m */; };
@@ -791,6 +792,7 @@
4CC7EA1A17807E7E0089D4F3 /* HNHRoundedTextFieldCellHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHRoundedTextFieldCellHelper.m; sourceTree = "<group>"; };
4CCA7EEC1797866F00B0B55E /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/GeneralSettings.strings; sourceTree = "<group>"; };
4CCA7EEE1797867200B0B55E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/GeneralSettings.strings; sourceTree = "<group>"; };
4CCA8E9A18D91ED9001A6754 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
4CCEDE28179F203B008402BE /* MPOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOutlineView.h; sourceTree = "<group>"; };
4CCEDE29179F203B008402BE /* MPOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineView.m; sourceTree = "<group>"; };
4CCEDE2C179F2122008402BE /* MPNotifications.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPNotifications.h; sourceTree = "<group>"; };
@@ -911,6 +913,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4CCA8E9B18D91ED9001A6754 /* Quartz.framework in Frameworks */,
4CC5D36418A1162D00AF7FA8 /* Sparkle.framework in Frameworks */,
4C00E33B17D8FAC100F37192 /* Carbon.framework in Frameworks */,
4CAD748E15B88AC100104512 /* libz.dylib in Frameworks */,
@@ -1430,6 +1433,7 @@
4C77E36515B84A240093A587 /* Frameworks */ = {
isa = PBXGroup;
children = (
4CCA8E9A18D91ED9001A6754 /* Quartz.framework */,
4C473A8518AFD7250073FD2E /* XCTest.framework */,
4CAD748D15B88AC100104512 /* libz.dylib */,
4C00E33A17D8FAC100F37192 /* Carbon.framework */,

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">

View File

@@ -69,7 +69,8 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
MPEntrySearchFlags toggleFlag = [sender tag];
MPEntrySearchFlags newFlags = MPEntrySearchNone;
BOOL isDoublePasswordFlag = (toggleFlag == MPEntrySearchDoublePasswords);
switch([sender state]) {
NSButton *button = sender;
switch([button state]) {
case NSOffState:
toggleFlag ^= MPEntrySearchAllFlags;
newFlags = isDoublePasswordFlag ? oldFlags : (self.activeFlags & toggleFlag);

View File

@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
#import "MPPasswordEditWindowController.h"
@class MPViewController;
@@ -16,7 +17,7 @@
@class MPOutlineViewController;
@class MPToolbarDelegate;
@interface MPDocumentWindowController : NSWindowController <MPPasswordEditWindowDelegate>
@interface MPDocumentWindowController : NSWindowController <MPPasswordEditWindowDelegate, QLPreviewPanelDataSource, QLPreviewPanelDelegate>
@property (readonly, strong) MPPasswordInputController *passwordInputController;
@property (readonly, strong) MPEntryViewController *entryViewController;

View File

@@ -51,6 +51,8 @@ typedef void (^MPPasswordChangedBlock)(void);
@property (nonatomic, copy) MPPasswordChangedBlock passwordChangedBlock;
@property (strong) QLPreviewPanel *previewPanel;
@end
@implementation MPDocumentWindowController
@@ -437,14 +439,38 @@ typedef void (^MPPasswordChangedBlock)(void);
}
- (NSSearchField *)locateToolbarSearchField {
for(NSToolbarItem *toolbarItem in [[self.window toolbar] items]) {
NSView *view = [toolbarItem view];
if([view isKindOfClass:[NSSearchField class]]) {
return (NSSearchField *)view;
- (void)toggleQuicklookPreview:(id)sender {
if([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible]) {
[[QLPreviewPanel sharedPreviewPanel] orderOut:sender];
}
else {
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:sender];
}
}
return nil;
#pragma mark -
#pragma mark QLPreviewDelegate
- (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel *)panel {
return YES;
}
- (void)beginPreviewPanelControl:(QLPreviewPanel *)panel {
self.previewPanel = panel;
[self.previewPanel setDataSource:self];
}
- (void)endPreviewPanelControl:(QLPreviewPanel *)panel {
self.previewPanel = nil;
}
#pragma mark -
#pragma mark QLPreviewDataSource
- (NSInteger)numberOfPreviewItemsInPreviewPanel:(QLPreviewPanel *)panel {
return (self.previewPanel == panel ? 1 : 0);
}
- (id<QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index {
return [[NSURL alloc] initWithString:@"file:///test.txt"];
}
@end