Projects/KTimeTracker

Jump to: navigation, search

Contents

Developing KTimeTracker

So you want to become a KTimeTracker developer

Here are your classes:

  • mainwindow.*: Is the main window of the KDE application
  • ktimetrackerpart.*: Is the KPart of KTimeTracker
    • timetrackerwidget.*: Is a widget with no or several tabs that contain
      • taskview.*: Is a treeListWidget that contains:
        • task.*: A QObject and QTreeWidgetItem. A task can be constructed from a taskview and a todo. As soon as you instantiate a task, it becomes visible in your TreeWidget.
        • timetrackerstorage.*: Is the storage backend that contains a:
          • KCal::ResourceCalendar

Nokia N810

I got a Nokia N810 from Nokia to allow me porting KTimeTracker to it. I appreciate this a lot and am now kompiling KTimeTracker for arm. The project is not ready, here is what I found out:

To kompile KTimeTracker for the Nokia N810

  • add the maemo repository
  • install openssh

dbus

dbus is clearly a developer topic. To test the dbus functionality of your KTimeTracker, have KTimeTracker running and proceed like in this example:

qdbus
...
 org.kde.KTimeTracker
...
qdbus org.kde.KTimeTracker
...
/KTimeTracker
...
qdbus org.kde.KTimeTracker /KTimeTracker
...
method void org.kde.KTimeTracker.KTimeTracker.quit()
...
qdbus org.kde.KTimeTracker /KTimeTracker org.kde.KTimeTracker.KTimeTracker.quit

Internationalization

You want to test the translation of KTimeTracker. For this, you want to call KTimeTracker in, say, german. For this, you need to know how you at all can call a KDE 4 program in another language than english. Here is as an example how I call akregator in german:

wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/de/messages/kdepim/ktimetracker.po  
msgfmt -o ktimetracker.mo ktimetracker.po
cp ktimetracker.mo .kde4/share/locale/de/LC_MESSAGES/
KDE4_LANG=de ktimetracker

How to reproduce a stale lock

Here is an example to give you an idea:

touch .kde/share/apps/kabc/lock/_home_tom_.kde_share_apps_karm_karm.ics.lock

How to get rid of debugging output

cmake -DCMAKE_BUILD_TYPE=Release

Goals

  • Unicode - I found out it is already capable of UTF-8.

Where is what ?

http://commitfilter.kde.org

http://websvn.kde.org/trunk/KDE/kdepim/doc/ktimetracker

  • KTimeTracker all-you-need in the internet:

http://userbase.kde.org/KTimeTracker

Development Direction

The following similar programs can give you inspiration how to move forward developing:

  • hourglass
  • gnotime
  • titrax
  • taskCoach
  • Hamster

Kontact plugin vs. Standalone

The Kontact plugin is realized via a KPart. The elegant solution would be to have one KPart that can be integrated into Kontact and one shell that just displays the KPart. This is not so far now. At the moment, ktimetrackerpart.cpp implements the KTimeTracker part and mainwindow.cpp implements the standalone application.

IdleTimeDetector

The idletimedetector is in the equally-named .cpp and .h file. It starts a qtimer and at every timeout, checks, if the X extension delivers for the last user interaction a timepoint that is further away than the maxIdleTime.

About storage

The storage of your KTimeTracker data takes place in an iCal file. That format needs a bit of explanation. A simple one looks like the following:

BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 3.5//EN
VERSION:2.0
BEGIN:VTODO
DTSTAMP:20060915T181010Z
ORGANIZER;CN=root:MAILTO:
X-KDE-karm-totalSessionTime:0
X-KDE-karm-totalTaskTime:19
CREATED:20060609T230212Z
UID:libkcal-652058592.803
SEQUENCE:0
LAST-MODIFIED:20060915T181010Z
SUMMARY:fg
CLASS:PUBLIC
PRIORITY:5
PERCENT-COMPLETE:0
END:VTODO

BEGIN:VEVENT
DTSTAMP:20060915T181010Z
ORGANIZER:MAILTO:
X-KDE-karm-duration:300
CREATED:20060915T174305Z
UID:libkcal-6397995.845
SEQUENCE:0
LAST-MODIFIED:20060910T174305Z
SUMMARY:fg
CLASS:PUBLIC
PRIORITY:5
CATEGORIES:KArm
RELATED-TO:libkcal-652058592.803
DTSTART:20060910T172346Z
DTEND:20060910T174305Z
TRANSP:OPAQUE
END:VEVENT

END:VCALENDAR

A test case for kcal

CMakeLists.txt

PROJECT( kde4start )
FIND_PACKAGE(KDE4 REQUIRED)
INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} . )


SET(kde4startSources main.cpp )

KDE4_ADD_EXECUTABLE(kde4start ${kde4startSources} )

TARGET_LINK_LIBRARIES(kde4start ${KDE4_KDEUI_LIBS} ${KDE4_KCAL_LIBS} ${KDE4_KPARTS_LIBS} kdepim kcal_resourceremote )

main.cpp

#include <QString>
#include <kapplication.h>
#include <kaboutdata.h>
#include <kmessagebox.h>
#include <kcmdlineargs.h>
#include <KMainWindow>
#include <kcal/resourcecalendar.h>
#include <kcal/resourcecached.h>
#include <kcal/resourcelocal.h>

int main (int argc, char *argv[])
{
  const QByteArray& ba=QByteArray("test");
  const KLocalizedString name=ki18n("myName");
  KAboutData aboutData( ba, ba, name, ba, name);
  KCmdLineArgs::init( argc, argv, &aboutData );
  KApplication khello;
  KCal::ResourceCalendar* cal;
  KCal::ResourceCached* resource;
  resource=new KCal::ResourceLocal("/tmp/KTimeTrackerkonsole.ics");
  cal=resource;
}

Compile, link and run

cmake . && make && ./kde4start

Related Projects

http://websvn.kde.org/trunk/playground/base/plasma/applets/timetracker/

Readings


This page was last modified on 22 August 2012, at 15:27. This page has been accessed 5,980 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal