| Index | Submit class | Submit snippet | Submission feed | List |

BSJobList

Language: Objective-C, Author: Karsten
License: Public domain

BSJobList opens a simple window with a list of checkboxes. these checkboxes represent jobs that can be performed. each job that is checked is executed after ok is pressed. Everything is provided as a bundle so it's easy to integrate into other applications.... for more information look here: http://briksoftware.com/blog/?p=50

BSJobList source preview

//
//  BSJobList.m
//  BSJobList
//
//  Created by Karsten Kusche on 14.07.07.
//  Copyright 2007 briksoftware.com. All rights reserved.
//

#import "BSJobList.h"
#import "BSJobsWindowController.h"
#import "BSJob.h"


@implementation BSJobList

- (BOOL)askToRunJobs:(NSArray*)jobs withTitle:(NSString*)title
{
  //  loads the nib
  if ([NSBundle loadNibNamed:@"MainMenu.nib" owner:self])
  {
    // setup the window
    [winController initWithJobs: jobs];
    [[winController window] setTitle:title];
    // open the window
    NSArray* performActions = [winController askForJobs];
    // performActions is nil if cancel was pressed
    if (performActions)
    {
      NSEnumerator* performers = [performActions objectEnumerator];
      BSJob* job;
      while (job = [performers nextObject])
      {
        // run each job
        [job run];
      }
      // returns YES when ok was pressed
      return YES;
    }
  }
  // return NO when cancel was pressed
  return NO;
}

+ (BOOL)askToRunJobs:(NSArray*)jobs
{
  return [[self alloc] askToRunJobs:jobs withTitle:@"Your Options"];
}

+ (BOOL)askToRunJobs:(NSArray*)jobs withTitle:(NSString*)aTitle
{
  return [[self alloc] askToRunJobs:jobs withTitle:aTitle];
}
@end

BSJobList header preview

//
//  BSJobList.h
//  BSJobList
//
//  Created by Karsten Kusche on 14.07.07.
//  Copyright 2007 briksoftware.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface BSJobList : NSObject {
  IBOutlet id winController;
}

// jobs is a array of BSJobs

// returns YES on Ok and NO on cancel

+ (BOOL)askToRunJobs:(NSArray*)jobs;
+ (BOOL)askToRunJobs:(NSArray*)jobs withTitle:(NSString*)aTitle;

@end
Download Archive

Compatible with:


Comments

Name

Website

Do you hate spammers? (Answer "Yes")