CCAdd.m 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // CCAdd.m
  3. // Crypto Cloud Technology Nextcloud
  4. //
  5. // Created by Marino Faggiana on 27/10/14.
  6. // Copyright (c) 2014 TWS. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import "CCAdd.h"
  24. @implementation CCAdd
  25. - (void)viewDidLoad
  26. {
  27. [super viewDidLoad];
  28. self.navigationItem.rightBarButtonItem.title = NSLocalizedString(@"_cancel_", nil);
  29. self.title = NSLocalizedString(@"_add_", nil);
  30. // Color
  31. [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
  32. }
  33. - (void)didReceiveMemoryWarning {
  34. [super didReceiveMemoryWarning];
  35. }
  36. #pragma --------------------------------------------------------------------------------------------
  37. #pragma mark == IBAction ==
  38. #pragma --------------------------------------------------------------------------------------------
  39. - (IBAction)Annula:(UIBarButtonItem *)sender
  40. {
  41. [self dismissViewControllerAnimated:YES completion:NULL];
  42. }
  43. #pragma --------------------------------------------------------------------------------------------
  44. #pragma mark == tableView ==
  45. #pragma --------------------------------------------------------------------------------------------
  46. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  47. {
  48. UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
  49. cell.accessoryType = UITableViewCellAccessoryNone;
  50. UILabel *nameLabel;
  51. NSUInteger section = [indexPath section];
  52. NSUInteger row = [indexPath row];
  53. switch (section)
  54. {
  55. case 0:
  56. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:100]; nameLabel.text = NSLocalizedString(@"_add_folder_", nil); }
  57. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:101]; nameLabel.text = NSLocalizedString(@"_add_photos_videos_", nil); }
  58. break;
  59. case 1:
  60. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:102]; nameLabel.text = NSLocalizedString(@"_add_folder_encryptated_", nil); }
  61. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:103]; nameLabel.text = NSLocalizedString(@"_add_encrypted_photo_video_", nil); }
  62. break;
  63. case 2:
  64. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:108]; nameLabel.text = NSLocalizedString(@"_add_notes_", nil); }
  65. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:107]; nameLabel.text = NSLocalizedString(@"_add_web_account_", nil); }
  66. break;
  67. case 3:
  68. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:104]; nameLabel.text = NSLocalizedString(@"_add_credit_card_", nil); }
  69. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:105]; nameLabel.text = NSLocalizedString(@"_add_atm_", nil); }
  70. if (row == 2) { nameLabel = (UILabel *)[cell viewWithTag:106]; nameLabel.text = NSLocalizedString(@"_add_bank_account_", nil); }
  71. break;
  72. case 4:
  73. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:109]; nameLabel.text = NSLocalizedString(@"_add_driving_license_", nil); }
  74. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:110]; nameLabel.text = NSLocalizedString(@"_add_id_card_", nil); }
  75. if (row == 2) { nameLabel = (UILabel *)[cell viewWithTag:111]; nameLabel.text = NSLocalizedString(@"_add_passport_", nil); }
  76. break;
  77. }
  78. return cell;
  79. }
  80. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  81. {
  82. NSUInteger section = [indexPath section];
  83. NSUInteger row = [indexPath row];
  84. switch (section) {
  85. case 0:
  86. if (row == 0) {
  87. [self dismissViewControllerAnimated:YES completion:^{
  88. [_delegate returnCreate:returnCreaCartellaChiaro];
  89. }];
  90. }
  91. if (row == 1) {
  92. [self dismissViewControllerAnimated:YES completion:^{
  93. [_delegate returnCreate:returnCreaFotoVideoChiaro];
  94. }];
  95. }
  96. break;
  97. case 1:
  98. if (row == 0) {
  99. [self dismissViewControllerAnimated:YES completion:^{
  100. [_delegate returnCreate:returnCreaCartellaCriptata];
  101. }];
  102. }
  103. if (row == 1) {
  104. [self dismissViewControllerAnimated:YES completion:^{
  105. [_delegate returnCreate:returnCreaFotoVideoCriptato];
  106. }];
  107. }
  108. break;
  109. case 2:
  110. if (row == 0) {
  111. [self dismissViewControllerAnimated:YES completion:^{
  112. [_delegate returnCreate:returnNote];
  113. }];
  114. }
  115. if (row == 1) {
  116. [self dismissViewControllerAnimated:YES completion:^{
  117. [_delegate returnCreate:returnAccountWeb];
  118. }];
  119. }
  120. break;
  121. case 3:
  122. if (row == 0) {
  123. [self dismissViewControllerAnimated:YES completion:^{
  124. [_delegate returnCreate:returnCartaDiCredito];
  125. }];
  126. }
  127. if (row == 1) {
  128. [self dismissViewControllerAnimated:YES completion:^{
  129. [_delegate returnCreate:returnBancomat];
  130. }];
  131. }
  132. if (row == 2) {
  133. [self dismissViewControllerAnimated:YES completion:^{
  134. [_delegate returnCreate:returnContoCorrente];
  135. }];
  136. }
  137. break;
  138. case 4:
  139. if (row == 0) {
  140. [self dismissViewControllerAnimated:YES completion:^{
  141. [_delegate returnCreate:returnPatenteGuida];
  142. }];
  143. }
  144. if (row == 1) {
  145. [self dismissViewControllerAnimated:YES completion:^{
  146. [_delegate returnCreate:returnCartaIdentita];
  147. }];
  148. }
  149. if (row == 2) {
  150. [self dismissViewControllerAnimated:YES completion:^{
  151. [_delegate returnCreate:returnPassaporto];
  152. }];
  153. }
  154. break;
  155. }
  156. }
  157. @end