have no default value for auto-import, and instead prompt for directory when enabled
This commit is contained in:
parent
dd3257d64c
commit
92d8072c44
|
@ -1838,7 +1838,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
{
|
{
|
||||||
if ([notification isEqualToString: UKFileWatcherWriteNotification])
|
if ([notification isEqualToString: UKFileWatcherWriteNotification])
|
||||||
{
|
{
|
||||||
if (![fDefaults boolForKey: @"AutoImport"])
|
if (![fDefaults boolForKey: @"AutoImport"] || ![fDefaults stringForKey: @"AutoImportDirectory"])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fAutoImportTimer)
|
if (fAutoImportTimer)
|
||||||
|
@ -1873,10 +1873,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
|
|
||||||
- (void) checkAutoImportDirectory
|
- (void) checkAutoImportDirectory
|
||||||
{
|
{
|
||||||
if (![fDefaults boolForKey: @"AutoImport"])
|
NSString * path;
|
||||||
|
if (![fDefaults boolForKey: @"AutoImport"] || !(path = [fDefaults stringForKey: @"AutoImportDirectory"]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString * path = [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath];
|
path = [path stringByExpandingTildeInPath];
|
||||||
|
|
||||||
NSArray * importedNames;
|
NSArray * importedNames;
|
||||||
if (!(importedNames = [[NSFileManager defaultManager] directoryContentsAtPath: path]))
|
if (!(importedNames = [[NSFileManager defaultManager] directoryContentsAtPath: path]))
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
<dict>
|
<dict>
|
||||||
<key>AutoImport</key>
|
<key>AutoImport</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>AutoImportDirectory</key>
|
|
||||||
<string>~/Desktop</string>
|
|
||||||
<key>AutoSize</key>
|
<key>AutoSize</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>AutoStartDownload</key>
|
<key>AutoStartDownload</key>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>153</key>
|
<key>153</key>
|
||||||
<string>294 444 563 268 0 0 1152 842 </string>
|
<string>206 273 563 268 0 0 1152 842 </string>
|
||||||
<key>28</key>
|
<key>28</key>
|
||||||
<string>294 421 563 313 0 0 1152 842 </string>
|
<string>294 421 563 313 0 0 1152 842 </string>
|
||||||
<key>41</key>
|
<key>41</key>
|
||||||
|
@ -23,8 +23,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>28</integer>
|
<integer>41</integer>
|
||||||
<integer>153</integer>
|
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>8P135</string>
|
<string>8P135</string>
|
||||||
|
|
Binary file not shown.
|
@ -66,9 +66,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//set auto import
|
//set auto import
|
||||||
if ([fDefaults boolForKey: @"AutoImport"])
|
NSString * autoPath;
|
||||||
[[UKKQueue sharedFileWatcher] addPath:
|
if ([fDefaults boolForKey: @"AutoImport"] && (autoPath = [fDefaults stringForKey: @"AutoImportDirectory"]))
|
||||||
[[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath]];
|
[[UKKQueue sharedFileWatcher] addPath: [autoPath stringByExpandingTildeInPath]];
|
||||||
|
|
||||||
//set bind port
|
//set bind port
|
||||||
int bindPort = [fDefaults integerForKey: @"BindPort"];
|
int bindPort = [fDefaults integerForKey: @"BindPort"];
|
||||||
|
@ -536,13 +536,19 @@
|
||||||
|
|
||||||
- (void) setAutoImport: (id) sender
|
- (void) setAutoImport: (id) sender
|
||||||
{
|
{
|
||||||
NSString * path = [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath];
|
NSString * path;
|
||||||
if ([fDefaults boolForKey: @"AutoImport"])
|
if ((path = [fDefaults stringForKey: @"AutoImportDirectory"]))
|
||||||
[[UKKQueue sharedFileWatcher] addPath: path];
|
{
|
||||||
|
path = [path stringByExpandingTildeInPath];
|
||||||
|
if ([fDefaults boolForKey: @"AutoImport"])
|
||||||
|
[[UKKQueue sharedFileWatcher] addPath: path];
|
||||||
|
else
|
||||||
|
[[UKKQueue sharedFileWatcher] removePathFromQueue: path];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
[[UKKQueue sharedFileWatcher] removePathFromQueue: path];
|
[self importFolderSheetShow: nil];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) importFolderSheetShow: (id) sender
|
- (void) importFolderSheetShow: (id) sender
|
||||||
|
@ -654,17 +660,22 @@
|
||||||
|
|
||||||
- (void) importFolderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info
|
- (void) importFolderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info
|
||||||
{
|
{
|
||||||
|
NSString * path = [fDefaults stringForKey: @"AutoImportDirectory"];
|
||||||
if (code == NSOKButton)
|
if (code == NSOKButton)
|
||||||
{
|
{
|
||||||
UKKQueue * sharedQueue = [UKKQueue sharedFileWatcher];
|
UKKQueue * sharedQueue = [UKKQueue sharedFileWatcher];
|
||||||
[sharedQueue removePathFromQueue: [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath]];
|
if (path)
|
||||||
|
[sharedQueue removePathFromQueue: [path stringByExpandingTildeInPath]];
|
||||||
|
|
||||||
[fDefaults setObject: [[openPanel filenames] objectAtIndex: 0] forKey: @"AutoImportDirectory"];
|
path = [[openPanel filenames] objectAtIndex: 0];
|
||||||
|
[fDefaults setObject: path forKey: @"AutoImportDirectory"];
|
||||||
[sharedQueue addPath: [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath]];
|
[sharedQueue addPath: [path stringByExpandingTildeInPath]];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoImportSettingChange" object: self];
|
||||||
}
|
}
|
||||||
|
else if (!path)
|
||||||
|
[fDefaults setBool: NO forKey: @"AutoImport"];
|
||||||
|
|
||||||
[fImportFolderPopUp selectItemAtIndex: 0];
|
[fImportFolderPopUp selectItemAtIndex: 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue