Commit 21666f38 authored by Alexandre Lision's avatar Alexandre Lision

ui: adapt to recentmodel changes

when there is only one call with the peer, do not show a child.

Issue: #75334
Change-Id: Ia0e9cb381771ca4d1d9282651632333498294c97
parent eab969c4
......@@ -250,12 +250,6 @@
[self animateOut];
});
QObject::connect(CallModel::instance(),
&QAbstractItemModel::dataChanged,
[=](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
[self updateCall];
});
QObject::connect(CallModel::instance()->userActionModel(),
&QAbstractItemModel::dataChanged,
[=](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
......@@ -427,6 +421,12 @@
/* check if text media is already present */
if(!CallModel::instance()->selectedCall())
return;
QObject::connect(CallModel::instance()->selectedCall(),
&Call::changed,
[=]() {
[self updateCall];
});
if (CallModel::instance()->selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) {
Media::Text *text = CallModel::instance()->selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::IN);
[self monitorIncomingTextMessages:text];
......
......@@ -181,7 +181,7 @@
QObject::connect(self->privateQModel,
&QAbstractItemModel::rowsAboutToBeRemoved,
[self](const QModelIndex & parent, int first, int last) {
for( int row = first; row <= last; row++) {
for( int row = last; row >= first; --row) {
//qDebug() << "REMOVING:"<< self->privateQModel->index(row, 0, parent) ;
if (!self->privateQModel->index(row, 0, parent).isValid())
continue;
......
......@@ -118,7 +118,8 @@ NSInteger const TXT_BUTTON_TAG = 500;
c->setPeerContactMethod(m);
c << Call::Action::ACCEPT;
[smartView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:1] byExtendingSelection:NO];
[smartView deselectAll:nil];
[smartView selectRowIndexes:[[NSIndexSet alloc] initWithIndex:0] byExtendingSelection:NO];
}
}
......@@ -180,9 +181,9 @@ NSInteger const TXT_BUTTON_TAG = 500;
QModelIndex qIdx = [treeController toQIdx:[treeController selectedNodes][0]];
// ask the tree controller for the current selection
if(auto selected = RecentModel::instance()->getActiveCall(qIdx.parent())) {
if (auto selected = RecentModel::instance()->getActiveCall(qIdx)) {
CallModel::instance()->selectCall(selected);
} else if (auto selected = RecentModel::instance()->getActiveCall(qIdx)){
} else if (auto selected = RecentModel::instance()->getActiveCall(qIdx.parent())){
CallModel::instance()->selectCall(selected);
} else {
CallModel::instance()->selectionModel()->clearCurrentIndex();
......@@ -201,7 +202,14 @@ NSInteger const TXT_BUTTON_TAG = 500;
[((ContextualTableCellView*) result) setContextualsControls:[NSMutableArray arrayWithObject:[result viewWithTag:CALL_BUTTON_TAG]]];
[details setStringValue:qIdx.data((int)Person::Role::FormattedLastUsed).toString().toNSString()];
if (auto call = RecentModel::instance()->getActiveCall(qIdx)) {
[details setStringValue:call->roleData((int)Call::Role::HumanStateName).toString().toNSString()];
[((ContextualTableCellView*) result) setActiveState:YES];
} else {
[details setStringValue:qIdx.data((int)Person::Role::FormattedLastUsed).toString().toNSString()];
[((ContextualTableCellView*) result) setActiveState:NO];
}
} else {
result = [outlineView makeViewWithIdentifier:@"CallCell" owner:outlineView];
NSTextField* details = [result viewWithTag:DETAILS_TAG];
......
......@@ -26,4 +26,9 @@
*/
@property (nonatomic) NSMutableArray* contextualsControls;
/**
* BOOL specifying if controls should be presented when mouse is hover
*/
@property (nonatomic) BOOL activeState;
@end
......@@ -54,6 +54,9 @@
- (void)mouseEntered:(NSEvent *)theEvent
{
if (self.activeState)
return;
for (NSView* item in self.contextualsControls) {
[item setHidden:NO];
}
......
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