summaryrefslogtreecommitdiffstats
path: root/keduca/keducabuilder/keducabuilder.h
blob: f69e50198c2a8e9f9d096b2a516906eed09dece6 (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
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
                          keducabuilder.h  -  description
                             -------------------
    begin                : Sat May 26 2001
    copyright            : (C) 2001 by Javier Campos
    email                : javi@asyris.org
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KEDUCABUILDER_H
#define KEDUCABUILDER_H

#include "../libkeduca/fileread.h"

#include <kmainwindow.h>

#include <klistbox.h>
#include <kaction.h>

#include <textview.h>
#include <tqsplitter.h>

/**Main control documents
 * The Editor. This is the new main window of KEduca.
 * You can edit a KEduca Document (i.e. Test/Examen) here.
 *@author Javier Campos
 */

class KEducaBuilder : public KMainWindow  {
    Q_OBJECT
  TQ_OBJECT

public:
    KEducaBuilder(TQWidget* parent=0, const char *name=0, WFlags f = WType_TopLevel | WDestructiveClose);
    ~KEducaBuilder();
    /** start a dialog that asks the user what he wants to do to start*/
    bool startChooser();
    /** Init Internet Gallery Servers */
    void initGallery(const KURL &urlFile = KURL());

private:

    // Private methods

    /** Init graphical interface */
    void init();
    /** Init menu bar settings */
    void initMenuBar();
    /** Write settings */
    void configWrite();
    /** Read config data */
    void configRead();
    /** Check if the current document can save */
    bool checkSave();

    /** Save the file, return false if save failed for any reason */
    bool fileSave();
    /** Save the file under a user-chosen filename, return false if save as
        failed for any reason */
    bool fileSaveAs();

    /** Ask the user if he wants to save the file if it has been changed.
     Returns true if the file may be replaced (that is when he successfully saved it or said "Discard") */
    bool currentFileMayBeReplaced();

    // Private attributes

    /** KEDUCA file */
    FileRead *_keducaFile;
    /** Recent files */
    KRecentFilesAction *_recentFiles;
    /** List of answers */
    KListBox *_listAnswer;
    /** Preview */
    TQTextView *_preview;
    /** Main splitter */
    TQSplitter *_split;
    /** I open a file */
    bool _isOpenFile;
    TQString _nativeFormat;

public slots:
    /** Open new file */
    void slotFileOpenURL( const KURL &url );
    /** Delete current document and start new */
    void slotFileOpenNew();

private slots:
    /** Open new document. */
    void slotFileOpen();
    /** Item select */
    void slotPreview( TQListBoxItem *item );
    /** Close the window */
    bool queryClose();
    /** Edit question */
    void slotEdit();
    /** Add question */
    void slotAdd();
    /** Remove question */
    void slotRemove();
    /** Down record */
    void slotDown();
    /** Up record */
    void slotUp();
    /** Save As... */
    void slotFileSaveAs();
    /** Save file */
    void slotFileSave();
    /** Print file */
    void slotFilePrint();
    /** Header info */
    int slotHeader();
    /** Init Gallery */
    void slotGallery();
    /** Double click in list, edit question */
    void slotEditbyList(TQListBoxItem *item);
};

#endif