Skip to content
Snippets Groups Projects
Commit 01cf5e38 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

chat: update RecentModel selection

Clear RecentModel current index:
- during a call when the call is OVER
- in chat view when clicking on back button

This allow to reselect the previous row, and visually reset
the row (remove highlight state)

Change-Id: I36f531c6304ce48f0be3cc541f28a21d73a05262
Tuleap: #202
parent 22d615bd
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
-(void) initFrame;
-(void) animateIn;
-(IBAction) animateOut:(id)sender;
-(void) animateOut;
/**
* Message contained in messageField TextField.
......
......@@ -44,7 +44,6 @@
@interface ConversationVC () <NSOutlineViewDelegate> {
__unsafe_unretained IBOutlet IconButton* backButton;
__unsafe_unretained IBOutlet NSTextField* messageField;
QVector<ContactMethod*> contactMethods;
NSMutableString* textSelection;
......@@ -141,6 +140,11 @@
}
}
- (IBAction)backPressed:(id)sender {
[conversationView setDelegate:nil];
RecentModel::instance().selectionModel()->clearCurrentIndex();
}
# pragma mark private IN/OUT animations
-(void) animateIn
......@@ -159,7 +163,7 @@
[CATransaction commit];
}
-(IBAction) animateOut:(id)sender
-(void) animateOut
{
if(self.view.frame.origin.x < 0) {
return;
......@@ -359,6 +363,7 @@
treeController = [[QNSTreeController alloc] initWithQModel:txtRecording->instantMessagingModel()];
[treeController setAvoidsEmptySelection:NO];
[treeController setChildrenKeyPath:@"children"];
[conversationView setDelegate:self];
[conversationView bind:@"content" toObject:treeController withKeyPath:@"arrangedObjects" options:nil];
[conversationView bind:@"sortDescriptors" toObject:treeController withKeyPath:@"sortDescriptors" options:nil];
[conversationView bind:@"selectionIndexPaths" toObject:treeController withKeyPath:@"selectionIndexPaths" options:nil];
......
......@@ -266,7 +266,7 @@
[self animateOut];
else if (CallModel::instance().getIndex(c) == current) {
if (c->state() == Call::State::OVER) {
[self animateOut];
RecentModel::instance().selectionModel()->clearCurrentIndex();
} else {
[self updateCall];
}
......
......@@ -88,7 +88,7 @@ static NSString* const kPreferencesIdentifier = @"PreferencesIdentifier";
[=](const QModelIndex &current, const QModelIndex &previous) {
auto call = RecentModel::instance().getActiveCall(current);
if(!current.isValid()) {
[offlineVC animateOut:self];
[offlineVC animateOut];
[currentCallVC animateOut];
return;
}
......@@ -98,7 +98,7 @@ static NSString* const kPreferencesIdentifier = @"PreferencesIdentifier";
[offlineVC animateIn];
} else {
[currentCallVC animateIn];
[offlineVC animateOut:self];
[offlineVC animateOut];
}
});
}
......
......@@ -98,8 +98,10 @@ NSInteger const TXT_BUTTON_TAG = 500;
QObject::connect(RecentModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
if(!current.isValid()) {
[smartView deselectAll:nil];
return;
}
auto proxyIdx = RecentModel::instance().peopleProxy()->mapFromSource(current);
if (proxyIdx.isValid()) {
......
......@@ -6,7 +6,6 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConversationVC">
<connections>
<outlet property="backButton" destination="ooq-vs-Xt1" id="BKE-0Z-BFy"/>
<outlet property="contactMethodsPopupButton" destination="xdB-aI-PSs" id="BZW-FI-WpH"/>
<outlet property="conversationTitle" destination="ucx-6g-eJw" id="40T-pM-nix"/>
<outlet property="conversationView" destination="bOO-CW-S21" id="NkS-gm-3Qn"/>
......@@ -160,7 +159,7 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="animateOut:" target="-2" id="t7C-zL-3sv"/>
<action selector="backPressed:" target="-2" id="Vfg-Ve-O7w"/>
</connections>
</button>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xdB-aI-PSs" userLabel="CMs Popup menu">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment