Add Contact: disable MAC Address book
Do not add contact to MAC Address book when new person is created.
In future option "add to MAC contact" should be selected by user.
Change-Id: Ic93668d85838bd3408e5653e52216e3f7f32eb4e
Reviewed-by: Anthony LĂ©onard <anthony.leonard@savoirfairelinux.com>
diff --git a/src/PersonLinkerVC.mm b/src/PersonLinkerVC.mm
index d40646d..d501c83 100644
--- a/src/PersonLinkerVC.mm
+++ b/src/PersonLinkerVC.mm
@@ -29,12 +29,11 @@
#import <contactmethod.h>
#import <numbercategorymodel.h>
#import <globalinstances.h>
+#import <peerprofilecollection.h>
#import "QNSTreeController.h"
#import "delegates/ImageManipulationDelegate.h"
-#import "backends/AddressBookBackend.h"
-#import <AddressBook/AddressBook.h>
class OnlyPersonProxyModel : public QSortFilterProxyModel
{
@@ -142,8 +141,7 @@
- (IBAction)presentNewContactForm:(id)sender {
[createContactSubview setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
//[createContactSubview setBounds:linkToExistingSubview.bounds];
- BOOL shoudHide = [ABAddressBook sharedAddressBook] == nil;
- [addCloudContactMsg setHidden:shoudHide];
+ [addCloudContactMsg setHidden:TRUE];
[createContactSubview setFrame:linkToExistingSubview.frame];
[linkToExistingSubview setHidden:YES];
@@ -174,7 +172,15 @@
numbers << self.methodToLink;
p->setContactMethods(numbers);
self.methodToLink->setPerson(p);
- PersonModel::instance().addNewPerson(p);
+ auto personCollections = PersonModel::instance().collections();
+ CollectionInterface *peerProfileCollection = nil;
+ foreach(auto collection, personCollections) {
+ if(dynamic_cast<PeerProfileCollection*>(collection))
+ peerProfileCollection = collection;
+ }
+ if(peerProfileCollection) {
+ PersonModel::instance().addNewPerson(p, peerProfileCollection);
+ }
[self.contactLinkedDelegate contactLinked];
}