Changeset 5849

Show
Ignore:
Timestamp:
11/22/07 03:54:40 (12 months ago)
Author:
flynd
Message:

Changed timestamps in info dialog to not cut year. Also moved the datetime handling to infofield class.

Location:
branches/qt-gui_qt4/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/qt-gui_qt4/src/dialogs/userinfodlg.cpp

    r5837 r5849  
    15731573  if (!u->StatusOffline()) 
    15741574    nfoLastOnline->setText(tr("Now")); 
    1575   else if (u->LastOnline() == 0) 
    1576     nfoLastOnline->setText(tr("Unknown")); 
    15771575  else 
    1578   { 
    1579     t.setTime_t(u->LastOnline()); 
    1580     ds = t.toString(); 
    1581     ds.truncate(ds.length() - 8); 
    1582     nfoLastOnline->setText(ds); 
    1583   } 
    1584  
    1585   if (u->LastSentEvent() == 0) 
    1586     nfoLastSent->setText(tr("Unknown")); 
    1587   else 
    1588   { 
    1589     t.setTime_t(u->LastSentEvent()); 
    1590     ds = t.toString(); 
    1591     ds.truncate(ds.length() - 8); 
    1592     nfoLastSent->setText(ds); 
    1593   } 
    1594  
    1595   if (u->LastReceivedEvent() == 0) 
    1596     nfoLastRecv->setText(tr("Unknown")); 
    1597   else 
    1598   { 
    1599     t.setTime_t(u->LastReceivedEvent()); 
    1600     ds = t.toString(); 
    1601     ds.truncate(ds.length() - 8); 
    1602     nfoLastRecv->setText(ds); 
    1603   } 
    1604  
    1605   if (u->LastCheckedAutoResponse() == 0) 
    1606     nfoLastCheckedAR->setText(tr("Unknown")); 
    1607   else 
    1608   { 
    1609     t.setTime_t(u->LastCheckedAutoResponse()); 
    1610     ds = t.toString(); 
    1611     ds.truncate(ds.length() - 8); 
    1612     nfoLastCheckedAR->setText(ds); 
    1613   } 
     1576    nfoLastOnline->setDateTime(u->LastOnline()); 
     1577 
     1578  nfoLastSent->setDateTime(u->LastSentEvent()); 
     1579  nfoLastRecv->setDateTime(u->LastSentEvent()); 
     1580  nfoLastCheckedAR->setDateTime(u->LastCheckedAutoResponse()); 
    16141581 
    16151582  if (u->StatusOffline()) 
    16161583    nfoOnlineSince->setText(tr("Offline")); 
    1617   else if (u->OnlineSince() == 0) 
    1618     nfoOnlineSince->setText(tr("Unknown")); 
    16191584  else 
    1620   { 
    1621     t.setTime_t(u->OnlineSince()); 
    1622     ds = t.toString(); 
    1623     ds.truncate(ds.length() - 8); 
    1624     nfoOnlineSince->setText(ds); 
    1625   } 
    1626  
    1627   if (bDropUser) gUserManager.DropUser(u); 
     1585    nfoOnlineSince->setDateTime(u->OnlineSince()); 
     1586 
     1587  if (bDropUser) 
     1588    gUserManager.DropUser(u); 
    16281589} 
    16291590 
  • branches/qt-gui_qt4/src/widgets/infofield.cpp

    r5837 r5849  
    2121#include "infofield.h" 
    2222 
     23#include <QDateTime> 
     24 
    2325using namespace LicqQtGui; 
     26/* TRANSLATOR LicqQtGui::InfoField */ 
    2427 
    2528InfoField::InfoField(bool ro, QWidget* parent) 
     
    4851void InfoField::setText(unsigned long data) 
    4952{ 
    50   char t[32]; 
    51   sprintf(t, "%lu", data); 
    52   setText(t); 
     53  setText(QString::number(data)); 
    5354} 
     55 
     56void InfoField::setDateTime(uint timestamp) 
     57{ 
     58  if (timestamp == 0) 
     59    setText(tr("Unknown")); 
     60  else 
     61    setText(QDateTime::fromTime_t(timestamp).toString()); 
     62} 
  • branches/qt-gui_qt4/src/widgets/infofield.h

    r5764 r5849  
    6565  void setText(unsigned long data); 
    6666 
     67  // Don't hide base setText which takes QString 
    6768  using QLineEdit::setText; 
     69 
     70  /** 
     71   * Set field to a timestamp 
     72   * 
     73   * @param timestamp Timestamp in UTC to set 
     74   */ 
     75  void setDateTime(uint timestamp); 
    6876 
    6977private: