Commit d00cd180 authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO

switch list type on call if needed

If an incoming call is from a contact in a different list than the one
currently selected, the list is switched to the relevant type.

Change-Id: If01b3fc0939b1b26c9ed9db24429b81fcc0049bf
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent bee94cc8
......@@ -37,7 +37,8 @@
#import <api/newcallmodel.h>
#import <api/behaviorcontroller.h>
#import <api/conversation.h>
#import <api/contactmodel.h>
#import <api/contact.h>
// Ring
#import "AppDelegate.h"
......@@ -129,6 +130,11 @@ NSString* const kChangeAccountToolBarItemIdentifier = @"ChangeAccountToolBarIte
[self](const std::string accountId,
const lrc::api::conversation::Info convInfo){
auto* accInfo = &lrc_->getAccountModel().getAccountInfo(accountId);
if (accInfo->contactModel->getContact(convInfo.participants[0]).profileInfo.type == lrc::api::profile::Type::PENDING)
[smartViewVC selectPendingList];
else
[smartViewVC selectConversationList];
[currentCallVC setCurrentCall:convInfo.callId
conversation:convInfo.uid
account:accInfo];
......@@ -142,6 +148,11 @@ NSString* const kChangeAccountToolBarItemIdentifier = @"ChangeAccountToolBarIte
[self](const std::string accountId,
const lrc::api::conversation::Info convInfo){
auto* accInfo = &lrc_->getAccountModel().getAccountInfo(accountId);
if (accInfo->contactModel->getContact(convInfo.participants[0]).profileInfo.type == lrc::api::profile::Type::PENDING)
[smartViewVC selectPendingList];
else
[smartViewVC selectConversationList];
[currentCallVC setCurrentCall:convInfo.callId
conversation:convInfo.uid
account:accInfo];
......
......@@ -56,4 +56,9 @@ namespace lrc {
*/
-(void)selectConversationList;
/**
* Change list selection to Pending
*/
-(void)selectPendingList;
@end
......@@ -234,6 +234,8 @@ NSInteger const REQUEST_SEG = 1;
-(void) selectConversationList
{
if (currentFilterType == lrc::api::profile::Type::RING)
return;
[listTypeSelector setSelectedSegment:CONVERSATION_SEG];
// Do not invert order of the next two lines or stack overflow
......@@ -243,6 +245,17 @@ NSInteger const REQUEST_SEG = 1;
model_->setFilter("");
}
-(void) selectPendingList
{
if (currentFilterType == lrc::api::profile::Type::PENDING)
return;
[listTypeSelector setSelectedSegment:REQUEST_SEG];
currentFilterType = lrc::api::profile::Type::PENDING;
model_->setFilter(lrc::api::profile::Type::PENDING);
model_->setFilter("");
}
#pragma mark - NSTableViewDelegate methods
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment