kpilot
notepad-conduit.h
Go to the documentation of this file.00001 #ifndef _KPILOT_NOTEPAD_CONDUIT_H 00002 #define _KPILOT_NOTEPAD_CONDUIT_H 00003 /* notepad-conduit.h KPilot 00004 ** 00005 ** Copyright (C) 2004 by Adriaan de Groot, Joern Ahrens, Angus Ainslie 00006 ** 00007 ** The code for NotepadActionThread::unpackNotePad was taken from 00008 ** Angus Ainslies read-notepad.c, which is part of pilot-link. 00009 ** NotepadActionThread::saveImage is also based on read-notepad.c. 00010 ** 00011 ** This file is part of the Notepad conduit, a conduit for KPilot that 00012 ** store the notepad drawings to files. 00013 */ 00014 00015 /* 00016 ** This program is free software; you can redistribute it and/or modify 00017 ** it under the terms of the GNU Lesser General Public License as published by 00018 ** the Free Software Foundation; either version 2.1 of the License, or 00019 ** (at your option) any later version. 00020 ** 00021 ** This program is distributed in the hope that it will be useful, 00022 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 ** GNU Lesser General Public License for more details. 00025 ** 00026 ** You should have received a copy of the GNU Lesser General Public License 00027 ** along with this program in a file called COPYING; if not, write to 00028 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00029 ** MA 02110-1301, USA. 00030 */ 00031 00032 /* 00033 ** Bug reports and questions can be sent to kde-pim@kde.org 00034 */ 00035 00036 #include "plugin.h" 00037 00038 #include <qthread.h> 00039 struct NotePad; 00040 class NotepadActionThread; 00041 00042 class NotepadConduit : public ConduitAction 00043 { 00044 public: 00045 NotepadConduit(KPilotLink *, 00046 const char *name=0L, 00047 const QStringList &args = QStringList()); 00048 virtual ~NotepadConduit(); 00049 virtual bool event(QEvent *e); 00050 00051 protected: 00052 virtual bool exec(); // From ConduitAction 00053 00054 private: 00055 NotepadActionThread *thread; 00056 }; 00057 00058 00062 class NotepadActionThread : public QThread 00063 { 00064 public: 00065 NotepadActionThread(QObject *parent, KPilotLink *link); 00066 00067 virtual void run(); 00068 int getFailed() { return notSaved; } 00069 int getSaved() { return saved; } 00070 00071 private: 00072 QObject *fParent; 00073 KPilotLink *fLink; 00074 00078 int notSaved; 00082 int saved; 00083 00084 int unpackNotePad(struct NotePad *a, unsigned char *buffer, int len); 00085 00091 void saveImage(struct NotePad *n); 00092 }; 00093 00094 #endif