aboutsummaryrefslogtreecommitdiffstats
path: root/textedit.cpp
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-12-22 23:06:04 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2010-12-22 23:06:04 +0000
commit1cf3eb2174458a0b844287b9c265fc4e92464177 (patch)
tree9b837881d1e747b3964df89e9f4be39c949191d5 /textedit.cpp
parentthere may be more than on signature (diff)
downloadgpg4usb-1cf3eb2174458a0b844287b9c265fc4e92464177.tar.gz
gpg4usb-1cf3eb2174458a0b844287b9c265fc4e92464177.zip
added comment action (to insert > at every line) in edit menu, added drag and drop handling and exported textedit to its own class
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@407 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'textedit.cpp')
-rw-r--r--textedit.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/textedit.cpp b/textedit.cpp
new file mode 100644
index 0000000..9615d20
--- /dev/null
+++ b/textedit.cpp
@@ -0,0 +1,35 @@
+#include "QDebug"
+class QString;
+#include "textedit.h"
+TextEdit::TextEdit(QWidget *parent)
+{
+ setAcceptDrops(true);
+}
+
+void TextEdit::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasFormat("text/plain"))
+ qDebug() << "enter drag action";
+
+ //event->acceptProposedAction();
+}
+
+void TextEdit::dropEvent(QDropEvent* event)
+{
+ this->setPlainText(event->mimeData()->text());
+
+ qDebug() << "enter drop action";
+ qDebug() << event->mimeData()->text();
+ event->acceptProposedAction();
+}
+
+void TextEdit::comment()
+{
+ QString test=this->toPlainText();
+ qDebug() << "-------------";
+ qDebug() << test;
+ test.replace("\n","\n>",Qt::CaseSensitive);
+ test.insert(0,QString(">"));
+ qDebug() << "-------------";
+ qDebug() << test;
+}