summaryrefslogtreecommitdiff
path: root/src/frontend/displaywindow/cplainwritewindow.h
blob: ec9fe5eae953e46875d69aae68d7cdf8ff20b1da (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
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2008 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef CPLAINWRITEWINDOW_H
#define CPLAINWRITEWINDOW_H

#include "frontend/displaywindow/cwritewindow.h"


class BtActionCollection;
class QAction;
class QString;

/** The write window class which offers a plain editor for source code editing.
  * @author The BibleTime team
  */
class CPlainWriteWindow : public CWriteWindow  {
        Q_OBJECT
    public:
        CPlainWriteWindow( QList<CSwordModuleInfo*> modules, CMDIArea* parent);
        virtual ~CPlainWriteWindow();

        /**
        * Store the settings of this window in the given CProfileWindow object.
        */
        virtual void storeProfileSettings( Profile::CProfileWindow* profileWindow );
        /**
        * Store the settings of this window in the given profile window.
        */
        virtual void applyProfileSettings( Profile::CProfileWindow* profileWindow );

        /**
         * Setups the popup menu of this display widget.
         */
        virtual void setupPopupMenu();
        virtual bool syncAllowed() const;

    protected: // Protected methods
        /**
        * Initialize the state of this widget.
        */
        virtual void initView();
        virtual void initConnections();
        virtual void initToolbars();
        virtual CDisplayWindow::WriteWindowType writeWindowType() {
            return CDisplayWindow::PlainTextWindow;
        };

        /**
         * Initializes the intern keyboard actions.
         */
        virtual void initActions();
        /**
        * Insert the keyboard accelerators of this window into the given KAccel object.
        */
        static void insertKeyboardActions( BtActionCollection* const a );

    private:
        struct {
            QAction* saveText;
            QAction* deleteEntry;
            QAction* restoreText;
            QAction* syncWindow;
        }
        m_actions;

    protected slots: // Protected slots
        /**
        * Saves the text for the current key. Directly writes the changed text into the module.
        */
        virtual void saveCurrentText( const QString& );
        /**
        * Is called when the current text was changed.
        */
        virtual void textChanged();
        /**
        * Loads the original text from the module.
        */
        virtual void restoreText();
        /**
        * Deletes the module entry and clears the edit widget.
        */
        virtual void deleteEntry();
};

#endif