Skip to content

Commit

Permalink
Merge pull request #364 from nico-izo/idleFix
Browse files Browse the repository at this point in the history
Fixed broken status changing
  • Loading branch information
Ruslan Nigmatullin committed Jul 28, 2015
2 parents 896ee71 + 4b03698 commit 512a756
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/lib/qutim/account.cpp
Expand Up @@ -184,6 +184,7 @@ void AccountPrivate::updateStatus()
break;
case Account::Connected:
case Account::Disconnecting:
q_func()->doStatusChange(userStatus);
setStatus(userStatus);
break;
}
Expand Down
9 changes: 5 additions & 4 deletions src/plugins/generic/idledetector/idle.cpp
Expand Up @@ -76,7 +76,7 @@ bool Idle::isActive() const

bool Idle::usingPlatform() const
{
return (platform ? true: false);
return (platform ? true : false);
}

void Idle::start()
Expand All @@ -101,9 +101,9 @@ void Idle::stop()
int Idle::secondsIdle()
{
int i;
if (platform)
if (platform) {
i = platform->secondsIdle();
else {
} else {
QPoint curMousePos = QCursor::pos();
QDateTime curDateTime = QDateTime::currentDateTime();
if(d->lastMousePos != curMousePos) {
Expand Down Expand Up @@ -131,12 +131,13 @@ int Idle::secondsIdle()

// how long have we been idle?
int idleTime = d->startTime.secsTo(QDateTime::currentDateTime());

return idleTime;
}

void Idle::doCheck()
{
secondsIdle(secondsIdle());
emit secondsIdle(secondsIdle());
}
}

3 changes: 0 additions & 3 deletions src/plugins/generic/idlestatuschanger/idle-global.h
Expand Up @@ -22,9 +22,6 @@
** $QUTIM_END_LICENSE$
**
****************************************************************************/
#define AWAY_DEF_SECS 180 // 3 mins
#define NA_DEF_SECS 600 // 10 mins
#define AA_CONFIG_GROUP "auto-away"

namespace Core{
class IdleStatusChanger;
Expand Down
9 changes: 5 additions & 4 deletions src/plugins/generic/idlestatuschanger/idlestatuschanger.cpp
Expand Up @@ -69,7 +69,7 @@ void IdleStatusChanger::refillAccounts()

void IdleStatusChanger::onIdle(int secs)
{
if ((m_awayEnabled?m_state == Away:1)
if ((m_awayEnabled ? m_state == Away : 1)
&& secs > m_naSecs
&& m_naEnabled) {
refillAccounts();
Expand Down Expand Up @@ -100,11 +100,12 @@ void IdleStatusChanger::onIdle(int secs)

void IdleStatusChanger::reloadSettings()
{
Config conf(AA_CONFIG_GROUP);
Config conf;
conf.beginGroup("auto-away");
m_awayEnabled = conf.value("away-enabled", true);
m_naEnabled = conf.value("na-enabled", true);
m_awaySecs = conf.value("away-secs", AWAY_DEF_SECS);
m_naSecs = conf.value("na-secs", NA_DEF_SECS);
m_awaySecs = conf.value("away-secs", 3*60); // 3 minutes
m_naSecs = conf.value("na-secs", 10*60); // 10 minutes
m_awayStatus.setText(conf.value("away-text", ""));
m_naStatus. setText(conf.value("na-text", ""));
}
Expand Down

0 comments on commit 512a756

Please sign in to comment.