Changeset 3645


Ignore:
Timestamp:
Oct 29, 2007, 7:45:34 PM (14 years ago)
Author:
livings124
Message:

use built-in suppression checkbox in alerts under Leopard

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r3640 r3645  
    467467                                    "Debug log alert -> informative message")];
    468468        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Debug log alert -> button")];
    469         [alert addButtonWithTitle: NSLocalizedString(@"Don't Alert Again", "Debug log alert -> button")];
    470        
    471         if ([alert runModal] == NSAlertSecondButtonReturn)
     469       
     470        BOOL onLeopard = [NSApp isOnLeopardOrBetter];
     471        if (onLeopard)
     472            [alert setShowsSuppressionButton: YES];
     473        else
     474            [alert addButtonWithTitle: NSLocalizedString(@"Don't Alert Again", "Debug log alert -> button")];
     475       
     476        NSInteger result = [alert runModal];
     477        if ((onLeopard ? [[alert suppressionButton] state] == NSOnState : result == NSAlertSecondButtonReturn))
    472478            [fDefaults setBool: NO forKey: @"WarningDebug"];
    473479        [alert release];
     
    955961            NSLocalizedString(@"The torrent file cannot be opened because it is a duplicate of an already running transfer.",
    956962                            "Open duplicate alert -> message")];
     963    [alert setAlertStyle: NSWarningAlertStyle];
    957964    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open duplicate alert -> button")];
    958     [alert addButtonWithTitle: NSLocalizedString(@"Don't Alert Again", "Open duplicate alert -> button")];
    959     [alert setAlertStyle: NSWarningAlertStyle];
    960    
    961     if ([alert runModal] == NSAlertSecondButtonReturn)
     965   
     966    BOOL onLeopard = [NSApp isOnLeopardOrBetter];
     967    if (onLeopard)
     968        [alert setShowsSuppressionButton: YES];
     969    else
     970        [alert addButtonWithTitle: NSLocalizedString(@"Don't Alert Again", "Open duplicate alert -> button")];
     971   
     972    NSInteger result = [alert runModal];
     973    if ((onLeopard ? [[alert suppressionButton] state] == NSOnState : result == NSAlertSecondButtonReturn))
    962974        [fDefaults setBool: NO forKey: @"WarningDuplicate"];
    963975    [alert release];
  • trunk/macosx/Torrent.m

    r3535 r3645  
    2424
    2525#import "Torrent.h"
     26#import "NSApplicationAdditions.h"
    2627#import "NSStringAdditions.h"
    2728
     
    492493            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
    493494            [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
    494             [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
    495495           
    496             int result = [alert runModal];
     496            #warning factor in choice with suppression
     497            BOOL onLeopard = [NSApp isOnLeopardOrBetter];
     498            if (onLeopard)
     499                [alert setShowsSuppressionButton: YES];
     500            else
     501                [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
     502
     503            NSInteger result = [alert runModal];
     504            if ((onLeopard ? [[alert suppressionButton] state] == NSOnState : result == NSAlertThirdButtonReturn))
     505                [fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
    497506            [alert release];
    498            
    499             if (result == NSAlertThirdButtonReturn)
    500                 [fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
    501507           
    502508            return result != NSAlertFirstButtonReturn;
Note: See TracChangeset for help on using the changeset viewer.