SVN_SILENT made messages (.desktop file)
[kdepim.git] / ktimetracker / ktimetrackerutility.h
blob694d0f5e028dbf33048dfbf0ac17f831302321bd
1 /*
2 * Copyright (C) 2007 by Thorsten Staerk <dev@staerk.de>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the
16 * Free Software Foundation, Inc.
17 * 51 Franklin Street, Fifth Floor
18 * Boston, MA 02110-1301 USA.
22 #ifndef KTIMETRACKERUTILITY_H
23 #define KTIMETRACKERUTILITY_H
25 #include <KDebug>
26 #include <KWindowSystem>
27 #include <QString>
29 /**
30 Format time for output. All times output on screen or report output go
31 through this function.
32 If the second argument is true, the time is output as a two-place decimal.
33 Otherwise the format is hh:mi.
34 Examples:
35 30 seconds are 0.5 minutes.
36 The output of formatTiMe(0.5,true) is 0.008333, because 0.5 minutes are 0.008333 hours.
37 The output of formatTiMe(0.5,false) is 0:01, because 0.5 minutes are 0:01 hours rounded.
39 QString formatTime( double minutes, bool decimal = false );
41 /**
42 Get the name of the window that has the focus
44 QString getFocusWindow();
46 /**
47 Get the number of virtual desktops
48 Delivers 4 for four virtual desktops, 1 for one virtual desktop, -1 if it could not be
49 determined. The absolute value of desktopcount is always the usable number of desktops
51 int desktopcount();
53 const int secsPerMinute=60;
55 enum KTIMETRACKER_Errors
57 KTIMETRACKER_ERR_GENERIC_SAVE_FAILED = 1,
58 KTIMETRACKER_ERR_COULD_NOT_MODIFY_RESOURCE,
59 KTIMETRACKER_ERR_MEMORY_EXHAUSTED,
60 KTIMETRACKER_ERR_UID_NOT_FOUND,
61 KTIMETRACKER_ERR_INVALID_DATE,
62 KTIMETRACKER_ERR_INVALID_TIME,
63 KTIMETRACKER_ERR_INVALID_DURATION,
65 KTIMETRACKER_MAX_ERROR_NO = KTIMETRACKER_ERR_INVALID_DURATION
68 #endif