summaryrefslogtreecommitdiffstats
path: root/karm/karmdcopiface.h
blob: 67e599383021e02a423f69d99f5a2ba27e22fd66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 *   This file only:
 *     Copyright (C) 2004  Mark Bucciarelli <mark@hubcapconsulting.com>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this program; if not, write to the
 *      Free Software Foundation, Inc.
 *      51 Franklin Street, Fifth Floor
 *      Boston, MA  02110-1301  USA.
 */
#ifndef KARM_DCOP_IFAC_H
#define KARM_DCOP_IFAC_H

#include <dcopobject.h>

/** Define DCOP interface to karm.  Methods implemented in MainWindow */
class KarmDCOPIface : virtual public DCOPObject
{
  K_DCOP
  k_dcop:

  /** Return karm version. */
  virtual TQString version() const = 0;

  /** Return id of task found, empty string if no match. */
  virtual TQString taskIdFromName( const TQString& taskName ) const = 0;

  /** 
   * Add a new top-level task.
   *
   * A top-level task is one that has no tqparent tasks.
   * 
   * @param taskName Name of new task.
   *
   * @return 0 on success, error number on failure.
   */
  virtual int addTask( const TQString& taskName ) = 0;

  /** 
   * Set percent complete to a task
   *
   * @param taskName Name of new task.
   * @param perCent  percent, e.g. 99
   *
   * @return "" on success, error msg on failure.
   */
   virtual TQString setPerCentComplete( const TQString& taskName, int perCent ) = 0;

  /** 
   * Add time to a task.  
   *
   * The GUI will be non-responsive until this method returns.
   *
   * @return 0 on success, error number on failure.
   *
   * @param taskId Unique ID of task to add time to 
   *
   * @param iso8601StartDateTime Date and time the booking starts, in extended
   * ISO-8601 format; for example, YYYY-MM-DDTHH:MI:SS format (see
   * TQt::ISODate).  No timezone support--time is interpreted as the local time.
   * If just the date is passed in (i.e., YYYY-MM-DD) , then the time is set to
   * noon.
   *
   * @param durationInMinutes The amount of time to book against the taskId.
   * 
   */ 
  virtual int bookTime( const TQString& taskId, const TQString& iso8601StartDateTime, 
                        long durationInMinutes ) = 0;

  /** 
   * Return error string associated with karm error number. 
   *
   * @param karmErrorNumber An integer error number.
   *
   * @return String associated with error number.  These strings are
   * internationalized.  An unknown error number produces an empty string as
   * the return value.
   *
   */
  virtual TQString getError( int karmErrorNumber ) const = 0;

  /**
   * Total time currently associated with a task.
   *
   * A task has two counters: the total session time and the total time.  Note
   * that th euser can reset both counters.
   *
   * @param taskId Unique ID of task to lookup bookings for.
   */
  virtual int totalMinutesForTaskId( const TQString& taskId ) = 0;

  /** Start timer for all tasks with the summary taskname.  */
  // may conflict with unitaskmode
  virtual TQString starttimerfor( const TQString& taskname ) = 0;

  /** Stop timer for all tasks with the summary taskname.  */
  // may conflict with unitaskmode
  virtual TQString stoptimerfor( const TQString& taskname ) = 0;

  /** delete the current item */
  virtual TQString deletetodo() = 0;

  /** set if prompted on deleting a task */
  virtual TQString setpromptdelete( bool prompt ) = 0;

  /** get if prompted on deleting a task */
  virtual bool getpromptdelete() = 0;

  /** export csv history or totals file */
  virtual TQString exportcsvfile( TQString filename, TQString from, TQString to, int type = 0, bool decimalMinutes=true, bool allTasks=true, TQString delimiter=";", TQString quote="'" ) = 0;

  /** import planner project file */
  virtual TQString importplannerfile( TQString filename ) = 0;

  /** save your tasks */
  virtual bool save() = 0;

  /** Graceful shutdown. */
  virtual void quit() = 0;
};

#endif // KARM_DCOP_IFAC_H