mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-26 23:39:33 +00:00
merge of '5b69d2cd30194d3e8db89060210265b500c3a3e0'
and 'dae312b4bfd2084618c23a6232f43e0a9c5d7938' Monotone-Parent: 5b69d2cd30194d3e8db89060210265b500c3a3e0 Monotone-Parent: dae312b4bfd2084618c23a6232f43e0a9c5d7938 Monotone-Revision: cbbaf4a8411e0af4f8c4320f2c151556beba1fad Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-06T23:12:10 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
2007-11-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MailerUI/UIxMailToSelection.m ([UIxMailToSelection
|
||||
-getAddressesFromFormValues:_dict]): take NSString and NSArray
|
||||
values. Ignore addresses with a length of 0.
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): we now
|
||||
fetch the accounts from the user defaults and create default
|
||||
values if missing.
|
||||
|
||||
2007-11-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MailPartViewers/UIxMailPartTextViewer.m
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((error = [self->folderManager createFolderOfType:_type atPath:_path])) {
|
||||
if ((error = [self->folderManager createFolderOfType:_type
|
||||
withName: @"testFolder"
|
||||
atPath:_path])) {
|
||||
[self logWithFormat:@"creation of folder %@ at %@ failed: %@",
|
||||
_type, _path, error];
|
||||
return 1;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
- (void)removeAllRecurrenceRules;
|
||||
- (void)addToRecurrenceRules:(id)_rrule;
|
||||
- (void)setRecurrenceRules:(id)_rrule;
|
||||
- (void)setRecurrenceRules:(NSArray *)_rrule;
|
||||
- (BOOL)hasRecurrenceRules;
|
||||
- (NSArray *)recurrenceRules;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
@interface NSData (SOGoMailUtilities)
|
||||
|
||||
- (NSData *) bodyDataFromEncoding: (NSString *) encoding;
|
||||
- (NSString *) decodedSubject;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
@interface NSString (SOGoExtension)
|
||||
|
||||
- (NSString *) htmlToText;
|
||||
|
||||
- (NSString *) decodedSubject;
|
||||
|
||||
@end
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#import <SoObjects/SOGo/SOGoPermissions.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
|
||||
#import "NSString+Mail.h"
|
||||
#import "NSData+Mail.h"
|
||||
#import "SOGoMailFolder.h"
|
||||
#import "SOGoMailAccount.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
|
||||
#import <SoObjects/SOGo/SOGoDateFormatter.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
|
||||
@@ -368,44 +368,58 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
}
|
||||
|
||||
/* mail */
|
||||
- (NSArray *) mailAccounts
|
||||
- (void) _prepareDefaultMailAccounts
|
||||
{
|
||||
#warning should be implemented with the user defaults interfaces
|
||||
NSMutableDictionary *mailAccount, *identity;
|
||||
NSMutableArray *identities;
|
||||
NSString *name, *fullName;
|
||||
NSArray *mails;
|
||||
unsigned int count, max;
|
||||
|
||||
mailAccount = [NSMutableDictionary dictionary];
|
||||
name = [NSString stringWithFormat: @"%@@%@",
|
||||
login, fallbackIMAP4Server];
|
||||
[mailAccount setObject: login forKey: @"userName"];
|
||||
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
||||
[mailAccount setObject: name forKey: @"name"];
|
||||
|
||||
identities = [NSMutableArray array];
|
||||
mails = [self allEmails];
|
||||
|
||||
max = [mails count];
|
||||
if (max > 1)
|
||||
max--;
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
identity = [NSMutableDictionary dictionary];
|
||||
fullName = [self cn];
|
||||
if (![fullName length])
|
||||
fullName = login;
|
||||
[identity setObject: fullName forKey: @"fullName"];
|
||||
[identity setObject: [mails objectAtIndex: count] forKey: @"email"];
|
||||
[identities addObject: identity];
|
||||
}
|
||||
[[identities objectAtIndex: 0] setObject: [NSNumber numberWithBool: YES]
|
||||
forKey: @"isDefault"];
|
||||
|
||||
[mailAccount setObject: identities forKey: @"identities"];
|
||||
|
||||
mailAccounts = [NSMutableArray new];
|
||||
[mailAccounts addObject: mailAccount];
|
||||
}
|
||||
|
||||
- (NSArray *) mailAccounts
|
||||
{
|
||||
NSUserDefaults *ud;
|
||||
|
||||
if (!mailAccounts)
|
||||
{
|
||||
NSArray *mails;
|
||||
int i;
|
||||
|
||||
mailAccount = [NSMutableDictionary dictionary];
|
||||
name = [NSString stringWithFormat: @"%@@%@", login, fallbackIMAP4Server];
|
||||
[mailAccount setObject: login forKey: @"userName"];
|
||||
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
||||
[mailAccount setObject: name forKey: @"name"];
|
||||
|
||||
identities = [NSMutableArray array];
|
||||
mails = [self allEmails];
|
||||
|
||||
for (i = 0; i < [mails count]; i++)
|
||||
{
|
||||
identity = [NSMutableDictionary dictionary];
|
||||
fullName = [self cn];
|
||||
if (![fullName length])
|
||||
fullName = login;
|
||||
[identity setObject: fullName forKey: @"fullName"];
|
||||
[identity setObject: [mails objectAtIndex: i] forKey: @"email"];
|
||||
|
||||
if (i == 0) [identity setObject: [NSNumber numberWithBool: YES] forKey: @"isDefault"];
|
||||
[identities addObject: identity];
|
||||
}
|
||||
|
||||
[mailAccount setObject: identities forKey: @"identities"];
|
||||
|
||||
mailAccounts = [NSMutableArray new];
|
||||
[mailAccounts addObject: mailAccount];
|
||||
ud = [self userDefaults];
|
||||
mailAccounts = [ud objectForKey: @"MailAccounts"];
|
||||
if (mailAccounts)
|
||||
[mailAccounts retain];
|
||||
else
|
||||
[self _prepareDefaultMailAccounts];
|
||||
}
|
||||
|
||||
return mailAccounts;
|
||||
|
||||
@@ -285,11 +285,31 @@ static NSArray *headers = nil;
|
||||
|
||||
/* handling requests */
|
||||
|
||||
- (void) _fillAddresses: (NSMutableArray *) addresses
|
||||
withObject: (id) object
|
||||
{
|
||||
NSEnumerator *list;
|
||||
NSString *currentAddress;
|
||||
|
||||
if ([object isKindOfClass: [NSString class]])
|
||||
[addresses addObject: object];
|
||||
else if ([object isKindOfClass: [NSArray class]])
|
||||
{
|
||||
list = [object objectEnumerator];
|
||||
while ((currentAddress
|
||||
= [[list nextObject] stringByTrimmingSpaces]))
|
||||
if ([currentAddress length])
|
||||
[addresses addObject: currentAddress];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) getAddressesFromFormValues: (NSDictionary *) _dict
|
||||
{
|
||||
NSMutableArray *rawTo, *rawCc, *rawBcc;
|
||||
NSString *idx, *popupKey, *popupValue;
|
||||
NSArray *keys;
|
||||
unsigned i, count;
|
||||
id addr;
|
||||
|
||||
rawTo = [NSMutableArray arrayWithCapacity:4];
|
||||
rawCc = [NSMutableArray arrayWithCapacity:4];
|
||||
@@ -304,18 +324,16 @@ static NSArray *headers = nil;
|
||||
key = [keys objectAtIndex:i];
|
||||
if ([key hasPrefix:@"addr_"])
|
||||
{
|
||||
NSString *idx, *addr, *popupKey, *popupValue;
|
||||
|
||||
addr = [[_dict objectForKey:key] lastObject];
|
||||
addr = [_dict objectForKey:key];
|
||||
idx = [self getIndexFromIdentifier:key];
|
||||
popupKey = [NSString stringWithFormat:@"popup_%@", idx];
|
||||
popupValue = [[_dict objectForKey:popupKey] lastObject];
|
||||
if([popupValue isEqualToString:@"0"])
|
||||
[rawTo addObject:addr];
|
||||
[self _fillAddresses: rawTo withObject: addr];
|
||||
else if([popupValue isEqualToString:@"1"])
|
||||
[rawCc addObject:addr];
|
||||
[self _fillAddresses: rawCc withObject: addr];
|
||||
else
|
||||
[rawBcc addObject:addr];
|
||||
[self _fillAddresses: rawBcc withObject: addr];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,9 @@
|
||||
"messageforward_inline" = "Inline";
|
||||
"messageforward_attached" = "As Attachment";
|
||||
|
||||
"Default identity:" = "Default identity:";
|
||||
"Manage identities..." = "Manage identities...";
|
||||
|
||||
/* password */
|
||||
"New password:" = "New password:";
|
||||
"Confirmation:" = "Confirmation:";
|
||||
|
||||
@@ -79,6 +79,9 @@
|
||||
"messageforward_inline" = "intégrés";
|
||||
"messageforward_attached" = "en pièces jointes";
|
||||
|
||||
"Default identity:" = "Identité par défaut :";
|
||||
"Manage identities..." = "Gérer les identitiés...";
|
||||
|
||||
/* password */
|
||||
"New password:" = "Nouveau mot de passe :";
|
||||
"Confirmation:" = "Confirmation :";
|
||||
|
||||
@@ -11,6 +11,7 @@ PreferencesUI_LANGUAGES = English French German
|
||||
PreferencesUI_OBJC_FILES = \
|
||||
PreferencesUIProduct.m \
|
||||
\
|
||||
UIxIdentities.m \
|
||||
UIxJSONPreferences.m \
|
||||
UIxPreferences.m
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@
|
||||
"messageforward_inline" = "Eingebunden";
|
||||
"messageforward_attached" = "Als Anhang";
|
||||
|
||||
"Default identity:" = "Default identity:";
|
||||
"Manage identities..." = "Manage identities...";
|
||||
|
||||
/* password */
|
||||
"New password:" = "Neues Passwort:";
|
||||
"Confirmation:" = "Bestätigung:";
|
||||
|
||||
@@ -33,14 +33,14 @@
|
||||
|
||||
@implementation UIxJSONPreferences
|
||||
|
||||
- (WOResponse *) _makeResponse: (NSString *) jsonText
|
||||
- (WOResponse *) _makeResponse: (NSUserDefaults *) defaults
|
||||
{
|
||||
WOResponse *response;
|
||||
|
||||
response = [context response];
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
forKey: @"content-type"];
|
||||
[response appendContentString: jsonText];
|
||||
[response appendContentString: [defaults jsonRepresentation]];
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
defaults = [[context activeUser] userDefaults];
|
||||
|
||||
return [self _makeResponse: [defaults jsonRepresentation]];
|
||||
return [self _makeResponse: defaults];
|
||||
}
|
||||
|
||||
- (WOResponse *) jsonSettingsAction
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
settings = [[context activeUser] userSettings];
|
||||
|
||||
return [self _makeResponse: [settings jsonRepresentation]];
|
||||
return [self _makeResponse: settings];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
@interface UIxPreferences : UIxComponent
|
||||
{
|
||||
NSString *item;
|
||||
id item;
|
||||
SOGoUser *user;
|
||||
NSUserDefaults *userDefaults;
|
||||
NSCalendarDate *today;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
|
||||
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
|
||||
#import "UIxPreferences.h"
|
||||
@@ -466,6 +467,35 @@ static BOOL shouldDisplayPasswordChange = NO;
|
||||
[userDefaults setObject: newMessageForwarding forKey: @"MessageForwarding"];
|
||||
}
|
||||
|
||||
// <label><var:string label:value="Default identity:"/>
|
||||
// <var:popup list="identitiesList" item="item"
|
||||
// string="itemIdentityText" selection="defaultIdentity"/></label>
|
||||
- (NSArray *) identitiesList
|
||||
{
|
||||
return [user allIdentities];
|
||||
}
|
||||
|
||||
- (NSString *) itemIdentityText
|
||||
{
|
||||
return [item keysWithFormat: @"%{fullName} <%{email}>"];
|
||||
}
|
||||
|
||||
- (NSDictionary *) defaultIdentity
|
||||
{
|
||||
NSDictionary *currentIdentity, *defaultIdentity;
|
||||
NSEnumerator *identities;
|
||||
|
||||
defaultIdentity = nil;
|
||||
|
||||
identities = [[user allIdentities] objectEnumerator];
|
||||
while (!defaultIdentity
|
||||
&& (currentIdentity = [identities nextObject]))
|
||||
if ([[currentIdentity objectForKey: @"isDefault"] boolValue])
|
||||
defaultIdentity = currentIdentity;
|
||||
|
||||
return defaultIdentity;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
id <WOActionResults> results;
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
protectedBy = "View";
|
||||
pageName = "UIxPreferences";
|
||||
};
|
||||
identities = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxIdentities";
|
||||
};
|
||||
jsonDefaults = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxJSONPreferences";
|
||||
|
||||
@@ -24,23 +24,27 @@
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
#import <Foundation/NSKeyValueCoding.h>
|
||||
#import <Foundation/NSPathUtilities.h>
|
||||
|
||||
#import <NGObjWeb/SoHTTPAuthenticator.h>
|
||||
#import <NGObjWeb/SoObjects.h>
|
||||
#import <NGObjWeb/WOResourceManager.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGExtensions/NSURL+misc.h>
|
||||
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoObject.h>
|
||||
#import <SoObjects/SOGo/SOGoCustomGroupFolder.h>
|
||||
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||
|
||||
#import "UIxComponent.h"
|
||||
#import "UIxJSClose.h"
|
||||
|
||||
#import "UIxComponent.h"
|
||||
|
||||
@interface UIxComponent (PrivateAPI)
|
||||
- (void)_parseQueryString:(NSString *)_s;
|
||||
- (NSMutableDictionary *)_queryParameters;
|
||||
|
||||
@@ -80,6 +80,12 @@
|
||||
<label><var:string label:value="Forward messages:"/>
|
||||
<var:popup list="messageForwardingList" item="item"
|
||||
string="itemMessageForwardingText" selection="userMessageForwarding"/></label><br/>
|
||||
<label><var:string label:value="Default identity:"/>
|
||||
<var:popup list="identitiesList" item="item"
|
||||
string="itemIdentityText" selection="defaultIdentity"/></label>
|
||||
<input type="button" class="button" id="manageIdentitiesBtn"
|
||||
label:value="Manage identities..."/>
|
||||
<br/>
|
||||
<!-- <label><input
|
||||
const:name="inTheOffice" type="radio" const:value="YES"
|
||||
var:selection="inTheOffice"/>
|
||||
|
||||
@@ -3,3 +3,21 @@ function savePreferences(sender) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function initPreferences() {
|
||||
var identitiesBtn = $("manageIdentitiesBtn");
|
||||
Event.observe(identitiesBtn, "click",
|
||||
popupIdentitiesWindow.bindAsEventListener(identitiesBtn));
|
||||
}
|
||||
|
||||
function popupIdentitiesWindow(event) {
|
||||
var urlstr = UserFolderURL + "identities";
|
||||
var w = window.open(urlstr, "identities",
|
||||
"width=430,height=250,resizable=0,scrollbars=0,location=0");
|
||||
w.opener = window;
|
||||
w.focus();
|
||||
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
addEvent(window, 'load', initPreferences);
|
||||
|
||||
@@ -218,8 +218,13 @@ function openUserFolderSelector(callback, type) {
|
||||
}
|
||||
|
||||
function openContactWindow(url, wId) {
|
||||
if (!wId)
|
||||
wId = "" + (new Date().getTime());
|
||||
if (typeof wId == "undefined")
|
||||
wId = "_blank";
|
||||
else {
|
||||
var r = new RegExp("[\.\/-]", "g");
|
||||
wId = wId.replace(r, "_");
|
||||
}
|
||||
|
||||
var w = window.open(url, wId,
|
||||
"width=450,height=600,resizable=0,location=0");
|
||||
w.focus();
|
||||
@@ -230,12 +235,15 @@ function openContactWindow(url, wId) {
|
||||
function openMailComposeWindow(url, wId) {
|
||||
var parentWindow = this;
|
||||
|
||||
if (!wId)
|
||||
wId = "" + (new Date().getTime());
|
||||
else
|
||||
if (typeof wId == "undefined")
|
||||
wId = "_blank";
|
||||
else {
|
||||
var r = new RegExp("[\.\/-]", "g");
|
||||
wId = wId.replace(r, "_");
|
||||
if (document.body.hasClassName("popup"))
|
||||
parentWindow = window.opener;
|
||||
|
||||
}
|
||||
|
||||
var w = parentWindow.open(url, wId,
|
||||
"width=680,height=520,resizable=1,scrollbars=1,toolbar=0,"
|
||||
+ "location=0,directories=0,status=0,menubar=0"
|
||||
|
||||
Reference in New Issue
Block a user