source: trunk/SapphireMultipleImporter.m @ 452

Revision 452, 2.4 KB checked in by gbooker, 7 years ago (diff)
  • Removed the pause and background callbacks to the data menu and instead the importers return an enum indicating if they skipped, imported, need to be paused, or backgrounded.
  • If an importer needed to be paused (selection menu), don't run the previous importers again when we resume.
Line 
1/*
2 * SapphireMultipleImporter.m
3 * Sapphire
4 *
5 * Created by Graham Booker on Aug. 29, 2007.
6 * Copyright 2007 Sapphire Development Team and/or www.nanopi.net
7 * All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License as published by the Free Software Foundation; either version 3 of the License,
11 * or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15 * Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with this program; if not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 */
20
21#import "SapphireMultipleImporter.h"
22
23
24@implementation SapphireMultipleImporter
25
26- (id)initWithImporters:(NSArray *)importerList
27{
28        self = [super init];
29        if(self == nil)
30                return nil;
31       
32        importers = [importerList retain];
33        importIndex = 0;
34       
35        return self;
36}
37
38- (void) dealloc
39{
40        [importers release];
41        [super dealloc];
42}
43
44- (ImportState)importMetaData:(id <SapphireFileMetaDataProtocol>)metaData
45{
46        ImportState ret = resumedState;
47        int count = [importers count];
48        for(;importIndex < count; importIndex++)
49        {
50                id <SapphireImporter> importer = [importers objectAtIndex:importIndex];
51                ImportState result = [importer importMetaData:metaData];
52                switch(result)
53                {
54                        case IMPORT_STATE_NEEDS_SUSPEND:
55                                resumedState = ret;
56                                return result;
57                        case IMPORT_STATE_BACKGROUND:
58                                ret = result;
59                                break;
60                        case IMPORT_STATE_UPDATED:
61                                if(ret != IMPORT_STATE_BACKGROUND)
62                                        ret = result;
63                                break;
64                }
65        }
66       
67        importIndex = 0;
68        resumedState = IMPORT_STATE_NOT_UPDATED;
69        return ret;
70}
71
72- (void)setImporterDataMenu:(SapphireImporterDataMenu *)theDataMenu
73{
74        [importers makeObjectsPerformSelector:@selector(setImporterDataMenu:) withObject:theDataMenu];
75}
76
77- (NSString *)completionText
78{
79        return @"";
80}
81
82- (NSString *)initialText
83{
84        return @"";
85}
86
87- (NSString *)informativeText
88{
89        return @"";
90}
91
92- (NSString *)buttonTitle
93{
94        return @"";
95}
96
97- (void) wasExhumedByPoppingController:(BRLayerController *) controller
98{
99        [importers makeObjectsPerformSelector:@selector(wasExhumedByPoppingController:) withObject:controller];
100}
101
102@end
Note: See TracBrowser for help on using the repository browser.