From kde-commits Wed Jul 31 23:16:45 2013 From: David Edmundson Date: Wed, 31 Jul 2013 23:16:45 +0000 To: kde-commits Subject: [ktp-kded-module/v0.6.3] /: %time Variable to get the current UTC time in the away message Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=137531261402012 Git commit 78f34f4040478bbee4942858e4b8de26d3400576 by David Edmundson, on = behalf of Lucas Betschart. Committed on 13/06/2013 at 21:19. Pushed by davidedmundson into tag 'v0.6.3'. %time Variable to get the current UTC time in the away message I've added an %time option which will get replaced by the current UTC time. To make this option visible I've changed the tool tip (I think the first th= ing a user would do if he wants no away message is to remove the message te= xt [if there is one, which isn't by default], so this double information ca= n be replaced). Adding an extra widget for drag n drop like in now playing would be too muc= h for this I think. It would blow up the UI if I add this under every linee= dit (as more stuff is visible on the first sight for the user as more compl= icated it looks) and it would be confusing if I add it only once in a centr= al place, so I decided to just inform the user through a tool tip (it's als= o not a important feature, so it's ok if it's a little bit hidden). M +2 -1 autoaway.cpp M +3 -3 config/telepathy-kded-config.cpp M +1 -0 screensaveraway.cpp http://commits.kde.org/telepathy-kded-module/78f34f4040478bbee4942858e4b8de= 26d3400576 diff --git a/autoaway.cpp b/autoaway.cpp index 06cb8e0..cbb9001 100644 --- a/autoaway.cpp +++ b/autoaway.cpp @@ -62,12 +62,13 @@ void AutoAway::timeoutReached(int id) if (m_globalPresence->currentPresence().type() !=3D Tp::Presence::= away().type() && m_globalPresence->currentPresence().type() !=3D Tp::Presence::= xa().type() && m_globalPresence->currentPresence().type() !=3D Tp::Presence::= hidden().type()) { - + m_awayMessage.replace(QLatin1String("%time"), QDateTime::curre= ntDateTimeUtc().toString(QLatin1String("hh:mm:ss")), Qt::CaseInsensitive); setRequestedPresence(Tp::Presence::away(m_awayMessage)); setActive(true); } } else if (id =3D=3D m_extAwayTimeoutId) { if (m_globalPresence->currentPresence().type() =3D=3D Tp::Presence= ::away().type()) { + m_xaMessage.replace(QLatin1String("%time"), QDateTime::current= DateTimeUtc().toString(QLatin1String("hh:mm:ss")), Qt::CaseInsensitive); setRequestedPresence(Tp::Presence::xa(m_xaMessage)); setActive(true); } diff --git a/config/telepathy-kded-config.cpp b/config/telepathy-kded-confi= g.cpp index 780a882..a225515 100644 --- a/config/telepathy-kded-config.cpp +++ b/config/telepathy-kded-config.cpp @@ -82,13 +82,13 @@ TelepathyKDEDConfig::TelepathyKDEDConfig(QWidget *paren= t, const QVariantList& ar " minutes")); = ui->m_awayMessage->setClickMessage(i18n("Leave empty for no message")); - ui->m_awayMessage->setToolTip(ui->m_awayMessage->clickMessage()); //us= e the same i18n string + ui->m_awayMessage->setToolTip(i18n("Use %time to insert UTC time of wh= en you went idle")); = ui->m_xaMessage->setClickMessage(i18n("Leave empty for no message")); - ui->m_xaMessage->setToolTip(ui->m_xaMessage->clickMessage()); //use th= e same i18n string + ui->m_xaMessage->setToolTip(i18n("Use %time to insert UTC time of when= you went idle")); = ui->m_screenSaverAwayMessage->setClickMessage(i18n("Leave empty for no= message")); - ui->m_screenSaverAwayMessage->setToolTip(ui->m_screenSaverAwayMessage-= >clickMessage()); //use the same i18n stringToMode + ui->m_screenSaverAwayMessage->setToolTip(i18n("Use %time to insert UTC= time of when you went idle")); = connect(ui->m_downloadUrlRequester, SIGNAL(textChanged(QString)), this, SLOT(settingsHasChanged())); diff --git a/screensaveraway.cpp b/screensaveraway.cpp index c7fdd75..14f2092 100644 --- a/screensaveraway.cpp +++ b/screensaveraway.cpp @@ -59,6 +59,7 @@ void ScreenSaverAway::onActiveChanged(bool newState) } = if (newState) { + m_screenSaverAwayMessage.replace(QLatin1String("%time"), QDateTime::= currentDateTimeUtc().toString(QLatin1String("hh:mm:ss")), Qt::CaseInsensiti= ve); setRequestedPresence(Tp::Presence::away(m_screenSaverAwayMessage)); setActive(true); } else {