Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TextLnk.cpp

Go to the documentation of this file.
00001 #include "TextLnk.h"
00002 
00003 void TextLnk::execute()
00004 {
00005         QClipboard* cb = QApplication::clipboard();
00006         parseText();
00007         cb->setText(m_params[1]);
00008         QWSServer::sendKeyEvent('V'-'@',Qt::Key_V, Qt::ControlButton,
00009                 true, false);
00010         QWSServer::sendKeyEvent('V'-'@',Qt::Key_V, Qt::ControlButton,
00011                 false, false);
00012 }
00013 
00014 void TextLnk::parse(QString& str)
00015 {
00016         replace(str, "\\\\", "\\");
00017         replace(str, "\\n", "\n");
00018         replace(str, "\\r", "\r");
00019         replace(str, "\\t", "\t");
00020 }
00021 
00022 void TextLnk::replace(QString& str, const QString& s1, const QString& s2)
00023 {
00024         int index = 0;
00025         int idx;
00026         int len = s1.length();
00027         idx = str.find(s1, index);
00028         for(;;){
00029                 idx = str.find(s1, index);
00030                 if(idx < 0) break;
00031                 str.replace(idx, len, s2);
00032                 index = idx;
00033         }
00034 }

Generated on Sat Nov 5 16:16:42 2005 for OPIE by  doxygen 1.4.2