diff options
| author | 2008-04-05 17:13:08 +0000 | |
|---|---|---|
| committer | 2008-04-05 17:13:08 +0000 | |
| commit | ff28d125380b2dbceb410f6f15785b78808fdad9 (patch) | |
| tree | 97457cd6c3c6c55744d72933bd095ddfcdf27b7e /src/modules/spaste | |
| parent | More correct kde4 support handling; Changed SIZEOFs' names to be compliant wi... (diff) | |
| download | KVIrc-ff28d125380b2dbceb410f6f15785b78808fdad9.tar.gz KVIrc-ff28d125380b2dbceb410f6f15785b78808fdad9.tar.bz2 KVIrc-ff28d125380b2dbceb410f6f15785b78808fdad9.zip | |
code clean
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1398 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/spaste')
| -rw-r--r-- | src/modules/spaste/controller.cpp | 34 | ||||
| -rw-r--r-- | src/modules/spaste/controller.h | 49 | ||||
| -rw-r--r-- | src/modules/spaste/libkvispaste.cpp | 14 | ||||
| -rw-r--r-- | src/modules/spaste/libkvispaste.h | 31 |
4 files changed, 66 insertions, 62 deletions
diff --git a/src/modules/spaste/controller.cpp b/src/modules/spaste/controller.cpp index cf6924275..438b82938 100644 --- a/src/modules/spaste/controller.cpp +++ b/src/modules/spaste/controller.cpp @@ -20,24 +20,26 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "controller.h" + #include "kvi_window.h" #include "kvi_console.h" #include "kvi_mirccntrl.h" #include "kvi_app.h" #include "kvi_options.h" -#include <qtimer.h> -#include <qstringlist.h> -#include <qclipboard.h> +#include <QTimer> +#include <QString> +#include <QStringList> +#include <QClipboard> extern KviPointerList<SPasteController> * g_pControllerList; SPasteController::SPasteController(KviWindow * w,int id) - : m_pClipBuff(NULL),m_pFile(NULL),m_pId(id),m_pWindow(w) +: m_pClipBuff(NULL),m_pFile(NULL),m_pId(id),m_pWindow(w) { - g_pControllerList->append(this); - //m_pWindow = w; - m_pTimer = new QTimer(this); + g_pControllerList->append(this); + //m_pWindow = w; + m_pTimer = new QTimer(this); } SPasteController::~SPasteController() @@ -86,22 +88,7 @@ bool SPasteController::pasteClipboardInit(void) void SPasteController::pasteFile(void) { -#ifndef COMPILE_USE_QT4 - QString line; - if(m_pFile->readLine(line,999) != -1) - { - if(line.isEmpty()) - line = QChar(KVI_TEXT_RESET); - if( (!g_pApp->windowExists(m_pWindow)) || m_pWindow->console()->isNotConnected() ) - { - m_pFile->close(); - delete this; - } else m_pWindow->ownMessage(line.ascii()); - } else { //File finished - m_pFile->close(); - delete this; - } -#endif + } void SPasteController::pasteClipboard(void) @@ -121,4 +108,3 @@ void SPasteController::pasteClipboard(void) #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "controller.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/spaste/controller.h b/src/modules/spaste/controller.h index 00d50e692..22172e24a 100644 --- a/src/modules/spaste/controller.h +++ b/src/modules/spaste/controller.h @@ -1,3 +1,5 @@ +#ifndef _SPASTE_CONTROLLER_H_ +#define _SPASTE_CONTROLLER_H_ // File : controller.h // Creation date : Thu Apr 30 2002 17:13:12 GMT by Juanjo Álvarez // @@ -19,41 +21,38 @@ // along with this program. If not, write to the Free Software Foundation, // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef SPASTE_CONTROLLER_H -#define SPASTE_CONTROLLER_H + #include "kvi_window.h" #include "kvi_string.h" -#include <qobject.h> -#include <qstringlist.h> -#include <qfile.h> +#include <QObject> +#include <QStringList> +#include <QFile> class SPasteController : public QObject { - Q_OBJECT + Q_OBJECT public: - SPasteController(KviWindow * w,int id); - ~SPasteController(); - - //bool pasteFileInit(KviStr * fileName); - bool pasteFileInit(QString &fileName); - bool pasteClipboardInit(void); - int getId(void){return m_pId;}; - KviWindow * window(void){return m_pWindow;}; - //void stop(void); + SPasteController(KviWindow * w,int id); + ~SPasteController(); + + //bool pasteFileInit(KviStr * fileName); + bool pasteFileInit(QString &fileName); + bool pasteClipboardInit(void); + int getId(void){return m_pId;}; + KviWindow * window(void){return m_pWindow;}; + //void stop(void); protected slots: - void pasteFile(void); - void pasteClipboard(void); - + void pasteFile(void); + void pasteClipboard(void); private: - QStringList *m_pClipBuff; - QFile *m_pFile; - int m_pId; - KviWindow *m_pWindow; - QTimer *m_pTimer; - QStringList::Iterator m_clipBuffIterator; + QStringList *m_pClipBuff; + QFile *m_pFile; + int m_pId; + KviWindow *m_pWindow; + QTimer *m_pTimer; + QStringList::Iterator m_clipBuffIterator; }; #endif //SPASTE_CONTROLLER_H - diff --git a/src/modules/spaste/libkvispaste.cpp b/src/modules/spaste/libkvispaste.cpp index 9603fa68a..4b8c5215a 100644 --- a/src/modules/spaste/libkvispaste.cpp +++ b/src/modules/spaste/libkvispaste.cpp @@ -207,7 +207,7 @@ static bool spaste_kvs_cmd_stop(KviKvsModuleCommandCall * c) } else { KviPointerListIterator<SPasteController> it(*g_pControllerList); SPasteController *item; - + if(!iId) //Delete all spaste's from the current window { if((c->window()->type() != KVI_WINDOW_TYPE_CHANNEL) && (c->window()->type() != KVI_WINDOW_TYPE_QUERY) && (c->window()->type() != KVI_WINDOW_TYPE_DCCCHAT)) @@ -222,10 +222,10 @@ static bool spaste_kvs_cmd_stop(KviKvsModuleCommandCall * c) if(kvi_strEqualCS(item->window()->id(),c->window()->id()))delete item; } } - } else //Delete the spaste with the given id - { + } else { + //Delete the spaste with the given id while( (item = it.current()) != 0) - { + { ++it; if(item->getId() == iId)delete item; } @@ -258,7 +258,7 @@ static bool spaste_kvs_cmd_stop(KviKvsModuleCommandCall * c) //-------------------------------------------------- static bool spaste_kvs_cmd_list(KviKvsModuleCommandCall * c) -{ +{ KviPointerListIterator<SPasteController> it(*g_pControllerList); SPasteController *item; @@ -295,7 +295,7 @@ static bool spaste_kvs_cmd_list(KviKvsModuleCommandCall * c) static bool spaste_kvs_cmd_setdelay(KviKvsModuleCommandCall * c) -{ +{ kvs_int_t delay; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("delay",KVS_PT_INTEGER,0,delay) @@ -334,7 +334,7 @@ static bool spaste_module_can_unload(KviModule *m) //------------------------------------------------- KVIRC_MODULE( "SPaste", // module name - "1.0.0", // module version + "4.0.0", // module version " (C) 2002 Juanjo Alvarez (juanjux@yahoo.es)", // author & (C) "Delayed paste commands", spaste_module_init, diff --git a/src/modules/spaste/libkvispaste.h b/src/modules/spaste/libkvispaste.h index 53724c2de..90d5a9a17 100644 --- a/src/modules/spaste/libkvispaste.h +++ b/src/modules/spaste/libkvispaste.h @@ -1,13 +1,32 @@ -#ifndef KVISPASTE_H -#define KVISPASTE_H +#ifndef _KVISPASTE_H_ +#define _KVISPASTE_H_ +// File : libkvispaste.h +// Creation date : Thu Dec 27 2002 17:13:12 GMT by Juanjo �varez +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2002 Juanjo �varez (juanjux@yahoo.es) +// Copyright (C) 2002 Szymon Stefanek (kvirc@tin.it) +// +// 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 opinion) 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// #include "kvi_window.h" typedef struct _SPasteThreadData { - QString * strData; - KviWindow * win; + QString * strData; + KviWindow * win; } SPasteThreadData; - - #endif |
