rhodes 2.2.3 → 2.2.4.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/Rakefile +1 -1
- data/bin/c2dm.rb +59 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +4 -0
- data/lib/framework/rho/rho.rb +2 -0
- data/lib/framework/rho/rhoapplication.rb +1 -0
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +1 -1
- data/platform/android/Rhodes/jni/src/callbacks.cpp +21 -0
- data/platform/android/Rhodes/jni/src/nativebar.cpp +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +68 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +34 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +21 -17
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +29 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +37 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +0 -1
- data/platform/android/build/RhodesSRC_build.files +24 -23
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -0
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +42 -20
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +111 -19
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +2 -0
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +2 -1
- data/platform/bb/RubyVM/src/com/rho/net/URI.java +80 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +21 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +6 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +139 -46
- data/platform/bb/build/bb.rake +8 -3
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +32 -21
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +31 -14
- data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +3 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +3 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +28 -0
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +111 -26
- data/platform/iphone/Classes/AppManager/AppManager.m +22 -0
- data/platform/iphone/Classes/DateTimePickerDelegate.m +3 -0
- data/platform/iphone/Classes/MapView/MapViewController.h +8 -3
- data/platform/iphone/Classes/MapView/MapViewController.m +63 -12
- data/platform/iphone/Classes/NativeBar.h +4 -3
- data/platform/iphone/Classes/NativeBar.m +28 -1
- data/platform/iphone/Classes/Rhodes.m +87 -20
- data/platform/iphone/Classes/Signature/SignatureView.m +16 -10
- data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -0
- data/platform/iphone/Classes/SimpleMainView.h +2 -0
- data/platform/iphone/Classes/SimpleMainView.m +120 -35
- data/platform/iphone/Classes/SplashViewController.h +8 -1
- data/platform/iphone/Classes/SplashViewController.m +233 -11
- data/platform/iphone/Classes/SplitView/LeftViewController.h +30 -0
- data/platform/iphone/Classes/SplitView/LeftViewController.m +189 -0
- data/platform/iphone/Classes/SplitView/RightViewController.h +54 -0
- data/platform/iphone/Classes/SplitView/RightViewController.m +268 -0
- data/platform/iphone/Classes/SplitView/SplitViewDelegate.h +22 -0
- data/platform/iphone/Classes/SplitView/SplitViewDelegate.m +92 -0
- data/platform/iphone/Classes/SplitView/SplittedMainView.h +65 -0
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +304 -0
- data/platform/iphone/Classes/TabbedMainView.m +23 -6
- data/platform/iphone/Classes/WebView.m +1 -1
- data/platform/iphone/Info.plist +11 -2
- data/platform/iphone/rbuild/iphone.rake +80 -3
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +50 -3
- data/platform/shared/common/RhoConf.cpp +5 -5
- data/platform/shared/db/DBAdapter.cpp +81 -3
- data/platform/shared/db/DBAdapter.h +1 -0
- data/platform/shared/json/JSONIterator.cpp +5 -0
- data/platform/shared/json/JSONIterator.h +1 -0
- data/platform/shared/net/CURLNetRequest.cpp +2 -2
- data/platform/shared/net/URI.cpp +53 -0
- data/platform/shared/net/URI.h +5 -1
- data/platform/shared/ruby/ext/system/system.i +9 -1
- data/platform/shared/ruby/ext/system/system_wrap.c +2632 -2574
- data/platform/shared/ruby/win32/win32.c +2 -0
- data/platform/shared/ruby/wince/direct.c +4 -0
- data/platform/shared/sync/SyncEngine.cpp +20 -1
- data/platform/shared/sync/SyncEngine.h +6 -1
- data/platform/shared/sync/SyncNotify.cpp +6 -1
- data/platform/shared/sync/SyncSource.cpp +130 -74
- data/platform/shared/sync/SyncSource.h +3 -1
- data/platform/wm/rhodes.sln +30 -22
- data/platform/wm/rhodes/Alert.cpp +4 -3
- data/platform/wm/rhodes/MainWindow.cpp +73 -20
- data/platform/wm/rhodes/RingtoneManager.cpp +4 -4
- data/platform/wm/rhodes/RingtoneManager.h +2 -1
- data/platform/wm/rhodes/Vibrate.cpp +1 -2
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +37 -0
- data/platform/wm/rhodes/rhodes.vcproj +219 -5
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rubylib/rubylib.vcproj +10 -8
- data/platform/wm/sqlite3/sqlite3.vcproj +6 -4
- data/platform/wm/syncengine/syncengine.vcproj +7 -5
- data/platform/wm/tcmalloc/tcmalloc.vcproj +11 -8
- data/rakefile.rb +1 -1
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +9 -1
- data/rhodes.gemspec +1 -1
- data/spec/phone_spec/app/spec/bulksync_spec.rb +71 -1
- metadata +17 -5
@@ -0,0 +1,30 @@
|
|
1
|
+
//
|
2
|
+
// TabbedMainView.h
|
3
|
+
// rhorunner
|
4
|
+
//
|
5
|
+
// Created by Dmitry Moskalchuk on 26.03.10.
|
6
|
+
// Copyright 2010 Rhomobile. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
#import "RhoMainView.h"
|
11
|
+
#import "RhoViewController.h"
|
12
|
+
#import "SplittedMainView.h"
|
13
|
+
|
14
|
+
@interface LeftViewController : UITableViewController {
|
15
|
+
SplittedMainView* splittedView;
|
16
|
+
NSArray *itemsData;
|
17
|
+
int preferredSize;
|
18
|
+
UIFont* myFont;
|
19
|
+
}
|
20
|
+
|
21
|
+
@property (nonatomic,retain) NSArray *itemsData;
|
22
|
+
@property (nonatomic,assign) int preferredSize;
|
23
|
+
@property (nonatomic,retain) UIFont *myFont;
|
24
|
+
|
25
|
+
- (id)initWithItems:(NSArray*)items parent:(SplittedMainView*)p;
|
26
|
+
- (void)setSelection:(int)index;
|
27
|
+
|
28
|
+
- (int)getPreferredWidth;
|
29
|
+
|
30
|
+
@end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
//
|
2
|
+
// TabbedMainView.m
|
3
|
+
// rhorunner
|
4
|
+
//
|
5
|
+
// Created by Dmitry Moskalchuk on 26.03.10.
|
6
|
+
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "LeftViewController.h"
|
10
|
+
#import "SimpleMainView.h"
|
11
|
+
#import "Rhodes.h"
|
12
|
+
#import "AppManager.h"
|
13
|
+
|
14
|
+
#include "common/RhodesApp.h"
|
15
|
+
#include "logging/RhoLog.h"
|
16
|
+
|
17
|
+
#undef DEFAULT_LOGCATEGORY
|
18
|
+
#define DEFAULT_LOGCATEGORY "LeftViewController"
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
@interface RhoLeftItem : NSObject {
|
23
|
+
@public
|
24
|
+
NSString *url;
|
25
|
+
UIImage* image;
|
26
|
+
NSString *title;
|
27
|
+
}
|
28
|
+
|
29
|
+
@property (retain) NSString *url;
|
30
|
+
@property (retain) UIImage *image;
|
31
|
+
@property (retain) NSString *title;
|
32
|
+
|
33
|
+
- (id)init;
|
34
|
+
- (void)dealloc;
|
35
|
+
|
36
|
+
@end
|
37
|
+
|
38
|
+
@implementation RhoLeftItem
|
39
|
+
|
40
|
+
@synthesize url, image, title;
|
41
|
+
|
42
|
+
- (id)init {
|
43
|
+
url = nil;
|
44
|
+
image = nil;
|
45
|
+
title = nil;
|
46
|
+
return self;
|
47
|
+
}
|
48
|
+
|
49
|
+
- (void)dealloc {
|
50
|
+
[url release];
|
51
|
+
[image release];
|
52
|
+
[title release];
|
53
|
+
[super dealloc];
|
54
|
+
}
|
55
|
+
|
56
|
+
@end
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
@implementation LeftViewController
|
61
|
+
|
62
|
+
@synthesize itemsData, preferredSize, myFont;
|
63
|
+
|
64
|
+
- (id)initWithItems:(NSArray*)items parent:(SplittedMainView*)parent {
|
65
|
+
self = [self initWithStyle:UITableViewStylePlain];
|
66
|
+
|
67
|
+
splittedView = parent;
|
68
|
+
|
69
|
+
int count = [items count]/5;
|
70
|
+
NSMutableArray *tabs = [[NSMutableArray alloc] initWithCapacity:count];
|
71
|
+
|
72
|
+
NSString *initUrl = nil;
|
73
|
+
|
74
|
+
self.myFont = [UIFont fontWithName:@"Helvetica-Bold" size:20.0];
|
75
|
+
[self.myFont release];
|
76
|
+
|
77
|
+
self.preferredSize = 0;
|
78
|
+
|
79
|
+
for (int i = 0; i < count; ++i) {
|
80
|
+
int index = i*5 - 1;
|
81
|
+
NSString *label = [items objectAtIndex:++index];
|
82
|
+
NSString *url = [items objectAtIndex:++index];
|
83
|
+
NSString *icon = [items objectAtIndex:++index];
|
84
|
+
NSString *reload = [items objectAtIndex:++index];
|
85
|
+
|
86
|
+
if (!initUrl)
|
87
|
+
initUrl = url;
|
88
|
+
|
89
|
+
if (label && url && icon) {
|
90
|
+
RhoLeftItem *td = [[RhoLeftItem alloc] init];
|
91
|
+
td.url = url;
|
92
|
+
td.title = label;
|
93
|
+
|
94
|
+
NSString *imagePath = [[AppManager getApplicationsRootPath] stringByAppendingPathComponent:icon];
|
95
|
+
td.image = [UIImage imageWithContentsOfFile:imagePath];
|
96
|
+
[tabs addObject:td];
|
97
|
+
|
98
|
+
CGSize textSize = [label sizeWithFont:myFont];
|
99
|
+
int pref_size = td.image.size.width + textSize.width + 32;
|
100
|
+
if (self.preferredSize < pref_size) {
|
101
|
+
self.preferredSize = pref_size;
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
[td release];
|
106
|
+
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
self.itemsData = tabs;
|
112
|
+
[tabs release];
|
113
|
+
|
114
|
+
self.view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight;
|
115
|
+
|
116
|
+
[self.tableView reloadData];
|
117
|
+
[self setSelection:0];
|
118
|
+
|
119
|
+
return self;
|
120
|
+
}
|
121
|
+
|
122
|
+
/*
|
123
|
+
- (void)loadView {
|
124
|
+
UITableView* tv = [[UITableView alloc] initWithFrame:CGRectMake(0,0, 100, 100) style:UITableViewStylePlain];
|
125
|
+
self.view = tv;
|
126
|
+
}
|
127
|
+
*/
|
128
|
+
|
129
|
+
|
130
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
131
|
+
// Return the number of sections.
|
132
|
+
return 1;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
137
|
+
// Return the number of rows in the section.
|
138
|
+
return [self.itemsData count];
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
// Customize the appearance of table view cells.
|
143
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
144
|
+
|
145
|
+
static NSString *CellIdentifier = @"Cell";
|
146
|
+
|
147
|
+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
148
|
+
if (cell == nil) {
|
149
|
+
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
|
150
|
+
}
|
151
|
+
|
152
|
+
cell.imageView.image = [[self.itemsData objectAtIndex:indexPath.row] image];
|
153
|
+
cell.textLabel.text = [NSString stringWithFormat:[[self.itemsData objectAtIndex:indexPath.row] title], indexPath.section, indexPath.row];
|
154
|
+
cell.textLabel.font = myFont;
|
155
|
+
|
156
|
+
|
157
|
+
return cell;
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
162
|
+
return YES;
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
168
|
+
int selectedItem = indexPath.row;
|
169
|
+
[splittedView switchTab:selectedItem];
|
170
|
+
}
|
171
|
+
|
172
|
+
|
173
|
+
- (void)setSelectionCommand:(NSIndexPath*)index {
|
174
|
+
|
175
|
+
[self.tableView selectRowAtIndexPath:index animated:YES scrollPosition:UITableViewScrollPositionNone];
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
- (void)setSelection:(int)index {
|
180
|
+
NSIndexPath* path = [NSIndexPath indexPathForRow:index inSection:0];
|
181
|
+
[self performSelectorOnMainThread:@selector(setSelectionCommand:) withObject:path waitUntilDone:NO];
|
182
|
+
}
|
183
|
+
|
184
|
+
- (int)getPreferredWidth {
|
185
|
+
return self.preferredSize;
|
186
|
+
}
|
187
|
+
|
188
|
+
|
189
|
+
@end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
//
|
2
|
+
// TabbedMainView.h
|
3
|
+
// rhorunner
|
4
|
+
//
|
5
|
+
// Created by Dmitry Moskalchuk on 26.03.10.
|
6
|
+
// Copyright 2010 Rhomobile. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
#import "RhoMainView.h"
|
11
|
+
#import "RhoViewController.h"
|
12
|
+
#import "SplittedMainView.h"
|
13
|
+
|
14
|
+
@interface RightViewController : UIViewController<RhoMainView> {
|
15
|
+
SplittedMainView* splittedView;
|
16
|
+
NSArray *itemsData;
|
17
|
+
int tabindex;
|
18
|
+
|
19
|
+
}
|
20
|
+
|
21
|
+
@property (nonatomic,retain) NSArray *itemsData;
|
22
|
+
@property (nonatomic,assign) int tabindex;
|
23
|
+
|
24
|
+
- (id)initWithItems:(NSArray*)items parent:(SplittedMainView*)parent;
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
//- (UIView*)view;
|
30
|
+
|
31
|
+
- (UIWebView*)detachWebView;
|
32
|
+
|
33
|
+
- (void)loadHTMLString:(NSString*)data;
|
34
|
+
|
35
|
+
- (void)back:(int)index;
|
36
|
+
- (void)forward:(int)index;
|
37
|
+
- (void)navigate:(NSString*)url tab:(int)index;
|
38
|
+
- (void)navigateRedirect:(NSString*)url tab:(int)index;
|
39
|
+
- (void)reload:(int)index;
|
40
|
+
|
41
|
+
- (void)executeJs:(NSString*)js tab:(int)index;
|
42
|
+
|
43
|
+
- (NSString*)currentLocation:(int)index;
|
44
|
+
|
45
|
+
- (void)switchTab:(int)index;
|
46
|
+
- (int)activeTab;
|
47
|
+
|
48
|
+
- (void)addNavBar:(NSString*)title left:(NSArray*)left right:(NSArray*)right;
|
49
|
+
- (void)removeNavBar;
|
50
|
+
|
51
|
+
- (UIWebView*)getWebView:(int)tab_index;
|
52
|
+
|
53
|
+
|
54
|
+
@end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
//
|
2
|
+
// TabbedMainView.m
|
3
|
+
// rhorunner
|
4
|
+
//
|
5
|
+
// Created by Dmitry Moskalchuk on 26.03.10.
|
6
|
+
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "RightViewController.h"
|
10
|
+
#import "SimpleMainView.h"
|
11
|
+
#import "Rhodes.h"
|
12
|
+
#import "AppManager.h"
|
13
|
+
|
14
|
+
#include "common/RhodesApp.h"
|
15
|
+
#include "logging/RhoLog.h"
|
16
|
+
|
17
|
+
#undef DEFAULT_LOGCATEGORY
|
18
|
+
#define DEFAULT_LOGCATEGORY "RightViewController"
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
@interface RhoRightItem : NSObject {
|
24
|
+
@public
|
25
|
+
NSString *url;
|
26
|
+
SimpleMainView* view;
|
27
|
+
BOOL loaded;
|
28
|
+
BOOL reload;
|
29
|
+
}
|
30
|
+
|
31
|
+
@property (retain) NSString *url;
|
32
|
+
@property (retain) SimpleMainView *view;
|
33
|
+
@property (assign) BOOL loaded;
|
34
|
+
@property (assign) BOOL reload;
|
35
|
+
|
36
|
+
- (id)init;
|
37
|
+
- (void)dealloc;
|
38
|
+
|
39
|
+
@end
|
40
|
+
|
41
|
+
@implementation RhoRightItem
|
42
|
+
|
43
|
+
@synthesize url, loaded, reload, view;
|
44
|
+
|
45
|
+
- (id)init {
|
46
|
+
url = nil;
|
47
|
+
view = nil;
|
48
|
+
loaded = NO;
|
49
|
+
reload = NO;
|
50
|
+
return self;
|
51
|
+
}
|
52
|
+
|
53
|
+
- (void)dealloc {
|
54
|
+
[url release];
|
55
|
+
[view release];
|
56
|
+
[super dealloc];
|
57
|
+
}
|
58
|
+
|
59
|
+
@end
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
@implementation RightViewController
|
66
|
+
|
67
|
+
@synthesize itemsData, tabindex;
|
68
|
+
|
69
|
+
- (id)initWithItems:(NSArray*)items parent:(SplittedMainView*)parent {
|
70
|
+
self = [self initWithNibName:nil bundle:nil];
|
71
|
+
|
72
|
+
CGRect rect = CGRectMake(0,0,200,200);//self.view.frame;
|
73
|
+
|
74
|
+
|
75
|
+
int count = [items count]/5;
|
76
|
+
|
77
|
+
NSMutableArray *tabs = [[NSMutableArray alloc] initWithCapacity:count];
|
78
|
+
|
79
|
+
NSString *initUrl = nil;
|
80
|
+
|
81
|
+
for (int i = 0; i < count; ++i) {
|
82
|
+
int index = i*5 - 1;
|
83
|
+
NSString *label = [items objectAtIndex:++index];
|
84
|
+
NSString *url = [items objectAtIndex:++index];
|
85
|
+
NSString *icon = [items objectAtIndex:++index];
|
86
|
+
NSString *reload = [items objectAtIndex:++index];
|
87
|
+
|
88
|
+
if (!initUrl)
|
89
|
+
initUrl = url;
|
90
|
+
|
91
|
+
if (label && url && icon) {
|
92
|
+
RhoRightItem *td = [[RhoRightItem alloc] init];
|
93
|
+
td.url = url;
|
94
|
+
td.reload = [reload isEqualToString:@"true"];
|
95
|
+
|
96
|
+
SimpleMainView *subController = [[SimpleMainView alloc] initWithParentView:parent frame:rect];
|
97
|
+
|
98
|
+
subController.title = label;
|
99
|
+
//subController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
100
|
+
|
101
|
+
td.view = subController;
|
102
|
+
|
103
|
+
[tabs addObject:td];
|
104
|
+
|
105
|
+
[td release];
|
106
|
+
[subController release];
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
self.itemsData = tabs;
|
111
|
+
[tabs release];
|
112
|
+
|
113
|
+
self.view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
114
|
+
self.view.autoresizesSubviews = YES;
|
115
|
+
|
116
|
+
self.tabindex = 0;
|
117
|
+
if (initUrl){
|
118
|
+
[self navigateRedirect:initUrl tab:0];
|
119
|
+
RhoRightItem *ri = [self.itemsData objectAtIndex:tabindex];
|
120
|
+
ri.loaded = YES;
|
121
|
+
}
|
122
|
+
// set first tab
|
123
|
+
SimpleMainView* v = [[self.itemsData objectAtIndex:0] view];
|
124
|
+
if (v != NULL) {
|
125
|
+
[v navigateRedirect:initUrl tab:0];
|
126
|
+
[self.view addSubview:v.view];
|
127
|
+
[self.view setNeedsLayout];
|
128
|
+
[v.view setNeedsDisplay];
|
129
|
+
}
|
130
|
+
|
131
|
+
return self;
|
132
|
+
}
|
133
|
+
|
134
|
+
|
135
|
+
- (void)loadView {
|
136
|
+
CGRect rect = CGRectMake(0,0,200,200);//self.view.frame;
|
137
|
+
UIView* v = [[UIView alloc] initWithFrame:rect];;
|
138
|
+
self.view = v;
|
139
|
+
[v release];
|
140
|
+
}
|
141
|
+
|
142
|
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
143
|
+
return YES;
|
144
|
+
}
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
- (SimpleMainView*) getSimpleView:(int)index {
|
149
|
+
if (index == -1) {
|
150
|
+
index = self.tabindex;
|
151
|
+
}
|
152
|
+
return [[self.itemsData objectAtIndex:index] view];
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
- (UIWebView*)detachWebView {
|
157
|
+
SimpleMainView* v = [self getSimpleView:-1];
|
158
|
+
return [v detachWebView];
|
159
|
+
}
|
160
|
+
|
161
|
+
- (void)loadHTMLString:(NSString*)data {
|
162
|
+
SimpleMainView* v = [self getSimpleView:-1];
|
163
|
+
[v loadHTMLString:data];
|
164
|
+
}
|
165
|
+
|
166
|
+
- (void)back:(int)index {
|
167
|
+
SimpleMainView* v = [self getSimpleView:index];
|
168
|
+
[v back:index];
|
169
|
+
}
|
170
|
+
|
171
|
+
- (void)forward:(int)index {
|
172
|
+
SimpleMainView* v = [self getSimpleView:index];
|
173
|
+
[v forward:index];
|
174
|
+
}
|
175
|
+
|
176
|
+
- (void)navigate:(NSString*)url tab:(int)index {
|
177
|
+
SimpleMainView* v = [self getSimpleView:index];
|
178
|
+
[v navigate:url tab:index];
|
179
|
+
}
|
180
|
+
|
181
|
+
- (void)navigateRedirect:(NSString*)url tab:(int)index {
|
182
|
+
SimpleMainView* v = [self getSimpleView:index];
|
183
|
+
[v navigateRedirect:url tab:index];
|
184
|
+
}
|
185
|
+
|
186
|
+
- (void)reload:(int)index {
|
187
|
+
SimpleMainView* v = [self getSimpleView:index];
|
188
|
+
[v reload:index];
|
189
|
+
}
|
190
|
+
|
191
|
+
- (void)executeJs:(NSString*)js tab:(int)index {
|
192
|
+
SimpleMainView* v = [self getSimpleView:index];
|
193
|
+
[v executeJs:js tab:index];
|
194
|
+
}
|
195
|
+
|
196
|
+
- (NSString*)currentLocation:(int)index {
|
197
|
+
SimpleMainView* v = [self getSimpleView:index];
|
198
|
+
return [v currentLocation:index];
|
199
|
+
}
|
200
|
+
|
201
|
+
- (void)switchTabCommand:(SimpleMainView*)new_v {
|
202
|
+
int index = 0;
|
203
|
+
int i;
|
204
|
+
for (i = 0; i < [self.itemsData count]; i++) {
|
205
|
+
if ([[self.itemsData objectAtIndex:i] view] == new_v) {
|
206
|
+
index = i;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
SimpleMainView* cur_v = [self getSimpleView:tabindex];
|
210
|
+
if (cur_v == new_v) {
|
211
|
+
return;
|
212
|
+
}
|
213
|
+
tabindex = index;
|
214
|
+
RhoRightItem *ri = [self.itemsData objectAtIndex:tabindex];
|
215
|
+
if (!ri.loaded || ri.reload) {
|
216
|
+
const char *s = [ri.url UTF8String];
|
217
|
+
rho_rhodesapp_load_url(s);
|
218
|
+
ri.loaded = YES;
|
219
|
+
}
|
220
|
+
CGRect myframe = self.view.bounds;
|
221
|
+
new_v.view.frame = myframe;
|
222
|
+
[cur_v.view removeFromSuperview];
|
223
|
+
[self.view addSubview:new_v.view];
|
224
|
+
[self.view setNeedsLayout];
|
225
|
+
//[self.view layoutSubviews];
|
226
|
+
//[self.view.superview setNeedsLayout];
|
227
|
+
//[new_v.view setNeedsDisplay];
|
228
|
+
}
|
229
|
+
|
230
|
+
- (void)switchTab:(int)index {
|
231
|
+
SimpleMainView* new_v = [self getSimpleView:index];
|
232
|
+
[self performSelectorOnMainThread:@selector(switchTabCommand:) withObject:new_v waitUntilDone:NO];
|
233
|
+
}
|
234
|
+
|
235
|
+
- (int)activeTab {
|
236
|
+
return tabindex;
|
237
|
+
}
|
238
|
+
|
239
|
+
- (void)addNavBar:(NSString*)title left:(NSArray*)left right:(NSArray*)right {
|
240
|
+
SimpleMainView* v = [self getSimpleView:index];
|
241
|
+
[v addNavBar:title left:left right:right];
|
242
|
+
}
|
243
|
+
|
244
|
+
- (void)removeNavBar {
|
245
|
+
SimpleMainView* v = [self getSimpleView:index];
|
246
|
+
[v removeNavBar];
|
247
|
+
}
|
248
|
+
|
249
|
+
- (UIWebView*)getWebView:(int)tab_index {
|
250
|
+
SimpleMainView* v = [self getSimpleView:index];
|
251
|
+
return [v getWebView:tab_index];
|
252
|
+
}
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
- (void)dealloc {
|
257
|
+
[itemsData release];
|
258
|
+
[super dealloc];
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
@end
|