summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-write/mainwindow.h
blob: 17713d87e52824874a30afd4ee2feff73297fe9e (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** Licensees holding valid Qtopia Developer license may use this
** file in accordance with the Qtopia Developer License Agreement
** provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE.
**
** email sales@trolltech.com for information about Qtopia License
** Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <qmainwindow.h>
#include <qwidgetstack.h>
#include <qmap.h>
#include <qpe/filemanager.h>

class QAction;
class QComboBox;
class FileSelectorView;
class FileSelector;
class QToolBar;
class ButtonMenu;

namespace Qt3 {

class QTextEdit;

}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow( QWidget *parent = 0, const char *name = 0 , WFlags fl = 0);
    ~MainWindow();

    static QString appName() { return QString::fromLatin1("opie-write"); }

protected:
    void closeEvent( QCloseEvent *e );

private slots:
    // new file functions
    void fileOpen();
    void fileRevert();
    void fileNew();

    void editUndo();
    void editRedo();
    void editCut();
    void editCopy();
    void editPaste();

    void textBold();
    void textUnderline();
    void textItalic();
    void textFamily( const QString &f );
    void textSize( const QString &p );
    void textStyle( int s );
    void textAlign( int );

    void fontChanged( const QFont &f );
    void colorChanged( const QColor &c );
    void alignmentChanged( int a );
    void editorChanged( QWidget * );

    // these are from textedit, we may need them
    void insertTable();
    void newFile( const DocLnk & );
    void openFile( const DocLnk & );
    void showEditTools();
    void hideEditTools();

private:
    void updateFontSizeCombo( const QFont &f );
    void setupActions();
    Qt3::QTextEdit *currentEditor() const;
    void doConnections( Qt3::QTextEdit *e );
    void updateCaption();
    void save();
    void clear();

    // added these from the textedit
    QWidgetStack *editorStack;
    FileSelector *fileSelector;
    QToolBar *tbMenu;
    QToolBar *tbEdit;
    QToolBar *tbFont;
    QToolBar *tbStyle;
    QAction *actionTextBold,
 	*actionTextUnderline,
 	*actionTextItalic;
    QComboBox *comboFont,
	*comboSize;
    ButtonMenu *alignMenu;
    DocLnk *doc;
    Qt3::QTextEdit* editor;
};


#endif