CCAdd.m 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. if (row == 2) { nameLabel = (UILabel *)[cell viewWithTag:102]; nameLabel.text = NSLocalizedString(@"_add_photos_videos_", nil); }
  59. break;
  60. case 1:
  61. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:200]; nameLabel.text = NSLocalizedString(@"_add_folder_encryptated_", nil); }
  62. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:201]; nameLabel.text = NSLocalizedString(@"_add_encrypted_photo_video_", nil); }
  63. if (row == 2) { nameLabel = (UILabel *)[cell viewWithTag:202]; nameLabel.text = NSLocalizedString(@"_add_encrypted_photo_video_", nil); }
  64. break;
  65. case 2:
  66. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:300]; nameLabel.text = NSLocalizedString(@"_add_notes_", nil); }
  67. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:301]; nameLabel.text = NSLocalizedString(@"_add_web_account_", nil); }
  68. break;
  69. case 3:
  70. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:400]; nameLabel.text = NSLocalizedString(@"_add_credit_card_", nil); }
  71. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:401]; nameLabel.text = NSLocalizedString(@"_add_atm_", nil); }
  72. if (row == 2) { nameLabel = (UILabel *)[cell viewWithTag:402]; nameLabel.text = NSLocalizedString(@"_add_bank_account_", nil); }
  73. break;
  74. case 4:
  75. if (row == 0) { nameLabel = (UILabel *)[cell viewWithTag:500]; nameLabel.text = NSLocalizedString(@"_add_driving_license_", nil); }
  76. if (row == 1) { nameLabel = (UILabel *)[cell viewWithTag:501]; nameLabel.text = NSLocalizedString(@"_add_id_card_", nil); }
  77. if (row == 2) { nameLabel = (UILabel *)[cell viewWithTag:502]; nameLabel.text = NSLocalizedString(@"_add_passport_", nil); }
  78. break;
  79. }
  80. return cell;
  81. }
  82. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  83. {
  84. NSUInteger section = [indexPath section];
  85. NSUInteger row = [indexPath row];
  86. switch (section) {
  87. case 0:
  88. if (row == 0) {
  89. [self dismissViewControllerAnimated:YES completion:^{
  90. [_delegate returnCreate:returnCreateFolderPlain];
  91. }];
  92. }
  93. if (row == 1) {
  94. [self dismissViewControllerAnimated:YES completion:^{
  95. [_delegate returnCreate:returnCreateFotoVideoPlain];
  96. }];
  97. }
  98. if (row == 2) {
  99. [self dismissViewControllerAnimated:YES completion:^{
  100. [_delegate returnCreate:returnCreateFilePlain];
  101. }];
  102. }
  103. break;
  104. case 1:
  105. if (row == 0) {
  106. [self dismissViewControllerAnimated:YES completion:^{
  107. [_delegate returnCreate:returnCreateFolderEncrypted];
  108. }];
  109. }
  110. if (row == 1) {
  111. [self dismissViewControllerAnimated:YES completion:^{
  112. [_delegate returnCreate:returnCreateFotoVideoEncrypted];
  113. }];
  114. }
  115. if (row == 2) {
  116. [self dismissViewControllerAnimated:YES completion:^{
  117. [_delegate returnCreate:returnCreateFileEncrypted];
  118. }];
  119. }
  120. break;
  121. case 2:
  122. if (row == 0) {
  123. [self dismissViewControllerAnimated:YES completion:^{
  124. [_delegate returnCreate:returnNote];
  125. }];
  126. }
  127. if (row == 1) {
  128. [self dismissViewControllerAnimated:YES completion:^{
  129. [_delegate returnCreate:returnAccountWeb];
  130. }];
  131. }
  132. break;
  133. case 3:
  134. if (row == 0) {
  135. [self dismissViewControllerAnimated:YES completion:^{
  136. [_delegate returnCreate:returnCartaDiCredito];
  137. }];
  138. }
  139. if (row == 1) {
  140. [self dismissViewControllerAnimated:YES completion:^{
  141. [_delegate returnCreate:returnBancomat];
  142. }];
  143. }
  144. if (row == 2) {
  145. [self dismissViewControllerAnimated:YES completion:^{
  146. [_delegate returnCreate:returnContoCorrente];
  147. }];
  148. }
  149. break;
  150. case 4:
  151. if (row == 0) {
  152. [self dismissViewControllerAnimated:YES completion:^{
  153. [_delegate returnCreate:returnPatenteGuida];
  154. }];
  155. }
  156. if (row == 1) {
  157. [self dismissViewControllerAnimated:YES completion:^{
  158. [_delegate returnCreate:returnCartaIdentita];
  159. }];
  160. }
  161. if (row == 2) {
  162. [self dismissViewControllerAnimated:YES completion:^{
  163. [_delegate returnCreate:returnPassaporto];
  164. }];
  165. }
  166. break;
  167. }
  168. }
  169. @end