Make ktimetracker build on OS X, where it uses a native method from the ApplicationServices framework for idle time detection, instead of the XScreenSaver.
Review Request #119533 - Created July 29, 2014 and discarded
|René J.V. Bertin|
Signed-off-by: RJVB <firstname.lastname@example.org>
Testing was done under KDE and KDEPIM 4.12.5, MacPorts. The patches from that version applied without issues on the code in git, with 2 exceptions that I could re-apply manually easily.
With these patches, ktimetracker builds and launches under OS X (•) and loads existing ktimetracker.ics files correctly. The idle time detection feature appears to work as far as I'm able to tell (I don't use it under Linux).
What remains to be done is to double-check the timing precision: I've had an impression that timing may be too fast but haven't been able to prove timing isn't correct.
The history output to clipboard feature does ignore the date range and "output only the selection" options; removing entries originating from Linux we have
"test" 0.00 0.00
"test->test 1" 0.07 0.03
"test->test 2" 0.00 0.06
"test->test 3" 0.00 0.03
"test->test 4" 0.00 0.03
and the timing output (which does honour the "output only the selection" option):
Totaux des tâches
0:05 test 1
0:03 test 2
0:02 test 3
0:02 test 4
•) this supposes libical is installed and built following https://trac.macports.org/ticket/44469, i.e. using cmake instead and including a patch from Ubuntu.
in mainwindow.cpp I added:
// not sure if this is really required but this is the code that works for me with g++-mp-4.8
static KParts::ReadWritePart rwp = factory->create<KParts::ReadWritePart>( this );
static ktimetrackerpart mp = dynamic_cast<ktimetrackerpart>( rwp );
m_part = dynamic_cast<ktimetrackerpart>( rwp );
kError() << "this=" << this << "; rwp=" << rwp << "; mp=" << mp << "; m_part=" << m_part;
turns out that this doesn't work when building with clang 3.4 (which is the current default compiler on OS X 10.9). the
kErrorstatement prints this:
ktimetracker(92451): this= MainWindow(0x117929f20) ; rwp= ktimetrackerpart(0x103defe60) ; mp= QObject(0x0) ; m_part= QObject(0x0)
which means back to the drawing board.
How can it be that rwp is identified as a (pointer to a)
ktimetrackerpart, and yet a
Does that have anything to do with the comment just above my change,//NOTE: Use the dynamic_cast below. Without it, KPluginLoader will use a qobject_cast // that fails, because ktimetrackerpart is defined twice, once in ktimetracker's binary // and another one in the plugin. The build system should be fixed. //m_part = factory->create<ktimetrackerpart>( this );
meaning someone would have to do the (apparently) required fix to the build system in order for this to work?