Review Request: Nepomuk timeline KIO slave

View: New views
6 Messages — Rating Filter:   Alert me  

Review Request: Nepomuk timeline KIO slave

by Sebastian Trueg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

I just commited the Nepomuk timeline KIO slave to kdereview (nepomuk-kio-
timeline).
The KIO slave uses the nepomuksearch KIO slave to provide file browsing by
modification date. It is a very simple slave, containing almost no code (at
least no complicated) since nepomuksearch does all the work.

More details can be found in my blog entry:
http://trueg.wordpress.com/2009/10/26/just-another-way-of-browsing-your-files/

I would like to move it to kdebase/runtime/nepomuk/kioslaves.

Please have a look and comment.

Cheers,
Sebastian

Re: Review Request: Nepomuk timeline KIO slave

by Albert Astals Cid-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A Dilluns, 26 d'octubre de 2009, Sebastian Trüg va escriure:

> Hello.
>
> I just commited the Nepomuk timeline KIO slave to kdereview (nepomuk-kio-
> timeline).
> The KIO slave uses the nepomuksearch KIO slave to provide file browsing by
> modification date. It is a very simple slave, containing almost no code (at
> least no complicated) since nepomuksearch does all the work.
>
> More details can be found in my blog entry:
> http://trueg.wordpress.com/2009/10/26/just-another-way-of-browsing-your-fil
> es/
>
> I would like to move it to kdebase/runtime/nepomuk/kioslaves.
>
> Please have a look and comment.

i18n bug
 QLocale::system().standaloneMonthName( month ) + ' ' + QString::number(year)
should be
 KGlobal::locale()->calendarSystem()->formateDate(QDate(year, month, 1),
i18nc("some_comment", "%B %Y"));

"some_comment" could be something like "This defines how dates will be shown,
have a look at http://api.kde.org/4.x-api/kdelibs-
apidocs/kdecore/html/classKCalendarSystem.html#a560204439a4b670ad36c16c404f292b4
to see which variables you can use and ask kde-i18n-doc@... if you have
problems understanding how to translate this"

Albert

>
> Cheers,
> Sebastian
>


Re: Review Request: Nepomuk timeline KIO slave

by Anders Lund :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sebastian Trüg skrev:

> Hello.
>
> I just commited the Nepomuk timeline KIO slave to kdereview (nepomuk-kio-
> timeline).
> The KIO slave uses the nepomuksearch KIO slave to provide file browsing by
> modification date. It is a very simple slave, containing almost no code (at
> least no complicated) since nepomuksearch does all the work.
>
> More details can be found in my blog entry:
> http://trueg.wordpress.com/2009/10/26/just-another-way-of-browsing-your-fil
> es/
>
> I would like to move it to kdebase/runtime/nepomuk/kioslaves.
>
> Please have a look and comment.
>
> Cheers,
> Sebastian
>

Not having looked at the code, I think it is awsome! Simple, and of great
value.

Anders
--
www: http://www.alweb.dk
jabber: anderslund@...

Re: Review Request: Nepomuk timeline KIO slave

by Sebastian Trueg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 26 October 2009 20:28:19 Albert Astals Cid wrote:

> A Dilluns, 26 d'octubre de 2009, Sebastian Trüg va escriure:
> > Hello.
> >
> > I just commited the Nepomuk timeline KIO slave to kdereview (nepomuk-kio-
> > timeline).
> > The KIO slave uses the nepomuksearch KIO slave to provide file browsing
> > by modification date. It is a very simple slave, containing almost no
> > code (at least no complicated) since nepomuksearch does all the work.
> >
> > More details can be found in my blog entry:
> > http://trueg.wordpress.com/2009/10/26/just-another-way-of-browsing-your-f
> >il es/
> >
> > I would like to move it to kdebase/runtime/nepomuk/kioslaves.
> >
> > Please have a look and comment.
>
> i18n bug
>  QLocale::system().standaloneMonthName( month ) + ' ' +
>  QString::number(year) should be
>  KGlobal::locale()->calendarSystem()->formateDate(QDate(year, month, 1),
> i18nc("some_comment", "%B %Y"));
>
> "some_comment" could be something like "This defines how dates will be
>  shown, have a look at http://api.kde.org/4.x-api/kdelibs-
> apidocs/kdecore/html/classKCalendarSystem.html#a560204439a4b670ad36c16c404f
> 292b4 to see which variables you can use and ask kde-i18n-doc@... if
>  you have problems understanding how to translate this"

nice. done. :)

Re: Review Request: Nepomuk timeline KIO slave

by Will Stephenson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 26 October 2009 20:12:38 Sebastian Trüg wrote:
> I would like to move it to kdebase/runtime/nepomuk/kioslaves.

Does anyone know if it is possible to hide the ugly nepomuksearch:/ url
containing an entire sparql query from the user when the user drills down to
view a single day?

timeline:/calendar/2009-11-06 would be so much more attractive than
nepomuksearch:/?sparql='select * from .... ... ...'

And here's my contribution:

The attached patch adds relative navigation to the ioslave using query
arguments of the form "?relMonths=-1 " that cause a redirection to the new
absolute date url.  

I envision being able to add VCR style controls to browsers and dialogs to
navigate along the timeline using this, or even a calendar widget that allows
range selections eg timeline:/2009-11-01?rangeTo=20091106.

Will


[kio_timeline-relative-movements.diff]

Index: kio_timeline.cpp
===================================================================
--- kio_timeline.cpp (revision 1045208)
+++ kio_timeline.cpp (working copy)
@@ -28,6 +28,7 @@
 #include <kio/job.h>
 #include <KUser>
 #include <KDebug>
+#include <KLocale>
 #include <kio/netaccess.h>
 #include <KCalendarSystem>
 #include <KUser>
@@ -138,11 +139,50 @@
             finished();
         }
         else {
-            kDebug() << ru;
+            kDebug() << ru << url.query();
             QStringList terms = ru.split('/', QString::SkipEmptyParts );
             kDebug() << terms;
             if( terms.count() == 1 ) {
                 QDate date = QDate::fromString( terms[0], QLatin1String("yyyy-MM") );
+                QDate newDate = date;
+                QMap<QString,QString> queryItems = url.queryItems();
+                QString dayKey = QLatin1String("relDays");
+                QString weekKey = QLatin1String("relWeeks");
+                QString monthKey = QLatin1String("relMonths");
+                QString yearKey = QLatin1String("relYears");
+                bool ok = false;
+
+                if (queryItems.contains(yearKey)) {
+                    int relYears = queryItems[yearKey].toInt(&ok);
+                    if (ok) {
+                        newDate = date.addYears(relYears);
+                    }
+                } else if (queryItems.contains(monthKey)) {
+                    int relMonths = queryItems[monthKey].toInt(&ok);
+                    if (ok) {
+                        newDate = date.addMonths(relMonths);
+                    }
+                } else if (queryItems.contains(weekKey)) {
+                    int relWeeks = queryItems[weekKey].toInt(&ok);
+                    if (ok) {
+                        const KCalendarSystem * calSystem = KGlobal::locale()->calendar();
+                        newDate = date.addDays(relWeeks * calSystem->daysInWeek(date));
+                    }
+                } else if (queryItems.contains(dayKey)) {
+                    int relDays = queryItems[dayKey].toInt(&ok);
+                    if (ok) {
+                        newDate = date.addDays(relDays);
+                    }
+                }
+                if (ok && newDate <= QDate::currentDate()) {
+                    KUrl newUrl;
+                    newUrl.setScheme(QLatin1String("timeline"));
+                    newUrl.setPath(QString("/calendar/%1").arg(newDate.toString("yyyy-MM")));
+                    kDebug() << newUrl;
+                    redirection(newUrl);
+                    finished();
+                }
+
                 kDebug() << date;
                 if( date.isValid() ) {
                     listDays( date.month(), date.year() );


Re: Review Request: Nepomuk timeline KIO slave

by Sebastian Trueg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A bit late but still...

Will Stephenson wrote:
> On Monday 26 October 2009 20:12:38 Sebastian Trüg wrote:
>> I would like to move it to kdebase/runtime/nepomuk/kioslaves.
>
> Does anyone know if it is possible to hide the ugly nepomuksearch:/ url
> containing an entire sparql query from the user when the user drills down to
> view a single day?

Done.

> timeline:/calendar/2009-11-06 would be so much more attractive than
> nepomuksearch:/?sparql='select * from .... ... ...'
>
> And here's my contribution:
>
> The attached patch adds relative navigation to the ioslave using query
> arguments of the form "?relMonths=-1 " that cause a redirection to the new
> absolute date url.  

Commited. Now we only need a nice gui to expose that. :)

Cheers,
Sebastian