+ [self _startLoading];
+}
+
+- (UIBarButtonItemStyle) rightButtonStyle {
+ if (style_ == nil) normal:
+ return UIBarButtonItemStylePlain;
+ else if ([style_ isEqualToString:@"Normal"])
+ return UIBarButtonItemStylePlain;
+ else if ([style_ isEqualToString:@"Highlighted"])
+ return UIBarButtonItemStyleDone;
+ else goto normal;
+}
+
+- (UIBarButtonItem *) customButton {
+ UIBarButtonItem *customItem = [[UIBarButtonItem alloc]
+ initWithTitle:button_
+ style:[self rightButtonStyle]
+ target:self
+ action:@selector(customButtonClicked)
+ ];
+
+ return [customItem autorelease];
+}
+
+- (UIBarButtonItem *) rightButton {
+ return reloaditem_;
+}
+
+- (void) applyLoadingTitle {
+ [[self navigationItem] setTitle:UCLocalize("LOADING")];
+}
+
+- (void) applyRightButton {
+ if ([self isLoading]) {
+ [[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
+ [[loadingitem_ view] addSubview:indicator_];
+ [self applyLoadingTitle];
+ } else if (button_) {
+ [[self navigationItem] setRightBarButtonItem:[self customButton] animated:YES];
+ } else {
+ [[self navigationItem] setRightBarButtonItem:[self rightButton] animated:YES];
+ }
+}
+
+- (void) _startLoading {
+ [self applyRightButton];