[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/sysadmin/muon/libmuon/HistoryView
From: Jonathan Michael Thomas <echidnaman () kubuntu ! org>
Date: 2010-12-23 19:21:37
Message-ID: 20101223192137.440693E1F1 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1208954 by jmthomas:
KLocale::formatDate() is somewhat expensive, so make a cache of resulting date \
strings so that we can call formatDate less
M +11 -1 HistoryView.cpp
--- trunk/extragear/sysadmin/muon/libmuon/HistoryView/HistoryView.cpp \
#1208953:1208954 @@ -95,12 +95,22 @@
QPixmap itemPixmap = KIcon("applications-other").pixmap(32,32);
+ QHash<int, QString> categoryHash;
+
QDateTime weekAgoTime = QDateTime::currentDateTime().addDays(-7);
foreach (QApt::HistoryItem *item, m_history->historyItems()) {
QDateTime startDateTime = item->startDate();
QString formattedTime = KGlobal::locale()->formatTime(startDateTime.time());
- QString category = KGlobal::locale()->formatDate(startDateTime.date(), \
KLocale::FancyShortDate); + QString category;
+ int day = startDateTime.date().day();
+ if (categoryHash.contains(day)) {
+ category = categoryHash.value(day);
+ } else {
+ category = KGlobal::locale()->formatDate(startDateTime.date(), \
KLocale::FancyShortDate); + categoryHash[day] = category;
+ }
+
QStandardItem *parentItem = 0;
if (!m_categoryHash.contains(category)) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic