summaryrefslogtreecommitdiffstats
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp21
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;