Commit d8486616 authored by Christian Loose's avatar Christian Loose

add possibility to hide time in tooltip for

annotation dialog

svn path=/trunk/kdesdk/cervisia/; revision=245450
parent 3661f2ec
......@@ -208,7 +208,7 @@ void AnnotateView::contentsMouseMoveEvent(QMouseEvent *e)
if (!currentLabel && item && col == AnnotateViewItem::AuthorColumn &&
!item->m_logInfo.m_author.isNull())
{
QString text = item->m_logInfo.createToolTipText();
QString text = item->m_logInfo.createToolTipText(false);
int left = header()->sectionPos(AnnotateViewItem::ContentColumn);
int top = viewport()->mapTo(this, itemRect(item).topLeft()).y();
......
......@@ -63,14 +63,14 @@ QString TagInfo::typeToString() const
}
QString LogInfo::createToolTipText() const
QString LogInfo::createToolTipText(bool showTime) const
{
QString text(QString::fromLatin1("<b>"));
text += QStyleSheet::escape(m_revision);
text += QString::fromLatin1("</b>&nbsp;&nbsp;");
text += QStyleSheet::escape(m_author);
text += QString::fromLatin1("&nbsp;&nbsp;<b>");
text += QStyleSheet::escape(dateTimeToString());
text += QStyleSheet::escape(dateTimeToString(showTime));
text += QString::fromLatin1("</b>");
if (!m_comment.isEmpty())
......@@ -97,9 +97,12 @@ QString LogInfo::createToolTipText() const
}
QString LogInfo::dateTimeToString(bool shortFormat) const
QString LogInfo::dateTimeToString(bool showTime, bool shortFormat) const
{
return KGlobal::locale()->formatDateTime(m_dateTime, shortFormat);
if( showTime )
return KGlobal::locale()->formatDateTime(m_dateTime, shortFormat);
else
return KGlobal::locale()->formatDate(m_dateTime.date(), shortFormat);
}
......
......@@ -88,18 +88,21 @@ struct LogInfo
typedef QValueList<TagInfo> TTagInfoSeq;
/**
* @param showTime show commit time in tooltip.
*
* @return rich text formatted tooltip text.
*/
QString createToolTipText() const;
QString createToolTipText(bool showTime = true) const;
/**
* Calls KLocale::formatDateTime() to create a formatted string.
*
* @param showTime show commit time in tooltip.
* @param shortFormat using the short date format.
*
* @return The date/time formatted to the user's locale's conventions.
*/
QString dateTimeToString(bool shortFormat = true) const;
QString dateTimeToString(bool showTime = true, bool shortFormat = true) const;
enum
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment