diff options
author | Luboš Doležel <lubos@dolezel.info> | 2020-02-23 09:50:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 09:50:24 +0100 |
commit | 188bd0606473fee9d7a09e17b9980f7a16d4dc31 (patch) | |
tree | e3147fbe8243a91893e2e31cf1b7246869604430 /src/gui/gui.cpp | |
parent | e9e1b86afd75cb55c90bc6ce58fc9c2d0c025a3f (diff) | |
parent | 3d9fb0ac7490620a49a400b77ab8f851cdd4fcf5 (diff) | |
download | twinkle-188bd0606473fee9d7a09e17b9980f7a16d4dc31.tar twinkle-188bd0606473fee9d7a09e17b9980f7a16d4dc31.tar.gz twinkle-188bd0606473fee9d7a09e17b9980f7a16d4dc31.tar.lz twinkle-188bd0606473fee9d7a09e17b9980f7a16d4dc31.tar.xz twinkle-188bd0606473fee9d7a09e17b9980f7a16d4dc31.zip |
Merge pull request #154 from fbriere/feature/inhibit-idle-session
Add an option to prevent an idle session while a call is in progress
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r-- | src/gui/gui.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ac14edd..954d8e8 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,11 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N qRegisterMetaType<t_cf_type>("t_cf_type"); qRegisterMetaType<string>("string"); qRegisterMetaType<std::list<std::string>>("std::list<std::string>"); + + m_idle_session_manager = new IdleSessionManager(this); + connect(this, &t_gui::update_state, + this, &t_gui::updateIdleSessionState, + Qt::QueuedConnection); mainWindow = new MphoneForm; #ifdef HAVE_KDE @@ -818,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<t_user *> user_list = phone->ref_users(); @@ -3175,6 +3183,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; |