[iphone/Barcodes] archive functionnality now works! Sometimes, delete archive will cause a crash, but I cannot reliably reproduce the bug. Also, another little bug is that all scans in archive are of type ABC (text), even though we scan a URL or something

git-svn-id: https://zxing.googlecode.com/svn/trunk@1656 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
rpechayr 2010-11-16 10:29:45 +00:00
parent b19fbf3d4b
commit 635071315f
8 changed files with 46 additions and 20 deletions

View file

@ -139,6 +139,7 @@
1FB4369512918FF0002D63E8 /* ScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanViewController.m; sourceTree = "<group>"; };
1FB4369912919014002D63E8 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
1FB436DE129194E7002D63E8 /* scans.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = scans.db; sourceTree = "<group>"; };
1FB437B612928EDA002D63E8 /* ModalViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModalViewControllerDelegate.h; sourceTree = "<group>"; };
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
@ -189,6 +190,7 @@
1FB430341290002C002D63E8 /* ZXMainViewController.h */,
1FB430351290002C002D63E8 /* ZXMainViewController.mm */,
1FB430361290002C002D63E8 /* ZXMainViewController.xib */,
1FB437B612928EDA002D63E8 /* ModalViewControllerDelegate.h */,
);
path = Classes;
sourceTree = "<group>";
@ -507,6 +509,10 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Barcodes_Prefix.pch;
INFOPLIST_FILE = "Barcodes-Info.plist";
OTHER_LDFLAGS = (
"-all_load",
"-Objc",
);
PRODUCT_NAME = Barcodes;
};
name = Debug;

View file

@ -20,19 +20,18 @@
*/
#import <UIKit/UIKit.h>
//@class DecoderViewController;
#import "ModalViewControllerDelegate.h"
@interface ArchiveController : UITableViewController {
NSMutableArray *scans;
NSMutableArray *results;
// DecoderViewController *decoderViewController;
NSDateFormatter *dateFormatter;
id<ModalViewControllerDelegate> delegate;
}
@property (nonatomic, retain) NSMutableArray *scans;
@property (nonatomic, retain) NSMutableArray *results;
//@property (nonatomic, retain) DecoderViewController *decoderViewController;
@property (nonatomic, assign) id<ModalViewControllerDelegate> delegate;
@property (nonatomic, retain) NSDateFormatter *dateFormatter;
- (NSInteger)scanIndexForRow:(NSInteger)row;

View file

@ -24,7 +24,6 @@
#import "Scan.h"
#import "ResultParser.h"
#import "ParsedResult.h"
//#import "DecoderViewController.h"
#import "ScanViewController.h"
#import "ScanCell.h"
@ -32,7 +31,7 @@
@synthesize scans;
@synthesize results;
//@synthesize decoderViewController;
@synthesize delegate;
@synthesize dateFormatter;
- (id)init {
@ -114,7 +113,7 @@
- (void)dealloc {
[scans release];
[results release];
//[decoderViewController release];
delegate = nil;
[dateFormatter release];
[super dealloc];
}
@ -124,11 +123,8 @@
[super viewDidLoad];
self.title = NSLocalizedString(@"ScanArchiveTitle", @"Scan Archive");
self.navigationItem.rightBarButtonItem = [self editButtonItem];
}
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)] autorelease];
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.scans = [NSMutableArray arrayWithArray:[[Database sharedDatabase] scans]];
self.results = [NSMutableArray arrayWithCapacity:self.scans.count];
for (Scan *scan in scans) {
@ -136,6 +132,15 @@
}
}
-(void)done:(id)sender {
[delegate modalViewControllerWantsToBeDismissed:self];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}

View file

@ -20,11 +20,10 @@
*/
#import <UIKit/UIKit.h>
#import "ModalViewControllerDelegate.h"
@class MessageViewController;
@protocol MessageViewControllerDelegate
- (void)messageViewControllerWantsToBeDispissed:(MessageViewController *)controller;
@end
@interface MessageViewController : UIViewController <UIWebViewDelegate> {
// id callbackTarget;
@ -32,7 +31,7 @@
// SEL callbackSelectorFailure;
NSURL *contentURL;
IBOutlet UIWebView *webView;
id<MessageViewControllerDelegate> delegate;
id<ModalViewControllerDelegate> delegate;
}
//@property (nonatomic, retain) id callbackTarget;
@ -40,7 +39,7 @@
//@property (nonatomic, assign) SEL callbackSelectorFailure;
@property (nonatomic,retain) IBOutlet UIWebView *webView;
@property (nonatomic,assign) id<MessageViewControllerDelegate> delegate;
@property (nonatomic,assign) id<ModalViewControllerDelegate> delegate;
@property (nonatomic, retain) NSURL *contentURL;
- (id)initWithMessageFilename:(NSString *)filename;

View file

@ -44,7 +44,7 @@
}
- (IBAction)dismiss:(id)sender {
[delegate messageViewControllerWantsToBeDispissed:self];
[delegate modalViewControllerWantsToBeDismissed:self];
}
- (void)loadView {

View file

@ -0,0 +1,15 @@
//
// ModalViewControllerDelegate.h
// Barcodes
//
// Created by Romain Pechayre on 11/16/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol ModalViewControllerDelegate
- (void)modalViewControllerWantsToBeDismissed:(UIViewController *)controller;
@end

View file

@ -9,12 +9,13 @@
#import <UIKit/UIKit.h>
#import "ZXingWidgetController.h"
#import "MessageViewController.h"
#import "ModalViewControllerDelegate.h"
@class UniversalResultParser;
@class ParsedResult;
@interface ZXMainViewController : UIViewController <ZXingDelegate,UIActionSheetDelegate,MessageViewControllerDelegate> {
@interface ZXMainViewController : UIViewController <ZXingDelegate,UIActionSheetDelegate,ModalViewControllerDelegate> {
UniversalResultParser *resultParser;
NSArray *actions;
ParsedResult *result;

View file

@ -88,13 +88,14 @@
- (IBAction)showArchive:(id)sender {
ArchiveController *archiveController = [[ArchiveController alloc] init];
archiveController.delegate = self;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:archiveController];
[self presentModalViewController:navController animated:YES];
[navController release];
[archiveController release];
}
- (void)messageViewControllerWantsToBeDispissed:(MessageViewController *)controller {
- (void)modalViewControllerWantsToBeDismissed:(UIViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
}