ProjectManager  0.2
FileManager.h
1 /*
2  FileManager.h
3 
4  Interface declaration of the FileManager class for the
5  ProjectManager application.
6 
7  Copyright (C) 2005 Saso Kiselkov
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 #import <Foundation/NSObject.h>
25 #import "../../ProjectModule.h"
26 
27 @class NSBrowser,
28  NSMatrix,
29  NSNotification,
30  NSMutableArray,
31  NSImage,
32  NSError;
33 
34 @protocol NSDraggingInfo,
36 
37 /*
38  * The pasteboard type used when dragging project files. The data
39  * of the pasteboard is a property list of the form:
40  * {
41  * Category = source-category;
42  * Project = project-file; <- used to distinguish dragged files
43  * within projects and from one project
44  * to another project
45  * Contents = (
46  * <list-of-filenames>
47  * );
48  * }
49  */
50 extern NSString * const ProjectFilesPboardType;
51 
66 typedef enum {
67  FMFileTypePlain,
68  FMFileTypeLink,
69  FMFileTypeCategory,
70  FMFileTypeVirtual
71 } FMFileType;
72 
73 extern NSString * const ProjectFilesDidChangeNotification;
74 
75 extern NSString * const ProjectFilesErrorDomain;
76 
77 enum {
78  ProjectFilesAlreadyExistError,
79  ProjectFilesInvalidFileTypeError,
80  ProjectFilesCreationError,
81  ProjectFilesDeletionError,
82  ProjectFilesCopyError,
83  ProjectFilesMoveError,
84  ProjectFilesGenericFileImportError
85 };
86 
87 @class ProjectBrowser,
89  NSTextField,
90  NSImageView;
91 
92 @interface FileManager : NSObject <ProjectModule>
93 {
94  id view;
95  id bogusWindow;
96 
97  ProjectBrowser * browser;
98  ProjectImageView * fileIcon;
99  NSTextField * fileNameField;
100  NSTextField * filePathField;
101  NSTextField * fileSizeField;
102  NSTextField * fileTypeField;
103  NSTextField * lastModifiedField;
104 
105  // the root category contents array
106  NSMutableArray * files;
107  id <FileManagerDelegate> delegate; // weak reference
108  ProjectDocument * document;
109 }
110 
111 - delegate;
112 
113 - (void) openFile: (id)sender;
114 
115 - (void) browser: (NSBrowser *) sender
116  createRowsForColumn: (int) column
117  inMatrix: (NSMatrix *) matrix;
118 - (NSString *) browser: (NSBrowser *)sender titleOfColumn: (int)column;
119 
120 - (void) selectFile: sender;
121 - (void) changeName: sender;
122 
123 - (void) selectAndEditNameAtPath: (NSString *) aPath;
124 
125 - (NSArray *) selectedFiles;
126 - (NSString *) containingCategory;
127 
128 - (BOOL) performDragOperation: (id <NSDraggingInfo>) sender;
129 
130 - (BOOL) openPath: (NSString *) aPath;
131 
132 /* project file/category management */
133 - (BOOL) fileExistsAtPath: (NSString *) aPath;
134 - (NSArray *) filesAtPath: (NSString *) category;
135 - (FMFileType) typeOfFileAtPath: (NSString *) aPath;
136 - (NSString *) targetOfLinkAtPath: (NSString *) aPath;
137 - (unsigned long long) measureDiskUsageAtPath: (NSString *) aPath;
138 - (NSString *) pathToFileAtPhysicalPath: (NSString *) diskLocation;
139 
140 - (NSArray *) filesAtPath: (NSString *) aCategory
141  ofType: (FMFileType) aFileType
142  recursive: (BOOL) recursive;
143 
144 - (BOOL) importFile: (NSString *) filePath
145  toPath: (NSString *) category
146  link: (BOOL) linkFlag
147  error: (NSError **) error;
148 - (BOOL) importFile: (NSString *) filePath
149  renameTo: (NSString *) aNewName
150  toPath: (NSString *) category
151  link: (BOOL) linkFlag
152  error: (NSError **) error;
153 - (BOOL) createCategory: (NSString *) categoryName
154  atPath: (NSString *) category
155  error: (NSError **) error;
156 - (BOOL) createCategoryAndIntermediateCategories: (NSString *) category
157  error: (NSError **) error;
158 - (BOOL) createVirtualFileNamed: (NSString *) filename
159  atPath: (NSString *) category
160  error: (NSError **) error;
161 
166 - (BOOL) removePath: (NSString *) aPath
167  delete: (BOOL) deleleFlag
168  error: (NSError **) error;
169 
170 - (BOOL) copyPath: (NSString *) aPath
171  toPath: (NSString *) newPath
172  error: (NSError **) error;
173 
174 - (BOOL) movePath: (NSString *) aPath
175  toPath: (NSString *) newPath
176  error: (NSError **) error;
177 
178 - (BOOL) linkPath: (NSString *) aPath
179  fromPath: (NSString *) newPath
180  error: (NSError **) error;
181 
182 - (NSImage *) iconForPath: (NSString *) aPath;
183 
184 // menu actions
185 - (void) importFiles: sender;
186 - (void) newEmptyFile: sender;
187 - (void) newFileFromTemplate: sender;
188 - (void) newCategory: sender;
189 - (void) deleteFiles: sender;
190 
191 // notifications
192 - (void) filesChanged: (NSNotification *) notif;
193 - (void) projectNameChanged: (NSNotification *) notif;
194 
195 @end
-[BundleExtensionLoader extensionsForBundleType:principalClassProtocol:bundleSubdirectory:inDomains:domainDetectionByKey:]
NSArray * extensionsForBundleType:principalClassProtocol:bundleSubdirectory:inDomains:domainDetectionByKey:(NSString *bundleFileExtension,[principalClassProtocol] Protocol *protocol,[bundleSubdirectory] NSString *subDirName,[inDomains] NSSearchPathDomainMask domainMask,[domainDetectionByKey] NSString *defaultsKey)
Searches the filesystem for extension bundles.
Definition: BundleExtensionLoader.m:159
+[ProjectModuleLoader shared]
id shared()
Returns a shared instance of a ProjectModuleLoader.
Definition: ProjectModuleLoader.m:38
+[BundleExtensionLoader shared]
id shared()
Returns a shared instance of BundleExtensionLoader.
Definition: BundleExtensionLoader.m:149
ProjectDocument
Definition: ProjectDocument.h:43
BundleExtensionLoader
Definition: BundleExtensionLoader.h:52
ProjectModule-p
This protocol declares methods which project modules must implement.
Definition: ProjectModule.h:44
FileManagerDelegate-p
This protocol declares what methods should be implemented by a FileManager delegate object.
Definition: FileManagerDelegate.h:43
ProjectModuleLoader
Definition: ProjectModuleLoader.h:31
ProjectBrowser
Definition: ProjectBrowser.h:30
FileManager
Definition: FileManager.h:92
ProjectImageView
Definition: ProjectImageView.h:28