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

close right panel on list type change

Modification of list type by user interaction means that the selected
conversation, if any, is left in the former list and is not present in
the one now selected. As this item disappear, we close the right
panel.

Change-Id: I97af4c4e461640d2a0b36af5b11408e288a1a630
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent 4bfd68b4
......@@ -62,4 +62,11 @@ namespace lrc {
*/
-(void) currentConversationTrusted;
/**
* Triggered by SmartView when list type is changed by user. It closes the right view as the selected conversation
* is not in filtered list anymore.
* @note This method is not to be used if list change is triggered by a left panel view.
*/
-(void) listTypeChanged;
@end
......@@ -378,6 +378,11 @@ NSString* const kChangeAccountToolBarItemIdentifier = @"ChangeAccountToolBarIte
[smartViewVC selectConversationList];
}
-(void) listTypeChanged {
[offlineVC animateOut];
[currentCallVC animateOut];
}
#pragma mark - NSToolbarDelegate
- (nullable NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{
......
......@@ -44,6 +44,7 @@
#import "views/RingTableView.h"
#import "views/ContextualTableCellView.h"
#import "utils.h"
#import "RingWindowController.h"
@interface SmartViewVC () <NSTableViewDelegate, NSTableViewDataSource, NSPopoverDelegate, ContextMenuDelegate, ContactLinkedDelegate, KeyboardShortcutDelegate> {
......@@ -59,6 +60,8 @@
lrc::api::ConversationModel* model_;
std::string selectedUid_;
lrc::api::profile::Type currentFilterType;
__unsafe_unretained IBOutlet RingWindowController *delegate;
}
@end
......@@ -211,12 +214,18 @@ NSInteger const REQUEST_SEG = 1;
NSInteger selectedItem = [sender selectedSegment];
switch (selectedItem) {
case CONVERSATION_SEG:
model_->setFilter(lrc::api::profile::Type::RING);
currentFilterType = lrc::api::profile::Type::RING;
if (currentFilterType != lrc::api::profile::Type::RING) {
model_->setFilter(lrc::api::profile::Type::RING);
[delegate listTypeChanged];
currentFilterType = lrc::api::profile::Type::RING;
}
break;
case REQUEST_SEG:
model_->setFilter(lrc::api::profile::Type::PENDING);
currentFilterType = lrc::api::profile::Type::PENDING;
if (currentFilterType != lrc::api::profile::Type::PENDING) {
model_->setFilter(lrc::api::profile::Type::PENDING);
[delegate listTypeChanged];
currentFilterType = lrc::api::profile::Type::PENDING;
}
break;
default:
NSLog(@"Invalid item selected in list selector: %d", selectedItem);
......
......@@ -499,6 +499,7 @@
</window>
<viewController id="jrf-42-1l2" customClass="SmartViewVC">
<connections>
<outlet property="delegate" destination="-2" id="SN7-eQ-w8z"/>
<outlet property="listTypeSelector" destination="3Nq-Rz-Etg" id="hvc-OL-Hc5"/>
<outlet property="searchField" destination="PoQ-x4-ES3" id="pOb-2e-PPS"/>
<outlet property="smartView" destination="tcL-dy-Q3h" id="Zc4-OM-Xk7"/>
......
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