1 |
/* FileOperation.h |
2 |
* |
3 |
* Copyright (C) 2003 Free Software Foundation, Inc. |
4 |
* |
5 |
* Author: Enrico Sersale <enrico@imago.ro> |
6 |
* Date: August 2001 |
7 |
* |
8 |
* This file is part of the GNUstep GWorkspace application |
9 |
* |
10 |
* This program is free software; you can redistribute it and/or modify |
11 |
* it under the terms of the GNU General Public License as published by |
12 |
* the Free Software Foundation; either version 2 of the License, or |
13 |
* (at your option) any later version. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
*/ |
24 |
|
25 |
#ifndef FILEOPERATION_H |
26 |
#define FILEOPERATION_H |
27 |
|
28 |
#include <Foundation/NSObject.h> |
29 |
|
30 |
@class NSString; |
31 |
@class NSMutableArray; |
32 |
@class NSMutableDictionary; |
33 |
@class NSFileManager; |
34 |
@class NSTimer; |
35 |
@class NSLock; |
36 |
@class GWorkspace; |
37 |
@class FileOpExecutor; |
38 |
|
39 |
@protocol FileOpProtocol |
40 |
|
41 |
- (void)registerExecutor:(id)anObject; |
42 |
|
43 |
- (int)requestUserConfirmationWithMessage:(NSString *)message |
44 |
title:(NSString *)title; |
45 |
|
46 |
- (int)showErrorAlertWithMessage:(NSString *)message; |
47 |
|
48 |
- (void)setNumFiles:(int)n; |
49 |
|
50 |
- (void)updateProgressIndicator; |
51 |
|
52 |
- (int)sendDidChangeNotification; |
53 |
|
54 |
- (void)endOperation; |
55 |
|
56 |
@end |
57 |
|
58 |
@protocol FileOpExecutorProtocol |
59 |
|
60 |
+ (void)setPorts:(NSArray *)thePorts; |
61 |
|
62 |
- (void)setFileop:(NSArray *)thePorts; |
63 |
|
64 |
- (BOOL)setOperation:(NSDictionary *)opDict; |
65 |
|
66 |
- (BOOL)checkSameName; |
67 |
|
68 |
- (oneway void)calculateNumFiles; |
69 |
|
70 |
- (oneway void)performOperation; |
71 |
|
72 |
- (NSString *)processedFiles; |
73 |
|
74 |
- (void)Pause; |
75 |
|
76 |
- (void)Stop; |
77 |
|
78 |
- (BOOL)isPaused; |
79 |
|
80 |
- (void)done; |
81 |
|
82 |
@end |
83 |
|
84 |
@interface FileOperation: NSObject <FileOpProtocol> |
85 |
{ |
86 |
NSString *operation; |
87 |
NSString *source; |
88 |
NSString *destination; |
89 |
NSMutableArray *files; |
90 |
NSMutableDictionary *operationDict; |
91 |
NSMutableArray *notifNames; |
92 |
int fileOperationRef; |
93 |
int filescount; |
94 |
BOOL confirm; |
95 |
BOOL showwin; |
96 |
BOOL opdone; |
97 |
NSConnection *execconn; |
98 |
id <FileOpExecutorProtocol> executor; |
99 |
NSTimer *timer; |
100 |
NSNotificationCenter *dnc; |
101 |
NSFileManager *fm; |
102 |
GWorkspace *gw; |
103 |
|
104 |
IBOutlet id win; |
105 |
IBOutlet id fromLabel; |
106 |
IBOutlet id fromField; |
107 |
IBOutlet id toLabel; |
108 |
IBOutlet id toField; |
109 |
IBOutlet id progInd; |
110 |
IBOutlet id pauseButt; |
111 |
IBOutlet id stopButt; |
112 |
} |
113 |
|
114 |
- (id)initWithOperation:(NSString *)opr |
115 |
source:(NSString *)src |
116 |
destination:(NSString *)dest |
117 |
files:(NSArray *)fls |
118 |
useConfirmation:(BOOL)conf |
119 |
showWindow:(BOOL)showw |
120 |
windowRect:(NSRect)wrect; |
121 |
|
122 |
- (void)checkExecutor:(id)sender; |
123 |
|
124 |
- (BOOL)showFileOperationAlert; |
125 |
|
126 |
- (void)showProgressWin; |
127 |
|
128 |
- (void)sendWillChangeNotification; |
129 |
|
130 |
- (IBAction)pause:(id)sender; |
131 |
|
132 |
- (IBAction)stop:(id)sender; |
133 |
|
134 |
- (int)fileOperationRef; |
135 |
|
136 |
- (NSRect)winRect; |
137 |
|
138 |
- (BOOL)showsWindow; |
139 |
|
140 |
@end |
141 |
|
142 |
|
143 |
@interface FileOpExecutor: NSObject <FileOpExecutorProtocol> |
144 |
{ |
145 |
NSString *operation; |
146 |
NSString *source; |
147 |
NSString *destination; |
148 |
NSMutableArray *files; |
149 |
NSMutableArray *procfiles; |
150 |
NSString *filename; |
151 |
int fcount; |
152 |
BOOL stopped; |
153 |
BOOL paused; |
154 |
BOOL canupdate; |
155 |
BOOL samename; |
156 |
NSFileManager *fm; |
157 |
NSConnection *fopConn; |
158 |
id <FileOpProtocol> fileOp; |
159 |
} |
160 |
|
161 |
- (void)doMove; |
162 |
|
163 |
- (void)doCopy; |
164 |
|
165 |
- (void)doLink; |
166 |
|
167 |
- (void)doRemove; |
168 |
|
169 |
- (void)doDuplicate; |
170 |
|
171 |
- (void)removeExisting:(NSString *)fname; |
172 |
|
173 |
@end |
174 |
|
175 |
#endif // FILEOPERATION_H |