/* Copyright (c) 2010 Indilo Wireless OÜ */

#import "TKSettingsController.h"

#define TKSettingsControllerTableViewTag 1000

@implementation TKSettingsController

@dynamic tableView;

- (UITableView *)tableView
{
	return (UITableView *)[self.view viewWithTag:TKSettingsControllerTableViewTag];
}

#pragma mark UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
	return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"Cell"];
	
	if (!cell) 
	{
		cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] autorelease];
		cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
		cell.selectionStyle = UITableViewCellSelectionStyleBlue;
	}
	
	switch (indexPath.section) {
		case 0:
			switch (indexPath.row) {
				case 0:
					cell.textLabel.text = NSLocalizedString(@"Settings.Events", nil);
					break;
					
				case 1:
					cell.textLabel.text = NSLocalizedString(@"Settings.Surveys", nil);
					break;
			}
			break;
	}
	
	return cell;
}

#pragma mark UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
	switch (indexPath.section) {
		case 0:
			switch (indexPath.row) {
				case 0:
					
					break;
			}
			break;
	}
	
	[tableView deselectRowAtIndexPath:indexPath animated:YES];
}

#pragma mark UIView

- (void)loadView
{
	UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0F, 0.0F, 320.0F, 480.0F)];
	
	view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
	view.backgroundColor = [UIColor whiteColor];

	UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0F, 0.0F, 320.0F, 480.0F) style:UITableViewStyleGrouped];
	tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
	tableView.backgroundColor = [UIColor clearColor];
	tableView.dataSource = self;
	tableView.delegate = self;
	tableView.tag = TKSettingsControllerTableViewTag;
	[view addSubview:tableView];
	[tableView release];
	
	self.view = view;
	[view release];
}

#pragma mark NSObject

- (id)init
{
	self = [super init];
	
	if(self) {
		self.navigationItem.title = NSLocalizedString(@"Settings.Title", nil);
	}
	
	return self;
}

- (void)dealloc 
{
	
    [super dealloc];
}

@end
