# 이슈처리

192 다른 이름으로 저장 취소시 팝업 문의건
This commit is contained in:
leejinho 2020-01-30 11:03:34 +09:00
parent 81c8a2b790
commit 4e6332dccf
5 changed files with 40 additions and 15 deletions

View File

@ -603,7 +603,10 @@ ipcMain.on(
dialog
.showSaveDialog({ defaultPath: args[0] })
.then(obj => {
event.returnValue = obj.filePath;
event.returnValue = {
canceled: obj.canceled,
filePath: obj.filePath
};
})
.catch(obj => {
event.returnValue = undefined;

View File

@ -918,15 +918,19 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.nativeService
.selectSaveFilePath(value.fileInfo.fileName)
.then(result => {
if (!!result && result.length > 0) {
this.saveFile(value, result);
if (!!result && result.filePath.length > 0) {
this.saveFile(value, result.filePath);
} else {
this.snackBarService.open(
this.translateService.instant(
'common.file.errors.failToSpecifyPath'
),
this.translateService.instant('common.file.errors.label')
);
if (!!result && result.canceled) {
// ignore..
} else {
this.snackBarService.open(
this.translateService.instant(
'common.file.errors.failToSpecifyPath'
),
this.translateService.instant('common.file.errors.label')
);
}
}
})
.catch(reason => {

View File

@ -187,9 +187,18 @@ export class BrowserNativeService extends NativeService {
});
}
selectSaveFilePath(defaultPath?: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
resolve('');
selectSaveFilePath(defaultPath?: string): Promise<{
canceled: boolean,
filePath: string
}> {
return new Promise<{
canceled: boolean,
filePath: string
}>((resolve, reject) => {
resolve({
canceled: false,
filePath: ''
});
});
}

View File

@ -309,8 +309,14 @@ export class ElectronNativeService implements NativeService {
});
}
selectSaveFilePath(defaultPath?: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
selectSaveFilePath(defaultPath?: string): Promise<{
canceled: boolean,
filePath: string
}> {
return new Promise<{
canceled: boolean,
filePath: string
}>((resolve, reject) => {
try {
resolve(
this.ipcRenderer.sendSync(FileChannel.SelectSaveFilePath, defaultPath)

View File

@ -59,7 +59,10 @@ export abstract class NativeService {
abstract openTargetItem(filePath?: string): Promise<boolean>;
abstract getPath(name: NativePathName): Promise<string>;
abstract selectDirectory(): Promise<string>;
abstract selectSaveFilePath(defaultPath?: string): Promise<string>;
abstract selectSaveFilePath(defaultPath?: string): Promise<{
canceled: boolean,
filePath: string
}>;
abstract executeProcess(executableName: string): Promise<number>;