diff options
| author | 2009-10-24 21:49:38 +0000 | |
|---|---|---|
| committer | 2009-10-24 21:49:38 +0000 | |
| commit | 7a74f19e206adaa23aa5003737ee425e347b8fe1 (patch) | |
| tree | c07b54260a76829851cae775c14bb3574ed0bc21 /src | |
| parent | Quick'n'fast mea culpa commit on alias editor hot key (diff) | |
| download | KVIrc-7a74f19e206adaa23aa5003737ee425e347b8fe1.tar.gz KVIrc-7a74f19e206adaa23aa5003737ee425e347b8fe1.tar.bz2 KVIrc-7a74f19e206adaa23aa5003737ee425e347b8fe1.zip | |
fix for #594 + some minor issues on slow paste
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3569 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/spaste/controller.cpp | 42 | ||||
| -rw-r--r-- | src/modules/spaste/controller.h | 1 | ||||
| -rw-r--r-- | src/modules/spaste/libkvispaste.h | 4 |
3 files changed, 21 insertions, 26 deletions
diff --git a/src/modules/spaste/controller.cpp b/src/modules/spaste/controller.cpp index 91b3d4655..8a496d442 100644 --- a/src/modules/spaste/controller.cpp +++ b/src/modules/spaste/controller.cpp @@ -1,10 +1,10 @@ //============================================================================= // // File : controller.h -// Creation date : Thu Apr 30 2002 17:13:12 GMT by Juanjo Alvarez +// Creation date : Thu Apr 30 2002 17:13:12 GMT by Juanjo Álvarez // // This file is part of the KVirc irc client distribution -// Copyright (C) 2002 Juanjo Alvarez (juanjux@yahoo.es) +// Copyright (C) 2002 Juanjo Álvarez (juanjux@yahoo.es) // Copyright (C) 2002-2008 Szymon Stefanek (kvirc@tin.it) // // This program is FREE software. You can redistribute it and/or @@ -69,8 +69,12 @@ bool SPasteController::pasteFileInit(QString &fileName) if(m_pFile)return false; // can't paste two files at a time m_pFile = new QFile(fileName); if(!m_pFile->open(QIODevice::ReadOnly))return false; + //avoid double connection + disconnect(m_pTimer,SIGNAL(timeout()),0,0); connect(m_pTimer,SIGNAL(timeout()),this,SLOT(pasteFile())); - m_pTimer->start(KVI_OPTION_UINT(KviOption_uintPasteDelay)); + //avoid timer reset if always active + if(!m_pTimer->isActive()) + m_pTimer->start(KVI_OPTION_UINT(KviOption_uintPasteDelay)); return true; } @@ -83,10 +87,13 @@ bool SPasteController::pasteClipboardInit(void) (*m_pClipBuff) += tmp.isEmpty()?QStringList():tmp.split("\n",QString::KeepEmptyParts); } else { m_pClipBuff = new QStringList(tmp.isEmpty()?QStringList():tmp.split("\n",QString::KeepEmptyParts)); - m_clipBuffIterator = m_pClipBuff->begin(); } + //avoid double connection + disconnect(m_pTimer,SIGNAL(timeout()),0,0); connect(m_pTimer,SIGNAL(timeout()),this,SLOT(pasteClipboard())); - m_pTimer->start(KVI_OPTION_UINT(KviOption_uintPasteDelay)); + //avoid timer reset if always active + if(!m_pTimer->isActive()) + m_pTimer->start(KVI_OPTION_UINT(KviOption_uintPasteDelay)); return true; } @@ -117,25 +124,14 @@ void SPasteController::pasteFile(void) void SPasteController::pasteClipboard(void) { - if(m_clipBuffIterator != m_pClipBuff->end()) + if(m_pClipBuff->isEmpty() || !g_pApp->windowExists(m_pWindow)) { - if(!g_pApp->windowExists(m_pWindow)) - { - delete this; - } else { - QString line; - if((*m_clipBuffIterator).isEmpty()) - { - line = QChar(KVI_TEXT_RESET); - } else { - line = *m_clipBuffIterator; - } - - line.replace('\t',QString(KVI_OPTION_UINT(KviOption_uintSpacesToExpandTabulationInput),' ')); //expand tabs to spaces - m_pWindow->ownMessage(line); - ++m_clipBuffIterator; - } - } else delete this;//Clipboard finished + delete this; + } else { + QString line = m_pClipBuff->takeFirst(); + line.replace('\t',QString(KVI_OPTION_UINT(KviOption_uintSpacesToExpandTabulationInput),' ')); //expand tabs to spaces + m_pWindow->ownMessage(line); + } } #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES diff --git a/src/modules/spaste/controller.h b/src/modules/spaste/controller.h index d428e22a9..4fd3d2795 100644 --- a/src/modules/spaste/controller.h +++ b/src/modules/spaste/controller.h @@ -55,7 +55,6 @@ private: int m_pId; KviWindow *m_pWindow; QTimer *m_pTimer; - QStringList::Iterator m_clipBuffIterator; }; #endif //SPASTE_CONTROLLER_H diff --git a/src/modules/spaste/libkvispaste.h b/src/modules/spaste/libkvispaste.h index caf74f001..37d1ff79c 100644 --- a/src/modules/spaste/libkvispaste.h +++ b/src/modules/spaste/libkvispaste.h @@ -3,10 +3,10 @@ //============================================================================= // // File : libkvispaste.h -// Creation date : Thu Dec 27 2002 17:13:12 GMT by Juanjo lvarez +// Creation date : Thu Dec 27 2002 17:13:12 GMT by Juanjo Álvarez // // This file is part of the KVirc irc client distribution -// Copyright (C) 2002 Juanjo lvarez (juanjux@yahoo.es) +// Copyright (C) 2002 Juanjo Álvarez (juanjux@yahoo.es) // Copyright (C) 2002-2008 Szymon Stefanek (kvirc@tin.it) // // This program is FREE software. You can redistribute it and/or |
