moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / keduca / keducabuilder / keducabuilder.h
blob74c5eb589a0bf5f19c57ce28c9aa88a1348d5af2
1 /***************************************************************************
2 keducabuilder.h - description
3 -------------------
4 begin : Sat May 26 2001
5 copyright : (C) 2001 by Javier Campos
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KEDUCABUILDER_H
19 #define KEDUCABUILDER_H
21 #include "../libkeduca/fileread.h"
23 #include <kmainwindow.h>
25 #include <klistbox.h>
26 #include <kaction.h>
28 #include <qtextview.h>
29 #include <qsplitter.h>
31 /**Main control documents
32 * The Editor. This is the new main window of KEduca.
33 * You can edit a KEduca Document (i.e. Test/Examen) here.
34 *@author Javier Campos
37 class KEducaBuilder : public KMainWindow {
38 Q_OBJECT
40 public:
41 KEducaBuilder(QWidget* parent=0, const char *name=0, WFlags f = WType_TopLevel | WDestructiveClose);
42 ~KEducaBuilder();
43 /** start a dialog that asks the user what he wants to do to start*/
44 bool startChooser();
45 /** Init Internet Gallery Servers */
46 void initGallery(const KURL &urlFile = KURL());
48 private:
50 // Private methods
52 /** Init graphical interface */
53 void init();
54 /** Init menu bar settings */
55 void initMenuBar();
56 /** Write settings */
57 void configWrite();
58 /** Read config data */
59 void configRead();
60 /** Check if the current document can save */
61 bool checkSave();
63 /** Save the file, return false if save failed for any reason */
64 bool fileSave();
65 /** Save the file under a user-chosen filename, return false if save as
66 failed for any reason */
67 bool fileSaveAs();
69 /** Ask the user if he wants to save the file if it has been changed.
70 Returns true if the file may be replaced (that is when he successfully saved it or said "Discard") */
71 bool currentFileMayBeReplaced();
73 // Private attributes
75 /** KEDUCA file */
76 FileRead *_keducaFile;
77 /** Recent files */
78 KRecentFilesAction *_recentFiles;
79 /** List of answers */
80 KListBox *_listAnswer;
81 /** Preview */
82 QTextView *_preview;
83 /** Main splitter */
84 QSplitter *_split;
85 /** I open a file */
86 bool _isOpenFile;
87 QString _nativeFormat;
89 public slots:
90 /** Open new file */
91 void slotFileOpenURL( const KURL &url );
92 /** Delete current document and start new */
93 void slotFileOpenNew();
95 private slots:
96 /** Open new document. */
97 void slotFileOpen();
98 /** Item select */
99 void slotPreview( QListBoxItem *item );
100 /** Close the window */
101 bool queryClose();
102 /** Edit question */
103 void slotEdit();
104 /** Add question */
105 void slotAdd();
106 /** Remove question */
107 void slotRemove();
108 /** Down record */
109 void slotDown();
110 /** Up record */
111 void slotUp();
112 /** Save As... */
113 void slotFileSaveAs();
114 /** Save file */
115 void slotFileSave();
116 /** Print file */
117 void slotFilePrint();
118 /** Header info */
119 int slotHeader();
120 /** Init Gallery */
121 void slotGallery();
122 /** Double click in list, edit question */
123 void slotEditbyList(QListBoxItem *item);
126 #endif