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 624 additions and 229 deletions
+1
View File
@@ -16,6 +16,7 @@ Mailer_OBJC_FILES += \
SOGoMailAccounts.m \
SOGoMailAccount.m \
SOGoMailFolder.m \
SOGoMailLabel.m \
SOGoMailNamespace.m \
SOGoMailObject.m \
SOGoMailObject+Draft.m \
+50
View File
@@ -0,0 +1,50 @@
/*
Copyright (C) 2013 Inverse inc.
This file is part of SOGo.
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#ifndef SOGOMAILLABEL_H
#define SOGOMAILLABEL_H
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import "../../UI/SOGoUI/UIxComponent.h";
@interface SOGoMailLabel : NSObject
{
NSString *_name;
NSString *_label;
NSString *_color;
}
- (id) initWithName: (NSString *) theName
label: (NSString *) theLabel
color: (NSString *) theColor;
- (NSString *) name;
- (NSString *) label;
- (NSString *) color;
+ (NSArray *) labelsFromDefaults: (NSDictionary *) theDefaults
component: (UIxComponent *) theComponent;
@end
#endif // SOGOMAILLABEL_H
+96
View File
@@ -0,0 +1,96 @@
/*
Copyright (C) 2007-2013 Inverse inc.
This file is part of SOGo.
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with OGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
#import "SOGoMailLabel.h"
#import <Foundation/NSDictionary.h>
@implementation SOGoMailLabel
- (id) initWithName: (NSString *) theName
label: (NSString *) theLabel
color: (NSString *) theColor
{
self = [super init];
if (self)
{
ASSIGN(_name, theName);
ASSIGN(_label, theLabel);
ASSIGN(_color, theColor);
}
return self;
}
- (void) dealloc
{
RELEASE(_name);
RELEASE(_label);
RELEASE(_color);
[super dealloc];
}
- (NSString *) name
{
return _name;
}
- (NSString *) label
{
return _label;
}
- (NSString *) color
{
return _color;
}
+ (NSArray *) labelsFromDefaults: (NSDictionary *) theDefaults
component: (UIxComponent *) theComponent
{
NSMutableArray *allLabels, *allKeys;
NSDictionary *mailLabelsColors;
NSString *key, *name;
SOGoMailLabel *label;
NSArray *values;
int i;
allLabels = [NSMutableArray array];
allKeys = [[theDefaults allKeys] sortedArrayUsingSelector: @selector (caseInsensitiveCompare:)];
for (i = 0; i < [allKeys count]; i++)
{
key = [allKeys objectAtIndex: i];
values = [theDefaults objectForKey: key];
name = [theComponent labelForKey: [values objectAtIndex: 0]];
label = [[self alloc] initWithName: key
label: name
color: [values objectAtIndex: 1]];
[allLabels addObject: label];
RELEASE(label);
}
return allLabels;
}
@end
+8
View File
@@ -76,4 +76,12 @@
SOGoRemindWithASound = YES;
SOGoSearchMinimumWordLength = 2;
SOGoMailLabelsColors = {
label1 = ("Important", "#f00");
label2 = ("Work", "#ff9a00");
label3 = ("Personal", "#009a00");
label4 = ("To Do", "#3130ff");
label5 = ("Later", "#9c309c");
};
}
+4 -3
View File
@@ -1,8 +1,6 @@
/* SOGoUserDefaults.h - this file is part of SOGo
*
* Copyright (C) 2011-2012 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2011-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
@@ -166,6 +164,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
- (void) setForwardOptions: (NSDictionary *) newValue;
- (NSDictionary *) forwardOptions;
- (void) setMailLabelsColors: (NSDictionary *) newValues;
- (NSDictionary *) mailLabelsColors;
/* calendar */
- (void) setCalendarCategories: (NSArray *) newValues;
- (NSArray *) calendarCategories;
+21 -3
View File
@@ -1,8 +1,6 @@
/* SOGoUserDefaults.m - this file is part of SOGo
*
* Copyright (C) 2009-2012 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2009-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
@@ -733,6 +731,26 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return [self boolForKey: @"SOGoRemindWithASound"];
}
//
// Dictionary of arrays. Example:
//
// {
// label1 => ("Important", "#FF0000");
// label2 => ("Work" "#00FF00");
// foo_bar => ("Foo Bar", "#0000FF");
// }
//
- (void) setMailLabelsColors: (NSDictionary *) newValues
{
[self setObject: newValues forKey: @"SOGoMailLabelsColors"];
}
- (NSDictionary *) mailLabelsColors
{
return [self objectForKey: @"SOGoMailLabelsColors"];
}
- (void) setSieveFilters: (NSArray *) newValue
{
[self setObject: newValue forKey: @"SOGoSieveFilters"];