summaryrefslogtreecommitdiffstats
path: root/karm/karm_part.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /karm/karm_part.h
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karm/karm_part.h')
-rw-r--r--karm/karm_part.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/karm/karm_part.h b/karm/karm_part.h
new file mode 100644
index 000000000..85c1e99f7
--- /dev/null
+++ b/karm/karm_part.h
@@ -0,0 +1,137 @@
+#ifndef _KARMPART_H_
+#define _KARMPART_H_
+
+#include <kparts/part.h>
+#include "karmerrors.h"
+#include <kparts/factory.h>
+#include <karmdcopiface.h>
+#include "reportcriteria.h"
+#include <qlistview.h>
+
+class KAccel;
+class KAccelMenuWatch;
+class KarmTray;
+class QWidget;
+class QPainter;
+class KURL;
+
+class Preferences;
+class Task;
+class TaskView;
+
+/**
+ * This is a "Part". It that does all the real work in a KPart
+ * application.
+ *
+ * @short Main Part
+ * @author Thorsten Staerk <kde at staerk dot de>
+ * @version 0.1
+ */
+class karmPart : public KParts::ReadWritePart, virtual public KarmDCOPIface
+{
+ Q_OBJECT
+
+ private:
+ void makeMenus();
+ QString _hastodo( Task* task, const QString &taskname ) const;
+ QString _hasTask( Task* task, const QString &taskname ) const;
+ Task* _hasUid( Task* task, const QString &uid ) const;
+
+ KAccel* _accel;
+ KAccelMenuWatch* _watcher;
+ TaskView* _taskView;
+ Preferences* _preferences;
+ KarmTray* _tray;
+ KAction* actionStart;
+ KAction* actionStop;
+ KAction* actionStopAll;
+ KAction* actionDelete;
+ KAction* actionEdit;
+// KAction* actionAddComment;
+ KAction* actionMarkAsComplete;
+ KAction* actionMarkAsIncomplete;
+ KAction* actionPreferences;
+ KAction* actionClipTotals;
+ KAction* actionClipHistory;
+ QString m_error[ KARM_MAX_ERROR_NO + 1 ];
+
+ friend class KarmTray;
+
+public:
+ karmPart(QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name);
+ // DCOP
+ void quit();
+ virtual bool save();
+ QString version() const;
+ QString taskIdFromName( const QString &taskName ) const;
+ /** @reimp from KarmDCOPIface */
+ int addTask( const QString &taskName );
+ /** @reimp from KarmDCOPIface */
+ QString setPerCentComplete( const QString& taskName, int PerCent );
+ /** @reimp from KarmDCOPIface */
+ int bookTime( const QString& taskId, const QString& iso8601StartDateTime, long durationInMinutes );
+ /** @reimp from KarmDCOPIface */
+ QString getError( int karmErrorNumber ) const;
+ int totalMinutesForTaskId( const QString& taskId );
+ QString starttimerfor( const QString &taskname );
+ QString stoptimerfor( const QString &taskname );
+ QString deletetodo();
+ bool getpromptdelete();
+ QString setpromptdelete( bool prompt );
+ QString exportcsvfile( QString filename, QString from, QString to, int type = 0, bool decimalMinutes=true, bool allTasks=true, QString delimiter="r", QString quote="q" );
+ QString importplannerfile( QString filename );
+
+ virtual ~karmPart();
+
+ /**
+ * This is a virtual function inherited from KParts::ReadWritePart.
+ * A shell will use this to inform this Part if it should act
+ * read-only
+ */
+ virtual void setReadWrite(bool rw);
+
+ /**
+ * Reimplemented to disable and enable Save action
+ */
+ virtual void setModified(bool modified);
+
+protected:
+ /**
+ * This must be implemented by each part
+ */
+ virtual bool openFile();
+
+ /**
+ * This must be implemented by each read-write part
+ */
+ virtual bool saveFile();
+
+protected slots:
+ void contextMenuRequest( QListViewItem*, const QPoint& point, int );
+ void fileOpen();
+ void fileSaveAs();
+ void slotSelectionChanged();
+ void startNewSession();
+};
+
+class KInstance;
+class KAboutData;
+
+class karmPartFactory : public KParts::Factory
+{
+ Q_OBJECT
+public:
+ karmPartFactory();
+ virtual ~karmPartFactory();
+ virtual KParts::Part* createPartObject( QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const char *classname, const QStringList &args );
+ static KInstance* instance();
+
+private:
+ static KInstance* s_instance;
+ static KAboutData* s_about;
+};
+
+#endif // _KARMPART_H_