Skip to content

Commit

Permalink
- Fixed a bug that would show the previously Added data in a new Add …
Browse files Browse the repository at this point in the history
…data dialog

- Refactored some clearSelection code
  • Loading branch information
pele1410 committed Jan 19, 2013
1 parent 28a5cd6 commit b88294a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
3 changes: 3 additions & 0 deletions UI/BackupMinderUI_Xcode3/Classes/AddPanelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ enum panelMode_t
// Param: sender_, Id of the sender object
- (IBAction)selectArchiveDestination:(id)sender_;

// Brief: Reset the text fields
- (void)clearSelection;

@end

#endif //ADD_PANEL_CONTROLLER_H
25 changes: 16 additions & 9 deletions UI/BackupMinderUI_Xcode3/Classes/AddPanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -374,20 +374,16 @@ - (IBAction)commit:(id)sender_
contextInfo:nil];
return;
}


[self clearSelection];

[[self window] orderOut:nil];
[NSApp endSheet:[self window]];
}

- (IBAction)cancel:(id)sender_
{
// Clear the textFields
[m_nameTextField setStringValue:@""];
[m_backupSourceTextField setStringValue:@""];
[m_archiveDestinationTextField setStringValue:@""];
[m_nameContainsTextField setStringValue:@""];
[m_backupsToLeaveTextField setStringValue:kBackupsToLeaveDefault];
[m_warnDaysTextField setStringValue:kWarnDaysDefault];
{
[self clearSelection];

[[self window] orderOut:nil];
[NSApp endSheet:[self window]];
Expand Down Expand Up @@ -448,4 +444,15 @@ - (IBAction)selectArchiveDestination:(id)sender_
}
}

- (void)clearSelection
{
// Clear the textFields
[m_nameTextField setStringValue:@""];
[m_backupSourceTextField setStringValue:@""];
[m_archiveDestinationTextField setStringValue:@""];
[m_nameContainsTextField setStringValue:@""];
[m_backupsToLeaveTextField setStringValue:kBackupsToLeaveDefault];
[m_warnDaysTextField setStringValue:kWarnDaysDefault];
}

@end
3 changes: 3 additions & 0 deletions UI/BackupMinderUI_Xcode3/Classes/MainMenuController.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
// Param: sender_, Id of the sender object
- (IBAction)refresh:(id)sender_;

// Brief: Reset the table selection and clear the table selection
- (void)clearSelection;

@end

#endif //MAIN_MENU_CONTROLLER_H
21 changes: 13 additions & 8 deletions UI/BackupMinderUI_Xcode3/Classes/MainMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ - (IBAction)refresh:(id)sender_
[m_backupsTableView reloadData];
}

- (void)clearSelection
{
[m_backupsTableView reloadData];

// Unselect the row so that the user must click
// on a row again to update the information
// Otherwise the information displayed might be stale
[m_backupsTableView deselectAll:nil];
}

#pragma mark -
#pragma mark Table Data Source Methods

Expand Down Expand Up @@ -378,7 +388,7 @@ - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode
return;
}

[m_backupsTableView reloadData];
[self clearSelection];
}
}

Expand All @@ -387,13 +397,8 @@ - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode

- (void)sheetDidEnd:(NSWindow *)sheet_ returnCode:(NSInteger)returnCode_
contextInfo:(void *)contextInfo_
{
[m_backupsTableView reloadData];

// Unselect the row so that the user must click
// on a row again to update the information
// Otherwise the information displayed might be stale
[m_backupsTableView deselectAll:nil];
{
[self clearSelection];
}

@end

0 comments on commit b88294a

Please sign in to comment.