Added button to status info display. Functionality is not wired yet.

This commit is contained in:
Michael Starke
2018-12-30 22:08:32 +01:00
parent 56a6fce658
commit 8f11acdfa4
5 changed files with 67 additions and 6 deletions

View File

@@ -10,6 +10,7 @@
4C00E33817D8FA3500F37192 /* DDHotKeyCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C00E33717D8FA3500F37192 /* DDHotKeyCenter.m */; };
4C00E33B17D8FAC100F37192 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C00E33A17D8FAC100F37192 /* Carbon.framework */; };
4C01C2421764D8980016D5D0 /* MPContextMenuHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */; };
4C06B17F21D9691F00CD4BBC /* MPPluginStatusTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C06B17E21D9691F00CD4BBC /* MPPluginStatusTableCellView.m */; };
4C0728BD17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0728BC17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m */; };
4C0728BF17B68ED0005A7DD9 /* SavePanelAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */; };
4C08ACEA204F01C700863D99 /* keyboardTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C08ACE9204F01C700863D99 /* keyboardTemplate.pdf */; };
@@ -335,6 +336,8 @@
4C00E33A17D8FAC100F37192 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
4C01C2401764D8980016D5D0 /* MPContextMenuHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MPContextMenuHelper.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MPContextMenuHelper.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
4C06B17D21D9691F00CD4BBC /* MPPluginStatusTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPPluginStatusTableCellView.h; sourceTree = "<group>"; };
4C06B17E21D9691F00CD4BBC /* MPPluginStatusTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPPluginStatusTableCellView.m; sourceTree = "<group>"; };
4C0728BB17B5B7F7005A7DD9 /* MPPasswordEditWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasswordEditWindowController.h; sourceTree = "<group>"; };
4C0728BC17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasswordEditWindowController.m; sourceTree = "<group>"; };
4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SavePanelAccessoryView.xib; sourceTree = "<group>"; };
@@ -1062,6 +1065,8 @@
4C0F043F2147A6FA000B8568 /* MPCustomFieldTableView.m */,
4C370EFC215B76CB00703AAE /* MPOutlineTableCellView.h */,
4C370EFD215B76CB00703AAE /* MPOutlineTableCellView.m */,
4C06B17D21D9691F00CD4BBC /* MPPluginStatusTableCellView.h */,
4C06B17E21D9691F00CD4BBC /* MPPluginStatusTableCellView.m */,
);
name = Views;
sourceTree = "<group>";
@@ -2047,6 +2052,7 @@
4C9BFFFB1FD19B5400264B16 /* MPPrettyPasswordTransformer.m in Sources */,
4CA0F3ED1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m in Sources */,
4CF78064176E75AD0032EE71 /* MPIntegrationSettingsController.m in Sources */,
4C06B17F21D9691F00CD4BBC /* MPPluginStatusTableCellView.m in Sources */,
4C25703F1BF11C2300D39416 /* MPPluginSettingsController.m in Sources */,
4CF6C711176F4533007A811D /* MPStringLengthValueTransformer.m in Sources */,
4C349A00218852160055AF45 /* MPKeyTyper.m in Sources */,

View File

@@ -12,6 +12,7 @@
#import "MPPluginRepository.h"
#import "MPPluginRepositoryItem.h"
#import "MPPluginVersionComparator.h"
#import "MPPluginStatusTableCellView.h"
typedef NS_ENUM(NSUInteger, MPPluginTableColumn) {
@@ -65,14 +66,19 @@ typedef NS_ENUM(NSUInteger, MPPluginTableColumn) {
view.textField.stringValue = item.currentVersion;
}
else if(column == MPPluginTableColumnStatus) {
MPPluginStatusTableCellView *statusView = (MPPluginStatusTableCellView *)view;
statusView.actionButton.hidden = NO;
MPPlugin *plugin = [MPPluginHost.sharedHost pluginWithBundleIdentifier:item.bundleIdentifier];
if(plugin) {
switch([MPPluginVersionComparator compareVersion:plugin.shortVersionString toVersion:item.currentVersion]) {
case NSOrderedSame:
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_LATEST_VERSION_INSTALLED", "Status for an up-to-date plugin in the plugin browser")];
statusView.actionButton.hidden = YES;
statusView.actionButton.title = @"";
break;
case NSOrderedAscending:
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_NEWER_VERSION_%@_AVAILABLE", "Status for an outdated plugin version in the plugin browser"), item.currentVersion];
statusView.actionButton.title = NSLocalizedString(@"PLUGIN_BROWSER_UPDATE_VERSION_BUTTON", "Button to update the Plugin to the current version");
break;
case NSOrderedDescending:
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_UNKNOWN_PLUGIN_VERSION_INSTALLED_%@", "Status for an unkonw plugin version in the plugin browser"), plugin.shortVersionString];
@@ -80,6 +86,9 @@ typedef NS_ENUM(NSUInteger, MPPluginTableColumn) {
}
}
else {
MPPluginStatusTableCellView *statusView = (MPPluginStatusTableCellView *)view;
statusView.actionButton.hidden = NO;
statusView.actionButton.title = NSLocalizedString(@"PLUGIN_BROWSER_INSTALL_PLUGIN_BUTTON", "Install plugin");
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_PLUGIN_NOT_INSTALLED", "Status for an uninstalled plugin in the plugin browser")];
}
}

View File

@@ -0,0 +1,19 @@
//
// MPPluginStatusTableCellView.h
// MacPass
//
// Created by Michael Starke on 30.12.18.
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface MPPluginStatusTableCellView : NSTableCellView
@property (strong) IBOutlet NSButton *actionButton;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,13 @@
//
// MPPluginStatusTableCellView.m
// MacPass
//
// Created by Michael Starke on 30.12.18.
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
//
#import "MPPluginStatusTableCellView.h"
@implementation MPPluginStatusTableCellView
@end

View File

@@ -111,21 +111,35 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="RMm-PO-UNp">
<tableCellView id="RMm-PO-UNp" customClass="MPPluginStatusTableCellView">
<rect key="frame" x="240" y="1" width="357" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RBa-0B-xVt">
<rect key="frame" x="0.0" y="0.0" width="357" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="RBa-0B-xVt">
<rect key="frame" x="0.0" y="0.0" width="96" height="17"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="ZIf-CU-gh7">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tVV-rz-Aff">
<rect key="frame" x="289" y="0.0" width="48" height="17"/>
<buttonCell key="cell" type="roundRect" title="Action" bezelStyle="roundedRect" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6jQ-Uk-uqD">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
</button>
</subviews>
<constraints>
<constraint firstItem="tVV-rz-Aff" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="RBa-0B-xVt" secondAttribute="trailing" constant="8" symbolic="YES" id="KPq-aq-5m6"/>
<constraint firstAttribute="trailing" secondItem="tVV-rz-Aff" secondAttribute="trailing" constant="20" symbolic="YES" id="MRd-Ov-adP"/>
<constraint firstItem="RBa-0B-xVt" firstAttribute="centerY" secondItem="RMm-PO-UNp" secondAttribute="centerY" id="V1D-iD-NGv"/>
<constraint firstItem="RBa-0B-xVt" firstAttribute="leading" secondItem="RMm-PO-UNp" secondAttribute="leading" constant="2" id="kE3-bd-GY0"/>
<constraint firstItem="tVV-rz-Aff" firstAttribute="centerY" secondItem="RMm-PO-UNp" secondAttribute="centerY" id="uxx-BA-DzR"/>
</constraints>
<connections>
<outlet property="actionButton" destination="tVV-rz-Aff" id="ikh-RO-wMJ"/>
<outlet property="textField" destination="RBa-0B-xVt" id="d6i-pV-UrO"/>
</connections>
</tableCellView>
@@ -142,7 +156,7 @@
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="400" id="gYM-eK-y5v"/>
</constraints>
<scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="ajb-Vb-WhY">
<scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="0.33333333333333331" horizontal="YES" id="ajb-Vb-WhY">
<rect key="frame" x="1" y="402" width="596" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
@@ -211,7 +225,7 @@
<constraint firstItem="bGv-Zc-Vrk" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="tk3-kF-k22"/>
<constraint firstItem="d2Q-7O-ilP" firstAttribute="leading" secondItem="fjQ-ni-Ayx" secondAttribute="trailing" constant="8" symbolic="YES" id="wHQ-Lk-2fv"/>
</constraints>
<point key="canvasLocation" x="-36" y="116"/>
<point key="canvasLocation" x="242" y="57"/>
</customView>
</objects>
</document>