2014-01-09 16:23:54 +00:00
|
|
|
//
|
|
|
|
// ShareToolbarItem.m
|
|
|
|
// Transmission
|
|
|
|
//
|
|
|
|
// Created by Mitchell Livingston on 1/8/14.
|
|
|
|
// Copyright (c) 2014 The Transmission Project. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "ShareToolbarItem.h"
|
2014-01-10 17:50:05 +00:00
|
|
|
#import "ShareTorrentFileHelper.h"
|
2014-01-09 16:23:54 +00:00
|
|
|
#import "NSApplicationAdditions.h"
|
|
|
|
|
|
|
|
@implementation ShareToolbarItem
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (NSMenuItem*)menuFormRepresentation
|
2014-01-09 16:23:54 +00:00
|
|
|
{
|
2021-08-15 09:41:48 +00:00
|
|
|
NSMenuItem* menuItem = [[NSMenuItem alloc] initWithTitle:self.label action:nil keyEquivalent:@""];
|
|
|
|
menuItem.enabled = [self.target validateToolbarItem:self];
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
if (menuItem.enabled)
|
|
|
|
{
|
|
|
|
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle:@""];
|
|
|
|
for (NSMenuItem* item in ShareTorrentFileHelper.sharedHelper.menuItems)
|
2014-01-09 16:23:54 +00:00
|
|
|
{
|
|
|
|
[servicesMenu addItem:item];
|
|
|
|
}
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2021-08-07 07:27:56 +00:00
|
|
|
menuItem.submenu = servicesMenu;
|
2014-01-09 16:23:54 +00:00
|
|
|
}
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2014-01-09 16:23:54 +00:00
|
|
|
return menuItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|