summaryrefslogtreecommitdiffstats
path: root/keduca
diff options
context:
space:
mode:
Diffstat (limited to 'keduca')
-rw-r--r--keduca/AUTHORS2
-rw-r--r--keduca/COPYING340
-rw-r--r--keduca/INSTALL167
-rw-r--r--keduca/Mainpage.dox5
-rw-r--r--keduca/Makefile.am17
-rw-r--r--keduca/TODO24
-rw-r--r--keduca/keduca.lsm14
-rw-r--r--keduca/keduca/Makefile.am40
-rw-r--r--keduca/keduca/configdialogbase.ui100
-rw-r--r--keduca/keduca/kcheckeduca.cpp85
-rw-r--r--keduca/keduca/kcheckeduca.h44
-rw-r--r--keduca/keduca/keduca.cpp130
-rw-r--r--keduca/keduca/keduca.h76
-rw-r--r--keduca/keduca/keduca.kcfg30
-rw-r--r--keduca/keduca/keduca_part.cpp96
-rw-r--r--keduca/keduca/keduca_part.desktop16
-rw-r--r--keduca/keduca/keduca_part.h87
-rw-r--r--keduca/keduca/keduca_partui.rc8
-rw-r--r--keduca/keduca/keducaprefs.cpp112
-rw-r--r--keduca/keduca/keducaprefs.h62
-rw-r--r--keduca/keduca/keducaui.rc9
-rw-r--r--keduca/keduca/keducaview.cpp629
-rw-r--r--keduca/keduca/keducaview.h147
-rw-r--r--keduca/keduca/kgroupeduca.cpp102
-rw-r--r--keduca/keduca/kgroupeduca.h57
-rw-r--r--keduca/keduca/kquestion.cpp123
-rw-r--r--keduca/keduca/kquestion.h79
-rw-r--r--keduca/keduca/kradioeduca.cpp83
-rw-r--r--keduca/keduca/kradioeduca.h51
-rw-r--r--keduca/keduca/main.cpp68
-rw-r--r--keduca/keduca/settings.kcfgc4
-rw-r--r--keduca/keducabuilder/Makefile.am39
-rw-r--r--keduca/keducabuilder/kcontroladdedit.cpp303
-rw-r--r--keduca/keducabuilder/kcontroladdedit.h93
-rw-r--r--keduca/keducabuilder/kcontroladdeditbase.ui877
-rw-r--r--keduca/keducabuilder/kcontrolheader.cpp376
-rw-r--r--keduca/keducabuilder/kcontrolheader.h86
-rw-r--r--keduca/keducabuilder/kcontrolheaderbase.ui472
-rw-r--r--keduca/keducabuilder/keducabuilder.cpp600
-rw-r--r--keduca/keducabuilder/keducabuilder.h126
-rw-r--r--keduca/keducabuilder/keducabuilderui.rc28
-rw-r--r--keduca/keducabuilder/keducaeditorstartdialog.cpp114
-rw-r--r--keduca/keducabuilder/keducaeditorstartdialog.h59
-rw-r--r--keduca/keducabuilder/keducaeditorstartdialogbase.ui320
-rw-r--r--keduca/keducabuilder/klangcombo.cpp51
-rw-r--r--keduca/keducabuilder/klangcombo.h47
-rw-r--r--keduca/keducabuilder/ktagcombobox.cpp229
-rw-r--r--keduca/keducabuilder/ktagcombobox.h94
-rw-r--r--keduca/keducabuilder/main.cpp67
-rw-r--r--keduca/libkeduca/Makefile.am10
-rw-r--r--keduca/libkeduca/fileread.cpp999
-rw-r--r--keduca/libkeduca/fileread.h274
-rw-r--r--keduca/libkeduca/kgallerydialog.cpp231
-rw-r--r--keduca/libkeduca/kgallerydialog.h70
-rw-r--r--keduca/libkeduca/kgallerydialogbase.ui370
-rw-r--r--keduca/resources/Makefile.am27
-rw-r--r--keduca/resources/hi128-app-keduca.pngbin0 -> 18743 bytes
-rw-r--r--keduca/resources/hi16-app-keduca.pngbin0 -> 920 bytes
-rw-r--r--keduca/resources/hi22-app-keduca.pngbin0 -> 1569 bytes
-rw-r--r--keduca/resources/hi32-app-keduca.pngbin0 -> 3061 bytes
-rw-r--r--keduca/resources/hi48-app-keduca.pngbin0 -> 5451 bytes
-rw-r--r--keduca/resources/hi64-app-keduca.pngbin0 -> 7934 bytes
-rw-r--r--keduca/resources/icons/Makefile.am5
-rw-r--r--keduca/resources/icons/cr16-action-addquestion.pngbin0 -> 666 bytes
-rw-r--r--keduca/resources/icons/cr16-action-control.pngbin0 -> 390 bytes
-rw-r--r--keduca/resources/icons/cr16-action-delquestion.pngbin0 -> 653 bytes
-rw-r--r--keduca/resources/icons/cr16-action-editquestion.pngbin0 -> 765 bytes
-rw-r--r--keduca/resources/icons/cr22-action-addquestion.pngbin0 -> 509 bytes
-rw-r--r--keduca/resources/icons/cr22-action-control.pngbin0 -> 410 bytes
-rw-r--r--keduca/resources/icons/cr22-action-delquestion.pngbin0 -> 275 bytes
-rw-r--r--keduca/resources/icons/cr22-action-editquestion.pngbin0 -> 769 bytes
-rw-r--r--keduca/resources/keduca.desktop135
-rw-r--r--keduca/resources/keducabuilder.desktop125
-rw-r--r--keduca/resources/pics/Makefile.am4
-rw-r--r--keduca/resources/pics/alert.pngbin0 -> 5635 bytes
-rw-r--r--keduca/resources/pics/bk_frame.pngbin0 -> 230 bytes
-rw-r--r--keduca/resources/pics/clock.pngbin0 -> 5228 bytes
-rw-r--r--keduca/resources/pics/default.pngbin0 -> 9716 bytes
-rw-r--r--keduca/resources/pics/info.pngbin0 -> 8741 bytes
-rw-r--r--keduca/resources/pics/keduca_correct_64.pngbin0 -> 6020 bytes
-rw-r--r--keduca/resources/pics/keduca_incorrect_64.pngbin0 -> 6162 bytes
-rw-r--r--keduca/resources/pics/keduca_init.pngbin0 -> 57902 bytes
-rw-r--r--keduca/resources/pics/statistics.pngbin0 -> 4823 bytes
-rw-r--r--keduca/resources/x-edu.desktop75
-rw-r--r--keduca/resources/x-edugallery.desktop67
85 files changed, 9180 insertions, 0 deletions
diff --git a/keduca/AUTHORS b/keduca/AUTHORS
new file mode 100644
index 00000000..7586de97
--- /dev/null
+++ b/keduca/AUTHORS
@@ -0,0 +1,2 @@
+Javier Campos <javi@asyris.org>
+Klas Kalass <klas@kde.org>
diff --git a/keduca/COPYING b/keduca/COPYING
new file mode 100644
index 00000000..37ba36f1
--- /dev/null
+++ b/keduca/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/keduca/INSTALL b/keduca/INSTALL
new file mode 100644
index 00000000..02a4a074
--- /dev/null
+++ b/keduca/INSTALL
@@ -0,0 +1,167 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes a while. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 4. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/keduca/Mainpage.dox b/keduca/Mainpage.dox
new file mode 100644
index 00000000..ec90d0b6
--- /dev/null
+++ b/keduca/Mainpage.dox
@@ -0,0 +1,5 @@
+/** @mainpage
+*
+* Add a k, remove a tion. I'm sure a chemistry person could
+* make a cation joke here.
+*/
diff --git a/keduca/Makefile.am b/keduca/Makefile.am
new file mode 100644
index 00000000..548a2bfa
--- /dev/null
+++ b/keduca/Makefile.am
@@ -0,0 +1,17 @@
+
+SUBDIRS = libkeduca keduca keducabuilder resources
+
+EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL README TODO keduca.lsm
+
+messages:
+ $(EXTRACTRC) `find . -name *.rc` > rc.cpp
+ $(EXTRACTRC) `find . -name *.ui` >> rc.cpp
+
+ LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
+ if test -n "$$LIST"; then \
+ $(XGETTEXT) $$LIST -o $(podir)/keduca.pot; \
+ fi
+ rm -f rc.cpp
+
+DOXYGEN_REFERENCES = kdeui
+include ../admin/Doxyfile.am
diff --git a/keduca/TODO b/keduca/TODO
new file mode 100644
index 00000000..887e103a
--- /dev/null
+++ b/keduca/TODO
@@ -0,0 +1,24 @@
+KEduca TODOs:
+
+ New Features:
+ -> "Explain" feature
+
+ Things that NEED to be done before KDE 3.4:
+ -> Use KNewStuff
+ -> Go through all reports in b.k.o and fix what can be fixed
+
+ Things that would be nice to have done for KDE 3.4:
+ -> Improved documentation
+
+ Things for KDE 4.0 or later:
+ -> Consider using IMS QTI as default format
+
+---
+
+Old TODOs (are these still relevant?):
+ - make sure that saving over the network works for images as well
+ - fix "crash on exit when downloaded from net" - Bug BUT HOW???
+ - fix "black background" - Bug
+ - sync the TestMaster view with the Editor
+ - watch the open file for modifications
+ - deactivate up and down actions when they cannot be executed
diff --git a/keduca/keduca.lsm b/keduca/keduca.lsm
new file mode 100644
index 00000000..3716f9af
--- /dev/null
+++ b/keduca/keduca.lsm
@@ -0,0 +1,14 @@
+Begin3
+Title: Keduca
+Version: 0.6
+Entered-date:
+Description:
+Keywords:
+Author: Javier Campos <javi@asyris.org>
+Maintained-by: Javier Campos <javi@asyris.org>
+Primary-site:
+Home-page: http://keduca.sourceforge.net
+Original-site:
+Platforms: Linux and other Unices
+Copying-policy: GNU Public License
+End
diff --git a/keduca/keduca/Makefile.am b/keduca/keduca/Makefile.am
new file mode 100644
index 00000000..fb713daf
--- /dev/null
+++ b/keduca/keduca/Makefile.am
@@ -0,0 +1,40 @@
+# set the include path for X, qt and KDE
+INCLUDES= -I../libkeduca $(all_includes)
+
+# The binary program keduca
+bin_PROGRAMS = keduca
+keduca_LDFLAGS = $(all_libraries)
+keduca_LDADD = $(LIB_KFILE) $(LIB_KPARTS) ../libkeduca/libkeduca.la
+keduca_SOURCES = main.cpp keduca.cpp
+
+# Convenience library
+#noinst_LTLIBRARIES = libkeduca_common.la
+
+#libkeduca_common_la_SOURCES = kradioeduca.cpp kquestion.cpp kgroupeduca.cpp keducaview.cpp \
+# keducaprefs.cpp kcheckeduca.cpp
+#libkeduca_common_la_LDFLAGS = $(all_libraries) -no-undefined
+#libkeduca_common_la_LIBADD = ../libkeduca/libkeduca.la
+
+# The KParts Component
+kde_module_LTLIBRARIES = libkeducapart.la
+libkeducapart_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries)
+libkeducapart_la_LIBADD = ../libkeduca/libkeduca.la $(LIB_KPARTS)
+libkeducapart_la_SOURCES = keduca_part.cpp kradioeduca.cpp kquestion.cpp \
+ kgroupeduca.cpp keducaview.cpp keducaprefs.cpp \
+ kcheckeduca.cpp settings.kcfgc configdialogbase.ui
+
+EXTRA_DIST = main.cpp keduca.cpp keduca.h kcheckeduca.cpp kcheckeduca.h keducaprefs.cpp \
+keducaprefs.h keducaui.rc keducaview.cpp keducaview.h kgroupeduca.cpp kgroupeduca.h kquestion.cpp \
+kquestion.h kradioeduca.cpp kradioeduca.h
+
+METASOURCES = AUTO
+
+rcdir = $(kde_datadir)/keduca
+rc_DATA = keducaui.rc keduca_partui.rc
+
+# Install the Part's desktop file
+kde_services_DATA = keduca_part.desktop
+
+kde_kcfg_DATA = keduca.kcfg
+
+include ../../admin/Doxyfile.am
diff --git a/keduca/keduca/configdialogbase.ui b/keduca/keduca/configdialogbase.ui
new file mode 100644
index 00000000..bb526841
--- /dev/null
+++ b/keduca/keduca/configdialogbase.ui
@@ -0,0 +1,100 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConfigDialogBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ConfigDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>332</width>
+ <height>273</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KEduca Config Dialog</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>kcfg_ResultFinish</cstring>
+ </property>
+ <property name="title">
+ <string>Show Results</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>testEnd</cstring>
+ </property>
+ <property name="text">
+ <string>At the end of the test</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>afterEachQuestion</cstring>
+ </property>
+ <property name="text">
+ <string>After answering each question</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>orderingButtonGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Ordering</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_RandomQuestions</cstring>
+ </property>
+ <property name="text">
+ <string>Show questions in random order</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_RandomAnswers</cstring>
+ </property>
+ <property name="text">
+ <string>Show answers in random order</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/keduca/keduca/kcheckeduca.cpp b/keduca/keduca/kcheckeduca.cpp
new file mode 100644
index 00000000..8fe6b557
--- /dev/null
+++ b/keduca/keduca/kcheckeduca.cpp
@@ -0,0 +1,85 @@
+/***************************************************************************
+ kcheckeduca.cpp - description
+ -------------------
+ begin : Tue Sep 5 2000
+ copyright : (C) 2000 by Javier Campos Morales
+ 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. *
+ * *
+ ***************************************************************************/
+
+#include "kcheckeduca.h"
+#include "kcheckeduca.moc"
+
+#include <qstyle.h>
+#include <kaccelmanager.h>
+
+KCheckEduca::KCheckEduca(QWidget *parent, const char *name ) : QCheckBox(parent,name)
+{
+ _doc = 0;
+ KAcceleratorManager::setNoAccel( this );
+}
+
+KCheckEduca::~KCheckEduca()
+{
+ delete _doc;
+}
+
+/** */
+void KCheckEduca::drawButtonLabel( QPainter *p){
+ int x, y, w, h;
+ int extra_width, indicator_width;
+
+ extra_width = 8;
+ indicator_width = style().pixelMetric(QStyle::PM_IndicatorWidth, 0);
+
+ y = 0;
+ x = indicator_width + extra_width; //###
+ w = width() - x;
+ h = height();
+
+ QRect cr(x,y,w,h);
+
+ _doc = new QSimpleRichText( text(), font() );
+ _doc->setWidth( 10 );
+
+ _doc->setWidth(p, cr.width() );
+ int rw = _doc->widthUsed() + extra_width;
+ int rh = _doc->height();
+ int xo = 0;
+ int yo = 0;
+
+ resize( width(), rh);
+
+ yo = (cr.height()-rh)/2;
+
+ if ( !isEnabled() ) {
+ QColorGroup cg = colorGroup();
+ cg.setColor( QColorGroup::Text, cg.light() );
+ _doc->draw(p, cr.x()+xo+1, cr.y()+yo+1, cr, cg, 0);
+ }
+ _doc->draw(p, cr.x()+xo, cr.y()+yo, cr, colorGroup(), 0);
+
+ if ( hasFocus() ) {
+// QRect br = style().itemRect( p, x, y, rw, rh+yo,
+// AlignLeft|AlignVCenter|ShowPrefix,
+// isEnabled(),
+// pixmap(), text().visual() );
+ QRect br(x,y,rw,rh+yo);
+
+ br.setLeft( br.left()-3 );
+ br.setRight( br.right()+2 );
+ br.setTop( br.top()-2 );
+ br.setBottom( br.bottom()+2);
+ br = br.intersect( QRect(0,0,rw, rh+yo ) );
+
+ style().drawPrimitive( QStyle::PE_FocusRect, p, br, colorGroup());
+ }
+}
diff --git a/keduca/keduca/kcheckeduca.h b/keduca/keduca/kcheckeduca.h
new file mode 100644
index 00000000..a874b62d
--- /dev/null
+++ b/keduca/keduca/kcheckeduca.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ kcheckeduca.h - description
+ -------------------
+ begin : Tue Sep 5 2000
+ copyright : (C) 2000 by Javier Campos Morales
+ 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 KCHECKEDUCA_H
+#define KCHECKEDUCA_H
+
+#include <qcheckbox.h>
+
+#include <qsimplerichtext.h>
+
+/**KCheck with wordwrap and rich text support
+ *@author Javier Campos Morales
+ */
+
+class KCheckEduca : public QCheckBox {
+ Q_OBJECT
+
+public:
+ KCheckEduca(QWidget *parent=0, const char *name=0);
+ ~KCheckEduca();
+
+protected:
+ void drawButtonLabel( QPainter *);
+
+private:
+ /** Rich text */
+ QSimpleRichText *_doc;
+};
+
+#endif
diff --git a/keduca/keduca/keduca.cpp b/keduca/keduca/keduca.cpp
new file mode 100644
index 00000000..8abc874b
--- /dev/null
+++ b/keduca/keduca/keduca.cpp
@@ -0,0 +1,130 @@
+/***************************************************************************
+ keduca.cpp - description
+ -------------------
+ begin : mi may 23 20:36:15 CEST 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. *
+ * *
+ ***************************************************************************/
+
+#include "keduca.h"
+#include "keduca.moc"
+#include "keduca_part.h"
+#include "../libkeduca/kgallerydialog.h"
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kfiledialog.h>
+#include <kdebug.h>
+
+#include <kparts/componentfactory.h>
+
+#include <qlabel.h>
+
+Keduca::Keduca( QWidget* parent, const char *name, WFlags f )
+ : KParts::MainWindow( parent, name, f ), _part( 0 )
+{
+ setXMLFile( "keducaui.rc" );
+
+ _part = KParts::ComponentFactory::createPartInstanceFromLibrary< KParts::ReadOnlyPart >
+ ( "libkeducapart", this, name, this, "KEducaPart" );
+
+ if ( _part )
+ {
+ setCentralWidget( _part->widget() );
+
+ setupActions();
+
+ configRead();
+
+ createGUI( _part );
+ }
+ else
+ {
+ kdFatal() << "The library \"libkeducapart\" could not be found. Aborting." << endl;
+ }
+ if (!initialGeometrySet())
+ resize( QSize(550, 450).expandedTo(minimumSizeHint()));
+}
+
+Keduca::~Keduca()
+{
+}
+
+
+void Keduca::setupActions()
+{
+ KStdAction::open( this, SLOT( slotFileOpen() ), actionCollection() );
+ (void)new KAction( i18n( "Open &Gallery..." ), 0, 0, this, SLOT( slotGallery() ),
+actionCollection(), "open_gallery" );
+ _recentFiles = KStdAction::openRecent(this, SLOT ( slotFileOpenURL(const KURL &) ),
+actionCollection());
+ KStdAction::quit(kapp, SLOT( quit() ), actionCollection());
+}
+
+void Keduca::slotFileOpen()
+{
+ KURL url = KFileDialog::getOpenURL( QString::null, "application/x-edu", this, i18n("Open Educa File") );
+ if( !url.isEmpty() )
+ slotFileOpenURL( url );
+}
+
+void Keduca::slotFileOpenURL( const KURL &url )
+{
+ if( !_part->openURL(url) ) return;
+ _recentFiles->addURL( url );
+}
+
+/*void Keduca::slotFileClose()
+{
+ init();
+}*/
+
+bool Keduca::queryClose()
+{
+ configWrite();
+ return( TRUE );
+}
+
+void Keduca::configRead()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup( "keduca" );
+ applyMainWindowSettings( config, "keduca" );
+ _recentFiles->loadEntries(config);
+}
+
+void Keduca::configWrite()
+{
+ KConfig *config = KGlobal::config();
+
+ config->setGroup( "keduca" );
+ saveMainWindowSettings( config, "keduca" );
+ _recentFiles->saveEntries(config);
+ config->sync();
+}
+
+void Keduca::slotGallery()
+{
+ initGallery();
+}
+
+void Keduca::initGallery(const KURL &urlFile)
+{
+ KGalleryDialog galleries;
+
+ if( !urlFile.url().isEmpty() )
+ galleries.putURL( urlFile );
+
+ if( galleries.exec() == QDialog::Accepted )
+ slotFileOpenURL( galleries.getURL() );
+}
diff --git a/keduca/keduca/keduca.h b/keduca/keduca/keduca.h
new file mode 100644
index 00000000..c5c5c99b
--- /dev/null
+++ b/keduca/keduca/keduca.h
@@ -0,0 +1,76 @@
+/***************************************************************************
+ keduca.h - description
+ -------------------
+ begin : mi may 23 20:36:15 CEST 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 KEDUCA_H
+#define KEDUCA_H
+
+/*
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+*/
+
+#include <kapplication.h>
+#include <kparts/mainwindow.h>
+#include <kparts/part.h>
+#include <kaction.h>
+
+/** The KEduca TestMaster.
+ This will execute the Test/Examen as defined by the KEduca Document. */
+class Keduca : public KParts::MainWindow
+{
+ Q_OBJECT
+
+public:
+ /** construtor */
+ Keduca(QWidget* parent=0, const char *name=0, WFlags f = WType_TopLevel | WDestructiveClose);
+ /** destructor */
+ ~Keduca();
+ /** Open gallery window */
+ void initGallery(const KURL &urlFile=KURL());
+
+private:
+ /** Configures the actions */
+ void setupActions();
+ /** Write settings */
+ void configWrite();
+ /** Read settings */
+ void configRead();
+ /** Close the window */
+ bool queryClose();
+
+ // Private attributes
+
+ /** Recent files */
+ KRecentFilesAction *_recentFiles;
+ /** A KEDUCA file main view */
+ KParts::ReadOnlyPart *_part;
+
+public slots:
+ /** Open a file */
+ void slotFileOpenURL( const KURL &url );
+ /** Open new file */
+ void slotFileOpen();
+
+private slots:
+ /** Close actual document */
+ /*void slotFileClose();*/
+ /** Open gallery dialog */
+ void slotGallery();
+};
+
+#endif
diff --git a/keduca/keduca/keduca.kcfg b/keduca/keduca/keduca.kcfg
new file mode 100644
index 00000000..077d19a8
--- /dev/null
+++ b/keduca/keduca/keduca.kcfg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+<kcfgfile name="keducarc"/>
+ <group name="Options">
+ <entry name="RandomAnswers" type="Bool">
+ <label>Display answers in random order.</label>
+ <default>false</default>
+ </entry>
+ <entry name="RandomQuestions" type="Bool">
+ <label>Display answers in random order.</label>
+ <default>false</default>
+ </entry>
+ <entry name="ResultFinish" type="Enum">
+ <label>Show results only at the end of the test.</label>
+ <choices>
+ <choice name="testEnd"/>
+ <choice name="afterEachQuestion"/>
+ </choices>
+ <default>testEnd</default>
+ </entry>
+ </group>
+ <group name="keducaview">
+ <entry name="Splitter_size" type="IntList">
+ <label>How the screen is divided in KEducaView.</label>
+ </entry>
+ </group>
+</kcfg> \ No newline at end of file
diff --git a/keduca/keduca/keduca_part.cpp b/keduca/keduca/keduca_part.cpp
new file mode 100644
index 00000000..c5d13f68
--- /dev/null
+++ b/keduca/keduca/keduca_part.cpp
@@ -0,0 +1,96 @@
+/*
+ *
+ * KEduca - Interactive Tests and Exams for KDE
+ *
+ * Copyright (c)
+ *
+ * 2004: Henrique Pinto <henrique.pinto@kdemail.net>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "keduca_part.h"
+#include "keducaview.h"
+#include "settings.h"
+#include "configdialogbase.h"
+
+#include <kaboutdata.h>
+#include <kparts/genericfactory.h>
+#include <kstdaction.h>
+#include <kconfigdialog.h>
+
+typedef KParts::GenericFactory<KEducaPart> KEducaPartFactory;
+K_EXPORT_COMPONENT_FACTORY( libkeducapart, KEducaPartFactory )
+
+KEducaPart::KEducaPart( QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const QStringList &/*args*/ )
+ : KParts::ReadOnlyPart( parent, name )
+{
+ setInstance( KEducaPartFactory::instance() );
+
+ m_view = new KEducaView( parentWidget, widgetName );
+ m_view->show();
+ setWidget( m_view );
+
+ setupActions();
+
+ setXMLFile( "keduca_partui.rc" );
+}
+
+KEducaPart::~KEducaPart()
+{
+}
+
+KAboutData* KEducaPart::createAboutData()
+{
+ KAboutData *data = new KAboutData( "keduca", I18N_NOOP( "KEducaPart" ),
+ "0.2", I18N_NOOP( "KEduca KParts Component" ),
+ KAboutData::License_GPL,
+ "(c) 2004, Henrique Pinto <henrique.pinto@kdemail.net>"
+ );
+ return data;
+}
+
+bool KEducaPart::openFile()
+{
+ return m_view->openURL( KURL( m_file ) );
+}
+
+void KEducaPart::setupActions()
+{
+ KStdAction::preferences( this, SLOT( slotConfigure() ), actionCollection(), "configure" );
+}
+
+void KEducaPart::slotConfigure()
+{
+ if ( KConfigDialog::showDialog( "KEducaSettings" ) )
+ return;
+
+ KConfigDialog *dialog = new KConfigDialog( widget(), "KEducaSettings", Settings::self() );
+ ConfigDialogBase *confDlg = new ConfigDialogBase( 0, "ConfigDialogBase" );
+ dialog->addPage( confDlg, i18n("General"), "keduca" );
+
+ connect( dialog, SIGNAL( settingsChanged() ), SLOT( updateConfiguration() ) );
+
+ dialog->show();
+}
+
+void KEducaPart::updateConfiguration()
+{
+ Settings::writeConfig();
+}
+
+#include "keduca_part.moc"
diff --git a/keduca/keduca/keduca_part.desktop b/keduca/keduca/keduca_part.desktop
new file mode 100644
index 00000000..730d099d
--- /dev/null
+++ b/keduca/keduca/keduca_part.desktop
@@ -0,0 +1,16 @@
+[Desktop Entry]
+Type=Service
+Name=KEduca
+Name[af]=Keduca
+Name[ar]=التعليم ك
+Name[bn]=কে-এডুকা
+Name[hi]=के-एज़ुका
+Name[mn]=КСургалт
+Name[ne]=केडीई इडु
+Name[pa]=ਕੇ-ਸਿੱਖਿਆ
+Name[sv]=Keduca
+Name[ta]=கேயுடியுகா
+Name[ven]=Pfunzo ya K
+MimeType=application/x-edu
+ServiceTypes=KParts/ReadOnlyPart
+X-KDE-Library=libkeducapart
diff --git a/keduca/keduca/keduca_part.h b/keduca/keduca/keduca_part.h
new file mode 100644
index 00000000..98a720fc
--- /dev/null
+++ b/keduca/keduca/keduca_part.h
@@ -0,0 +1,87 @@
+/*
+ *
+ * KEduca - Interactive Tests and Exams for KDE
+ *
+ * Copyright (c)
+ *
+ * 2004: Henrique Pinto <henrique.pinto@kdemail.net>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KEDUCA_PART_H
+#define KEDUCA_PART_H
+
+#include <kparts/part.h>
+
+class KEducaView;
+class KAboutData;
+
+/**
+ * KPart component for KEduca
+ * @author Henrique Pinto <henrique.pinto@kdemail.net>
+ */
+class KEducaPart : public KParts::ReadOnlyPart
+{
+ Q_OBJECT
+ public:
+ /*
+ * Constructor.
+ */
+ KEducaPart( QWidget *parentWidget, const char *widgetName, QObject *parent,
+ const char *name, const QStringList &args );
+
+ /*
+ * Destructor.
+ */
+ virtual ~KEducaPart();
+
+ /*
+ * Returns information about this part.
+ */
+ static KAboutData* createAboutData();
+
+ protected:
+ /*
+ * Opens the file indicated in the m_file member variable.
+ * Returns true on success, false if errors occured.
+ */
+ virtual bool openFile();
+
+ protected slots:
+ /*
+ * Shows the configuration dialog.
+ */
+ void slotConfigure();
+
+ /*
+ * Updates the configuration in case the user has changed it in
+ * the Config Dialog.
+ */
+ void updateConfiguration();
+
+ private:
+ /*
+ * Sets the KActions for this part.
+ */
+ void setupActions();
+
+ /*
+ * The widget for this part.
+ */
+ KEducaView *m_view;
+};
+
+#endif // KEDUCA_PART_H
diff --git a/keduca/keduca/keduca_partui.rc b/keduca/keduca/keduca_partui.rc
new file mode 100644
index 00000000..4873cc4f
--- /dev/null
+++ b/keduca/keduca/keduca_partui.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui >
+<kpartgui version="2" name="KEducaPart" >
+<MenuBar>
+ <Menu name="settings"><text>&amp;Settings</text>
+ <Action name="configure"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/keduca/keduca/keducaprefs.cpp b/keduca/keduca/keducaprefs.cpp
new file mode 100644
index 00000000..b43f59e2
--- /dev/null
+++ b/keduca/keduca/keducaprefs.cpp
@@ -0,0 +1,112 @@
+/***************************************************************************
+ keducaprefs.cpp - description
+ -------------------
+ begin : Sat Jun 2 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. *
+ * *
+ ***************************************************************************/
+
+#include "keducaprefs.h"
+#include "keducaprefs.moc"
+
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qbuttongroup.h>
+
+
+KEducaPrefs::KEducaPrefs(QWidget *parent, const char *name, bool modal ) : KDialogBase(IconList, i18n("Configure"), Ok|Cancel, Ok, parent, name, modal, true)
+{
+ setPageGeneral();
+ configRead();
+}
+
+KEducaPrefs::~KEducaPrefs(){}
+
+/** Set page general */
+void KEducaPrefs::setPageGeneral()
+{
+ QVBox *mainFrame = addVBoxPage( i18n("Miscellaneous"), i18n("Various Settings"), DesktopIcon("misc"));
+
+
+
+ QButtonGroup *buttonGroup1 = new QButtonGroup( mainFrame, "ButtonGroup1" );
+ buttonGroup1->setTitle( i18n( "General" ) );
+ buttonGroup1->setColumnLayout(0, Qt::Vertical );
+ buttonGroup1->layout()->setSpacing( 0 );
+ buttonGroup1->layout()->setMargin( 0 );
+ QVBoxLayout *buttonGroup1Layout = new QVBoxLayout( buttonGroup1->layout() );
+ buttonGroup1Layout->setAlignment( Qt::AlignTop );
+ buttonGroup1Layout->setSpacing( 6 );
+ buttonGroup1Layout->setMargin( 11 );
+
+ _resultAfterNext = new QRadioButton( buttonGroup1, "RadioButton1" );
+ _resultAfterNext->setText( i18n( "Show results of the answer after press next" ) );
+ buttonGroup1Layout->addWidget( _resultAfterNext );
+
+ _resultAfterFinish = new QRadioButton( buttonGroup1, "RadioButton2" );
+ _resultAfterFinish->setText( i18n( "Show results when finish the test" ) );
+ buttonGroup1Layout->addWidget( _resultAfterFinish );
+
+ QGroupBox *GroupBox1 = new QGroupBox( mainFrame, "GroupBox7" );
+ GroupBox1->setTitle( i18n( "Order" ) );
+ GroupBox1->setColumnLayout(0, Qt::Vertical );
+ GroupBox1->layout()->setSpacing( 0 );
+ GroupBox1->layout()->setMargin( 0 );
+ QVBoxLayout *GroupBox1Layout = new QVBoxLayout( GroupBox1->layout() );
+ GroupBox1Layout->setAlignment( Qt::AlignTop );
+ GroupBox1Layout->setSpacing( 6 );
+ GroupBox1Layout->setMargin( 11 );
+
+ _randomQuestions = new QCheckBox( GroupBox1, "CheckBox1" );
+ _randomQuestions->setText( i18n( "Show questions in random order" ) );
+ GroupBox1Layout->addWidget( _randomQuestions );
+
+ _randomAnswers = new QCheckBox( GroupBox1, "CheckBox2" );
+ _randomAnswers->setText( i18n( "Show answers in random order" ) );
+ GroupBox1Layout->addWidget( _randomAnswers );
+}
+
+/** Read settings */
+void KEducaPrefs::configRead()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Options");
+ QSize defaultSize(500,400);
+ resize( config->readSizeEntry("Geometry", &defaultSize ) );
+ config->readBoolEntry("ResultFinish", true ) ? _resultAfterFinish->setChecked(true) : _resultAfterNext->setChecked(true);
+ config->readBoolEntry("RandomQuestions", false ) ? _randomQuestions->setChecked(true) : _randomQuestions->setChecked(false);
+ config->readBoolEntry("RandomAnswers", false ) ? _randomAnswers->setChecked(true) : _randomAnswers->setChecked(false);
+}
+
+/** Write settings */
+void KEducaPrefs::configWrite()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Options");
+ config->writeEntry("Geometry", size() );
+ config->writeEntry("ResultFinish", _resultAfterFinish->isChecked() );
+ config->writeEntry("RandomQuestions", _randomQuestions->isChecked() );
+ config->writeEntry("RandomAnswers", _randomAnswers->isChecked() );
+ config->sync();
+}
+
+/** Push ok button */
+void KEducaPrefs::slotOk()
+{
+ configWrite();
+ accept();
+}
+
diff --git a/keduca/keduca/keducaprefs.h b/keduca/keduca/keducaprefs.h
new file mode 100644
index 00000000..b1493798
--- /dev/null
+++ b/keduca/keduca/keducaprefs.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ keducaprefs.h - description
+ -------------------
+ begin : Sat Jun 2 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 KEDUCAPREFS_H
+#define KEDUCAPREFS_H
+
+#include <kdialogbase.h>
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+
+/** Preferences for KEduca TestMaster (class KEduca)
+ *@author Javier Campos
+ */
+
+class KEducaPrefs : public KDialogBase {
+ Q_OBJECT
+
+public:
+ KEducaPrefs(QWidget *parent=0, const char *name=0, bool modal=true);
+ ~KEducaPrefs();
+
+private:
+
+ // Private methods
+
+ /** Set page general */
+ void setPageGeneral();
+ /** Write settings */
+ void configWrite();
+ /** Read settings */
+ void configRead();
+
+ // Private attributes
+
+ /** Show result after next */
+ QRadioButton *_resultAfterNext;
+ /** Show results after finish */
+ QRadioButton *_resultAfterFinish;
+ QCheckBox *_randomQuestions;
+ QCheckBox *_randomAnswers;
+
+private slots:
+ /** Push ok button */
+ void slotOk();
+};
+
+#endif
diff --git a/keduca/keduca/keducaui.rc b/keduca/keduca/keducaui.rc
new file mode 100644
index 00000000..6273bdcb
--- /dev/null
+++ b/keduca/keduca/keducaui.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui >
+<kpartgui version="3" name="keducaTestMaster" >
+<MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <Action name="open_gallery"/>
+ </Menu>
+ <Merge/>
+</MenuBar>
+</kpartgui>
diff --git a/keduca/keduca/keducaview.cpp b/keduca/keduca/keducaview.cpp
new file mode 100644
index 00000000..cd6c1782
--- /dev/null
+++ b/keduca/keduca/keducaview.cpp
@@ -0,0 +1,629 @@
+/***************************************************************************
+ keducaview.cpp - description
+ -------------------
+ begin : Thu May 24 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. *
+ * *
+ ***************************************************************************/
+
+#include "keducaview.h"
+#include "keducaview.moc"
+#include "settings.h"
+#include "../libkeduca/fileread.h"
+#include "kquestion.h"
+#include "kgroupeduca.h"
+
+#include <stdlib.h>
+
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <kpushbutton.h>
+#include <kdebug.h>
+#include <kio/netaccess.h>
+
+#include <qtimer.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qtextedit.h>
+
+KEducaView::KEducaView( QWidget *parent, const char *name )
+ : QWidgetStack( parent, name ), _keducaFile( 0 ), _timeoutTimer( 0 )
+{
+ init();
+}
+
+KEducaView::~KEducaView()
+{
+ delete _questionText;
+ delete _buttonGroup;
+ delete _split;
+ delete _buttonNext;
+ delete _buttonSave;
+ delete _viewResults;
+ delete _keducaFile;
+}
+
+/** Init graphical interface */
+void KEducaView::init()
+{
+ // Intro Screen
+ _introWidget = new QLabel( this, "introScreen" );
+ _introWidget->setBackgroundColor( Qt::white );
+ _introWidget->setAlignment( AlignCenter );
+ _introWidget->setPixmap( QPixmap( locate("data","keduca/pics/keduca_init.png") ) );
+ addWidget( _introWidget, 0 );
+
+ // Info Widget
+ _infoWidget = new QVBox( this, "infoWidget" );
+ _viewInfo = new QTextEdit( _infoWidget );
+ _viewInfo->setReadOnly( true );
+ _buttonStartTest = new KPushButton( i18n( "&Start Test" ), _infoWidget );
+ connect( _buttonStartTest, SIGNAL( clicked() ), SLOT( slotButtonNext() ) );
+ addWidget( _infoWidget, 1 );
+
+ // Question Widget
+ _questionWidget = new QVBox( this, "questionWidget" );
+ _split = new QSplitter( QSplitter::Vertical, _questionWidget );
+ _questionText = new KQuestion( _split, "kquestion" );
+ _buttonGroup = new KGroupEduca( _split, "ButtonGroup" );
+ _buttonGroup->setRadioButtonExclusive( true );
+ _buttonNext = new KPushButton( i18n( "&Next >>" ), _questionWidget, "ButtonNext" );
+ connect( _buttonNext, SIGNAL( clicked() ), SLOT( slotButtonNext() ) );
+ addWidget( _questionWidget, 2 );
+
+ // Results Widget
+ _resultsWidget = new QVBox( this, "resultsWidget" );
+ _viewResults = new QTextEdit( _resultsWidget );
+ _viewResults->setReadOnly( true );
+ _buttonSave = new KPushButton( i18n( "&Save Results..." ), _resultsWidget );
+ connect( _buttonSave, SIGNAL( clicked() ), SLOT( slotButtonSave() ) );
+ /* FIXME: This is a hack
+ * The results widget can be shown only in the end of the test (when you should be shown the
+ * option to save the results) or at the middle of the test, after each question (when there should
+ * be a "Next" button).
+ */
+ _buttonResultsNext = new KPushButton( i18n( "&Next >>" ), _resultsWidget );
+ connect( _buttonResultsNext, SIGNAL( clicked() ), SLOT( slotButtonNext() ) );
+ _buttonResultsNext->hide();
+ addWidget( _resultsWidget, 3 );
+
+ raiseWidget( _introWidget );
+
+ // Restore splitter size
+ _split->setSizes( Settings::splitter_size() );
+}
+
+void KEducaView::slotButtonStartTest()
+{
+ raiseWidget( _questionWidget );
+ showRecord();
+}
+
+/** Button Next action */
+void KEducaView::slotButtonNext()
+{
+ // stop the timer
+ if (_timeoutTimer)
+ {
+ _currentTime += _questionText->getCurrentTime();
+ _timeoutTimer->stop();
+ _questionText->countdown(0);
+ }
+
+ if( ( visibleWidget() == _questionWidget ) && !_isInitStatus )
+ setResults();
+
+ _buttonGroup->clearAnswers();
+
+ if( ( Settings::resultFinish()== Settings::EnumResultFinish::afterEachQuestion )
+ && _questionText->isVisible() )
+ {
+ showResults( _currentResults + "<HR>" + currentStatusPoints() );
+ }
+ else
+ {
+ if( questionNext() )
+ showRecord();
+ else
+ {
+ configWrite();
+ showResults( setFinalResult() + currentStatusPoints() + "<HR><P>" + _results + "</HTML>"
+);
+ }
+ }
+}
+
+/** Button Save action */
+void KEducaView::slotButtonSave()
+{
+ KFileDialog *dialog=new KFileDialog(QString::null, QString::null, this, "file dialog", true);
+ dialog->setCaption( i18n("Save Results As") );
+ dialog->setKeepLocation( true );
+ dialog->setOperationMode( KFileDialog::Saving );
+ QStringList mimeFilter( "text/html");
+ dialog->setMimeFilter( mimeFilter );
+ KURL newURL;
+ QString outputFormat ("text/html");
+
+ bool bOk;
+ do {
+ bOk=true;
+ if(dialog->exec()==QDialog::Accepted) {
+ newURL=dialog->selectedURL();
+ outputFormat=dialog->currentMimeFilter();
+ }
+ else
+ {
+ bOk = false;
+ break;
+ }
+ kdDebug()<<"Requested saving to file "<<newURL.prettyURL() <<endl;
+
+ if ( QFileInfo( newURL.path() ).extension().isEmpty() ) {
+ // No more extensions in filters. We need to get it from the mimetype.
+ QString extension = ".html";
+ newURL.setPath( newURL.path() + extension );
+ }
+
+ if ( KIO::NetAccess::exists( newURL, false, this ) ) { // this file exists => ask for confirmation
+ bOk = KMessageBox::warningContinueCancel( this,
+ i18n("A document with this name already exists.\n"\
+ "Do you want to overwrite it?"),
+ i18n("Warning"), i18n("Overwrite") ) == KMessageBox::Continue;
+ }
+ } while ( !bOk );
+
+ delete dialog;
+ if( bOk ) {
+ if (!_keducaFile->saveResults( newURL, _viewResults->text() ))
+ {
+ kdDebug()<< "saving of file failed" <<endl;
+ KMessageBox::sorry( this, i18n("Save failed.") );
+ }
+ }else {
+ kdDebug()<< "KControlDoc: no valid filename selected" <<endl;
+ }
+}
+
+/** Show record, returns false if there is no record to show. */
+void KEducaView::showRecord()
+{
+ QString questionTextTemp = "";
+
+ raiseWidget( _questionWidget );
+
+ _keducaFileIndex++;
+ bool MultiAnswer = _keducaFile->isMultiAnswer();
+
+ // SHOW QUESTION *******************************************************************
+ _questionText->setPixmap( _keducaFile->getPicturePixmap() );
+ questionTextTemp = "<table width=100%><tr><td><b>"
+ + i18n("Question %1").arg(_keducaFileIndex) + "</b>";
+
+ if( _keducaFile->getTotalPoints() > 0 )
+ questionTextTemp += "</td><td align=center bgColor=#336699><font color=#ffffff><b>"
+ + _keducaFile->getQuestion( FileRead::QF_POINTS )
+ + " " + i18n("Points")
+ + "</b></font>";
+
+ questionTextTemp += "</tr></td></table><hr/><table><tr><td>"
+ + _keducaFile->getQuestion( FileRead::QF_TEXT )
+ + "</td></tr></table>";
+
+ _questionText->setText( questionTextTemp );
+
+ // SHOW ANSWERS ********************************************************************
+ if( MultiAnswer )
+ _buttonGroup->setType( KGroupEduca::Check );
+ else
+ _buttonGroup->setType( KGroupEduca::Radio );
+
+
+ if( Settings::randomAnswers() )
+ {
+ _randomAnswers.clear();
+ QValueList<unsigned int> tmpRandom;
+ unsigned int index;
+ for( index = 0 ; index < _keducaFile->recordAnswerCount() ; index ++ )
+ { tmpRandom.append( index ); }
+ for( index = 0 ; index < _keducaFile->recordAnswerCount() ; index ++ )
+ {
+ unsigned int random = rand() % tmpRandom.count();
+ QValueList<unsigned int>::iterator itTmpRandom = tmpRandom.begin();
+ for( unsigned int i = 0; i < random; i++) { ++itTmpRandom; }
+ _keducaFile->recordAnswerAt( (*itTmpRandom) );
+ _randomAnswers.append( (*itTmpRandom) );
+ _buttonGroup->insertAnswer( _keducaFile->getAnswer(FileRead::AF_TEXT) );
+ tmpRandom.remove( itTmpRandom );
+ }
+ }
+ else
+ {
+ _keducaFile->recordAnswerFirst();
+ while( !_keducaFile->recordAnswerEOF() )
+ {
+ if( !_keducaFile->getAnswer(FileRead::AF_TEXT).isEmpty() )
+ _buttonGroup->insertAnswer( _keducaFile->getAnswer(FileRead::AF_TEXT) );
+ _keducaFile->recordAnswerNext();
+ };
+ }
+
+
+ // START THE TIMER *****************************************************************
+ if( _keducaFile->getQuestionInt(FileRead::QF_TIME) > 0 )
+ {
+ KMessageBox::information( this,
+ i18n( "You have %1 seconds to complete this question.\n\n"
+ "Press OK when you are ready." )
+ .arg( _keducaFile->getQuestion(FileRead::QF_TIME) ) );
+ }
+
+ int timeout = _keducaFile->getQuestionInt(FileRead::QF_TIME);
+ if (timeout > 0)
+ {
+ if (!_timeoutTimer)
+ {
+ _timeoutTimer = new QTimer(this);
+ connect(_timeoutTimer, SIGNAL(timeout()),
+ this, SLOT(questionTimedOut()));
+ }
+ _timeoutTimer->start(1000*timeout);
+ _questionText->countdown(timeout);
+ _questionText->countdownVisible(true);
+ }
+ else
+ {
+ _questionText->countdownVisible(false);
+ }
+}
+
+void KEducaView::questionTimedOut()
+{
+ _currentTime += _keducaFile->getQuestionInt(FileRead::QF_TIME);
+ slotButtonNext();
+}
+
+/** Show results */
+void KEducaView::showResults( const QString &text )
+{
+ _viewResults->setText( text );
+
+ if ( _keducaFile->recordEOF() )
+ {
+ _buttonSave->show();
+ _buttonResultsNext->hide();
+ }
+ else
+ {
+ _buttonSave->hide();
+ _buttonResultsNext->show();
+ }
+
+ raiseWidget( _resultsWidget );
+}
+
+/** Set results */
+void KEducaView::setResults()
+{
+ bool isCorrect = true;
+ QString yourAnswer = "";
+ QString correctAnswer = "";
+ QValueList<uint>::iterator itRandom = _randomAnswers.begin();
+
+ Settings::randomAnswers() ? _keducaFile->recordAnswerAt(*itRandom) : _keducaFile->recordAnswerFirst();
+
+ for( unsigned index = 0 ; index < _keducaFile->recordAnswerCount() ; index++ )
+ {
+ QString answertext = _keducaFile->getAnswer( FileRead::AF_TEXT );
+ if( !answertext.isEmpty() )
+ {
+ if(_buttonGroup->isChecked(index) != _keducaFile->getAnswerValue())
+ {
+ isCorrect=false;
+ if(_buttonGroup->isChecked(index)) yourAnswer += "<BR><FONT COLOR=#b84747><B>" + answertext + "</B></FONT>";
+ if(_keducaFile->getAnswerValue()) correctAnswer += "<BR><FONT COLOR=#006b6b><B>" + answertext + "</B></FONT>";
+ }
+ else
+ {
+ if(_buttonGroup->isChecked(index)) yourAnswer += "<BR><B>" + answertext + "</B>";
+ if(_keducaFile->getAnswerValue()) correctAnswer += "<BR><FONT COLOR=#006b6b><B>" + answertext + "</B></FONT>";
+ }
+ }
+ if( Settings::randomAnswers() )
+ {
+ ++itRandom;
+ _keducaFile->recordAnswerAt(*itRandom);
+ }
+ else
+ _keducaFile->recordAnswerNext();
+ }
+
+ if( isCorrect)
+ {
+ _correctAnswer++;
+ if( _keducaFile->getTotalPoints() > 0 )
+ _correctPoints += _keducaFile->getQuestionInt(FileRead::QF_POINTS);
+ }
+ else
+ {
+ _incorrectAnswer++;
+ if( _keducaFile->getTotalPoints() > 0 )
+ _incorrectPoints += _keducaFile->getQuestionInt(FileRead::QF_POINTS);
+ }
+
+ _results += getTableQuestion( isCorrect, correctAnswer, yourAnswer );
+}
+
+/** Set results */
+QString KEducaView::setFinalResult()
+{
+ QString finalResult = "";
+
+ if( !_keducaFile->isResult() ) return "";
+
+ finalResult = "<TABLE WIDTH=100% BORDER=0 BGCOLOR=#EEEEDD CELLSPACING=0><TR><TD BGCOLOR=#DDDDCC COLSPAN=2 ALIGN=CENTER><FONT COLOR=#222211><B>"
+ + i18n("Result")
+ + "</B></FONT></TD></TR>";
+
+ _keducaFile->recordResultFirst();
+ while( !_keducaFile->recordResultEOF() )
+ {
+ if( _correctPoints >= _keducaFile->getResultInt(FileRead::RS_MIN) &&
+ _correctPoints <= _keducaFile->getResultInt(FileRead::RS_MAX) )
+ {
+ if( _keducaFile->getResult(FileRead::RS_PICTURE).isEmpty() )
+ finalResult += "<TR><TD COLSPAN=2 ALIGN=CENTER>";
+ else
+ finalResult += "<TR><TD><IMG SRC=" + _keducaFile->getResult(FileRead::RS_PICTURE) + " : </TD><TD>";
+
+ finalResult += _keducaFile->getResult(FileRead::RS_TEXT) + "</TD><TR>";
+ }
+ _keducaFile->recordResultNext();
+ }
+
+ finalResult += "</TABLE>";
+
+ return finalResult;
+}
+
+/** Open url */
+bool KEducaView::openURL( const KURL &url)
+{
+ _keducaFile = new FileRead();
+ if ( !_keducaFile->openFile( url ) )
+ return false;
+
+ _isInitStatus = true;
+ _results = "<HTML>";
+ _correctAnswer = 0;
+ _correctPoints = 0;
+ _currentTime = 0;
+ _incorrectAnswer = 0;
+ _incorrectPoints = 0;
+ _keducaFileIndex = 0;
+
+ if( Settings::randomQuestions() )
+ {
+ unsigned int index;
+ for( index = 0 ; index < _keducaFile->getTotalQuestions() ; index ++ )
+ { _randomQuestions.append( index ); }
+ }
+
+ _keducaFile->recordFirst();
+ _keducaFile->recordAnswerFirst();
+
+ _viewInfo->setText( getInformation() );
+ raiseWidget( _infoWidget );
+
+ return true;
+}
+
+/** Write settings */
+void KEducaView::configWrite()
+{
+ Settings::setSplitter_size( _split->sizes() );
+ Settings::writeConfig();
+}
+
+/** current Status Points */
+QString KEducaView::currentStatusPoints()
+{
+ QString tempStatus;
+
+ tempStatus = insertTable()
+ + insertRow( i18n("Statistics"), true, 4)
+ + insertRow( i18n("Correct questions"),
+ QString().setNum( _correctAnswer ),
+ i18n("Incorrect questions"),
+ QString().setNum( _incorrectAnswer ), true);
+
+ if( _keducaFile->getTotalPoints() > 0 )
+ tempStatus += insertRow( i18n("Total points"), true, 4 )
+ + insertRow( i18n("Correct points"),
+ QString().setNum( _correctPoints ),
+ i18n("Incorrect points"),
+ QString().setNum( _incorrectPoints ), true );
+
+ if( _keducaFile->getTotalTime() > 0 )
+ tempStatus += insertRow( i18n("Time"), true, 4 )
+ + insertRow( i18n("Total time"),
+ QString().setNum( _keducaFile->getTotalTime() ),
+ i18n("Time in tests"),
+ QString().setNum( _currentTime ), true );
+ tempStatus += insertTableClose();
+ return tempStatus;
+}
+
+/** Set HTML table view with correct and incorrect answers */
+QString KEducaView::getTableQuestion( bool isCorrect, const QString &correct, const QString &incorrect)
+{
+ _currentResults = "<TABLE WIDTH=100% BORDER=0><TR><TD VALIGN=TOP WIDTH=70><IMG WIDTH=64 HEIGHT=64 SRC=";
+ if( isCorrect )
+ _currentResults += locate("data","keduca/pics/keduca_correct_64.png");
+ else
+ _currentResults += locate("data","keduca/pics/keduca_incorrect_64.png");
+
+ _currentResults += "></TD><TD VALIGN=TOP>";
+
+ _currentResults += "<B><FONT COLOR=#336699>" + _keducaFile->getQuestion( FileRead::QF_TEXT ) + "</FONT></B>";
+
+ if( _keducaFile->getQuestionInt(FileRead::QF_POINTS) > 0 )
+ _currentResults += "<SMALL> ( " + _keducaFile->getQuestion(FileRead::QF_POINTS) + " " + i18n("Points") + " )</SMALL>";
+
+ _currentResults += "<HR><SMALL>";
+
+ if( isCorrect )
+ _currentResults += i18n( "The answer is: ");
+ else
+ _currentResults += i18n( "The correct answer is: ");
+
+ _currentResults += correct + "<BR>";
+
+ if( !isCorrect )
+ {
+ _currentResults += i18n( "Your answer was: ");
+ _currentResults += incorrect;
+ }
+
+ _currentResults += "</SMALL></TD></TR></TABLE><P>";
+ return _currentResults;
+}
+
+/** Define the next questions (random, secuencial) */
+bool KEducaView::questionNext()
+{
+ if( !Settings::randomQuestions() && !_isInitStatus )
+ {
+ _keducaFile->recordNext();
+ return _keducaFile->recordEOF() ? false : true;
+ }
+
+ if( _isInitStatus )
+ {
+ _isInitStatus = false;
+ if( !Settings::randomQuestions() ) return true;
+ }
+
+ if( _randomQuestions.count() > 0 )
+ {
+ unsigned int randomQuestion = rand() % _randomQuestions.count();
+ QValueList<uint>::iterator itRandom = _randomQuestions.begin();
+ for( unsigned int i = 0; i < randomQuestion; ++i)
+ { ++itRandom; }
+ _keducaFile->recordAt( (*itRandom) );
+ _randomQuestions.remove( itRandom );
+ return true;
+ }
+ else
+ return false;
+}
+
+/** Get document information */
+QString KEducaView::getInformation()
+{
+
+ QString tmp = "";
+
+ if ( _keducaFile )
+ {
+ if( !(_keducaFile->getHeader("startupinfo")).isEmpty() )
+ {
+ tmp += insertTable( "<img src=" + locate("data","keduca/pics/alert.png") + ">", 2 )
+// + insertRow( i18n("Additional Information")+"<br>", true, 2 )
+ + insertRow( _keducaFile->getHeader("startupinfo") + "<br>", false )
+ + insertTableClose();
+ }
+
+ tmp += insertTable( "<img src=" + locate("data","keduca/pics/info.png") + ">", 2 );
+ tmp += insertRow( i18n("Information")+"<br>", true, 2);
+ tmp += insertRow( i18n("Title"), _keducaFile->getHeader("title"), true );
+ tmp += insertRow( i18n("Category"), _keducaFile->getHeader("category"), true );
+ tmp += insertRow( i18n("Type"), _keducaFile->getHeader("type"), true );
+ tmp += insertRow( i18n("Language"), _keducaFile->getHeader("language"), true );
+ tmp += insertTableClose();
+ }
+ else
+ {
+ tmp += "<html><body>";
+ tmp += "<img src=" + locate("data","keduca/pics/keduca_init.png") + "/>";
+ tmp += "</body></html>";
+ }
+
+ return tmp;
+}
+
+/** Init table with title and colspan */
+QString KEducaView::insertTable( const QString &title, unsigned int col){
+ QString tmp;
+
+ tmp = "<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 BGCOLOR=#EEEEDD>";
+
+ if( !title.isEmpty() ) {
+ tmp += "<TR><TD ";
+
+ if( col > 0 ) tmp += "COLSPAN=" + QString().setNum( col ) + " ";
+
+ tmp += "ALIGN=CENTER><FONT COLOR=#222211><B>"
+ + title
+ + "</B></FONT></TD></TR>";
+ }
+ return tmp;
+}
+
+/** Insert row */
+QString KEducaView::insertRow( const QString &text, bool title, unsigned colSpan ){
+ QString tmp;
+ tmp = "<TR><TD";
+ if( colSpan>0 ) tmp+= " COLSPAN=" + QString().setNum(colSpan);
+ if( title ) tmp += " ALIGN=CENTER";
+ tmp += ">";
+ if( title ) tmp += "<B>";
+ tmp += text;
+ if( title ) tmp += "</B>";
+ tmp += "</TD></TR>";
+ return tmp;
+}
+
+/** Insert row */
+QString KEducaView::insertRow( const QString &label, const QString &field, bool formBased ){
+ QString tmp;
+ tmp = "<TR><TD";
+ if( formBased ) tmp += " ALIGN=RIGHT";
+ tmp += ">" + label;
+ if( formBased ) tmp += ": ";
+ tmp += "</TD><TD>" + field + "</TD></TR>";
+ return tmp;
+}
+
+QString KEducaView::insertRow( const QString &label1, const QString &field1, const QString &label2, const QString &field2, bool formBased ){
+ QString tmp;
+ tmp = "<TR><TD";
+ if( formBased ) tmp += " ALIGN=RIGHT";
+ tmp += ">" + label1;
+ if( formBased ) tmp += ": ";
+ tmp += "</TD><TD>" + field1 + "</TD>";
+ tmp += "<TD";
+ if( formBased ) tmp += " ALIGN=RIGHT";
+ tmp += ">" + label2;
+ if( formBased ) tmp += ": ";
+ tmp += "</TD><TD>" + field2 + "</TD></TR>";
+ return tmp;
+}
+
+
+/** Close current table */
+QString KEducaView::insertTableClose(){
+ return "</TABLE>";
+}
+
diff --git a/keduca/keduca/keducaview.h b/keduca/keduca/keducaview.h
new file mode 100644
index 00000000..78bce53c
--- /dev/null
+++ b/keduca/keduca/keducaview.h
@@ -0,0 +1,147 @@
+/***************************************************************************
+ keducaview.h - description
+ -------------------
+ begin : Thu May 24 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 KEDUCAVIEW_H
+#define KEDUCAVIEW_H
+
+#include <kurl.h>
+
+#include <qlayout.h>
+#include <qsplitter.h>
+#include <qwidgetstack.h>
+
+class QTimer;
+class QTextEdit;
+class QLabel;
+
+class KPushButton;
+
+class FileRead;
+class KQuestion;
+class KGroupEduca;
+
+/**Main view of keduca file (questions and answers)
+ This is the widget for asking questions and allowing selection of answers
+ as used by KEduca TestMaster (class KEduca)
+ *@author Javier Campos
+ */
+
+class KEducaView : public QWidgetStack
+{
+ Q_OBJECT
+
+public:
+ KEducaView(QWidget *parent=0, const char *name=0);
+ ~KEducaView();
+ /** Open url */
+ bool openURL( const KURL &url);
+ FileRead const *getKeducaFile() const {return _keducaFile; }
+
+private:
+
+ // Private methods
+
+ /** Init graphical interface */
+ void init();
+ /** Show record, returns false if there is no record to show. */
+ void showRecord();
+ /** Show results */
+ void showResults( const QString &text );
+ /** Set results */
+ void setResults();
+ /** Set results */
+ QString setFinalResult();
+ /** Write settings */
+ void configWrite();
+ /** current results Points */
+ QString currentStatusPoints();
+ /** Set HTML table view with correct and incorrect answers */
+ QString getTableQuestion( bool isCorrect, const QString &correct, const QString &incorrect);
+ /** Define the next questions (random, secuencial) */
+ bool questionNext();
+
+ QString getInformation();
+ /** Init table with title and colspan */
+ QString insertTable( const QString &title = "", unsigned int col=0);
+ /** Insert row */
+ QString insertRow( const QString &text, bool title, unsigned int colSpan=0 );
+ QString insertRow( const QString &label, const QString &field, bool formBased );
+ QString insertRow( const QString &label1, const QString &field1, const QString &label2, const QString &field2, bool formBased );
+ /** Close current table */
+ QString insertTableClose();
+
+ // Private attributes
+
+ /** Widgets */
+ QLabel *_introWidget;
+ QWidget *_infoWidget, *_questionWidget, *_resultsWidget;
+ /** Push Buttons */
+ KPushButton *_buttonNext;
+ KPushButton *_buttonSave;
+ KPushButton *_buttonResultsNext; // FIXME: this is a hack
+ KPushButton *_buttonStartTest;
+ /** Group of answers. This is a frame an check or radio buttons. */
+ KGroupEduca *_buttonGroup;
+ /** KEDUCA file */
+ FileRead *_keducaFile;
+ /** A question text with pixmaps and movies support */
+ KQuestion *_questionText;
+ /** A question text with pixmaps and movies support */
+ QTextEdit *_viewResults;
+ QTextEdit *_viewInfo;
+ /** Current record */
+ int _keducaFileIndex;
+ /** Current results */
+ QString _results;
+ /** Main vbox */
+ QVBoxLayout *_vbox2;
+ /** Main splitt */
+ QSplitter *_split;
+ /** Current results */
+ QString _currentResults;
+ /** If is init window */
+ bool _isInitStatus;
+ QTimer *_timeoutTimer;
+ /** Num of correct answers */
+ int _correctAnswer;
+ /** Number of incorrect answers */
+ int _incorrectAnswer;
+ /** Number of correct answers in points*/
+ int _correctPoints;
+ /** Number of incorrect answers in points*/
+ int _incorrectPoints;
+ /** Current time */
+ int _currentTime;
+ /** Show results when finish? */
+ bool _showResultFinish;
+ /** Show random questions */
+ bool _showRandomQuestions;
+ /** Show random answers */
+ bool _showRandomAnswers;
+ /** Save real order by random questions */
+ QValueList<uint> _randomQuestions;
+ /** Save real order by random answers */
+ QValueList<uint> _randomAnswers;
+private slots:
+ /** Button Next action */
+ void slotButtonNext();
+ void slotButtonSave();
+ void slotButtonStartTest();
+ void questionTimedOut();
+};
+
+#endif
diff --git a/keduca/keduca/kgroupeduca.cpp b/keduca/keduca/kgroupeduca.cpp
new file mode 100644
index 00000000..7cdb8b38
--- /dev/null
+++ b/keduca/keduca/kgroupeduca.cpp
@@ -0,0 +1,102 @@
+/***************************************************************************
+ kgroupeduca.cpp - description
+ -------------------
+ begin : Thu Sep 7 2000
+ copyright : (C) 2000 by Javier Campos Morales
+ 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. *
+ * *
+ ***************************************************************************/
+
+#include "kgroupeduca.h"
+#include "kgroupeduca.moc"
+#include "kcheckeduca.h"
+#include "kradioeduca.h"
+
+#include <klocale.h>
+
+KGroupEduca::KGroupEduca(QWidget *parent, const char *name ) : QVButtonGroup(i18n("Answers"), parent, name)
+{
+ _sv = new QScrollView(this);
+ _sv->setVScrollBarMode(QScrollView::Auto);
+ _sv->setHScrollBarMode(QScrollView::Auto);
+ _sv->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
+ _vbox2 = new QVBox( _sv->viewport() );
+ _vbox2->setSpacing( 6 );
+ _vbox2->setMargin( 11 );
+ _sv->viewport()->setBackgroundMode( _vbox2->backgroundMode() );
+ _sv->setStaticBackground(true);
+ _sv->addChild( _vbox2 );
+ _typeMode = Radio;
+}
+
+KGroupEduca::~KGroupEduca(){
+}
+
+/** Insert a check or radio button */
+void KGroupEduca::insertAnswer( const QString& text)
+{
+ QButton *answer = 0;
+
+ switch( _typeMode )
+ {
+ case Radio:
+ answer = new KRadioEduca( _vbox2 );
+ break;
+ case Check:
+ answer = new KCheckEduca( _vbox2 );
+ break;
+ }
+ answer->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0 ) );
+ answer->setText( text );
+ answer->show();
+ insert(answer);
+}
+
+/** Set type */
+void KGroupEduca::setType(ButtonType type)
+{
+ _typeMode = type;
+}
+
+/** Clear all kradio or kcheck answers */
+void KGroupEduca::clearAnswers()
+{
+ unsigned int maxButton = count();
+ for( unsigned int i=0 ; i<maxButton ; ++i )
+ {
+ QButton *tmpButton;
+ if( (tmpButton = find(i)) )
+ remove(tmpButton);
+ delete tmpButton;
+ }
+
+}
+
+/** Return if is checked radio or check buttons */
+bool KGroupEduca::isChecked(int id)
+{
+ switch( _typeMode )
+ {
+ case Radio:
+ {
+ KRadioEduca *tmpRadioButton = (KRadioEduca*) find(id);
+ if(tmpRadioButton != 0) return tmpRadioButton->isChecked();
+ }
+ break;
+ case Check:
+ {
+ KCheckEduca *tmpCheckButton = (KCheckEduca*) find(id);
+ if(tmpCheckButton != 0) return tmpCheckButton->isChecked();
+ }
+ break;
+ }
+ return 0;
+}
diff --git a/keduca/keduca/kgroupeduca.h b/keduca/keduca/kgroupeduca.h
new file mode 100644
index 00000000..f0dbd904
--- /dev/null
+++ b/keduca/keduca/kgroupeduca.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ kgroupeduca.h - description
+ -------------------
+ begin : Thu Sep 7 2000
+ copyright : (C) 2000 by Javier Campos Morales
+ 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 KGROUPEDUCA_H
+#define KGROUPEDUCA_H
+
+#include <qvbuttongroup.h>
+#include <qscrollview.h>
+#include <qvbox.h>
+
+/**
+ *@author Javier Campos Morales
+ */
+class KGroupEduca : public QVButtonGroup {
+ Q_OBJECT
+
+public:
+ enum ButtonType { Radio, Check };
+
+ KGroupEduca(QWidget *parent=0, const char *name=0);
+ ~KGroupEduca();
+ /** Insert a check or radio button */
+ void insertAnswer( const QString& text);
+ /** Set type */
+ void setType(ButtonType Type);
+ /** Clear all kradio or kcheck answers */
+ void clearAnswers();
+ /** Return if is checked radio or check buttons */
+ bool isChecked(int id);
+
+protected:
+ QVBox* _vbox2;
+
+private:
+
+ // Private attributes
+
+ QScrollView *_sv;
+ /** Type mode */
+ ButtonType _typeMode;
+};
+
+#endif
diff --git a/keduca/keduca/kquestion.cpp b/keduca/keduca/kquestion.cpp
new file mode 100644
index 00000000..262f89b3
--- /dev/null
+++ b/keduca/keduca/kquestion.cpp
@@ -0,0 +1,123 @@
+/***************************************************************************
+ kquestion.cpp - description
+ -------------------
+ begin : Tue May 22 2001
+ copyright : (C) 2001 by Javier Campos Morales
+ 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. *
+ * *
+ ***************************************************************************/
+
+
+#include "kquestion.h"
+#include "kquestion.moc"
+
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qvbox.h>
+#include <qtimer.h>
+
+#include <kprogress.h>
+#include <klocale.h>
+
+KQuestion::KQuestion( QWidget *parent, const char *name )
+ : QHBox( parent, name ), _countdownTimer( 0 )
+{
+ initGUI();
+}
+
+KQuestion::~KQuestion()
+{
+}
+
+/** Init graphical interface */
+void KQuestion::initGUI()
+{
+ setFrameShape( QFrame::Box );
+ setFrameShadow( QFrame::Plain );
+ setPalette( QPalette( Qt::white ) );
+
+ QVBox *picBox = new QVBox( this );
+
+ _picture = new QLabel( picBox, "PixmapLabel1" );
+ _picture->setScaledContents( FALSE );
+ _picture->setPalette( QPalette( Qt::white ) );
+
+ _countdownWidget = new KProgress( picBox );
+ _countdownWidget->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,
+ QSizePolicy::Preferred ) );
+ _countdownWidget->setFormat( i18n( "%v seconds left" ) );
+
+ _view = new QTextEdit( this, "TextView1" );
+ _view->setReadOnly( true );
+ _view->setFrameShape( QTextEdit::NoFrame );
+ _view->setHScrollBarMode( QTextEdit::AlwaysOff );
+ _view->setTextFormat( QTextEdit::RichText );
+ _view->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, true ) );
+}
+
+/** Set text */
+void KQuestion::setText( const QString &text)
+{
+ _view->setText( text );
+}
+
+/** Set pixmap */
+void KQuestion::setPixmap( const QPixmap pixmap)
+{
+ _picture->setPixmap( pixmap );
+}
+
+void KQuestion::countdown(int starttime)
+{
+ _totalCount = starttime;
+ _currentCount = starttime;
+ if (starttime > 0)
+ {
+ if (!_countdownTimer)
+ {
+ _countdownTimer = new QTimer(this);
+ connect(_countdownTimer, SIGNAL(timeout()),
+ this, SLOT(countDownOne()));
+ }
+ _countdownTimer->start(1000);
+ // make one step less than time passes by in seconds
+ // so that the user will see when time is up
+ _countdownWidget->setTotalSteps(starttime);
+ _countdownWidget->setProgress(starttime);
+ }else{
+ _countdownTimer->stop();
+ _countdownWidget->reset();
+ }
+}
+
+void KQuestion::countDownOne()
+{
+ _currentCount--;
+ //_countdownWidget->setProgress(_totalCount - _currentCount);
+ _countdownWidget->advance(-1);
+
+ if (_currentCount == 0)
+ _countdownTimer->stop();
+}
+
+void KQuestion::countdownVisible(bool visible)
+{
+ if (visible)
+ _countdownWidget->show();
+ else
+ _countdownWidget->hide();
+}
+
+/** Get current time */
+int KQuestion::getCurrentTime()
+{
+ return _totalCount - _currentCount;
+}
diff --git a/keduca/keduca/kquestion.h b/keduca/keduca/kquestion.h
new file mode 100644
index 00000000..1753375e
--- /dev/null
+++ b/keduca/keduca/kquestion.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ kquestion.h - description
+ -------------------
+ begin : Tue May 22 2001
+ copyright : (C) 2001 by Javier Campos Morales
+ 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 KQUESTION_H
+#define KQUESTION_H
+
+#include <qhbox.h>
+#include <qtextedit.h>
+#include <qlabel.h>
+
+class QTimer;
+class KProgress;
+
+/**Question view
+ * The Widget that is used to display the Question.
+ *@author Javier Campos Morales
+ */
+class KQuestion : public QHBox
+{
+ Q_OBJECT
+
+public:
+ KQuestion(QWidget *parent=0, const char *name=0);
+ ~KQuestion();
+ /** Set pixmap */
+ void setPixmap( const QPixmap pixmap);
+ /** Set text */
+ void setText( const QString &text);
+
+ /** show a countdown, starting at "starttime" and counting
+ down to 0, each second one count.
+
+ 0 disables the countdown.
+ */
+ void countdown(int starttime);
+
+ void countdownVisible(bool visible);
+
+ /** Get current time */
+ int getCurrentTime();
+
+private slots:
+ void countDownOne();
+
+private:
+
+ // Private methods
+
+ /** Init graphical interface */
+ void initGUI();
+
+ // Private attributes
+
+ /** Main View */
+ QTextEdit *_view;
+ /** Main Picture */
+ QLabel *_picture;
+ QTimer *_countdownTimer;
+ KProgress *_countdownWidget;
+ int _currentCount;
+ int _totalCount;
+};
+
+#endif
diff --git a/keduca/keduca/kradioeduca.cpp b/keduca/keduca/kradioeduca.cpp
new file mode 100644
index 00000000..94f26eeb
--- /dev/null
+++ b/keduca/keduca/kradioeduca.cpp
@@ -0,0 +1,83 @@
+/***************************************************************************
+ kradioeduca.cpp - description
+ -------------------
+ begin : Wed Sep 6 2000
+ copyright : (C) 2000 by Javier Campos Morales
+ 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. *
+ * *
+ ***************************************************************************/
+
+#include "kradioeduca.h"
+#include "kradioeduca.moc"
+#include <qstyle.h>
+#include <kaccelmanager.h>
+
+KRadioEduca::KRadioEduca(QWidget *parent, const char *name) : QRadioButton(parent,name)
+{
+ _doc=0;
+ KAcceleratorManager::setNoAccel(this);
+}
+
+KRadioEduca::~KRadioEduca()
+{
+ delete _doc;
+}
+
+/** reimpl */
+void KRadioEduca::drawButtonLabel( QPainter *p)
+{
+ int x, y, w, h;
+ int extra_width, indicator_width;
+ extra_width = 8;
+ indicator_width = style().pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 0);
+
+ y = 0;
+ x = indicator_width + extra_width; //###
+ w = width() - x;
+ h = height();
+
+ QRect cr(x,y,w,h);
+
+ _doc = new QSimpleRichText( text(), font() );
+ _doc->setWidth( 10 );
+
+ _doc->setWidth(p, cr.width() );
+ int rw = _doc->widthUsed() + extra_width;
+ int rh = _doc->height();
+ int xo = 0;
+ int yo = 0;
+
+ resize( width(), rh);
+
+ yo = (cr.height()-rh)/2;
+
+ if (!isEnabled() ) {
+ QColorGroup cg = colorGroup();
+ cg.setColor( QColorGroup::Text, cg.light() );
+ _doc->draw(p, cr.x()+xo+1, cr.y()+yo+1, cr, cg, 0);
+ }
+ _doc->draw(p, cr.x()+xo, cr.y()+yo, cr, colorGroup(), 0);
+
+ if ( hasFocus() ) {
+// QRect br = style().itemRect( p, x, y, rw, rh+yo,
+// AlignLeft|AlignVCenter|ShowPrefix,
+// isEnabled(),
+// pixmap(), text().visual() );
+ QRect br(x,y,rw,rh+yo);
+
+ br.setLeft( br.left()-3 );
+ br.setRight( br.right()+2 );
+ br.setTop( br.top()-2 );
+ br.setBottom( br.bottom()+2);
+ br = br.intersect( QRect(0,0,rw, rh+yo ) );
+ style().drawPrimitive( QStyle::PE_FocusRect, p, br, colorGroup());
+ }
+}
diff --git a/keduca/keduca/kradioeduca.h b/keduca/keduca/kradioeduca.h
new file mode 100644
index 00000000..b17276d9
--- /dev/null
+++ b/keduca/keduca/kradioeduca.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ kradioeduca.h - description
+ -------------------
+ begin : Wed Sep 6 2000
+ copyright : (C) 2000 by Javier Campos Morales
+ 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 KRADIOEDUCA_H
+#define KRADIOEDUCA_H
+
+
+#include <qradiobutton.h>
+#include <qsimplerichtext.h>
+
+/**QRadioButton with wordwrap and richtext features
+ *@author Javier Campos Morales
+ */
+class KRadioEduca : public QRadioButton {
+ Q_OBJECT
+
+public:
+ KRadioEduca(QWidget *parent=0, const char *name=0);
+ ~KRadioEduca();
+
+protected:
+
+ // Protected methods
+
+ /** reimpl */
+ void drawButtonLabel( QPainter *p);
+
+private:
+
+ // Private attributes
+
+ /** Rich Text */
+ QSimpleRichText *_doc;
+
+};
+
+#endif
diff --git a/keduca/keduca/main.cpp b/keduca/keduca/main.cpp
new file mode 100644
index 00000000..9b33280b
--- /dev/null
+++ b/keduca/keduca/main.cpp
@@ -0,0 +1,68 @@
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : mi may 23 20:36:15 CEST 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. *
+ * *
+ ***************************************************************************/
+
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+
+#include <qfileinfo.h>
+#include "keduca.h"
+
+static const char description[] = I18N_NOOP("Form-based tests and exams");
+static const char version[] = "1.3";
+
+static KCmdLineOptions options[] =
+{
+ { "+file", I18N_NOOP("File to load"), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char *argv[])
+{
+ KAboutData aboutData( "keduca", I18N_NOOP("KEduca"),
+ version, description, KAboutData::License_GPL,
+ "(c) 2001, Javier Campos", 0, "http://keduca.sourceforge.net", "submit@bugs.kde.org");
+ aboutData.addAuthor("Javier Campos",I18N_NOOP( "Original Author" ), "javi@asyris.org");
+ aboutData.addAuthor("Klas Kalass",I18N_NOOP( "Maintainer 2002-2004" ), "klas@kde.org");
+ aboutData.addAuthor("Henrique Pinto",I18N_NOOP( "Current Maintainer" ), "henrique.pinto@kdemail.net");
+ aboutData.addAuthor("Anne-Marie Mahfouf",I18N_NOOP( "Various fixes and cleanups" ), "annma@kde.org");
+
+ aboutData.addCredit("Nenad Grujicic", I18N_NOOP("Icons"), "mengele@linuxo.org");
+
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
+
+ KApplication a;
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ // start as KEduca TestMaster
+ Keduca *keducaTestMaster = new Keduca();
+ a.setMainWidget(keducaTestMaster);
+ keducaTestMaster->show();
+
+ if ( args->count() > 0 )
+ {
+ if( QFileInfo( KURL(args->url(0)).url() ).extension() == "edugallery" )
+ keducaTestMaster->initGallery( args->url(0) );
+ else
+ keducaTestMaster->slotFileOpenURL( args->url(0) );
+ }
+
+ args->clear();
+
+ return a.exec();
+}
diff --git a/keduca/keduca/settings.kcfgc b/keduca/keduca/settings.kcfgc
new file mode 100644
index 00000000..2a9bec07
--- /dev/null
+++ b/keduca/keduca/settings.kcfgc
@@ -0,0 +1,4 @@
+File=keduca.kcfg
+ClassName=Settings
+Singleton=true
+Mutators=true \ No newline at end of file
diff --git a/keduca/keducabuilder/Makefile.am b/keduca/keducabuilder/Makefile.am
new file mode 100644
index 00000000..39fcb8d6
--- /dev/null
+++ b/keduca/keducabuilder/Makefile.am
@@ -0,0 +1,39 @@
+bin_PROGRAMS = keducabuilder
+keducabuilder_SOURCES = kcontroladdeditbase.ui keducaeditorstartdialogbase.ui keducaeditorstartdialog.cpp ktagcombobox.cpp klangcombo.cpp kcontrolheader.cpp keducabuilder.cpp kcontroladdedit.cpp main.cpp
+keducabuilder_LDADD = $(LIB_KFILE) ../libkeduca/libkeduca.la
+
+EXTRA_DIST = main.cpp kcontroladdedit.cpp kcontroladdedit.h keducabuilder.cpp keducabuilder.h kcontrolheader.cpp kcontrolheader.h keducabuilderui.rc klangcombo.cpp klangcombo.h ktagcombobox.cpp ktagcombobox.h keducaeditorstartdialog.cpp keducaeditorstartdialog.h
+
+# this 10 paths are KDE specific. Use them:
+# kde_htmldir Where your docs should go to. (contains lang subdirs)
+# kde_appsdir Where your application file (.kdelnk) should go to.
+# kde_icondir Where your icon should go to.
+# kde_minidir Where your mini icon should go to.
+# kde_datadir Where you install application data. (Use a subdir)
+# kde_locale Where translation files should go to.(contains lang subdirs)
+# kde_cgidir Where cgi-bin executables should go to.
+# kde_confdir Where config files should go to.
+# kde_mimedir Where mimetypes should go to.
+# kde_toolbardir Where general toolbar icons should go to.
+# kde_wallpaperdir Where general wallpapers should go to.
+
+# set the include path for X, qt and KDE
+INCLUDES= -I../libkeduca $(all_includes)
+
+METASOURCES = AUTO
+
+# the library search path.
+keducabuilder_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+# Uncomment the following two lines if you add a ui.rc file for your application to make use of
+# KDEs XML GUI builing
+rcdir = $(kde_datadir)/keduca
+rc_DATA = keducabuilderui.rc
+
+messages: rc.cpp
+ LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
+ if test -n "$$LIST"; then \
+ $(XGETTEXT) $$LIST -o $(podir)/keduca.pot; \
+ fi
+
+include ../../admin/Doxyfile.am
diff --git a/keduca/keducabuilder/kcontroladdedit.cpp b/keduca/keducabuilder/kcontroladdedit.cpp
new file mode 100644
index 00000000..76715e27
--- /dev/null
+++ b/keduca/keducabuilder/kcontroladdedit.cpp
@@ -0,0 +1,303 @@
+/***************************************************************************
+ kcontroladdedit.cpp - description
+ -------------------
+ begin : Sun May 27 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. *
+ * *
+ ***************************************************************************/
+
+#include "kcontroladdedit.h"
+#include "kcontroladdedit.moc"
+
+// KDE includes
+#include <klocale.h>
+#include <kconfig.h>
+#include <kurlrequester.h>
+#include <kcombobox.h>
+#include <knuminput.h>
+#include <klistview.h>
+//#include <.h>
+
+// Qt includes
+#include <qlabel.h>
+#include <qtextedit.h>
+
+KControlAddEdit::KControlAddEdit(QWidget *parent, const char *name, bool modal, WFlags f)
+ : KControlAddEditBase(parent, name, modal, f),
+ _currentAnswerItem(0)
+{
+ configRead();
+}
+
+KControlAddEdit::~KControlAddEdit()
+{
+}
+
+/** Init _keducaFile pointer and EditMode */
+void KControlAddEdit::init(FileRead *keducaFile, bool edit)
+{
+ setCurrentAnswerItem(0);
+ _keducaFile = keducaFile;
+ _editMode = edit;
+
+ _listAnswers->setSorting(-1);
+
+ if( _editMode )
+ {
+ setCaption(i18n("Modify Question"));
+ fillPage();
+ }else{
+ setCaption(i18n("Add Questions"));
+ slotQuestionTypeChanged( 0 );
+ }
+
+ // settings for Question page
+ setHelpEnabled ( _pageQuestion, false );
+ setNextEnabled( _pageQuestion, false );
+
+ // settings for Answer page
+ setHelpEnabled ( _pageAnswer, false );
+ setFinishEnabled( _pageAnswer, true );
+}
+
+/** Fill page of current record */
+void KControlAddEdit::fillPage()
+{
+ _questionText->setText( _keducaFile->getQuestion( FileRead::QF_TEXT ) );
+ if( !_keducaFile->getQuestion( FileRead::QF_PICTURE ).isEmpty() )
+ {
+ _questionPreview->setPixmap(_keducaFile->getQuestion(FileRead::QF_PICTURE));
+ _answerPreview->setPixmap(_keducaFile->getQuestion(FileRead::QF_PICTURE));
+ _questionPicture->setURL( _keducaFile->getQuestion( FileRead::QF_PICTURE ) );
+ }
+ _questionType->setCurrentItem( _keducaFile->getQuestionInt( FileRead::QF_TYPE )-1 );
+ slotQuestionTypeChanged( _questionType->currentItem() );
+ _questionPoint->setValue( _keducaFile->getQuestionInt( FileRead::QF_POINTS ) );
+ _questionTip->setText( _keducaFile->getQuestion( FileRead::QF_TIP ) );
+ _questionExplain->setText( _keducaFile->getQuestion( FileRead::QF_EXPLAIN ) );
+ _questionTime->setValue( _keducaFile->getQuestionInt( FileRead::QF_TIME ) );
+
+ _listAnswers->clear();
+ _keducaFile->recordAnswerFirst();
+ while( !_keducaFile->recordAnswerEOF() )
+ {
+ QListViewItem *newItem = new QListViewItem(_listAnswers);
+ newItem->setText(0,_keducaFile->getAnswer( FileRead::AF_TEXT ));
+ newItem->setText(1,_keducaFile->getAnswerValue()?i18n("True"):i18n("False"));
+ newItem->setText(2,QString::number(_keducaFile->getAnswerPoints()));
+
+ _keducaFile->recordAnswerNext();
+ };
+}
+
+void KControlAddEdit::setCurrentAnswerItem(QListViewItem *item)
+{
+ _currentAnswerItem = item;
+ if (item)
+ _buttonInsert->setText(i18n("&Apply"));
+ else
+ _buttonInsert->setText(i18n("&Add"));
+}
+
+/** Button insert */
+void KControlAddEdit::slotAddAnswer()
+{
+ if( !_answerText->text().isEmpty() )
+ {
+ // add new listview item
+ QListViewItem *newItem = _currentAnswerItem
+ ? _currentAnswerItem
+ : new QListViewItem(_listAnswers,_listAnswers->lastItem());
+ newItem->setText(0,_answerText->text());
+ newItem->setText(1,_answerValue->currentItem() == 1 ?i18n("True"):i18n("False"));
+ newItem->setText(2,QString::number(_answerPoints->value()));
+
+ // reset values
+ newItem->setSelected(false);
+ resetAnswerValues();
+ }
+}
+
+void KControlAddEdit::resetAnswerValues()
+{
+ _answerText->setText("");
+ _answerValue->setCurrentItem( 0 );
+ _answerPoints->setValue(0);
+ _answerText->setFocus();
+ setCurrentAnswerItem(0);
+ _buttonUp->setEnabled(false);
+ _buttonDown->setEnabled(false);
+ _buttonRemove->setEnabled(false);
+ _buttonInsert->setEnabled(false);
+}
+
+/** Remove answer */
+void KControlAddEdit::slotRemoveAnswer()
+{
+ delete _listAnswers->currentItem();
+ resetAnswerValues();
+}
+
+/** Button Up */
+void KControlAddEdit::slotMoveUpAnswer()
+{
+ QListViewItem *item = _listAnswers->currentItem();
+
+ if (item && item->itemAbove())
+ item->itemAbove()->moveItem(item);
+
+ _buttonUp->setEnabled(item->itemAbove()!=0);
+ _buttonDown->setEnabled(item->itemBelow()!=0);
+}
+
+/** Button Down */
+void KControlAddEdit::slotMoveDownAnswer()
+{
+ QListViewItem *item = _listAnswers->currentItem();
+
+ if (item)
+ item->moveItem(item->itemBelow());
+
+ _buttonUp->setEnabled(item->itemAbove()!=0);
+ _buttonDown->setEnabled(item->itemBelow()!=0);
+}
+
+void KControlAddEdit::slotAnswerSelected(QListViewItem *item)
+{
+ if (!item)
+ return;
+
+ setCurrentAnswerItem(item);
+
+ // set the answer fields to the value of the selected answer
+ _answerText->setText(item->text(0));
+ _answerValue->setCurrentItem(item->text(1) == i18n("True")?1:0);
+ _answerPoints->setValue(item->text(2).toInt());
+
+ // enable/disable the buttons as appropriate
+ _buttonRemove->setEnabled(true);
+ _buttonInsert->setEnabled(true);
+ _buttonDown->setEnabled(item->itemBelow()!=0);
+ _buttonUp->setEnabled(item->itemAbove()!=0);
+}
+
+/** Accept changes */
+void KControlAddEdit::accept()
+{
+ if( !_editMode )
+ _keducaFile->insertQuestion();
+
+ addQuestion();
+ configWrite();
+ done( QDialog::Accepted );
+}
+
+/** Add question with form data */
+void KControlAddEdit::addQuestion()
+{
+ _keducaFile->setQuestion( FileRead::QF_TEXT, _questionText->text() );
+ _keducaFile->setQuestion( FileRead::QF_TYPE, _questionType->currentItem()+1 );
+ _keducaFile->setQuestion( FileRead::QF_PICTURE, _questionPicture->url() );
+ _keducaFile->setQuestion( FileRead::QF_POINTS, _questionPoint->value() );
+ _keducaFile->setQuestion( FileRead::QF_TIME, _questionTime->value() );
+ _keducaFile->setQuestion( FileRead::QF_TIP, _questionTip->text() );
+ _keducaFile->setQuestion( FileRead::QF_EXPLAIN, _questionExplain->text() );
+
+ _keducaFile->clearAnswers();
+ QListViewItem *item = _listAnswers->firstChild();
+ while (item) {
+ _keducaFile->setAnswer(
+ item->text(0), // The Answer text
+ item->text(1)==i18n("True"), // the validity of the answer
+ item->text(2).toInt()); // the points
+ item = item->nextSibling();
+ }
+}
+/** Read config settings */
+void KControlAddEdit::configRead()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("AddModify Window");
+ QSize defaultSize(500,400);
+ resize( config->readSizeEntry("Geometry", &defaultSize ) );
+}
+
+/** Write config settings */
+void KControlAddEdit::configWrite()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("AddModify Window");
+ config->writeEntry("Geometry", size() );
+ config->sync();
+}
+
+/** Question data changed */
+void KControlAddEdit::slotDataChanged()
+{
+ if( _pageQuestion == currentPage() )
+ {
+ nextButton()->setEnabled( !_questionText->text().isEmpty() );
+ }
+ if( _pageAnswer == currentPage() )
+ {
+ _buttonInsert->setEnabled( !_answerText->text().isEmpty() );
+ }
+}
+
+
+/** Preview image */
+void KControlAddEdit::slotPreviewImage( const QString &text)
+{
+ if( text.isEmpty() ) { _questionPreview->setText(""); _answerPreview->setText(""); return; }
+
+ _questionPreview->setPixmap( QPixmap( text ) );
+ _answerPreview->setPixmap( QPixmap( text ) );
+}
+
+/** show current Page */
+void KControlAddEdit::showPage(QWidget *page)
+{
+ QWizard::showPage(page);
+ slotDataChanged();
+
+ if ( page == _pageQuestion ) {
+ _questionText->setFocus();
+ } else if ( page == _pageAnswer ) {
+ _answerText->setFocus();
+ }
+}
+
+/** Change question type */
+void KControlAddEdit::slotQuestionTypeChanged( int index )
+{
+ switch( index+1 )
+ {
+ case 1:
+ _questionPoint->setEnabled( false );
+ _answerPoints->setEnabled( false );
+ _questionPoint->setValue(0);
+ _answerPoints->setValue(0);
+ break;
+ case 2:
+ _questionPoint->setEnabled( true );
+ _answerPoints->setEnabled( false );
+ _answerPoints->setValue(0);
+ break;
+ case 3:
+ _questionPoint->setEnabled( false );
+ _answerPoints->setEnabled( true );
+ _questionPoint->setValue(0);
+ break;
+ default:
+ break;
+ }
+}
diff --git a/keduca/keducabuilder/kcontroladdedit.h b/keduca/keducabuilder/kcontroladdedit.h
new file mode 100644
index 00000000..d700ec43
--- /dev/null
+++ b/keduca/keducabuilder/kcontroladdedit.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ kcontroladdedit.h - description
+ -------------------
+ begin : Sun May 27 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 KCONTROLADDEDIT_H
+#define KCONTROLADDEDIT_H
+
+#include "../libkeduca/fileread.h"
+#include "kcontroladdeditbase.h"
+
+// Qt forward declarations
+class QListViewItem;
+
+/**Add or edit questions
+ * This is the Wizard that allows adding and editing of
+ * Questions (and corresponding possible answers) to the
+ * KEduca Document.
+ * This will be called from the Editor (class KEducaBuilder)
+ *@author Javier Campos
+ * @author Klas Kalass (2003)
+ */
+
+class KControlAddEdit : public KControlAddEditBase {
+ Q_OBJECT
+
+public:
+ KControlAddEdit(QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
+ ~KControlAddEdit();
+ /** Init keducaFile pointer and EditMode */
+ void init(FileRead *keducaFile, bool editMode);
+ /** show current Page */
+ void showPage(QWidget *page);
+
+private:
+
+ // Private methods
+
+ /** Init graphical interface */
+// void initGUI();
+ /** Fill page of current record */
+ void fillPage();
+ /** Add question with form data */
+ void addQuestion();
+ /** Write config settings */
+ void configWrite();
+ /** Read config settings */
+ void configRead();
+ void setCurrentAnswerItem(QListViewItem *item);
+ void resetAnswerValues();
+
+ // Private attributes
+ /** Pointer to keduca of kcontrol page */
+ FileRead *_keducaFile;
+ /** The currently selected answer item, important for editing of the answer*/
+ QListViewItem *_currentAnswerItem;
+ /** Is a edit modify? */
+ bool _editMode;
+
+private slots:
+ /** Accept changes */
+ void accept();
+ /** An Answer has been selected */
+ void slotAnswerSelected(QListViewItem *item);
+ /** Remove answer */
+ void slotRemoveAnswer();
+ /** Button insert */
+ void slotAddAnswer();
+ /** Button Down */
+ void slotMoveDownAnswer();
+ /** Button Up */
+ void slotMoveUpAnswer();
+ /** Question or Answer data changed */
+ void slotDataChanged();
+ /** Preview image */
+ void slotPreviewImage( const QString & );
+ /** Change question type */
+ void slotQuestionTypeChanged( int index );
+};
+
+#endif
diff --git a/keduca/keducabuilder/kcontroladdeditbase.ui b/keduca/keducabuilder/kcontroladdeditbase.ui
new file mode 100644
index 00000000..0292edf2
--- /dev/null
+++ b/keduca/keducabuilder/kcontroladdeditbase.ui
@@ -0,0 +1,877 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>KControlAddEditBase</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>KControlAddEditBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>_pageQuestion</cstring>
+ </property>
+ <attribute name="title">
+ <string>Question</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>125</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundPixmap">
+ <pixmap>editbase_image0</pixmap>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>_questionPreview</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;span style="color:black"&gt;
+ &lt;p&gt;&lt;b&gt;Question&lt;/b&gt;&lt;/p&gt;
+&lt;hr&gt;
+ &lt;p&gt;Only the question and type is required.&lt;/p&gt;
+&lt;/span&gt;</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame5</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Question:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionText</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Type:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Picture:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionPicture</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>_questionPicture</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Test with Question Points</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Test with Answers Points</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>_questionType</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>P&amp;oint:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionPoint</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Ti&amp;me:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionTime</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>T&amp;ip:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionTip</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>_questionTip</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Explain:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_questionExplain</cstring>
+ </property>
+ </widget>
+ <widget class="QTextEdit" row="0" column="1">
+ <property name="name">
+ <cstring>_questionText</cstring>
+ </property>
+ </widget>
+ <widget class="QTextEdit" row="6" column="1">
+ <property name="name">
+ <cstring>_questionExplain</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="1">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>_questionTime</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="1">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>_questionPoint</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>_pageAnswer</cstring>
+ </property>
+ <attribute name="title">
+ <string>Answer</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame3_2</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>125</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundPixmap">
+ <pixmap>editbase_image0</pixmap>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>_answerPreview</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;span style="color:black"&gt;
+ &lt;p&gt;&lt;b&gt;Answers&lt;/b&gt;&lt;/p&gt;
+&lt;hr&gt;
+ &lt;p&gt;Only the answer and value is required.&lt;/p&gt;
+&lt;/span&gt;</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame6</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>_answerPoints</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QTextEdit" row="0" column="1">
+ <property name="name">
+ <cstring>_answerText</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Answer:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_answerText</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Value:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_answerValue</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>False</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>True</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>_answerValue</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Points:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_answerPoints</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Answer</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Points</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>_listAnswers</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>_buttonInsert</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>_buttonRemove</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>_buttonUp</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>_buttonDown</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+</widget>
+<images>
+ <image name="editbase_image0">
+ <data format="XPM.GZ" length="2314">789ced95bd6e83301485f73c8515b6a84a14a4b0547d844a1d2b551d8cb181947fdca1aafaeec5f75e830d51105397de230f9f50823987634e07f6faf2cc0ea75dafb9ce051319efd821f92ccbafb7f7a7efddfe1c5ed8f9c2c2909df70fbb7dc5040b642443a50c968411e21551291919ac01a5bdda1072c48e50227e200ebf95065b832ab2577b4445f7d584f4cf05a15270df0050c910b7c10923c4e38870a39890230a42899858c47f9688c33600156184988e08bbca08e979734285780c0671d231e6f1114423e2045622ac6422cd4ae4384aa646ca2a53590a1a27472d07c232f301cbd3620a5f052c6772589e725877065e9eaaaeead2aaa91bb3ea86a66dba610deaacfaae6f41e3a4bd1e56aaad8667d71b1c0838c8c981430e3c8ea71c2889290701393829284cc2cf414dbbc86fee02de79dff785f7c5dcfd85f70be7577c9f6da02a2b9342e9e650420ee374a0450edd94828614b49b83ce308b550766eedb1ed050077cf713bf05e9dcfd947ab0a105373a705d496291c3f60ee0066ab705b603f5e47e3b77bfa51e38fea77e0bf4a673803ac0fd16f029056c8158e620fc1640126e0b308bd577e07ad7fb1bcedfe840b1d9fb790b66a7119e475e0b2009b7059d9f829e9f46f63c5a75e0ff5bf0b7df829fc7dd2faa1761dd</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>_questionText</sender>
+ <signal>textChanged()</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotDataChanged()</slot>
+ </connection>
+ <connection>
+ <sender>_questionPicture</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotPreviewImage(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>_questionType</sender>
+ <signal>activated(int)</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotQuestionTypeChanged(int)</slot>
+ </connection>
+ <connection>
+ <sender>_buttonInsert</sender>
+ <signal>clicked()</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotAddAnswer()</slot>
+ </connection>
+ <connection>
+ <sender>_buttonRemove</sender>
+ <signal>clicked()</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotRemoveAnswer()</slot>
+ </connection>
+ <connection>
+ <sender>_buttonUp</sender>
+ <signal>clicked()</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotMoveUpAnswer()</slot>
+ </connection>
+ <connection>
+ <sender>_buttonDown</sender>
+ <signal>clicked()</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotMoveDownAnswer()</slot>
+ </connection>
+ <connection>
+ <sender>_listAnswers</sender>
+ <signal>selectionChanged(QListViewItem*)</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotAnswerSelected(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>_answerText</sender>
+ <signal>textChanged()</signal>
+ <receiver>KControlAddEditBase</receiver>
+ <slot>slotDataChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>_answerText</tabstop>
+ <tabstop>_answerValue</tabstop>
+ <tabstop>_answerPoints</tabstop>
+ <tabstop>_listAnswers</tabstop>
+ <tabstop>_buttonInsert</tabstop>
+ <tabstop>_buttonRemove</tabstop>
+ <tabstop>_buttonUp</tabstop>
+ <tabstop>_buttonDown</tabstop>
+ <tabstop>_questionText</tabstop>
+ <tabstop>_questionPicture</tabstop>
+ <tabstop>_questionType</tabstop>
+ <tabstop>_questionPoint</tabstop>
+ <tabstop>_questionTime</tabstop>
+ <tabstop>_questionTip</tabstop>
+ <tabstop>_questionExplain</tabstop>
+</tabstops>
+<slots>
+ <slot access="private" specifier="pure virtual">slotAddAnswer()</slot>
+ <slot access="private" specifier="pure virtual">slotRemoveAnswer()</slot>
+ <slot access="private" specifier="pure virtual">slotMoveUpAnswer()</slot>
+ <slot access="private" specifier="pure virtual">slotMoveDownAnswer()</slot>
+ <slot access="private" specifier="pure virtual">slotPreviewImage(const QString &amp;)</slot>
+ <slot access="private" specifier="pure virtual">slotQuestionTypeChanged(int index)</slot>
+ <slot access="private" specifier="pure virtual">slotDataChanged()</slot>
+ <slot access="private" specifier="pure virtual">slotAnswerSelected(QListViewItem *)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/keduca/keducabuilder/kcontrolheader.cpp b/keduca/keducabuilder/kcontrolheader.cpp
new file mode 100644
index 00000000..d7a2090a
--- /dev/null
+++ b/keduca/keducabuilder/kcontrolheader.cpp
@@ -0,0 +1,376 @@
+/***************************************************************************
+ kcontrolheader.cpp - description
+ -------------------
+ begin : Tue May 29 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. *
+ * *
+ ***************************************************************************/
+
+#include "kcontrolheader.h"
+#include "kcontrolheader.moc"
+
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <ksimpleconfig.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+
+KControlHeader::KControlHeader(FileRead *keducaFile, QWidget *parent, const char *name ) : KDialogBase(Swallow, i18n("Document Information"), Ok|Cancel, Ok, parent, name, true, true)
+{
+ _keducaFile = keducaFile;
+ init();
+ configRead();
+}
+
+KControlHeader::~KControlHeader(){}
+
+/** Init graphical interface */
+void KControlHeader::init()
+{
+ QWidget *mainView = new QWidget(this);
+
+ QVBoxLayout *Form2Layout = new QVBoxLayout( mainView );
+ Form2Layout->setSpacing( 6 );
+ Form2Layout->setMargin( 0 );
+
+ QFrame *Frame16 = new QFrame( mainView, "Frame16" );
+ Frame16->setMinimumSize( QSize( 0, 50 ) );
+ Frame16->setMaximumSize( QSize( 32767, 50 ) );
+ Frame16->setFrameShape( QFrame::Box );
+ Frame16->setFrameShadow( QFrame::Plain );
+ Frame16->setPalette( QPalette( QColor(255, 255, 255) ) );
+ QHBoxLayout *Frame16Layout = new QHBoxLayout( Frame16 );
+ Frame16Layout->setSpacing( 6 );
+ Frame16Layout->setMargin( 1 );
+
+ QFrame *Frame17 = new QFrame( Frame16, "Frame17" );
+ Frame17->setMinimumSize( QSize( 125, 0 ) );
+ Frame17->setMaximumSize( QSize( 125, 32767 ) );
+ Frame17->setFrameShape( QFrame::NoFrame );
+ Frame17->setFrameShadow( QFrame::Raised );
+ Frame17->setBackgroundPixmap( QPixmap(locate("appdata","pics/bk_frame.png") ) );
+ QVBoxLayout *Frame17Layout = new QVBoxLayout( Frame17 );
+ Frame17Layout->setSpacing( 6 );
+ Frame17Layout->setMargin( 11 );
+
+ QLabel *TextLabel1 = new QLabel( Frame17, "TextLabel1" );
+ TextLabel1->setText( "<b style=\"text-decoration:underline;\">"+i18n("Information")+"</b>" );
+ TextLabel1->setBackgroundPixmap( QPixmap(locate("appdata","pics/bk_frame.png") ) );
+ Frame17Layout->addWidget( TextLabel1 );
+ Frame16Layout->addWidget( Frame17 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Frame16Layout->addItem( spacer );
+
+ QLabel *TextLabel2 = new QLabel( Frame16, "TextLabel2" );
+ TextLabel2->setText( i18n( "Description and rules of the project." ) );
+ TextLabel2->setPalette( QPalette( QColor(255, 255, 255) ) );
+ Frame16Layout->addWidget( TextLabel2 );
+ Form2Layout->addWidget( Frame16 );
+
+ QGroupBox *GroupBox7 = new QGroupBox( mainView, "GroupBox7" );
+ GroupBox7->setTitle( i18n( "Description" ) );
+ GroupBox7->setColumnLayout(0, Qt::Vertical );
+ GroupBox7->layout()->setSpacing( 0 );
+ GroupBox7->layout()->setMargin( 0 );
+ QVBoxLayout *GroupBox7Layout = new QVBoxLayout( GroupBox7->layout() );
+ GroupBox7Layout->setAlignment( Qt::AlignTop );
+ GroupBox7Layout->setSpacing( 6 );
+ GroupBox7Layout->setMargin( 11 );
+
+ QGridLayout *Layout13 = new QGridLayout;
+ Layout13->setSpacing( 6 );
+ Layout13->setMargin( 0 );
+
+ QLabel *TextLabel10 = new QLabel( GroupBox7, "TextLabel10" );
+ TextLabel10->setText( i18n( "Type:" ));
+ TextLabel10->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+
+ Layout13->addWidget( TextLabel10, 2, 0 );
+
+ QHBoxLayout *Layout12 = new QHBoxLayout;
+ Layout12->setSpacing( 6 );
+ Layout12->setMargin( 0 );
+
+ _headerType = new KComboBox( FALSE, GroupBox7, "_headerType" );
+ Layout12->addWidget( _headerType );
+
+ QLabel *TextLabel11 = new QLabel( GroupBox7, "TextLabel11" );
+ TextLabel11->setText( i18n( "Level:" ));
+ TextLabel11->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ Layout12->addWidget( TextLabel11 );
+
+ _headerLevel = new KComboBox( FALSE, GroupBox7, "_headerLevel" );
+ Layout12->addWidget( _headerLevel );
+ Layout13->addLayout( Layout12, 2, 1 );
+
+ QLabel *TextLabel12 = new QLabel( GroupBox7, "TextLabel12" );
+ TextLabel12->setText( i18n( "Language:" ));
+ TextLabel12->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ Layout13->addWidget( TextLabel12, 3, 0 );
+
+ _headerLang = new KLanguageCombo( GroupBox7, "_headerLang" );
+ loadCountryList( _headerLang );
+ Layout13->addWidget( _headerLang, 3, 1 );
+
+ QLabel *TextLabel9 = new QLabel( GroupBox7, "TextLabel9" );
+ TextLabel9->setText( i18n( "Category:" ));
+ TextLabel9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+
+ Layout13->addWidget( TextLabel9, 1, 0 );
+
+ _headerCategory = new KComboBox( true, GroupBox7, "_headerCategory" );
+ Layout13->addWidget( _headerCategory, 1, 1 );
+
+ _headerTitle = new QLineEdit( GroupBox7, "_headerTitle" );
+ Layout13->addWidget( _headerTitle, 0, 1 );
+
+ QLabel *TextLabel8 = new QLabel( GroupBox7, "TextLabel8" );
+ TextLabel8->setText( i18n( "Title:" ));
+ TextLabel8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+
+ Layout13->addWidget( TextLabel8, 0, 0 );
+ GroupBox7Layout->addLayout( Layout13 );
+ Form2Layout->addWidget( GroupBox7 );
+
+ QGroupBox *GroupBox8 = new QGroupBox( mainView, "GroupBox8" );
+ GroupBox8->setTitle( i18n( "Picture" ) );
+ GroupBox8->setColumnLayout(0, Qt::Vertical );
+ GroupBox8->layout()->setSpacing( 0 );
+ GroupBox8->layout()->setMargin( 0 );
+ QHBoxLayout *GroupBox8Layout = new QHBoxLayout( GroupBox8->layout() );
+ GroupBox8Layout->setAlignment( Qt::AlignTop );
+ GroupBox8Layout->setSpacing( 6 );
+ GroupBox8Layout->setMargin( 11 );
+
+ QLabel *TextLabel13 = new QLabel( GroupBox8, "TextLabel13" );
+ TextLabel13->setText( i18n( "Default picture:" ));
+ GroupBox8Layout->addWidget( TextLabel13 );
+
+ _headerPicture = new KURLRequester( GroupBox8, "_headerPicture" );
+ GroupBox8Layout->addWidget( _headerPicture );
+ Form2Layout->addWidget( GroupBox8 );
+
+ QGroupBox *GroupBox6 = new QGroupBox( mainView, "GroupBox6" );
+ GroupBox6->setTitle( i18n( "Author" ) );
+ GroupBox6->setColumnLayout(0, Qt::Vertical );
+ GroupBox6->layout()->setSpacing( 0 );
+ GroupBox6->layout()->setMargin( 0 );
+ QGridLayout *GroupBox6Layout = new QGridLayout( GroupBox6->layout() );
+ GroupBox6Layout->setAlignment( Qt::AlignTop );
+ GroupBox6Layout->setSpacing( 6 );
+ GroupBox6Layout->setMargin( 11 );
+
+ _headerName = new QLineEdit( GroupBox6, "_headerName" );
+
+ GroupBox6Layout->addWidget( _headerName, 0, 1 );
+
+ _headerEmail = new QLineEdit( GroupBox6, "_headerEmail" );
+
+ GroupBox6Layout->addWidget( _headerEmail, 1, 1 );
+
+ QLabel *TextLabel7 = new QLabel( GroupBox6, "TextLabel7" );
+ TextLabel7->setText( i18n( "Web page:" ));
+ TextLabel7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+
+ GroupBox6Layout->addWidget( TextLabel7, 2, 0 );
+
+ QLabel *TextLabel6 = new QLabel( GroupBox6, "TextLabel6" );
+ TextLabel6->setText( i18n( "Email:" ));
+ TextLabel6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+
+ GroupBox6Layout->addWidget( TextLabel6, 1, 0 );
+
+ QLabel *TextLabel5 = new QLabel( GroupBox6, "TextLabel5" );
+ TextLabel5->setText( i18n( "Name:" ));
+ TextLabel5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+
+ GroupBox6Layout->addWidget( TextLabel5, 0, 0 );
+
+ _headerWWW = new QLineEdit( GroupBox6, "_headerWWW" );
+
+ GroupBox6Layout->addWidget( _headerWWW, 2, 1 );
+ Form2Layout->addWidget( GroupBox6 );
+
+ // tab order
+ setTabOrder( _headerTitle, _headerCategory );
+ setTabOrder( _headerCategory, _headerType );
+ setTabOrder( _headerType, _headerLevel );
+ setTabOrder( _headerLevel, _headerLang );
+ setTabOrder( _headerLang, _headerPicture->lineEdit() );
+ setTabOrder( _headerPicture->lineEdit(), _headerPicture->comboBox() );
+ setTabOrder( _headerPicture->comboBox(), _headerName );
+ setTabOrder( _headerName, _headerEmail );
+ setTabOrder( _headerEmail, _headerWWW );
+
+ // set a sensible focus
+ _headerTitle->setFocus();
+
+ setMainWidget(mainView);
+}
+
+/** Insert header */
+void KControlHeader::insertHeader()
+{
+ QStringList tmpResult = _defaultCategories.grep( _headerCategory->currentText() );
+ if( tmpResult.count() == 0 )
+ {
+ KConfig *appconfig = KGlobal::config();
+ _defaultCategories.append( _headerCategory->currentText() );
+ appconfig->setGroup("General");
+ appconfig->writeEntry( "Categories", _defaultCategories);
+ appconfig->sync();
+ }
+ _keducaFile->setHeader( "category", _headerCategory->currentText() );
+ _keducaFile->setHeader( "title", _headerTitle->text() );
+ _keducaFile->setHeader( "image", _headerPicture->url() );
+ _keducaFile->setHeader( "type", QString().setNum( _headerType->currentItem() + 1 ) );
+ _keducaFile->setHeader( "level", QString().setNum( _headerLevel->currentItem() + 1 ) );
+ _keducaFile->setHeader( "language", _headerLang->currentTag() );
+ _keducaFile->setHeader( "name", _headerName->text() );
+ _keducaFile->setHeader( "email", _headerEmail->text() );
+ _keducaFile->setHeader( "www", _headerWWW->text() );
+}
+
+/** Load country list */
+void KControlHeader::loadCountryList(KLanguageCombo *combo)
+{
+ QString sub = QString::fromLatin1("l10n/");
+
+ // clear the list
+ combo->clear();
+
+ QStringList regionlist = KGlobal::dirs()->findAllResources("locale", sub + QString::fromLatin1("*.desktop"));
+ regionlist.sort();
+
+ for ( QStringList::ConstIterator it = regionlist.begin();
+ it != regionlist.end();
+ ++it )
+ {
+ QString tag = *it;
+ int index;
+
+ index = tag.findRev('/');
+ if (index != -1) tag = tag.mid(index + 1);
+
+ index = tag.findRev('.');
+ if (index != -1) tag.truncate(index);
+
+ KSimpleConfig entry(*it);
+ entry.setGroup(QString::fromLatin1("KCM Locale"));
+ QString name = entry.readEntry(QString::fromLatin1("Name"));
+
+ combo->insertSubmenu( name, '-' + tag, sub );
+ }
+
+ // add all languages to the list
+ QStringList countrylist = KGlobal::dirs()->findAllResources("locale", sub + QString::fromLatin1("*/entry.desktop"));
+ countrylist.sort();
+
+ for ( QStringList::ConstIterator it = countrylist.begin();
+ it != countrylist.end(); ++it )
+ {
+ KSimpleConfig entry(*it);
+ entry.setGroup(QString::fromLatin1("KCM Locale"));
+ QString name = entry.readEntry(QString::fromLatin1("Name"));
+ QString submenu = '-' + entry.readEntry(QString::fromLatin1("Region"));
+
+ QString tag = *it;
+ int index = tag.findRev('/');
+ tag.truncate(index);
+ index = tag.findRev('/');
+ tag = tag.mid(index+1);
+ combo->insertLanguage(tag, name, sub, submenu);
+ }
+}
+
+/** Ok push */
+void KControlHeader::slotOk()
+{
+ insertHeader();
+ configWrite();
+ accept();
+}
+
+/** Read settings */
+void KControlHeader::configRead()
+{
+ KConfig *config = new KConfig("emaildefaults");
+ KConfig *appconfig = KGlobal::config();
+
+ config->setGroup("UserInfo");
+
+ if( _keducaFile->getHeader( "name" ).isEmpty() )
+ _headerName->setText(config->readEntry("FullName", QString::null ));
+ else
+ _headerName->setText( _keducaFile->getHeader("name") );
+
+ if( _keducaFile->getHeader( "email" ).isEmpty() )
+ _headerEmail->setText(config->readEntry("EmailAddress", QString::null ));
+ else
+ _headerEmail->setText( _keducaFile->getHeader("email") );
+
+ _headerWWW->setText( _keducaFile->getHeader("www") );
+
+ if( !_keducaFile->getHeader("language").isEmpty() )
+ {
+ _headerLang->setCurrentItem( _keducaFile->getHeader("language") );
+ }
+ else
+ {
+ config->setGroup("Locale");
+ _headerLang->setCurrentItem( config->readEntry("Country") );
+ }
+
+ appconfig->setGroup("General");
+ _defaultCategories = appconfig->readListEntry("Categories");
+ if( _defaultCategories.count() == 0 )
+ {
+ _defaultCategories.append(i18n("Computers"));
+ }
+ _defaultCategories.sort();
+ _headerCategory->insertStringList( _defaultCategories );
+ if( !_keducaFile->getHeader( "category" ).isEmpty() ) _headerCategory->setEditText( _keducaFile->getHeader("category") );
+
+ _headerType->insertItem( i18n("Test") );
+ _headerType->insertItem( i18n("Test with Question Points") );
+ _headerType->insertItem( i18n("Test with Answers Points") );
+ _headerType->insertItem( i18n("Slidershow") );
+ _headerType->insertItem( i18n("Exam") );
+ _headerType->insertItem( i18n("Psychotechnic Test") );
+ if( QString(_keducaFile->getHeader("type")).toInt() > 0 ) _headerType->setCurrentItem( QString(_keducaFile->getHeader("type")).toInt() -1 );
+
+ _headerLevel->insertItem( i18n("Easy") );
+ _headerLevel->insertItem( i18n("Normal") );
+ _headerLevel->insertItem( i18n("Expert") );
+ _headerLevel->insertItem( i18n("Supreme") );
+ if( QString(_keducaFile->getHeader("level")).toInt() >0 ) _headerLevel->setCurrentItem( QString(_keducaFile->getHeader("level")).toInt() -1 );
+
+ _headerPicture->setURL( _keducaFile->getHeader("image") );
+ _headerTitle->setText( _keducaFile->getHeader("title") );
+
+ appconfig->setGroup("kcontrolheader");
+ QSize *defaultSize = new QSize(500,400);
+ resize( appconfig->readSizeEntry("Geometry", defaultSize ) );
+ delete config;
+}
+
+/** Write settings */
+void KControlHeader::configWrite()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("kcontrolheader");
+ config->writeEntry("Geometry", size() );
+ config->sync();
+}
diff --git a/keduca/keducabuilder/kcontrolheader.h b/keduca/keducabuilder/kcontrolheader.h
new file mode 100644
index 00000000..86752ae0
--- /dev/null
+++ b/keduca/keducabuilder/kcontrolheader.h
@@ -0,0 +1,86 @@
+/***************************************************************************
+ kcontrolheader.h - description
+ -------------------
+ begin : Tue May 29 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 KCONTROLHEADER_H
+#define KCONTROLHEADER_H
+
+#include "../libkeduca/fileread.h"
+#include "klangcombo.h"
+
+#include <kdialogbase.h>
+#include <kurlrequester.h>
+
+
+/**Information header
+ * Options Dialog for KEduca Document.
+ * Will be called for each new KEduca Document and from the Editor (class KEducaBuilder)
+ *@author Javier Campos
+ */
+
+class KControlHeader : public KDialogBase {
+ Q_OBJECT
+
+public:
+ KControlHeader(FileRead *keducaFile, QWidget *parent=0, const char *name=0);
+ ~KControlHeader();
+
+private:
+
+ // Private attributes
+
+ /** Keduca pointer */
+ FileRead *_keducaFile;
+ /** Title */
+ QLineEdit *_headerTitle;
+ /** Header type */
+ KComboBox *_headerType;
+ /** Header category */
+ KComboBox *_headerCategory;
+ /** Header level */
+ KComboBox *_headerLevel;
+ /** Header lang */
+ KLanguageCombo *_headerLang;
+ /** Header picture */
+ KURLRequester *_headerPicture;
+ /** Header name */
+ QLineEdit *_headerName;
+ /** Header email */
+ QLineEdit *_headerEmail;
+ /** Header www */
+ QLineEdit *_headerWWW;
+ /** Default categories */
+ QStringList _defaultCategories;
+
+ // Private methods
+
+ /** Init graphical interface */
+ void init();
+ /** Insert header */
+ void insertHeader();
+ /** Load country list */
+ void loadCountryList(KLanguageCombo *combo);
+ /** Write settings */
+ void configWrite();
+ /** Read settings */
+ void configRead();
+
+private slots:
+ /** Ok push */
+ void slotOk();
+};
+
+#endif
diff --git a/keduca/keducabuilder/kcontrolheaderbase.ui b/keduca/keducabuilder/kcontrolheaderbase.ui
new file mode 100644
index 00000000..04f2411b
--- /dev/null
+++ b/keduca/keducabuilder/kcontrolheaderbase.ui
@@ -0,0 +1,472 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>MyDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>512</width>
+ <height>534</height>
+ </rect>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame3</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundColor">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame4</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>125</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>125</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="paletteBackgroundPixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b style="text-decoration:underline;"&gt;Information&lt;/b&gt;</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Description and rules of the project.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Description</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>Title:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Language:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Category:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>_headerLang</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>_headerTitle</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>_headerType</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Level:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>_headerLevel</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>_headerCategory</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Picture</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Default picture:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignJustify|AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>_headerPicture</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Author</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>_headerName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>_headerWWW</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>_headerEmail</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Web page:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Email:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="2314">789ced95bd6e83301485f73c8515b6a84a14a4b0547d844a1d2b551d8cb181947fdca1aafaeec5f75e830d51105397de230f9f50823987634e07f6faf2cc0ea75dafb9ce051319efd821f92ccbafb7f7a7efddfe1c5ed8f9c2c2909df70fbb7dc5040b642443a50c968411e21551291919ac01a5bdda1072c48e50227e200ebf95065b832ab2577b4445f7d584f4cf05a15270df0050c910b7c10923c4e38870a39890230a42899858c47f9688c33600156184988e08bbca08e979734285780c0671d231e6f1114423e2045622ac6422cd4ae4384aa646ca2a53590a1a27472d07c232f301cbd3620a5f052c6772589e725877065e9eaaaeead2aaa91bb3ea86a66dba610deaacfaae6f41e3a4bd1e56aaad8667d71b1c0838c8c981430e3c8ea71c2889290701393829284cc2cf414dbbc86fee02de79dff785f7c5dcfd85f70be7577c9f6da02a2b9342e9e650420ee374a0450edd94828614b49b83ce308b550766eedb1ed050077cf713bf05e9dcfd947ab0a105373a705d496291c3f60ee0066ab705b603f5e47e3b77bfa51e38fea77e0bf4a673803ac0fd16f029056c8158e620fc1640126e0b308bd577e07ad7fb1bcedfe840b1d9fb790b66a7119e475e0b2009b7059d9f829e9f46f63c5a75e0ff5bf0b7df829fc7dd2faa1761dd</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>_headerTitle</tabstop>
+ <tabstop>_headerCategory</tabstop>
+ <tabstop>_headerType</tabstop>
+ <tabstop>_headerLevel</tabstop>
+ <tabstop>_headerLang</tabstop>
+ <tabstop>_headerPicture</tabstop>
+ <tabstop>_headerName</tabstop>
+ <tabstop>_headerEmail</tabstop>
+ <tabstop>_headerWWW</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/keduca/keducabuilder/keducabuilder.cpp b/keduca/keducabuilder/keducabuilder.cpp
new file mode 100644
index 00000000..08487cc9
--- /dev/null
+++ b/keduca/keducabuilder/keducabuilder.cpp
@@ -0,0 +1,600 @@
+/***************************************************************************
+ keducabuilder.cpp - 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. *
+ * *
+ ***************************************************************************/
+
+#include "keducabuilder.h"
+#include "keducabuilder.moc"
+
+#include "kcontroladdedit.h"
+#include "kcontrolheader.h"
+#include "keducaeditorstartdialog.h"
+#include "../libkeduca/kgallerydialog.h"
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kedittoolbar.h>
+#include <kdebug.h>
+#include <kio/netaccess.h>
+#include <kmessagebox.h>
+#include <kprinter.h>
+
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qpaintdevicemetrics.h>
+#include <qpainter.h>
+
+static const char* const keducabuilder_data[] = {
+ "15 16 4 1",
+ "a c #0000ff",
+ "# c #008183",
+ "b c #c5c2c5",
+ ". c #ffffff",
+ "...............",
+ ".#############.",
+ ".#...........#.",
+ ".#...aaaa....#.",
+ ".#..aa.baa...#.",
+ ".#......aa...#.",
+ ".#.....aab...#.",
+ ".#....aab....#.",
+ ".#....aab....#.",
+ ".#.....b.....#.",
+ ".#....aa.....#.",
+ ".#....aa.....#.",
+ ".#...........#.",
+ ".#...........#.",
+ ".#############.",
+ "..............."};
+
+KEducaBuilder::KEducaBuilder(QWidget* parent, const char *name, WFlags f )
+ : KMainWindow(parent,name,f),
+ _nativeFormat("application/x-edu")
+{
+ _keducaFile = new FileRead();
+ initMenuBar();
+ init();
+ configRead();
+ setIcon( KGlobal::iconLoader()->loadIcon("control.png",
+ KIcon::Small) );
+ _isOpenFile = false;
+}
+
+KEducaBuilder::~KEducaBuilder()
+{
+ delete _keducaFile;
+}
+
+/** Init graphical interface */
+void KEducaBuilder::init()
+{
+ QWidget *mainView = new QWidget(this, "mainview");
+
+ QVBoxLayout *form2Layout = new QVBoxLayout( mainView );
+ form2Layout->setSpacing( 2 );
+ form2Layout->setMargin( 0 );
+
+ _split = new QSplitter( mainView );
+ _split->setOrientation( QSplitter::Vertical );
+
+ _listAnswer = new KListBox( _split, "_listAnswer" );
+ _listAnswer->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, _listAnswer->sizePolicy().hasHeightForWidth() ) );
+ connect( _listAnswer, SIGNAL( highlighted(QListBoxItem *) ), this, SLOT( slotPreview(QListBoxItem *) ) );
+ connect( _listAnswer, SIGNAL( doubleClicked(QListBoxItem *) ), this, SLOT( slotEditbyList(QListBoxItem *) ) );
+
+ _preview = new QTextView( _split, "_preview" );
+ _preview->setFrameShape( QTextView::NoFrame );
+ _preview->setLineWidth( 1 );
+
+ form2Layout->addWidget( _split );
+
+ setCentralWidget( mainView );
+ if (!initialGeometrySet())
+ resize( QSize(500, 400).expandedTo(minimumSizeHint()));
+ setupGUI( ToolBar | Keys | StatusBar | Create, "keducabuilderui.rc" );
+ setAutoSaveSettings();
+}
+
+/** Init menu bar settings */
+void KEducaBuilder::initMenuBar()
+{
+ KStdAction::openNew(this, SLOT( slotFileOpenNew() ), actionCollection());
+ KStdAction::open (this, SLOT( slotFileOpen() ), actionCollection());
+ (void)new KAction(i18n("Open &Gallery..."), 0, 0, this, SLOT( slotGallery() ), actionCollection(), "open_gallery");
+ _recentFiles = KStdAction::openRecent(this, SLOT ( slotFileOpenURL(const KURL &)), actionCollection());
+ KStdAction::save (this, SLOT( slotFileSave() ), actionCollection());
+ KStdAction::saveAs (this, SLOT( slotFileSaveAs() ), actionCollection());
+ KStdAction::print (this, SLOT( slotFilePrint() ), actionCollection());
+ (void)new KAction(i18n("Document Info"), "info", 0, this, SLOT( slotHeader() ), actionCollection(), "info_doc");
+ KStdAction::quit(this, SLOT( close() ), actionCollection());
+
+ (void)new KAction(i18n("&Add..."), "addquestion", 0, this, SLOT( slotAdd() ), actionCollection(), "question_add");
+ (void)new KAction(i18n("&Edit..."), "editquestion", 0, this, SLOT( slotEdit() ), actionCollection(), "question_edit");
+ (void)new KAction(i18n("&Remove"), "delquestion", 0, this, SLOT( slotRemove() ), actionCollection(), "question_remove");
+ (void)new KAction(i18n("&Up"), "up", 0, this, SLOT( slotUp() ), actionCollection(), "question_up");
+ (void)new KAction(i18n("&Down"), "down", 0, this, SLOT( slotDown() ), actionCollection(), "question_down");
+}
+
+/** Delete current document and start new */
+void KEducaBuilder::slotFileOpenNew()
+{
+ if (!currentFileMayBeReplaced())
+ return;
+
+ if( _keducaFile ) delete _keducaFile;
+ _listAnswer->clear();
+ _preview->setText("<qt><br><center><h1>"+i18n("Welcome To KEduca!")+"</h1>"+
+ i18n("Add a new Question by using the Edit Menu or by choosing one of the icons above.")+
+ "</center></qt>");
+ _keducaFile = new FileRead();
+ _isOpenFile = false;
+ // ask for meta information
+ slotHeader();
+}
+
+/** Open new document. */
+void KEducaBuilder::slotFileOpen()
+{
+ KURL url = KFileDialog::getOpenURL( QString::null, _nativeFormat, this, i18n("Open Educa File") );
+
+ if( !url.isEmpty() )
+ slotFileOpenURL( url );
+}
+
+/** Open new file */
+void KEducaBuilder::slotFileOpenURL( const KURL &url )
+{
+ if (!currentFileMayBeReplaced())
+ return;
+
+ QPixmap image0( ( const char** ) keducabuilder_data );
+ delete _keducaFile;
+ _keducaFile = new FileRead();
+ if( !_keducaFile->openFile(url) ) { return; }
+ _recentFiles->addURL( url );
+ _listAnswer->clear();
+ _isOpenFile = true;
+
+ _keducaFile->recordFirst();
+ while( !_keducaFile->recordEOF() )
+ {
+ _listAnswer->insertItem( image0, _keducaFile->getQuestion( FileRead::QF_TEXT ) );
+ _keducaFile->recordNext();
+ }
+}
+
+/** Item select */
+void KEducaBuilder::slotPreview( QListBoxItem *item )
+{
+// bool match = false;
+ QString tmpListanswer;
+
+ // FIND THE SELECT RECORD
+ if( !item ) return;
+
+// kdDebug() << "Item : " << _listAnswer->currentItem() <<endl;
+ _keducaFile->recordAt( _listAnswer->currentItem() );
+
+ // START THE PREVIEW VALUES
+ tmpListanswer = "<p><b>" + i18n("Answers") + "</b></p><hr>";
+ tmpListanswer += "<p>";
+
+ tmpListanswer +="<TABLE WIDTH=98%>";
+ _keducaFile->recordAnswerFirst();
+ while( !_keducaFile->recordAnswerEOF() )
+ {
+ tmpListanswer += "<TR>";
+ tmpListanswer += "<TD WIDTH=3% BGCOLOR=";
+ _keducaFile->getAnswerValue() ? tmpListanswer += "#006b6b>" : tmpListanswer += "#b84747>";
+ if( _keducaFile->getQuestionInt( FileRead::QF_TYPE ) == 3 )
+ {
+ tmpListanswer += "<FONT COLOR=#ffffff><b>"
+ + _keducaFile->getAnswer( FileRead::AF_POINT )
+ + "</b></FONT>";
+ }
+ tmpListanswer += "</TD>";
+ tmpListanswer += "<TD WIDTH=95% BGCOLOR=";
+ _keducaFile->getAnswerValue() ? tmpListanswer += "#daeaea>" : tmpListanswer += "#eadada>";
+ tmpListanswer += "<span style=\"color:black;\">"+_keducaFile->getAnswer( FileRead::AF_TEXT )+"</span>";
+ tmpListanswer += "</TD></TR>";
+ _keducaFile->recordAnswerNext();
+ };
+ tmpListanswer += "</TABLE>";
+
+ if( !_keducaFile->getQuestion( FileRead::QF_PICTURE ).isEmpty() )
+ {
+ tmpListanswer += "<table><tr><td><img src=";
+ tmpListanswer += _keducaFile->getPicture();
+ tmpListanswer += "></td>";
+ tmpListanswer += "<td align=right><b>" + i18n("Question Image") + "</b><hr>";
+ tmpListanswer += _keducaFile->getQuestion( FileRead::QF_PICTURE ) + "</td></tr></table>";
+ };
+
+ if( _keducaFile->getQuestionInt( FileRead::QF_POINTS ) > 0 )
+ {
+ tmpListanswer += "<p><b>" + i18n("Question point") + ":</b> ";
+ tmpListanswer += _keducaFile->getQuestion( FileRead::QF_POINTS );
+ }
+
+ if( _keducaFile->getQuestionInt( FileRead::QF_TIME ) > 0 )
+ {
+ tmpListanswer += "<p><b>"+i18n("Time")+":</b> ";
+ tmpListanswer += _keducaFile->getQuestion( FileRead::QF_TIME );
+ tmpListanswer += i18n(" seconds</p>");
+ }
+
+ if( !_keducaFile->getQuestion( FileRead::QF_TIP ).isEmpty() )
+ {
+ tmpListanswer += "<p><b>" + i18n("Tip") +":</b> ";
+ tmpListanswer += _keducaFile->getQuestion( FileRead::QF_TIP );
+ tmpListanswer += "</p>";
+ }
+
+ if( !_keducaFile->getQuestion( FileRead::QF_EXPLAIN ).isEmpty() )
+ {
+ tmpListanswer += "<p><b>"
+ + i18n("Explain") + ":</b>"
+ + _keducaFile->getQuestion( FileRead::QF_EXPLAIN )
+ + "</p>";
+ }
+
+ _preview->setText( tmpListanswer );
+}
+
+/** Read config data */
+void KEducaBuilder::configRead()
+{
+ KConfig *config = KGlobal::config();
+
+ config->setGroup( "keducacontrol" );
+ applyMainWindowSettings( config, "keducacontrol" );
+ _split->setSizes( config->readIntListEntry("Splitter_size") );
+ _recentFiles->loadEntries(config);
+}
+
+/** Write settings */
+void KEducaBuilder::configWrite()
+{
+ KConfig *config = KGlobal::config();
+
+ config->setGroup( "keducacontrol" );
+ saveMainWindowSettings( config, "keducacontrol" );
+ config->writeEntry("Splitter_size", _split->sizes() );
+ _recentFiles->saveEntries(config);
+ config->sync();
+}
+
+bool KEducaBuilder::currentFileMayBeReplaced()
+{
+ if (_keducaFile->changed())
+ {
+ int res = KMessageBox::warningYesNoCancel( widget(),
+ // ask the user to save
+ i18n( "The document \"%1\" has been modified.\n"
+ "Do you want to save it?" ).arg( _keducaFile->getCurrentURL().fileName() ),
+ i18n( "Save Document?" ), KStdGuiItem::save(), KStdGuiItem::discard() );
+ switch (res)
+ {
+ case KMessageBox::Yes:
+ // If the saving was successful, then the file may be replaced
+ return fileSave();
+ break;
+ case KMessageBox::Cancel:
+ // User cancels operation, do not replace the file
+ return false;
+ break;
+ default: ;
+ }
+ }
+
+ // file was not changed, it may be replaced
+ return true;
+}
+
+/** Close the window */
+bool KEducaBuilder::queryClose ()
+{
+ if (_keducaFile) {
+ if (!currentFileMayBeReplaced())
+ return false;
+ }
+ configWrite();
+ return( TRUE );
+}
+
+/** Add question */
+void KEducaBuilder::slotAdd()
+{
+ QPixmap image0( ( const char** ) keducabuilder_data );
+
+ KControlAddEdit edit(this);
+ edit.init( _keducaFile, false );
+ if( !edit.exec() ) return;
+
+ _listAnswer->insertItem( image0, _keducaFile->getQuestion( FileRead::QF_TEXT ) );
+ _listAnswer->setCurrentItem( _listAnswer->count()-1 );
+ slotPreview( _listAnswer->item(_listAnswer->currentItem()) );
+}
+
+/** Edit question */
+void KEducaBuilder::slotEdit()
+{
+ if( _listAnswer->currentItem() == -1 ) return;
+
+ QPixmap image0( ( const char** ) keducabuilder_data );
+
+ KControlAddEdit edit(this);
+ edit.init( _keducaFile, true );
+ if( edit.exec() )
+ {
+ _listAnswer->changeItem( image0, _keducaFile->getQuestion( FileRead::QF_TEXT ), _listAnswer->currentItem() );
+ slotPreview( _listAnswer->item(_listAnswer->currentItem()) );
+ }
+}
+
+/** Edit question */
+void KEducaBuilder::slotRemove()
+{
+ if( _listAnswer->currentItem() == -1 ) return;
+ _keducaFile->recordDelete();
+ _listAnswer->removeItem( _listAnswer->currentItem() );
+}
+
+/** Up record */
+void KEducaBuilder::slotUp()
+{
+ int current = _listAnswer->currentItem();
+
+ if( current < 1 ) return;
+ QPixmap image0( ( const char** ) keducabuilder_data );
+
+ _keducaFile->recordSwap( true );
+ QString tmpString = _listAnswer->text( current-1 );
+ _listAnswer->changeItem( image0, _listAnswer->text( current ), current-1 );
+ _listAnswer->changeItem( image0, tmpString, current );
+ _listAnswer->setCurrentItem( current-1 );
+}
+
+/** Down record */
+void KEducaBuilder::slotDown()
+{
+ int current = _listAnswer->currentItem();
+
+ if( current == -1 || current == (signed)(_listAnswer->count()-1) ) return;
+ QPixmap image0( ( const char** ) keducabuilder_data );
+
+ _keducaFile->recordSwap( true );
+ QString tmpString = _listAnswer->text( current+1 );
+ _listAnswer->changeItem( image0, _listAnswer->text( current ), current+1 );
+ _listAnswer->changeItem( image0, tmpString, current );
+ _listAnswer->setCurrentItem( current+1 );
+}
+
+/** Save file */
+void KEducaBuilder::slotFileSave()
+{
+ fileSave();
+}
+bool KEducaBuilder::fileSave()
+{
+ if( !_isOpenFile ) { return fileSaveAs(); }
+
+ if( checkSave() ) return _keducaFile->saveFile();
+ return false;
+}
+
+/** Save As... */
+void KEducaBuilder::slotFileSaveAs()
+{
+ fileSaveAs();
+}
+
+bool KEducaBuilder::fileSaveAs()
+{
+ if( !checkSave() ) return false;
+
+ QCheckBox *saveCompressedCheckBox = new QCheckBox( i18n( "Compress the file" ), 0 );
+ saveCompressedCheckBox->setChecked( true );
+
+ KFileDialog *dialog=new KFileDialog(QString::null, QString::null, this, "file dialog", true, saveCompressedCheckBox);
+ dialog->setCaption( i18n("Save Document As") );
+ dialog->setKeepLocation( true );
+ dialog->setOperationMode( KFileDialog::Saving );
+ QStringList mimeFilter(_nativeFormat);
+ dialog->setMimeFilter( mimeFilter, _nativeFormat );
+ KURL newURL;
+ QString outputFormat (_nativeFormat);
+
+ bool bOk;
+ do {
+ bOk=true;
+ if(dialog->exec()==QDialog::Accepted) {
+ newURL=dialog->selectedURL();
+ outputFormat=dialog->currentMimeFilter();
+ }
+ else
+ {
+ bOk = false;
+ break;
+ }
+ kdDebug()<<"Requested saving to file "<<newURL.prettyURL() <<endl;
+ if ( newURL.isEmpty() )
+ {
+ bOk = false;
+ break;
+ }
+
+ if ( QFileInfo( newURL.path() ).extension().isEmpty() ) {
+ // No more extensions in filters. We need to get it from the mimetype.
+ KMimeType::Ptr mime = KMimeType::mimeType( outputFormat );
+ QString extension = mime->property( "X-KDE-NativeExtension" ).toString();
+ kdDebug() << "KEducaBuilder::slotFileSaveAs outputFormat=" << outputFormat << " extension=" << extension << endl;
+ newURL.setPath( newURL.path() + extension );
+ }
+
+ if ( KIO::NetAccess::exists( newURL, false, this ) ) { // this file exists => ask for confirmation
+ bOk = KMessageBox::warningContinueCancel( this,
+ i18n("A document with this name already exists.\n"\
+ "Do you want to overwrite it?"),
+ i18n("Warning"), i18n("Overwrite") ) == KMessageBox::Continue;
+ }
+ } while ( !bOk );
+
+ bool saveCompressed = saveCompressedCheckBox->isChecked();
+
+ delete dialog;
+
+ if (bOk) {
+ bool copyImages = KMessageBox::questionYesNo( this,
+ i18n("If you want to share this document, it is better to copy the images to the same folder as the document.\n"\
+ "Do you want to copy images?"),
+ i18n("Warning"), i18n("Copy Images"), i18n("Do Not Copy") ) == KMessageBox::Yes;
+ if (_keducaFile->saveFile( newURL, copyImages, saveCompressed ) ) {
+ _recentFiles->addURL(newURL);
+ // we saved the file, so the internal representation is now present as a file
+ _isOpenFile=true;
+ return true;
+ }else {
+ kdDebug()<< "saving of file failed" <<endl;
+ return false;
+ }
+ }else {
+ kdDebug()<< "KEducaBuilder: no valid filename selected" <<endl;
+ return false;
+ }
+}
+
+/** Print file */
+void KEducaBuilder::slotFilePrint()
+{
+ KPrinter *printer = new KPrinter();
+
+ QString file = _keducaFile->getCurrentURL().fileName();
+ if (file.isEmpty())
+ file = i18n("Test");
+ if(printer->setup(this, i18n("Print %1").arg(file)))
+ {
+ QPaintDeviceMetrics metrics(printer);
+ QPainter p;
+
+ const int margin=20;
+ int yPos=0;
+ QString text;
+
+ p.begin(printer);
+ p.setFont( QFont(font().family(), 12, QFont::Bold) );
+ QFontMetrics fm = p.fontMetrics();
+
+ _keducaFile->recordFirst();
+ while(!_keducaFile->recordEOF())
+ {
+ p.drawText( 10, yPos+margin, metrics.width(), fm.lineSpacing(),
+ ExpandTabs | DontClip, _keducaFile->getQuestion(FileRead::QF_TEXT) );
+ yPos += fm.lineSpacing();
+
+ p.drawLine(10, yPos+margin, metrics.width(), yPos+margin);
+ yPos += 2*fm.lineSpacing();
+
+ _keducaFile->recordNext();
+ }
+
+ p.end();
+ }
+
+ delete printer;
+
+}
+
+/** Header info */
+int KEducaBuilder::slotHeader() {
+ KControlHeader infoDoc(_keducaFile);
+ return infoDoc.exec();
+}
+
+/** Check if the current document can save */
+bool KEducaBuilder::checkSave()
+{
+ if( _keducaFile->getHeader("title").isEmpty() ||
+ _keducaFile->getHeader("category").isEmpty() ||
+ _keducaFile->getHeader("type").isEmpty() ||
+ _keducaFile->getHeader("level").isEmpty() ||
+ _keducaFile->getHeader("language").isEmpty() )
+ {
+ if (KMessageBox::warningContinueCancel(this, i18n("Unable to save file.\n\nYou must complete the Document Info\n(Only the description is necessary)"), QString::null, i18n("Complete Document Info..."))
+ == KMessageBox::Continue) {
+ if (slotHeader()!=KControlHeader::Accepted)
+ return false;
+ }else
+ return false;
+ }
+
+ if( _listAnswer->count() < 1 )
+ {
+ if (KMessageBox::warningContinueCancel(this, i18n("Unable to save file.\n\nYou must insert a question."),
+ QString::null, i18n("Insert Question"))==KMessageBox::Continue)
+ slotAdd();
+ else
+ return false;
+ }
+
+ return true;
+}
+
+bool KEducaBuilder::startChooser() {
+ KEducaEditorStartDialog startDialog(this, "KEducaEditorStartDialog", true);
+
+ switch (startDialog.exec()) {
+ case KEducaEditorStartDialog::OpenDoc:
+ case KEducaEditorStartDialog::OpenRecentDoc:
+ slotFileOpenURL(startDialog.getURL());
+ break;
+ case KEducaEditorStartDialog::NewDoc:
+ slotFileOpenNew();
+ break;
+ case KEducaEditorStartDialog::Gallery:
+ initGallery();
+ break;
+ default:
+ close();
+ break;
+ }
+
+ return true;
+}
+/** Init Internet Gallery Servers */
+void KEducaBuilder::initGallery(const KURL &urlFile)
+{
+ KGalleryDialog galleries;
+
+ if( !urlFile.url().isEmpty() )
+ galleries.putURL( urlFile );
+
+ if( galleries.exec() == QDialog::Accepted )
+ slotFileOpenURL( galleries.getURL() );
+}
+
+/** Init Gallery */
+void KEducaBuilder::slotGallery()
+{
+ initGallery();
+}
+
+/** Double click in list, edit question */
+void KEducaBuilder::slotEditbyList(QListBoxItem *item)
+{
+ if( item )
+ slotEdit();
+}
diff --git a/keduca/keducabuilder/keducabuilder.h b/keduca/keducabuilder/keducabuilder.h
new file mode 100644
index 00000000..74c5eb58
--- /dev/null
+++ b/keduca/keducabuilder/keducabuilder.h
@@ -0,0 +1,126 @@
+/***************************************************************************
+ 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 <qtextview.h>
+#include <qsplitter.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
+
+public:
+ KEducaBuilder(QWidget* 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 */
+ QTextView *_preview;
+ /** Main splitter */
+ QSplitter *_split;
+ /** I open a file */
+ bool _isOpenFile;
+ QString _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( QListBoxItem *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(QListBoxItem *item);
+};
+
+#endif
diff --git a/keduca/keducabuilder/keducabuilderui.rc b/keduca/keducabuilder/keducabuilderui.rc
new file mode 100644
index 00000000..0942cea9
--- /dev/null
+++ b/keduca/keducabuilder/keducabuilderui.rc
@@ -0,0 +1,28 @@
+<!DOCTYPE kpartgui >
+<kpartgui version="2" name="keducaEditor" >
+<MenuBar>
+ <Menu name="file"><text>&amp;File</text>
+ <Action name="open_gallery"/>
+ <Action name="info_doc"/>
+ </Menu>
+ <Menu name="Edit" ><text>&amp;Edit</text>
+ <Action name="question_add" />
+ <Action name="question_edit" />
+ <Action name="question_remove" />
+ <Separator lineSeparator="true"/>
+ <Action name="question_up" icon="up"/>
+ <Action name="question_down" icon="down"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar" >
+ <Action name="info_doc" />
+</ToolBar>
+<ToolBar name="mainQuestionBar" >
+ <Action name="question_add" />
+ <Action name="question_edit" />
+ <Action name="question_remove" />
+ <Separator lineSeparator="true"/>
+ <Action name="question_up" icon="up"/>
+ <Action name="question_down" icon="down"/>
+</ToolBar>
+</kpartgui>
diff --git a/keduca/keducabuilder/keducaeditorstartdialog.cpp b/keduca/keducabuilder/keducaeditorstartdialog.cpp
new file mode 100644
index 00000000..88cf9305
--- /dev/null
+++ b/keduca/keducabuilder/keducaeditorstartdialog.cpp
@@ -0,0 +1,114 @@
+/***************************************************************************
+ keducaeditorstartdialog.cpp - description
+ -------------------
+ begin : Fri May 10 2002
+ copyright : (C) 2002 by Klas Kalass
+ email : klas@kde.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. *
+ * *
+ ***************************************************************************/
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+
+#include <kdebug.h>
+#include <kurlrequester.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kcombobox.h>
+
+#include "keducaeditorstartdialog.h"
+#include "keducabuilder.h"
+
+/**
+ */
+KEducaEditorStartDialog::KEducaEditorStartDialog(KEducaBuilder * parent, const char* name, bool modal, WFlags fl)
+ :KEducaEditorStartDialogBase(parent, name, modal, fl),
+ _choice(NewDoc),
+ _maxRecentDocumentItems(20)
+{
+ newDocumentRB->setFocus();
+
+ // read recent files
+ buildRecentFilesList();
+
+// setup connections
+ urlRequester->setFilter( "application/x-edu");
+
+ connect( startChoiceBtnGrp, SIGNAL( clicked(int) ),
+ this, SLOT( slotChoiceChanged(int) ) );
+}
+
+/** based on code in kaction.cpp
+ */
+void KEducaEditorStartDialog::buildRecentFilesList()
+{
+ QString key;
+ QString value;
+ QString oldGroup;
+ KConfig *config = KGlobal::config();
+
+ oldGroup = config->group();
+
+ config->setGroup( "RecentFiles" );
+
+ // read file list
+ for( unsigned int i = 1 ; i <= _maxRecentDocumentItems ; i++ )
+ {
+ key = QString( "File%1" ).arg( i );
+ value = config->readEntry( key, QString::null );
+
+ if (!value.isNull())
+ recentDocumentCB->insertURL( KURL(value) );
+ }
+
+ config->setGroup( oldGroup );
+}
+
+KEducaEditorStartDialog::~KEducaEditorStartDialog() {
+
+}
+
+void KEducaEditorStartDialog::slotChoiceChanged(int id) {
+ _choice = id+1;
+}
+
+KURL KEducaEditorStartDialog::getURL()const{
+ switch(_choice) {
+ case OpenDoc:
+ return KURL(urlRequester->url());
+ break;
+ case OpenRecentDoc:
+ return KURL(recentDocumentCB->currentText());
+ break;
+ default:
+ break;
+ }
+
+ return KURL();
+}
+
+int KEducaEditorStartDialog::exec() {
+ int ret = KEducaEditorStartDialogBase::exec();
+ if ( ret == KEducaEditorStartDialogBase::Rejected )
+ _choice = KEducaEditorStartDialog::Rejected;
+
+ return _choice;
+}
+
+void KEducaEditorStartDialog::accept() {
+ if (((_choice == OpenDoc || _choice == OpenRecentDoc)
+ && getURL().isEmpty())) {
+ KMessageBox::sorry(this, i18n("You need to specify the file to open!"));
+ }else
+ KEducaEditorStartDialogBase::accept();
+}
+
+#include "keducaeditorstartdialog.moc"
diff --git a/keduca/keducabuilder/keducaeditorstartdialog.h b/keduca/keducabuilder/keducaeditorstartdialog.h
new file mode 100644
index 00000000..dd163848
--- /dev/null
+++ b/keduca/keducabuilder/keducaeditorstartdialog.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ keducaeditorstartdialog.h - description
+ -------------------
+ begin : Fri May 10 2002
+ copyright : (C) 2002 by Klas Kalass
+ email : klas@kde.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 KEDUCAEDITORSTARTDIALOG_H
+#define KEDUCAEDITORSTARTDIALOG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "keducaeditorstartdialogbase.h"
+
+// forward declarations
+class KEducaBuilder;
+
+/**
+ */
+class KEducaEditorStartDialog : public KEducaEditorStartDialogBase{
+ Q_OBJECT
+public:
+ enum {Rejected=0, OpenDoc=1, OpenRecentDoc=2, Gallery=3, NewDoc=4}StartChoice;
+ /** Constructor.
+ */
+ KEducaEditorStartDialog(KEducaBuilder * parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ /** Destructor.
+ */
+ virtual ~KEducaEditorStartDialog();
+
+ KURL getURL()const;
+ int exec();
+
+private:
+ KURL _selectedURL;
+ int _choice;
+ unsigned int const _maxRecentDocumentItems;
+ void buildRecentFilesList();
+
+protected slots:
+ void accept();
+
+private slots:
+ void slotChoiceChanged(int id);
+
+};
+#endif
diff --git a/keduca/keducabuilder/keducaeditorstartdialogbase.ui b/keduca/keducabuilder/keducaeditorstartdialogbase.ui
new file mode 100644
index 00000000..0cb69e39
--- /dev/null
+++ b/keduca/keducabuilder/keducaeditorstartdialogbase.ui
@@ -0,0 +1,320 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>KEducaEditorStartDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KEducaEditorStartDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>511</width>
+ <height>311</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Editor - Getting Started</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>startChoiceBtnGrp</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>openDocumentRB</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Open an &amp;existing document:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>urlRequester</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>openRecentDocumentRB</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Open a &amp;recent document:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>recentDocumentCB</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton4</cstring>
+ </property>
+ <property name="text">
+ <string>Open with Internet gallery browser</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>newDocumentRB</cstring>
+ </property>
+ <property name="text">
+ <string>Start a &amp;new document</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KEducaEditorStartDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KEducaEditorStartDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>urlRequester</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>openDocumentRB</receiver>
+ <slot>animateClick()</slot>
+ </connection>
+ <connection>
+ <sender>recentDocumentCB</sender>
+ <signal>activated(int)</signal>
+ <receiver>openRecentDocumentRB</receiver>
+ <slot>animateClick()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>newDocumentRB</tabstop>
+ <tabstop>urlRequester</tabstop>
+ <tabstop>recentDocumentCB</tabstop>
+ <tabstop>buttonHelp</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+ <tabstop>openDocumentRB</tabstop>
+ <tabstop>openRecentDocumentRB</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/keduca/keducabuilder/klangcombo.cpp b/keduca/keducabuilder/klangcombo.cpp
new file mode 100644
index 00000000..ebedd9dd
--- /dev/null
+++ b/keduca/keducabuilder/klangcombo.cpp
@@ -0,0 +1,51 @@
+/*
+ * klangcombo.cpp - Adds some methods for inserting languages.
+ *
+ * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include <kstandarddirs.h>
+
+#include "klangcombo.h"
+#include "klangcombo.moc"
+
+KLanguageCombo::~KLanguageCombo ()
+{
+}
+
+KLanguageCombo::KLanguageCombo (QWidget * parent, const char *name)
+ : KTagComboBox(parent, name)
+{
+}
+
+void KLanguageCombo::insertLanguage(const QString& path, const QString& name, const QString& sub, const QString &submenu)
+{
+ QString output = name + QString::fromLatin1(" (") + path + QString::fromLatin1(")");
+ QPixmap flag(locate("locale", sub + path + QString::fromLatin1("/flag.png")));
+ insertItem(QIconSet(flag), output, path, submenu);
+}
+
+void KLanguageCombo::changeLanguage(const QString& name, int i)
+{
+ if (i < 0 || i >= count()) return;
+ QString output = name + QString::fromLatin1(" (") + tag(i) + QString::fromLatin1(")");
+ changeItem(output, i);
+}
diff --git a/keduca/keducabuilder/klangcombo.h b/keduca/keducabuilder/klangcombo.h
new file mode 100644
index 00000000..4c9fb801
--- /dev/null
+++ b/keduca/keducabuilder/klangcombo.h
@@ -0,0 +1,47 @@
+/*
+ * klangcombo.h - Adds some methods for inserting languages.
+ *
+ * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __KLANGCOMBO_H__
+#define __KLANGCOMBO_H__
+
+#include "ktagcombobox.h"
+
+/*
+ * Extends KTagCombo to support adding and changing languages.
+ *
+ * It has also support for sub menues.
+ */
+class KLanguageCombo : public KTagComboBox
+{
+ Q_OBJECT
+
+public:
+ KLanguageCombo(QWidget *parent=0, const char *name=0);
+ ~KLanguageCombo();
+
+ void insertLanguage(const QString& path, const QString& name, const QString& sub = QString::null, const QString &submenu = QString::null);
+ void changeLanguage(const QString& name, int i);
+};
+
+#endif
diff --git a/keduca/keducabuilder/ktagcombobox.cpp b/keduca/keducabuilder/ktagcombobox.cpp
new file mode 100644
index 00000000..9b7e969e
--- /dev/null
+++ b/keduca/keducabuilder/ktagcombobox.cpp
@@ -0,0 +1,229 @@
+/*
+ * ktagcombobox.cpp - A combobox with support for submenues, icons and tags
+ *
+ * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#define INCLUDE_MENUITEM_DEF 1
+#include <qpainter.h>
+#include <qpopupmenu.h>
+#include <kdebug.h>
+
+
+#include "ktagcombobox.h"
+#include "ktagcombobox.moc"
+
+KTagComboBox::~KTagComboBox ()
+{
+ delete _popup;
+ delete _tags;
+}
+
+KTagComboBox::KTagComboBox (QWidget * parent, const char *name)
+ : QComboBox(parent, name)
+{
+ _popup = new QPopupMenu(this);
+ _tags = new QStringList;
+ connect( _popup, SIGNAL(activated(int)),
+ SLOT(internalActivate(int)) );
+ connect( _popup, SIGNAL(highlighted(int)),
+ SLOT(internalHighlight(int)) );
+}
+
+void KTagComboBox::popupMenu()
+{
+ _popup->popup( mapToGlobal( QPoint(0,0) ), _current );
+}
+
+void KTagComboBox::keyPressEvent( QKeyEvent *e )
+{
+ int c;
+
+ if ( ( e->key() == Key_F4 && e->state() == 0 ) ||
+ ( e->key() == Key_Down && (e->state() & AltButton) ) ||
+ ( e->key() == Key_Space ) ) {
+ if ( count() ) {
+ _popup->setActiveItem( _current );
+ popupMenu();
+ }
+ return;
+ } else {
+ e->ignore();
+ return;
+ }
+
+ c = currentItem();
+ emit highlighted( c );
+ emit activated( c );
+}
+
+void KTagComboBox::mousePressEvent( QMouseEvent * )
+{
+ popupMenu();
+}
+
+void KTagComboBox::internalActivate( int index )
+{
+ if (_current == index) return;
+ _current = index;
+ emit activated( index );
+ repaint();
+}
+
+void KTagComboBox::internalHighlight( int index )
+{
+ emit highlighted( index );
+}
+
+void KTagComboBox::clear()
+{
+ _popup->clear();
+ _tags->clear();
+}
+
+int KTagComboBox::count() const
+{
+ return _tags->count();
+}
+
+static inline QPopupMenu *checkInsertIndex(QPopupMenu *popup, const QStringList *tags, const QString &submenu, int *index)
+{
+ int pos = tags->findIndex(submenu);
+
+ QPopupMenu *pi = 0;
+ if (pos != -1)
+ {
+ QMenuItem *p = popup->findItem(popup->idAt(pos));
+ pi = p?p->popup():0;
+ }
+ if (!pi) pi = popup;
+
+ if (*index > (int)pi->count())
+ *index = -1;
+
+ return pi;
+}
+
+void KTagComboBox::insertItem(const QIconSet& icon, const QString &text, const QString &tag, const QString &submenu, int index )
+{
+ QPopupMenu *pi = checkInsertIndex(_popup, _tags, submenu, &index);
+ pi->insertItem(icon, text, count(), index);
+ _tags->append(tag);
+}
+
+void KTagComboBox::insertItem(const QString &text, const QString &tag, const QString &submenu, int index )
+{
+ QPopupMenu *pi = checkInsertIndex(_popup, _tags, submenu, &index);
+ pi->insertItem(text, count(), index);
+ _tags->append(tag);
+}
+
+void KTagComboBox::insertSeparator(const QString &submenu, int index)
+{
+ QPopupMenu *pi = checkInsertIndex(_popup, _tags, submenu, &index);
+ pi->insertSeparator(index);
+ _tags->append(QString::null);
+}
+
+void KTagComboBox::insertSubmenu(const QString &text, const QString &tag, const QString &submenu, int index)
+{
+ QPopupMenu *pi = checkInsertIndex(_popup, _tags, submenu, &index);
+ QPopupMenu *p = new QPopupMenu(pi);
+ pi->insertItem(text, p, count(), index);
+ _tags->append(tag);
+ connect( p, SIGNAL(activated(int)),
+ SLOT(internalActivate(int)) );
+ connect( p, SIGNAL(highlighted(int)),
+ SLOT(internalHighlight(int)) );
+}
+
+void KTagComboBox::changeItem( const QString &text, int index )
+{
+ _popup->changeItem( text, index);
+ if (index == _current)
+ repaint();
+}
+
+void KTagComboBox::paintEvent( QPaintEvent * ev)
+{
+ QComboBox::paintEvent(ev);
+
+ QPainter p (this);
+
+ // Text
+ QRect clip(2, 2, width() - 4, height() - 4);
+ if ( hasFocus())
+ p.setPen( colorGroup().highlightedText() );
+ p.drawText(clip, AlignCenter | SingleLine, _popup->text( _current ));
+
+ // Icon
+ QIconSet *icon = _popup->iconSet( _current );
+ if (icon) {
+ QPixmap pm = icon->pixmap();
+ p.drawPixmap( 4, (height()-pm.height())/2, pm );
+ }
+}
+
+bool KTagComboBox::containsTag( const QString &str ) const
+{
+ return _tags->contains(str) > 0;
+}
+
+QString KTagComboBox::currentTag() const
+{
+ return *_tags->at(currentItem());
+}
+
+QString KTagComboBox::tag(int i) const
+{
+ if (i < 0 || i >= count())
+ {
+ kdDebug() << "KTagComboBox::tag(), unknown tag " << i << endl;
+ return QString::null;
+ }
+ return *_tags->at(i);
+}
+
+int KTagComboBox::currentItem() const
+{
+ return _current;
+}
+
+void KTagComboBox::setCurrentItem(int i)
+{
+ if (i < 0 || i >= count()) return;
+ _current = i;
+ repaint();
+}
+
+void KTagComboBox::setCurrentItem(const QString &code)
+{
+ int i = _tags->findIndex(code);
+ if (code.isNull())
+ i = 0;
+ if (i != -1)
+ setCurrentItem(i);
+}
+
+void KTagComboBox::setFont( const QFont &font )
+{
+ QComboBox::setFont( font );
+ _popup->setFont( font );
+}
diff --git a/keduca/keducabuilder/ktagcombobox.h b/keduca/keducabuilder/ktagcombobox.h
new file mode 100644
index 00000000..099c6561
--- /dev/null
+++ b/keduca/keducabuilder/ktagcombobox.h
@@ -0,0 +1,94 @@
+/*
+ * ktagcombobox.h - A combobox with support for submenues, icons and tags
+ *
+ * Copyright (c) 1999-2000 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __KTAGCOMBOBOX_H__
+#define __KTAGCOMBOBOX_H__
+
+#include <qcombobox.h>
+#include <qiconset.h>
+class QPopupMenu;
+class QStringList;
+
+/*
+ * This class should be just like qcombobox, but it should be possible
+ * to have have a QIconSet for each entry, and each entry should have a tag.
+ *
+ * It has also support for sub menues.
+ */
+class KTagComboBox : public QComboBox
+{
+ Q_OBJECT
+
+public:
+ KTagComboBox(QWidget *parent=0, const char *name=0);
+ ~KTagComboBox();
+
+ void insertItem(const QIconSet& icon, const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1 );
+ void insertItem(const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1 );
+ void insertSeparator(const QString &submenu = QString::null, int index=-1 );
+ void insertSubmenu(const QString &text, const QString &tag, const QString &submenu = QString::null, int index=-1);
+ void changeItem( const QString &text, int index );
+
+ int count() const;
+ void clear();
+
+ /*
+ * Tag of the selected item
+ */
+ QString currentTag() const;
+ QString tag ( int i ) const;
+ bool containsTag (const QString &str ) const;
+
+ /*
+ * Set the current item
+ */
+ int currentItem() const;
+ void setCurrentItem(int i);
+ void setCurrentItem(const QString &code);
+
+ // widget stuff
+ virtual void setFont( const QFont & );
+
+signals:
+ void activated( int index );
+ void highlighted( int index );
+
+private slots:
+ void internalActivate( int );
+ void internalHighlight( int );
+
+protected:
+ void paintEvent( QPaintEvent * );
+ void mousePressEvent( QMouseEvent * );
+ void keyPressEvent( QKeyEvent *e );
+ void popupMenu();
+
+private:
+ // work space for the new class
+ QStringList *_tags;
+ QPopupMenu *_popup;
+ int _current;
+};
+
+#endif
diff --git a/keduca/keducabuilder/main.cpp b/keduca/keducabuilder/main.cpp
new file mode 100644
index 00000000..93a49cdf
--- /dev/null
+++ b/keduca/keducabuilder/main.cpp
@@ -0,0 +1,67 @@
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : mi may 23 20:36:15 CEST 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. *
+ * *
+ ***************************************************************************/
+
+#include <kcmdlineargs.h>
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+
+#include <qfileinfo.h>
+#include "keducabuilder.h"
+
+static const char description[] = I18N_NOOP("Form-based tests and exams builder");
+static const char version[] = "1.2.0";
+
+static KCmdLineOptions options[] =
+{
+ { "+file", I18N_NOOP("File to load"), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char *argv[])
+{
+ KAboutData aboutData( "keduca", I18N_NOOP("KEducaBuilder"),
+ version, description, KAboutData::License_GPL,
+ "(c) 2001, Javier Campos", 0, "http://keduca.sourceforge.net", "submit@bugs.kde.org");
+ aboutData.addAuthor("Javier Campos",I18N_NOOP("Original Author"), "javi@asyris.org");
+ aboutData.addAuthor("Klas Kalass",I18N_NOOP("Maintainer 2002-2004"), "klas@kde.org");
+ aboutData.addAuthor("Anne-Marie Mahfouf",I18N_NOOP("Various fixes and cleanups"), "annma@kde.org");
+ aboutData.addCredit("Nenad Grujicic", I18N_NOOP("Icons"), "mengele@linuxo.org");
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
+
+ KApplication a;
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ // start as KEduca Builder
+ KEducaBuilder *keducaEditor = new KEducaBuilder();
+ a.setMainWidget(keducaEditor);
+ keducaEditor->show();
+
+ if ( args->count() > 0 ){
+ if( QFileInfo( KURL(args->url(0)).url() ).extension() == "edugallery" )
+ keducaEditor->initGallery( args->url(0) );
+ else
+ keducaEditor->slotFileOpenURL( args->url(0) );
+ }else
+ keducaEditor->startChooser();
+
+
+ args->clear();
+
+ return a.exec();
+}
diff --git a/keduca/libkeduca/Makefile.am b/keduca/libkeduca/Makefile.am
new file mode 100644
index 00000000..f3424f00
--- /dev/null
+++ b/keduca/libkeduca/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES=$(all_includes)
+
+noinst_LTLIBRARIES = libkeduca.la
+libkeduca_la_SOURCES = kgallerydialogbase.ui fileread.cpp kgallerydialog.cpp
+libkeduca_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+libkeduca_la_LIBADD = -lkdeprint
+noinst_HEADERS = fileread.h kgallerydialog.h kgallerydialogbase.h
+
+METASOURCES=AUTO
+include ../../admin/Doxyfile.am
diff --git a/keduca/libkeduca/fileread.cpp b/keduca/libkeduca/fileread.cpp
new file mode 100644
index 00000000..db8f56cb
--- /dev/null
+++ b/keduca/libkeduca/fileread.cpp
@@ -0,0 +1,999 @@
+/***************************************************************************
+ fileread.cpp - description
+ -------------------
+ begin : Wed May 23 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. *
+ * *
+ ***************************************************************************/
+
+#include "fileread.h"
+
+#include <assert.h>
+
+#include <kio/netaccess.h>
+#include <kstandarddirs.h>
+#include <kmimetype.h>
+#include <kdebug.h>
+#include <ktempfile.h>
+
+#include <qfileinfo.h>
+#include <qpixmap.h>
+#include <qbuffer.h>
+
+FileRead::FileRead( QObject *parent, const char *name )
+ :QObject(parent, name),
+ _changed(false),
+ _tmpfile(0)
+{
+}
+
+FileRead::~FileRead()
+{
+}
+
+bool FileRead::openFile(const KURL &url) {
+ QString tmpFile;
+ bool returnval=false;
+ if( KIO::NetAccess::download( url, tmpFile, 0 ) )
+ {
+ returnval=loadFile( tmpFile );
+ if (returnval) {
+ _currentURL = url;
+ kdDebug()<<"... load successful: "<<_currentURL.url()<<endl;
+ }
+
+ KIO::NetAccess::removeTempFile( tmpFile );
+ }else
+ kdDebug()<<"FileRead::openFile(): download NOT successful: "<<url.url()<<endl;
+
+ return returnval;
+}
+
+bool FileRead::loadFile(const QString &filename)
+{
+ QDomDocument doc("document.xml");
+
+ KMimeType::Ptr type = KMimeType::findByFileContent(filename);
+
+ kdDebug() << "FileRead::loadFile(): MIME-Type is " << type->name() << endl;
+
+ QFile file(filename);
+
+ if(!file.open(IO_ReadOnly))
+ {
+ return false;
+ }
+
+ if (type->name() == "text/html") // Non-compressed files are recognized as HTML...
+ {
+ doc.setContent(&file);
+ }
+ else
+ {
+ doc.setContent(qUncompress(file.readAll()));
+ }
+
+ QDomElement docElem = doc.documentElement();
+ if( (doc.doctype().isNull()) || (doc.doctype().name() != "educa") ) {
+ file.close();
+ return false;
+ }
+
+ QDomNode n = docElem.firstChild();
+
+ QDomNodeList dnList = n.childNodes();
+ for( unsigned int i = 0; i < dnList.count(); ++i)
+ {
+ // ------------------- INFORMATION BODY -----------------------
+ QDomElement element = dnList.item(i).toElement();
+ if( element.tagName() == "default" || element.tagName() == "author" )
+ {
+ if( element.tagName() == "default" ) { _header.insert( "image", element.attribute( "image", "default.png" ) ); }
+ if( element.tagName() == "author" ) {
+ QDomNodeList AuthordnList = element.childNodes();
+ for( unsigned int i = 0; i < AuthordnList.count(); ++i) {
+ QDomElement authorelement = AuthordnList.item(i).toElement();
+ _header.insert( authorelement.tagName(), authorelement.text() );
+ }
+ }
+ } else {
+ _header.insert( element.tagName(), element.text() );
+ }
+ }
+
+ n = n.nextSibling();
+
+ dnList = n.childNodes();
+ for( unsigned int i = 0; i < dnList.count(); ++i)
+ {
+ insertQuestion();
+ // --------------------- QUESTION ATTRIBUTE------------------------
+ QDomElement elementNODE = dnList.item(i).toElement();
+ setQuestion( QF_TYPE, elementNODE.attribute( "type", "1" ).toInt() );
+ setQuestion( QF_PICTURE, elementNODE.attribute( "image", "" ) );
+ setQuestion( QF_TIME, elementNODE.attribute( "time", "0" ).toInt() );
+ setQuestion( QF_POINTS, elementNODE.attribute( "points", "0" ).toInt() );
+
+ QDomNodeList quList = elementNODE.childNodes();
+ for( unsigned int x = 0; x < quList.count(); ++x)
+ {
+ // --------------------- QUESTION AND RESPONSES------------------
+ QDomElement element = quList.item(x).toElement();
+ if( element.tagName() == "text" ) setQuestion( QF_TEXT, element.text() );
+ if( element.tagName() == "true" ) setAnswer( element.text(), true, element.attribute( "points", "0" ).toInt() );
+ if( element.tagName() == "false" ) setAnswer( element.text(), false,element.attribute( "points", "0" ).toInt() );
+ if( element.tagName() == "tip" ) setQuestion( QF_TIP, element.text() );
+ if( element.tagName() == "explain" ) setQuestion( QF_EXPLAIN, element.text() );
+ }
+ }
+
+ n = n.nextSibling();
+
+ dnList = n.childNodes();
+
+ if( dnList.count() > 0 )
+ {
+ for( unsigned int i = 0; i < dnList.count(); ++i)
+ {
+ insertResult();
+ // --------------------- QUESTION ATTRIBUTE------------------------
+ QDomElement elementNODE = dnList.item(i).toElement();
+ setResult( RS_TEXT, elementNODE.text() );
+ setResult( RS_PICTURE, elementNODE.attribute( "image", "" ) );
+ setResult( RS_MIN, elementNODE.attribute( "min", "0" ).toInt() );
+ setResult( RS_MAX, elementNODE.attribute( "max", "0" ).toInt() );
+ }
+ }
+
+ file.close();
+
+ refreshData();
+
+ _changed=false;
+ return true;
+}
+
+void FileRead::setQuestion( QuestionField field, const QString& text)
+{
+// QF_text, QF_picture, QF_type, QF_time, QF_tip, QF_explain
+ switch( field )
+ {
+ case QF_TEXT:
+ (*_recordQuestions).text = text;
+ break;
+ case QF_PICTURE:
+ (*_recordQuestions).picture = text;
+ break;
+ case QF_TIP:
+ (*_recordQuestions).tip = text;
+ break;
+ case QF_EXPLAIN:
+ (*_recordQuestions).explain = text;
+ break;
+ default:
+ kdDebug()<<"FileRead::setQuestion(QuestionField field, QString text) called for not handled field value "<<field <<endl;
+ break;
+ }
+ _changed=true;
+}
+
+void FileRead::setQuestion( QuestionField field, int value )
+{
+ switch( field )
+ {
+ case QF_TYPE:
+ (*_recordQuestions).type = value;
+ break;
+ case QF_TIME:
+ (*_recordQuestions).time = value;
+ break;
+ case QF_POINTS:
+ (*_recordQuestions).points = value;
+ break;
+ default:
+ kdDebug()<<"FileRead::setQuestion(QuestionField field, int value) called for not handled field value "<<field <<endl;
+ break;
+ }
+ _changed=true;
+}
+
+void FileRead::setResult( ResultField field, const QString& text)
+{
+// RS_text, QF_picture
+ switch( field )
+ {
+ case RS_TEXT:
+ (*_recordResults).text = text;
+ break;
+ case RS_PICTURE:
+ (*_recordResults).picture = text;
+ break;
+ default:
+ kdDebug()<<"FileRead::setResult(ResultField field, QString text) called for not handled field value "<<field <<endl;
+ break;
+ }
+ _changed=true;
+}
+
+void FileRead::setResult( ResultField field, int value )
+{
+ switch( field )
+ {
+ case RS_MIN:
+ (*_recordResults).min = value;
+ break;
+ case RS_MAX:
+ (*_recordResults).max = value;
+ break;
+ default:
+ kdDebug()<<"FileRead::setResultInt(ResultField field, int value) called for not handled field value "<<field <<endl;
+ break;
+ }
+ _changed=true;
+}
+
+void FileRead::setAnswer( const QString& text, bool value, int points)
+{
+ Answers tmpAnswers;
+
+ tmpAnswers.text = text;
+ tmpAnswers.value = value;
+ tmpAnswers.points = points;
+
+ (*_recordQuestions).listAnswers.append( tmpAnswers );
+ _changed=true;
+}
+
+void FileRead::insertQuestion()
+{
+ Questions tempQuestions;
+ tempQuestions.text = "";
+ _listQuestions.append( tempQuestions );
+ recordLast();
+ _changed=true;
+}
+
+void FileRead::insertResult()
+{
+ Results tempResults;
+ tempResults.text = "";
+ _listResults.append( tempResults );
+ recordResultLast();
+ _changed=true;
+}
+
+void FileRead::recordFirst()
+{
+ if( _fileEOF = true ) _fileEOF = false;
+ if( _fileBOF = false ) _fileBOF = true;
+ _recordQuestions = _listQuestions.begin();
+}
+
+void FileRead::recordLast()
+{
+ if( _fileBOF = true ) _fileBOF = false;
+ if( _fileEOF = false ) _fileEOF = true;
+ _recordQuestions = _listQuestions.end();
+ --_recordQuestions;
+}
+
+void FileRead::recordNext()
+{
+ ++_recordQuestions;
+ if( _recordQuestions == _listQuestions.end() )
+ {
+ _fileEOF = true;
+ --_recordQuestions;
+ }
+ else
+ if( _fileBOF = true ) _fileBOF = false;
+}
+
+void FileRead::recordPrevious()
+{
+ if( _recordQuestions == _listQuestions.begin() )
+ _fileBOF = true;
+ else
+ {
+ if( _fileEOF = true ) _fileEOF = false;
+ --_recordQuestions;
+ }
+}
+
+void FileRead::recordResultFirst()
+{
+ if( _fileResultEOF = true ) _fileResultEOF = false;
+ if( _fileResultBOF = false ) _fileResultBOF = true;
+ _recordResults = _listResults.begin();
+}
+
+void FileRead::recordResultLast()
+{
+ if( _fileResultBOF = true ) _fileResultBOF = false;
+ if( _fileResultEOF = false ) _fileResultEOF = true;
+ _recordResults = _listResults.end();
+ --_recordResults;
+}
+
+void FileRead::recordResultNext()
+{
+ ++_recordResults;
+ if( _recordResults == _listResults.end() )
+ {
+ _fileResultEOF = true;
+ --_recordResults;
+ }
+ else
+ {
+ if( _fileBOF = true ) _fileBOF = false;
+ }
+}
+
+void FileRead::recordResultPrevious()
+{
+ if( _recordResults == _listResults.begin() )
+ {
+ _fileResultBOF = true;
+ }
+ else
+ {
+ if( _fileResultEOF = true ) _fileResultEOF = false;
+ --_recordResults;
+ }
+}
+
+void FileRead::recordAnswerFirst()
+{
+ if( _fileAnswerEOF = true ) _fileAnswerEOF = false;
+ if( _fileAnswerBOF = false ) _fileAnswerBOF = true;
+ (*_recordQuestions).recordAnswers = (*_recordQuestions).listAnswers.begin();
+}
+
+void FileRead::recordAnswerLast()
+{
+ if( _fileAnswerBOF = true ) _fileAnswerBOF = false;
+ if( _fileAnswerEOF = false ) _fileAnswerEOF = true;
+ (*_recordQuestions).recordAnswers = (*_recordQuestions).listAnswers.end();
+ --(*_recordQuestions).recordAnswers;
+}
+
+void FileRead::recordAnswerNext()
+{
+ ++(*_recordQuestions).recordAnswers;
+ if( (*_recordQuestions).recordAnswers == (*_recordQuestions).listAnswers.end() )
+ {
+ _fileAnswerEOF = true;
+ --(*_recordQuestions).recordAnswers;
+ }
+ else
+ {
+ if( _fileAnswerBOF = true ) _fileAnswerBOF = false;
+ }
+}
+
+void FileRead::recordAnswerPrevious()
+{
+ if( (*_recordQuestions).recordAnswers == (*_recordQuestions).listAnswers.begin() )
+ {
+ _fileBOF = true;
+ }
+ else
+ {
+ if( _fileAnswerEOF = true ) _fileAnswerEOF = false;
+ --(*_recordQuestions).recordAnswers;
+ }
+}
+
+void FileRead::recordAnswerAt( unsigned int index)
+{
+ (*_recordQuestions).recordAnswers = (*_recordQuestions).listAnswers.begin();
+ for( unsigned int i = 0; i < index; ++i)
+ ++(*_recordQuestions).recordAnswers;
+}
+
+unsigned int FileRead::recordAnswerCount()
+{
+ return (*_recordQuestions).listAnswers.count();
+}
+
+QString FileRead::getQuestion( QuestionField field )
+{
+// QF_text, QF_picture, QF_type, QF_time, QF_tip, QF_explain
+ switch( field )
+ {
+ case QF_TEXT:
+ return (*_recordQuestions).text;
+ break;
+ case QF_PICTURE:
+// return getPictureLocal( (*_recordQuestions).picture );
+ return( (*_recordQuestions).picture );
+ break;
+ case QF_POINTS:
+ return QString().setNum( (*_recordQuestions).points );
+ break;
+ case QF_TIME:
+ return QString().setNum( (*_recordQuestions).time );
+ break;
+ case QF_TIP:
+ return (*_recordQuestions).tip;
+ break;
+ case QF_EXPLAIN:
+ return (*_recordQuestions).explain;
+ break;
+ default:
+ kdDebug()<<"FileRead::getQuestion() called for not handled field value "<<field <<endl;
+ return "";
+ break;
+ }
+}
+
+int FileRead::getQuestionInt( QuestionField field )
+{
+ switch( field )
+ {
+ case QF_TYPE:
+ return (*_recordQuestions).type;
+ break;
+ case QF_TIME:
+ return (*_recordQuestions).time;
+ break;
+ case QF_POINTS:
+ return (*_recordQuestions).points;
+ break;
+ default:
+ kdDebug()<<"FileRead::getQuestionInt() called for not handled field value "<<field <<endl;
+ return 0;
+ }
+}
+
+QString FileRead::getAnswer( AnswerField field )
+{
+ // AField { AF_text, AF_value, AF_picture, AF_point };
+ switch( field )
+ {
+ case AF_TEXT:
+ return (*(*_recordQuestions).recordAnswers).text;
+ break;
+// case AF_VALUE:
+// (*(*_recordQuestions).RecordAnswers).Value ? return i18n("True") : return i18n("False");
+// break;
+ case AF_POINT:
+ return QString().setNum( (*(*_recordQuestions).recordAnswers).points );
+ break;
+ default:
+ kdDebug()<<"FileRead::getAnswer() called for not handled field value "<<field <<endl;
+ return "";
+ }
+}
+
+bool FileRead::getAnswerValue()
+{
+ return (*(*_recordQuestions).recordAnswers).value;
+}
+
+int FileRead::getAnswerPoints()
+{
+ return (*(*_recordQuestions).recordAnswers).points;
+}
+
+QString FileRead::getResult( ResultField field )
+{
+ switch( field )
+ {
+ case RS_TEXT:
+ return (*_recordResults).text;
+ break;
+ case RS_PICTURE:
+ return( (*_recordResults).picture );
+ break;
+ case RS_MIN:
+ return QString().setNum( (*_recordResults).min );
+ break;
+ case RS_MAX:
+ return QString().setNum( (*_recordResults).max );
+ break;
+ default:
+ kdDebug()<<"FileRead::getResult() called for not handled field value "<<field <<endl;
+ return "";
+ break;
+ }
+}
+
+int FileRead::getResultInt( ResultField field )
+{
+ switch( field )
+ {
+ case RS_MIN:
+ return (*_recordResults).min;
+ break;
+ case RS_MAX:
+ return (*_recordResults).max;
+ break;
+ default:
+ kdDebug()<<"FileRead::getResult() called for not handled field value "<<field <<endl;
+ return 0;
+ break;
+ }
+}
+
+bool FileRead::recordEOF()
+{
+ return _fileEOF;
+}
+
+bool FileRead::recordBOF()
+{
+ return _fileBOF;
+}
+
+bool FileRead::recordResultEOF()
+{
+ return _fileResultEOF;
+}
+
+bool FileRead::recordResultBOF()
+{
+ return _fileResultBOF;
+}
+
+bool FileRead::recordAnswerEOF()
+{
+ return _fileAnswerEOF;
+}
+
+bool FileRead::recordAnswerBOF()
+{
+ return _fileAnswerBOF;
+}
+
+QString FileRead::getPicture()
+{
+ QString picture;
+
+ if( !getQuestion(QF_PICTURE).isEmpty() )
+ picture = getQuestion(QF_PICTURE);
+ else if( !(_header["image"]).isEmpty() )
+ picture = _header["image"];
+ else
+ return locate("data","keduca/pics/default.png");
+
+ if( _currentURL.isLocalFile() && !KURL(picture).isValid() )
+ {
+ if( !QFileInfo(picture).exists() )
+ picture = _currentURL.directory(false,true) + picture;
+ } else if( !_currentURL.isLocalFile() && !KURL(picture).isValid() )
+ picture = _currentURL.protocol() + "://" + _currentURL.host() + _currentURL.directory(false,true) + picture;
+
+ kdDebug()<< picture <<endl;
+
+ return picture;
+}
+
+QPixmap FileRead::getPicturePixmap()
+{
+
+ KURL picture ( getPicture() );
+ QPixmap pict;
+
+ if( KIO::NetAccess::download( picture, _tmpfileImage, 0 ) )
+ {
+ kdDebug()<<"... load successful: "<< _tmpfileImage <<endl;
+ pict = QPixmap( _tmpfileImage );
+ KIO::NetAccess::removeTempFile( _tmpfileImage );
+ }
+ else
+ {
+ kdDebug()<<"FileRead::openFile(): download NOT successful: "<< _tmpfileImage <<endl;
+ pict = NULL;
+ }
+
+ return pict;
+}
+
+void FileRead::clearAnswers()
+{
+ ((*_recordQuestions).listAnswers).clear();
+ _changed=true;
+}
+
+void FileRead::recordDelete()
+{
+ _listQuestions.remove( _recordQuestions );
+ _changed=true;
+}
+
+void FileRead::recordSwap( bool moveup )
+{
+ Questions listTMP;
+ Questions listNEW;
+
+ listTMP = (*_recordQuestions);
+
+ if( moveup )
+ {
+ recordPrevious();
+ listNEW = (*_recordQuestions);
+ (*_recordQuestions) = listTMP;
+ recordNext();
+ (*_recordQuestions) = listNEW;
+ }
+ else
+ {
+ recordNext();
+ listNEW = (*_recordQuestions);
+ (*_recordQuestions) = listTMP;
+ recordPrevious();
+ (*_recordQuestions) = listNEW;
+ }
+ _changed=true;
+}
+
+bool FileRead::saveFile( const KURL &url, bool copyimages, bool saveCompressed )
+{
+ if (url.isValid())
+ {
+ _currentURL = url;
+ }
+ kdDebug()<<"FileRead::saveFile() to "<<_currentURL.url()<<endl;
+ // Local file
+ if ( _currentURL.isLocalFile() )
+ {
+ if ( _tmpfile != 0 ) // get rid of a possible temp file first
+ { // (happens if previous _currentURL was remote)
+ _tmpfile->unlink();
+ delete _tmpfile;
+ _tmpfile = 0;
+ }
+ if( saveFile(_currentURL.path(), copyimages, saveCompressed) ) {
+ emit completed();
+ emit setWindowCaption( _currentURL.prettyURL() );
+ return true;
+ }
+ }
+ else
+ { // Remote file
+ // We haven't saved yet, or we did but locally - provide a temp file
+ if ( _tmpfile == 0 )
+ {
+ _tmpfile = new KTempFile;
+ }
+ // otherwise, we already had a temp file
+ if( saveFile(_tmpfile->name(), copyimages, saveCompressed) ) {
+ // upload the file
+ KIO::Job * job = KIO::file_copy( KURL::fromPathOrURL( _tmpfile->name() ), _currentURL, -1, true /*overwrite*/ );
+ connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotUploadFinished (KIO::Job *) ) );
+ return true;
+ }
+ }
+
+ // Save local file and upload local file
+ return false;
+}
+
+bool FileRead::saveFile( const QString &filename, bool copyimages, bool saveCompressed )
+{
+ QDomDocument doc("document.xml");
+ QTextStream stream;
+ QString line;
+ QByteArray data;
+ QBuffer buffer(data);
+ QFile file(filename);
+ QStringList copyJOB;
+
+ stream.setDevice(&buffer);
+
+ if ( (!file.open(IO_WriteOnly)) || (!buffer.open(IO_WriteOnly)) )
+ {
+ return false;
+ }
+ /*
+ stream.setDevice(&file);
+
+ if(!file.open(IO_WriteOnly))
+ {
+ // No puede abrir la base
+ return false;
+ }
+ */
+
+ QString head( "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><!DOCTYPE educa>" );
+ doc.setContent( head );
+
+ QDomElement Root = doc.createElement("Document");
+ doc.appendChild( Root );
+
+ QDomElement NodeInfo = doc.createElement("Info");
+ Root.appendChild( NodeInfo );
+
+ insertXML( doc, NodeInfo, "title", _header["title"] );
+ insertXML( doc, NodeInfo, "category", _header["category"] );
+ insertXML( doc, NodeInfo, "type", _header["type"] );
+ insertXML( doc, NodeInfo, "level", _header["level"] );
+ insertXML( doc, NodeInfo, "language", _header["language"] );
+
+ if( !(_header["image"]).isEmpty() )
+ {
+ QDomElement Nodedefault = doc.createElement("default");
+
+ if( copyimages )
+ {
+ copyJOB.append( _header["image"] );
+ Nodedefault.setAttribute( "image", QFileInfo(_header["image"]).fileName() );
+ } else {
+ Nodedefault.setAttribute( "image", _header["image"]);
+ }
+ NodeInfo.appendChild( Nodedefault );
+ }
+
+ if( !_header["name"].isEmpty() || !_header["email"].isEmpty() || !_header["www"].isEmpty() )
+ {
+ QDomElement Nodeauthor = doc.createElement("author");
+ NodeInfo.appendChild( Nodeauthor );
+ if( !_header["name"].isEmpty() ) insertXML( doc, Nodeauthor, "name", _header["name"] );
+ if( !_header["email"].isEmpty() ) insertXML( doc, Nodeauthor, "email", _header["email"] );
+ if( !_header["www"].isEmpty() ) insertXML( doc, Nodeauthor, "www", _header["www"] );
+ }
+
+ QDomElement NodeData = doc.createElement("Data");
+ Root.appendChild( NodeData );
+
+ recordFirst();
+ while ( !recordEOF() )
+ {
+ QDomElement question = doc.createElement("question");
+ if( !getQuestion( QF_PICTURE ).isEmpty() )
+ {
+ if( copyimages )
+ {
+ copyJOB.append( getQuestion( QF_PICTURE ) );
+ question.setAttribute("image", QFileInfo( getQuestion( QF_PICTURE ) ).fileName() );
+ } else {
+ question.setAttribute("image", getQuestion( QF_PICTURE ) );
+ }
+ }
+ question.setAttribute( "type", getQuestionInt( QF_TYPE ) );
+ if( getQuestionInt( QF_POINTS ) > 0 ) question.setAttribute( "points", getQuestion( QF_POINTS ) );
+ if( getQuestionInt( QF_TIME ) > 0 ) question.setAttribute( "time", getQuestion( QF_TIME ) );
+ insertXML( doc, question, "text", getQuestion( QF_TEXT ) );
+
+ recordAnswerFirst();
+ while( !recordAnswerEOF() )
+ {
+ if( getAnswerValue() )
+ {
+ QDomElement domELEMENT = doc.createElement( "true" );
+ if( getAnswerPoints() > 0 ) domELEMENT.setAttribute("points", getAnswerPoints() );
+ QDomText DATAelement = doc.createTextNode( getAnswer( AF_TEXT ) );
+ question.appendChild( domELEMENT );
+ domELEMENT.appendChild( DATAelement );
+ } else {
+// insertXML( doc, question, "false", getAnswer( AF_text ) );
+ QDomElement domELEMENT = doc.createElement( "false" );
+ if( getAnswerPoints() > 0 ) domELEMENT.setAttribute("points", getAnswerPoints() );
+ QDomText DATAelement = doc.createTextNode( getAnswer( AF_TEXT ) );
+ question.appendChild( domELEMENT );
+ domELEMENT.appendChild( DATAelement );
+ }
+ recordAnswerNext();
+ };
+
+ if( !getQuestion( QF_TIP ).isEmpty() ) insertXML( doc, question, "tip", getQuestion( QF_TIP ) );
+ if( !getQuestion( QF_EXPLAIN ).isEmpty() ) insertXML( doc, question, "explain", getQuestion( QF_EXPLAIN ) );
+
+ NodeData.appendChild( question );
+ recordNext();
+ }
+
+ doc.save( stream, 4);
+ buffer.close();
+ if ( saveCompressed )
+ file.writeBlock(qCompress(data));
+ else
+ file.writeBlock(data);
+ file.close();
+
+ if( copyimages == true && copyJOB.count() > 0 )
+ {
+ KURL::List KurlLIST( copyJOB );
+ KIO::CopyJob *copyjob;
+
+ copyjob = KIO::copy( KurlLIST, KURL( _currentURL.directory(false,true) ), true);
+ }
+ _changed=false;
+ return true;
+
+}
+
+/** Save results */
+bool FileRead::saveResults( const KURL &url, const QString &results )
+{
+ if (url.isValid())
+ {
+ _currentURL = url;
+ }
+ kdDebug()<<"FileRead::saveResults() to "<<_currentURL.url()<<endl;
+ // Local file
+ if ( _currentURL.isLocalFile() )
+ {
+ if ( _tmpfile != 0 ) // get rid of a possible temp file first
+ { // (happens if previous _currentURL was remote)
+ _tmpfile->unlink();
+ delete _tmpfile;
+ _tmpfile = 0;
+ }
+ if( saveResults(_currentURL.path(), results) ) {
+ emit completed();
+ emit setWindowCaption( _currentURL.prettyURL() );
+ return true;
+ }
+ }
+ else
+ { // Remote file
+ // We haven't saved yet, or we did but locally - provide a temp file
+ if ( _tmpfile == 0 )
+ {
+ _tmpfile = new KTempFile;
+ }
+ // otherwise, we already had a temp file
+ if( saveResults(_tmpfile->name(), results) ) {
+ // upload the file
+ KIO::Job * job = KIO::file_copy( KURL::fromPathOrURL( _tmpfile->name() ), _currentURL, -1, true /*overwrite*/ );
+ connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotUploadFinished (KIO::Job *) ) );
+ return true;
+ }
+ }
+
+ // Save local file and upload local file
+ return false;
+}
+
+bool FileRead::saveResults( const QString &filename, const QString &results )
+{
+ QTextStream stream;
+ QFile file(filename);
+ QStringList copyJOB;
+
+ stream.setDevice(&file);
+
+ if(!file.open(IO_WriteOnly))
+ {
+ // Cannot open
+ return false;
+ }
+ stream << results;
+ file.close();
+ return true;
+}
+
+/** Insert xml format data */
+void FileRead::insertXML( QDomDocument &doc, QDomElement &parent, const QString &tagName, const QString &data)
+{
+ QDomElement domELEMENT = doc.createElement( tagName );
+ QDomText DATAelement = doc.createTextNode( data );
+
+ parent.appendChild( domELEMENT );
+ domELEMENT.appendChild( DATAelement );
+}
+
+/** Insert xml data format */
+void FileRead::insertXML( QDomDocument &doc, QDomElement &parent, const QString &data)
+{
+ QDomText DATAelement = doc.createTextNode( data );
+ parent.appendChild( DATAelement );
+}
+
+/** Get Header */
+QString FileRead::getHeader(const QString &head)
+{
+ return _header[head];
+}
+
+/** Set header data */
+void FileRead::setHeader( const QString field, const QString value)
+{
+ _changed = _header[field]!=value;
+
+ if( (_header[field]).isEmpty() )
+ _header.insert( field, value );
+ else
+ _header.replace( field, value );
+}
+
+/** is Multi Answer */
+bool FileRead::isMultiAnswer()
+{
+ int numOKanswer = 0;
+
+ recordAnswerFirst();
+
+ while( !recordAnswerEOF() )
+ {
+ if( (*(*_recordQuestions).recordAnswers).value == true ) numOKanswer++;
+ recordAnswerNext();
+ }
+
+ if( numOKanswer > 1 ) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/** is Multi Answer */
+bool FileRead::isResult()
+{
+ return _listResults.count() > 0 ? true : false;
+}
+
+void FileRead::slotUploadFinished( KIO::Job * job )
+{
+ if (job->error()) {
+ emit canceled( job->errorString() );
+ kdDebug()<< "FileRead::slotUploadFinished(): " <<job->errorString()<<endl;
+ }
+ else
+ {
+ if ( _tmpfile!=0 ) // We're finished with this document -> remove temp file
+ {
+ _tmpfile->unlink();
+ delete _tmpfile;
+ _tmpfile=0;
+ }
+ emit setWindowCaption( _currentURL.prettyURL() );
+ emit completed();
+ }
+}
+
+/** Record at index */
+void FileRead::recordAt( uint index )
+{
+ _recordQuestions = _listQuestions.begin();
+ for( unsigned int i = 0; i < index; ++i)
+ ++_recordQuestions;
+}
+
+/** Total questions */
+uint FileRead::getTotalQuestions()
+{
+ return _totalQuestions;
+}
+
+/** Total points */
+uint FileRead::getTotalPoints()
+{
+ return _totalPoints;
+}
+
+/** Total time */
+uint FileRead::getTotalTime()
+{
+ return _totalTime;
+}
+
+/** Refresh stadistical data - Points, number questions and total points */
+void FileRead::refreshData()
+{
+ _totalTime = 0;
+ _totalPoints = 0;
+ _totalQuestions = 0;
+
+ _recordQuestions = _listQuestions.begin();
+ while ( _recordQuestions != _listQuestions.end() )
+ {
+ _totalQuestions++;
+ _totalPoints += (*_recordQuestions).points;
+ _totalTime += (*_recordQuestions).time;
+ ++_recordQuestions;
+ }
+}
+
+#include "fileread.moc"
diff --git a/keduca/libkeduca/fileread.h b/keduca/libkeduca/fileread.h
new file mode 100644
index 00000000..3dc82a0b
--- /dev/null
+++ b/keduca/libkeduca/fileread.h
@@ -0,0 +1,274 @@
+/***************************************************************************
+ fileread.h - description
+ -------------------
+ begin : Wed May 23 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 FILEREAD_H
+#define FILEREAD_H
+
+#include <kio/job.h>
+
+#include <qdom.h>
+
+// forward declarations
+class KTempFile;
+
+class QFile;
+
+/**File Read operations. This class read a keduca file an pass the records.
+ *@author Javier Campos
+ *@author Klas Kalass
+ */
+
+class FileRead : public QObject {
+ Q_OBJECT
+
+public:
+ FileRead( QObject *parent=0, const char *name=0 );
+ virtual ~FileRead();
+ enum QuestionField { QF_TEXT, QF_PICTURE, QF_POINTS, QF_TYPE, QF_TIME, QF_TIP, QF_EXPLAIN };
+ enum AnswerField { AF_TEXT, AF_VALUE, AF_POINT };
+ enum ResultField { RS_TEXT, RS_MIN, RS_MAX, RS_PICTURE };
+
+ /** Open keduca file. This function can open a remote or local url. */
+ bool openFile( const KURL &url );
+ /** Set value to questions fields */
+ void setQuestion( QuestionField field, const QString& text);
+ /** Set value to questions fields */
+ void setQuestion( QuestionField field, int value );
+ /** Set value to results fields */
+ void setResult( ResultField field, const QString& text);
+ /** Set value to results fields */
+ void setResult( ResultField field, int value );
+ /** Insert an answer field */
+ void setAnswer( const QString& text, bool value, int points=0);
+ /** Go to the Last Record */
+ void recordLast();
+ /** Go to the First record */
+ void recordFirst();
+ /** Go to the Last Record */
+ void recordResultLast();
+ /** Go to the First record */
+ void recordResultFirst();
+ /** Insert a blank question */
+ void insertQuestion();
+ /** Insert a blank result */
+ void insertResult();
+ /** Record Next */
+ void recordNext();
+ /** Record previous */
+ void recordPrevious();
+ /** Record Next */
+ void recordResultNext();
+ /** Record previous */
+ void recordResultPrevious();
+ /** Go to the Last Record */
+ void recordAnswerLast();
+ /** Go to the First record */
+ void recordAnswerFirst();
+ /** Record Next */
+ void recordAnswerNext();
+ /** Record previous */
+ void recordAnswerPrevious();
+ /** Move to record */
+ void recordAnswerAt( unsigned int index);
+ /** Record answer count */
+ unsigned int recordAnswerCount();
+ /** Get the value of the field question */
+ QString getQuestion( QuestionField field );
+ /** Get the value of the field questions in integer */
+ int getQuestionInt( QuestionField field );
+ /** Get Answer field */
+ QString getAnswer( AnswerField field );
+ /** Get answer field */
+ int getAnswerPoints();
+ /** Get Answer field */
+ bool getAnswerValue();
+ /** Get the value of the field result */
+ QString getResult( ResultField field );
+ /** Get the value of the field result */
+ int getResultInt( ResultField field );
+ /** Returns if this record is a begin of file */
+ bool recordBOF();
+ /** Returns if this record is a end of file */
+ bool recordEOF();
+ /** Returns if this record is a begin of file */
+ bool recordResultBOF();
+ /** Returns if this record is a end of file */
+ bool recordResultEOF();
+ /** Returns if this record is a begin of file */
+ bool recordAnswerBOF();
+ /** Returns if this record is a end of file */
+ bool recordAnswerEOF();
+ /** Clear answers */
+ void clearAnswers();
+ /** Delete current record */
+ void recordDelete();
+ /** Swap two variables */
+ void recordSwap( bool );
+ /** Save file */
+ bool saveFile( const KURL &url = KURL(), bool copyimages = false, bool saveCompressed = true );
+ /** Save results */
+ bool saveResults( const KURL &url, const QString &results );
+ /** Get real picture */
+ QString getPicture();
+ /** Get real picture */
+ QPixmap getPicturePixmap();
+ /** Set header data */
+ void setHeader( const QString field, const QString value);
+ /** Get Header */
+ QString getHeader(const QString &head);
+ /** is Multi Answer */
+ bool isMultiAnswer();
+ /** is Result */
+ bool isResult();
+ KURL const &getCurrentURL()const{return _currentURL;}
+ /** @return true: The document has changed and should be saved*/
+ bool changed() {return _changed;}
+ /** Record at index */
+ void recordAt( uint index );
+ /** Refresh stadistical data - Points, number questions and total points */
+ void refreshData();
+ /* get total questions */
+ uint getTotalQuestions();
+ /* get total Points */
+ uint getTotalPoints();
+ /* get total Time */
+ uint getTotalTime();
+private:
+
+ // Private attributes
+
+ bool _changed;
+ /** List of General Variables of the header */
+ QMap<QString,QString> _header;
+
+ struct Answers
+ {
+ QString text;
+ bool value;
+ int points;
+ };
+
+ struct Results
+ {
+ QString text;
+ QString picture;
+ int min;
+ int max;
+ };
+
+ struct Questions
+ {
+ QString text;
+ int type;
+ QString picture;
+ int time;
+ int points;
+ QString tip;
+ QString explain;
+ QValueList<Answers> listAnswers;
+ QValueListIterator<Answers> recordAnswers;
+ };
+
+ /** List to Data struct */
+ QValueList<Questions> _listQuestions;
+ QValueListIterator<Questions> _recordQuestions;
+
+ QValueList<Results> _listResults;
+ QValueListIterator<Results> _recordResults;
+
+ /** Returns if the database finds End Of File */
+ bool _fileEOF;
+ /** Returns if the database finds Bof Of File */
+ bool _fileBOF;
+ /** Returns if the database finds End Of File */
+ bool _fileAnswerEOF;
+ /** Returns if the database finds Bof Of File */
+ bool _fileAnswerBOF;
+ /** Returns if the database finds End Of File */
+ bool _fileResultEOF;
+ /** Returns if the database finds Bof Of File */
+ bool _fileResultBOF;
+ /** Current url */
+ KURL _currentURL;
+ /** the temporary file to which the document is saved, NULL if no temporary file is needed */
+ KTempFile *_tmpfile;
+ /** the temporary image file */
+ QString _tmpfileImage;
+ /** Total Questions */
+ uint _totalQuestions;
+ /** Total Time */
+ uint _totalTime;
+ /** Total Points */
+ uint _totalPoints;
+
+ // Private methods
+
+ /** Insert xml format data */
+ void insertXML( QDomDocument &doc, QDomElement &parent, const QString &tagName, const QString &data);
+ /** Insert xml data format */
+ void insertXML( QDomDocument &doc, QDomElement &parent, const QString &data);
+
+protected:
+ /** Open keduca file. This function does the actual work and expects a local filename . */
+ bool loadFile( const QString &filename );
+ /** Save KEduca file to the file*/
+ bool saveFile( const QString &filename, bool copyimages, bool saveCompressed = true );
+ /** Save Results file to the file */
+ bool saveResults( const QString &filename, const QString &results );
+
+protected slots:
+ void slotUploadFinished( KIO::Job * job );
+
+signals:
+/* Stolen from kparts */
+
+ /**
+ * Emit this when you have completed loading data.
+ * Hosting apps will want to know when the process of loading the data
+ * is finished, so that they can access the data when everything is loaded.
+ **/
+ void completed();
+
+ /**
+ * Same as the above signal except besides indicating that the data has
+ * been completely loaded it also informs the host, by setting the flag,
+ * that a pending action has been generated as a result of completing the
+ * requested task (loading the data). An example of this is meta-refresh
+ * tags on HTML pages which result in the page either being refreshed or
+ * the viewer being redirected to another page. By emitting this signal
+ * after appropriately setting the flag, the part can tell the host of the
+ * pending scheduled action inorder to give it a chance to accept or cancel
+ * that action.
+ *
+ * @p pendingAction if true, a pending action exists (ex: a scheduled refresh)
+ */
+ void completed( bool pendingAction );
+
+ /**
+ * Emit this if loading is canceled by the user or by an error.
+ **/
+ void canceled( const QString &errMsg );
+
+ /**
+ * Emitted by the part, to set the caption of the window(s)
+ * hosting this part
+ */
+ void setWindowCaption( const QString & caption );
+
+};
+
+#endif
diff --git a/keduca/libkeduca/kgallerydialog.cpp b/keduca/libkeduca/kgallerydialog.cpp
new file mode 100644
index 00000000..0ab2d126
--- /dev/null
+++ b/keduca/libkeduca/kgallerydialog.cpp
@@ -0,0 +1,231 @@
+/***************************************************************************
+ kgallerydialog.cpp - description
+ -------------------
+ begin : mar abr 1 2003
+ copyright : (C) 2003 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. *
+ * *
+ ***************************************************************************/
+
+#include "kgallerydialog.h"
+#include "kgallerydialog.moc"
+
+#include <kdebug.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kio/netaccess.h>
+
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qsplitter.h>
+#include <qdom.h>
+#include <qfileinfo.h>
+
+KGalleryDialog::KGalleryDialog(QWidget *parent, const char *name )
+ :KGalleryDialogBase(parent,name)
+{
+ configRead();
+}
+
+KGalleryDialog::~KGalleryDialog()
+{
+}
+
+/** Open keduca file. This function can open a remote or local url. */
+bool KGalleryDialog::openFile(const KURL &url) {
+ QString tmpFile;
+ bool returnval=false;
+ if( KIO::NetAccess::download( url, tmpFile, this ) )
+ {
+ returnval=loadFile( tmpFile );
+ if (returnval) {
+ _currentURL = url;
+ kdDebug()<<"... load successful: "<<_currentURL.url()<<endl;
+ }
+
+ KIO::NetAccess::removeTempFile( tmpFile );
+ }else
+ kdDebug()<<"FileRead::openFile(): download NOT successful: "<<url.url()<<endl;
+
+ return returnval;
+}
+
+bool KGalleryDialog::loadFile( const QString &filename )
+{
+ QDomDocument doc("document.xml");
+
+ QFile file(filename);
+
+ if(!file.open(IO_ReadOnly))
+ {
+ return false;
+ }
+ doc.setContent( &file );
+
+ if( doc.doctype().name() != "educagallery" )
+ { return false; }
+
+ QDomElement docElem = doc.documentElement();
+ QDomNode n = docElem.firstChild();
+
+ kdDebug()<<"... load attributes: "<< docElem.tagName() <<endl;
+
+ QDomNodeList dnList = n.childNodes();
+ for( unsigned int i = 0; i < dnList.count(); ++i)
+ {
+ QListViewItem *newItem = new QListViewItem(listDocuments);
+ QDomElement serversNode = dnList.item(i).toElement();
+
+ kdDebug()<<"... load attributes: "<< serversNode.text() <<endl;
+
+ newItem->setText( 0, serversNode. text() );
+ newItem->setText( 1, serversNode.attribute( "language" ) );
+ newItem->setText( 2, serversNode.attribute( "category" ) );
+ newItem->setText( 3, serversNode.attribute( "type" ) );
+ newItem->setText( 4, serversNode.attribute( "author" ) );
+ newItem->setText( 5, serversNode.attribute( "address" ) );
+ newItem->setSelected(false);
+ }
+
+ file.close();
+
+ return true;
+}
+
+/** Read servers */
+void KGalleryDialog::configRead()
+{
+ KConfig *appconfig = KGlobal::config();
+ QStringList servers;
+ QStringList ipservers;
+ QStringList::Iterator it_ipservers;
+
+ appconfig->setGroup( "kgallerydialog" );
+ _split->setSizes( appconfig->readIntListEntry("Splitter_size") );
+ QSize defaultSize(500,400);
+ resize( appconfig->readSizeEntry("Geometry", &defaultSize ) );
+
+ appconfig->setGroup("Galleries Servers");
+ servers = appconfig->readListEntry ( "Servers" );
+ ipservers = appconfig->readListEntry ( "ServersIP" );
+
+ if( ipservers.count() == 0 )
+ {
+ servers.append( "KEduca Main Server" );
+ ipservers.append( "http://keduca.sourceforge.net/gallery/gallery.edugallery" );
+ }
+
+ it_ipservers=ipservers.begin();
+ for ( QStringList::Iterator it_servers = servers.begin(); it_servers != servers.end(); ++it_servers )
+ {
+ QListViewItem *newItem = new QListViewItem(listServers);
+ newItem->setText(0,*it_servers);
+ newItem->setText(1,*it_ipservers);
+ newItem->setSelected(false);
+ ++it_ipservers;
+ }
+}
+
+/** Write servers lists */
+void KGalleryDialog::configWrite()
+{
+ QStringList servers;
+ QStringList ipservers;
+ KConfig *config = KGlobal::config();
+
+ config->setGroup( "kgallerydialog" );
+ config->writeEntry("Splitter_size", _split->sizes() );
+ config->writeEntry("Geometry", size() );
+ config->sync();
+
+ config->setGroup("Galleries Servers");
+ QListViewItem *item = listServers->firstChild();
+ while (item) {
+ servers.append( item->text(0) );
+ ipservers.append( item->text(1) );
+ item = item->nextSibling();
+ }
+ config->writeEntry("Servers", servers);
+ config->writeEntry("ServersIP", ipservers);
+
+ config->sync();
+}
+
+/** No descriptions */
+void KGalleryDialog::slotButtonAdd()
+{
+ if( (lineName->text()).isEmpty() || (lineAddress->text()).isEmpty() )
+ {
+ KMessageBox::sorry(this, i18n("You need to specify a server!"));
+ return;
+ }
+
+ QListViewItem *newItem = new QListViewItem(listServers);
+ newItem->setText(0,lineName->text());
+ newItem->setText(1,lineAddress->text());
+ newItem->setSelected(false);
+}
+
+/** Open selected document */
+void KGalleryDialog::accept()
+{
+ if (getURL().isEmpty())
+ KMessageBox::sorry(this, i18n("You need to specify the file to open!"));
+ else
+ {
+ configWrite();
+ KGalleryDialogBase::accept();
+ }
+// done( QDialog::Accepted );
+}
+
+/** Select Server */
+void KGalleryDialog::slotServerSelected( QListViewItem *item )
+{
+ if (!item)
+ return;
+
+ KURL url_server = KURL( item->text(1) );
+
+ listDocuments->clear();
+ openFile( url_server );
+}
+
+/** Get keduca test url */
+KURL KGalleryDialog::getURL()
+{
+ QListViewItem *item = listDocuments->currentItem();
+
+ if (!item)
+ return KURL();
+
+ QString urlAddress = item->text(5);
+
+ if( _currentURL.isLocalFile() && !KURL(urlAddress).isValid() )
+ {
+ if( !QFileInfo(urlAddress).exists() )
+ urlAddress = _currentURL.directory(false,true) + urlAddress;
+ kdDebug()<< "Imagen en local" <<endl;
+ } else if( !_currentURL.isLocalFile() && !KURL(urlAddress).isValid() )
+ urlAddress = _currentURL.protocol() + "://" + _currentURL.host() + _currentURL.directory(false,true) + urlAddress;
+
+ kdDebug()<< urlAddress <<endl;
+ return KURL( urlAddress );
+}
+
+/** Add url */
+void KGalleryDialog::putURL(const KURL &urlFile)
+{
+ QListViewItem *newItem = new QListViewItem(listServers);
+ newItem->setText( 1, urlFile.url() );
+ newItem->setSelected(false);
+}
diff --git a/keduca/libkeduca/kgallerydialog.h b/keduca/libkeduca/kgallerydialog.h
new file mode 100644
index 00000000..a662bde6
--- /dev/null
+++ b/keduca/libkeduca/kgallerydialog.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ kgallerydialog.h - description
+ -------------------
+ begin : mar abr 1 2003
+ copyright : (C) 2003 by javi
+ email : javi@recibos
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 KGALLERYDIALOG_H
+#define KGALLERYDIALOG_H
+
+#include "kgallerydialogbase.h"
+
+#include <kurl.h>
+// #include <kio/global.h>
+// #include <kio/job.h>
+
+/**Gallery
+ *@author Javier Campos
+ */
+
+// forward declarations
+class KTempFile;
+
+namespace KIO { class Job; }
+
+class KGalleryDialog : public KGalleryDialogBase {
+ Q_OBJECT
+public:
+ KGalleryDialog(QWidget *parent=0, const char *name=0);
+ ~KGalleryDialog();
+ /** Open keduca file. This function can open a remote or local url. */
+ bool openFile( const KURL &url );
+ /** Get keduca test url */
+ KURL getURL();
+ /** Add url */
+ void putURL(const KURL &urlFile);
+protected slots: // Private slots
+ /** No descriptions */
+ void slotButtonAdd();
+ /** Open selected document */
+ void accept();
+ /** Select Server */
+ void slotServerSelected( QListViewItem *item );
+protected:
+ /** Open keduca file. This function does the actual work and expects a local filename . */
+ bool loadFile( const QString &filename );
+private: // Private attributes
+ /** Current url */
+ KURL _currentURL;
+ /** The temporary file to which the document is saved, NULL if no temporary file is needed */
+ KTempFile *_tmpfile;
+private: // Private methods
+ /** Read servers */
+ void configRead();
+ /** Write servers lists */
+ void configWrite();
+ /** Init gui settings */
+};
+
+#endif
diff --git a/keduca/libkeduca/kgallerydialogbase.ui b/keduca/libkeduca/kgallerydialogbase.ui
new file mode 100644
index 00000000..ccd51e46
--- /dev/null
+++ b/keduca/libkeduca/kgallerydialogbase.ui
@@ -0,0 +1,370 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KGalleryDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KGalleryDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>657</width>
+ <height>400</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Gallery</string>
+ </property>
+ <property name="focusPolicy">
+ <enum>TabFocus</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>lineName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Address:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>lineAddress</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonAdd</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Add Server</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>_split</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Servers</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Address</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listServers</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Language</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Category</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Author</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Address</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listDocuments</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOpen</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Open</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonAdd</sender>
+ <signal>clicked()</signal>
+ <receiver>KGalleryDialogBase</receiver>
+ <slot>slotButtonAdd()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KGalleryDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonOpen</sender>
+ <signal>clicked()</signal>
+ <receiver>KGalleryDialogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>listServers</sender>
+ <signal>selectionChanged(QListViewItem*)</signal>
+ <receiver>KGalleryDialogBase</receiver>
+ <slot>slotServerSelected(QListViewItem*)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotButtonAdd()</slot>
+ <slot>slotServerSelected(QListViewItem*)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/keduca/resources/Makefile.am b/keduca/resources/Makefile.am
new file mode 100644
index 00000000..56208d45
--- /dev/null
+++ b/keduca/resources/Makefile.am
@@ -0,0 +1,27 @@
+SUBDIRS = pics icons
+EXTRA_DIST = keduca.desktop keducabuilder.desktop x-edu.desktop x-edugallery.desktop
+
+KDE_ICON = AUTO
+
+# this 10 paths are KDE specific. Use them:
+# kde_htmldir Where your docs should go to. (contains lang subdirs)
+# kde_appsdir Where your application file (.kdelnk) should go to.
+# kde_icondir Where your icon should go to.
+# kde_minidir Where your mini icon should go to.
+# kde_datadir Where you install application data. (Use a subdir)
+# kde_locale Where translation files should go to.(contains lang subdirs)
+# kde_cgidir Where cgi-bin executables should go to.
+# kde_confdir Where config files should go to.
+# kde_mimedir Where mimetypes should go to.
+# kde_toolbardir Where general toolbar icons should go to.
+# kde_wallpaperdir Where general wallpapers should go to.
+
+# set the include path for X, qt and KDE
+INCLUDES= $(all_includes)
+
+METASOURCES = AUTO
+
+appmimedir = $(kde_mimedir)/application
+appmime_DATA = x-edu.desktop x-edugallery.desktop
+
+xdg_apps_DATA = keduca.desktop keducabuilder.desktop
diff --git a/keduca/resources/hi128-app-keduca.png b/keduca/resources/hi128-app-keduca.png
new file mode 100644
index 00000000..c68d0633
--- /dev/null
+++ b/keduca/resources/hi128-app-keduca.png
Binary files differ
diff --git a/keduca/resources/hi16-app-keduca.png b/keduca/resources/hi16-app-keduca.png
new file mode 100644
index 00000000..3e53bba5
--- /dev/null
+++ b/keduca/resources/hi16-app-keduca.png
Binary files differ
diff --git a/keduca/resources/hi22-app-keduca.png b/keduca/resources/hi22-app-keduca.png
new file mode 100644
index 00000000..1e653ae6
--- /dev/null
+++ b/keduca/resources/hi22-app-keduca.png
Binary files differ
diff --git a/keduca/resources/hi32-app-keduca.png b/keduca/resources/hi32-app-keduca.png
new file mode 100644
index 00000000..e6c9c36b
--- /dev/null
+++ b/keduca/resources/hi32-app-keduca.png
Binary files differ
diff --git a/keduca/resources/hi48-app-keduca.png b/keduca/resources/hi48-app-keduca.png
new file mode 100644
index 00000000..38747719
--- /dev/null
+++ b/keduca/resources/hi48-app-keduca.png
Binary files differ
diff --git a/keduca/resources/hi64-app-keduca.png b/keduca/resources/hi64-app-keduca.png
new file mode 100644
index 00000000..f5fdaecf
--- /dev/null
+++ b/keduca/resources/hi64-app-keduca.png
Binary files differ
diff --git a/keduca/resources/icons/Makefile.am b/keduca/resources/icons/Makefile.am
new file mode 100644
index 00000000..cf1a0540
--- /dev/null
+++ b/keduca/resources/icons/Makefile.am
@@ -0,0 +1,5 @@
+
+keducadir= $(kde_datadir)/keduca/icons
+keduca_ICON = AUTO
+
+
diff --git a/keduca/resources/icons/cr16-action-addquestion.png b/keduca/resources/icons/cr16-action-addquestion.png
new file mode 100644
index 00000000..7660c587
--- /dev/null
+++ b/keduca/resources/icons/cr16-action-addquestion.png
Binary files differ
diff --git a/keduca/resources/icons/cr16-action-control.png b/keduca/resources/icons/cr16-action-control.png
new file mode 100644
index 00000000..78dc1dc7
--- /dev/null
+++ b/keduca/resources/icons/cr16-action-control.png
Binary files differ
diff --git a/keduca/resources/icons/cr16-action-delquestion.png b/keduca/resources/icons/cr16-action-delquestion.png
new file mode 100644
index 00000000..81a655fc
--- /dev/null
+++ b/keduca/resources/icons/cr16-action-delquestion.png
Binary files differ
diff --git a/keduca/resources/icons/cr16-action-editquestion.png b/keduca/resources/icons/cr16-action-editquestion.png
new file mode 100644
index 00000000..c7924d73
--- /dev/null
+++ b/keduca/resources/icons/cr16-action-editquestion.png
Binary files differ
diff --git a/keduca/resources/icons/cr22-action-addquestion.png b/keduca/resources/icons/cr22-action-addquestion.png
new file mode 100644
index 00000000..cb3dd32c
--- /dev/null
+++ b/keduca/resources/icons/cr22-action-addquestion.png
Binary files differ
diff --git a/keduca/resources/icons/cr22-action-control.png b/keduca/resources/icons/cr22-action-control.png
new file mode 100644
index 00000000..f5b6313d
--- /dev/null
+++ b/keduca/resources/icons/cr22-action-control.png
Binary files differ
diff --git a/keduca/resources/icons/cr22-action-delquestion.png b/keduca/resources/icons/cr22-action-delquestion.png
new file mode 100644
index 00000000..27464b2e
--- /dev/null
+++ b/keduca/resources/icons/cr22-action-delquestion.png
Binary files differ
diff --git a/keduca/resources/icons/cr22-action-editquestion.png b/keduca/resources/icons/cr22-action-editquestion.png
new file mode 100644
index 00000000..c52a2e11
--- /dev/null
+++ b/keduca/resources/icons/cr22-action-editquestion.png
Binary files differ
diff --git a/keduca/resources/keduca.desktop b/keduca/resources/keduca.desktop
new file mode 100644
index 00000000..2bcb5612
--- /dev/null
+++ b/keduca/resources/keduca.desktop
@@ -0,0 +1,135 @@
+[Desktop Entry]
+GenericName=Tests & Exams
+GenericName[af]=Toetse & Eksamens
+GenericName[ar]=الاختبارات والامتحانات
+GenericName[be]=Тэсты і экзамены
+GenericName[bg]=Тестове и изпити
+GenericName[bn]=পরীক্ষা
+GenericName[bs]=Testovi i ispiti
+GenericName[ca]=Proves i exàmens
+GenericName[cs]=Testy a zkoušky
+GenericName[csb]=Testë ë Ekzaminë
+GenericName[cy]=Arbrofion ac Arholiadau
+GenericName[da]=Test & eksaminer
+GenericName[de]=Tests und Prüfungen
+GenericName[el]=Τεστ & Eξετάσεις
+GenericName[eo]=Testoj kaj ekzamenoj
+GenericName[es]=Pruebas y exámenes
+GenericName[et]=Testid ja eksamid
+GenericName[eu]=Testak eta azterketak
+GenericName[fa]=آزمون و امتحان
+GenericName[fi]=Testit ja kokeet
+GenericName[fo]=Royndir
+GenericName[fr]=Tests et examens
+GenericName[ga]=Teisteanna agus Scrúduithe
+GenericName[gl]=Tests e Exames
+GenericName[he]=מבחנים
+GenericName[hi]=जाँच व परीक्षा
+GenericName[hr]=Provjere i ispiti
+GenericName[hu]=Tesztkészítő
+GenericName[is]=Verkefni & Próf
+GenericName[it]=Prove ed esami
+GenericName[ja]=テスト & 試験
+GenericName[ka]=ტესტები და გამოცდები
+GenericName[km]=ការ​ប្រលង និង​សាកល្បង
+GenericName[lt]=Testai ir egzaminai
+GenericName[lv]=Testi & Eksāmeni
+GenericName[mk]=Тестови и испити
+GenericName[mn]=Тест ба Шалгалт
+GenericName[ms]=Ujian dan Peperiksaan
+GenericName[nb]=Prøver og eksamener
+GenericName[nds]=Pröven un Examens
+GenericName[ne]=परीक्षण र जाँच
+GenericName[nl]=Toetsen & examens
+GenericName[nn]=Testar og prøvar
+GenericName[nso]=Meleko & Dithlahlobo
+GenericName[pa]=ਟੈਸਟ ਅਤੇ ਪ੍ਰੀਖਿਆ
+GenericName[pl]=Testy i egzaminy
+GenericName[pt]=Testes & Exames
+GenericName[pt_BR]=Testes e exames
+GenericName[ru]=Экзаменатор KDE
+GenericName[se]=Geahččaleamit ja eksamenat
+GenericName[sk]=Testy a skúšky
+GenericName[sl]=Preizkusi in izpiti
+GenericName[sr]=Тестови и испити
+GenericName[sr@Latn]=Testovi i ispiti
+GenericName[sv]=Prov och examen
+GenericName[ta]=சோதனைகளும் தேர்வுகளும்
+GenericName[tg]=Санҷиш ва Имтиҳон
+GenericName[tr]=Sınavlar ve Testler
+GenericName[uk]=Тести та екзамени
+GenericName[ven]=linga & Mulingo
+GenericName[vi]=Kiểm tra & Thi
+GenericName[xh]=Uvavanyo Nemviwo
+GenericName[zh_CN]=测验和考试
+GenericName[zh_TW]=測驗與考試
+GenericName[zu]=Izivivinyo kanye Nokubhalwa kwezivivinyo
+Comment=KDE Tests & Exams Program
+Comment[be]=Праграма KDE для тэставання і экзаменаў
+Comment[bg]=Тестове и изпити
+Comment[bn]=কে.ডি.ই. উপস্থাপিত পরীক্ষা নেওয়ার প্রোগ্রাম
+Comment[bs]=KDE program za testove i ispite
+Comment[ca]=Programa de proves i exàmens per a KDE
+Comment[cs]=KDE program pro testování a zkoušení
+Comment[csb]=Programa do testów ë ekzaminów
+Comment[da]=Test- og eksamensprogram for KDE
+Comment[de]=KDE Test- und Prüfungsprogramm
+Comment[el]=Πρόγραμμα εξετάσεων και ελέγχων του KDE
+Comment[eo]=KDE Testa kaj ekzamena programo
+Comment[es]=Programa de exámenes y pruebas de KDE
+Comment[et]=KDE testide ja eksamite programm
+Comment[eu]=KDE testak eta azterketak programa
+Comment[fa]=آزمونهای KDE و برنامۀ امتحانها
+Comment[fi]=KDE Testaus- ja koeohjelma
+Comment[fr]=Programme de tests et d'examens de KDE
+Comment[ga]=Clár Scrúduithe KDE
+Comment[gl]=Programa de Tests e Exame para KDE
+Comment[he]=תוכנת מבחנים ובחנים של KDE
+Comment[hr]=KDE programi za provjeravanje i ispitivanje
+Comment[hu]=Teszt- és vizsgakészítő program
+Comment[is]=KDE prófa- & þrautaleikur
+Comment[it]=Prove ed esami per KDE
+Comment[ja]=KDE テスト & 試験
+Comment[ka]=KDE ტესტებისა და გამოცდების პროგრამა
+Comment[km]=កម្មវិធី​ប្រលង និង​សាកល្បង
+Comment[lt]=KDE testų ir egzaminų programa
+Comment[nb]=KDE-program for prøver og eksamener
+Comment[nds]=Prööv- un Examenprogramm vun KDE
+Comment[ne]=KDE परीक्षण र जाँच कार्यक्रम
+Comment[nl]=KDE-programma voor tests en examens
+Comment[nn]=Testar og prøvar for KDE
+Comment[pa]=KDE ਟੈਸਟ ਅਤੇ ਪਰੀਖਿਆ ਪਰੋਗਰਾਮ
+Comment[pl]=Program do testów i egzaminów dla KDE
+Comment[pt]=Programa de Testes & Exames do KDE
+Comment[pt_BR]=Programa do KDE de testes & exames
+Comment[ru]=Простая программа для проведения тестов
+Comment[sk]=KDE testovacie a skúšacie programy
+Comment[sl]=Program za izdelavo testov
+Comment[sr]=KDE програм за тестове и испите
+Comment[sr@Latn]=KDE program za testove i ispite
+Comment[sv]=Prov- och examenprogram för KDE
+Comment[tr]=KDE Testleri & Sınav Programı
+Comment[uk]=Програма для тестів та екзаменів
+Comment[vi]=Chương trình Kiểm tra & Thi KDE
+Comment[zh_CN]=KDE 测验和考试程序
+Comment[zh_TW]=KDE 測驗與考試的程式
+Exec=keduca
+Icon=keduca
+MimeType=application/x-edu;application/x-edugallery;
+Name=KEduca
+Name[af]=Keduca
+Name[ar]=التعليم ك
+Name[bn]=কে-এডুকা
+Name[hi]=के-एज़ुका
+Name[mn]=КСургалт
+Name[ne]=केडीई इडु
+Name[pa]=ਕੇ-ਸਿੱਖਿਆ
+Name[sv]=Keduca
+Name[ta]=கேயுடியுகா
+Name[ven]=Pfunzo ya K
+DocPath=keduca/index.html
+Path=
+Terminal=false
+Type=Application
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;Education;
diff --git a/keduca/resources/keducabuilder.desktop b/keduca/resources/keducabuilder.desktop
new file mode 100644
index 00000000..4c83ada6
--- /dev/null
+++ b/keduca/resources/keducabuilder.desktop
@@ -0,0 +1,125 @@
+[Desktop Entry]
+GenericName=Tests & Exams Editor
+GenericName[af]=Toetse & Eksamens Redigeerder
+GenericName[ar]=محرّر اختبارات وامتحانات
+GenericName[be]=Рэдактар тэстаў і экзаменаў
+GenericName[bg]=Редактор на тестове и изпити
+GenericName[bn]=পরীক্ষা সম্পাদক
+GenericName[bs]=Editor testova i ispita
+GenericName[ca]=Editor de proves i exàmens
+GenericName[cs]=Editor pro testy a zkoušky
+GenericName[csb]=Editora testów ë ekzaminów
+GenericName[cy]=Golygydd Arbrofion ac Arholiadau
+GenericName[da]=Test- & eksamenseditor
+GenericName[de]=Editor für Tests und Prüfungen
+GenericName[el]=Επεξεργαστής τεστ & εξετάσεων
+GenericName[eo]=Testa kaj ekzamena redaktilo
+GenericName[es]=Editor de pruebas y exámenes
+GenericName[et]=Testide ja eksamite redaktor
+GenericName[eu]=Test eta azterketen editorea
+GenericName[fa]=ویرایشگر آزمون و امتحان
+GenericName[fi]=Testien ja kokeiden muokkain
+GenericName[fr]=Éditeur de tests et examens
+GenericName[ga]=Eagarthóir Teisteanna agus Scrúduithe
+GenericName[gl]=Editor de Tests e Exames
+GenericName[he]=עורך מבחנים
+GenericName[hi]=जाँच व परीक्षा संपादक
+GenericName[hr]=Uređivač provjera i ispita
+GenericName[hu]=Tesztszerkesztő
+GenericName[is]=Verkefna og prófa-ritill
+GenericName[it]=Editor di prove ed esami
+GenericName[ja]=テスト & 試験エディタ
+GenericName[ka]=ტესტებისა და გამოცდების რედაქტორი
+GenericName[km]=កម្មវិធី​និពន្ធ​ការ​ប្រលង និង​សាកល្បង
+GenericName[lt]=Testų ir egzaminų redaktorius
+GenericName[lv]=Testu & Eksāmenu Redaktors
+GenericName[mk]=Уредувач на Тестови и испити
+GenericName[mn]=Тест ба Шалгалтын-Засвар
+GenericName[ms]=Penyunting Ujian dan Peperiksaan
+GenericName[nb]=Redigerer for prøver og eksamener
+GenericName[nds]=Editor för Pröven un Examens
+GenericName[ne]=परीक्षण र जाँच सम्पादक
+GenericName[nl]=Toetsen- & examens-editor
+GenericName[nn]=Redigering av testar og prøvar
+GenericName[nso]=Mofetosi wa Diteko & Dihlahlobo
+GenericName[pa]=ਟੈਸਟ ਜਾਂ ਪਰੀਖਿਆ ਸੰਪਾਦਕ
+GenericName[pl]=Edytor testów i egzaminów
+GenericName[pt]=Editor de Testes & Exames
+GenericName[pt_BR]=Editor de testes e exames
+GenericName[ru]=Редактор тестов и экзаменов
+GenericName[se]=Doaimmat geahččalemiid ja eksameniid
+GenericName[sk]=Editor pre testy a skúšky
+GenericName[sl]=Urejevalnik preizkusov in izpitov
+GenericName[sr]=Уређивач за тестове и испите
+GenericName[sr@Latn]=Uređivač za testove i ispite
+GenericName[sv]=Prov- och examenseditor
+GenericName[ta]=சோதனைகள் மற்றும் தேர்வுகள் தொகுப்பான்
+GenericName[tg]=Таҳрири Санҷиш ва Имтиҳон
+GenericName[tr]=Sınav ve Test Düzenleyici
+GenericName[uk]=Редактор тестів та екзаменів
+GenericName[ven]=linga & Musengulusi wa mulingo
+GenericName[vi]=Trình soạn thảo Kiểm tra & Thi
+GenericName[xh]=Umhleli Wovavanyo Noviwo
+GenericName[zh_CN]=测验和试卷编辑器
+GenericName[zh_TW]=測試 & 考驗編輯器
+GenericName[zu]=Izivivinyo kanye Nomhleli wokubhalwa kokuvivinywa
+Exec=keducabuilder
+Icon=keduca
+MimeType=application/x-edu;application/x-edugallery;
+Name=KEduca-Editor
+Name[ar]=محرر التعليم ك
+Name[bg]=Редактор на KEduca
+Name[bn]=কে-এডুকা-সম্পাদক
+Name[br]=Aozer KEduca
+Name[cs]=Editor pro KEduca
+Name[csb]=Editora do programù KEduca
+Name[cy]=Golygydd KEduca
+Name[da]=KEduca-editor
+Name[el]=KEduca-επεξεργαστής
+Name[eo]=KEduca redaktilo
+Name[et]=KEduca redaktor
+Name[fa]=ویرایشگر KEduca
+Name[fi]=KEduca-editori
+Name[fr]=Éditeur de KEduca
+Name[gl]=Editor de KEduca
+Name[hi]=के-एज़ुका-संपादक
+Name[hr]=KEduca uređivač
+Name[hu]=KEducabuilder
+Name[is]=KEduca-Ritill
+Name[it]=Editor di KEduca
+Name[ja]=KEduca エディタ
+Name[ka]=KEduca რედაქტორი
+Name[km]=កម្មវិធី​និពន្ធ KEduca
+Name[lt]=KEduca redaktorius
+Name[lv]=KEduca-Redaktors
+Name[mk]=KEduca-Уредувач
+Name[mn]=КСургалтын-Засвар
+Name[ms]=Penyunting KEduca
+Name[nb]=KEduca-redigerer
+Name[ne]=केडीई एडु-सम्पादक
+Name[nn]=KEduca-redigering
+Name[pa]=ਕੇ-ਪ੍ਰੀਖਿਆ ਸੰਪਾਦਕ
+Name[pl]=Edytor do programu KEduca
+Name[pt]=Editor do KEduca
+Name[se]=KEduca-doaimmaheapmi
+Name[sk]=Editor pre KEduca
+Name[sl]=Urejevalnik KEduca
+Name[sr]=KEduca-уређивач
+Name[sr@Latn]=KEduca-uređivač
+Name[sv]=Keduca-editor
+Name[ta]=கேயிடியுகா-தொகுப்பான்
+Name[tg]=Муҳаррири KEduca
+Name[tr]=KEduca Düzenleyici
+Name[uk]=Редактор KEduca
+Name[ven]=Musengulusi wa pfunzo ya K
+Name[vi]=Trình soạn thảo KEduca
+Name[xh]=KEduca-Umhleli
+Name[zh_CN]=KEduca 编辑器
+Name[zh_TW]=KEduca-編輯器
+Name[zu]=Umhleli we-KEduca
+DocPath=keduca/index.html
+Path=
+Terminal=false
+Type=Application
+X-DCOP-ServiceType=Multi
+Categories=Qt;KDE;Education;
diff --git a/keduca/resources/pics/Makefile.am b/keduca/resources/pics/Makefile.am
new file mode 100644
index 00000000..142728a8
--- /dev/null
+++ b/keduca/resources/pics/Makefile.am
@@ -0,0 +1,4 @@
+pics_DATA = alert.png bk_frame.png clock.png default.png info.png keduca_init.png keduca_correct_64.png statistics.png keduca_incorrect_64.png
+picsdir = $(kde_datadir)/keduca/pics
+
+EXTRA_DIST = $(pics_DATA)
diff --git a/keduca/resources/pics/alert.png b/keduca/resources/pics/alert.png
new file mode 100644
index 00000000..84bedd2a
--- /dev/null
+++ b/keduca/resources/pics/alert.png
Binary files differ
diff --git a/keduca/resources/pics/bk_frame.png b/keduca/resources/pics/bk_frame.png
new file mode 100644
index 00000000..0c9bde32
--- /dev/null
+++ b/keduca/resources/pics/bk_frame.png
Binary files differ
diff --git a/keduca/resources/pics/clock.png b/keduca/resources/pics/clock.png
new file mode 100644
index 00000000..a12d3117
--- /dev/null
+++ b/keduca/resources/pics/clock.png
Binary files differ
diff --git a/keduca/resources/pics/default.png b/keduca/resources/pics/default.png
new file mode 100644
index 00000000..7c815c62
--- /dev/null
+++ b/keduca/resources/pics/default.png
Binary files differ
diff --git a/keduca/resources/pics/info.png b/keduca/resources/pics/info.png
new file mode 100644
index 00000000..a3428ae0
--- /dev/null
+++ b/keduca/resources/pics/info.png
Binary files differ
diff --git a/keduca/resources/pics/keduca_correct_64.png b/keduca/resources/pics/keduca_correct_64.png
new file mode 100644
index 00000000..f663cfa6
--- /dev/null
+++ b/keduca/resources/pics/keduca_correct_64.png
Binary files differ
diff --git a/keduca/resources/pics/keduca_incorrect_64.png b/keduca/resources/pics/keduca_incorrect_64.png
new file mode 100644
index 00000000..a493bd50
--- /dev/null
+++ b/keduca/resources/pics/keduca_incorrect_64.png
Binary files differ
diff --git a/keduca/resources/pics/keduca_init.png b/keduca/resources/pics/keduca_init.png
new file mode 100644
index 00000000..e233b358
--- /dev/null
+++ b/keduca/resources/pics/keduca_init.png
Binary files differ
diff --git a/keduca/resources/pics/statistics.png b/keduca/resources/pics/statistics.png
new file mode 100644
index 00000000..2311ee91
--- /dev/null
+++ b/keduca/resources/pics/statistics.png
Binary files differ
diff --git a/keduca/resources/x-edu.desktop b/keduca/resources/x-edu.desktop
new file mode 100644
index 00000000..2d88f6ab
--- /dev/null
+++ b/keduca/resources/x-edu.desktop
@@ -0,0 +1,75 @@
+[Desktop Entry]
+Comment=Edu Document
+Comment[af]=Edu Dokument
+Comment[ar]=مستند تعليمي
+Comment[be]=Дакумент Edu
+Comment[bg]=Документ на Edu
+Comment[bn]=শিক্ষামূলক ডকুমেন্ট
+Comment[br]=Teul Edu
+Comment[bs]=Edu dokument
+Comment[ca]=Document Edu
+Comment[cs]=Dokument Edu
+Comment[csb]=Dokùment Edu
+Comment[cy]=Dogfen Edu
+Comment[da]=Edu-dokument
+Comment[de]=Edu-Dokument
+Comment[el]=Έγγραφο edu
+Comment[eo]=Edu dokumento
+Comment[es]=Documento Edu
+Comment[et]=Edu-paketi dokument
+Comment[eu]=Edu dokumentua
+Comment[fa]=سند Edu
+Comment[fi]=Edu-asiakirja
+Comment[fo]=Undirvísingarskjal
+Comment[fr]=Document Edu
+Comment[ga]=Cáipéis Edu
+Comment[gl]=Documento Edu
+Comment[he]=מסמך Edu
+Comment[hi]=ईडीयू दस्तावेज़
+Comment[hr]=Edu dokument
+Comment[hu]=Edu dokumentum
+Comment[is]=Edu skjal
+Comment[it]=Documento Edu
+Comment[ja]=Edu ドキュメント
+Comment[ka]=Edu ტესტი
+Comment[km]=ឯកសារ​របស់ Edu
+Comment[lt]=Edu dokumentas
+Comment[lv]=Edu Dokuments
+Comment[mk]=Edu документ
+Comment[mn]=Сургалт
+Comment[ms]=Dokumen Edu
+Comment[nb]=Edu-dokument
+Comment[nds]=Edu-Dokment
+Comment[ne]=एडु कागजात
+Comment[nl]=Edu-document
+Comment[nn]=Edu-dokument
+Comment[nso]=Tokomane ya Edu
+Comment[pa]=ਪ੍ਰੀਖਿਆ ਦਸਤਾਵੇਜ਼
+Comment[pl]=Dokument Edu (z pakietu edukacyjnego)
+Comment[pt]=Documento Edu
+Comment[pt_BR]=Documento Edu
+Comment[ru]=Тест Edu
+Comment[se]=Edu-dokumeanta
+Comment[sk]=Dokument Edu
+Comment[sl]=Dokument Edu
+Comment[sr]=Edu документ
+Comment[sr@Latn]=Edu dokument
+Comment[sv]=Utbildningsdokument
+Comment[ta]=இடியு ஆவணம்
+Comment[tg]=Ҳуҷҷати Edu
+Comment[tr]=Edu Belgesi
+Comment[uk]=Документ Edu
+Comment[ven]=Manwalwa a pfunzo
+Comment[vi]=Tài liệu Giảng dạy
+Comment[xh]=Vocabulary Trainer Document
+Comment[zh_CN]=Edu 文档
+Comment[zh_TW]=Edu 文件
+Comment[zu]=Idokhumente ye Edu
+DefaultApp=keduca
+Icon=keduca
+Type=MimeType
+MimeType=application/x-edu
+Patterns=*.edu;
+[Property::X-KDE-NativeExtension]
+Type=QString
+Value=.edu
diff --git a/keduca/resources/x-edugallery.desktop b/keduca/resources/x-edugallery.desktop
new file mode 100644
index 00000000..45209c1d
--- /dev/null
+++ b/keduca/resources/x-edugallery.desktop
@@ -0,0 +1,67 @@
+[Desktop Entry]
+Comment=Edu Gallery Document
+Comment[af]=Edu Gallery Dokument
+Comment[ar]=مستند الصور التعليمي
+Comment[be]=Галерэя дакументаў Edu
+Comment[bg]=Документ на галерия на Edu
+Comment[bn]=শিক্ষামূলক গ্যালারী ডকুমেন্ট
+Comment[br]=Teul garidell Edu
+Comment[bs]=Edu Gallery dokument
+Comment[ca]=Galeria de documents Edu
+Comment[cs]=Dokument Edu-galerie
+Comment[csb]=Dokùment galerëji Edu
+Comment[cy]=Dogfen Oriel Edu
+Comment[da]=Edu galleridokument
+Comment[de]=Edu-Galerie-Dokument
+Comment[el]=Έγγραφο συλλογής edu
+Comment[eo]=Edu galerio dokumento
+Comment[es]=Documento de galería de Edu
+Comment[et]=Edu-paketi galerii dokument
+Comment[eu]=Edu galeria-dokumentua
+Comment[fa]=سند گالری Edu
+Comment[fi]=Edu-galleria-asiakirja
+Comment[fr]=Document de galerie éducative
+Comment[ga]=Cáipéis Edu Gallery
+Comment[gl]=Documento de Galeria Edu
+Comment[he]=מסמכים וגלריית לימודים
+Comment[hi]=ईडीयू गैलरी दस्तावेज़
+Comment[hr]=Dokument Edu galerije
+Comment[hu]=Edu Gallery dokumentum
+Comment[is]=Edu gallerýskjal
+Comment[it]=Documento galleria Edu
+Comment[ja]=Edu ギャラリードキュメント
+Comment[ka]=Edu ტესტების ნაკრები
+Comment[km]=ឯកសារ​វិចិត្រសាល​របស់ Edu
+Comment[lt]=Edu galerijos dokumentas
+Comment[lv]=Edu Galerijas Dokuments
+Comment[mk]=Edu Gallery документ
+Comment[ms]=Dokumen Galeri Edu
+Comment[nb]=Edu galleri-dokument
+Comment[nds]=Edu-Galeriedokment
+Comment[ne]=एडु ग्यालरी कागजात
+Comment[nl]=Edu Gallery-document
+Comment[nn]=Edu-galleridokument
+Comment[pl]=Dokument galerii Edu (z pakietu edukacyjnego)
+Comment[pt]=Documento da Galeria Edu
+Comment[pt_BR]=Documento da galeria Edu
+Comment[ru]=Набор тестов Edu
+Comment[sk]=Dokument galérie Edu
+Comment[sl]=Dokument galerije Edu
+Comment[sr]=Документ Edu галерије
+Comment[sr@Latn]=Dokument Edu galerije
+Comment[sv]=Utbildningsgalleridokument
+Comment[ta]=இடியு கூட ஆவணம்
+Comment[tg]=Долони Ҳуҷҷатҳои Таълимӣ
+Comment[tr]=Eğitim Galerisi Belgesi
+Comment[uk]=Документ галереї Edu
+Comment[vi]=Phòng trưng bày các Tài liệu Giảng dạy
+Comment[zh_CN]=Edu 库文档
+Comment[zh_TW]=Edu 文件
+DefaultApp=keduca
+Icon=keduca
+Type=MimeType
+MimeType=application/x-edugallery
+Patterns=*.edugallery;
+[Property::X-KDE-NativeExtension]
+Type=QString
+Value=.edugallery