Commit 69bb766e authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): naming conventions in `App.xpp` and correct access to root children in `Chat/Message`

parent 4ef9e4c7
......@@ -2,7 +2,6 @@
#include <QQmlComponent>
#include <QQmlContext>
#include <QQuickView>
#include <QSystemTrayIcon>
#include <QtDebug>
#include "../components/contacts/ContactsListProxyModel.hpp"
......@@ -84,7 +83,7 @@ void App::addContextProperties () {
if (component.isError()) {
qWarning() << component.errors();
} else {
// context->setContextProperty("CallsWindow", component.create());
context->setContextProperty("CallsWindow", component.create());
}
// Models.
......@@ -99,7 +98,7 @@ void App::addContextProperties () {
void App::setTrayIcon () {
QQuickWindow *root = qobject_cast<QQuickWindow *>(m_engine.rootObjects().at(0));
QMenu *menu = new QMenu();
QSystemTrayIcon *tray_icon = new QSystemTrayIcon(root);
m_tray_icon = new QSystemTrayIcon(root);
// trayIcon: Right click actions.
QAction *quit_action = new QAction("Quit", root);
......@@ -109,7 +108,7 @@ void App::setTrayIcon () {
root->connect(restore_action, &QAction::triggered, root, &QQuickWindow::showNormal);
// trayIcon: Left click actions.
root->connect(tray_icon, &QSystemTrayIcon::activated, [root](QSystemTrayIcon::ActivationReason reason) {
root->connect(m_tray_icon, &QSystemTrayIcon::activated, [root](QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::Trigger) {
if (root->visibility() == QWindow::Hidden)
root->showNormal();
......@@ -123,8 +122,8 @@ void App::setTrayIcon () {
menu->addSeparator();
menu->addAction(quit_action);
tray_icon->setContextMenu(menu);
tray_icon->setIcon(QIcon(WINDOW_ICON_PATH));
tray_icon->setToolTip("Linphone");
tray_icon->show();
m_tray_icon->setContextMenu(menu);
m_tray_icon->setIcon(QIcon(WINDOW_ICON_PATH));
m_tray_icon->setToolTip("Linphone");
m_tray_icon->show();
}
......@@ -4,6 +4,7 @@
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlFileSelector>
#include <QSystemTrayIcon>
#include <QTranslator>
// ===================================================================
......@@ -20,6 +21,7 @@ private:
QQmlApplicationEngine m_engine;
QQmlFileSelector *m_file_selector;
QSystemTrayIcon *m_tray_icon;
QTranslator m_translator;
};
......
......@@ -22,9 +22,11 @@ Item {
var children = root.children
// Can be the `invertedMouseArea` of other message.
var mouseArea = children[children.length - 1]
var mouseArea = Utils.find(children, function (element) {
return Utils.qmlTypeof(element, 'QQuickMouseArea')
})
if (Utils.qmlTypeof(mouseArea, 'QQuickMouseArea')) {
if (mouseArea != null) {
mouseArea.cursorShape = hoveredLink
? Qt.PointingHandCursor
: Qt.ArrowCursor
......
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