/[gnustep]/gnustep/usr-apps/gworkspace/GWorkspace/FileOperations/FileOperation.m
ViewVC logotype

Diff of /gnustep/usr-apps/gworkspace/GWorkspace/FileOperations/FileOperation.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by esersale, Mon Aug 25 17:19:14 2003 UTC revision 1.5 by esersale, Sat Oct 4 14:45:18 2003 UTC
# Line 316  static NSString *nibName = @"FileOperati Line 316  static NSString *nibName = @"FileOperati
316        return;          return;  
317                  }                  }
318    }    }
319        
320      filescount = -1;
321      [executor calculateNumFiles];
322      while (filescount == -1) {
323        [[NSRunLoop currentRunLoop]
324            runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.01]];
325      }
326        
   filescount = [executor calculateNumFiles];    
327    if (showwin) {    if (showwin) {
328      [self showProgressWin];      [self showProgressWin];
329    }    }
# Line 408  static NSString *nibName = @"FileOperati Line 414  static NSString *nibName = @"FileOperati
414                                                                                                                                  NSLocalizedString(@"Continue", @""), nil, nil);                                                                                                                                  NSLocalizedString(@"Continue", @""), nil, nil);
415  }  }
416    
417    - (void)setNumFiles:(int)n
418    {
419      filescount = n;
420    }
421    
422  - (void)updateProgressIndicator  - (void)updateProgressIndicator
423  {  {
424    [progInd incrementBy: 1.0];    [progInd incrementBy: 1.0];
# Line 429  static NSString *nibName = @"FileOperati Line 440  static NSString *nibName = @"FileOperati
440          NSMutableDictionary *dict;          NSMutableDictionary *dict;
441    int i;    int i;
442            
443    notifNames = [[NSMutableArray alloc] initWithCapacity: 1];    notifNames = [NSMutableArray new];
444        
445    if ([operation isEqual: @"NSWorkspaceDuplicateOperation"]) {          if ([operation isEqual: @"NSWorkspaceDuplicateOperation"]) {      
446      for(i = 0; i < [files count]; i++) {      for(i = 0; i < [files count]; i++) {
# Line 465  static NSString *nibName = @"FileOperati Line 476  static NSString *nibName = @"FileOperati
476          [notifObj setObject: operation forKey: @"operation"];            [notifObj setObject: operation forKey: @"operation"];  
477    [notifObj setObject: source forKey: @"source"];          [notifObj setObject: source forKey: @"source"];      
478    [notifObj setObject: destination forKey: @"destination"];        [notifObj setObject: destination forKey: @"destination"];    
479    [notifObj setObject: notifNames forKey: @"files"];        
480      if (executor) {
481        NSString *procFilesStr = [executor processedFiles];
482    
483        if (procFilesStr) {
484          [notifObj setObject: [procFilesStr propertyList] forKey: @"files"];      
485          [notifObj setObject: notifNames forKey: @"origfiles"];    
486        }
487      } else {
488        [notifObj setObject: notifNames forKey: @"files"];
489        [notifObj setObject: notifNames forKey: @"origfiles"];      
490      }
491      
492    opdone = YES;                    opdone = YES;                
493    
494          [dnc postNotificationName: GWFileSystemDidChangeNotification          [dnc postNotificationName: GWFileSystemDidChangeNotification
# Line 588  static NSString *nibName = @"FileOperati Line 610  static NSString *nibName = @"FileOperati
610    TEST_RELEASE (source);    TEST_RELEASE (source);
611    TEST_RELEASE (destination);    TEST_RELEASE (destination);
612    TEST_RELEASE (files);    TEST_RELEASE (files);
613      TEST_RELEASE (procfiles);
614          [super dealloc];          [super dealloc];
615  }  }
616    
# Line 642  static NSString *nibName = @"FileOperati Line 665  static NSString *nibName = @"FileOperati
665      ASSIGN (destination, dictEntry);      ASSIGN (destination, dictEntry);
666    }      }  
667    
668    files = [[NSMutableArray alloc] initWithCapacity: 1];    files = [NSMutableArray new];
669    dictEntry = [opDict objectForKey: @"files"];    dictEntry = [opDict objectForKey: @"files"];
670    if (dictEntry != nil) {    if (dictEntry != nil) {
671      for (i = 0; i < [dictEntry count]; i++) {      for (i = 0; i < [dictEntry count]; i++) {
# Line 650  static NSString *nibName = @"FileOperati Line 673  static NSString *nibName = @"FileOperati
673      }      }
674    }                }            
675        
676      procfiles = [NSMutableArray new];
677      
678    return YES;    return YES;
679  }  }
680    
# Line 690  static NSString *nibName = @"FileOperati Line 715  static NSString *nibName = @"FileOperati
715    return NO;    return NO;
716  }  }
717    
718  - (int)calculateNumFiles  - (oneway void)calculateNumFiles
719  {  {
720          BOOL isDir;          BOOL isDir;
721    NSDirectoryEnumerator *enumerator;    NSDirectoryEnumerator *enumerator;
# Line 712  static NSString *nibName = @"FileOperati Line 737  static NSString *nibName = @"FileOperati
737            }            }
738    }    }
739    
740    return fcount;            [fileOp setNumFiles: fcount];
741  }  }
742    
743  - (oneway void)performOperation  - (oneway void)performOperation
# Line 738  static NSString *nibName = @"FileOperati Line 763  static NSString *nibName = @"FileOperati
763          }          }
764  }  }
765    
766    - (NSString *)processedFiles
767    {
768      return [procfiles description];
769    }
770    
771  #define CHECK_DONE \  #define CHECK_DONE \
772  if (![files count] || stopped) [self done]; \  if (([files count] == 0) || stopped || paused) break
 if (paused) break  
773    
774  #define GET_FILENAME filename = [files objectAtIndex: 0]  #define GET_FILENAME filename = [files objectAtIndex: 0]
775    
# Line 754  runUntilDate: [NSDate dateWithTimeInterv Line 783  runUntilDate: [NSDate dateWithTimeInterv
783  - (void)doMove  - (void)doMove
784  {  {
785    while (1) {    while (1) {
           CHECK_DONE;    
786            GET_FILENAME;                GET_FILENAME;    
787            CHECK_SAME_NAME;            CHECK_SAME_NAME;
788    
# Line 762  runUntilDate: [NSDate dateWithTimeInterv Line 790  runUntilDate: [NSDate dateWithTimeInterv
790                                    toPath: [destination stringByAppendingPathComponent: filename]                                    toPath: [destination stringByAppendingPathComponent: filename]
791                             handler: self];                             handler: self];
792    
793            [files removeObject: filename];                [procfiles addObject: filename];    
794              [files removeObject: filename];      
795        
796              CHECK_DONE;  
797      WAIT;      WAIT;
798    }                                              }
799      
800      if (([files count] == 0) || stopped) {
801        [self done];
802      }
803  }  }
804    
805  - (void)doCopy  - (void)doCopy
806  {  {
807    while (1) {    while (1) {
           CHECK_DONE;    
808            GET_FILENAME;              GET_FILENAME;  
809            CHECK_SAME_NAME;            CHECK_SAME_NAME;
810    
# Line 778  runUntilDate: [NSDate dateWithTimeInterv Line 812  runUntilDate: [NSDate dateWithTimeInterv
812                                    toPath: [destination stringByAppendingPathComponent: filename]                                    toPath: [destination stringByAppendingPathComponent: filename]
813                             handler: self];                             handler: self];
814    
815        [procfiles addObject: filename];    
816            [files removeObject: filename];                    [files removeObject: filename];        
817        
818              CHECK_DONE;  
819      WAIT;          WAIT;    
820    }                                            }
821    
822      if (([files count] == 0) || stopped) {
823        [self done];
824      }                                          
825  }  }
826    
827  - (void)doLink  - (void)doLink
828  {  {
829    while (1) {    while (1) {
           CHECK_DONE;    
830            GET_FILENAME;                GET_FILENAME;    
831            CHECK_SAME_NAME;            CHECK_SAME_NAME;
832    
# Line 794  runUntilDate: [NSDate dateWithTimeInterv Line 834  runUntilDate: [NSDate dateWithTimeInterv
834                                    toPath: [destination stringByAppendingPathComponent: filename]                                    toPath: [destination stringByAppendingPathComponent: filename]
835                       handler: self];                       handler: self];
836    
837            [files removeObject: filename];                  [procfiles addObject: filename];    
838              [files removeObject: filename];          
839        
840              CHECK_DONE;  
841      WAIT;      WAIT;
842      }
843    
844      if (([files count] == 0) || stopped) {
845        [self done];
846    }                                                }                                            
847  }  }
848    
849  - (void)doRemove  - (void)doRemove
850  {  {
851    while (1) {    while (1) {
           CHECK_DONE;    
852            GET_FILENAME;              GET_FILENAME;  
853                    
854            [fm removeFileAtPath: [destination stringByAppendingPathComponent: filename]            [fm removeFileAtPath: [destination stringByAppendingPathComponent: filename]
855                                            handler: self];                                            handler: self];
856    
857        [procfiles addObject: filename];    
858            [files removeObject: filename];                  [files removeObject: filename];      
859        
860              CHECK_DONE;  
861      WAIT;          WAIT;    
862      }
863    
864      if (([files count] == 0) || stopped) {
865        [self done];
866    }                                          }                                      
867  }  }
868    
# Line 819  runUntilDate: [NSDate dateWithTimeInterv Line 872  runUntilDate: [NSDate dateWithTimeInterv
872          NSString *newname;          NSString *newname;
873    
874    while (1) {    while (1) {
           CHECK_DONE;  
875            GET_FILENAME;              GET_FILENAME;  
876    
877            newname = [NSString stringWithString: filename];            newname = [NSString stringWithString: filename];
# Line 837  runUntilDate: [NSDate dateWithTimeInterv Line 889  runUntilDate: [NSDate dateWithTimeInterv
889                                    toPath: fulldestpath                                    toPath: fulldestpath
890                            handler: self];                            handler: self];
891    
892        [procfiles addObject: newname];      
893            [files removeObject: filename];                      [files removeObject: filename];          
894        
895              CHECK_DONE;
896      WAIT;        WAIT;  
897      }
898      
899      if (([files count] == 0) || stopped) {
900        [self done];
901    }                                                }                                            
902  }  }
903    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26