Skip to content

Commit 0697687

Browse files
committed
Add convenience initialiser to Field class for invisible fields
1 parent a14e78e commit 0697687

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

Vienna/Sources/Database/Database.m

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,7 @@ -(NSInteger)countOfUnread
452452
customizationOptions:VNAFieldCustomizationResizing],
453453
[[Field alloc] initWithName:MA_Field_GUID
454454
type:VNAFieldTypeInteger
455-
sqlField:@"message_id"
456-
displayName:nil
457-
visible:NO
458-
width:72
459-
customizationOptions:VNAFieldCustomizationResizing],
455+
sqlField:@"message_id"],
460456
[[Field alloc] initWithName:MA_Field_Subject
461457
type:VNAFieldTypeString
462458
sqlField:@"title"
@@ -491,11 +487,7 @@ -(NSInteger)countOfUnread
491487
customizationOptions:VNAFieldCustomizationAll],
492488
[[Field alloc] initWithName:MA_Field_Parent
493489
type:VNAFieldTypeInteger
494-
sqlField:@"parent_id"
495-
displayName:nil
496-
visible:NO
497-
width:72
498-
customizationOptions:VNAFieldCustomizationResizing],
490+
sqlField:@"parent_id"],
499491
[[Field alloc] initWithName:MA_Field_Author
500492
type:VNAFieldTypeString
501493
sqlField:@"sender"
@@ -546,11 +538,7 @@ -(NSInteger)countOfUnread
546538
customizationOptions:(VNAFieldCustomizationVisibility | VNAFieldCustomizationResizing)],
547539
[[Field alloc] initWithName:MA_Field_EnclosureDownloaded
548540
type:VNAFieldTypeFlag
549-
sqlField:@"enclosuredownloaded_flag"
550-
displayName:nil
551-
visible:NO
552-
width:100
553-
customizationOptions:VNAFieldCustomizationResizing],
541+
sqlField:@"enclosuredownloaded_flag"],
554542
];
555543
return _fields;
556544
}

Vienna/Sources/Database/Field.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ typedef NS_OPTIONS(NSUInteger, VNAFieldCustomizationOptions) {
4848
width:(NSInteger)width
4949
customizationOptions:(VNAFieldCustomizationOptions)customizationOptions;
5050

51+
- (instancetype)initWithName:(NSString *)name
52+
type:(VNAFieldType)type
53+
sqlField:(NSString *)sqlField;
54+
5155
/// The field name is the unlocalised display name; useful for writing to data
5256
/// files where sysName isn't appropriate.
5357
@property (copy, nonatomic) NSString *name;

Vienna/Sources/Database/Field.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ - (instancetype)initWithName:(NSString *)name
5454
return self;
5555
}
5656

57+
- (instancetype)initWithName:(NSString *)name
58+
type:(VNAFieldType)type
59+
sqlField:(NSString *)sqlField
60+
{
61+
self = [super init];
62+
if (self) {
63+
_name = [name copy];
64+
_type = type;
65+
_sqlField = [sqlField copy];
66+
}
67+
return self;
68+
}
69+
5770
// MARK: Overrides
5871

5972
- (NSString *)description

0 commit comments

Comments
 (0)