Loïc Siret | fcb4ca6 | 2016-09-21 17:12:09 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015-2016 Savoir-faire Linux Inc. |
| 3 | * Author: Loïc Siret <loic.siret@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | */ |
| 19 | |
| 20 | #import "RingWizardChooseVC.h" |
| 21 | |
| 22 | @interface RingWizardChooseVC() |
| 23 | |
| 24 | @end |
| 25 | |
Kateryna Kostiuk | ecaa395 | 2018-07-13 16:00:34 -0400 | [diff] [blame] | 26 | @implementation RingWizardChooseVC { |
| 27 | |
| 28 | __unsafe_unretained IBOutlet NSButton* createSIPAccount; |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 29 | __unsafe_unretained IBOutlet NSButton* connectToManager; |
| 30 | __unsafe_unretained IBOutlet NSLayoutConstraint* viewBottomConstraint; |
Kateryna Kostiuk | ecaa395 | 2018-07-13 16:00:34 -0400 | [diff] [blame] | 31 | |
| 32 | } |
Loïc Siret | fcb4ca6 | 2016-09-21 17:12:09 -0400 | [diff] [blame] | 33 | |
| 34 | @synthesize delegate; |
| 35 | |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 36 | - (void)showInitialwithCancell:(BOOL)showCancel { |
Kateryna Kostiuk | 23222fe | 2018-11-16 14:28:02 -0500 | [diff] [blame] | 37 | self.isCancelable = showCancel; |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 38 | [self.view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; |
| 39 | [createSIPAccount setHidden: YES]; |
| 40 | [connectToManager setHidden: YES]; |
| 41 | viewBottomConstraint.constant = showCancel ? 25 : 0; |
Kateryna Kostiuk | 23222fe | 2018-11-16 14:28:02 -0500 | [diff] [blame] | 42 | } |
| 43 | |
Loïc Siret | fcb4ca6 | 2016-09-21 17:12:09 -0400 | [diff] [blame] | 44 | - (IBAction)createRingAccount:(id)sender |
| 45 | { |
| 46 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
| 47 | [delegate didCompleteWithAction:WizardAction::WIZARD_ACTION_NEW]; |
| 48 | } |
| 49 | } |
| 50 | |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 51 | - (IBAction)importFromArchive:(id)sender |
Loïc Siret | fcb4ca6 | 2016-09-21 17:12:09 -0400 | [diff] [blame] | 52 | { |
| 53 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 54 | [delegate didCompleteWithAction:WizardAction::WIZARD_ACTION_IMPORT_FROM_ADCHIVE]; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | - (IBAction)importFromDevice:(id)sender |
| 59 | { |
| 60 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
| 61 | [delegate didCompleteWithAction:WizardAction::WIZARD_ACTION_IMPORT_FROM_DEVICE]; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | - (IBAction)connectToAccountManager:(id)sender |
| 66 | { |
| 67 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
| 68 | [delegate didCompleteWithAction:WizardAction::WIZARD_ACTION_ACCOUNT_MANAGER]; |
Loïc Siret | fcb4ca6 | 2016-09-21 17:12:09 -0400 | [diff] [blame] | 69 | } |
| 70 | } |
| 71 | |
| 72 | - (IBAction)onCancel:(id)sender |
| 73 | { |
| 74 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
| 75 | [delegate didCompleteWithAction:WIZARD_ACTION_INVALID]; |
| 76 | } |
| 77 | } |
| 78 | |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 79 | - (IBAction)expandAdwanced:(id)sender |
Kateryna Kostiuk | ecaa395 | 2018-07-13 16:00:34 -0400 | [diff] [blame] | 80 | { |
| 81 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
Kateryna Kostiuk | c7e68f3 | 2019-10-09 16:15:45 -0400 | [diff] [blame] | 82 | [createSIPAccount setHidden: !createSIPAccount.isHidden]; |
| 83 | [connectToManager setHidden: !connectToManager.isHidden]; |
Kateryna Kostiuk | ecaa395 | 2018-07-13 16:00:34 -0400 | [diff] [blame] | 84 | [delegate didCompleteWithAction:WIZARD_ACTION_ADVANCED]; |
| 85 | } |
Kateryna Kostiuk | ecaa395 | 2018-07-13 16:00:34 -0400 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | - (IBAction)addSIPAccount:(id)sender |
| 89 | { |
| 90 | if ([self.delegate respondsToSelector:@selector(didCompleteWithAction:)]){ |
| 91 | [delegate didCompleteWithAction:WIZARD_ACTION_SIP_ACCOUNT]; |
| 92 | } |
| 93 | } |
| 94 | |
Loïc Siret | fcb4ca6 | 2016-09-21 17:12:09 -0400 | [diff] [blame] | 95 | @end |