[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/nepomuk/kioslaves/timeline
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2010-12-09 9:43:45
Message-ID: 20101209094345.3380AAC8A8 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1204843 by trueg:
Only show folders that actually contain any files.
M +15 -2 kio_timeline.cpp
--- trunk/KDE/kdebase/runtime/nepomuk/kioslaves/timeline/kio_timeline.cpp \
#1204842:1204843 @@ -22,6 +22,7 @@
#include "nepomukservicecontrolinterface.h"
#include "timelinetools.h"
+#include <Nepomuk/ResourceManager>
#include <Nepomuk/Vocabulary/NFO>
#include <Nepomuk/Vocabulary/NIE>
#include <Nepomuk/Vocabulary/NUAO>
@@ -94,7 +95,14 @@
uds.insert( KIO::UDSEntry::UDS_NEPOMUK_QUERY, Nepomuk::buildTimelineQuery( \
date ).toString() ); return uds;
}
+
+ bool filesInDateRange( const QDate& from, const QDate& to = QDate() )
+ {
+ return Nepomuk::ResourceManager::instance()->mainModel()->executeQuery(
+ Nepomuk::buildTimelineQuery( from, to \
).toSparqlQuery(Nepomuk::Query::Query::CreateAskQuery), + \
Soprano::Query::QueryLanguageSparql ).boolValue(); }
+}
Nepomuk::TimelineProtocol::TimelineProtocol( const QByteArray& poolSocket, const \
QByteArray& appSocket ) @@ -292,7 +300,8 @@
const int days = KGlobal::locale()->calendar()->daysInMonth( QDate( year, month, \
1 ) ); for( int day = 1; day <= days; ++day ) {
QDate date(year, month, day);
- if( date <= QDate::currentDate() ) {
+ if( date <= QDate::currentDate() &&
+ filesInDateRange(date) ) {
listEntry( createDayUDSEntry( date ), false );
}
}
@@ -304,15 +313,19 @@
kDebug();
int currentMonth = QDate::currentDate().month();
for( int month = 1; month <= currentMonth; ++month ) {
+ const QDate dateInMonth( QDate::currentDate().year(), month, 1 );
+ if( filesInDateRange( \
KGlobal::locale()->calendar()->firstDayOfMonth(dateInMonth), + \
KGlobal::locale()->calendar()->lastDayOfMonth(dateInMonth) ) ) {
listEntry( createMonthUDSEntry( month, QDate::currentDate().year() ), false \
); }
}
+}
void Nepomuk::TimelineProtocol::listPreviousYears()
{
kDebug();
- // TODO: list years before this year that have files
+ // TODO: list years before this year that have files, but first get the smallest \
date
// Using a query like: "select ?date where { ?r a nfo:FileDataObject . ?r \
nie:lastModified ?date . } ORDER BY ?date LIMIT 1" (this would have to be cached) }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic