mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
when using the Add window, if the destination and the data have the same name, give a warning stating this (should help avoid the "why can't i seed if i set the destination to the data" problems)
This commit is contained in:
parent
90f5c61327
commit
8ebe4614b2
3 changed files with 56 additions and 11 deletions
|
@ -27,17 +27,22 @@
|
||||||
#import "GroupsWindowController.h"
|
#import "GroupsWindowController.h"
|
||||||
#import "NSStringAdditions.h"
|
#import "NSStringAdditions.h"
|
||||||
#import "NSMenuAdditions.h"
|
#import "NSMenuAdditions.h"
|
||||||
|
#import "NSApplicationAdditions.h"
|
||||||
#import "ExpandedPathToIconTransformer.h"
|
#import "ExpandedPathToIconTransformer.h"
|
||||||
|
|
||||||
#define UPDATE_SECONDS 1.0
|
#define UPDATE_SECONDS 1.0
|
||||||
|
|
||||||
@interface AddWindowController (Private)
|
@interface AddWindowController (Private)
|
||||||
|
|
||||||
|
- (void) confirmAdd;
|
||||||
|
|
||||||
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) contextInfo;
|
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) contextInfo;
|
||||||
|
|
||||||
- (void) setGroupsMenu;
|
- (void) setGroupsMenu;
|
||||||
- (void) changeGroupValue: (id) sender;
|
- (void) changeGroupValue: (id) sender;
|
||||||
|
|
||||||
|
- (void) sameNameAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AddWindowController
|
@implementation AddWindowController
|
||||||
|
@ -162,17 +167,28 @@
|
||||||
|
|
||||||
- (void) add: (id) sender
|
- (void) add: (id) sender
|
||||||
{
|
{
|
||||||
[fTimer invalidate];
|
if ([[fDestination lastPathComponent] isEqualToString: [fTorrent name]]
|
||||||
fTimer = nil;
|
&& [[NSUserDefaults standardUserDefaults] boolForKey: @"WarningFolderDataSameName"])
|
||||||
|
{
|
||||||
[fTorrent setWaitToStart: [fStartCheck state] == NSOnState];
|
NSAlert * alert = [[NSAlert alloc] init];
|
||||||
[fTorrent setGroupValue: [[fGroupPopUp selectedItem] tag]];
|
[alert setMessageText: NSLocalizedString(@"The destination directory and root data directory have the same name.",
|
||||||
|
"Add torrent -> same name -> title")];
|
||||||
if ([fDeleteCheck state] == NSOnState)
|
[alert setInformativeText: NSLocalizedString(@"If you are attempting to use already existing data,"
|
||||||
[fTorrent trashTorrent];
|
" the root data directory should be inside the destination directory.", "Add torrent -> same name -> message")];
|
||||||
|
[alert setAlertStyle: NSWarningAlertStyle];
|
||||||
//ensure last, since it releases this controller
|
[alert addButtonWithTitle: NSLocalizedString(@"Cancel", "Add torrent -> same name -> button")];
|
||||||
[fController askOpenConfirmed: self add: YES];
|
[alert addButtonWithTitle: NSLocalizedString(@"Add", "Add torrent -> same name -> button")];
|
||||||
|
|
||||||
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
|
[alert setShowsSuppressionButton: YES];
|
||||||
|
else
|
||||||
|
[alert addButtonWithTitle: NSLocalizedString(@"Don't Alert Again", "Add torrent -> same name -> button")];
|
||||||
|
|
||||||
|
[alert beginSheetModalForWindow: [self window] modalDelegate: self
|
||||||
|
didEndSelector: @selector(sameNameAlertDidEnd:returnCode:contextInfo:) contextInfo: nil];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[self confirmAdd];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) cancelAdd: (id) sender
|
- (void) cancelAdd: (id) sender
|
||||||
|
@ -214,6 +230,21 @@
|
||||||
|
|
||||||
@implementation AddWindowController (Private)
|
@implementation AddWindowController (Private)
|
||||||
|
|
||||||
|
- (void) confirmAdd
|
||||||
|
{
|
||||||
|
[fTimer invalidate];
|
||||||
|
fTimer = nil;
|
||||||
|
|
||||||
|
[fTorrent setWaitToStart: [fStartCheck state] == NSOnState];
|
||||||
|
[fTorrent setGroupValue: [[fGroupPopUp selectedItem] tag]];
|
||||||
|
|
||||||
|
if ([fDeleteCheck state] == NSOnState)
|
||||||
|
[fTorrent trashTorrent];
|
||||||
|
|
||||||
|
//ensure last, since it releases this controller
|
||||||
|
[fController askOpenConfirmed: self add: YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) contextInfo
|
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) contextInfo
|
||||||
{
|
{
|
||||||
if (code == NSOKButton)
|
if (code == NSOKButton)
|
||||||
|
@ -255,4 +286,15 @@
|
||||||
fGroupValue = [sender tag];
|
fGroupValue = [sender tag];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) sameNameAlertDidEnd: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo
|
||||||
|
{
|
||||||
|
if (([NSApp isOnLeopardOrBetter] ? [[alert suppressionButton] state] == NSOnState : returnCode == NSAlertThirdButtonReturn))
|
||||||
|
[[NSUserDefaults standardUserDefaults] setBool: NO forKey: @"WarningFolderDataSameName"];
|
||||||
|
|
||||||
|
[alert release];
|
||||||
|
|
||||||
|
if (returnCode == NSAlertSecondButtonReturn)
|
||||||
|
[self performSelectorOnMainThread: @selector(confirmAdd) withObject: nil waitUntilDone: NO];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -140,6 +140,8 @@
|
||||||
<false/>
|
<false/>
|
||||||
<key>WarningDuplicate</key>
|
<key>WarningDuplicate</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>WarningFolderDataSameName</key>
|
||||||
|
<true/>
|
||||||
<key>WarningRemainingSpace</key>
|
<key>WarningRemainingSpace</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
|
@ -451,6 +451,7 @@
|
||||||
{
|
{
|
||||||
[fDefaults setBool: YES forKey: @"WarningDuplicate"];
|
[fDefaults setBool: YES forKey: @"WarningDuplicate"];
|
||||||
[fDefaults setBool: YES forKey: @"WarningRemainingSpace"];
|
[fDefaults setBool: YES forKey: @"WarningRemainingSpace"];
|
||||||
|
[fDefaults setBool: YES forKey: @"WarningFolderDataSameName"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setCheckForUpdate: (id) sender
|
- (void) setCheckForUpdate: (id) sender
|
||||||
|
|
Loading…
Reference in a new issue