mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +08:00
Merge branch 'master' of https://github.com/Foundry376/Mailspring
This commit is contained in:
commit
86734a54f1
3 changed files with 25 additions and 3 deletions
|
@ -78,7 +78,13 @@ class SystemTrayManager {
|
|||
|
||||
_onClick = () => {
|
||||
if (this._platform !== 'darwin') {
|
||||
this._application.emit('application:show-main-window');
|
||||
if(this._application.windowManager.getVisibleWindowCount() == 0) {
|
||||
this._application.emit('application:show-main-window');
|
||||
}
|
||||
else {
|
||||
const visibleWindows = this._application.windowManager.getVisibleWindows();
|
||||
visibleWindows.forEach(window => window.hide());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -56,6 +56,22 @@ export default class WindowManager {
|
|||
return this.getOpenWindows().length;
|
||||
}
|
||||
|
||||
getVisibleWindows() {
|
||||
const values = [];
|
||||
Object.keys(this._windows).forEach(key => {
|
||||
const win = this._windows[key];
|
||||
if (win.isVisible()) {
|
||||
values.push(win);
|
||||
}
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
getVisibleWindowCount() {
|
||||
return this.getVisibleWindows().length;
|
||||
}
|
||||
|
||||
getAllWindowDimensions() {
|
||||
const dims = {};
|
||||
Object.keys(this._windows).forEach(key => {
|
||||
|
|
|
@ -447,8 +447,8 @@ class AttachmentStore extends MailspringStore {
|
|||
const stats = await this._getFileStats(filePath);
|
||||
if (stats.isDirectory()) {
|
||||
throw new Error(`${filename} is a directory. Try compressing it and attaching it again.`);
|
||||
} else if (stats.size > 15 * 1000000) {
|
||||
throw new Error(`${filename} cannot be attached because it is larger than 5MB.`);
|
||||
} else if (stats.size > 25 * 1000000) {
|
||||
throw new Error(`${filename} cannot be attached because it is larger than 25MB.`);
|
||||
}
|
||||
|
||||
const file = new File({
|
||||
|
|
Loading…
Reference in a new issue