]> err.no Git - scalable-opengroupware.org/commitdiff
partially implemented mail delete #1212
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 28 Jan 2005 17:04:53 +0000 (17:04 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 28 Jan 2005 17:04:53 +0000 (17:04 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@504 d1b88da0-ebda-0310-925b-ed51d893ca5b

18 files changed:
SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/SOGoMailAccount.h
SOGo/SoObjects/Mailer/SOGoMailAccount.m
SOGo/SoObjects/Mailer/SOGoMailFolder.m
SOGo/SoObjects/Mailer/SOGoMailManager.h
SOGo/SoObjects/Mailer/SOGoMailManager.m
SOGo/SoObjects/Mailer/SOGoMailObject.m
SOGo/SoObjects/Mailer/Version
SOGo/SoObjects/SOGo/SOGoObject.m
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxMailEditor.m
SOGo/UI/Mailer/UIxMailListView.m
SOGo/UI/Mailer/UIxMailListView.wox
SOGo/UI/Mailer/UIxMailView.m
SOGo/UI/Mailer/UIxMailView.wox
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/mailer.css
SOGo/UI/Mailer/product.plist

index 6e87c5bb90e3d42dda11c5a520864f68959ee95b..93da62fa665f974a2d024de05801399f843066de 100644 (file)
@@ -1,5 +1,18 @@
 2005-01-28  Helge Hess  <helge.hess@skyrix.com>
-       
+
+       * v0.9.58
+
+       * SOGoMailObject.m: implemented a simple delete by setting the IMAP4
+         delete flag
+
+       * SOGoMailManager.m: added method to mark a message deleted
+
+       * SOGoMailFolder.m: just override -delete instead of implementing
+         -DELETAction: directrly
+
+       * SOGoMailAccount.m: added ability to retrieve Sent/Trash and INBOX
+         special mail folders
+
        * v0.9.57
        
        * SOGoMailBodyPart.m: enhanced lookup to allow for arbitary filenames
index 2a19c958e0153b4393d73bef39ed1fc2c0b4b086..20c30d6d9aa12f59e086f493aafcbeead58ca6d9 100644 (file)
 */
 
 @class NSArray;
+@class SOGoMailFolder;
 
 @interface SOGoMailAccount : SOGoMailBaseObject
 {
+  SOGoMailFolder *inboxFolder;
+  SOGoMailFolder *sentFolder;
+  SOGoMailFolder *trashFolder;
 }
 
 - (NSArray *)allFolderPathes;
 
+/* special folders */
+
+- (SOGoMailFolder *)inboxFolderInContext:(id)_ctx;
+- (SOGoMailFolder *)sentFolderInContext:(id)_ctx;
+- (SOGoMailFolder *)trashFolderInContext:(id)_ctx;
+
 @end
 
 #endif /* __Mailer_SOGoMailAccount_H__ */
index bc3c00317261064f64de49774a44f683fd710db8..1e3c67411a9d64a997e0dae6f73275e95cffa4bd 100644 (file)
@@ -142,6 +142,63 @@ static NSString *sieveFolderName  = @"Filters";
   return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
 }
 
+/* special folders */
+
+- (SOGoMailFolder *)inboxFolderInContext:(id)_ctx {
+  // TODO: use some profile to determine real location
+  SOGoMailFolder *folder;
+  
+  if (self->inboxFolder != nil)
+    return self->inboxFolder;
+  
+  folder = [self lookupName:@"INBOX" inContext:_ctx acquire:NO];
+  if ([folder isKindOfClass:[NSException class]]) return folder;
+  
+  return ((self->inboxFolder = [folder retain]));
+}
+
+- (SOGoMailFolder *)sentFolderInContext:(id)_ctx {
+  // TODO: use some profile to determine real location
+  SOGoMailFolder *folder;
+  
+  if (self->sentFolder != nil)
+    return self->sentFolder;
+  
+  folder = [self inboxFolderInContext:_ctx];
+  if ([folder isKindOfClass:[NSException class]]) return folder;
+  
+  folder = [folder lookupName:@"Sent" inContext:_ctx acquire:NO];
+  if ([folder isKindOfClass:[NSException class]]) return folder;
+  
+  if (![folder isNotNull]) {
+    return [NSException exceptionWithHTTPStatus:404 /* not found */
+                       reason:@"did not find Sent folder!"];
+  }
+  
+  return ((self->sentFolder = [folder retain]));
+}
+
+- (SOGoMailFolder *)trashFolderInContext:(id)_ctx {
+  // TODO: use some profile to determine real location
+  SOGoMailFolder *folder;
+  
+  if (self->trashFolder != nil)
+    return self->trashFolder;
+
+  folder = [self inboxFolderInContext:_ctx];
+  if ([folder isKindOfClass:[NSException class]]) return folder;
+  
+  folder = [folder lookupName:@"Trash" inContext:_ctx acquire:NO];
+  if ([folder isKindOfClass:[NSException class]]) return folder;
+  
+  if (![folder isNotNull]) {
+    return [NSException exceptionWithHTTPStatus:404 /* not found */
+                       reason:@"did not find Trash folder!"];
+  }
+  
+  return ((self->trashFolder = [folder retain]));
+}
+
 /* WebDAV */
 
 - (BOOL)davIsCollection {
index 5b5d87c38a26738216a7c498954808d2de48b412..05b2d905d44c88b81da4bd1ae8e4a3f9a4df2414 100644 (file)
                             password:[self imap4Password]];
 }
 
-- (id)DELETEAction:(id)_ctx {
-  id result;
-  
-  result = [[self mailManager] deleteMailboxAtURL:[self imap4URL]
-                              password:[self imap4Password]];
-  if (result != nil)
-    return result;
-  
-  return [NSNumber numberWithBool:YES];
+/* operations */
+
+- (NSException *)delete {
+  /* Note: overrides SOGoObject -delete */
+  return [[self mailManager] deleteMailboxAtURL:[self imap4URL]
+                            password:[self imap4Password]];
 }
 
 @end /* SOGoMailFolder */
index baa3bcbc2d6e830f59a82f83062ad5b543c4cca3..0888bf84a9bbfc2b204ab7b7d3857a09fb1619d5 100644 (file)
@@ -71,6 +71,7 @@
 
 - (NSException *)addFlags:(id)_f    toURL:(NSURL *)_u password:(NSString *)_p;
 - (NSException *)removeFlags:(id)_f toURL:(NSURL *)_u password:(NSString *)_p;
+- (NSException *)markURLDeleted:(NSURL *)_u           password:(NSString *)_p;
 
 - (NSException *)postData:(NSData *)_data flags:(id)_flags
   toFolderURL:(NSURL *)_url password:(NSString *)_p;
index 633504b85f92afac462bf66c0054d479ad927c57..3bdbfe7e0de668c6041a86df3320137556c8ad0e 100644 (file)
 #include "SOGoMailConnectionEntry.h"
 #include "common.h"
 
-// TODO: need a way to refresh caches on get mail!
+/*
+  Could check read-write state:
+    dict = [[self->context client] select:[self absoluteName]];
+    self->isReadOnly = 
+      [[dict objectForKey:@"access"] isEqualToString:@"READ-WRITE"]
+      ? NoNumber : YesNumber;
+*/
 
 @implementation SOGoMailManager
 
@@ -616,6 +622,10 @@ static NSString       *imap4Separator  = nil;
   return [self addOrRemove:NO flags:_f toURL:_u password:_p];
 }
 
+- (NSException *)markURLDeleted:(NSURL *)_url password:(NSString *)_p {
+  return [self addOrRemove:YES flags:@"Deleted" toURL:_url password:_p];
+}
+
 - (NSException *)postData:(NSData *)_data flags:(id)_f
   toFolderURL:(NSURL *)_url password:(NSString *)_p
 {
index 4194cda3d8a5928a618194e90f24dc0608be8972..4315009163b75dd176d7c9dc3d3e45b0faa5abd1 100644 (file)
@@ -335,4 +335,12 @@ static BOOL heavyDebug = NO;
   return r;
 }
 
+/* operations */
+
+- (NSException *)delete {
+  // TODO: copy to Trash folder
+  return [[self mailManager] markURLDeleted:[self imap4URL] 
+                            password:[self imap4Password]];
+}
+
 @end /* SOGoMailObject */
index 20b1dd206e45bdf89ca7a0c954817c1d103f2c2c..6d5b940ec4ce8b24601af377634efc1fa4b263d2 100644 (file)
@@ -1,6 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=57
+SUBMINOR_VERSION:=58
 
 # v0.9.55 requires NGExtensions v4.5.136
 # v0.9.44 requires libNGMime    v4.3.194
index f7b1c080bdd427d875612409467213f1172b1bcf..c871f4509a8883a669915090c93e50e5f9bba4ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2004 SKYRIX Software AG
+  Copyright (C) 2004-2005 SKYRIX Software AG
 
   This file is part of OpenGroupware.org.
 
@@ -18,7 +18,6 @@
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 #include "SOGoObject.h"
 #include "SOGoUserFolder.h"
index e76c3e97bfc48397d38d7f0b0edaf718ff3a1f98..6cd64481b1bbf7cfd7c10db02c6e9c89b2df22c4 100644 (file)
@@ -1,5 +1,15 @@
 2005-01-28  Helge Hess  <helge.hess@skyrix.com>
 
+       * v0.9.78
+
+       * UIxMailListView.m: properly mark deleted mails using line-through
+
+       * UIxMailView.m: close mail viewer if mail delete was successful
+
+       * mailer.css: added style classes for deleted cells
+
+       * UIxMailEditor.m: moved some Sent folder lookup to SOGoMailAccount
+
        * v0.9.77
 
        * added UIxMailSizeFormatter to render big file size numbers with some
index 57a04567b1e451327d2fb353cc5add60e97a645f..b6954df49d70438023449597524c181c91914ffb 100644 (file)
@@ -159,11 +159,6 @@ static NSArray *infoKeys = nil;
 }
 
 - (id)lookupSentFolder {
-  /* 
-     Lookup INBOX/Sent folder. This must be in the UI layer, because the Sent
-     folder could be a user defined folder (so we cannot have a simple
-     -saveToSent action on the SOGoDraftObject).
-  */
   SOGoMailAccount *account;
   SOGoMailFolder  *folder;
   
@@ -173,19 +168,9 @@ static NSArray *infoKeys = nil;
   account = [[self clientObject] mailAccountFolder];
   if ([account isKindOfClass:[NSException class]]) return account;
   
-  folder = [account lookupName:@"INBOX" inContext:[self context] acquire:NO];
-  if ([folder isKindOfClass:[NSException class]]) return folder;
-  
-  folder = [folder lookupName:@"Sent" inContext:[self context] acquire:NO];
+  folder = [account sentFolderInContext:[self context]];
   if ([folder isKindOfClass:[NSException class]]) return folder;
-
-  if (![folder isNotNull]) {
-    return [NSException exceptionWithHTTPStatus:500 /* server error */
-                       reason:@"did not find Sent folder!"];
-  }
-  
-  self->sentFolder = [folder retain];
-  return self->sentFolder;
+  return ((self->sentFolder = [folder retain]));
 }
 
 - (NSException *)storeMailInSentFolder:(NSString *)_path {
@@ -254,7 +239,8 @@ static NSArray *infoKeys = nil;
   if (![self _saveFormInfo])
     return [self failedToSaveFormResponse];
   
-  /* save mail to file (so that we can upload the mail to Cyrus */
+  /* save mail to file (so that we can upload the mail to Cyrus) */
+  // TODO: all this could be handled by the SOGoDraftObject?
   
   mailPath = [[self clientObject] saveMimeMessageToTemporaryFile];
   
index ca08bb2c66c3414be7df4d190cd1b3485286dd95..09c7338d63e9e367e8d174801dde13c3d8ee43c0 100644 (file)
@@ -84,6 +84,13 @@ static int attachmentFlagSize = 8096;
 
 /* derived accessors */
 
+- (BOOL)isMessageDeleted {
+  NSArray *flags;
+  
+  flags = [[self message] valueForKey:@"flags"];
+  return [flags containsObject:@"deleted"];
+}
+
 - (BOOL)isMessageRead {
   NSArray *flags;
   
@@ -94,6 +101,17 @@ static int attachmentFlagSize = 8096;
   return [[[self message] valueForKey:@"uid"] stringValue];
 }
 
+- (NSString *)messageSubjectStyleClass {
+  return [self isMessageRead]
+    ? @"mailer_readmailsubject"
+    : @"mailer_unreadmailsubject";
+}
+- (NSString *)messageCellStyleClass {
+  return [self isMessageDeleted]
+    ? @"mailer_listcell_deleted"
+    : @"mailer_listcell_regular";
+}
+
 - (BOOL)hasMessageAttachment {
   /* we detect attachments by size ... */
   unsigned size;
index 2c7ebeca4894fadbb88e7389f6fae8322dbccdbd..6b550ec1ca86bdc25806485ddd34e6c6acf7fe52 100644 (file)
               />
 -->
             </td>
-            <td>
-              <var:if condition="isMessageRead">
-                <div class="mailer_readmailsubject" var:id="msgDivID"
-                >
-                  <!-- Note: var:href="messageViewURL" (done by JS),
-                             var:target="messageViewTarget" -->
-                  <a href="#" var:onclick="clickedMsgJS">
-                    <var:string value="message.envelope.subject"
-                                formatter="context.mailSubjectFormatter"/>
-                  </a>
-                </div>
-              </var:if>
-              <var:if condition="isMessageRead" const:negate="YES">
-                <div class="mailer_unreadmailsubject" var:id="msgDivID">
-                  <!-- Note: var:href="messageViewURL" (done by JS) -->
-                  <a href="#" var:onclick="clickedMsgJS">
-                    <var:string value="message.envelope.subject"
-                                formatter="context.mailSubjectFormatter"/>
-                  </a>
-                </div>
-              </var:if>
+            <td var:class="messageCellStyleClass">
+              <div var:class="messageSubjectStyleClass" var:id="msgDivID">
+                <!-- Note: var:href="messageViewURL" (done by JS),
+                           var:target="messageViewTarget" -->
+                <a href="#" var:onclick="clickedMsgJS">
+                  <var:string value="message.envelope.subject"
+                              formatter="context.mailSubjectFormatter"/>
+                </a>
+              </div>
             </td>
-            <td>
+            <td var:class="messageCellStyleClass">
               <!-- TODO: show compose links -->
               <!-- TODO: different color for internal vs external addrs -->
               <var:if condition="showToAddress" const:negate="YES">
               </var:if>
             </td>
            
-            <td>
+            <td var:class="messageCellStyleClass">
               <span class="mailer_datefield">
                 <var:string value="message.envelope.date" 
                             formatter="context.mailDateFormatter"/>
index a1a6e8a2436b81716353b2891fd736ae860e021d..351c5ddc18c36584af9adfe1476fb800cfc087bf 100644 (file)
 - (BOOL)isDeletableClientObject {
   return [[self clientObject] respondsToSelector:@selector(delete)];
 }
+- (BOOL)isInlineViewer {
+  return NO;
+}
 
 - (id)deleteAction {
   NSException *ex;
-  id url;
-
+  
   if (![self isDeletableClientObject]) {
     return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
                         reason:@"method cannot be invoked on "
                                @"the specified object"];
   }
-
+  
   if ((ex = [[self clientObject] delete]) != nil) {
     // TODO: improve error handling
     [self debugWithFormat:@"failed to delete: %@", ex];
     return ex;
   }
+  
+  if (![self isInlineViewer]) {
+    // if everything is ok, close the window (send a JS closing the Window)
+    return [self pageWithName:@"UIxMailWindowCloser"];
+  }
+  else {
+    id url;
 
-  url = [[[self clientObject] container] baseURLInContext:[self context]];
-  return [self redirectToLocation:url];
+    url = [[[self clientObject] container] baseURLInContext:[self context]];
+    return [self redirectToLocation:url];
+  }
 }
 
 - (id)getMailAction {
index 47c70a136fe7f82b3b1c14c9813b6e2cb727886b..154bb53c2726643c60ac7f2e4611bcada0545d91 100644 (file)
@@ -11,7 +11,8 @@
   const:hideFolderTree="1"
 >
   <!-- 
-    todo: we cannot make this static because the CC list has a dynamic height?
+    Note: We cannot make this section static (like the toolbar) because the CC
+          list has a dynamic height (would require some tricky JavaScript).
     -->
   <table class="mailer_fieldtable">
     <tr class="mailer_fieldrow">
index 733f93ecec63d68432a562f0d37febcbdc8e33fa..0069dec7e03be84f4472729a33727b6c35906f7a 100644 (file)
@@ -2,6 +2,7 @@
 
 SUBMINOR_VERSION:=77
 
+# v0.9.78 requires SoObjects/Mailer v0.9.58
 # v0.9.77 requires SoObjects/Mailer v0.9.57
 # v0.9.74 requires SoObjects/Mailer v0.9.56
 # v0.9.70 requires NGExtensions     v4.5.136
index bc6bb1f75a2530d88ab10cda3cf1d95e8b6c791b..f4763b0f76133fd37cdd5841ba4e94b6a569e8a4 100644 (file)
@@ -227,8 +227,6 @@ span.mailer_datefield {
 }
 
 div.mailer_readmailsubject { 
-  /* TODO: use proper read icon */
-  /* background-image:    url(tbtv_leaf_corner_17x17.gif); */
   background-image:    url(message-mail-read.png);
   background-repeat:   no-repeat;
   background-position: 0px 0px;
@@ -236,8 +234,6 @@ div.mailer_readmailsubject {
   padding-left:        20px;
 }
 div.mailer_unreadmailsubject { 
-  /* TODO: use proper unread icon */
-  /* background-image:    url(tbtv_leaf_corner_17x17.gif); */
   background-image:    url(message-mail.png);
   background-repeat:   no-repeat;
   background-position: 0px 0px;
@@ -254,6 +250,12 @@ div.mailer_unreadmailsubject a {
   text-decoration: none;
 }
 
+td.mailer_listcell_deleted {
+  text-decoration: line-through;
+}
+td.mailer_listcell_regular {
+}
+
 div.mailer_readicon { 
   /* TODO: use Thunderbird icon */
   background-image:    url(icon_read.gif);
@@ -405,7 +407,7 @@ div.linked_attachment_frame {
 
 div.linked_attachment_body {
   font-family:  Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
-  font-size:    10pt;
+  font-size:           10pt;
   padding:             4px;
 
   border-width:        1;
index 78084786a49c810f2af9b7635b2b97d73de401fa..edefca9ba704485ea2d8408558c707af81118800 100644 (file)
                 cssClass = "tbicon_forward";  label = "Forward";   },
             ),
 */
+            ( // third group
+              { link = "delete"; 
+                cssClass = "tbicon_delete"; label = "Delete"; },
+            ),
 /* TODO: enable when implemented
             ( // third group
 // TODO: enable when delete works (#1212)