From 1e9f091f39a32193b0671e9dfbfb657dd45fec3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Fri, 12 Jul 2019 19:01:41 -0400 Subject: Add an option to prevent an idle session while a call is in progress Having the session marked as idle while a call is in progress could trigger certain actions (such as locking the screen, logging out automatically, or suspending the system) which could be undesirable in this situation. Closes #123 --- src/gui/gui.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gui/gui.cpp') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ac14edd..d96da2a 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -56,6 +56,7 @@ #include "yesnodialog.h" #include "command_args.h" #include "im/msg_session.h" +#include "idlesession_manager.h" #include "qcombobox.h" #include "qlabel.h" @@ -783,6 +784,12 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N qRegisterMetaType("t_cf_type"); qRegisterMetaType("string"); qRegisterMetaType>("std::list"); + + m_idle_session_manager = new IdleSessionManager(this); + updateInhibitIdleSession(); + connect(this, &t_gui::update_state, + this, &t_gui::updateIdleSessionState, + Qt::QueuedConnection); mainWindow = new MphoneForm; #ifdef HAVE_KDE @@ -3175,6 +3182,19 @@ void t_gui::updateTimersMessageSessions() { } } +void t_gui::updateInhibitIdleSession() { + m_idle_session_manager->setEnabled(sys_config->get_inhibit_idle_session()); +} + +void t_gui::updateIdleSessionState() { + bool busy = false; + for (int i = 0; i < NUM_USER_LINES; i++) { + if (phone->get_line_state(i) == LS_BUSY) + busy = true; + } + m_idle_session_manager->setActivityState(busy); +} + string t_gui::mime2file_extension(t_media media) { string extension; -- cgit v1.2.3 From 3d9fb0ac7490620a49a400b77ab8f851cdd4fcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Sat, 13 Jul 2019 17:50:36 -0400 Subject: Properly display and log warning messages in IdleSessionInhibitor --- src/gui/gui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/gui.cpp') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d96da2a..954d8e8 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -786,7 +786,6 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N qRegisterMetaType>("std::list"); m_idle_session_manager = new IdleSessionManager(this); - updateInhibitIdleSession(); connect(this, &t_gui::update_state, this, &t_gui::updateIdleSessionState, Qt::QueuedConnection); @@ -825,6 +824,8 @@ void t_gui::run(void) { thr_process_events = new t_thread(process_events_main, NULL); MEMMAN_NEW(thr_process_events); + updateInhibitIdleSession(); + QString s; list user_list = phone->ref_users(); -- cgit v1.2.3