Added PasteboardController to handle pasteboard cleanup on shutdown and timeout

This commit is contained in:
michael starke
2013-03-02 23:31:28 +01:00
parent b26434569c
commit b021aefd51
17 changed files with 504 additions and 156 deletions

BIN
Assets/buttonBar.psd Normal file

Binary file not shown.

View File

@@ -19,10 +19,12 @@
4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */; };
4C3BD51516D276F800389F1F /* MPToolbarDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */; };
4C3FFD9E16DAF60600DF9186 /* FilterBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */; };
4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */; };
4C4E1DC716DC6536007B9B47 /* PathBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C4E1DC616DC6536007B9B47 /* PathBar.xib */; };
4C586F9E16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C586F9D16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf */; };
4C586FA016D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C586F9F16D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf */; };
4C586FA216D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C586FA116D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf */; };
4C587F2E16E0257B0003718D /* MPButtonBarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C587F2D16E0257B0003718D /* MPButtonBarButton.m */; };
4C61EA0316D2FD0800AC519E /* MPOutlineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C61EA0216D2FD0800AC519E /* MPOutlineViewController.m */; };
4C61EA0516D2FFE200AC519E /* OutlineView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C61EA0416D2FFE200AC519E /* OutlineView.xib */; };
4C65C79C16DD283900E32CFF /* MPToolbarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C65C79B16DD283900E32CFF /* MPToolbarButton.m */; };
@@ -96,7 +98,9 @@
4CD78ABF16D155FF00768A1D /* 10_ContactTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78ABA16D155FF00768A1D /* 10_ContactTemplate.pdf */; };
4CD78AC016D155FF00768A1D /* 11_CameraTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */; };
4CD884B715BD47080042BBF8 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CD884B615BD47080042BBF8 /* MainWindow.xib */; };
4CDB556416E29A7C00635918 /* MPPathControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDB556316E29A7C00635918 /* MPPathControl.m */; };
4CDF01A316D1B76700D0AC08 /* MPEntryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */; };
4CE06D7D16DEF3FE00840E3A /* MPButtonBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE06D7C16DEF3FE00840E3A /* MPButtonBar.m */; };
4CF5D49616D5B6E900CB78BD /* MPEntryEditController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D49416D5B6E900CB78BD /* MPEntryEditController.m */; };
4CF5D49716D5B6E900CB78BD /* EntryEditView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CF5D49516D5B6E900CB78BD /* EntryEditView.xib */; };
/* End PBXBuildFile section */
@@ -120,10 +124,14 @@
4C3BD51316D276F800389F1F /* MPToolbarDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPToolbarDelegate.h; sourceTree = "<group>"; };
4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPToolbarDelegate.m; sourceTree = "<group>"; };
4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FilterBar.xib; sourceTree = "<group>"; };
4C431BCB16E2A82700700A81 /* MPPasteBoardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasteBoardController.h; sourceTree = "<group>"; };
4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasteBoardController.m; sourceTree = "<group>"; };
4C4E1DC616DC6536007B9B47 /* PathBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PathBar.xib; sourceTree = "<group>"; };
4C586F9D16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 00_PasswordTemplate.pdf; sourceTree = "<group>"; };
4C586F9F16D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 01_PackageNetworkTemplate.pdf; sourceTree = "<group>"; };
4C586FA116D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 02_MessageBoxWarningTemplate.pdf; sourceTree = "<group>"; };
4C587F2C16E0257B0003718D /* MPButtonBarButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPButtonBarButton.h; sourceTree = "<group>"; };
4C587F2D16E0257B0003718D /* MPButtonBarButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPButtonBarButton.m; sourceTree = "<group>"; };
4C61EA0116D2FD0800AC519E /* MPOutlineViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOutlineViewController.h; sourceTree = "<group>"; };
4C61EA0216D2FD0800AC519E /* MPOutlineViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineViewController.m; sourceTree = "<group>"; };
4C61EA0416D2FFE200AC519E /* OutlineView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OutlineView.xib; sourceTree = "<group>"; };
@@ -264,8 +272,12 @@
4CD78ABA16D155FF00768A1D /* 10_ContactTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 10_ContactTemplate.pdf; sourceTree = "<group>"; };
4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 11_CameraTemplate.pdf; sourceTree = "<group>"; };
4CD884B615BD47080042BBF8 /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
4CDB556216E29A7C00635918 /* MPPathControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPathControl.h; sourceTree = "<group>"; };
4CDB556316E29A7C00635918 /* MPPathControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPathControl.m; sourceTree = "<group>"; };
4CDF01A116D1B76700D0AC08 /* MPEntryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryViewController.h; sourceTree = "<group>"; };
4CDF01A216D1B76700D0AC08 /* MPEntryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEntryViewController.m; sourceTree = "<group>"; };
4CE06D7B16DEF3FE00840E3A /* MPButtonBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPButtonBar.h; sourceTree = "<group>"; };
4CE06D7C16DEF3FE00840E3A /* MPButtonBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPButtonBar.m; sourceTree = "<group>"; };
4CF5D49316D5B6E900CB78BD /* MPEntryEditController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryEditController.h; sourceTree = "<group>"; };
4CF5D49416D5B6E900CB78BD /* MPEntryEditController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEntryEditController.m; sourceTree = "<group>"; };
4CF5D49516D5B6E900CB78BD /* EntryEditView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryEditView.xib; sourceTree = "<group>"; };
@@ -302,12 +314,6 @@
4C4E1DC616DC6536007B9B47 /* PathBar.xib */,
4C69A73816D589DF00EC1B1A /* MPGradientView.h */,
4C69A73916D589DF00EC1B1A /* MPGradientView.m */,
4C16854216D704980027ECBC /* MPPathBar.h */,
4C16854316D704980027ECBC /* MPPathBar.m */,
4C6DA0F716D81B8A0011224B /* MPPathBarItemView.h */,
4C6DA0F816D81B8A0011224B /* MPPathBarItemView.m */,
4C65C79A16DD283900E32CFF /* MPToolbarButton.h */,
4C65C79B16DD283900E32CFF /* MPToolbarButton.m */,
);
name = Views;
sourceTree = "<group>";
@@ -525,6 +531,7 @@
4CA0B30E15BCB70200654E32 /* Protocolls */,
4CA0B2F115BCAEE600654E32 /* Controller */,
4C06398C15B980480004DE27 /* Views */,
4CDB556616E29A8A00635918 /* Controls */,
4C37A84215B8B495005EF8EE /* Model */,
4C37A84115B8B47D005EF8EE /* Delegates */,
4C77E36D15B84A240093A587 /* Supporting Files */,
@@ -565,6 +572,8 @@
4C61EA0216D2FD0800AC519E /* MPOutlineViewController.m */,
4CF5D49316D5B6E900CB78BD /* MPEntryEditController.h */,
4CF5D49416D5B6E900CB78BD /* MPEntryEditController.m */,
4C431BCB16E2A82700700A81 /* MPPasteBoardController.h */,
4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */,
);
name = Controller;
sourceTree = "<group>";
@@ -635,6 +644,25 @@
path = Private;
sourceTree = "<group>";
};
4CDB556616E29A8A00635918 /* Controls */ = {
isa = PBXGroup;
children = (
4C16854216D704980027ECBC /* MPPathBar.h */,
4C16854316D704980027ECBC /* MPPathBar.m */,
4C6DA0F716D81B8A0011224B /* MPPathBarItemView.h */,
4C6DA0F816D81B8A0011224B /* MPPathBarItemView.m */,
4C65C79A16DD283900E32CFF /* MPToolbarButton.h */,
4C65C79B16DD283900E32CFF /* MPToolbarButton.m */,
4CE06D7B16DEF3FE00840E3A /* MPButtonBar.h */,
4CE06D7C16DEF3FE00840E3A /* MPButtonBar.m */,
4C587F2C16E0257B0003718D /* MPButtonBarButton.h */,
4C587F2D16E0257B0003718D /* MPButtonBarButton.m */,
4CDB556216E29A7C00635918 /* MPPathControl.h */,
4CDB556316E29A7C00635918 /* MPPathControl.m */,
);
name = Controls;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -804,6 +832,10 @@
4C6DA0F916D81B8A0011224B /* MPPathBarItemView.m in Sources */,
4C920E2A16DCDFA00083839B /* MPLoggerProxy.m in Sources */,
4C65C79C16DD283900E32CFF /* MPToolbarButton.m in Sources */,
4CE06D7D16DEF3FE00840E3A /* MPButtonBar.m in Sources */,
4C587F2E16E0257B0003718D /* MPButtonBarButton.m in Sources */,
4CDB556416E29A7C00635918 /* MPPathControl.m in Sources */,
4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -863,7 +895,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2/**";
MACOSX_DEPLOYMENT_TARGET = 10.7;
MACOSX_DEPLOYMENT_TARGET = 10.8;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-lxml2";
SDKROOT = macosx;
@@ -890,7 +922,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2/**";
MACOSX_DEPLOYMENT_TARGET = 10.7;
MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_LDFLAGS = "-lxml2";
SDKROOT = macosx;
};
@@ -903,7 +935,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MacPass/MacPass-Prefix.pch";
INFOPLIST_FILE = "MacPass/MacPass-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
MACOSX_DEPLOYMENT_TARGET = 10.8;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -916,7 +948,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MacPass/MacPass-Prefix.pch";
INFOPLIST_FILE = "MacPass/MacPass-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
MACOSX_DEPLOYMENT_TARGET = 10.8;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};

View File

@@ -2,7 +2,7 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12C60</string>
<string key="IBDocument.SystemVersion">12C3103</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
<string key="IBDocument.HIToolboxVersion">625.00</string>
@@ -42,23 +42,13 @@
<reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSCustomView" id="446204460">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 56}, {291, 24}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">MPPathBar</string>
</object>
<object class="NSPopUpButton" id="421904700">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{146, 91}, {127, 26}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="446204460"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSAntiCompressionPriority">{750, 751}</string>
<bool key="NSEnabled">YES</bool>
@@ -196,14 +186,6 @@
</object>
<int key="connectionID">83</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">pathBar</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="446204460"/>
</object>
<int key="connectionID">372</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -317,54 +299,6 @@
<float key="scoringTypeFloat">40</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="679237613">
<reference key="firstItem" ref="1005"/>
<int key="firstAttribute">9</int>
<int key="relation">0</int>
<reference key="secondItem" ref="446204460"/>
<int key="secondAttribute">9</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1005"/>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">2</int>
</object>
<object class="IBNSLayoutConstraint" id="804532430">
<reference key="firstItem" ref="446204460"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="1005"/>
<int key="secondAttribute">5</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1005"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="537103058">
<reference key="firstItem" ref="446204460"/>
<int key="firstAttribute">10</int>
<int key="relation">0</int>
<reference key="secondItem" ref="1005"/>
<int key="secondAttribute">10</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1005"/>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">2</int>
</object>
<object class="IBNSLayoutConstraint" id="689515169">
<reference key="firstItem" ref="637214120"/>
<int key="firstAttribute">7</int>
@@ -413,7 +347,6 @@
<float key="scoringTypeFloat">40</float>
<int key="contentType">3</int>
</object>
<reference ref="446204460"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -511,49 +444,6 @@
<reference key="object" ref="835508122"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">357</int>
<reference key="object" ref="446204460"/>
<array class="NSMutableArray" key="children">
<object class="IBNSLayoutConstraint" id="892605823">
<reference key="firstItem" ref="446204460"/>
<int key="firstAttribute">8</int>
<int key="relation">0</int>
<nil key="secondItem"/>
<int key="secondAttribute">0</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">24</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="446204460"/>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">1</int>
</object>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">366</int>
<reference key="object" ref="537103058"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">368</int>
<reference key="object" ref="804532430"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">370</int>
<reference key="object" ref="892605823"/>
<reference key="parent" ref="446204460"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">371</int>
<reference key="object" ref="679237613"/>
<reference key="parent" ref="1005"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -564,9 +454,6 @@
<reference ref="180695068"/>
<reference ref="989429017"/>
<reference ref="689515169"/>
<reference ref="537103058"/>
<reference ref="804532430"/>
<reference ref="679237613"/>
<reference ref="704304955"/>
<reference ref="106372279"/>
<reference ref="850330857"/>
@@ -585,15 +472,6 @@
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<array key="357.IBNSViewMetadataConstraints">
<reference ref="892605823"/>
</array>
<boolean value="NO" key="357.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="357.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="366.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="59.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="62.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="66.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -606,7 +484,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">379</int>
<int key="maxID">407</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -632,22 +510,6 @@
<string key="minorKey">./Classes/MPGeneralSettingsController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPGradientView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPGradientView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPPathBar</string>
<string key="superclassName">MPGradientView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPPathBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPViewController</string>
<string key="superclassName">NSViewController</string>

52
MacPass/MPButtonBar.h Normal file
View File

@@ -0,0 +1,52 @@
//
// MPButtonBar.h
// MacPass
//
// Created by michael starke on 28.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPGradientView.h"
/*
Notifications and userInfo dictionary keys
*/
APPKIT_EXTERN NSString *const MPButtonBarSelectionChangedNotification;
/*
Key in for the Index of the new selection. NSNumber with NSUInteger
*/
APPKIT_EXTERN NSString *const MPButtonBarSelectionIndexKey;
/*
Exception thrown if an illegal delegate is used.
*/
APPKIT_EXTERN NSString *const MPButtonBarInvalidDelegateException;
@class MPButtonBar;
@protocol MPButtonBarDelegate <NSObject>
@required
- (NSUInteger)buttonsInButtonBar:(MPButtonBar *)buttonBar;
@optional
- (NSImage *)buttonBar:(MPButtonBar *)buttonBar imageAtIndex:(NSUInteger)index;
- (NSString *)buttonBar:(MPButtonBar *)buttonBar labelAtIndex:(NSUInteger)index;
/*
A delegate that implements this function automatically gets registred to recive MPButtonBarSelectionDidChangeNotification
The object in the notification is the buttonbar,
The userDictionary contrains the following keys:
MPButtonBarSelectionIndexKey;
*/
- (void)didChangeButtonSelection:(NSNotification *)notification;
@end
@interface MPButtonBar : MPGradientView
@property (nonatomic, assign) id<MPButtonBarDelegate> delegate;
@property (nonatomic, readonly) NSUInteger selectedIndex;
@property (nonatomic, readonly) BOOL hasSelection;
@end

131
MacPass/MPButtonBar.m Normal file
View File

@@ -0,0 +1,131 @@
//
// MPButtonBar.m
// MacPass
//
// Created by michael starke on 28.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPButtonBar.h"
#import "MPButtonBarButton.h"
#define MPBUTTONBAR_BUTTON_MARGIN 5.0;
NSString *const MPButtonBarSelectionChangedNotification = @"MPButtonBarSelectionChangedNotification";
NSString *const MPButtonBarSelectionIndexKey = @"MPButtonBarSelectionIndexKey";
NSString *const MPButtonBarInvalidDelegateException = @"MPButtonBarInvalidDelegateException";
@interface MPButtonBar ()
@property (retain) NSMutableArray *buttons;
@property (nonatomic, assign) NSUInteger selectedIndex;
@property (assign) BOOL delegateSupportsImage;
@property (assign) BOOL delegateSupportsLabel;
- (void)_updateButtons;
- (void)_didClickButton:(id)sender;
@end
@implementation MPButtonBar
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.selectedIndex = NSNotFound;
self.buttons = [NSMutableArray arrayWithCapacity:5];
self.delegateSupportsImage = NO;
self.delegateSupportsLabel = NO;
[self _updateButtons];
}
return self;
}
# pragma mark Layout
- (void)_updateButtons {
NSUInteger currentButtonCount = [self.buttons count];
NSUInteger newButtonCount = 5;//[self.delegate buttonsInButtonBar:self];
/*
remove unused buttons
*/
if(currentButtonCount > newButtonCount) {
NSRange removalRange = NSMakeRange(newButtonCount - 1, currentButtonCount - newButtonCount);
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:removalRange];
NSArray *obsolteButtons = [self.buttons objectsAtIndexes:indexSet];
for(NSButton *button in obsolteButtons) {
[button removeFromSuperviewWithoutNeedingDisplay];
}
[self.buttons removeObjectsInRange:NSMakeRange(newButtonCount - 1, currentButtonCount - newButtonCount)];
}
CGFloat startPosition = MPBUTTONBAR_BUTTON_MARGIN;
for(NSUInteger buttonIndex = 0; buttonIndex < newButtonCount ; buttonIndex++) {
BOOL needsDisplay = NO;
if(buttonIndex >= currentButtonCount) {
NSButton *newButton= [[MPButtonBarButton alloc] initWithFrame:NSMakeRect(0, 0, 30, 30)];
[self addSubview:newButton];
[self.buttons addObject:newButton];
[newButton release];
[newButton setTarget:self];
[newButton setImage:[NSImage imageNamed:NSImageNameActionTemplate]];
[newButton setAction:@selector(_didClickButton:)];
needsDisplay = YES;
}
NSButton *currentButton = self.buttons[buttonIndex];
if (self.delegateSupportsImage) {
[currentButton setImage:[self.delegate buttonBar:self imageAtIndex:buttonIndex]];
needsDisplay = YES;
}
if(self.delegateSupportsLabel) {
[currentButton setStringValue:[self.delegate buttonBar:self labelAtIndex:buttonIndex]];
needsDisplay = YES;
}
[currentButton sizeToFit];
NSRect frame = [currentButton frame];
frame.size.width += 20;
frame.origin.x = startPosition;
[currentButton setFrame:frame];
startPosition += frame.size.width + MPBUTTONBAR_BUTTON_MARGIN;
[self setNeedsDisplay:needsDisplay];
}
}
#pragma mark Button Events
- (void)_didClickButton:(id)sender {
NSUInteger index = [[self subviews] indexOfObject:sender];
if(index == NSNotFound) {
return; // Nothing we need to know about happened;
}
NSDictionary *userInfo = @{ MPButtonBarSelectionIndexKey: @(index) };
[[NSNotificationCenter defaultCenter] postNotificationName:MPButtonBarSelectionChangedNotification object:self userInfo:userInfo];
}
# pragma mark Properties
- (void)setDelegate:(id<MPButtonBarDelegate>)delegate {
if( ![delegate conformsToProtocol:@protocol(MPButtonBarDelegate)]) {
NSException *invalidDelegateException = [NSException exceptionWithName:MPButtonBarInvalidDelegateException reason:@"The Delegate does not conform to the MPButtonBarDelegate protocoll" userInfo:nil];
@throw invalidDelegateException;
}
if(_delegate != delegate) {
if([_delegate respondsToSelector:@selector(didChangeButtonSelection:)]) {
[[NSNotificationCenter defaultCenter] removeObserver:_delegate];
}
_delegate = delegate;
self.delegateSupportsLabel = [delegate respondsToSelector:@selector(buttonBar:labelAtIndex:)];
self.delegateSupportsImage = [delegate respondsToSelector:@selector(buttonBar:imageAtIndex:)];
if([delegate respondsToSelector:@selector(selectionDidChanged:)]) {
[[NSNotificationCenter defaultCenter] addObserver:self.delegate selector:@selector(didChangeButtonSelection:) name:MPButtonBarSelectionChangedNotification object:self];
}
[self _updateButtons];
}
}
- (BOOL)hasSelection {
return self.selectedIndex != NSNotFound;
}
@end

View File

@@ -0,0 +1,13 @@
//
// MPButtonBarButton.h
// MacPass
//
// Created by Michael Starke on 01.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface MPButtonBarButton : NSButton
@end

View File

@@ -0,0 +1,41 @@
//
// MPButtonBarButton.m
// MacPass
//
// Created by Michael Starke on 01.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPButtonBarButton.h"
@implementation MPButtonBarButton
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setButtonType:NSPushOnPushOffButton];
[self setBordered:NO];
[[self cell] setHighlightsBy:NSContentsCellMask];
[[self cell] setShowsStateBy:NSNoCellMask];
[[self cell] setBackgroundStyle:NSBackgroundStyleRaised];
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect {
if(self.state == NSOnState) {
NSRect drawingRect = [self bounds];
NSColor *edgeColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.2];
NSColor *middelColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0];
NSGradient *borderGradient = [[NSGradient alloc] initWithColors:@[edgeColor, middelColor]];
drawingRect.size.width = 5;
[borderGradient drawInRect:drawingRect relativeCenterPosition:NSMakePoint(-1.0, 0)];
drawingRect.origin.x = [self bounds].size.width - 5;
[borderGradient drawInRect:drawingRect relativeCenterPosition:NSMakePoint(1.0, 0)];
}
[super drawRect:dirtyRect];
}
@end

View File

@@ -12,6 +12,7 @@
#import "MPDatabaseDocument.h"
#import "MPIconHelper.h"
#import "MPMainWindowController.h"
#import "MPPasteBoardController.h"
#import "KdbGroup+MPAdditions.h"
#import <QuartzCore/QuartzCore.h>
@@ -25,6 +26,13 @@ typedef enum {
MPFilterTitles = 8,
} MPFilterModeType;
typedef enum {
MPCopyUsername,
MPCopyPassword,
MPCopyURL,
MPCopyWholeEntry,
} MPCopyContentTypeTag;
NSString *const MPEntryTableUserNameColumnIdentifier = @"MPUserNameColumnIdentifier";
NSString *const MPEntryTableTitleColumnIdentifier = @"MPTitleColumnIdentifier";
NSString *const MPEntryTablePasswordColumnIdentifier = @"MPPasswordColumnIdentifier";
@@ -69,10 +77,13 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
- (void)updateFilter;
- (void)setupFilterBar;
- (void)setupPathBar;
- (void)_setupEntryMenu;
- (void)_didChangeGroupSelectionInOutlineView:(NSNotification *)notification;
- (void)_showFilterBarAnimated:(BOOL)animate;
- (void)_hideStatusBarAnimated:(BOOL)animate;
- (void)_copyEntryData:(id)sender;
@end
@implementation MPEntryViewController
@@ -114,6 +125,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
[self _hideStatusBarAnimated:NO];
[self.entryTable setDelegate:self];
[self _setupEntryMenu];
NSTableColumn *parentColumn = [self.entryTable tableColumns][0];
NSTableColumn *titleColumn = [self.entryTable tableColumns][1];
@@ -340,8 +352,65 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
}
}
#pragma mark EntryMenu
- (void)_setupEntryMenu {
NSMenu *menu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
NSMenuItem *copyUserItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"Copy Username"
action:@selector(_copyEntryData:)
keyEquivalent:@"C"];
[copyUserItem setTag:MPCopyUsername];
[copyUserItem setTarget:self];
NSMenuItem *copyPasswordItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"Copy Password"
action:@selector(_copyEntryData:)
keyEquivalent:@"c"];
[copyPasswordItem setTag:MPCopyPassword];
[copyPasswordItem setTarget:self];
[menu addItem:copyUserItem];
[menu addItem:copyPasswordItem];
[copyUserItem release];
[copyPasswordItem release];
[self.entryTable setMenu:menu];
[menu release];
}
#pragma mark Actions
- (void)_copyEntryData:(id)sender {
NSInteger selectedRow = [self.entryTable selectedRow];
if(selectedRow > [[self.entryArrayController arrangedObjects] count]) {
return;
}
KdbEntry *selectedEntry = [self.entryArrayController arrangedObjects][selectedRow];
if([sender respondsToSelector:@selector(tag)]) {
MPCopyContentTypeTag contentTag = (MPCopyContentTypeTag)[sender tag];
SEL contentTypeSelector = @selector(description);
switch (contentTag) {
case MPCopyPassword:
contentTypeSelector = @selector(password);
break;
case MPCopyUsername:
contentTypeSelector = @selector(username);
break;
case MPCopyURL:
contentTypeSelector = @selector(URL);
break;
case MPCopyWholeEntry:
default:
break;
}
[[MPPasteBoardController defaultController] copyObjects:@[ [selectedEntry performSelector:contentTypeSelector] ]];
}
}
- (void)_toggleFilterSpace:(id)sender {
NSButton *button = sender;
NSNumber *value = self.filterButtonToMode[[button identifier]];

View File

@@ -51,7 +51,5 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
[_encodingPopup setMenu:encodingMenu];
[encodingMenu release];
}
@end

View File

@@ -57,7 +57,9 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
NSOutlineView *outlineView = [notification object];
KdbGroup *selectedGroup = [outlineView itemAtRow:[outlineView selectedRow]];
self.selectedGroup = selectedGroup;
#ifdef DEBUG
NSLog(@"Selected: %@", self.selectedGroup);
#endif
[[NSNotificationCenter defaultCenter] postNotificationName:MPOutlineViewDidChangeGroupSelection object:self userInfo:nil];
}

View File

@@ -50,6 +50,8 @@
}
- (void)_showError {
#ifdef DEBUG
NSLog(@"Something went wrong");
#endif
}
@end

View File

@@ -0,0 +1,23 @@
//
// MPPastBoardController.h
// MacPass
//
// Created by Michael Starke on 02.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MPPasteBoardController : NSObject
/*
This time sets the time interval after which a copied entry shoudl be purged from the pasteboard
*/
@property (assign, nonatomic) NSTimeInterval clearTimeout;
@property (assign, nonatomic) BOOL clearPasteboardOnShutdown;
+ (MPPasteBoardController *)defaultController;
- (void)copyObjects:(NSArray *)objects;
@end

View File

@@ -0,0 +1,87 @@
//
// MPPastBoardController.m
// MacPass
//
// Created by Michael Starke on 02.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPPasteBoardController.h"
@interface MPPasteBoardController ()
@property (assign) BOOL isEmpty;
- (void)_clearPasteboardContents;
- (void)_updateNotifications;
@end
@implementation MPPasteBoardController
+ (MPPasteBoardController *)defaultController {
static MPPasteBoardController* sharedInstance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[MPPasteBoardController alloc] init];
});
return sharedInstance;
}
- (id)init {
self = [super init];
if (self) {
_isEmpty = YES;
/* User preferences and bindings */
_clearTimeout = 30;
_clearPasteboardOnShutdown = YES;
[self _updateNotifications];
}
return self;
}
- (void)dealloc
{
if(_clearPasteboardOnShutdown) {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
[super dealloc];
}
- (void)_updateNotifications {
if(self.clearPasteboardOnShutdown) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clearContents) name:NSApplicationWillTerminateNotification object:nil];
}
else {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
}
- (void)setClearTimeout:(NSTimeInterval)clearTimeout {
if(_clearTimeout != clearTimeout) {
_clearTimeout = clearTimeout;
}
}
- (void)setClearPasteboardOnShutdown:(BOOL)clearPasteboardOnShutdown {
if(_clearPasteboardOnShutdown != clearPasteboardOnShutdown ) {
_clearPasteboardOnShutdown = !_clearPasteboardOnShutdown;
[self _updateNotifications];
}
}
- (void)copyObjects:(NSArray *)objects {
[[NSPasteboard generalPasteboard] clearContents];
[[NSPasteboard generalPasteboard] writeObjects:objects];
self.isEmpty = NO;
[self performSelector:@selector(clearContents) withObject:nil afterDelay:self.clearTimeout];
}
- (void)_clearPasteboardContents {
/* Only clear stuff we might have put there */
if(!self.isEmpty) {
[[NSPasteboard generalPasteboard] clearContents];
}
self.isEmpty = YES;
}
@end

13
MacPass/MPPathControl.h Normal file
View File

@@ -0,0 +1,13 @@
//
// MPPathControl.h
// MacPass
//
// Created by Michael Starke on 02.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface MPPathControl : NSPathControl
@end

22
MacPass/MPPathControl.m Normal file
View File

@@ -0,0 +1,22 @@
//
// MPPathControl.m
// MacPass
//
// Created by Michael Starke on 02.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPPathControl.h"
@implementation MPPathControl
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[[self cell] setShowsStateBy:NSNoCellMask];
}
return self;
}
@end

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>34B</string>
<string>37D</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>

View File

@@ -70,6 +70,7 @@
<string key="NSFrame">{{257, 0}, {470, 449}}</string>
<reference key="NSSuperview" ref="947682332"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<string key="NSClassName">NSView</string>
</object>
@@ -88,7 +89,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="947682332"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMinSize">{400, 422}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
@@ -211,7 +212,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">643</int>
<int key="maxID">674</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">