Added support for dynamic mail labels/tags management.

The CSS in the UIxPreferences remains to be done.
This commit is contained in:
Ludovic Marcotte committed 2013-11-11 10:49:58 -05:00
1 parent 6a9bcfda68
commit 37d3234b60
24 files changed
+624 -229

No files matched your search

+1 -3
View File
@@ -1,8 +1,6 @@
/* UIxMailActions.h - this file is part of SOGo
*
* Copyright (C) 2007 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
+26 -62
View File
@@ -1,8 +1,6 @@
/* UIxMailActions.m - this file is part of SOGo
*
* Copyright (C) 2007 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
@@ -21,6 +19,7 @@
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import <NGObjWeb/WOContext.h>
@@ -32,6 +31,8 @@
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/SOGo/SOGoUserDefaults.h>
#import "../Common/WODirectAction+SOGo.h"
@@ -194,16 +195,18 @@
return response;
}
- (WOResponse *) _addLabel: (unsigned int) number
- (WOResponse *) addLabelAction
{
WOResponse *response;
SOGoMailObject *co;
NSException *error;
NSArray *flags;
NSString *flag;
flag = [[[self->context request] formValueForKey: @"flag"] fromCSSIdentifier];
co = [self clientObject];
flags = [NSArray arrayWithObject:
[NSString stringWithFormat: @"$Label%u", number]];
flags = [NSArray arrayWithObject: flag];
error = [co addFlags: flags];
if (error)
response = (WOResponse *) error;
@@ -213,16 +216,18 @@
return response;
}
- (WOResponse *) _removeLabel: (unsigned int) number
- (WOResponse *) removeLabelAction
{
WOResponse *response;
SOGoMailObject *co;
NSException *error;
NSArray *flags;
NSString *flag;
flag = [[[self->context request] formValueForKey: @"flag"] fromCSSIdentifier];
co = [self clientObject];
flags = [NSArray arrayWithObject:
[NSString stringWithFormat: @"$Label%u", number]];
flags = [NSArray arrayWithObject: flag];
error = [co removeFlags: flags];
if (error)
response = (WOResponse *) error;
@@ -232,66 +237,25 @@
return response;
}
- (WOResponse *) addLabel1Action
{
return [self _addLabel: 1];
}
- (WOResponse *) addLabel2Action
{
return [self _addLabel: 2];
}
- (WOResponse *) addLabel3Action
{
return [self _addLabel: 3];
}
- (WOResponse *) addLabel4Action
{
return [self _addLabel: 4];
}
- (WOResponse *) addLabel5Action
{
return [self _addLabel: 5];
}
- (WOResponse *) removeLabel1Action
{
return [self _removeLabel: 1];
}
- (WOResponse *) removeLabel2Action
{
return [self _removeLabel: 2];
}
- (WOResponse *) removeLabel3Action
{
return [self _removeLabel: 3];
}
- (WOResponse *) removeLabel4Action
{
return [self _removeLabel: 4];
}
- (WOResponse *) removeLabel5Action
{
return [self _removeLabel: 5];
}
- (WOResponse *) removeAllLabelsAction
{
NSMutableArray *flags;
WOResponse *response;
SOGoMailObject *co;
NSException *error;
NSArray *flags;
NSDictionary *v;
co = [self clientObject];
flags = [NSArray arrayWithObjects: @"$Label1", @"$Label2", @"$Label3",
@"$Label4", @"$Label5", nil];
v = [[[context activeUser] userDefaults] mailLabelsColors];
// We always unconditionally remove the Mozilla tags
flags = [NSMutableArray arrayWithObjects: @"$Label1", @"$Label2", @"$Label3",
@"$Label4", @"$Label5", nil];
[flags addObjectsFromArray: [v allKeys]];
error = [co removeFlags: flags];
if (error)
response = (WOResponse *) error;
+4 -3
View File
@@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2011 Inverse inc.
Copyright (C) 2006-2013 Inverse inc.
This file is part of SOGo
@@ -861,8 +861,9 @@
flags = [[message objectForKey: @"flags"] objectEnumerator];
while ((currentFlag = [flags nextObject]))
if ([currentFlag hasPrefix: @"$label"])
[labels addObject: [currentFlag substringFromIndex: 1]];
{
[labels addObject: currentFlag];
}
return [labels componentsJoinedByString: @" "];
}
+4 -3
View File
@@ -1,8 +1,6 @@
/* UIxMailMainFrame.h - this file is part of SOGo
*
* Copyright (C) 2006-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2006-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
@@ -25,6 +23,8 @@
#import "../SOGoUI/UIxComponent.h"
@class SOGoMailLabel;
@interface UIxMailMainFrame : UIxComponent
{
SOGoUserSettings *us;
@@ -33,6 +33,7 @@
NSArray *columnsOrder;
int folderType;
NSDictionary *currentColumn;
SOGoMailLabel *_currentLabel;
}
- (WOResponse *) getFoldersStateAction;
+36 -5
View File
@@ -1,9 +1,5 @@
/*
Copyright (C) 2007-2011 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
Ludovic Marcotte <lmarcotte@inverse.ca>
Copyright (C) 2007-2013 Inverse inc.
This file is part of SOGo.
@@ -48,6 +44,7 @@
#import <Mailer/SOGoMailAccount.h>
#import <Mailer/SOGoMailAccounts.h>
#import <Mailer/SOGoMailFolder.h>
#import <Mailer/SOGoMailLabel.h>
#import <Mailer/SOGoMailObject.h>
#import <Mailer/SOGoSentFolder.h>
#import <SOGo/NSDictionary+URL.h>
@@ -84,6 +81,12 @@
return self;
}
- (void) dealloc
{
RELEASE(_currentLabel);
[super dealloc];
}
- (void) _setupContext
{
SOGoUser *activeUser;
@@ -687,4 +690,32 @@
return [folders jsonRepresentation];
}
//
// Standard mapping done by Thunderbird:
//
// label1 => Important
// label2 => Work
// label3 => Personal
// label4 => To Do
// label5 => Later
//
- (NSArray *) availableLabels
{
NSDictionary *v;
v = [[[context activeUser] userDefaults] mailLabelsColors];
return [SOGoMailLabel labelsFromDefaults: v component: self];
}
- (void) setCurrentLabel: (SOGoMailLabel *) theCurrentLabel
{
ASSIGN(_currentLabel, theCurrentLabel);
}
- (SOGoMailLabel *) currentLabel
{
return _currentLabel;
}
@end /* UIxMailMainFrame */
+4 -44
View File
@@ -272,55 +272,15 @@
actionClass = "UIxMailActions";
actionName = "markMessageRead";
};
addLabel1 = {
addLabel = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "addLabel1";
actionName = "addLabel";
};
addLabel2 = {
removeLabel = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "addLabel2";
};
addLabel3 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "addLabel3";
};
addLabel4 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "addLabel4";
};
addLabel5 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "addLabel5";
};
removeLabel1 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "removeLabel1";
};
removeLabel2 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "removeLabel2";
};
removeLabel3 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "removeLabel3";
};
removeLabel4 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "removeLabel4";
};
removeLabel5 = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "removeLabel5";
actionName = "removeLabel";
};
removeAllLabels = {
protectedBy = "View";