~ubuntu-branches/ubuntu/precise/kgpg/precise

« back to all changes in this revision

Viewing changes to editor/kgpgtextedit.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-16 14:56:55 UTC
  • Revision ID: package-import@ubuntu.com-20111216145655-tryg3vy1v761c116
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2002 Jean-Baptiste Mardelle <bj@altern.org>
 
3
 * Copyright (C) 2009,2010,2011 Rolf Eike Beer <kde@opensource.sf-tec.de>
 
4
 */
 
5
 
 
6
/***************************************************************************
 
7
 *                                                                         *
 
8
 *   This program is free software; you can redistribute it and/or modify  *
 
9
 *   it under the terms of the GNU General Public License as published by  *
 
10
 *   the Free Software Foundation; either version 2 of the License, or     *
 
11
 *   (at your option) any later version.                                   *
 
12
 *                                                                         *
 
13
 ***************************************************************************/
 
14
 
 
15
#ifndef KGPGTEXTEDIT_H
 
16
#define KGPGTEXTEDIT_H
 
17
 
 
18
#include <QString>
 
19
 
 
20
#include <KTextEdit>
 
21
#include <KUrl>
 
22
 
 
23
class QDragEnterEvent;
 
24
class QDropEvent;
 
25
 
 
26
class KGpgItemModel;
 
27
class KeysManager;
 
28
 
 
29
class KgpgTextEdit : public KTextEdit
 
30
{
 
31
    Q_OBJECT
 
32
 
 
33
public:
 
34
    explicit KgpgTextEdit(QWidget *parent, KGpgItemModel *model, KeysManager *manager);
 
35
    ~KgpgTextEdit();
 
36
 
 
37
    void signVerifyText(const QString &message);
 
38
    void openDroppedFile(const KUrl &url, const bool probe);
 
39
 
 
40
signals:
 
41
    void newText();
 
42
    void resetEncoding(bool);
 
43
    void verifyFinished();
 
44
 
 
45
public slots:
 
46
    void slotDroppedFile(const KUrl &url);
 
47
    void slotEncode();
 
48
    void slotDecode();
 
49
    void slotSign(const QString &message);
 
50
    void slotVerify(const QString &message);
 
51
    void slotSignVerify();
 
52
    void slotHighlightText(const QString &, const int &matchingindex, const int &matchedlength);
 
53
 
 
54
protected:
 
55
    void dragEnterEvent(QDragEnterEvent *e);
 
56
    void dropEvent(QDropEvent *e);
 
57
 
 
58
private:
 
59
    bool checkForUtf8(const QString &text);
 
60
 
 
61
private slots:
 
62
    void slotEncodeUpdate(int result);
 
63
    void slotSignUpdate(const QString &content);
 
64
    void slotVerifySuccess(const QString &content, const QString &log);
 
65
    void slotVerifyKeyNeeded(const QString &id);
 
66
 
 
67
    void slotDecryptDone(int result);
 
68
 
 
69
private:
 
70
    QString m_tempfile;
 
71
 
 
72
    int m_posstart;
 
73
    int m_posend;
 
74
 
 
75
    KGpgItemModel *m_model;
 
76
    KeysManager *m_keysmanager;
 
77
};
 
78
 
 
79
#endif // KGPGVIEW_H