aboutsummaryrefslogtreecommitdiffstats
path: root/textedit.h
blob: 06fd3babd6d00d1e0bb89d0bc5c388675336434d (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
#ifndef __TEXTEDIT_H__
#define __TEXTEDIT_H__

#include <QPlainTextEdit>

#include <QtGui>
#include <QFileDialog>
#include <QMessageBox>
#include <QFileInfo>
#include <QApplication>
#include <QFile>

class QWidget;
class QString;

class TextEdit : public QPlainTextEdit
{
    Q_OBJECT
public:
    TextEdit(QWidget *parent=0);
    void setCurrentFile(const QString &fileName);
    void loadFile(const QString &fileName);
    bool maybeSave();

public slots:
    void quote();
    bool save();
    bool saveAs();
    void open();
    void print();

private:
    bool isKey(QString key);
    bool saveFile(const QString &fileName);
    QString strippedName(const QString &fullFileName);
    QString curFile;

protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent* event);

};
#endif // TEXTEDIT