Skip to content

Commit

Permalink
add createdate col
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakey committed Nov 14, 2018
1 parent fd0f92f commit 47739b4
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 23 deletions.
6 changes: 6 additions & 0 deletions ProfilesManager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
B80FCFC31E4AAE480044098D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B80FCFC51E4AAE480044098D /* Localizable.strings */; };
B81B6A782195470500A8580F /* ProfilesManagerWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B81B6A7A2195470500A8580F /* ProfilesManagerWindowController.xib */; };
B843F36E20897BAD00C1679C /* ProfilesManagerWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = B843F36C20897BAD00C1679C /* ProfilesManagerWindowController.m */; };
B8B8EE1B219C1BCA00F75DC4 /* DragOutlineRowView.m in Sources */ = {isa = PBXBuildFile; fileRef = B8B8EE1A219C1BCA00F75DC4 /* DragOutlineRowView.m */; };
B8BCD2401E6CEFCB00ABD2A6 /* iAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = B8BCD23F1E6CEFCB00ABD2A6 /* iAlert.m */; };
B8C823BE1E0288D9004BEAEF /* NSData+JKBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = B8C823BD1E0288D8004BEAEF /* NSData+JKBase64.m */; };
B8F694BB204D3ADF0048F3E6 /* PreviewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B8F694B9204D3ADF0048F3E6 /* PreviewViewController.m */; };
Expand Down Expand Up @@ -108,6 +109,8 @@
B843F36B20897BAD00C1679C /* ProfilesManagerWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProfilesManagerWindowController.h; sourceTree = "<group>"; };
B843F36C20897BAD00C1679C /* ProfilesManagerWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProfilesManagerWindowController.m; sourceTree = "<group>"; };
B856B7801E25EDC800060107 /* ProfilesManager.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ProfilesManager.entitlements; sourceTree = "<group>"; };
B8B8EE19219C1BCA00F75DC4 /* DragOutlineRowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DragOutlineRowView.h; sourceTree = "<group>"; };
B8B8EE1A219C1BCA00F75DC4 /* DragOutlineRowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DragOutlineRowView.m; sourceTree = "<group>"; };
B8BCD23E1E6CEFCB00ABD2A6 /* iAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iAlert.h; sourceTree = "<group>"; };
B8BCD23F1E6CEFCB00ABD2A6 /* iAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iAlert.m; sourceTree = "<group>"; };
B8C823BC1E0288D8004BEAEF /* NSData+JKBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+JKBase64.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -230,6 +233,8 @@
children = (
A2A8FA881AFA43E10087DD68 /* DragOutlineView.m */,
A2A8FA891AFA43E10087DD68 /* DragOutlineView.h */,
B8B8EE19219C1BCA00F75DC4 /* DragOutlineRowView.h */,
B8B8EE1A219C1BCA00F75DC4 /* DragOutlineRowView.m */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -417,6 +422,7 @@
A21193221AF1CA5B0064CA7D /* main.m in Sources */,
B8C823BE1E0288D9004BEAEF /* NSData+JKBase64.m in Sources */,
B804236A2192BD9100AD899F /* GitHubInstallWindowController.m in Sources */,
B8B8EE1B219C1BCA00F75DC4 /* DragOutlineRowView.m in Sources */,
B804235B2192BD9100AD899F /* GitHubReleaseAsset.m in Sources */,
B8BCD2401E6CEFCB00ABD2A6 /* iAlert.m in Sources */,
A21193201AF1CA5B0064CA7D /* AppDelegate.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="ProfileManager" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="800" height="500"/>
<rect key="contentRect" x="543" y="266" width="1000" height="600"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<value key="minSize" type="size" width="800" height="200"/>
<value key="maxSize" type="size" width="1600" height="1200"/>
<value key="minSize" type="size" width="490" height="600"/>
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="800" height="500"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<toolbar key="toolbar" implicitIdentifier="D0B8F835-261B-492D-B195-DB0C58068081" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="small" id="cZP-oM-lQ5">
Expand Down Expand Up @@ -68,9 +66,15 @@
<action selector="refreshButtonTouched:" target="-2" id="0HH-yv-p7C"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="CC576DE0-526F-4887-BB82-165F4724BCB7" label="Reset" paletteLabel="Reset" tag="-1" image="NSActionTemplate" sizingBehavior="auto" id="YQD-l5-tAa">
<connections>
<action selector="resetButtonTouched:" target="-2" id="Uy0-gz-nl2"/>
</connections>
</toolbarItem>
</allowedToolbarItems>
<defaultToolbarItems>
<toolbarItem reference="RbJ-X4-SVv"/>
<toolbarItem reference="YQD-l5-tAa"/>
<toolbarItem reference="rz2-bg-kUw"/>
<toolbarItem reference="RdP-pm-wWl"/>
<toolbarItem reference="TqD-HL-i0O"/>
Expand All @@ -83,6 +87,7 @@
</window>
</objects>
<resources>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="NSRefreshFreestandingTemplate" width="14" height="14"/>
</resources>
</document>
19 changes: 13 additions & 6 deletions ProfilesManager/Controller/ProfilesManagerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#import "iAlert.h"
#import "PreviewViewController.h"
#import "PlistManager.h"

#import "DragOutlineRowView.h"
//#include <unistd.h>
//#include <sys/types.h>
//#include <pwd.h>
Expand All @@ -24,6 +24,7 @@
static NSString *kColumnIdentifierDetal = @"detail";
// static NSString *kColumnIdentifierUUID = @"uuid";
static NSString *kColumnIdentifierExpirationDate = @"expirationDate";
static NSString *kColumnIdentifierCreateDate = @"creationDate";

@implementation ProfilesManagerViewController

Expand All @@ -38,8 +39,6 @@ - (void)viewDidLoad {
// [self.treeView sizeLastColumnToFit];
//app第一次运行Column 最后一行自动宽等比增减,否则会有滚动条
[self.treeView sizeToFit];



[self loadProfileFilesWithSearchWord:_searchWord];
//drag file
Expand Down Expand Up @@ -117,7 +116,11 @@ - (void)loadProfileFilesWithSearchWord:(NSString*)searchWord {


#pragma mark - Outline

- (nullable NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item{
DragOutlineRowView *row = [[DragOutlineRowView alloc] init];
row.identifier = @"row";
return row;
}
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item{
ProfilesNode *realItem = item ?: _rootNode;
return [realItem.childrenNodes count];
Expand Down Expand Up @@ -146,13 +149,16 @@ - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTabl
return realItem.detail;
} else if([[tableColumn identifier] isEqualToString:kColumnIdentifierExpirationDate]){
return realItem.expirationDate;
}else if([[tableColumn identifier] isEqualToString:kColumnIdentifierCreateDate]){
return realItem.creationDate;
}
return @"";
}

- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item{
NSInteger row = [outlineView clickedRow];
NSLog(@"select is %zd",row);
NSInteger selectedRow = [outlineView clickedRow];
// [outlineView setNeedsDisplayInRect:[outlineView rectOfRow:selectedRow]];
NSLog(@"select is %zd",selectedRow);
return YES;
}

Expand Down Expand Up @@ -182,6 +188,7 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(NSTextFieldCel
[cell setMenu:nil];
}
}

}


Expand Down
35 changes: 24 additions & 11 deletions ProfilesManager/Controller/ProfilesManagerViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="920" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="22" horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bQP-D8-T2r">
<rect key="frame" x="0.0" y="0.0" width="920" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="600"/>
<clipView key="contentView" drawsBackground="NO" id="O7w-RX-5YA">
<rect key="frame" x="1" y="0.0" width="918" height="599"/>
<rect key="frame" x="1" y="0.0" width="998" height="599"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView appearanceType="vibrantLight" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="Ygp-i7-VyR" viewBased="YES" indentationPerLevel="16" outlineTableColumn="FkK-IV-RHo" id="3ki-mw-HE6" customClass="DragOutlineView">
<rect key="frame" x="0.0" y="0.0" width="918" height="576"/>
<rect key="frame" x="0.0" y="0.0" width="998" height="576"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="5"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="key" width="245" minWidth="40" maxWidth="1000" id="FkK-IV-RHo">
<tableColumn identifier="key" width="245" minWidth="40" maxWidth="400" id="FkK-IV-RHo">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Filename or Key">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -44,7 +44,7 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="type" width="229" minWidth="11" maxWidth="3.4028234663852886e+38" id="ggW-Oi-DM3" userLabel="type">
<tableColumn identifier="type" width="229" minWidth="140" maxWidth="280" id="ggW-Oi-DM3" userLabel="type">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Name or Type">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -57,7 +57,7 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="detail" width="313" minWidth="11" maxWidth="3.4028234663852886e+38" id="4N6-rc-Q65" userLabel="detail">
<tableColumn identifier="detail" width="250" minWidth="40" maxWidth="3.4028234663852886e+38" id="4N6-rc-Q65" userLabel="detail">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Status or Detail">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -70,8 +70,8 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="expirationDate" width="119" minWidth="11" maxWidth="3.4028234663852886e+38" id="PQW-JJ-FJD" userLabel="expirationDate">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="ExpirationDate">
<tableColumn identifier="creationDate" width="135" minWidth="135" maxWidth="135" id="PQW-JJ-FJD" userLabel="creationDate">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="CreateDate">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -83,6 +83,19 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="expirationDate" width="135" minWidth="135" maxWidth="135" id="Mf9-vb-Si1" userLabel="expirationDate">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="ExpirationDate">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="tuT-NQ-v4F">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="-2" id="x0y-Ur-KhI"/>
Expand All @@ -101,7 +114,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" id="Ygp-i7-VyR">
<rect key="frame" x="0.0" y="0.0" width="918" height="23"/>
<rect key="frame" x="0.0" y="0.0" width="998" height="23"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
Expand All @@ -112,7 +125,7 @@
<constraint firstAttribute="trailing" secondItem="bQP-D8-T2r" secondAttribute="trailing" id="Z0B-Ol-du0"/>
<constraint firstItem="bQP-D8-T2r" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="nxd-RY-BEY"/>
</constraints>
<point key="canvasLocation" x="114" y="534"/>
<point key="canvasLocation" x="168.5" y="534"/>
</customView>
</objects>
</document>
6 changes: 6 additions & 0 deletions ProfilesManager/Controller/ProfilesManagerWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ - (IBAction)refreshButtonTouched:(id)sender {
ProfilesManagerViewController *manger = (ProfilesManagerViewController*)self.contentViewController;
[manger loadProfileFilesWithSearchWord:self.searchTextField.stringValue];
}
- (IBAction)resetButtonTouched:(id)sender {
// rm ~/Library/Preferences/myapp.plist; sudo killall cfprefsd
// defaults delete ~/Library/Preferences/myapp.plist
[self.window setFrame:NSMakeRect(0, 0, 1000, 600) display:YES];
[self.window center];
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

/* Class = "NSToolbarItem"; paletteLabel = "Refresh"; ObjectID = "RbJ-X4-SVv"; */
"RbJ-X4-SVv.paletteLabel" = "Refresh";


"YQD-l5-tAa.paletteLabel" = "Reset";
"YQD-l5-tAa.label" = "Reset";

/* Class = "NSTextField"; ibShadowedToolTip = "search keyword"; ObjectID = "t6d-rt-sJV"; */
"t6d-rt-sJV.ibShadowedToolTip" = "search keyword";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
/* Class = "NSToolbarItem"; paletteLabel = "Refresh"; ObjectID = "RbJ-X4-SVv"; */
"RbJ-X4-SVv.paletteLabel" = "刷新";

"YQD-l5-tAa.label" = "重置";
"YQD-l5-tAa.paletteLabel" = "重置";

/* Class = "NSTextField"; ibShadowedToolTip = "search keyword"; ObjectID = "t6d-rt-sJV"; */
"t6d-rt-sJV.ibShadowedToolTip" = "搜索关键词";

Expand Down
1 change: 1 addition & 0 deletions ProfilesManager/Model/ProfilesNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@property (nonatomic, copy)NSString *filePath;
@property (nonatomic, strong)NSDictionary *extra;
@property (nonatomic, copy)NSString *expirationDate;
@property (nonatomic, copy)NSString *creationDate;

- (id)initWithRootNode:(ProfilesNode *)rootNote originInfo:(id)info key:(NSString*)key;

Expand Down
2 changes: 2 additions & 0 deletions ProfilesManager/Model/ProfilesNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ - (id)initWithRootNode:(ProfilesNode *)rootNode originInfo:(id)info key:(NSStrin
_uuid = [dict objectForKey:@"UUID"];
_filePath = [dict objectForKey:@"filePath"];
_expirationDate = [[DateManager sharedManager] stringConvert_YMDHM_FromDate:[dict objectForKey:@"ExpirationDate"]];
_expirationDate = [[DateManager sharedManager] stringConvert_YMDHM_FromDate:[dict objectForKey:@"ExpirationDate"]];
_creationDate= [[DateManager sharedManager] stringConvert_YMDHM_FromDate:[dict objectForKey:@"CreationDate"]];

if(_uuid){
NSDate *expiration = [dict objectForKey:@"ExpirationDate"];
Expand Down
17 changes: 17 additions & 0 deletions ProfilesManager/View/DragOutlineRowView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// DragOutlineRowView.h
// ProfilesManager
//
// Created by Jakey on 2018/11/14.
// Copyright © 2018 Jakey. All rights reserved.
//

#import <Cocoa/Cocoa.h>

NS_ASSUME_NONNULL_BEGIN

@interface DragOutlineRowView : NSTableRowView

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 47739b4

Please sign in to comment.