karm

karm_part.h
1 #ifndef _KARMPART_H_
2 #define _KARMPART_H_
3 
4 #include <tdeparts/part.h>
5 #include "karmerrors.h"
6 #include <tdeparts/factory.h>
7 #include <karmdcopiface.h>
8 #include "reportcriteria.h"
9 #include <tqlistview.h>
10 
11 class TDEAccel;
12 class TDEAccelMenuWatch;
13 class KarmTray;
14 class TQWidget;
15 class TQPainter;
16 class KURL;
17 
18 class Preferences;
19 class Task;
20 class TaskView;
21 
30 class karmPart : public KParts::ReadWritePart, virtual public KarmDCOPIface
31 {
32  TQ_OBJECT
33 
34 
35  private:
36  void makeMenus();
37  TQString _hastodo( Task* task, const TQString &taskname ) const;
38  TQString _hasTask( Task* task, const TQString &taskname ) const;
39  Task* _hasUid( Task* task, const TQString &uid ) const;
40 
41  TDEAccel* _accel;
42  TDEAccelMenuWatch* _watcher;
43  TaskView* _taskView;
44  Preferences* _preferences;
45  KarmTray* _tray;
46  TDEAction* actionStart;
47  TDEAction* actionStop;
48  TDEAction* actionStopAll;
49  TDEAction* actionDelete;
50  TDEAction* actionEdit;
51 // TDEAction* actionAddComment;
52  TDEAction* actionMarkAsComplete;
53  TDEAction* actionMarkAsIncomplete;
54  TDEAction* actionPreferences;
55  TDEAction* actionClipTotals;
56  TDEAction* actionClipHistory;
57  TQString m_error[ KARM_MAX_ERROR_NO + 1 ];
58 
59  friend class KarmTray;
60 
61 public:
62  karmPart(TQWidget *parentWidget, const char *widgetName,
63  TQObject *parent, const char *name);
64  // DCOP
65  void quit();
66  virtual bool save();
67  TQString version() const;
68  TQString taskIdFromName( const TQString &taskName ) const;
70  int addTask( const TQString &taskName );
72  TQString setPerCentComplete( const TQString& taskName, int PerCent );
74  int bookTime( const TQString& taskId, const TQString& iso8601StartDateTime, long durationInMinutes );
76  TQString getError( int karmErrorNumber ) const;
77  int totalMinutesForTaskId( const TQString& taskId );
78  TQString starttimerfor( const TQString &taskname );
79  TQString stoptimerfor( const TQString &taskname );
80  TQString deletetodo();
81  bool getpromptdelete();
82  TQString setpromptdelete( bool prompt );
83  TQString exportcsvfile( TQString filename, TQString from, TQString to, int type = 0, bool decimalMinutes=true, bool allTasks=true, TQString delimiter="r", TQString quote="q" );
84  TQString importplannerfile( TQString filename );
85 
86  virtual ~karmPart();
87 
93  virtual void setReadWrite(bool rw);
94 
98  virtual void setModified(bool modified);
99 
100 protected:
104  virtual bool openFile();
105 
109  virtual bool saveFile();
110 
111 protected slots:
112  void contextMenuRequest( TQListViewItem*, const TQPoint& point, int );
113  void fileOpen();
114  void fileSaveAs();
115  void slotSelectionChanged();
116  void startNewSession();
117 };
118 
119 class TDEInstance;
120 class TDEAboutData;
121 
122 class karmPartFactory : public KParts::Factory
123 {
124  TQ_OBJECT
125 
126 public:
127  karmPartFactory();
128  virtual ~karmPartFactory();
129  virtual KParts::Part* createPartObject( TQWidget *parentWidget, const char *widgetName,
130  TQObject *parent, const char *name,
131  const char *classname, const TQStringList &args );
132  static TDEInstance* instance();
133 
134 private:
135  static TDEInstance* s_instance;
136  static TDEAboutData* s_about;
137 };
138 
139 #endif // _KARMPART_H_
Define DCOP interface to karm.
Definition: karmdcopiface.h:28
Provide an interface to the configuration options for the program.
Definition: preferences.h:17
Easy updating of menu accels when changing a TDEAccel object.
Container and interface for the tasks.
Definition: taskview.h:43
A class representing a task.
Definition: task.h:42
This is a "Part".
Definition: karm_part.h:31
virtual void setReadWrite(bool rw)
This is a virtual function inherited from KParts::ReadWritePart.
Definition: karm_part.cpp:286
virtual void setModified(bool modified)
Reimplemented to disable and enable Save action.
Definition: karm_part.cpp:301
bool getpromptdelete()
get if prompted on deleting a task
Definition: karm_part.cpp:449
int addTask(const TQString &taskName)
Definition: karm_part.cpp:489
TQString getError(int karmErrorNumber) const
Definition: karm_part.cpp:576
TQString exportcsvfile(TQString filename, TQString from, TQString to, int type=0, bool decimalMinutes=true, bool allTasks=true, TQString delimiter="r", TQString quote="q")
export csv history or totals file
Definition: karm_part.cpp:677
TQString setPerCentComplete(const TQString &taskName, int PerCent)
Definition: karm_part.cpp:503
virtual bool saveFile()
This must be implemented by each read-write part.
Definition: karm_part.cpp:330
TQString starttimerfor(const TQString &taskname)
Start timer for all tasks with the summary taskname.
Definition: karm_part.cpp:649
int bookTime(const TQString &taskId, const TQString &iso8601StartDateTime, long durationInMinutes)
Definition: karm_part.cpp:524
int totalMinutesForTaskId(const TQString &taskId)
Total time currently associated with a task.
Definition: karm_part.cpp:582
TQString stoptimerfor(const TQString &taskname)
Stop timer for all tasks with the summary taskname.
Definition: karm_part.cpp:663
TQString taskIdFromName(const TQString &taskName) const
Return id of task found, empty string if no match.
Definition: karm_part.cpp:460
TQString version() const
Return karm version.
Definition: karm_part.cpp:438
TQString setpromptdelete(bool prompt)
set if prompted on deleting a task
Definition: karm_part.cpp:454
virtual bool save()
save your tasks
Definition: karm_part.cpp:479
void quit()
Graceful shutdown.
Definition: karm_part.cpp:474
TQString importplannerfile(TQString filename)
import planner project file
Definition: karm_part.cpp:691
virtual bool openFile()
This must be implemented by each part.
Definition: karm_part.cpp:319
TQString deletetodo()
delete the current item
Definition: karm_part.cpp:443