blob: 202c3e812d61f2fc1e9d7f7579688400793a217f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include "QDebug"
#include "QUrl"
class QString;
#include "textedit.h"
TextEdit::TextEdit(QWidget *parent)
{
setAcceptDrops(true);
}
void TextEdit::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("text/plain"))
qDebug() << "enter textedit drag action";
event->acceptProposedAction();
}
void TextEdit::dropEvent(QDropEvent* event)
{
this->setPlainText(event->mimeData()->text());
qDebug() << "enter textedit drop action";
qDebug() << event->mimeData()->text();
foreach (QUrl tmp, event->mimeData()->urls())
{
qDebug() << "hallo" << tmp;
}
//event->acceptProposedAction();
}
void TextEdit::quote()
{
QTextCursor cursor(this->document());
// beginEditBlock and endEditBlock() let operation look like single undo/redo operation
cursor.beginEditBlock();
cursor.setPosition(0);
cursor.insertText("> ");
while (!cursor.isNull() && !cursor.atEnd()) {
cursor.movePosition(QTextCursor::EndOfLine);
cursor.movePosition(QTextCursor::NextCharacter);
if(!cursor.atEnd())
cursor.insertText("> ");
}
cursor.endEditBlock();
}
bool TextEdit::isKey(QString key)
{
qDebug() << key.contains("-----BEGIN PGP PUBLIC KEY BLOCK-----", Qt::CaseSensitive);
return true;
}
|