Added support for dynamic mail labels/tags management.

The CSS in the UIxPreferences remains to be done.
This commit is contained in:
Ludovic Marcotte
2013-11-11 10:49:58 -05:00
parent 6a9bcfda68
commit 37d3234b60
24 changed files with 625 additions and 230 deletions
@@ -288,12 +288,13 @@
"Flagged" = "Flagged";
"Junk" = "Junk";
"Not Junk" = "Not Junk";
"Label 1" = "Label 1";
"Label 2" = "Label 2";
"Label 3" = "Label 3";
"Label 4" = "Label 4";
"Label 5" = "Label 5";
"Important" = "Important";
"Work" = "Work";
"Personal" = "Personal";
"To Do" = "To Do";
"Later" = "Later";
/* Password policy */
"The password was changed successfully." = "The password was changed successfully.";
"Password must not be empty." = "Password must not be empty.";
"The passwords do not match. Please try again." = "The passwords do not match. Please try again.";
@@ -306,4 +307,4 @@
"Unhandled policy error: %{0}" = "Unhandled policy error: %{0}";
"Unhandled error response" = "Unhandled error response";
"Password change is not supported." = "Password change is not supported.";
"Unhandled HTTP error code: %{0}" = "Unhandled HTTP error code: %{0}";
"Unhandled HTTP error code: %{0}" = "Unhandled HTTP error code: %{0}";
+35 -3
View File
@@ -1,8 +1,6 @@
/* UIxFilterEditor.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2010-2013 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
@@ -26,20 +24,44 @@
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/WOResponse.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGoUI/UIxComponent.h>
@interface UIxFilterEditor : UIxComponent
{
NSString *filterId;
NSDictionary *labels;
}
@end
@implementation UIxFilterEditor
- (id) init
{
self = [super init];
if (self)
{
filterId = nil;
labels = nil;
}
return self;
}
- (void) dealloc
{
RELEASE(filterId);
RELEASE(labels);
[super dealloc];
}
/* convert and save */
- (BOOL) _validateFilterId
{
@@ -80,4 +102,14 @@
return filterId;
}
- (NSString *) labels
{
if (!labels)
{
ASSIGN(labels, [[[context activeUser] userDefaults] mailLabelsColors]);
}
return [labels jsonRepresentation];
}
@end
+14 -3
View File
@@ -1,8 +1,6 @@
/* UIxPreferences.h - this file is part of SOGo
*
* Copyright (C) 2007-2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2007-2013 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
@@ -27,23 +25,36 @@
@class NSString;
@class SOGoMailLabel;
@class SOGoUser;
@interface UIxPreferences : UIxComponent
{
id item;
SOGoUser *user;
// Calendar categories
NSString *category;
NSArray *calendarCategories;
NSDictionary *calendarCategoriesColors;
NSArray *contactsCategories;
NSString *defaultCategoryColor;
NSCalendarDate *today;
// Mail labels/tags
SOGoMailLabel *label;
NSArray *mailLabels;
// Sieve filtering
NSArray *daysOfWeek, *daysBetweenResponsesList;
NSArray *sieveFilters;
NSMutableDictionary *vacationOptions, *forwardOptions;
BOOL mailCustomFromEnabled;
BOOL hasChanged;
}
- (NSString *) userLongDateFormat;
+70 -4
View File
@@ -1,9 +1,6 @@
/* UIxPreferences.m - this file is part of SOGo
*
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>
* Copyright (C) 2007-2013 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
@@ -31,6 +28,8 @@
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WORequest.h>
#import <NGImap4/NSString+Imap4.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGCards/iCalTimeZone.h>
@@ -47,6 +46,7 @@
#import <SOGo/WOResourceManager+SOGo.h>
#import <Mailer/SOGoMailAccount.h>
#import <Mailer/SOGoMailAccounts.h>
#import <Mailer/SOGoMailLabel.h>
#import "UIxPreferences.h"
@@ -77,6 +77,9 @@
defaultCategoryColor = nil;
category = nil;
label = nil;
mailLabels = nil;
ASSIGN (daysOfWeek, [locale objectForKey: NSWeekDayNameArray]);
dd = [user domainDefaults];
@@ -120,6 +123,8 @@
[calendarCategoriesColors release];
[defaultCategoryColor release];
[category release];
[label release];
[mailLabels release];
[contactsCategories release];
[forwardOptions release];
[daysOfWeek release];
@@ -1175,6 +1180,67 @@
sortedArrayUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
}
- (SOGoMailLabel *) label
{
return label;
}
- (void) setLabel: (SOGoMailLabel *) newLabel
{
ASSIGN(label, newLabel);
}
- (NSArray *) mailLabelList
{
if (!mailLabels)
{
NSDictionary *v;
v = [[[context activeUser] userDefaults] mailLabelsColors];
ASSIGN(mailLabels, [SOGoMailLabel labelsFromDefaults: v component: self]);
}
return mailLabels;
}
- (NSString *) mailLabelsValue
{
return @"";
}
- (void) setMailLabelsValue: (NSString *) value
{
NSMutableDictionary *sanitizedLabels;
NSDictionary *newLabels;
NSArray *allKeys;
NSString *name;
int i;
newLabels = [value objectFromJSONString];
if (newLabels && [newLabels isKindOfClass: [NSDictionary class]])
{
// We encode correctly our keys
sanitizedLabels = [NSMutableDictionary dictionary];
allKeys = [newLabels allKeys];
for (i = 0; i < [allKeys count]; i++)
{
name = [allKeys objectAtIndex: i];
if (![name is7bitSafe])
name = [name stringByEncodingImap4FolderName];
name = [name lowercaseString];
[sanitizedLabels setObject: [newLabels objectForKey: [allKeys objectAtIndex: i]]
forKey: name];
}
[userDefaults setMailLabelsColors: sanitizedLabels];
}
}
- (void) setCategory: (NSString *) newCategory
{
ASSIGN (category, newCategory);