Commit 16d9c0a2 authored by Alexandre Lision's avatar Alexandre Lision Committed by gerrit2

focus: fix chat

The ring ID label behind was receiving click events instead of the chat field.
This fix moves the ring ID label to prevent interference with on-top ui,
and gives focus to the chat field automatically when uncollapsing the chat
view.

Issue: #78879
Change-Id: Ib46dd3054978f295d8b63c8f28a056533e027145
parent 18e1fcd9
/*
* Copyright (C) 2015 Savoir-Faire Linux Inc.
* Copyright (C) 2015 Savoir-faire Linux Inc.
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -38,4 +38,6 @@
*/
@property (retain) NSString* message;
- (void) takeFocus;
@end
......@@ -84,6 +84,7 @@
[chatView setDefaultParagraphStyle:paragraphStyle];
}
- (void) setupChat
{
QObject::disconnect(mediaHolder.newMediaAdded);
......@@ -165,6 +166,11 @@
}
- (void) takeFocus
{
[self.view.window makeFirstResponder:self.messageField];
}
- (IBAction)sendMessage:(id)sender {
QModelIndex callIdx = CallModel::instance()->selectionModel()->currentIndex();
......
......@@ -46,6 +46,7 @@
#import "views/ITProgressIndicator.h"
#import "views/CallView.h"
#import "PersonLinkerVC.h"
#import "ChatVC.h"
@interface RendererConnectionsHolder : NSObject
......@@ -80,6 +81,7 @@
@property (strong) IBOutlet NSPopover *qualityPopOver;
@property (strong) NSPopover* addToContactPopover;
@property (strong) IBOutlet ChatVC *chatVC;
@property QHash<int, NSButton*> actionHash;
......@@ -531,6 +533,8 @@
[left setFrameSize:leftFrame.size];
[right setFrame:rightFrame];
[splitView display];
[self.chatVC takeFocus];
}
......
......@@ -72,7 +72,8 @@ static NSString* const kCallButtonIdentifer = @"CallButtonIdentifier";
PersonModel::instance()->addCollection<AddressBookBackend>(LoadOptions::FORCE_ENABLED);
[callView addSubview:[self.currentVC view]];
[callView addSubview:[self.currentVC view] positioned:NSWindowAbove relativeTo:nil];
[currentVC initFrame];
// Update Ring ID label based on account model changes
......
......@@ -8,6 +8,7 @@
<connections>
<outlet property="addContactButton" destination="Zss-6A-bSy" id="Px0-5v-NE7"/>
<outlet property="chatButton" destination="fmp-x4-Pef" id="ARt-dr-TRo"/>
<outlet property="chatVC" destination="LWe-df-dS6" id="SMR-T0-fYe"/>
<outlet property="controlsPanel" destination="Eoi-B8-iL6" id="4xn-3b-SNn"/>
<outlet property="hangUpButton" destination="Kjq-iM-NBL" id="Puz-4L-Okl"/>
<outlet property="holdOnOffButton" destination="anb-Y8-JQi" id="HSl-pE-Kwg"/>
......@@ -28,14 +29,14 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<customView wantsLayer="YES" id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="1014" height="509"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GIJ-gB-FZo">
<splitView wantsLayer="YES" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GIJ-gB-FZo">
<rect key="frame" x="0.0" y="0.0" width="1014" height="509"/>
<subviews>
<customView id="2wf-Py-l6B" customClass="CallView">
<customView wantsLayer="YES" id="2wf-Py-l6B" customClass="CallView">
<rect key="frame" x="0.0" y="0.0" width="675" height="509"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
......@@ -78,7 +79,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button hidden="YES" wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zss-6A-bSy" userLabel="Chat">
<button hidden="YES" wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zss-6A-bSy" userLabel="AddToContact">
<rect key="frame" x="107" y="6" width="54" height="32"/>
<backgroundFilters>
<ciFilter name="CIColorMonochrome">
......@@ -303,7 +304,7 @@
<constraint firstItem="Eoi-B8-iL6" firstAttribute="leading" secondItem="2wf-Py-l6B" secondAttribute="leading" constant="20" id="sHw-xg-QAo"/>
</constraints>
</customView>
<customView id="TdD-3L-553">
<customView wantsLayer="YES" id="TdD-3L-553">
<rect key="frame" x="676" y="0.0" width="338" height="509"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
......@@ -321,7 +322,7 @@
<binding destination="LWe-df-dS6" name="enabled" keyPath="self.message.length" id="ec2-s1-Hpt"/>
</connections>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBX-o0-u1k">
<textField wantsLayer="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBX-o0-u1k">
<rect key="frame" x="20" y="20" width="252" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" state="on" borderStyle="bezel" bezelStyle="round" id="QW9-Ty-ZEe">
<font key="font" metaFont="system"/>
......@@ -406,7 +407,7 @@
<outlet property="view" destination="TdD-3L-553" id="HQf-B1-D8b"/>
</connections>
</viewController>
<customView id="Y38-Id-LGC">
<customView wantsLayer="YES" id="Y38-Id-LGC">
<rect key="frame" x="0.0" y="4" width="56" height="161"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
......
......@@ -171,7 +171,7 @@
</tabViewItem>
<tabViewItem label="Contacts" identifier="" id="Zbi-X6-DLT">
<view key="view" id="sag-tS-7Jw">
<rect key="frame" x="10" y="7" width="289" height="405"/>
<rect key="frame" x="10" y="7" width="295" height="405"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView focusRingType="none" misplaced="YES" autohidesScrollers="YES" horizontalLineScroll="42" horizontalPageScroll="10" verticalLineScroll="42" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rJv-ju-DFe">
......@@ -181,7 +181,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowHeight="40" indentationPerLevel="16" autoresizesOutlineColumn="YES" outlineTableColumn="8Ve-L0-o7V" id="Hrg-Fe-uGq">
<rect key="frame" x="0.0" y="0.0" width="293" height="48"/>
<rect key="frame" x="0.0" y="0.0" width="293" height="42"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
......@@ -231,37 +231,37 @@
</tabViewItem>
</tabViewItems>
</tabView>
<customView focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="tSW-YT-asL">
<rect key="frame" x="323" y="0.0" width="730" height="626"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="626" id="5yo-rb-X1O"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="725" id="ccX-uq-zuj"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JN3-vO-zcd">
<rect key="frame" x="321" y="20" width="714" height="26"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JN3-vO-zcd" userLabel="Ring ID">
<rect key="frame" x="321" y="0.0" width="714" height="26"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="935-yR-f9b"/>
<constraint firstAttribute="height" constant="26" id="TYe-h2-pPT"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" alignment="center" id="qCF-Zf-vZg">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="center" id="qCF-Zf-vZg">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="tSW-YT-asL">
<rect key="frame" x="323" y="0.0" width="730" height="626"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="626" id="5yo-rb-X1O"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="725" id="ccX-uq-zuj"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="JN3-vO-zcd" firstAttribute="leading" secondItem="tSW-YT-asL" secondAttribute="leading" id="4Vu-Lf-w9F"/>
<constraint firstItem="xXW-iq-GcP" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="6mJ-d2-JIf"/>
<constraint firstItem="bqQ-DB-Z0g" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" id="FeC-4y-ScK"/>
<constraint firstAttribute="trailing" secondItem="JN3-vO-zcd" secondAttribute="trailing" constant="20" symbolic="YES" id="KPv-O8-ffI"/>
<constraint firstItem="xXW-iq-GcP" firstAttribute="top" secondItem="bqQ-DB-Z0g" secondAttribute="bottom" constant="8" id="KXj-CP-Fmh"/>
<constraint firstAttribute="trailing" secondItem="JN3-vO-zcd" secondAttribute="trailing" constant="20" symbolic="YES" id="O3N-2P-8iN"/>
<constraint firstItem="JN3-vO-zcd" firstAttribute="bottom" secondItem="xXW-iq-GcP" secondAttribute="bottom" id="OoQ-1f-3Nr"/>
<constraint firstAttribute="bottom" secondItem="tSW-YT-asL" secondAttribute="bottom" id="Xa4-hd-K1t"/>
<constraint firstItem="tSW-YT-asL" firstAttribute="leading" secondItem="bqQ-DB-Z0g" secondAttribute="trailing" constant="8" id="cW1-si-AGR"/>
<constraint firstAttribute="trailing" secondItem="tSW-YT-asL" secondAttribute="trailing" id="g0F-Wt-YT6"/>
<constraint firstAttribute="bottom" secondItem="xXW-iq-GcP" secondAttribute="bottom" constant="20" id="hQL-rc-Qaw"/>
<constraint firstItem="bqQ-DB-Z0g" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="jQg-C7-rD0"/>
<constraint firstItem="JN3-vO-zcd" firstAttribute="leading" secondItem="tSW-YT-asL" secondAttribute="leading" id="rqu-Sb-asZ"/>
<constraint firstItem="JN3-vO-zcd" firstAttribute="bottom" secondItem="tSW-YT-asL" secondAttribute="bottom" id="tIa-aw-5Gu"/>
<constraint firstItem="tSW-YT-asL" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="w5j-cX-qS9"/>
</constraints>
</view>
......
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