Don't use trayicon on android

This commit is contained in:
Tobias Fella
2020-11-23 00:03:49 +01:00
parent 9484a4c8de
commit 0b8db12543
5 changed files with 19 additions and 11 deletions

View File

@@ -87,14 +87,6 @@ Kirigami.ApplicationWindow {
root.requestActivate()
}
TrayIcon {
id: trayIcon
visible: true
iconSource: ":/assets/img/icon.png"
isOnline: true
onShowWindow: root.showWindow()
}
contextDrawer: RoomDrawer {
id: contextDrawer
enabled: roomManager.hasOpenRoom
@@ -177,6 +169,8 @@ Kirigami.ApplicationWindow {
}
onGlobalErrorOccured: showPassiveNotification(error + ": " + detail)
onShowWindow: root.showWindow()
}
RoomListModel {

View File

@@ -8,7 +8,6 @@ add_executable(neochat
roomlistmodel.cpp
neochatroom.cpp
neochatuser.cpp
trayicon.cpp
userlistmodel.cpp
publicroomlistmodel.cpp
userdirectorylistmodel.cpp
@@ -19,6 +18,10 @@ add_executable(neochat
../res.qrc
)
if(NOT ANDROID)
target_sources(neochat PRIVATE trayicon.cpp)
endif()
target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(neochat PRIVATE Qt5::Quick Qt5::Qml Qt5::Gui Qt5::Network Qt5::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore KF5::ConfigGui KF5::CoreAddons Quotient cmark::cmark)
kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)

View File

@@ -46,6 +46,10 @@
#include "settings.h"
#include "utils.h"
#ifndef Q_OS_ANDROID
#include "trayicon.h"
#endif
Controller::Controller(QObject *parent)
: QObject(parent)
{
@@ -54,6 +58,14 @@ Controller::Controller(QObject *parent)
Connection::setRoomType<NeoChatRoom>();
Connection::setUserType<NeoChatUser>();
#ifndef Q_OS_ANDROID
TrayIcon *trayIcon = new TrayIcon(this);
connect(trayIcon, &TrayIcon::showWindow, this, &Controller::showWindow);
trayIcon->setVisible(true);
trayIcon->setIconSource(":/assets/img/icon.png");
trayIcon->setIsOnline(true);
#endif
QTimer::singleShot(0, this, [=] {
invokeLogin();
});

View File

@@ -102,6 +102,7 @@ Q_SIGNALS:
void activeConnectionChanged();
void aboutDataChanged();
void passwordStatus(Controller::PasswordStatus status);
void showWindow();
public Q_SLOTS:
void logout(Quotient::Connection *conn, bool serverSideLogout);

View File

@@ -33,7 +33,6 @@
#include "room.h"
#include "roomlistmodel.h"
#include "sortfilterroomlistmodel.h"
#include "trayicon.h"
#include "userdirectorylistmodel.h"
#include "userlistmodel.h"
#include "neochatconfig.h"
@@ -72,7 +71,6 @@ int main(int argc, char *argv[])
qmlRegisterType<PublicRoomListModel>("org.kde.neochat", 1, 0, "PublicRoomListModel");
qmlRegisterType<UserDirectoryListModel>("org.kde.neochat", 1, 0, "UserDirectoryListModel");
qmlRegisterType<EmojiModel>("org.kde.neochat", 1, 0, "EmojiModel");
qmlRegisterType<TrayIcon>("org.kde.neochat", 1, 0, "TrayIcon");
qmlRegisterType<SortFilterRoomListModel>("org.kde.neochat", 1, 0, "SortFilterRoomListModel");
qmlRegisterUncreatableType<RoomMessageEvent>("org.kde.neochat", 1, 0, "RoomMessageEvent", "ENUM");
qmlRegisterUncreatableType<RoomType>("org.kde.neochat", 1, 0, "RoomType", "ENUM");