mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 04:15:26 +00:00
@@ -3,6 +3,7 @@
|
||||
/* Icon's label */
|
||||
"Create" = "Create";
|
||||
"Empty Trash" = "Empty Trash";
|
||||
"Empty Junk Folder" = "Empty Junk Folder";
|
||||
"Delete" = "Delete";
|
||||
"Expunge" = "Expunge";
|
||||
"Forward" = "Forward";
|
||||
@@ -73,8 +74,13 @@
|
||||
"An error occured while communicating with the mail server" = "An error occured while communicating with the mail server";
|
||||
|
||||
/* Mailbox actions */
|
||||
|
||||
/* Compact Folder success message */
|
||||
"Folder compacted" = "Folder compacted";
|
||||
|
||||
/* Empty Junk Folder success message */
|
||||
"Junk folder emptied" = "Junk folder emptied";
|
||||
|
||||
/* Empty Trash success message */
|
||||
"Trash emptied" = "Trash emptied";
|
||||
|
||||
@@ -387,6 +393,12 @@
|
||||
"Send Anyway" = "Send Anyway";
|
||||
"Error while saving the draft" = "Error while saving the draft";
|
||||
|
||||
/* Error when emptying trash */
|
||||
"Unable to empty the trash folder." = "Unable to empty the trash folder.";
|
||||
|
||||
/* Error when emptying junk folder */
|
||||
"Unable to empty the junk folder." = "Unable to empty the junk folder.";
|
||||
|
||||
/* Error when uploading a file attachment */
|
||||
"Error while uploading the file \"%{0}\":" = "Error while uploading the file \"%{0}\":";
|
||||
"There is an active file upload. Closing the window will interrupt it." = "There is an active file upload. Closing the window will interrupt it.";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* UIxMailFolderActions.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007-2016 Inverse inc.
|
||||
* Copyright (C) 2007-2021 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,7 +33,9 @@
|
||||
- (WOResponse *) batchDeleteAction;
|
||||
- (WOResponse *) saveMessagesAction;
|
||||
- (WOResponse *) expungeAction;
|
||||
- (WOResponse *) emptyJunkAction;
|
||||
- (WOResponse *) emptyTrashAction;
|
||||
- (WOResponse *) emptySpecialFolderAction: (NSString *) folderType;
|
||||
- (WOResponse *) subscribeAction;
|
||||
- (WOResponse *) unsubscribeAction;
|
||||
- (id <WOActionResults>) getLabelsAction;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
|
||||
#import <Mailer/SOGoMailAccount.h>
|
||||
#import <Mailer/SOGoMailFolder.h>
|
||||
#import <Mailer/SOGoTrashFolder.h>
|
||||
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
@@ -876,15 +877,25 @@
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WOResponse *) emptyJunkAction
|
||||
{
|
||||
return [self emptySpecialFolderAction: @"junk"];
|
||||
}
|
||||
|
||||
- (WOResponse *) emptyTrashAction
|
||||
{
|
||||
return [self emptySpecialFolderAction: @"trash"];
|
||||
}
|
||||
|
||||
- (WOResponse *) emptySpecialFolderAction: (NSString *) folderType
|
||||
{
|
||||
NSException *error;
|
||||
SOGoTrashFolder *co;
|
||||
SOGoSpecialMailFolder *co;
|
||||
SOGoMailAccount *account;
|
||||
NSEnumerator *subfolders;
|
||||
WOResponse *response;
|
||||
NGImap4Connection *connection;
|
||||
NSString *currentName;
|
||||
NSString *currentName, *errorMsg;
|
||||
NSDictionary *data;
|
||||
|
||||
id quota;
|
||||
@@ -909,7 +920,8 @@
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
data = [NSDictionary dictionaryWithObject: [self labelForKey: @"Unable to empty the trash folder." inContext: context]
|
||||
errorMsg = [NSString stringWithFormat: @"Unable to empty the %@ folder.", folderType];
|
||||
data = [NSDictionary dictionaryWithObject: [self labelForKey: errorMsg inContext: context]
|
||||
forKey: @"message"];
|
||||
response = [self responseWithStatus: 500 andJSONRepresentation: data];
|
||||
}
|
||||
|
||||
@@ -161,6 +161,23 @@
|
||||
};
|
||||
};
|
||||
|
||||
SOGoJunkFolder = {
|
||||
/* just a new toolbar, other things come from SOGoMailFolder */
|
||||
slots = {
|
||||
toolbar = {
|
||||
protectedBy = "View";
|
||||
value = "SOGoMailFolder.toolbar";
|
||||
};
|
||||
};
|
||||
methods = {
|
||||
emptyJunk = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxMailFolderActions";
|
||||
actionName = "emptyJunk";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
SOGoTrashFolder = {
|
||||
/* just a new toolbar, other things come from SOGoMailFolder */
|
||||
slots = {
|
||||
|
||||
@@ -659,15 +659,16 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $emptyTrash
|
||||
* @function $empty
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Empty the Trash folder.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Mailbox.prototype.$emptyTrash = function() {
|
||||
var _this = this;
|
||||
Mailbox.prototype.$empty = function() {
|
||||
var _this = this,
|
||||
action = 'empty' + this.type[0].capitalize() + this.type.substring(1);
|
||||
|
||||
return Mailbox.$$resource.post(this.id, 'emptyTrash').then(function(data) {
|
||||
return Mailbox.$$resource.post(this.id, action).then(function(data) {
|
||||
// Remove all messages from the mailbox
|
||||
_this.$messages = _this.$visibleMessages = [];
|
||||
_this.uidsMap = {};
|
||||
|
||||
@@ -258,11 +258,19 @@
|
||||
});
|
||||
};
|
||||
|
||||
this.emptyJunkFolder = function() {
|
||||
return this.emptyFolder(l('Junk folder emptied'));
|
||||
};
|
||||
|
||||
this.emptyTrashFolder = function() {
|
||||
this.folder.$emptyTrash().then(function() {
|
||||
return this.emptyFolder(l('Trash emptied'));
|
||||
};
|
||||
|
||||
this.emptyFolder = function(successMsg) {
|
||||
this.folder.$empty().then(function() {
|
||||
$mdToast.show(
|
||||
$mdToast.simple()
|
||||
.textContent(l('Trash emptied'))
|
||||
.textContent(successMsg)
|
||||
.position('top right')
|
||||
.hideDelay(3000));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user