[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktp-kded-module/v0.6.3] /: %time Variable to get the current UTC time in the away message
From:       David Edmundson <kde () davidedmundson ! co ! uk>
Date:       2013-07-31 23:16:45
Message-ID: E1V4fdN-00058K-Lu () scm ! kde ! org
[Download RAW message or body]

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 thing a user \
would do if he wants no away message is to remove the message text [if there is one, \
which isn't by default], so this double information can be replaced).

Adding an extra widget for drag n drop like in now playing would be too much for this \
I think. It would blow up the UI if I add this under every lineedit (as more stuff is \
visible on the first sight for the user as more complicated it looks) and it would be \
confusing if I add it only once in a central place, so I decided to just inform the \
user through a tool tip (it's also 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/78f34f4040478bbee4942858e4b8de26d3400576

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() != \
                Tp::Presence::away().type() &&
             m_globalPresence->currentPresence().type() != Tp::Presence::xa().type() \
                &&
             m_globalPresence->currentPresence().type() != \
                Tp::Presence::hidden().type()) {
-
+            m_awayMessage.replace(QLatin1String("%time"), \
QDateTime::currentDateTimeUtc().toString(QLatin1String("hh:mm:ss")), \
Qt::CaseInsensitive);  setRequestedPresence(Tp::Presence::away(m_awayMessage));
             setActive(true);
         }
     } else if (id == m_extAwayTimeoutId) {
         if (m_globalPresence->currentPresence().type() == \
Tp::Presence::away().type()) { +            \
m_xaMessage.replace(QLatin1String("%time"), \
QDateTime::currentDateTimeUtc().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-config.cpp
index 780a882..a225515 100644
--- a/config/telepathy-kded-config.cpp
+++ b/config/telepathy-kded-config.cpp
@@ -82,13 +82,13 @@ TelepathyKDEDConfig::TelepathyKDEDConfig(QWidget *parent, const \
QVariantList& ar  " minutes"));
 
     ui->m_awayMessage->setClickMessage(i18n("Leave empty for no message"));
-    ui->m_awayMessage->setToolTip(ui->m_awayMessage->clickMessage()); //use the same \
i18n string +    ui->m_awayMessage->setToolTip(i18n("Use %time to insert UTC time of \
when you went idle"));  
     ui->m_xaMessage->setClickMessage(i18n("Leave empty for no message"));
-    ui->m_xaMessage->setToolTip(ui->m_xaMessage->clickMessage()); //use the 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::CaseInsensitive);  \
setRequestedPresence(Tp::Presence::away(m_screenSaverAwayMessage));  setActive(true);
     } else {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic