From 84a2452e7730ae498c3e6d41d8d44400b7e0eccf Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 7 Jul 2005 15:59:34 +0000 Subject: [PATCH] implemented empty trash git-svn-id: http://svn.opengroupware.org/SOGo/trunk@692 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/MailerUI/ChangeLog | 11 ++++++- SOGo/UI/MailerUI/UIxMailListView.m | 37 ++++++++++++++++++++++++ SOGo/UI/MailerUI/Version | 2 +- SOGo/UI/MailerUI/product.plist | 46 ++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 2 deletions(-) diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index 9a4c8c3f..648b8049 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,7 +1,16 @@ 2005-07-07 Helge Hess - * v0.9.129 + * v0.9.130 + + * UIxMailListView.m: implemented empty-trash action + * product.plist: added a reduced toolbar when being on the trash folder + (no reply/fwd etc, but added an empty trash button) + +2005-07-07 Helge Hess + + * v0.9.129 + * UIxMailAccountView.m: added code to better display shared accounts * UIxMailTree.m: moved IMAP4 connection string => label code to a diff --git a/SOGo/UI/MailerUI/UIxMailListView.m b/SOGo/UI/MailerUI/UIxMailListView.m index 5fe52e5b..c499e3d0 100644 --- a/SOGo/UI/MailerUI/UIxMailListView.m +++ b/SOGo/UI/MailerUI/UIxMailListView.m @@ -518,6 +518,43 @@ static int attachmentFlagSize = 8096; return [self redirectToLocation:@"view"]; } +- (id)emptyTrashAction { + // TODO: we might want to flush the caches? + NSException *error; + id client; + + if ((client = [self clientObject]) == nil) { + return [NSException exceptionWithHTTPStatus:404 /* Not Found */ + reason:@"did not find mail folder"]; + } + + if (![client isKindOfClass:NSClassFromString(@"SOGoTrashFolder")]) { + /* would be better to move the method to an own class, but well .. */ + return [NSException exceptionWithHTTPStatus:400 /* Bad Request */ + reason:@"method cannot be invoked on " + @"the specified object"]; + } + + /* mark all as deleted */ + + [self logWithFormat:@"TODO: must mark all as deleted for empty-trash"]; + + error = [[self clientObject] addFlagsToAllMessages:@"deleted"]; + if (error != nil) + // TODO: improve error + return error; + + /* expunge */ + + if ((error = [[self clientObject] expunge]) != nil) + // TODO: improve error + return error; + + if ([client respondsToSelector:@selector(flushMailCaches)]) + [client flushMailCaches]; + return [self redirectToLocation:@"view"]; +} + /* folder operations */ - (id)createFolderAction { diff --git a/SOGo/UI/MailerUI/Version b/SOGo/UI/MailerUI/Version index 91009252..7b76bee4 100644 --- a/SOGo/UI/MailerUI/Version +++ b/SOGo/UI/MailerUI/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=129 +SUBMINOR_VERSION:=130 # v0.9.100 requires libNGMime v4.5.213 # v0.9.99 requires libNGMime v4.5.212 diff --git a/SOGo/UI/MailerUI/product.plist b/SOGo/UI/MailerUI/product.plist index d8ed9bf7..50af86e7 100644 --- a/SOGo/UI/MailerUI/product.plist +++ b/SOGo/UI/MailerUI/product.plist @@ -190,6 +190,52 @@ }; }; + SOGoTrashFolder = { + /* just a new toolbar, other things come from SOGoMailFolder */ + slots = { + toolbar = { + protectedBy = "View"; + value = ( /* the toolbar groups */ + ( /* first group */ + { + link = "getMail"; + cssClass = "tbicon_getmail"; label = "Get Mail"; + }, + { + link = "#"; // "compose"; // target = "_blank"; + isSafe = NO; + onclick = "clickedCompose(this);return false;"; + cssClass = "tbicon_compose"; label = "Write"; + }, + ), + ( // third group + { link = "emptyTrash"; isSafe = NO; + enabled = clientObject.isDeleteAndExpungeAllowed; + cssClass = "tbicon_trash"; label = "Empty Trash"; }, +/* TODO: enable when implemented +// TODO: enable when delete works (#1212) + { link = "#"; isSafe = NO; + cssClass = "tbicon_delete"; label = "Delete"; }, +// TODO: enable when we know how to mark junk (#971) + { link = "#"; isSafe = NO; + cssClass = "tbicon_junk"; label = "Junk"; }, +*/ + ), + ( /* fourth group */ + { link = "#"; cssClass = "tbicon_stop"; label = "Stop"; }, + ), + ); + }; + }; + methods = { + emptyTrash = { + protectedBy = "View"; + pageName = "UIxMailListView"; + actionName = "emptyTrash"; + }; + }; + }; + SOGoMailObject = { slots = { toolbar = { -- 2.39.5